J1939 Documentation
Version 4.16.00
|
The file j1939_defs.h holds global definitions, constants and structures for the J1939 stack.
Data Structures | |
struct | J1939_PGN_Entry_s |
Macros | |
#define | J1939_VERSION_MAJOR 4 |
#define | J1939_VERSION_MINOR 16 |
#define | J1939_VERSION_BUILD 0 |
#define | J1939_PRIORITY_LEVEL_0 ((uint16_t) 0x0000) |
#define | J1939_PRIORITY_LEVEL_1 ((uint16_t) 0x0001) |
#define | J1939_PRIORITY_LEVEL_2 ((uint16_t) 0x0002) |
#define | J1939_PRIORITY_LEVEL_3 ((uint16_t) 0x0003) |
#define | J1939_PRIORITY_LEVEL_4 ((uint16_t) 0x0004) |
#define | J1939_PRIORITY_LEVEL_5 ((uint16_t) 0x0005) |
#define | J1939_PRIORITY_LEVEL_6 ((uint16_t) 0x0006) |
#define | J1939_PRIORITY_LEVEL_7 ((uint16_t) 0x0007) |
#define | J1939_PRIORITY_CTRL ((uint16_t) 0x0003) |
#define | J1939_PRIORITY_INFO ((uint16_t) 0x0006) |
#define | J1939_MSG_RCV ((uint16_t) 0x0040) |
#define | J1939_MSG_TRM ((uint16_t) 0x0080) |
#define | J1939_MSG_FP ((uint16_t) 0x0100) |
#define | J1939_MSG_NO_RQST ((uint16_t) 0x0200) |
#define | J1939_ADDR_NULL ((uint8_t) 0xFE) |
#define | J1939_ADDR_BROADCAST ((uint8_t) 0xFF) |
#define | J1939_PGN_HANDLER_WRITE ((uint16_t) 0x8000) |
#define | J1939_PGN_HANDLER_FP_SEL ((uint16_t) 0x4000) |
#define | J1939_PGN_HANDLER_TP ((uint16_t) 0x2000) |
#define | J1939_PGN_HANDLER_SIZE_MASK ((uint16_t) 0x07FF) |
#define | J1939_TP_SIZE_MAX ((uint16_t) 1785) |
Typedefs | |
typedef int32_t | J1939_Status_tv |
typedef int16_t(* | PgnHandler_fn) (uint8_t *pubDataV, uint16_t uwSizeV, uint8_t ubSrcAddrV, uint8_t ubNetV) |
Enumerations | |
enum | J1939_Err_e { eJ1939_ERR_NONE = 0 , eJ1939_ERR_CAN_INIT = -1 , eJ1939_ERR_CAN_BUFFER = -2 , eJ1939_ERR_CAN_FUNCTION = -3 , eJ1939_ERR_RESET = -10 , eJ1939_ERR_NET = -20 , eJ1939_ERR_NET_VALUE = -21 , eJ1939_ERR_SERVICE = -30 , eJ1939_ERR_SERVICE_MODE = -31 , eJ1939_ERR_SERVICE_PARAM = -32 , eJ1939_ERR_PGN = -40 , eJ1939_ERR_PGN_VALUE = -41 } |
enum | J1939_Buf_e { eJ1939_BUF_RCV = eCP_BUFFER_1 , eJ1939_BUF_ADDR , eJ1939_BUF_PGN_REQ , eJ1939_BUF_TP_ACK , eJ1939_BUF_TP_BAM , eJ1939_BUF_PDU_TRM } |
enum | J1939_Handler_Result_e { eJ1939_HANDLER_RESULT_OK = 0 , eJ1939_HANDLER_RESULT_ACK = -1 , eJ1939_HANDLER_RESULT_NACK = -2 , eJ1939_HANDLER_RESULT_DENIED = -3 , eJ1939_HANDLER_RESULT_RESPONSE = -4 } |
#define J1939_ADDR_BROADCAST ((uint8_t) 0xFF) |
J1939 broadcast address
#define J1939_ADDR_NULL ((uint8_t) 0xFE) |
J1939 NULL address
#define J1939_PGN_HANDLER_FP_SEL ((uint16_t) 0x4000) |
Used in PGN callback handler (parameter uwSizeV): denotes special behaviour for Fast-packet message handling.
#define J1939_PGN_HANDLER_SIZE_MASK ((uint16_t) 0x07FF) |
Used in PGN callback handler (parameter uwSizeV): mask for number of bytes to copy
#define J1939_PGN_HANDLER_TP ((uint16_t) 0x2000) |
Used in PGN callback handler (parameter uwSizeV): denotes that data was transferred using the TP.CON handling instead of TP.BAM.
#define J1939_PGN_HANDLER_WRITE ((uint16_t) 0x8000) |
Used in PGN callback handler (parameter uwSizeV): denotes the data access direction
#define J1939_TP_SIZE_MAX ((uint16_t) 1785) |
Maximum number of bytes for a transport protocol.
#define J1939_VERSION_BUILD 0 |
Build version number of J1939 stack. The version number of the J1939 protocol stack is reflected by PGN 65242.
#define J1939_VERSION_MAJOR 4 |
Major version number of J1939 stack. The version number of the J1939 protocol stack is reflected by PGN 65242.
#define J1939_VERSION_MINOR 16 |
Minor version number of J1939 stack. The version number of the J1939 protocol stack is reflected by PGN 65242.
typedef int32_t J1939_Status_tv |
Function return value.
Functions of the J1939 Protocol Stack have a generic return value, which is defined as int32_t by default. A negative value of J1939_Status_tv denotes an error, defined by the enumeration J1939_Err_e.
typedef int16_t(* PgnHandler_fn) (uint8_t *pubDataV, uint16_t uwSizeV, uint8_t ubSrcAddrV, uint8_t ubNetV) |
[in,out] | pubDataV | Pointer to message data |
[in] | uwSizeV | Size of data |
[in] | ubSrcAddrV | Source address of PDU |
[in] | ubNetV | J1939 Network channel |
The handler is called by the stack if a PGN is available in the CA. The lower 11 bits of the parameter uwSizeV denote the size of the data to be transmitted. Within the handler the mask J1939_PGN_HANDLER_SIZE_MASK can be used to retrieve this data size. The highest bit of the parameter uwSizeV defines the data direction (see definition J1939_PGN_HANDLER_WRITE). Possible return values are defined by J1939_Handler_Result_e.
enum J1939_Buf_e |
Message buffer allocation.
Each J1939 PGN (i.e. identifier) is assigned to a specific message buffer in the CAN controller.
enum J1939_Err_e |
Error Codes of protocol stack.
All error codes of the J1939 protocol stack have the prefix 'eJ1939_Err_'.
PGN handler result.
This enumeration lists possible return values for the PGN handler function PgnHandler_fn
enum J1939_Net_e |