src.dualinventive.com/jjacobs/dinetrpcll-sniffer/libdi/include/di/can/cfg.h

67 lines
1.8 KiB
C

/**
* @ingroup can
* @defgroup can_cfg Stack configuration
* @brief Stack configuration
* @date Nov 3, 2015
* @author jjacobs
* @copyright 2015 Dual Inventive Technology Centre B.V.
*
* CAN stack compile-time configuration
* @{
*/
#ifndef LIBDI_INCLUDE_DI_CAN_CFG_H_
#define LIBDI_INCLUDE_DI_CAN_CFG_H_
/**
* @brief di_can_frame_rx in pool
*/
#if defined(__DOXYGEN__)
#define DI_CAN_CFG_FRAME_POOL_SIZE 32U
#endif
/**
* @brief di_can_msg pool size and message data (buffer) size
*/
#if defined(__DOXYGEN__)
#define DI_CAN_CFG_MSG_POOL_SIZE 32U
#endif
#if defined(__DOXYGEN__)
#define DI_CAN_CFG_MSG_DATA_SIZE 1024U
#endif
/**
* @brief di_can_frame_rx garbage collect timeout in milliseconds.
* When di_can_msg reassembly is not run in time the di_can_frame_rx
* pool is depeleted and by marking frames with a timeout the pool
* can be cleaned. This timeout needs to be aligned with the reassembly
* timeout.
*/
#if !defined(DI_CAN_CFG_FRAME_TIMEOUT) || defined(__DOXYGEN__)
#define DI_CAN_CFG_FRAME_TIMEOUT 100U
#endif
/**
* @brief di_can_msg garbage collect timeout in milliseconds.
* A maximum DI CAN Message payload is 1024 bytes (with 16-bit CRC)
* - So whole di can message in can frames: 128 (1024 / 8)
* - 128 frames * 161 us (one can frame) = 20.608 ms (worst case, without retransmitting frames)
* One CAN frame with 8 bytes data payload takes (min 131uS, max 161uS):
* - 1 uS per bit (1000kHz)
* - 131 bits (zero stuff bits)
* - 161 bits (max stuff bits)
*/
#if !defined(DI_CAN_CFG_MSG_TIMEOUT) || defined(__DOXYGEN__)
#define DI_CAN_CFG_MSG_TIMEOUT 500U
#endif
/**
* @brief Can stack debugging facility
*/
#if defined(__DOXYGEN__) || !defined(DI_CAN_CFG_DBG_STAT)
#define DI_CAN_CFG_DBG_STAT TRUE
#endif
/** @} */
#endif /* LIBDI_INCLUDE_DI_CAN_CFG_H_ */