From 73e956f5f8459466ec7d6a5d5c8a459668d5e383 Mon Sep 17 00:00:00 2001 From: Michal Horn Date: Wed, 24 Jun 2015 17:55:42 +0200 Subject: [PATCH 1/1] Modify flexray commands to reflect changes in RPP library --- rpp-lib | 2 +- rpp-test-sw/commands/cmd_fr_basic_test.c | 139 ++++++++++++----------- 2 files changed, 72 insertions(+), 69 deletions(-) diff --git a/rpp-lib b/rpp-lib index 8a3aa31..bd0f31e 160000 --- a/rpp-lib +++ b/rpp-lib @@ -1 +1 @@ -Subproject commit 8a3aa319332aa8f9f73d8d7a540d8dfbf6210fa4 +Subproject commit bd0f31e2adaa80d99e699a92001c8b296e8d1af3 diff --git a/rpp-test-sw/commands/cmd_fr_basic_test.c b/rpp-test-sw/commands/cmd_fr_basic_test.c index 081ab54..2f053a7 100644 --- a/rpp-test-sw/commands/cmd_fr_basic_test.c +++ b/rpp-test-sw/commands/cmd_fr_basic_test.c @@ -1210,13 +1210,13 @@ int cmd_do_fr_getpocstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *pa int cmd_do_fr_transmittxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) { int8_t retVal = ERR_PARAM_NO_ERROR; - uint32_t slotID; + uint32_t bufferID; uint8_t dataLength; int values[MAX_PARAM_VALUES_NUM]; uint8_t data[MAX_PARAM_VALUES_NUM]; char *token = NULL; - if (sscanf(param[1], "%d", &slotID) != 1) + if (sscanf(param[1], "%d", &bufferID) != 1) return -CMDERR_BADPAR; if (sscanf(param[2], " %2x", &values[0]) != 1) return -CMDERR_BADPAR; @@ -1232,7 +1232,7 @@ int cmd_do_fr_transmittxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char * dataLength++; } - retVal = rpp_fr_transmit_lpdu(0, slotID, data, dataLength); + retVal = rpp_fr_transmit_lpdu(0, bufferID, data, dataLength); if (retVal == SUCCESS) rpp_sci_printf("Data were set for transmission.\r\n"); else { @@ -1253,14 +1253,14 @@ int cmd_do_fr_transmittxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char * int cmd_do_fr_canceltxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) { int8_t retVal = ERR_PARAM_NO_ERROR; - uint32_t slotID; + uint32_t bufferID; - if (sscanf(param[1], "%d", &slotID) != 1) + if (sscanf(param[1], "%d", &bufferID) != 1) return -CMDERR_BADPAR; if (param[2] != NULL) return -CMDERR_BADPAR; - retVal = rpp_fr_cancel_transmit_lpdu(0, slotID); + retVal = rpp_fr_cancel_transmit_lpdu(0, bufferID); if (retVal == SUCCESS) rpp_sci_printf("Transmission canceled.\r\n"); else { @@ -1281,20 +1281,20 @@ int cmd_do_fr_canceltxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *pa int cmd_do_fr_receiverxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) { int8_t retVal = ERR_PARAM_NO_ERROR; - uint32_t slotID; + uint32_t bufferID; uint8_t data[cPayloadLengthMax]; Fr_RxLPduStatusType status; uint8_t receivedLength = 0; uint8_t i; - if (sscanf(param[1], "%d", &slotID) != 1) + if (sscanf(param[1], "%d", &bufferID) != 1) return -CMDERR_BADPAR; if (param[2] != NULL) return -CMDERR_BADPAR; memset(data, 0, sizeof(data)); - retVal = rpp_fr_receive_lpdu(0, slotID, data, &status, &receivedLength); + retVal = rpp_fr_receive_lpdu(0, bufferID, data, &status, &receivedLength); if (retVal == SUCCESS) { switch (status) { case FR_RECEIVED_MORE_DATA_AVAILABLE: @@ -1329,16 +1329,16 @@ int cmd_do_fr_receiverxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *p int cmd_do_fr_checktxlpdustatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) { int8_t retVal = ERR_PARAM_NO_ERROR; - uint32_t slotID; + uint32_t bufferID; Fr_TxLPduStatusType status; char *statusStrings[] = {"is not", "is"}; - if (sscanf(param[1], "%d", &slotID) != 1) + if (sscanf(param[1], "%d", &bufferID) != 1) return -CMDERR_BADPAR; if (param[2] != NULL) return -CMDERR_BADPAR; - retVal = rpp_fr_check_tx_lpdu_status(0, slotID, &status); + retVal = rpp_fr_check_tx_lpdu_status(0, bufferID, &status); if (retVal == SUCCESS) rpp_sci_printf("Message transmission %s pending.\r\n", statusStrings[status]); else { @@ -1359,14 +1359,14 @@ int cmd_do_fr_checktxlpdustatus(cmd_io_t *cmd_io, const struct cmd_des *des, cha int cmd_do_fr_disablelpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) { int8_t retVal = ERR_PARAM_NO_ERROR; - uint32_t slotID; + uint32_t bufferID; - if (sscanf(param[1], "%d", &slotID) != 1) + if (sscanf(param[1], "%d", &bufferID) != 1) return -CMDERR_BADPAR; if (param[2] != NULL) return -CMDERR_BADPAR; - retVal = rpp_fr_disable_lpdu(0, slotID); + retVal = rpp_fr_disable_lpdu(0, bufferID); if (retVal == SUCCESS) rpp_sci_printf("Buffer disabled.\r\n"); else { @@ -1782,13 +1782,13 @@ int cmd_do_fr_reconfigure_buffer(cmd_io_t *cmd_io, const struct cmd_des *des, ch { int ret; char channel[3]; - unsigned id, slot, maxpayload, cycleset, cycleoffset; + unsigned bufferID, slot, maxpayload, cycleset, cycleoffset; Fr_TMS570LS_BufferConfigType tmp_buffer; boolean_t is_pow2; uint8_t pow2; ret = sscanf(param[2], "id%i slot%i %2s cycset%i cycoffset%i max%i", - &id, + &bufferID, &slot, channel, &cycleset, @@ -1800,7 +1800,7 @@ int cmd_do_fr_reconfigure_buffer(cmd_io_t *cmd_io, const struct cmd_des *des, ch return -CMDERR_BADPAR; } - if (slot > 2047 || id > 2047) + if (slot > 2047 || bufferID > FR_MAX_BUFFERS_CNT) return badpar("Invalid slot number\n"); tmp_buffer.slotId = slot; if (strcmp(channel, "A") == 0) tmp_buffer.channel = FR_CHANNEL_A; @@ -1823,9 +1823,9 @@ int cmd_do_fr_reconfigure_buffer(cmd_io_t *cmd_io, const struct cmd_des *des, ch return badpar("Maximum payload in bytes must be less than 256\n"); tmp_buffer.maxPayload = maxpayload; - if (rpp_fr_reconfigure_lpdu(0, id, tmp_buffer.slotId, tmp_buffer.channel, cycleset, cycleoffset, tmp_buffer.maxPayload, 0) == SUCCESS) { + if (rpp_fr_reconfigure_lpdu(0, bufferID, tmp_buffer.slotId, tmp_buffer.channel, cycleset, cycleoffset, tmp_buffer.maxPayload, 0) == SUCCESS) { printf("id%i slot%i %2s cycset%i cycoffset%i max%i\n", - id, + bufferID, slot, channel, cycleset, @@ -1939,11 +1939,11 @@ cmd_des_t const cmd_des_fr_config_buffer = { "frbtcfgbuf?*","Configure a message buffer in the user configuration", "### Command syntax ###\n" "\n" - " frbtcfgbuf slot cyc max ppi int\n" + " frbtcfgbuf slot cyc max ppi int\n" "where\n" "\n" "- `` is 'S' for static segment buffers and 'D' for dynamic segment buffers,\n" - "- `` is the number of the buffer. Both static and dynamic buffers are numbered independently starting from zero,\n" + "- `` is the number of the buffer. Both static and dynamic buffers are numbered independently starting from zero,\n" "- `` is the number of the slot,\n" "- `` is one of 'A', 'B' or 'AB' and identifies the used channel,\n" "- `` is the cycle set when to send the buffer,\n" @@ -2064,6 +2064,9 @@ cmd_des_t const cmd_des_fr_start = { "\n" "The command should be called after the frbtinit command.\n" "\n" + "You may also want to call frbtallslots command to allow the communication\n" + "for all other slots besides the key slots.\n" + "\n" "### Example ###\n" "\n" " --> frbtstart\n" @@ -2227,22 +2230,23 @@ cmd_des_t const cmd_des_fr_getpocstatus = { /** Command descriptor for FlexRay transmit tx lpdu command */ cmd_des_t const cmd_des_fr_transmittxlpdu = { 0, 0, - "frbttransmit*","Transmit data in selected frame", + "frbttransmit*","Transmit data from the selected frame buffer", "### Command syntax ###\n" "\n" - " frbttransmit \n" + " frbttransmit \n" "where\n" "\n" - "- `` is a decimal number specifying the ID of the frame for which a buffer has been configured.\n" - "- `` is a sequence of hexadecimal numbers separated by spaces. Each number represents one byte of the message.\n" + "- `` is a decimal number specifying the ID of the frame\n" + " buffer configured for data transmission\n" + "- `` is a sequence of hexadecimal numbers separated by spaces.\n" + " Each number represents one byte of the message.\n" "\n" "### Description ###\n" "\n" "The command stands for Fr_TransmitTxLPdu function from the Autosar\n" - "specification. The command finds the first buffer assigned to the\n" - "specified frame ID and copies the given data into its data section in\n" - "the message RAM. Transmit request is set after the data are copied, so\n" - "transmission starts at the next occurrence of the frame in the\n" + "specification. The command copies the given data into the buffers data\n" + "section in the message RAM. Transmit request is set after the data are\n" + "copied, so transmission starts at the next occurrence of the frame in the\n" "communication cycle.\n" "\n" "### Example ###\n" @@ -2255,22 +2259,22 @@ cmd_des_t const cmd_des_fr_transmittxlpdu = { /** Command descriptor for FlexRay cancel tx lpdu command */ cmd_des_t const cmd_des_fr_canceltxlpdu = { 0, 0, - "frbtcanceltx*","Stop the transmission of the frame", + "frbtcanceltx*","Stop the transmission from the frame buffer", "### Command syntax ###\n" "\n" - " frbtcanceltx\n" + " frbtcanceltx\n" "\n" - "where `` is a decimal number specifying the ID of the frame for\n" - "which a buffer has been configured.\n" + "where `` is a decimal number specifying the ID of a configured\n" + "frame buffer\n" "\n" "### Description ###\n" "\n" "The command stands for Fr_CancelTxLPdu function from the Autosar\n" - "specification. The command finds all buffers assigned to the specified\n" - "frame ID and reconfigures them to stop transmitting data. The command\n" - "finishes successfully only if reconfiguration is allowed in message\n" - "RAM configuration (secureBuffers configuration parameter). Only TX\n" - "buffers and buffers not used for startup frames can be canceled.\n" + "specification. The command reconfigures the selected buffer to stop\n" + "data transmission. The command finishes successfully only if the\n" + "reconfiguration is allowed in message RAM configuration (secureBuffers\n" + "configuration parameter). Only TX buffers and buffers not used for startup\n" + "frames can be canceled.\n" "\n" "### Example ###\n" "\n" @@ -2285,28 +2289,27 @@ cmd_des_t const cmd_des_fr_receiverxlpdu = { "frbtreceive*","Receive a new message", "### Command syntax ###\n" "\n" - " frbtreceive\n" + " frbtreceive\n" "\n" - "where `` is a decimal number specifying the ID of the frame for\n" - "which a buffer was configured.\n" + "where `` is a decimal number specifying the ID of a configured\n" + "frame buffer.\n" "\n" "### Description ###\n" "\n" "The command stands for Fr_ReceiveRxLPdu function from the Autosar\n" - "specification. The command finds the first buffer assigned to the\n" - "specified frame ID, determines if a new message has been received and\n" - "reads it out of the buffer. If no message was received, \"No message\n" - "received\" is printed. If a new message was received, all message data\n" - "are printed as a hexadecimal values. If a new message was retrieved\n" - "from a FIFO buffer and more messages are available in it, \"More\n" - "messages are still in FIFO\" is printed.\n" + "specification. The command tries to read a new message from the selected\n" + "buffer. If new message is available, it is copied out of the buffer and\n" + "printed. If no message is available, \"No message received\" is printed.\n" + "If a new message was retrieved from a FIFO buffer and more messages are\n" + "available in it, \"More messages are still in FIFO\" is printed.\n" "\n" "### Example ###\n" "\n" " --> frbtreceive0\n" " More messages are still in FIFO:\n" " Received message (32 B):\n" - " ee ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n", + " ee ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n" + " 00 00 00 00 00 00 00 00 00\n", CMD_HANDLER(cmd_do_fr_receiverxlpdu), (void *)&cmd_list_fr_basic_test }; @@ -2316,20 +2319,21 @@ cmd_des_t const cmd_des_fr_checktxlpdustatus = { "frbtchecktx*","Print the status of the transmit buffer", "### Command syntax ###\n" "\n" - " frbtchecktx\n" + " frbtchecktx\n" "\n" - "where `` is a decimal number specifying the ID of the frame for\n" - "which a buffer has been configured.\n" + "where `` is a decimal number specifying the ID of a configured\n" + "frame buffer.\n" "\n" "### Description ###\n" "\n" "The command stands for Fr_CheckTxLPduStatus function from the Autosar\n" - "specification. The command finds the first buffer assigned to the\n" - "specified frame ID, reads its status and prints it. The buffer can be\n" - "in one of the two states:\n" + "specification. The command reads and prints status of the selected frame buffer.\n" + "The buffer can be in one of the two states:\n" "\n" - "- Message transmission is pending, which means that the buffer has not yet sent its message in single shot mode or that it is in continuous mode.\n" - "- No message transmission is pending, which means that the buffer is in single shot mode and the message has already been sent.\n" + "- Message transmission is pending, which means that the buffer has not yet sent its\n" + " message in single shot mode or that it is in continuous mode.\n" + "- No message transmission is pending, which means that the buffer is in single shot\n" + " mode and the message has already been sent.\n" "\n" "### Example ###\n" "\n" @@ -2344,19 +2348,18 @@ cmd_des_t const cmd_des_fr_disablelpdu = { "frbtdisable*","Disable the buffers assigned to the frame", "### Command syntax ###\n" "\n" - " frbtdisable\n" + " frbtdisable\n" "\n" - "where `` is a decimal number specifying the ID of a frame. The\n" - "buffers configure for this frame will be disabled.\n" + "where `` is a decimal number specifying the ID of a frame buffer.\n" + "The buffer configured will be disabled.\n" "\n" "### Description ###\n" "\n" "The command stands for Fr_DisableLPdu function from the Autosar\n" - "specification. The command finds all buffers assigned to the specified\n" - "frame ID and disables them. This means that those buffers will be\n" - "unavailable for the communication until their reconfiguration (which\n" - "is not yet implemented). Buffers used for startup frames and FIFO RX\n" - "buffers cannot be disabled.\n" + "specification. The command disables the selected buffer. This means\n" + "that this buffer will be unavailable for the communication until\n" + "their reconfiguration (which is not yet implemented). Buffers used\n" + "for startup frames and FIFO RX buffers cannot be disabled.\n" "\n" "### Example ###\n" "\n" @@ -2702,10 +2705,10 @@ cmd_des_t const cmd_des_fr_reconfigure_buffer = { "frbtreconfigurebuf*","Reconfigure a buffer to communicate in another slot", "### Command syntax ###\n" "\n" - " frbtreconfigurebuf id slot cycset cycoffset max\n" + " frbtreconfigurebuf id slot cycset cycoffset max\n" "where\n" "\n" - "- `` is a number specifying a slot, where the buffer is currently communicating,\n" + "- `` is a number specifying a slot, where the buffer is currently communicating,\n" "- `` is a number, where buffer will be communicating after the reconfiguration,\n" "- `` is one of 'A', 'B' or 'AB' and identifies the used channel,\n" "- `` is the cycle set. It has to be one of 0, 1, 2, 4, 8, 16, 32, 64. It specifies together with `` the cycle filtering.\n" -- 2.39.2