|
canpie.h File ReferenceCANpie constants, structures and enumerations.
More...
|
Data Structures |
struct | CpCanMsg_s |
| CAN message structure. More...
|
struct | CpBitTiming_s |
| Bit timing structure. More...
|
struct | CpStatistic_s |
| CAN statistic structure. More...
|
struct | CpState_s |
| CAN state structure. More...
|
Defines |
#define | CP_AUTOBAUD 0 |
#define | CP_BUFFER_MAX 0 |
#define | CP_CAN_MSG_MACRO 0 |
#define | CP_CAN_MSG_TIME 1 |
#define | CP_CAN_MSG_USER 1 |
#define | CP_CHANNEL_MAX 1 |
#define | CP_SMALL_CODE 0 |
#define | CP_STATISTIC 0 |
#define | CP_MASK_STD_FRAME 0x000007FF |
#define | CP_MASK_EXT_FRAME 0x1FFFFFFF |
#define | CP_MASK_EXT_BIT 0x01 |
#define | CP_MASK_RTR_BIT 0x02 |
#define | CP_MASK_OVR_BIT 0x04 |
Typedefs |
typedef struct CpCanMsg_s | _TsCpCanMsg |
typedef struct CpHdi_s | _TsCpHdi |
Enumerations |
enum | CpErr {
CpErr_OK = 0,
CpErr_GENERIC,
CpErr_HARDWARE,
CpErr_INIT_FAIL,
CpErr_INIT_READY,
CpErr_INIT_MISSING,
CpErr_RCV_EMPTY,
CpErr_OVERRUN,
CpErr_TRM_FULL,
CpErr_CAN_MESSAGE = 10,
CpErr_CAN_ID,
CpErr_CAN_DLC,
CpErr_FIFO_EMPTY = 20,
CpErr_FIFO_WAIT,
CpErr_FIFO_FULL,
CpErr_FIFO_SIZE,
CpErr_FIFO_PARM,
CpErr_BUS_PASSIVE = 30,
CpErr_BUS_OFF,
CpErr_BUS_WARNING,
CpErr_CHANNEL = 40,
CpErr_REGISTER,
CpErr_BAUDRATE,
CpErr_BUFFER,
CpErr_PARAM,
CpErr_NOT_SUPPORTED = 50
} |
enum | CP_CALLBACK { CP_CALLBACK_PROCESSED = 0,
CP_CALLBACK_PUSH_FIFO
} |
enum | CP_BAUD { CP_BAUD_10K = 0,
CP_BAUD_20K,
CP_BAUD_50K,
CP_BAUD_100K,
CP_BAUD_125K,
CP_BAUD_250K,
CP_BAUD_500K,
CP_BAUD_800K,
CP_BAUD_1M,
CP_BAUD_AUTO
} |
enum | CP_CHANNEL { CP_CHANNEL_1 = 0,
CP_CHANNEL_2,
CP_CHANNEL_3,
CP_CHANNEL_4,
CP_CHANNEL_5,
CP_CHANNEL_6,
CP_CHANNEL_7,
CP_CHANNEL_8
} |
enum | CP_MODE { CP_MODE_STOP = 0,
CP_MODE_START,
CP_MODE_LISTEN_ONLY,
CP_MODE_SLEEP
} |
enum | CP_STATE { CP_STATE_STOPPED = 0,
CP_STATE_SLEEPING,
CP_STATE_BUS_ACTIVE,
CP_STATE_BUS_WARN,
CP_STATE_BUS_PASSIVE,
CP_STATE_BUS_OFF,
CP_STATE_PHY_FAULT = 10,
CP_STATE_PHY_H,
CP_STATE_PHY_L
} |
enum | CP_BUFFER |
Detailed Description
This file holds constants and structures used within CANpie. All functions, structures, defines and constants in CANpie have the prefix "Cp". The following table shows the used nomenclature:
CANpie code | Prefix |
Core functions | CpCore |
Message access functions | CpMsg |
Structures | _TsCp |
Constants / Defines | CP |
Error Codes | CpErr |
Typedef Documentation
CAN message structure.
For transmission and reception of CAN messages the structure CpCanMsg_s is used.
Hardware description interface structure.
The structure CpHdi_s provides fields to gather information about the CAN hardware.
Enumeration Type Documentation
Fixed baudrates.
The values of the enumeration CP_BAUD are used as parameter for the function CpCoreBaudrate(). - Enumerator:
-
CP_BAUD_10K |
Baudrate 10 kBit/sec |
CP_BAUD_20K |
Baudrate 20 kBit/sec |
CP_BAUD_50K |
Baudrate 50 kBit/sec |
CP_BAUD_100K |
Baudrate 100 kBit/sec |
CP_BAUD_125K |
Baudrate 125 kBit/sec |
CP_BAUD_250K |
Baudrate 250 kBit/sec |
CP_BAUD_500K |
Baudrate 500 kBit/sec |
CP_BAUD_800K |
Baudrate 800 kBit/sec |
CP_BAUD_1M |
Baudrate 1 MBit/sec |
CP_BAUD_AUTO |
Use automatic baudrate detection |
Buffer definition.
The enumeration CP_BUFFER is used to define a message buffer inside a FullCAN controller. The index for the first buffer starts at 1.
Buffer direction definition.
- Enumerator:
-
CP_BUFFER_DIR_RX |
Buffer direction is receive |
CP_BUFFER_DIR_TX |
Buffer direction is transmit |
Callback Return Codes.
These return values are used by the callback functions that can be installed by the function CpCoreIntFunctions().
Example
- Enumerator:
-
CP_CALLBACK_PROCESSED |
Message was processed by callback and is not inserted in the FIFO |
CP_CALLBACK_PUSH_FIFO |
Message was processed by callback and is inserted in the FIFO |
Channel definition.
The physical CAN interfaces are numbered from 0 .. N-1 (N: total number of physical CAN interfaces on the target system). The enumeration CP_CHANNEL lists up to 8 physical interfaces. - Enumerator:
-
CP_CHANNEL_1 |
CAN interface 1 |
CP_CHANNEL_2 |
CAN interface 2 |
CP_CHANNEL_3 |
CAN interface 3 |
CP_CHANNEL_4 |
CAN interface 4 |
CP_CHANNEL_5 |
CAN interface 5 |
CP_CHANNEL_6 |
CAN interface 6 |
CP_CHANNEL_7 |
CAN interface 7 |
CP_CHANNEL_8 |
CAN interface 8 |
Mode of CAN controller.
These values are used as parameter for the function CpCoreCanMode() in order to change the state of the CAN controller. - Enumerator:
-
CP_MODE_STOP |
Set controller in Stop mode (no reception / transmission possible) |
CP_MODE_START |
Set controller into normal operation |
CP_MODE_LISTEN_ONLY |
Set controller into listen-only mode |
CP_MODE_SLEEP |
Set controller into Sleep mode |
State of CAN controller.
These values are used as return value for the function CpCoreCanState(). - Enumerator:
-
CP_STATE_STOPPED |
CAN controller is in stopped mode |
CP_STATE_SLEEPING |
CAN controller is in Sleep mode |
CP_STATE_BUS_ACTIVE |
CAN controller is error active |
CP_STATE_BUS_WARN |
CAN controller is active, warning level is reached |
CP_STATE_BUS_PASSIVE |
CAN controller is error passive |
CP_STATE_BUS_OFF |
CAN controller went into Bus Off |
CP_STATE_PHY_FAULT |
General failure of physical layer detected (if supported by hardware) |
CP_STATE_PHY_H |
Fault on CAN-H detected (Low Speed CAN) |
CP_STATE_PHY_L |
Fault on CAN-L detected (Low Speed CAN) |
CANpie Error codes.
All functions that may cause an error condition will return an error code. The CANpie error codes are within the value range from 0 to 127. The designer of the core functions might extend the error code table with hardware specific error codes, which must be in the range from 128 to 255. - Enumerator:
-
CpErr_OK |
No error (00dec / 00hex) |
CpErr_GENERIC |
Error not specified (01dec / 01hex) |
CpErr_HARDWARE |
Hardware failure (02dec / 02hex) |
CpErr_INIT_FAIL |
Initialisation failure (03dec / 03hex) |
CpErr_INIT_READY |
Channel is initialised, ready to run (04dec / 04hex) |
CpErr_INIT_MISSING |
CAN channel was not initialised (05dec / 05hex) |
CpErr_RCV_EMPTY |
Receive buffer is empty (05dec / 05hex) |
CpErr_OVERRUN |
Receive buffer overrun (06dec / 06hex) |
CpErr_TRM_FULL |
Transmit buffer is full (07dec / 07hex) |
CpErr_CAN_MESSAGE |
CAN message has wrong format (10dec / 0Ahex) |
CpErr_CAN_ID |
CAN identifier not valid (11dec / 0Bhex) |
CpErr_CAN_DLC |
CAN data length code not valid (12dec / 0Chex) |
CpErr_FIFO_EMPTY |
FIFO is empty (20dec / 14hex) |
CpErr_FIFO_WAIT |
Message is waiting in FIFO (21dec / 15hex) |
CpErr_FIFO_FULL |
FIFO is full (22dec / 16hex) |
CpErr_FIFO_SIZE |
FIFO size is out of range (23dec / 17hex) |
CpErr_FIFO_PARM |
Parameter of FIFO function is out of range (24dec / 18hex) |
CpErr_BUS_PASSIVE |
Controller is in error passive (30dec / 1Ehex) |
CpErr_BUS_OFF |
Controller is in bus off (31dec / 1Fhex) |
CpErr_BUS_WARNING |
Controller is in warning status (32dec / 20hex) |
CpErr_CHANNEL |
Channel out of range (40dec / 28hex) |
CpErr_REGISTER |
Register address out of range (41dec / 29hex) |
CpErr_BAUDRATE |
Baudrate out of range (42dec / 2Ahex) |
CpErr_BUFFER |
Buffer number out of range (43dec / 2Bhex) |
CpErr_PARAM |
Parameter number out of range (44dec / 2Chex) |
CpErr_NOT_SUPPORTED |
Function is not supported (50dec / 32hex) |
|