File nut/arch/avr/dev/atcan.c

* Definitions

References Functions: AtCanInit() nut/arch/avr/dev/atcan.c
  AtCanInput() nut/arch/avr/dev/atcan.c
  AtCanOutput() nut/arch/avr/dev/atcan.c
  AtCanRxAvail() nut/arch/avr/dev/atcan.c
  AtCanSetAccCode() nut/arch/avr/dev/atcan.c
  AtCanSetAccMask() nut/arch/avr/dev/atcan.c
  AtCanSetBaudrate() nut/arch/avr/dev/atcan.c
  AtCanTxFree() nut/arch/avr/dev/atcan.c
References Variables: dcb_atcan nut/arch/avr/dev/atcan.c
  ifc_atcan nut/arch/avr/dev/atcan.c

Included Files


Preprocessor definitions

#define MAX_NO_MOB 15

#define RX_MOB 8

#define CAN_BUF_SIZE 64

#define CAN_BT1_10K 0x76

#define CAN_BT2_10K 0x0E

#define CAN_BT3_10K 0x4B

#define CAN_BT1_20K 0x3A

#define CAN_BT2_20K 0x0E

#define CAN_BT3_20K 0x4B

#define CAN_BT1_50K 0x26

#define CAN_BT2_50K 0x08

#define CAN_BT3_50K 0x25

#define CAN_BT1_100K 0x12

#define CAN_BT2_100K 0x08

#define CAN_BT3_100K 0x25

#define CAN_BT1_125K 0x0A

#define CAN_BT2_125K 0x0C

#define CAN_BT3_125K 0x37

#define CAN_BT1_250K 0x04

#define CAN_BT2_250K 0x0C

#define CAN_BT3_250K 0x37

#define CAN_BT1_500K 0x02

#define CAN_BT2_500K 0x08

#define CAN_BT3_500K 0x25

#define CAN_BT1_800K 0x00

#define CAN_BT2_800K 0x0E

#define CAN_BT3_800K 0x25

#define CAN_BT1_1M 0x00

#define CAN_BT2_1M 0x08

#define CAN_BT3_1M 0x25


Type enum CAN_RESULT

* CAN result codes * * @ingroup can

enum CAN_RESULT

enum CAN_RESULT  
   {  
      CAN_SUCCESS;  
      CAN_TXBUF_FULL;  
      CAN_RXBUF_EMPTY;  
      CAN_ILLEGAL_MOB;  
      CAN_INVALID_SPEED;  
   }  

Type struct _CANBuffer

struct _CANBuffer
struct _CANBuffer  
   {  
      CANFRAME* dataptr;  
      uint8_t size;  
      uint8_t datalength;  
      uint8_t dataindex;  
   }  

Typedef CANBuffer

typedef struct _CANBuffer CANBuffer
See: Type struct _CANBuffer

Global Variable canRxBuf

CANBuffer canRxBuf
Visible in:   nut/arch/avr/dev/atcan.c
Used in: AtCanInit() nut/arch/avr/dev/atcan.c
  AtCanInput() nut/arch/avr/dev/atcan.c
  AtCanInterrupt() nut/arch/avr/dev/atcan.c
  AtCanRxAvail() nut/arch/avr/dev/atcan.c

Global Variable dcb_atcan

CANINFO dcb_atcan
Visible in:   nut/arch/avr/dev/atcan.c
Used in:   nut/arch/avr/dev/atcan.c

Global Variable ifc_atcan

IFCAN ifc_atcan
Visible in:   nut/arch/avr/dev/atcan.c
Used in:   nut/arch/avr/dev/atcan.c
  AtCanInit() nut/arch/avr/dev/atcan.c

Global Variable devAtCan

NUTDEVICE devAtCan
Visible in:   nut/arch/avr/dev/atcan.c

Global Function AtCanEnableMsgObj()

* Configure a single message object for receiption. * * @param mob Message object index (0-14) * @param id Acceptance code * @param idIsExt Flag if acceptance code is extended (0 = standard, 1 = extended) * @param idRemTag Id's remote tag (0 or 1) * @param mask Acceptance mask * @param maskIsExt Flag if acceptance mask is extended (0 = standard, 1 = extended) * @param maskRemTag Mask's remote tag (0 or 1) * @return Result code. See @ref CAN_RESULT

int8_t AtCanEnableMsgObj ( uint8_t mob, uint32_t id, int8_t idIsExt, int8_t idRemTag, uint32_t mask, int8_t maskIsExt, int8_t maskRemTag )

Called by: AtCanEnableRx() nut/arch/avr/dev/atcan.c

Global Function AtCanEnableRx()

