Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

tini400_canbus.h File Reference


Detailed Description

CAN Bus Interrupt Driver for DS80C390 / 400.

This library provides an interrupt driven interface for the CAN peripherals on the DS80C390 / 400 Microcontorller. This driver allows applications to asynchronously transmit & receive CAN data while the applications perform other processing.

For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.

The CAN library consists of four sub modules:

Initialization module initializes the global data structures, message centers, transmit & receive buffers and interrupt handlers.

Configuration Module enables the application to configure the CAN peripheral and the individual message centers.

Data Access Module provides interface to application to transmit & receive data.

Interrupt handlers contains interrupt handlers for all CAN interrupts.

Go to the source code of this file.

Data Structures

struct  CanFrame
 CAN Frame structure. Denotes the structure of a Transmitted or received CAN frame. More...
struct  MCConfig
 CAN Message center configuration structure. Used for configuration of receive parameters of Message Centers. More...

Defines

#define TRUE   1
 TRUE.
#define FALSE   0
 FALSE.
#define TINI400_CANBUS_VERSION   3
#define CAN_ERROR_NOERROR   0
#define CAN_ERROR_GENERIC   -1
#define CAN_ERROR_BUSOFF   -2
#define CAN_ERROR_TIMEOUT   -3
#define CAN_ERROR_NOT_INITIALIZED   -4
#define CAN_ERROR_ARGUMENT   -5
#define CAN_ERROR_PORT_ENABLED   -6
#define CAN_ERROR_PORT_DISABLED   -7
#define CAN_ERROR_MC_ACTIVE   -8
#define CAN_ERROR_BIT_STUFF   -9
#define CAN_ERROR_FORMAT   -10
#define CAN_ERROR_TRANSMIT_NO_ACK   -11
#define CAN_ERROR_BIT_ONE   -12
#define CAN_ERROR_BIT_ZERO   -13
#define CAN_ERROR_CRC   -14
#define CAN_ERROR_COUNT_EXCEEDED   -15
#define CAN_ERROR_NOFREEMC   -16
#define CAN_ERROR_BUFFULL   -17
#define CAN_ERROR_BUFEMPTY   -18
#define CAN_ERROR_INVALID_TSEG   -19
#define CAN_ERROR_FRAMESDROPPED   -20

Typedefs

typedef signed char int8_t
 8 bit signed integer
typedef unsigned char uint8_t
 8 bit unsigned integer
typedef signed int int16_t
 16 bit signed integer
typedef unsigned int uint16_t
 16 bit unsigned integer
typedef signed long int32_t
 32 bit signed integer
typedef unsigned long uint32_t
 32 bit unsigned integer
typedef unsigned char boolean
 boolean

Functions

uint16_t can_version (void)
 Returns the version number of this CAN library. this function is safe to be called from multiple processes at the same time.
void can_init (void)
 Initializes CAN library.
int8_t can_resetcontroller (uint8_t CAN_No)
 Resets CAN controller.
int8_t can_setsiestamode (uint8_t CAN_No)
 Puts the CAN Controller in SIESTA (low power) mode.
int8_t can_disablecontroller (uint8_t CAN_No)
 Disables the CAN controller.
int8_t can_enablecontroller (uint8_t CAN_No)
 Enables the CAN controller.
int8_t can_enablecontrollerpassive (uint8_t CAN_No)
 Enables the CAN controller, but doesn't connect CAN transmit to the bus.
int8_t can_setrxwriteoverenable (uint8_t CAN_No, boolean writeover)
 Sets the state of write over in the receiver buffer.
int8_t can_set11bitglobalidmask (uint8_t CAN_No, uint32_t *mask)
 Sets the 11 bit Standard Global Id Mask.
int8_t can_set29bitglobalidmask (uint8_t CAN_No, uint32_t *mask)
 Sets the 29 bit Standard Global Id Mask.
int8_t can_set11bitmessagecenter15idmask (uint8_t CAN_No, uint32_t *mask)
 Sets the global 11 Bit Message Center 15 ID Mask.
int8_t can_set29bitmessagecenter15idmask (uint8_t CAN_No, uint32_t *mask)
 Sets the global 29 Bit Message Center 15 ID Mask.
int8_t can_setmediaidmask (uint8_t CAN_No, uint16_t mask)
 Sets the global media ID mask.
int8_t can_setmediaidarbitration (uint8_t CAN_No, uint16_t value)
 Sets the global media ID arbitration.
int8_t can_setbaudrateprescaler (uint8_t CAN_No, uint16_t prescaler)
 Sets the basic time quantum (tqu) necessary for CAN communication.
int8_t can_setsynchronizationjumpwidth (uint8_t CAN_No, uint8_t jumpWidth)
 Sets the Synchronization Jump Width necessary for adjusting TSEG1 and TSEG2.
int8_t can_setsamplerate (uint8_t CAN_No, uint8_t sampleRate)
 Sets the sample rate which is whether to use one or three samples per bit time during CAN communication.
int8_t can_settseg1 (uint8_t CAN_No, uint8_t tseg1)
 Sets Timing Segment 1 to a specified number of time quanta.
