RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
grcan.h File Reference

Driver API for the GRLIB GRCAN and GRCANFD controllers. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  grcan_regs
 
struct  grcan_stats
 
struct  grcan_timing
 
struct  grcanfd_timing
 
struct  grcan_selection
 
struct  grcan_filter
 
struct  CANMsg
 
struct  CANFDMsg
 

Macros

#define GRCAN_FDOPT_NOM   0
 
#define GRCAN_FDOPT_FDBTR   0x01
 
#define GRCAN_FDOPT_FDFRM   0x02
 
#define GRCAN_FDMASK   (GRCAN_FDOPT_FDBTR | GRCAN_FDOPT_FDFRM)
 
#define GRCAN_CFG_ABORT   0x00000001
 
#define GRCAN_CFG_ENABLE0   0x00000002
 
#define GRCAN_CFG_ENABLE1   0x00000004
 
#define GRCAN_CFG_SELECTION   0x00000008
 
#define GRCAN_CFG_SILENT   0x00000010
 
#define GRCAN_CFG_BPR   0x00000300
 
#define GRCAN_CFG_RSJ   0x00007000
 
#define GRCAN_CFG_PS1   0x00f00000
 
#define GRCAN_CFG_PS2   0x000f0000
 
#define GRCAN_CFG_SCALER   0xff000000
 
#define GRCAN_CFG_BPR_BIT   8
 
#define GRCAN_CFG_RSJ_BIT   12
 
#define GRCAN_CFG_PS1_BIT   20
 
#define GRCAN_CFG_PS2_BIT   16
 
#define GRCAN_CFG_SCALER_BIT   24
 
#define GRCAN_CTRL_RESET   0x2
 
#define GRCAN_CTRL_ENABLE   0x1
 
#define GRCAN_TXCTRL_ENABLE   1
 
#define GRCAN_TXCTRL_ONGOING   1
 
#define GRCAN_RXCTRL_ENABLE   1
 
#define GRCAN_RXCTRL_ONGOING   1
 
#define GRCANFD_NBTR_SCALER   0x00ff0000
 
#define GRCANFD_NBTR_PS1   0x0000fc00
 
#define GRCANFD_NBTR_PS2   0x000003e0
 
#define GRCANFD_NBTR_SJW   0x0000001f
 
#define GRCANFD_NBTR_SCALER_BIT   16
 
#define GRCANFD_NBTR_PS1_BIT   10
 
#define GRCANFD_NBTR_PS2_BIT   5
 
#define GRCANFD_NBTR_SJW_BIT   0
 
#define GRCANFD_FDBTR_SCALER   0x00ff0000
 
#define GRCANFD_FDBTR_PS1   0x00003c00
 
#define GRCANFD_FDBTR_PS2   0x000001e0
 
#define GRCANFD_FDBTR_SJW   0x0000000f
 
#define GRCANFD_FDBTR_SCALER_BIT   16
 
#define GRCANFD_FDBTR_PS1_BIT   10
 
#define GRCANFD_FDBTR_PS2_BIT   5
 
#define GRCANFD_FDBTR_SJW_BIT   0
 
#define GRCAN_IRQ_IRQ   0
 
#define GRCAN_IRQ_TXSYNC   1
 
#define GRCAN_IRQ_RXSYNC   2
 
#define GRCAN_ERR_IRQ   0x1
 
#define GRCAN_OFF_IRQ   0x2
 
#define GRCAN_OR_IRQ   0x4
 
#define GRCAN_RXAHBERR_IRQ   0x8
 
#define GRCAN_TXAHBERR_IRQ   0x10
 
#define GRCAN_RXIRQ_IRQ   0x20
 
#define GRCAN_TXIRQ_IRQ   0x40
 
#define GRCAN_RXFULL_IRQ   0x80
 
#define GRCAN_TXEMPTY_IRQ   0x100
 
#define GRCAN_RX_IRQ   0x200
 
#define GRCAN_TX_IRQ   0x400
 
#define GRCAN_RXSYNC_IRQ   0x800
 
#define GRCAN_TXSYNC_IRQ   0x1000
 
#define GRCAN_RXERR_IRQ   0x2000
 
#define GRCAN_TXERR_IRQ   0x4000
 
#define GRCAN_RXMISS_IRQ   0x8000
 
#define GRCAN_TXLOSS_IRQ   0x10000
 
#define GRCAN_STAT_PASS   0x1
 
#define GRCAN_STAT_OFF   0x2
 
#define GRCAN_STAT_OR   0x4
 
#define GRCAN_STAT_AHBERR   0x8
 
#define GRCAN_STAT_ACTIVE   0x10
 
#define GRCAN_STAT_RXERRCNT   0xff00
 
#define GRCAN_STAT_TXERRCNT   0xff0000
 

Enumerations

enum  {
  GRCAN_RET_OK = 0 , GRCAN_RET_INVARG = -1 , GRCAN_RET_NOTSTARTED = -2 , GRCAN_RET_TIMEOUT = -3 ,
  GRCAN_RET_BUSOFF = -4 , GRCAN_RET_AHBERR = -5
}
 
enum  grcan_state { STATE_STOPPED = 0 , STATE_STARTED = 1 , STATE_BUSOFF = 2 , STATE_AHBERR = 3 }
 

Functions

int grcan_dev_count (void)
 
void * grcan_open (int dev_no)
 
void * grcan_open_by_name (char *name, int *dev_no)
 
int grcan_close (void *d)
 
int grcan_canfd_capable (void *d)
 
int grcan_read (void *d, CANMsg *msg, size_t count)
 
int grcanfd_read (void *d, CANFDMsg *msg, size_t count)
 
int grcan_write (void *d, CANMsg *msg, size_t count)
 
int grcanfd_write (void *d, CANFDMsg *msg, size_t ucount)
 
int grcan_get_state (void *d)
 
int grcan_start (void *d)
 
int grcan_stop (void *d)
 
int grcan_flush (void *d)
 
int grcan_set_silent (void *d, int silent)
 
int grcan_set_abort (void *d, int abort)
 
int grcan_set_selection (void *d, const struct grcan_selection *selection)
 
int grcan_set_speed (void *d, unsigned int hz)
 
int grcan_set_btrs (void *d, const struct grcan_timing *timing)
 
int grcanfd_set_speed (void *d, unsigned int nomhz, unsigned int fdhz)
 
int grcanfd_set_btrs (void *d, const struct grcanfd_timing *nominal, const struct grcanfd_timing *fd)
 
int grcan_set_rxblock (void *d, int block)
 
int grcan_set_txblock (void *d, int block)
 
int grcan_set_txcomplete (void *d, int complete)
 
int grcan_set_rxcomplete (void *d, int complete)
 
int grcan_get_stats (void *d, struct grcan_stats *stats)
 
int grcan_clr_stats (void *d)
 
int grcan_set_afilter (void *d, const struct grcan_filter *filter)
 
int grcan_set_sfilter (void *d, const struct grcan_filter *filter)
 
int grcan_get_status (void *d, unsigned int *status)
 
void grcan_register_drv (void)
 

Detailed Description

Driver API for the GRLIB GRCAN and GRCANFD controllers.