* Configure message objects for receiption. * * @param noOfMsgObjs Number of message objects used for receiption (1-14). * Message objects not configured for receiption are used for * transmission. * The same acceptance filter and mask is applied to the * message objects. * If it is required to set-up more complex * filtering mechanisms use canEnableMsgObj() instead, which * allows setting filters on a per message object basis. * @param id Acceptance code * @param idIsExt Flag if acceptance code is extended (0 = standard, 1 = extended) * @param idRemTag Id's remote tag (0 or 1) * @param mask Acceptance mask * @param maskIsExt Flag if acceptance mask is extended (0 = standard, 1 = extended) * @param maskRemTag Mask's remote tag (0 or 1) * @return Result code. See @ref CAN_RESULT

int8_t AtCanEnableRx ( uint8_t noOfMsgObjs, uint32_t id, int8_t idIsExt, int8_t idRemTag, uint32_t mask, int8_t maskIsExt, int8_t maskRemTag )

Calls: AtCanEnableMsgObj() nut/arch/avr/dev/atcan.c
Called by: AtCanInit() nut/arch/avr/dev/atcan.c
  AtCanSetAccCode() nut/arch/avr/dev/atcan.c
  AtCanSetAccMask() nut/arch/avr/dev/atcan.c

Global Function AtCanGetFreeMob()

* @internal * Search for a free message object * @return Index of free message object or -1 if none is available

int8_t AtCanGetFreeMob ( void )

Called by: AtCanSendMsg() nut/arch/avr/dev/atcan.c
  AtCanTxFree() nut/arch/avr/dev/atcan.c

Global Function AtCanInit()

int AtCanInit ( NUTDEVICE* dev )
Calls: AtCanEnableRx() nut/arch/avr/dev/atcan.c
  AtCanSetBaudrate() nut/arch/avr/dev/atcan.c
  NutHeapAlloc() nut/os/heap.c
  NutRegisterIrqHandler() nut/dev/ihndlr.c
  memset()
Used in:   nut/arch/avr/dev/atcan.c
References Functions: AtCanInterrupt() nut/arch/avr/dev/atcan.c
References Variables: canRxBuf nut/arch/avr/dev/atcan.c
  ifc_atcan nut/arch/avr/dev/atcan.c

Global Function AtCanInput()

void AtCanInput ( NUTDEVICE* dev, CANFRAME* frame )
Calls: NutEventWait() nut/os/event.c
Used in:   nut/arch/avr/dev/atcan.c
References Variables: canRxBuf nut/arch/avr/dev/atcan.c

Global Function AtCanOutput()

void AtCanOutput ( NUTDEVICE* dev, CANFRAME* frame )
Calls: AtCanSendMsg() nut/arch/avr/dev/atcan.c
  NutEventWait() nut/os/event.c
Used in:   nut/arch/avr/dev/atcan.c

Global Function AtCanRxAvail()

u_char AtCanRxAvail ( NUTDEVICE* dev )
Used in:   nut/arch/avr/dev/atcan.c
References Variables: canRxBuf nut/arch/avr/dev/atcan.c

Global Function AtCanSendMsg()

* Send a CAN message * * @param frame Container for CAN message to be sent * @return Result code. See @ref CAN_RESULT

int8_t AtCanSendMsg ( CANFRAME* frame )

Calls: AtCanGetFreeMob() nut/arch/avr/dev/atcan.c
Called by: AtCanOutput() nut/arch/avr/dev/atcan.c

Global Function AtCanSetAccCode()

void AtCanSetAccCode ( NUTDEVICE* dev, u_char* ac )
Calls: AtCanEnableRx() nut/arch/avr/dev/atcan.c
  memcpy()
Used in:   nut/arch/avr/dev/atcan.c

Global Function AtCanSetAccMask()

void AtCanSetAccMask ( NUTDEVICE* dev, u_char* am )
Calls: AtCanEnableRx() nut/arch/avr/dev/atcan.c
  memcpy()
Used in:   nut/arch/avr/dev/atcan.c

Global Function AtCanSetBaudrate()

u_char AtCanSetBaudrate ( NUTDEVICE* dev, u_long baudrate )
Called by: AtCanInit() nut/arch/avr/dev/atcan.c
Used in:   nut/arch/avr/dev/atcan.c

Global Function AtCanTxFree()

u_char AtCanTxFree ( NUTDEVICE* dev )
Calls: AtCanGetFreeMob() nut/arch/avr/dev/atcan.c
Used in:   nut/arch/avr/dev/atcan.c

Local Function AtCanInterrupt()

static void AtCanInterrupt ( void* arg )
Used in: AtCanInit() nut/arch/avr/dev/atcan.c
References Variables: canRxBuf nut/arch/avr/dev/atcan.c