/************************************************************************** * * Copyright (c) 2019-2020 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 * * @date 08-Oct-2019 * @author S. Nash * * @brief header file for System Communication service . * **************************************************************************/ #ifndef __SYSTEM_COMM_H__ #define __SYSTEM_COMM_H__ #include "DGCommon.h" #include "CommBuffers.h" #include "MsgQueues.h" // ********** public definitions ********** #define MESSAGE_SYNC_BYTE 0xA5 #define CAN_MESSAGE_PAYLOAD_SIZE 8 #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 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 ); void execSystemCommRx( void ); void execSystemCommTx( void ); void handleCANMsgInterrupt( CAN_MESSAGE_BOX_T srcCANBox ); #ifdef DEBUG_ENABLED void handleUARTMsgRecvPacketInterrupt( void ); void handleUARTMsgXmitPacketInterrupt( void ); #endif BOOL isHDCommunicating( void ); BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ); #endif