Index: firmware/App/Services/MsgQueues.h =================================================================== diff -u -reff7b1575f008f81b29ef906f6346fac6012d3ab -r663c6ccbe24d0adf734ca0684510eef70884cdee --- firmware/App/Services/MsgQueues.h (.../MsgQueues.h) (revision eff7b1575f008f81b29ef906f6346fac6012d3ab) +++ firmware/App/Services/MsgQueues.h (.../MsgQueues.h) (revision 663c6ccbe24d0adf734ca0684510eef70884cdee) @@ -33,13 +33,13 @@ typedef struct { U16 msgID; // ID of message - U08 cargoLen; // length of cargo in bytes + U08 payloadLen; // length of cargo in bytes } MESSAGE_HEADER_T; typedef struct { MESSAGE_HEADER_T hdr; // message header - U08 cargo[MAX_MSG_CARGO_SIZE]; // message cargo + U08 payload[MAX_MSG_CARGO_SIZE]; // message cargo } MESSAGE_T; typedef struct Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r6d5a23b275903587f400bc686aed4d2709cf3e78 -r663c6ccbe24d0adf734ca0684510eef70884cdee --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 6d5a23b275903587f400bc686aed4d2709cf3e78) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 663c6ccbe24d0adf734ca0684510eef70884cdee) @@ -166,14 +166,14 @@ } else if ( TRUE == isCANBoxForRecv( srcCANBox ) ) { - U08 data[CAN_MESSAGE_CARGO_SIZE]; + U08 data[CAN_MESSAGE_PAYLOAD_SIZE]; // get CAN packet received on given CAN message box if ( FALSE != canIsRxMessageArrived( canREG1, srcCANBox ) ) { canGetData( canREG1, srcCANBox, data ); // add CAN packet to appropriate comm buffer based on the message box it came in on (s/b same #) - addToCommBuffer( srcCANBox, data, CAN_MESSAGE_CARGO_SIZE ); + addToCommBuffer( srcCANBox, data, CAN_MESSAGE_PAYLOAD_SIZE ); } } else @@ -361,7 +361,7 @@ // search for next priority CAN packet to transmit for ( i = 0; i < NUM_OF_CAN_OUT_BUFFERS; i++ ) { - if ( numberOfBytesInCommBuffer( CAN_OUT_BUFFERS[i] ) >= CAN_MESSAGE_CARGO_SIZE ) + if ( numberOfBytesInCommBuffer( CAN_OUT_BUFFERS[i] ) >= CAN_MESSAGE_PAYLOAD_SIZE ) { result = CAN_OUT_BUFFERS[i]; break; // found highest priority packet to transmit - we're done @@ -388,12 +388,12 @@ // if a buffer is found with a packet to transmit, get packet from buffer and transmit it if ( buffer != COMM_BUFFER_NOT_USED ) { - U08 data[CAN_MESSAGE_CARGO_SIZE]; - U32 dataSize = getFromCommBuffer( buffer, data, CAN_MESSAGE_CARGO_SIZE ); + U08 data[CAN_MESSAGE_PAYLOAD_SIZE]; + U32 dataSize = getFromCommBuffer( buffer, data, CAN_MESSAGE_PAYLOAD_SIZE ); CAN_MESSAGE_BOX_T mBox = buffer; // CAN message boxes and comm buffers are aligned // if there's another CAN packet to send, send it - if ( dataSize == CAN_MESSAGE_CARGO_SIZE ) + if ( dataSize == CAN_MESSAGE_PAYLOAD_SIZE ) { canTransmit( canREG1, mBox, data ); } @@ -482,8 +482,8 @@ memcpy( &(rcvMsg.msg.hdr), dataPtr, sizeof(MESSAGE_HEADER_T) ); dataPtr += sizeof(MESSAGE_HEADER_T); // copy message cargo portion of message data to the new message - memcpy( &(rcvMsg.msg.cargo), dataPtr, rcvMsg.msg.hdr.cargoLen ); - dataPtr += rcvMsg.msg.hdr.cargoLen; + memcpy( &(rcvMsg.msg.payload), dataPtr, rcvMsg.msg.hdr.payloadLen ); + dataPtr += rcvMsg.msg.hdr.payloadLen; // copy CRC portion of message data to the new message rcvMsg.crc = *dataPtr; // add new message to queue for later processing Index: firmware/App/Services/SystemComm.h =================================================================== diff -u -reff7b1575f008f81b29ef906f6346fac6012d3ab -r663c6ccbe24d0adf734ca0684510eef70884cdee --- firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision eff7b1575f008f81b29ef906f6346fac6012d3ab) +++ firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision 663c6ccbe24d0adf734ca0684510eef70884cdee) @@ -24,7 +24,7 @@ #define MESSAGE_SYNC_BYTE 0xA5 -#define CAN_MESSAGE_CARGO_SIZE 8 +#define CAN_MESSAGE_PAYLOAD_SIZE 8 #define PC_MESSAGE_PACKET_SIZE 8 typedef COMM_BUFFER_T CAN_MESSAGE_BOX_T; // the first 10 comm buffers align with the 10 active CAN message boxes Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r6d5a23b275903587f400bc686aed4d2709cf3e78 -r663c6ccbe24d0adf734ca0684510eef70884cdee --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6d5a23b275903587f400bc686aed4d2709cf3e78) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 663c6ccbe24d0adf734ca0684510eef70884cdee) @@ -35,7 +35,7 @@ typedef struct { U08 confirmed; // 1 = confirmed, 0 = rejected/timed out -} OFF_BUTTON_MESSAGE_FROM_UI_CARGO_T; +} OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T; #pragma pack(pop) @@ -75,16 +75,16 @@ memcpy( &data[msgSize], &(msg.hdr), sizeof(MESSAGE_HEADER_T) ); msgSize += sizeof(MESSAGE_HEADER_T); - // serialize message cargo (only used bytes per cargoLen field) - memcpy( &data[msgSize], &(msg.cargo), msg.hdr.cargoLen ); - msgSize += msg.hdr.cargoLen; + // serialize message payload (only used bytes per payloadLen field) + memcpy( &data[msgSize], &(msg.payload), msg.hdr.payloadLen ); + msgSize += msg.hdr.payloadLen; // TODO - calculate 8-bit CRC data[msgSize++] = 0; // TODO - s/b 8-bit CRC when calc is available - // pad with zero bytes to get length a multiple of CAN_MESSAGE_CARGO_SIZE (8) - sizeMod = msgSize % CAN_MESSAGE_CARGO_SIZE; - sizePad = ( sizeMod == 0 ? 0 : CAN_MESSAGE_CARGO_SIZE - sizeMod ); + // pad with zero bytes to get length a multiple of CAN_MESSAGE_PAYLOAD_SIZE (8) + sizeMod = msgSize % CAN_MESSAGE_PAYLOAD_SIZE; + sizePad = ( sizeMod == 0 ? 0 : CAN_MESSAGE_PAYLOAD_SIZE - sizeMod ); for ( i = 0; i < sizePad; i++ ) { data[msgSize++] = 0; @@ -112,12 +112,12 @@ BOOL result; MESSAGE_T msg; U32 msgSize; - U08 data[sizeof(MESSAGE_WRAPPER_T)+1+CAN_MESSAGE_CARGO_SIZE]; // must hold full (wrapped) message + sync + any CAN padding + U08 data[sizeof(MESSAGE_WRAPPER_T)+1+CAN_MESSAGE_PAYLOAD_SIZE]; // must hold full (wrapped) message + sync + any CAN padding // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_OFF_BUTTON_PRESS; - msg.hdr.cargoLen = 0; + msg.hdr.payloadLen = 0; // serialize the message (w/ sync, CRC, and appropriate CAN padding) msgSize = serializeMessage( msg, data ); @@ -140,10 +140,10 @@ *************************************************************************/ void handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ) { - OFF_BUTTON_MESSAGE_FROM_UI_CARGO_T cargo; + OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T payload; - memcpy( &cargo, message->cargo, sizeof(OFF_BUTTON_MESSAGE_FROM_UI_CARGO_T) ); - userConfirmOffButton( cargo.confirmed ); + memcpy( &payload, message->payload, sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ); + userConfirmOffButton( payload.confirmed ); } @@ -167,12 +167,12 @@ #endif // If we start therapy - if (message->cargo[0] == START && getCurrentOperationMode() == MODE_STAN) + if (message->payload[0] == START && getCurrentOperationMode() == MODE_STAN) { requestNewOperationMode(MODE_FILL); sendTestAckResponseMsg((MSG_ID_T)message->hdr.msgID, TRUE); } // We can only stop fill if we are in fill mode - else if (message->cargo[0] == STOP && getCurrentOperationMode() == MODE_FILL) + else if (message->payload[0] == STOP && getCurrentOperationMode() == MODE_FILL) { requestNewOperationMode(MODE_STAN); sendTestAckResponseMsg((MSG_ID_T)message->hdr.msgID, TRUE); @@ -206,13 +206,13 @@ BOOL result; MESSAGE_T msg; U32 msgSize; - U08 data[sizeof(MESSAGE_WRAPPER_T) + 1 + CAN_MESSAGE_CARGO_SIZE]; // must hold full (wrapped) message + sync + any CAN padding + U08 data[sizeof(MESSAGE_WRAPPER_T) + 1 + CAN_MESSAGE_PAYLOAD_SIZE]; // must hold full (wrapped) message + sync + any CAN padding // create a message record blankMessage( &msg ); msg.hdr.msgID = 2; - msg.hdr.cargoLen = len; - memcpy( msg.cargo, dbgData, len ); + msg.hdr.payloadLen = len; + memcpy( msg.payload, dbgData, len ); // serialize the message (w/ sync, CRC, and appropriate CAN padding) msgSize = serializeMessage( msg, data ); @@ -261,8 +261,8 @@ // create a message record blankMessage( &msg ); msg.hdr.msgID = msgID; - msg.hdr.cargoLen = 1; - msg.cargo[0] = (U08)ack; + msg.hdr.payloadLen = 1; + msg.payload[0] = (U08)ack; // serialize the message (w/ sync, CRC, and appropriate CAN padding) msgSize = serializeMessage( msg, data ); @@ -287,7 +287,7 @@ { // verify pass code // TODO - placeholder - how do we want to authenticate tester? - if ( ( 3 == message->hdr.cargoLen ) && ( 0x31 == message->cargo[0] ) && ( 0x32 == message->cargo[1] ) && ( 0x33 == message->cargo[2] ) ) + if ( ( 3 == message->hdr.payloadLen ) && ( 0x31 == message->payload[0] ) && ( 0x32 == message->payload[1] ) && ( 0x33 == message->payload[2] ) ) { testerLoggedIn = TRUE; } @@ -312,11 +312,11 @@ void handleTestHDMessageRequest( MESSAGE_T *message ) { MESSAGE_WRAPPER_T hdMessage; - U32 msgLen = (U32)(message->hdr.cargoLen); + U32 msgLen = (U32)(message->hdr.payloadLen); U08 *msgBytes = (U08*)(&(hdMessage)); BOOL result; - memcpy( msgBytes, message->cargo, msgLen ); + memcpy( msgBytes, message->payload, msgLen ); // add HD message to received message queue result = addToMsgQueue( MSG_Q_IN, &hdMessage ); @@ -337,17 +337,17 @@ *************************************************************************/ void handleTestOffButtonStateOverrideRequest( MESSAGE_T *message ) { - TEST_OVERRIDE_CARGO_T cargo; + TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify cargo length - if ( sizeof(TEST_OVERRIDE_CARGO_T) == message->hdr.cargoLen ) + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { - memcpy( &cargo, message->cargo, sizeof(TEST_OVERRIDE_CARGO_T) ); + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == cargo.reset ) + if ( FALSE == payload.reset ) { - result = testSetOffButtonStateOverride( (BUTTON_STATE_T)(cargo.state) ); + result = testSetOffButtonStateOverride( (BUTTON_STATE_T)(payload.state) ); } else { @@ -370,17 +370,17 @@ *************************************************************************/ void handleTestStopButtonStateOverrideRequest( MESSAGE_T *message ) { - TEST_OVERRIDE_CARGO_T cargo; + TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify cargo length - if ( sizeof(TEST_OVERRIDE_CARGO_T) == message->hdr.cargoLen ) + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { - memcpy( &cargo, message->cargo, sizeof(TEST_OVERRIDE_CARGO_T) ); + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == cargo.reset ) + if ( FALSE == payload.reset ) { - result = testSetStopButtonStateOverride( (BUTTON_STATE_T)(cargo.state) ); + result = testSetStopButtonStateOverride( (BUTTON_STATE_T)(payload.state) ); } else { @@ -403,17 +403,17 @@ *************************************************************************/ void handleTestAlarmLampPatternOverrideRequest( MESSAGE_T *message ) { - TEST_OVERRIDE_CARGO_T cargo; + TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; - // verify cargo length - if ( sizeof(TEST_OVERRIDE_CARGO_T) == message->hdr.cargoLen ) + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { - memcpy( &cargo, message->cargo, sizeof(TEST_OVERRIDE_CARGO_T) ); + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == cargo.reset ) + if ( FALSE == payload.reset ) { - result = testSetCurrentLampPatternOverride( (LAMP_PATTERN_T)(cargo.state) ); + result = testSetCurrentLampPatternOverride( (LAMP_PATTERN_T)(payload.state) ); } else { @@ -436,21 +436,21 @@ *************************************************************************/ void handleTestWatchdogCheckInStateOverrideRequest( MESSAGE_T *message ) { - TEST_OVERRIDE_ARRAY_CARGO_T cargo; + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; - // verify cargo length - if ( sizeof(TEST_OVERRIDE_ARRAY_CARGO_T) == message->hdr.cargoLen ) + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { - memcpy( &cargo, message->cargo, sizeof(TEST_OVERRIDE_ARRAY_CARGO_T) ); + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); - if ( FALSE == cargo.reset ) + if ( FALSE == payload.reset ) { - result = testSetWatchdogTaskCheckInOverride( cargo.index, (BOOL)(cargo.state) ); + result = testSetWatchdogTaskCheckInOverride( payload.index, (BOOL)(payload.state) ); } else { - result = testResetWatchdogTaskCheckInOverride( cargo.index ); + result = testResetWatchdogTaskCheckInOverride( payload.index ); } } // respond to request Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r6d5a23b275903587f400bc686aed4d2709cf3e78 -r663c6ccbe24d0adf734ca0684510eef70884cdee --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 6d5a23b275903587f400bc686aed4d2709cf3e78) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 663c6ccbe24d0adf734ca0684510eef70884cdee) @@ -26,8 +26,8 @@ { MSG_ID_UNUSED = 0, MSG_ID_OFF_BUTTON_PRESS, - MSD_ID_DG_FILL_START_STOP =0xA000, - MSG_ID_FIRST_TESTER_MESSAGE = 0xA100, + MSD_ID_DG_FILL_START_STOP = 0x2000, + MSG_ID_FIRST_TESTER_MESSAGE = 0xA000, MSG_ID_TESTER_LOGIN_REQUEST = MSG_ID_FIRST_TESTER_MESSAGE, MSG_ID_HD_MESSAGE, MSG_ID_OFF_BUTTON_STATE_OVERRIDE, Index: firmware/App/TestSupport.h =================================================================== diff -u -reff7b1575f008f81b29ef906f6346fac6012d3ab -r663c6ccbe24d0adf734ca0684510eef70884cdee --- firmware/App/TestSupport.h (.../TestSupport.h) (revision eff7b1575f008f81b29ef906f6346fac6012d3ab) +++ firmware/App/TestSupport.h (.../TestSupport.h) (revision 663c6ccbe24d0adf734ca0684510eef70884cdee) @@ -28,14 +28,14 @@ { BOOL reset; U32 state; -} TEST_OVERRIDE_CARGO_T; +} TEST_OVERRIDE_PAYLOAD_T; typedef struct { BOOL reset; U32 state; U32 index; -} TEST_OVERRIDE_ARRAY_CARGO_T; +} TEST_OVERRIDE_ARRAY_PAYLOAD_T; #pragma pack(pop)