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