Index: firmware/App/Services/SystemComm.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r62a4d7b976107f7ac4d5013ce06f38f4a0bf65bd --- firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision 62a4d7b976107f7ac4d5013ce06f38f4a0bf65bd) @@ -7,8 +7,8 @@ * * @file SystemComm.h * -* @author (last) Sean -* @date (last) 27-Feb-2020 +* @author (last) Quang Nguyen +* @date (last) 24-Aug-2020 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -22,23 +22,31 @@ #include "CommBuffers.h" #include "MsgQueues.h" +/** + * @defgroup SystemComm SystemComm + * @brief System communication module. Manages incoming and outgoing CAN frames. + * + * @addtogroup SystemComm + * @{ + */ + // ********** public definitions ********** -#define MESSAGE_SYNC_BYTE 0xA5 +#define MESSAGE_SYNC_BYTE 0xA5 ///< Denali message syncronization byte. -#define CAN_MESSAGE_PAYLOAD_SIZE 8 +#define CAN_MESSAGE_PAYLOAD_SIZE 8 ///< CAN frame payload size (in bytes). #ifdef DEBUG_ENABLED #define PC_MESSAGE_PACKET_SIZE 8 #endif -#define MSG_ID_ACK 0xFFFF -#define MSG_ACK_BIT 0x8000 -#define MAX_MSG_SEQ_NO 0x7FFF -#define MIN_MSG_SEQ_NO 0x0001 -#define MAX_ACK_MSG_SIZE ( sizeof( MESSAGE_WRAPPER_T ) + 1 + CAN_MESSAGE_PAYLOAD_SIZE ) // must hold full (wrapped) message + sync + any CAN padding +#define MSG_ID_ACK 0xFFFF ///< Denali message ID for acknowledging received messages (when required). +#define MSG_ACK_BIT 0x8000 ///< ACK bit in sequence number that indicates an ACK is required. +#define MAX_MSG_SEQ_NO 0x7FFF ///< Maximum sequence number for Denali message (then wraps to 1). +#define MIN_MSG_SEQ_NO 0x0001 ///< Minimum sequence number for Denali message. +#define MAX_ACK_MSG_SIZE ( sizeof( MESSAGE_WRAPPER_T ) + 1 + CAN_MESSAGE_PAYLOAD_SIZE ) ///< Maximum size (in bytes) of Denali message including full (wrapped) message + sync + any CAN padding) + +typedef COMM_BUFFER_T CAN_MESSAGE_BOX_T; ///< the CAN comm buffers align with the active CAN message boxes -typedef COMM_BUFFER_T CAN_MESSAGE_BOX_T; // the first 12 comm buffers align with the 12 active CAN message boxes - // ********** public function prototypes ********** void initSystemComm( void ); @@ -49,7 +57,11 @@ void handleUARTMsgRecvPacketInterrupt( void ); void handleUARTMsgXmitPacketInterrupt( void ); #endif -BOOL isHDCommunicating( void ); -BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ); - -#endif + +BOOL isCANBoxForXmit( CAN_MESSAGE_BOX_T srcCANBox ); +BOOL isCANBoxForRecv( CAN_MESSAGE_BOX_T srcCANBox ); +BOOL isHDCommunicating( void ); +BOOL isDGOnlyCANNode( void ); +BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ); + +#endif