/************************************************************************** * * 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 MessageSupport.h * * @author (last) Sean * @date (last) 30-Jul-2024 * * @author (original) Sean * @date (original) 30-Jul-2024 * ***************************************************************************/ #ifndef __MESSAGE_SUPPORT_H__ #define __MESSAGE_SUPPORT_H__ #include "CommBuffers.h" #include "MsgDefs.h" /** * @defgroup MessageSupport MessageSupport * @brief Provides functions to support messaging on the CAN bus that are * common to all firmware stacks. * * @addtogroup MessageSupport * @{ */ // ********** public definitions ****************** #define MAX_MSG_PAYLOAD_SIZE 250 ///< Bytes #define MESSAGE_OVERHEAD_SIZE (sizeof(MESSAGE_HEADER_T) + sizeof(U08)) ///< Byte size of a message's overhead (fixed at 6 bytes). #pragma pack(push,1) /// Record structure for message header. typedef struct { S16 seqNo; ///< Sequence number (and ACK required bit) of message U16 msgID; ///< ID of message U08 payloadLen; ///< Length of payload in bytes } MESSAGE_HEADER_T; /// Record structure for a message (header + payload). typedef struct { COMM_BUFFER_T in_buffer; ///< Message received into this channel buffer MESSAGE_HEADER_T hdr; ///< Message header U08 payload[ MAX_MSG_PAYLOAD_SIZE ]; ///< Message payload } MESSAGE_T; /// Record structure for a wrapped message (message + CRC). typedef struct { MESSAGE_T msg; ///< Message U08 crc; ///< Message CRC } MESSAGE_WRAPPER_T; #pragma pack(pop) // ********** public function prototypes ********** BOOL broadcastData( MSG_ID_T msgID, COMM_BUFFER_T buffer, U08* dataPtr, U32 length ); #endif