Index: MessageSupport.h =================================================================== diff -u -r9512aac6feeb1379d6d425361fa78d58f75c86f6 -rb8c0a53bcfa6be12c305761b0b1b5c79e97b55ca --- MessageSupport.h (.../MessageSupport.h) (revision 9512aac6feeb1379d6d425361fa78d58f75c86f6) +++ MessageSupport.h (.../MessageSupport.h) (revision b8c0a53bcfa6be12c305761b0b1b5c79e97b55ca) @@ -19,6 +19,7 @@ #define __MESSAGESUPPORT_H__ #include "CommBuffers.h" +#include "MsgDefs.h" /** * @defgroup MessageSupport MessageSupport @@ -29,6 +30,38 @@ * @{ */ +// ********** 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 ); Index: TestSupport.c =================================================================== diff -u -r6520e649188757399c2dfd58a30af80d96256295 -rb8c0a53bcfa6be12c305761b0b1b5c79e97b55ca --- TestSupport.c (.../TestSupport.c) (revision 6520e649188757399c2dfd58a30af80d96256295) +++ TestSupport.c (.../TestSupport.c) (revision b8c0a53bcfa6be12c305761b0b1b5c79e97b55ca) @@ -15,8 +15,8 @@ * ***************************************************************************/ -#include #include "Common.h" +#include "Messaging.h" #include "Timers.h" /** @@ -147,6 +147,56 @@ return result; } +/*********************************************************************//** + * @brief + * The getOverridePayloadFromMessage function extracts the override payload + * record from a given override message. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Pointer to an override message + * @param override Pointer to override payload record to populate from the + * given override message. + * @return Type of override received + *************************************************************************/ +OVERRIDE_TYPE_T getOverridePayloadFromMessage( MESSAGE_T *message, TEST_OVERRIDE_PAYLOAD_T *override ) +{ + OVERRIDE_TYPE_T reset = OVERRIDE_INVALID; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( override, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + reset = ( TRUE == override->reset ? OVERRIDE_RESET_OVERRIDE : OVERRIDE_OVERRIDE ); + } + + return reset; +} + +/*********************************************************************//** + * @brief + * The getOverrideArrayPayloadFromMessage function extracts the override array + * payload record from a given override array message. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Pointer to an override message + * @param override Pointer to override array payload record to populate from the + * given override array message. + * @return Type of override received + *************************************************************************/ +OVERRIDE_TYPE_T getOverrideArrayPayloadFromMessage( MESSAGE_T *message, TEST_OVERRIDE_ARRAY_PAYLOAD_T *override ) +{ + OVERRIDE_TYPE_T reset = OVERRIDE_INVALID; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( override, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + reset = ( TRUE == override->reset ? OVERRIDE_RESET_OVERRIDE : OVERRIDE_OVERRIDE ); + } + + return reset; +} + // ********** Release software configurations functions ********** /*********************************************************************//** Index: TestSupport.h =================================================================== diff -u -r6520e649188757399c2dfd58a30af80d96256295 -rb8c0a53bcfa6be12c305761b0b1b5c79e97b55ca --- TestSupport.h (.../TestSupport.h) (revision 6520e649188757399c2dfd58a30af80d96256295) +++ TestSupport.h (.../TestSupport.h) (revision b8c0a53bcfa6be12c305761b0b1b5c79e97b55ca) @@ -18,6 +18,8 @@ #ifndef __TEST_SUPPORT_H__ #define __TEST_SUPPORT_H__ +#include "MessageSupport.h" + /** * @defgroup TestSupport TestSupport * @brief Test support functions for accessing override records, managing @@ -32,6 +34,15 @@ #define OVERRIDE_KEY 0xCCC33C33 ///< Override key #define OVERRIDE_RESET 0x00000000 ///< Override reset +/// Override types. +typedef enum override_Types +{ + OVERRIDE_INVALID = 0, ///< Invalid - payload invalid or corrupted. + OVERRIDE_RESET_OVERRIDE, ///< Override reset. + OVERRIDE_OVERRIDE, ///< Override. + NUM_OF_OVERRIDE_TYPES ///< Number of override types. +} OVERRIDE_TYPE_T; + #ifdef _DD_ /// DD test software configurations @@ -44,7 +55,8 @@ NUM_OF_TEST_CONFIGS ///< Number of test configuration. } TEST_CONFIG_T; -#else +#endif +#ifdef _TD_ /// TD test software configurations typedef enum test_Config @@ -131,6 +143,9 @@ S32 getS32OverrideValue( OVERRIDE_S32_T *ovS32 ); F32 getF32OverrideValue( OVERRIDE_F32_T *ovF32 ); +OVERRIDE_TYPE_T getOverridePayloadFromMessage( MESSAGE_T *message, TEST_OVERRIDE_PAYLOAD_T *override ); +OVERRIDE_TYPE_T getOverrideArrayPayloadFromMessage( MESSAGE_T *message, TEST_OVERRIDE_ARRAY_PAYLOAD_T *override ); + // Test configuration functions void initTestConfigs( void );