/************************************************************************** * * Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file SystemComm.h * * @author (last) Sean * @date (last) 30-Jul-2024 * * @author (original) Sean * @date (original) 30-Jul-2024 * ***************************************************************************/ #ifndef __SYSTEM_COMM_H__ #define __SYSTEM_COMM_H__ #ifdef _TD_ #include "TDCommon.h" #endif #ifdef _DD_ #include "DDCommon.h" #endif #ifdef _RO_ #include "FPCommon.h" #endif #include "CommBuffers.h" #include "MsgQueues.h" /** * @defgroup SystemComm SystemComm * @brief System communication unit. Manages incoming and outgoing CAN frames. * * @addtogroup SystemComm * @{ */ // ********** public definitions ********** #define MESSAGE_SYNC_BYTE 0xA5 ///< Denali message syncronization byte. #define CAN_FRAME_PAYLOAD_SIZE 8 ///< CAN frame payload size (in bytes). #define MAX_ACK_MSG_SIZE ( sizeof( MESSAGE_WRAPPER_T ) + 1 + CAN_FRAME_PAYLOAD_SIZE ) ///< Maximum size (in bytes) of Leahi 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 // ********** public function prototypes ********** void initSystemComm( void ); void execSystemCommRx( void ); void execSystemCommTx( void ); void handleCANMsgInterrupt( CAN_MESSAGE_BOX_T srcCANBox ); BOOL isCANBoxForXmit( CAN_MESSAGE_BOX_T srcCANBox ); BOOL isCANBoxForRecv( CAN_MESSAGE_BOX_T srcCANBox ); BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ); BOOL testSetPendingACKOverride( U32 value ); BOOL testResetPendingACKOverride( void ); /**@}*/ #endif