sja1000.c File Reference


Detailed Description

Driver for SJA1000 CAN-Bus controller.

The SJA1000 controller is connected to the memory bus. It's base address and interrupt is set by NutRegisterDevice.

Have a look to our m-can board if you have questions.

Definition in file sja1000.c.

Go to the source code of this file.

Defines

#define SJA_SIGNAL   sig_INTERRUPT7
#define SJA_EICR   EICRB
#define SJA_SIGNAL_BIT   7
#define SJA_BASE   0x8800
#define CAN_BufSize   64

Typedefs

typedef struct _CANBuffer CANBuffer

Functions

void CANBufferInit (CANBuffer *buffer, uint16_t size)
CANFRAME CANBufferGetMutex (CANBuffer *buffer)
void CANBufferPutMutex (CANBuffer *buffer, CANFRAME *data)
CANFRAME CANBufferGet (CANBuffer *buffer)
void CANBufferPut (CANBuffer *buffer, CANFRAME *data)
uint16_t CANBufferFree (CANBuffer *buffer)
uint8_t SJARxAvail (NUTDEVICE *dev)
 checks if data is available in input buffer
uint8_t SJATxFree (NUTDEVICE *dev)
 checks if there's still space in output buffer
void SJAOutput (NUTDEVICE *dev, CANFRAME *frame)
 Write a frame from to output buffer.
uint8_t SJAInput (NUTDEVICE *dev, CANFRAME *frame)
 Reads a frame from input buffer.
void SJASetAccCode (NUTDEVICE *dev, uint8_t *ac)
 Sets the acceptance code.
void SJASetAccMask (NUTDEVICE *dev, uint8_t *am)
 Sets the acceptance mask.
uint8_t SJASetBaudrate (NUTDEVICE *dev, uint32_t baudrate)
 Sets the baudrate.
void SJATxFrame (CANFRAME *CAN_frame)
 Sends a CAN Frane.
void SJARxFrame (CANFRAME *CAN_frame)
 Receives a CAN Frane.
void CAN_Tx (void *arg)
 CAN transmitter thread.
int SJAInit (NUTDEVICE *dev)
 Initialize SJA1000 Canbus interface.

Variables

CANINFO dcb_sja1000
volatile uint16_t sja_base = 0x0000
CANBuffer CAN_RX_BUF
CANBuffer CAN_TX_BUF
IFCAN ifc_sja1000
 Interface information structure.
NUTDEVICE devSJA1000
 Device information structure.


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/