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 RX_MOB 8

#define ATCAN_RX_BUF_SIZE 64

#define CAN_BT1_10K 0x76

#define CAN_BT2_10K 0x2E

#define CAN_BT3_10K 0x2E

#define CAN_BT1_20K 0x4E

#define CAN_BT2_20K 0x2E

#define CAN_BT3_20K 0x16

#define CAN_BT1_50K 0x1C

#define CAN_BT2_50K 0x2E

#define CAN_BT3_50K 0x18

#define CAN_BT1_100K 0x0E

#define CAN_BT2_100K 0x2E

#define CAN_BT3_100K 0x16

#define CAN_BT1_125K 0x0A

#define CAN_BT2_125K 0x2E

#define CAN_BT3_125K 0x18

#define CAN_BT1_250K 0x04

#define CAN_BT2_250K 0x2E

#define CAN_BT3_250K 0x18

#define CAN_BT1_500K 0x02

#define CAN_BT2_500K 0x2C

#define CAN_BT3_500K 0x12

#define CAN_BT1_800K 0x00

#define CAN_BT2_800K 0x2E

#define CAN_BT3_800K 0x16

#define CAN_BT1_1M 0x00

#define CAN_BT2_1M 0x2C

#define CAN_BT3_1M 0x12


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 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

Local Variables

canRxBuf
static CANBuffer canRxBuf
Used in: AtCanInit()  
  AtCanInput()  
  AtCanInterrupt()  
  AtCanRxAvail()  

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 AtCanGetBusState()

* Returns the state of this CAN node. * Refer to state diagram in AT90CAN128 dataheet chapter 20.7 "Error * Management" * * @retval CAN_SUCCESS if CAN node is in ACTIVE state * @retval CAN_PASSIVE if CAN node is in PASSIVE state * @retval CAN_BUS_OFF if CAN node is in BUS OFF state

int8_t AtCanGetBusState ( void )


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
  NutHeapRootAlloc(), NutRegisterIrqHandler(), 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()

uint8_t AtCanInput ( NUTDEVICE* dev, CANFRAME* frame )
Calls: NutEventWait()
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()
Used in:   nut/arch/avr/dev/atcan.c

Global Function AtCanRxAvail()

uint8_t 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, uint8_t* 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, uint8_t* am )
Calls: AtCanEnableRx() nut/arch/avr/dev/atcan.c
  memcpy()
Used in:   nut/arch/avr/dev/atcan.c

Global Function AtCanSetBaudrate()

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

Global Function AtCanTxFree()

uint8_t 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