int8_t can_settseg2 (uint8_t CAN_No, uint8_t tseg2)
 Sets Timing Segment 1 to a specified number of time quanta.
int8_t can_enablemessagecenter (uint8_t CAN_No, uint8_t messageCenter)
 Puts the message center into Active mode if disabled.
int8_t can_disablemessagecenter (uint8_t CAN_No, uint8_t messageCenter)
 Puts the message center into Disabled mode if active.
int8_t can_freemessagecenter (uint8_t CAN_No, uint8_t messageCenter)
 Returns the message center to the free pool.
int8_t can_setmessagecentertx (uint8_t CAN_No, uint8_t messageCenter)
 Sets Tx/Rx bit of a specific message center to 1 (transmit).
int8_t can_setmessagecenterrx (uint8_t CAN_No, uint8_t messageCenter)
 Sets Tx/Rx bit of a specific message center to 1 (receive).
int8_t can_set11bitmessagecenterarbitrationid (uint8_t CAN_No, uint8_t messageCenter, uint32_t *ID)
 Sets the 11 bit Arbitration ID.
int8_t can_set29bitmessagecenterarbitrationid (uint8_t CAN_No, uint8_t messageCenter, uint32_t *ID)
 Sets the 29 bit Arbitration ID.
int8_t can_setmessagecentermessageidmaskenable (uint8_t CAN_No, uint8_t messageCenter, boolean maskEnable)
 Enables or disables Message ID Masking for a specific message center.
int8_t can_setmessagecentermediaidmaskenable (uint8_t CAN_No, uint8_t messageCenter, boolean maskEnable)
 Enables or disables Media ID Masking for a specific message center.
int8_t can_sendframe (uint8_t CAN_No, CanFrame *frame)
 Transmits a data or RFR frame.
int8_t can_getrxmessagecenter (uint8_t CAN_No, MCConfig *config)
 Gets the first available message centre and configure it for reception.
int8_t can_receiveframesavailable (uint8_t CAN_No)
 Gets the number of frames rending in the receive buffer.
int8_t can_receiveframe (uint8_t CAN_No, CanFrame *frame)
 Gets a frame from the receive buffer.
int8_t can_getautoanswerrfrmessagecenter (uint8_t CAN_No, CanFrame *frame)
 Gets the first available message centre and configure it for Auto-answering Remote RFRs.
int16_t can_gettxerrorcount (uint8_t CAN_No)
 Gets the transmitter error count.
int16_t can_getrxerrorcount (uint8_t CAN_No)
 Gets the receiver error count.


Define Documentation

#define CAN_ERROR_ARGUMENT   -5
 

Improper argument.

#define CAN_ERROR_BIT_ONE   -12
 

Bit 1 error.

#define CAN_ERROR_BIT_STUFF   -9
 

Bit stuff error. CAN controller detected more than five consecutive bits of an identical state in an incoming message.

#define CAN_ERROR_BIT_ZERO   -13
 

Bit 0 error.

#define CAN_ERROR_BUFEMPTY   -18
 

Receiver buffer is empty.

#define CAN_ERROR_BUFFULL   -17
 

Transmitter buffer is full.

#define CAN_ERROR_BUSOFF   -2
 

CAN Bus off error. Transmit error count has reached or exceeded 256.

#define CAN_ERROR_COUNT_EXCEEDED   -15
 

Transmit or Receiver Error counter has exceeded the error count of 96 (in case of ERCS bit of C0C register is 0) or reached 128 (in case of ERCS bit of C0C register is 1).

#define CAN_ERROR_CRC   -14
 

CRC error. The calculated CRC of the received message message does not match the CRC embedded in the message.

#define CAN_ERROR_FORMAT   -10
 

Format error. Received message has the wrong format.

#define CAN_ERROR_FRAMESDROPPED   -20
 

One or more frames have been dropped. In this case also, valid frames are are returned from the receiver buffer. User can chose to ignore this error and treat it as CAN_ERROR_NOERROR.

#define CAN_ERROR_GENERIC   -1
 

Message Center is not in disabled mode.

#define CAN_ERROR_INVALID_TSEG   -19
 

Time Segment value not set.

#define CAN_ERROR_MC_ACTIVE   -8
 

Message Center Active.

#define CAN_ERROR_NOERROR   0
 

No Error

#define CAN_ERROR_NOFREEMC   -16
 

No Free Message Center available.

#define CAN_ERROR_NOT_INITIALIZED   -4
 

Can controller not initialized.

#define CAN_ERROR_PORT_DISABLED   -7
 

CAN Port disabled.

#define CAN_ERROR_PORT_ENABLED   -6
 

CAN Port enabled.

#define CAN_ERROR_TIMEOUT   -3
 

Time out error.

#define CAN_ERROR_TRANSMIT_NO_ACK   -11
 

Transmit not acknowledged error. Requested node did not acknowledge the sent message.

#define TINI400_CANBUS_VERSION   3
 

Version number associated with this header file. Should be the same as the version number returned by the can_version function.

See also:
can_version


Copyright 2005 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.