]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - rpp-test-sw/commands/cmd_fr_basic_test.c
Merge branches 'master' and 'rm48/master'
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / cmd_fr_basic_test.c
diff --git a/rpp-test-sw/commands/cmd_fr_basic_test.c b/rpp-test-sw/commands/cmd_fr_basic_test.c
new file mode 100644 (file)
index 0000000..2f053a7
--- /dev/null
@@ -0,0 +1,2768 @@
+/*
+ * Copyright (C) 2012-2013 Czech Technical University in Prague
+ *
+ * Created on: 6.8.2013
+ *
+ * Authors:
+ *     - Michal Horn
+ *
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
+ *
+ * File : cmd_fr_basic_test.c
+ *
+ * Abstract:
+ *             The file contains a set of commands to control the FlexRay driver.
+ *             Those commands can be used to configure RPP board as a FlexRay node,
+ *             configure a set of TX and RX buffers, get status of the buffers and
+ *             the FlexRay controller, manipulate with timers and control the transmission
+ *             of messages.
+ */
+
+
+#include "cmd_fr_basic_test.h"
+
+#ifndef DOCGEN
+
+#include <string.h>
+#include "cmdproc_utils.h"
+#include "drv/drv.h"
+#include "rpp/rpp.h"
+#include "hal/hal.h"
+#include "stdio.h"
+
+#define printf rpp_sci_printf
+
+static inline int badpar(const char *msg)
+{
+       printf("%s", msg);
+       return -CMDERR_BADPAR;
+}
+
+/**
+ * Flag to recognize whether the FlexRay driver was already initialized. If it was, no further configuration is allowed.
+ */
+static boolean_t fr_initialized = FALSE;
+
+/**
+ * This structure contains global FlexRay configuration.
+ * All nodes in the network have to use the same values for
+ * all parameters of this structure.
+ */
+static Fr_TMS570LS_ClusterConfigType Fr_cluster_config = {
+       .gColdStartAttempts = 0x2,
+       .gListenNoise = 0xF,
+       .gMacroPerCycle = 0x15E0,   // (cycle period, 5.6us)
+       .gMaxWithoutClockCorrectionFatal = 0xF,
+       .gMaxWithoutClockCorrectionPassive = 0xF,
+       .gNetworkManagementVectorLength = 12,
+       .gNumberOfMinislots = 0x15A,
+       .gNumberOfStaticSlots = 0x8,
+       .gOffsetCorrectionStart = 0xAE4,
+       .gPayloadLengthStatic = 0x9,
+       .gSyncNodeMax = 0xF,
+       .gdActionPointOffset = 0x4,
+       .gdCASRxLowMax = 0x43,
+       .gdDynamicSlotIdlePhase = 0x1,
+       .gdMinislot = 0x4,
+       .gdMinislotActionPointOffset = 0x2,
+       .gdNIT = 0xAE3,
+       .gdSampleClockPeriod = 0,       // 10mbit/sec
+       .gdStaticSlot = 0x56,
+       .gdTSSTransmitter = 0xA,
+       .gdWakeupSymbolRxIdle = 18,
+       .gdWakeupSymbolRxLow = 18,
+       .gdWakeupSymbolRxWindow = 76,
+       .gdWakeupSymbolTxIdle = 180,
+       .gdWakeupSymbolTxLow = 60
+};
+
+/**
+ * This structure contains local configuration of the FlexRay node A.
+ * All nodes in the network shall have their own local configuraion,
+ * but it does not matters if they share some together, until their
+ * buffer configuration differs.
+ */
+static Fr_TMS570LS_NodeConfigType Fr_node_A_config = {
+       .pAllowHaltDueToClock = 0,
+       .pAllowPassiveToActive = 0xF,
+       .pChannels = FR_CHANNEL_AB,
+       .pClusterDriftDamping = 0x1,
+       .pDelayCompensationA = 0x3,
+       .pDelayCompensationB = 0x3,
+       .pExternOffsetCorrection = 0,
+       .pExternRateCorrection = 0,
+       .pKeySlotUsedForStartup = TRUE,
+       .pKeySlotUsedForSync = TRUE,
+       .pLatestTx = 0x10D,
+       .pMacroInitialOffsetA = 0x6,
+       .pMacroInitialOffsetB = 0x6,
+       .pMicroInitialOffsetA = 0x18,
+       .pMicroInitialOffsetB = 0x18,
+       .pMicroPerCycle = 0x36B00,
+       .pRateCorrectionOut = 0xCD,
+       .pOffsetCorrectionOut = 0x151,
+       .pSamplesPerMicrotick = 0,      // 10 mbit/sec
+       .pSingleSlotEnabled = TRUE,
+       .pWakeupChannel = FR_CHANNEL_A,
+       .pWakeupPattern = 2,
+       .pdAcceptedStartupRange = 0x81,
+       .pdListenTimeout = 0x36DA2,
+       .pdMaxDrift = 0x151,
+       .pDecodingCorrection = 0x33
+};
+
+/**
+ * This structure contains local configuration of the FlexRay node B.
+ * All nodes in the network shall have their own local configuraion,
+ * but it does not matters if they share some together, until their
+ * buffer configuration differs.
+ */
+static Fr_TMS570LS_NodeConfigType Fr_node_B_config = {
+       .pAllowHaltDueToClock = 0,
+       .pAllowPassiveToActive = 0xF,
+       .pChannels = FR_CHANNEL_AB,
+       .pClusterDriftDamping = 0x1,
+       .pDelayCompensationA = 0x3,
+       .pDelayCompensationB = 0x3,
+       .pExternOffsetCorrection = 0,
+       .pExternRateCorrection = 0,
+       .pKeySlotUsedForStartup = TRUE,
+       .pKeySlotUsedForSync = TRUE,
+       .pLatestTx = 0x10D,
+       .pMacroInitialOffsetA = 0x6,
+       .pMacroInitialOffsetB = 0x6,
+       .pMicroInitialOffsetA = 0x18,
+       .pMicroInitialOffsetB = 0x18,
+       .pMicroPerCycle = 0x36B00,
+       .pRateCorrectionOut = 0xCD,
+       .pOffsetCorrectionOut = 0x151,
+       .pSamplesPerMicrotick = 0,          // 10 mbit/sec
+       .pSingleSlotEnabled = TRUE,
+       .pWakeupChannel = FR_CHANNEL_A,
+       .pWakeupPattern = 2,
+       .pdAcceptedStartupRange = 0x81,
+       .pdListenTimeout = 0x36DA2,
+       .pdMaxDrift = 0x151,
+       .pDecodingCorrection = 0x33
+};
+
+static Fr_TMS570LS_MsgRAMConfig Fr_node_A_msgRAM_config = {
+       .dynSegmentBufferCount = 3,
+       .fifoBufferCount = 5,
+       .secureBuffers = FR_SB_RECONFIG_ENABLED,
+       .statSegmentBufferCount = 5,
+       .syncFramePayloadMultiplexEnabled = 0
+};
+
+static Fr_TMS570LS_MsgRAMConfig Fr_node_B_msgRAM_config = {
+       .dynSegmentBufferCount = 3,
+       .fifoBufferCount = 5,
+       .secureBuffers = FR_SB_RECONFIG_ENABLED,
+       .statSegmentBufferCount = 5,
+       .syncFramePayloadMultiplexEnabled = 0
+};
+
+static Fr_TMS570LS_BufferConfigType Fr_node_A_static_buffers_config[] = {
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 1
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 2
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 3
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 4
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = TRUE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 5
+       }
+
+};
+
+static Fr_TMS570LS_BufferConfigType Fr_node_B_static_buffers_config[] = {
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 2
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 1
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 4
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 3
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = TRUE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 5
+       }
+};
+
+static Fr_TMS570LS_BufferConfigType Fr_node_A_dynamic_buffers_config[] = {
+       {
+               .channel = FR_CHANNEL_A,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 64,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 9
+       },
+       {
+               .channel = FR_CHANNEL_B,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 32,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 10
+       },
+       {
+               .channel = FR_CHANNEL_A,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 16,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 11
+       }
+};
+
+
+static Fr_TMS570LS_BufferConfigType Fr_node_B_dynamic_buffers_config[] = {
+       {
+               .channel = FR_CHANNEL_B,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 32,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 10
+       },
+       {
+               .channel = FR_CHANNEL_A,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 64,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 9
+       },
+       {
+               .channel = FR_CHANNEL_A,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = TRUE,
+               .maxPayload = 9,
+               .msgBufferInterrupt = TRUE,
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = FALSE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = TRUE,
+               .slotId = 12
+       }
+};
+
+static Fr_TMS570LS_BufferConfigType Fr_node_A_fifo_buffers_config[] = {
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 127,
+               .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 12
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 127,
+               .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 12
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 127,
+               .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 12
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 127,
+               .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 12
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 127,
+               .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 12
+       }
+};
+
+static Fr_TMS570LS_BufferConfigType Fr_node_B_fifo_buffers_config[] = {
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 64,
+               .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 0 // No Frame is rejected
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 64,
+               .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 0 // No Frame is rejected
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 64,
+               .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 0 // No Frame is rejected
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 64,
+               .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 0 // No Frame is rejected
+       },
+       {
+               .channel = FR_CHANNEL_AB,
+               .cycleCounterFiltering = 0,
+               .fidMask = 0,
+               .isTx = FALSE,
+               .maxPayload = 64,
+               .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
+               .payloadPreambleIndicatorTr = FALSE,
+               .rejectNullFrames = TRUE,
+               .rejectStaticSegment = FALSE,
+               .singleTransmit = FALSE,
+               .slotId = 0 // No Frame is rejected
+       }
+};
+
+/**
+ * This is an unifying configuration structure for the node A.
+ * It joins all the configuration structure together.
+ */
+static Fr_ConfigType Fr_config_node_A = {
+       .clusterConfiguration = &Fr_cluster_config,
+       .dynamicBufferConfigs = Fr_node_A_dynamic_buffers_config,
+       .fifoBufferConfigs = Fr_node_A_fifo_buffers_config,
+       .msgRAMConfig = &Fr_node_A_msgRAM_config,
+       .nodeConfiguration = &Fr_node_A_config,
+       .staticBufferConfigs = Fr_node_A_static_buffers_config
+};
+
+/**
+ * This is an unifying configuration structure for the node A.
+ * It joins all the configuration structure together.
+ */
+static Fr_ConfigType Fr_config_node_B = {
+       .clusterConfiguration = &Fr_cluster_config,
+       .dynamicBufferConfigs = Fr_node_B_dynamic_buffers_config,
+       .fifoBufferConfigs = Fr_node_B_fifo_buffers_config,
+       .msgRAMConfig = &Fr_node_B_msgRAM_config,
+       .nodeConfiguration = &Fr_node_B_config,
+       .staticBufferConfigs = Fr_node_B_static_buffers_config
+};
+
+/* User configuration */
+
+static Fr_TMS570LS_ClusterConfigType user_cluster_config;
+static Fr_TMS570LS_NodeConfigType user_node_config;
+static Fr_TMS570LS_MsgRAMConfig user_msg_ram_config;
+static Fr_TMS570LS_BufferConfigType user_static_buffer_config[RPP_FR_MAX_STATIC_BUF_CNT];
+static Fr_TMS570LS_BufferConfigType user_dynamic_buffer_config[RPP_FR_MAX_DYNAMIC_BUF_CNT];
+static Fr_TMS570LS_BufferConfigType user_fifo_buffer_config[RPP_FR_MAX_FIFO_BUF_DEPTH];
+static Fr_ConfigType user_configuration = {
+       .clusterConfiguration = &user_cluster_config,
+       .nodeConfiguration = &user_node_config,
+       .msgRAMConfig = &user_msg_ram_config,
+       .staticBufferConfigs = user_static_buffer_config,
+       .dynamicBufferConfigs = user_dynamic_buffer_config,
+       .fifoBufferConfigs = user_fifo_buffer_config,
+};
+;
+
+#define USER_CONFIG_NOT_DONE        0x0
+#define USER_CONFIG_CLUSTER         0x1
+#define USER_CONFIG_NODE            0x2
+
+static uint8_t user_configuration_state = USER_CONFIG_NOT_DONE;
+static uint8_t user_static_buffer_configured = 0;
+static uint8_t user_dynamic_buffer_configured = 0;
+static uint8_t user_fifo_buffer_depth = 0;
+
+/**
+ * Split string into numbers
+ *
+ * The function takes a string with hexadecimal numbers,
+ * separated by spaces, and converts it into an array of numbers.
+ *
+ * For example "0x2 0xA 0XDD 0xABCD" -> {0x2, 0xA, 0XDD, 0xABCD}
+ *
+ * @param [in] params Address of the string which will be converted
+ * @param [in] params_cnt A number of parameters, which should be found and converted from the string params
+ * @param [out] tmp_params Address, where converted array of numbers will be stored
+ *
+ * @return SUCCESS when all parameters were converted to the array of numbers,
+ *         FAILURE when the string was too short, too long or some other error occurred.
+ */
+static int8_t cmd_fr_parse_params(const char *params, uint32_t params_cnt, uint32_t *tmp_params)
+{
+       char cpy_params[256];
+       char *token;
+       int i;
+
+       if (params == NULL || tmp_params == NULL)
+               return FAILURE;
+       strncpy(cpy_params, params, 256);
+       token = strtok(cpy_params, " ");
+       if (token == NULL)
+               return FAILURE;
+       for (i = 0; i < params_cnt; i++) {
+               if (sscanf(token, "%i", &tmp_params[i]) == EOF)     // No number found
+                       return FAILURE;
+               if ((token = strtok(NULL, " ")) == NULL && i < params_cnt-1)    // Not enough parameters in the string
+                       return FAILURE;
+       }
+       return SUCCESS;
+}
+
+int8_t cmd_fr_config_cluster_params(const char *params)
+{
+       uint32_t tmp_params[FR_CLUSTER_PARAMS_CNT];
+
+       if (cmd_fr_parse_params(params, FR_CLUSTER_PARAMS_CNT, tmp_params) == FAILURE)
+               return FAILURE;
+
+       user_cluster_config.gColdStartAttempts = tmp_params[0];
+       user_cluster_config.gListenNoise = tmp_params[1];
+       user_cluster_config.gMacroPerCycle = tmp_params[2];
+       user_cluster_config.gMaxWithoutClockCorrectionFatal = tmp_params[3];
+       user_cluster_config.gMaxWithoutClockCorrectionPassive = tmp_params[4];
+       user_cluster_config.gNetworkManagementVectorLength = tmp_params[5];
+       user_cluster_config.gNumberOfMinislots = tmp_params[6];
+       user_cluster_config.gNumberOfStaticSlots = tmp_params[7];
+       user_cluster_config.gOffsetCorrectionStart = tmp_params[8];
+       user_cluster_config.gPayloadLengthStatic = tmp_params[9];
+       user_cluster_config.gSyncNodeMax = tmp_params[10];
+       user_cluster_config.gdActionPointOffset = tmp_params[11];
+       user_cluster_config.gdCASRxLowMax = tmp_params[12];
+       user_cluster_config.gdDynamicSlotIdlePhase = tmp_params[13];
+       user_cluster_config.gdMinislot = tmp_params[14];
+       user_cluster_config.gdMinislotActionPointOffset = tmp_params[15];
+       user_cluster_config.gdNIT = tmp_params[16];
+       user_cluster_config.gdSampleClockPeriod = tmp_params[17];
+       user_cluster_config.gdStaticSlot = tmp_params[18];
+       user_cluster_config.gdTSSTransmitter = tmp_params[19];
+       user_cluster_config.gdWakeupSymbolRxIdle = tmp_params[20];
+       user_cluster_config.gdWakeupSymbolRxLow = tmp_params[21];
+       user_cluster_config.gdWakeupSymbolRxWindow = tmp_params[22];
+       user_cluster_config.gdWakeupSymbolTxIdle = tmp_params[23];
+       user_cluster_config.gdWakeupSymbolTxLow = tmp_params[24];
+
+       user_configuration_state |= USER_CONFIG_CLUSTER;
+       return SUCCESS;
+}
+
+int8_t cmd_fr_config_node_params(const char *params)
+{
+       uint32_t tmp_params[FR_NODE_PARAMS_CNT+2];  // +2 because two more parameters from message RAM structure are expected in the string.
+       Fr_ChannelType channels[3] = {FR_CHANNEL_A, FR_CHANNEL_B, FR_CHANNEL_AB};
+       Fr_TMS570LS_SecureBuffersType secure[4] = {FR_SB_RECONFIG_ENABLED, FR_SB_STAT_REC_DISABLED_STAT_TR_DISABLED, FR_SB_ALL_REC_DISABLED, FR_SB_ALL_REC_DISABLED_STAT_TR_DISABLED};
+
+       if (cmd_fr_parse_params(params, FR_NODE_PARAMS_CNT+2, tmp_params) == FAILURE)
+               return FAILURE;
+
+       user_node_config.pAllowHaltDueToClock = tmp_params[0];
+       user_node_config.pAllowPassiveToActive = tmp_params[1];
+       if (tmp_params[2] > 2) return FAILURE;
+       user_node_config.pChannels = channels[ tmp_params[2] ];
+       user_node_config.pClusterDriftDamping = tmp_params[3];
+       user_node_config.pDelayCompensationA = tmp_params[4];
+       user_node_config.pDelayCompensationB = tmp_params[5];
+       user_node_config.pExternOffsetCorrection = tmp_params[6];
+       user_node_config.pExternRateCorrection = tmp_params[7];
+       user_node_config.pKeySlotUsedForStartup = tmp_params[8];
+       user_node_config.pKeySlotUsedForSync = tmp_params[9];
+       user_node_config.pLatestTx = tmp_params[10];
+       user_node_config.pMacroInitialOffsetA = tmp_params[11];
+       user_node_config.pMacroInitialOffsetB = tmp_params[12];
+       user_node_config.pMicroInitialOffsetA = tmp_params[13];
+       user_node_config.pMicroInitialOffsetB = tmp_params[14];
+       user_node_config.pMicroPerCycle = tmp_params[15];
+       user_node_config.pRateCorrectionOut = tmp_params[16];
+       user_node_config.pOffsetCorrectionOut = tmp_params[17];
+       user_node_config.pSamplesPerMicrotick = tmp_params[18];
+       user_node_config.pSingleSlotEnabled = tmp_params[19];
+       if (tmp_params[20] > 1) return FAILURE;
+       user_node_config.pWakeupChannel = channels[ tmp_params[20] ];
+       user_node_config.pWakeupPattern = tmp_params[21];
+       user_node_config.pdAcceptedStartupRange = tmp_params[22];
+       user_node_config.pdListenTimeout = tmp_params[23];
+       user_node_config.pdMaxDrift = tmp_params[24];
+       user_node_config.pDecodingCorrection = tmp_params[25];
+       user_msg_ram_config.syncFramePayloadMultiplexEnabled = tmp_params[26];
+       if (tmp_params[27] > 3) return FAILURE;
+       user_msg_ram_config.secureBuffers = secure[ tmp_params[27] ];
+
+       user_configuration_state |= USER_CONFIG_NODE;
+       return SUCCESS;
+}
+
+int cmd_do_fr_config_fifo(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       Fr_TMS570LS_BufferConfigType *fifo_buffer_ptr = &user_fifo_buffer_config[0];
+       int ret, i;
+       char channel[3], rej_static_frames[8], rej_null_frames[8];
+       unsigned depth, slot, cycleset, maxpayload, mask;
+       Fr_TMS570LS_BufferConfigType tmp_buffer;
+
+       if (fr_initialized) {
+               rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
+               return -CMDERR_BADCFG;
+       }
+
+       ret = sscanf(param[2], "rejslot%i slotmask%i depth%i %2s cyc%i max%i %10s %10s",
+                                &slot,
+                                &mask,
+                                &depth,
+                                channel,
+                                &cycleset,
+                                &maxpayload,
+                                rej_null_frames,
+                                rej_static_frames
+                                );
+       if (ret != 8) {
+               printf("Error parsing parameter %d\n", ret+1);
+               return -CMDERR_BADPAR;
+       }
+
+       if (depth < 1 || depth >= RPP_FR_MAX_FIFO_BUF_DEPTH)
+               return badpar("Depth too high\n");
+       user_fifo_buffer_depth = depth;
+
+       if (slot > 2047)
+               return badpar("Invalid slot number\n");
+       tmp_buffer.slotId = slot;
+       if (slot > 2047)
+               return badpar("Invalid mask\n");
+       tmp_buffer.fidMask = mask;
+       if (strcmp(channel, "A") == 0) tmp_buffer.channel = FR_CHANNEL_A;
+       else if (strcmp(channel, "B") == 0) tmp_buffer.channel = FR_CHANNEL_B;
+       else if (strcmp(channel, "AB") == 0) tmp_buffer.channel = FR_CHANNEL_AB;
+       else return badpar("Channel parsing error\n");
+
+       if (cycleset >= 0x80)
+               return badpar("Cycle set must be less than 0x80.\n");
+       tmp_buffer.cycleCounterFiltering = cycleset;
+
+       if (maxpayload >= 128)
+               return badpar("Maximum payload in half-words must be less than 128\n");
+       tmp_buffer.maxPayload = maxpayload;
+
+       if (strcmp(rej_null_frames, "rejnull") == 0) tmp_buffer.rejectNullFrames = true;
+       else if (strcmp(rej_null_frames, "accnull") == 0) tmp_buffer.rejectNullFrames = false;
+       else return badpar("Reject/accept NULL frames parsing error\n");
+
+       if (strcmp(rej_static_frames, "rejstat") == 0)
+               tmp_buffer.rejectStaticSegment = true;
+       else if (strcmp(rej_static_frames, "accstat") == 0)
+               tmp_buffer.rejectStaticSegment = false;
+       else return badpar("Invalid reject/accept static frame parameter");
+
+       for (i = 0; i < user_fifo_buffer_depth; i++) {
+               fifo_buffer_ptr[i].slotId = tmp_buffer.slotId;
+               fifo_buffer_ptr[i].fidMask = tmp_buffer.fidMask;
+               fifo_buffer_ptr[i].maxPayload = tmp_buffer.maxPayload;
+               fifo_buffer_ptr[i].channel = tmp_buffer.channel;
+               fifo_buffer_ptr[i].cycleCounterFiltering = tmp_buffer.cycleCounterFiltering;
+               fifo_buffer_ptr[i].isTx = FALSE;
+               fifo_buffer_ptr[i].singleTransmit = FALSE;
+               fifo_buffer_ptr[i].payloadPreambleIndicatorTr = FALSE;
+               fifo_buffer_ptr[i].rejectNullFrames = tmp_buffer.rejectNullFrames;
+               fifo_buffer_ptr[i].rejectStaticSegment = tmp_buffer.rejectStaticSegment;
+               fifo_buffer_ptr[i].msgBufferInterrupt = 0;
+       }
+
+       printf("frbtcfgfifo rejslot%i slotmask%i depth%i %2s cyc%i max%i %10s %10s\n",
+                  slot,
+                  mask,
+                  depth,
+                  channel,
+                  cycleset,
+                  maxpayload,
+                  rej_null_frames,
+                  rej_static_frames
+                  );
+
+       return SUCCESS;
+}
+
+int cmd_do_fr_config_bufer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       Fr_TMS570LS_BufferConfigType *cfg;
+
+       int ret;
+       char buf_type, channel[3],rxtx[3], single_continuous[11];
+       unsigned buffer, slot, cycleset, maxpayload, intr, preamb;
+
+       if (fr_initialized) {
+               rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
+               return -CMDERR_BADCFG;
+       }
+
+       ret = sscanf(param[1], "%c%i slot%i %2s cyc%i %2s max%i %10s ppi%i int%i",
+                                &buf_type,
+                                &buffer,
+                                &slot,
+                                channel,
+                                &cycleset,
+                                rxtx,
+                                &maxpayload,
+                                single_continuous,
+                                &preamb,
+                                &intr
+                                );
+       if (ret != 10) {
+               printf("Error parsing parameter %d\n", ret+1);
+               return -CMDERR_BADPAR;
+
+       }
+
+       switch (buf_type) {
+       case 'S':
+               if (buffer >= RPP_FR_MAX_STATIC_BUF_CNT)
+                       return badpar("Buffer index too high\n");
+               cfg = &user_static_buffer_config[buffer];
+               break;
+       case 'D':
+               if (buffer >= RPP_FR_MAX_DYNAMIC_BUF_CNT)
+                       return badpar("Buffer index too high\n");
+               cfg = &user_dynamic_buffer_config[buffer];
+               break;
+       default:
+               return badpar("Invalid buffer type (S, D)\n");
+       }
+
+       if (slot < 1 || slot > 2047)
+               return badpar("Invalid slot number\n");
+       cfg->slotId = slot;
+
+       if (strcmp(channel, "A") == 0) cfg->channel = FR_CHANNEL_A;
+       else if (strcmp(channel, "B") == 0) cfg->channel = FR_CHANNEL_B;
+       else if (strcmp(channel, "AB") == 0) cfg->channel = FR_CHANNEL_AB;
+       else return badpar("Channel parsing error\n");
+       if (buf_type == 'D' && cfg->channel == FR_CHANNEL_AB)
+               return badpar("Dynamic segment buffers cannot have AB channels.\n");
+
+       if (cycleset >= 0x80)
+               return badpar("Cycle set must be less than 0x80.\n");
+       cfg->cycleCounterFiltering = cycleset;
+
+       if (strcmp(rxtx, "tx") == 0) cfg->isTx = true;
+       else if (strcmp(rxtx, "rx") == 0) cfg->isTx = false;
+       else return badpar("RX/TX parsing error\n");
+
+       if (maxpayload >= 128)
+               return badpar("Maximum payload in half-words must be less than 128\n");
+       cfg->maxPayload = maxpayload;
+
+       if (0 == strcmp(single_continuous, "single") ||
+               0 == strcmp(single_continuous, "s"))
+               cfg->singleTransmit = true;
+       else if (0 == strcmp(single_continuous, "continuous") ||
+                        0 == strcmp(single_continuous, "c"))
+               cfg->singleTransmit = false;
+       else return badpar("Invalid single/continuous parameter");
+
+       if (preamb > 1)
+               return badpar("Payload preamble indicator must be 0 or 1");
+       cfg->payloadPreambleIndicatorTr = preamb;
+
+       if (intr > 1)
+               return badpar("Interrupt parameter must be 0 or 1");
+       cfg->msgBufferInterrupt = intr;
+
+       switch (buf_type) {
+       case 'S':
+               if (buffer >= user_static_buffer_configured)
+                       user_static_buffer_configured = buffer + 1;
+               break;
+       case 'D':
+               if (buffer >= user_dynamic_buffer_configured)
+                       user_dynamic_buffer_configured = buffer + 1;
+               break;
+       }
+
+       printf("frbtcfgbuf%c%i slot%i %2s cyc%i %2s max%i %10s ppi%i int%i\n",
+                  buf_type,
+                  buffer,
+                  slot,
+                  channel,
+                  cycleset,
+                  rxtx,
+                  maxpayload,
+                  single_continuous,
+                  preamb,
+                  intr
+                  );
+
+       return 0;
+}
+
+
+
+/**
+ *  @brief     Do the user configuration of the FlexRay cluster parameters
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_user_config(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       char *token;
+
+       if (fr_initialized) {
+               rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
+               return -CMDERR_BADCFG;
+       }
+
+       token = strtok(param[1], " ");
+       if (strcmp(token, "cluster") == 0) {
+               if (cmd_fr_config_cluster_params(param[2]) == FAILURE) {
+                       rpp_sci_printf("FlexRay cluster configuration not accepted.\n");
+                       return -CMDERR_BADPAR;
+               }
+               rpp_sci_printf("FlexRay cluster configuration accepted.\n");
+       }
+       else if (strcmp(token, "node") == 0) {
+               if (cmd_fr_config_node_params(param[2]) == FAILURE) {
+                       rpp_sci_printf("FlexRay node configuration not accepted.\n");
+                       return -CMDERR_BADPAR;
+               }
+               rpp_sci_printf("FlexRay node configuration accepted.\n");
+       }
+       else
+               return -CMDERR_BADPAR;
+
+       return 0;
+}
+
+/**
+ *  @brief     Initialize the device as FlexRay node.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_init(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       const Fr_ConfigType *Fr_ConfigPtr = NULL;
+       int8_t retVal = SUCCESS;
+       uint32_t error = ERR_PARAM_NO_ERROR;
+
+       if (*param[1] == 'A')
+               Fr_ConfigPtr = &Fr_config_node_A;
+       else if (*param[1] == 'B')
+               Fr_ConfigPtr = &Fr_config_node_B;
+       else if (*param[1] == 'U') {    // Select the user configuration  -  call config commands first
+               user_msg_ram_config.statSegmentBufferCount = user_static_buffer_configured;
+               user_msg_ram_config.dynSegmentBufferCount = user_dynamic_buffer_configured;
+               user_msg_ram_config.fifoBufferCount = user_fifo_buffer_depth;
+               Fr_ConfigPtr = &user_configuration;
+       }
+       else
+               return -CMDERR_BADPAR;
+
+       retVal = rpp_fr_init_driver(Fr_ConfigPtr, &error);
+       if (retVal == SUCCESS) {
+               rpp_sci_printf("FlexRay driver initialized.\r\n");
+               fr_initialized = TRUE;
+       }
+       else {
+               retVal = rpp_fr_init_controller(0, &error);
+               if (retVal == SUCCESS) {
+                       rpp_sci_printf("FlexRay controller reinitialized.\r\n");
+                       return 0;
+               }
+               else {
+                       rpp_sci_printf("FlexRay needs to be configured before initialization.\r\n");
+                       return -CMDERR_BADCFG;
+               }
+       }
+
+       retVal = rpp_fr_init_controller(0, &error);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("FlexRay controller initialized.\r\n");
+       else {
+               if (error & FR_INIT_ERR_CLUSTER_CONFIG)
+                       rpp_sci_printf("Cluster configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
+               else if (error & FR_INIT_ERR_NODE_CONFIG)
+                       rpp_sci_printf("Node configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
+               else if (error & FR_INIT_ERR_MSGRAM_CONFIG)
+                       rpp_sci_printf("Message RAM configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
+               else if (error & FR_INIT_ERR_BUFFPARAM_CONFIG)
+                       rpp_sci_printf("Buffer configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
+               else if (error & (uint32_t)FR_INIT_ERR_BUFF_CONFIG)
+                       rpp_sci_printf("Buffer configuration error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
+               else
+                       rpp_sci_printf("POC state switching error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Starts FlexRay communication
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_start(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = SUCCESS;
+       uint32_t error = ERR_PARAM_NO_ERROR;
+
+       retVal = rpp_fr_start_communication(0, &error);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("FlexRay communication is running.\r\n");
+       else {
+               if (error & FR_STARTUP_ERR_SW_STUP_FOLLOW)
+                       rpp_sci_printf("Can not switch POC to RUN state.\r\n");
+               else if (error & FR_STARTUP_ERR_CSINH_DIS)
+                       rpp_sci_printf("Cold start inhibit disabled error.\r\n");
+               else if (error & FR_STARTUP_ERR_SW_STUP_READY)
+                       rpp_sci_printf("Can not switch back to READY from STARTUP.\r\n");
+               else if (error & FR_STARTUP_ERR_SW_STUP_AS_NCOLD)
+                       rpp_sci_printf("Can not switch to STARTUP as non-coldstarter.\r\n");
+               else
+                       rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Invokes POC command ALL_SLOTS
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_allslots(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+
+       retVal = rpp_fr_all_slots(0);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("FlexRay node started communication in all slots.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Halt FlexRay communication
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_halt(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+
+       retVal = rpp_fr_halt_communication(0);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("FlexRay node communication halted.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Abort FlexRay communication
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_abort(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+
+       retVal = rpp_fr_abort_communication(0);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("FlexRay node communication aborted.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Send wake up pattern
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_sendwup(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+
+       retVal = rpp_fr_send_wup(0);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Wake up pattern has been sent.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Set channel for wake up pattern sending.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_setwuchannel(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       Fr_ChannelType channel = FR_CHANNEL_A;
+
+       if (*param[1] == 'A')
+               channel = FR_CHANNEL_A;
+       else if (*param[1] == 'B')
+               channel = FR_CHANNEL_B;
+       else
+               return -CMDERR_BADPAR;
+       retVal = rpp_fr_set_wu_channel(0, channel);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Wake up channel has been set.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Get and print POC status of the FlexRay controller.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getpocstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       Fr_POCStatusType status;
+       char *ErrorModeStrings[] = {"ACTIVE", "HALT", "PASSIVE"};
+       char *SlotModeStrings[]  = {"KEYSLOT", "ALL_PENDING", "ALL"};
+       char *StartupStateStrings[]  = {
+               "UNDEFINED", "COLDSTART_LISTEN", "COLDSTART_CHECK", "COLDSTART_JOIN",
+               "COLDSTART_CONSISTENCY_CHECK", "INTEGRATION_LISTEN", "INITIALIZE_SCHEDULE", "INTEGRATION_CONSISTENCY_CHECK",
+               "COLDSTART_GAP", "EXTERNAL_STARTUP", "ABORT", "COLDSTART_COLLISION_RESOLUTION",
+               "PREPARE"
+       };
+       char *StateStrings[]  = {
+               "CONFIG", "DEFAULT_CONFIG", "HALT", "NORMAL_ACTIVE",
+               "NORMAL_PASSIVE", "READY", "STARTUP", "LOOPBACK",
+               "MONITOR", "WAKEUP"
+       };
+       char *WakeupStatusStrings[]  = {
+               "UNDEFINED", "RECEIVED_HEADER", "RECEIVED_WUP", "COLLISION_HEADER",
+               "COLLISION_WUP", "COLLISION_UNKNOWN", "TRANSMITTED"
+       };
+
+       retVal = rpp_fr_get_poc_status(0, &status);
+       if (retVal == SUCCESS) {
+               rpp_sci_printf("POC status:\r\n");
+               rpp_sci_printf("CHIHaltRequest: %s\r\n", (status.CHIHaltRequest == TRUE) ? "TRUE" : "FALSE");
+               rpp_sci_printf("CHIReadyRequest: %s\r\n", (status.CHIReadyRequest == TRUE) ? "TRUE" : "FALSE");
+               rpp_sci_printf("ColdstartNoise: %s\r\n", (status.ColdstartNoise == TRUE) ? "TRUE" : "FALSE");
+               rpp_sci_printf("Freeze: %s\r\n", (status.Freeze == TRUE) ? "TRUE" : "FALSE");
+               rpp_sci_printf("ErrorMode: %s\r\n", ErrorModeStrings[status.ErrorMode]);
+               rpp_sci_printf("SlotMode: %s\r\n", SlotModeStrings[status.SlotMode]);
+               rpp_sci_printf("StartupState: %s\r\n", StartupStateStrings[status.StartupState]);
+               rpp_sci_printf("State: %s\r\n", StateStrings[status.State]);
+               rpp_sci_printf("WakeupStatus: %s\r\n", WakeupStatusStrings[status.WakeupStatus]);
+       }
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Send given data through the FlexRay in selected slot.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+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 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", &bufferID) != 1)
+               return -CMDERR_BADPAR;
+       if (sscanf(param[2], " %2x", &values[0]) != 1)
+               return -CMDERR_BADPAR;
+       data[0] = (uint8_t)values[0];
+       token = strtok(param[2], " ");
+       token = strtok(NULL, " ");
+       dataLength = 1;
+       while (dataLength < MAX_PARAM_VALUES_NUM && token != NULL) {
+               if (sscanf(token, "%2x", &values[dataLength]) == EOF)
+                       break;
+               data[dataLength] = (uint8_t)values[dataLength];
+               token = strtok(NULL, " ");
+               dataLength++;
+       }
+
+       retVal = rpp_fr_transmit_lpdu(0, bufferID, data, dataLength);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Data were set for transmission.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Cancel the transmission in the selected slot.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+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 bufferID;
+
+       if (sscanf(param[1], "%d", &bufferID) != 1)
+               return -CMDERR_BADPAR;
+       if (param[2] != NULL)
+               return -CMDERR_BADPAR;
+
+       retVal = rpp_fr_cancel_transmit_lpdu(0, bufferID);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Transmission canceled.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Receive data from selected slot.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+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 bufferID;
+       uint8_t data[cPayloadLengthMax];
+       Fr_RxLPduStatusType status;
+       uint8_t receivedLength = 0;
+       uint8_t i;
+
+       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, bufferID, data, &status, &receivedLength);
+       if (retVal == SUCCESS) {
+               switch (status) {
+               case FR_RECEIVED_MORE_DATA_AVAILABLE:
+                       rpp_sci_printf("More messages are still in FIFO:\r\n");
+               case FR_RECEIVED:
+                       rpp_sci_printf("Received message (%d B):\r\n", receivedLength);
+                       for (i = 0; i < receivedLength; i++) {
+                               rpp_sci_printf(" %02x", data[i]);
+                       }
+                       rpp_sci_printf("\r\n");
+                       break;
+               default:
+                       rpp_sci_printf("No message received.\r\n");
+                       break;
+               }
+       }
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Returns TX LPdu status.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+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 bufferID;
+       Fr_TxLPduStatusType status;
+       char *statusStrings[] = {"is not", "is"};
+
+       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, bufferID, &status);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Message transmission %s pending.\r\n", statusStrings[status]);
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Disable buffer.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+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 bufferID;
+
+       if (sscanf(param[1], "%d", &bufferID) != 1)
+               return -CMDERR_BADPAR;
+       if (param[2] != NULL)
+               return -CMDERR_BADPAR;
+
+       retVal = rpp_fr_disable_lpdu(0, bufferID);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Buffer disabled.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Print global time of the FlexRay network.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getglobaltime(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       uint8_t cycle = 0;
+       uint16_t macroTick = 0;
+
+       retVal = rpp_fr_get_global_time(0, &cycle, &macroTick);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Cycle number: %d\r\nMacrotick number: %d\r\n", cycle, macroTick);
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Print network management vector of the FlexRay node.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getnmvector(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       uint8_t nmVector[12];
+       uint8_t i;
+
+       retVal = rpp_fr_get_network_management_vector(0, nmVector);
+       if (retVal == SUCCESS) {
+               rpp_sci_printf("Network management vector:");
+               for (i = 0; i < Fr_cluster_config.gNetworkManagementVectorLength; i++) {
+                       rpp_sci_printf(" %x", nmVector[i]);
+               }
+               rpp_sci_printf("\r\n");
+       }
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+int cmd_do_fr_nmwatch(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       uint8_t nmVector[12];
+       uint8_t i;
+
+       // Calculate wait time in OS ticks
+       static const portTickType freq_ticks = 100 /* ms */ / portTICK_RATE_MS;
+       portTickType last_wake_time = xTaskGetTickCount();
+
+       while (cmd_io->getc(cmd_io) < 0) {
+               retVal = rpp_fr_get_network_management_vector(0, nmVector);
+               if (retVal == SUCCESS) {
+                       rpp_sci_printf("Network management vector:");
+                       for (i = 0; i < Fr_cluster_config.gNetworkManagementVectorLength; i++) {
+                               rpp_sci_printf(" %02x", nmVector[i]);
+                       }
+                       rpp_sci_printf("\r");
+               }
+               else {
+                       rpp_sci_printf("General error.\r\n");
+                       return -CMDERR_BADCFG;
+               }
+               vTaskDelayUntil(&last_wake_time, freq_ticks);
+       }
+       rpp_sci_printf("\n");
+       return 0;
+}
+
+/**
+ *  @brief     Print both channels status of the FlexRay node.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getchannelstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       uint8_t index;
+       uint8_t channel;
+       char *decodeStrings[] = {
+               "aggregated channel status vSS!ValidFrame",
+               "aggregated channel status vSS!SyntaxError",
+               "aggregated channel status vSS!ContentError",
+               "aggregated channel status additional communication",
+               "aggregated channel status vSS!Bviolation",
+               "aggregated channel status vSS!TxConflict",
+               "Not used (0)",
+               "Not used (0)",
+               "symbol window status data vSS!ValidMTS",
+               "symbol window status data vSS!SyntaxError",
+               "symbol window status data vSS!Bviolation",
+               "symbol window status data vSS!TxConflict",
+               "NIT status data vSS!SyntaxError",
+               "NIT status data vSS!Bviolation",
+               "Not used (0)",
+               "Not used (0)"
+       };
+       char *channelNames[] = {"A", "B"};
+       char *boolStrings[] = {"FALSE", "TRUE"};
+       uint16_t channelStatuses[2];
+
+       retVal = rpp_fr_get_channel_status(0, &channelStatuses[0], &channelStatuses[1]);
+       if (retVal == SUCCESS)
+               for (channel = 0; channel < 2; channel++) {
+                       rpp_sci_printf("Channel %s status:\r\n", channelNames[channel]);
+                       for (index = 0; index < 16; index++) {
+                               rpp_sci_printf("\t%s: %s\r\n", decodeStrings[index], boolStrings[ (channelStatuses[channel] >> index) & 0x1 ] );
+                       }
+               }
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Print clock correction of the FlexRay node
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getclockcorrection(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       int16_t rateCorrection;
+       int32_t offsetCorrection;
+
+       retVal = rpp_fr_get_clock_correction(0, &rateCorrection, &offsetCorrection);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Rate correction: %d\r\nOffset correction: %d\r\n", rateCorrection, offsetCorrection);
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Print list of syncframec transmitted on both channels via the even and odd cycle.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getsyncframelist(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       uint16_t channelAEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
+       uint16_t channelBEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
+       uint16_t channelAOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
+       uint16_t channelBOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
+       uint32_t listSize = 0;
+       uint8_t i;
+
+       if (sscanf(param[1], "%d", &listSize) != 1)
+               return -CMDERR_BADPAR;
+       if (param[2] != NULL)
+               return -CMDERR_BADPAR;
+       if (listSize > FR_MAX_SYNC_FRAME_LIST_SIZE)
+               return -CMDERR_BADPAR;
+
+       retVal = rpp_fr_get_sync_frame_list(0, listSize, channelAEvenList, channelBEvenList, channelAOddList, channelBOddList);
+       if (retVal == SUCCESS) {
+               rpp_sci_printf("| Channel A even | channel B even | channel A odd  | channel B odd  |\r\n");
+               rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
+               for (i = 0; i < listSize; i++) {
+                       rpp_sci_printf("| %-14x | %-14x | %-14x | %-14x |\r\n", channelAEvenList[i], channelBEvenList[i], channelAOddList[i], channelBOddList[i]);
+               }
+               rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
+
+       }
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Print status of wakeup on each channels (wakeup received on channel or not yet received).
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getwakeuprxstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       uint8_t status = 0;
+       char *statusStrings[] = {"was not yet", "was"};
+       char *channelNames[] = {"A", "B"};
+       uint8_t i;
+
+       retVal = rpp_fr_get_wakeup_rx_status(0, &status);
+       if (retVal == SUCCESS)
+               for (i = 0; i < 2; i++) {
+                       rpp_sci_printf("Wake up pattern %s received on channel %s.\r\n", statusStrings[(status >> i) & 0x1], channelNames[i]);
+               }
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Set and start absolute timer.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_settimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       int timer = 0;
+       int cycle = 0;
+       int offset = 0;
+
+       if (sscanf(param[1], "%i %i %i", &timer, &cycle, &offset) != 3)
+               return -CMDERR_BADPAR;
+
+       retVal = rpp_fr_set_timer(0, timer, cycle, offset);
+       if (retVal == SUCCESS) {
+               uint8_t i = 0x40;
+               while (i && (cycle & i) == 0)
+                       i >>= 1;
+               if (!i)
+                       i = 1;
+
+               rpp_sci_printf("Timer was set for every %d-th cycle, offset %d, macrotick %d\n",
+                                          i, cycle & ~i, offset);
+       }
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Cancel selected timer
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_canceltimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       int timer = 0;
+
+       if (sscanf(param[1], "%d", &timer) != 1)
+               return -CMDERR_BADPAR;
+
+       if (param[2] != NULL)
+               return -CMDERR_BADPAR;
+
+       retVal = rpp_fr_cancel_timer(0, timer);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Timer was canceled.\r\n");
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Enable/disable, acknowledge, get timer IRQ
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_timerirq(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       int timer = 0;
+       char str[4];
+       boolean_t status = FALSE;
+       char *boolStrings[] = {"FALSE", "TRUE"};
+
+
+       if (sscanf(param[1], "%d", &timer) != 1)
+               return -CMDERR_BADPAR;
+
+       if (param[2] == NULL) {     // Get timer IRQ
+               retVal = rpp_fr_get_timer_irq_status(0, timer, &status);
+               if (retVal == SUCCESS)
+                       rpp_sci_printf("IRQ = %s\r\n", boolStrings[status]);
+               else {
+                       rpp_sci_printf("General error.\r\n");
+                       return -CMDERR_BADCFG;
+               }
+       }
+       else {  // Some set action
+               if (sscanf(param[2], "%4s", str) != 1)
+                       return -CMDERR_BADPAR;
+               if (strcmp(str, "EN") == 0)   // Enable IRQ
+                       retVal = SUCCESS;   // No interrupts imlemented
+               else if (strcmp(str, "DIS") == 0)   // Disable IRQ
+                       retVal = SUCCESS;   // No interrupts implemented
+               else if  (strcmp(str, "ACK") == 0)   // Clear IRQ
+                       retVal = rpp_fr_clear_timer_irq(0, timer);
+               else    // Bad argument
+                       return -CMDERR_BADPAR;
+
+               if (retVal == SUCCESS)
+                       rpp_sci_printf("OK\r\n");
+               else {
+                       rpp_sci_printf("General error.\r\n");
+                       return -CMDERR_BADCFG;
+               }
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Print FlexRay driver version info.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_getversioninfo(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       Std_VersionInfoType versionInfo;
+
+       rpp_fr_get_driver_version(&versionInfo);
+       rpp_sci_printf("vendorID: %#x\r\n", versionInfo.vendorID);
+       rpp_sci_printf("moduleID: %#x\r\n", versionInfo.moduleID);
+       rpp_sci_printf("sw_major_version: %#x\r\n", versionInfo.sw_major_version);
+       rpp_sci_printf("sw_minor_version: %#x\r\n", versionInfo.sw_minor_version);
+       rpp_sci_printf("sw_patch_version: %#x\r\n", versionInfo.sw_patch_version);
+
+       return 0;
+}
+
+/**
+ *  @brief     Print value of FlexRay configuratoin parameter.
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_readcconfig(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int8_t retVal = ERR_PARAM_NO_ERROR;
+       int index = 0;
+       uint32_t value = 0;
+
+       if (sscanf(param[1], "%d", &index) != 1)
+               return -CMDERR_BADPAR;
+
+       if (param[2] != NULL)
+               return -CMDERR_BADPAR;
+
+       retVal = rpp_fr_read_com_ctrl_config(0, index, &value);
+       if (retVal == SUCCESS)
+               rpp_sci_printf("Value = %#x\r\n", value);
+       else {
+               rpp_sci_printf("General error.\r\n");
+               return -CMDERR_BADCFG;
+       }
+       return 0;
+}
+
+/**
+ *  @brief     Reconfigure buffer
+ *
+ * @param[in]  cmd_io  Pointer to IO stack
+ * @param[in]  des             Pointer to command descriptor
+ * @param[in]  param   Parameters of command
+ * @return     0 when OK or error code
+ */
+int cmd_do_fr_reconfigure_buffer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       int ret;
+       char channel[3];
+       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",
+                                &bufferID,
+                                &slot,
+                                channel,
+                                &cycleset,
+                                &cycleoffset,
+                                &maxpayload
+                                );
+       if (ret != 6) {
+               printf("Error parsing parameter %d\n", ret+1);
+               return -CMDERR_BADPAR;
+       }
+
+       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;
+       else if (strcmp(channel, "B") == 0) tmp_buffer.channel = FR_CHANNEL_B;
+       else if (strcmp(channel, "AB") == 0) tmp_buffer.channel = FR_CHANNEL_AB;
+       else return badpar("Channel parsing error\n");
+       if (cycleset == 0) cycleset = 1;
+       for (pow2 = 1, is_pow2 = FALSE; pow2 < 128; pow2 *= 2) {
+               if (cycleset == pow2) {
+                       is_pow2 = TRUE;
+                       break;
+               }
+       }
+       if (!is_pow2)
+               return badpar("Cycle set must be one of 0, 1, 2, 4, 8, 16, 32, 64.\n");
+       if (cycleoffset >= cycleset)
+               return badpar("Cycle offset must in range 0 - cycset-1.\n");
+
+       if (maxpayload >= 256)
+               return badpar("Maximum payload in bytes must be less than 256\n");
+       tmp_buffer.maxPayload = maxpayload;
+
+       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",
+                          bufferID,
+                          slot,
+                          channel,
+                          cycleset,
+                          cycleoffset,
+                          maxpayload
+                          );
+               return 0;
+       }
+       else
+               printf("Reconfiguration failed.\n");
+       return -CMDERR_BADPAR;
+}
+
+#endif  /* DOCGEN */
+
+/** Command descriptor for FlexRay user config cluster command */
+cmd_des_t const cmd_des_fr_user_config = {
+       0, 0,
+       "frbtconfig*","Set the user configuration parameters",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtconfig<TYPE> <PARAMS>\n"
+       "where\n"
+       "\n"
+       "- `<TYPE>` is a string specifying the type of parameters to be set. It can be: \"cluster\" or  \"node\"\n"
+       "- `<PARAMS>` is a sequence of numbers separated by spaces. Each number stands for one parameter.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command takes the configuration parameters in the form of a string\n"
+       "and sets the appropriate type of the FlexRay parameters. It is\n"
+       "necessary to configure parameters of at least cluster, and node and\n"
+       "one static buffer (see frbtcfgbuf command). The parameters set by this\n"
+       "command are applied by the frbtinitU command. Once frbtinit is called,\n"
+       "it is no longer possible to change the parameters.\n"
+       "\n"
+       "The type of the parameters can be selected by the `<TYPE>` selector.\n"
+       "\n"
+       "Type \"cluster\" sets global FlexRay network parameters. It expects a\n"
+       "sequence of 25 parameters in this order:\n"
+       "\n"
+       "- 1) gColdStartAttempts\n"
+       "- 2) gListenNoise\n"
+       "- 3) gMacroPerCycle\n"
+       "- 4) gMaxWithoutClockCorrectionFatal\n"
+       "- 5) gMaxWithoutClockCorrectionPassive\n"
+       "- 6) gNetworkManagementVectorLength\n"
+       "- 7) gNumberOfMinislots\n"
+       "- 8) gNumberOfStaticSlots\n"
+       "- 9) gOffsetCorrectionStart\n"
+       "- 10) gPayloadLengthStatic\n"
+       "- 11) gSyncNodeMax\n"
+       "- 12) gdActionPointOffset\n"
+       "- 13) gdCASRxLowMax\n"
+       "- 14) gdDynamicSlotIdlePhase\n"
+       "- 15) gdMinislot\n"
+       "- 16) gdMinislotActionPointOffset\n"
+       "- 17) gdNIT\n"
+       "- 18) gdSampleClockPeriod\n"
+       "- 19) gdStaticSlot\n"
+       "- 20) gdTSSTransmitter\n"
+       "- 21) gdWakeupSymbolRxIdle\n"
+       "- 22) gdWakeupSymbolRxLow\n"
+       "- 23) gdWakeupSymbolRxWindow\n"
+       "- 24) gdWakeupSymbolTxIdle\n"
+       "- 25) gdWakeupSymbolTxLow\n"
+       "\n"
+       "Type \"node\" sets local FlexRay network parameters. It expects a\n"
+       "sequence of 28 parameters in this order:\n"
+       "\n"
+       "- 1) pAllowHaltDueToClock\n"
+       "- 2) pAllowPassiveToActive\n"
+       "- 3) pChannels (0 - A, 1 - B, 2 - AB)\n"
+       "- 4) pClusterDriftDamping\n"
+       "- 5) pDelayCompensationA\n"
+       "- 6) pDelayCompensationB\n"
+       "- 7) pExternOffsetCorrection\n"
+       "- 8) pExternRateCorrection\n"
+       "- 9) pKeySlotUsedForStartup\n"
+       "- 10) pKeySlotUsedForSync\n"
+       "- 11) pLatestTx\n"
+       "- 12) pMacroInitialOffsetA\n"
+       "- 13) pMacroInitialOffsetB\n"
+       "- 14) pMicroInitialOffsetA\n"
+       "- 15) pMicroInitialOffsetB\n"
+       "- 16) pMicroPerCycle\n"
+       "- 17) pRateCorrectionOut\n"
+       "- 18) pOffsetCorrectionOut\n"
+       "- 19) pSamplesPerMicrotick\n"
+       "- 20) pSingleSlotEnabled\n"
+       "- 21) pWakeupChannel (0 - A, 1 - B)\n"
+       "- 22) pWakeupPattern\n"
+       "- 23) pdAcceptedStartupRange\n"
+       "- 24) pdListenTimeout\n"
+       "- 25) pdMaxDrift\n"
+       "- 26) pDecodingCorrection\n"
+       "- 27) syncFramePayloadMultiplexEnabled\n"
+       "- 28) secureBuffers (0 - FR_SB_RECONFIG_ENABLED, 1 - FR_SB_STAT_REC_DISABLED_STAT_TR_DISABLED, 2 - FR_SB_ALL_REC_DISABLED, 3 - FR_SB_ALL_REC_DISABLED_STAT_TR_DISABLED)\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtconfigcluster 0x2 0xF 0x15E0 0xF 0xF 0xC 0x15A 0x8 0xAE4 0x9 0xF 0x4 0x43 0x1 0x4 0x2 0xAE3 0x0 0x56 0xA 0x12 0x12 0x4C 0xB4 0x3C\n"
+       "    FlexRay cluster configuration accepted.\n"
+       "    --> frbtconfignode 0x0 0x0 0x2 0x1 0x3 0x3 0x0 0x0 0x1 0x1 0x10D 0x6 0x6 0x18 0x18 0x36B00 0xCD 0x151 0x0 0x1 0x0 0x2 0x81 0x36DA2 0x151 0x33 0x0 0x0\n"
+       "    FlexRay node configuration accepted.\n",
+       CMD_HANDLER(cmd_do_fr_user_config), (void *)&cmd_list_fr_basic_test
+};
+
+cmd_des_t const cmd_des_fr_config_buffer = {
+       0, 0,
+       "frbtcfgbuf?*","Configure a message buffer in the user configuration",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtcfgbuf<TYPE><BUFID> slot<SLOT> <CHN> cyc<CYC> <RXTX> max<MAX> <REP> ppi<PPI> int<INT>\n"
+       "where\n"
+       "\n"
+       "- `<TYPE>` is 'S' for static segment buffers and 'D' for dynamic segment buffers,\n"
+       "- `<BUFID>` is the number of the buffer. Both static and dynamic buffers are numbered independently starting from zero,\n"
+       "- `<SLOT>` is the number of the slot,\n"
+       "- `<CHN>` is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
+       "- `<CYC>` is the cycle set when to send the buffer,\n"
+       "- `<RXTX>` is either string \"rx\" or \"tx\",\n"
+       "- `<MAX>` is the number determining the maximum payload (in hald-words),\n"
+       "- `<REP>` is a string \"s\" or \"single\" for single transmission or \"c\" or \"continuous\" for continuous transmission,\n"
+       "- `<PPI>` is 0 or 1 determining whether the payload preamble indicator is set,\n"
+       "- `<INT>` is 0 or 1 and is currently ignored.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command sets the configuration parameters for static or dynamic\n"
+       "buffers in user configuration. The parameters set by this command are\n"
+       "applied by the frbtinitU command. Once frbtinit is called, it is no\n"
+       "longer possible to change the parameters.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtcfgbufS0 slot2 AB cyc0 tx max9 continous ppi0 int1\n"
+       "    frbtcfgbufS0 slot2 AB cyc0 tx max9  continous ppi0 int1\n"
+       "    --> frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1\n"
+       "    frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1\n"
+       "    --> frbtcfgbufD0  slot9  A cyc0 rx max0x40 single ppi0 int0\n"
+       "    frbtcfgbufD0 slot9  A cyc0 rx max64 single ppi0 int0\n"
+       "    --> frbtcfgbufD1  slot10 A cyc0 tx max0x40 single ppi0 int0\n"
+       "    frbtcfgbufD1 slot10  A cyc0 tx max64 single ppi0 int0\n",
+       CMD_HANDLER(cmd_do_fr_config_bufer), (void *)&cmd_list_fr_basic_test
+};
+
+cmd_des_t const cmd_des_fr_config_fifo = {
+       0, 0,
+       "frbtcfgfifo*","Configure a RX FIFO message buffer in the user configuration",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtcfgfifo rejslot<SLOT> slotmask<MASK> depth<DEPTH> <CHN> cyc<CYC> max<MAX> <REJNULL> <REJSTAT>\n"
+       "where\n"
+       "- `<SLOT>` is the number of the slot that will be rejected. If it is 0, no slot will be rejected,\n"
+       "- `<MASK>` is a number specifying which bits of the `<SLOT>` will be ignored,"
+       "- `<DEPTH>` is a number specifying the depth of the FIFO,\n"
+       "- `<CHN>` is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
+       "- `<CYC>` is the cycle set when to send the buffer,\n"
+       "- `<MAX>` is the number determining the maximum payload (in hald-words),\n"
+       "- `<REJNULL>` is a string \"rejnull\" for rejecting NULL frames or \"accnull\" for accepting NULL frames,\n"
+       "- `<REJSTAT>` is a string \"rejstat\" for rejecting frames in static segment or \"accstat\" for accepting frames from static segment,\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command sets the configuration parameters for RX FIFO buffer\n"
+       "in user configuration. The parameters set by this command are\n"
+       "applied by the frbtinitU command. Once frbtinit is called, it is no\n"
+       "longer possible to change the parameters.\n"
+       "Those messages, which are not accepted by any other buffer and pass the\n"
+       "FIFO rejection filter will be stored in the RX FIFO buffer.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtcfgfifo rejslot6 slotmask6 depth5 AB cyc0 max0x20 rejnull accstat\n"
+       "    frbtcfgfifo rejslot6 slotmask6 depth5 AB cyc0 max0x20 rejnull accstat\n",
+       CMD_HANDLER(cmd_do_fr_config_fifo), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay init command */
+cmd_des_t const cmd_des_fr_init = {
+       0, 0,
+       "frbtinit?","Initialize a FlexRay node",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtinit<CFG>\n"
+       "\n"
+       "where `<CFG>` identifies the configuration to use. It can be one of A, B\n"
+       "or U. The A and B are predefined configurations. If U is specified,\n"
+       "the user configuration previously set by frbtconfig command is used.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_Init and Fr_ControllerInit functions from\n"
+       "the Autosar specification. It initializes the internal data structures\n"
+       "of the driver and then, based on those data, the controller\n"
+       "configuration is done. During the controller configuration the\n"
+       "parameters of the cluster, node, message RAM and buffers are checked.\n"
+       "If anything goes bad, the command returns an error number, which can\n"
+       "be decoded by macros defined in driver header file fr_tms570.h with\n"
+       "prefix ERR_PARAM. If all parameters are OK, all necessary registers of\n"
+       "the controller are initialized according to the specified\n"
+       "configuration parameters. At the end of the command, the FlexRay\n"
+       "controller is switched into READY state and all buffers are configured\n"
+       "to send NULL frames. This command should be called as the very first\n"
+       "command, when trying to communicate over the FlexRay bus.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtinitA\n"
+       "    FlexRay driver initialized.\n"
+       "    FlexRay controller initialized.\n",
+       CMD_HANDLER(cmd_do_fr_init), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay controller init command */
+cmd_des_t const cmd_des_fr_start = {
+       0, 0,
+       "frbtstart","Start a new FlexRay network or join to the existing one",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtstart\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_StartCommunication function from the Autosar\n"
+       "specification.\n"
+       "If the FlexRay node is configured as a coldstarter node\n"
+       "(as for example by frbtinitA/B command), then the command first listen\n"
+       "on the bus. When it does not detect any existing bus communication, it\n"
+       "tries to initiate a new network. If the initiation fails, the FlexRay\n"
+       "controller is switched back to the ready state for another attempt\n"
+       "(calling frbtstart again). If the FlexRay node is configured as\n"
+       "non-coldstarter, it is listening on the bus until some existing\n"
+       "communication is detected.\n"
+       "\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"
+       "    FlexRay communication is running.\n",
+       CMD_HANDLER(cmd_do_fr_start), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay controller all slots command */
+cmd_des_t const cmd_des_fr_allslots = {
+       0, 0,
+       "frbtallslots","Enables communication for all frames",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtallslots\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_AllSlots function from the Autosar\n"
+       "specification.\n"
+       "\n"
+       "The node can be configured to communicate only on key frames by\n"
+       "default (as in the case of frbtinitA/B). This command can be used to\n"
+       "allow the communication on all configured frames. The command invokes\n"
+       "the FlexRay POC command ALL_SLOTS which enables the communication on\n"
+       "all frames. The command can be called after the controller\n"
+       "initialization.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtallslots\n"
+       "    FlexRay node started communication on all slots.\n",
+       CMD_HANDLER(cmd_do_fr_allslots), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay controller halt command */
+cmd_des_t const cmd_des_fr_halt = {
+       0, 0,
+       "frbthalt","Halt FlexRay communication after the end of the actual communication cycle",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbthalt\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_HaltCommunication function from the Autosar\n"
+       "specification. The command invokes the FlexRay POC command HALT, which\n"
+       "means that communication is stopped after the end of the actual\n"
+       "communication cycle. On the opposite side, there is a frbtfreeze\n"
+       "command, which stops the communication immediately. To restart the\n"
+       "communication, the frbtinit and frbtstart commands have to be called.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbthalt\n"
+       "    FlexRay node communication halted.\n",
+       CMD_HANDLER(cmd_do_fr_halt), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay controller abort command */
+cmd_des_t const cmd_des_fr_abort = {
+       0, 0,
+       "frbtabort","Abort FlexRay communication immediately",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtabort\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_AbortCommunication function from the Autosar\n"
+       "specification. The command invokes the FlexRay POC command FREEZE,\n"
+       "which means that the communication is stopped immediately. On the\n"
+       "opposite side there is a frbthalt command, which stops the\n"
+       "communication after the end of the actual communication cycle. To\n"
+       "restart the communication, the frbtinit and frbtstart commands have\n"
+       "to be called.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtabort\n"
+       "    FlexRay node communication aborted.\n",
+       CMD_HANDLER(cmd_do_fr_abort), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay controller send wake up pattern command */
+cmd_des_t const cmd_des_fr_sendwup = {
+       0, 0,
+       "frbtwup","Initiate the wake up procedure",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtwup\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_SendWUP function from the Autosar\n"
+       "specification. It initiates the wake up procedure by switching FlexRay\n"
+       "controller state machine to WAKEUP state.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtwup\n"
+       "    Wake up pattern has been sent.\n",
+       CMD_HANDLER(cmd_do_fr_sendwup), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay controller sent wake up pattern channel command */
+cmd_des_t const cmd_des_fr_setwuchannel = {
+       0, 0,
+       "frbtsetwuch?","Set wake up channel",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtsetwuch<CHANNEL>\n"
+       "\n"
+       "where `<CHANNEL>` is a character A or B, specifying the channel.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_SetWakeupChannel function from the Autosar\n"
+       "specification. Wake up channel is the channel, where Wake Up Pattern\n"
+       "is sent. The channel can be set after the driver and controller are\n"
+       "initialized and before the communication is running. The actual\n"
+       "wake-up pattern is sent by the frbtwup command.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtsetwuchA\n"
+       "    Wake up channel has been set.\n",
+       CMD_HANDLER(cmd_do_fr_setwuchannel), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay controller get POC status command */
+cmd_des_t const cmd_des_fr_getpocstatus = {
+       0, 0,
+       "frbtgetpocst","Print FlexRay POC status",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtgetpocst\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetPOCStatus function from the Autosar\n"
+       "specification. It prints the main FlexRay POC status values in the\n"
+       "form of a table. The command should be called after the frbtinit\n"
+       "command.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtgetpocst\n"
+       "    POC status:\n"
+       "    CHIHaltRequest: FALSE\n"
+       "    CHIReadyRequest: FALSE\n"
+       "    ColdstartNoise: FALSE\n"
+       "    Freeze: FALSE\n"
+       "    ErrorMode: ACTIVE\n"
+       "    SlotMode: ALL\n"
+       "    StartupState: UNDEFINED\n"
+       "    State: READY\n"
+       "    WakeupStatus: UNDEFINED\n",
+       CMD_HANDLER(cmd_do_fr_getpocstatus), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay transmit tx lpdu command */
+cmd_des_t const cmd_des_fr_transmittxlpdu = {
+       0, 0,
+       "frbttransmit*","Transmit data from the selected frame buffer",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbttransmit<BUFID> <DATA>\n"
+       "where\n"
+       "\n"
+       "- `<BUFID>` is a decimal number specifying the ID of the frame\n"
+       "            buffer configured for data transmission\n"
+       "- `<DATA>`  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 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"
+       "\n"
+       "    --> frbttransmit1 12 34 56 AA BB CC\n"
+       "    Data were set for transmission.\n",
+       CMD_HANDLER(cmd_do_fr_transmittxlpdu), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay cancel tx lpdu command */
+cmd_des_t const cmd_des_fr_canceltxlpdu = {
+       0, 0,
+       "frbtcanceltx*","Stop the transmission from the frame buffer",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtcanceltx<BUFID>\n"
+       "\n"
+       "where `<BUFID>` 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 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"
+       "    --> frbtcanceltx3\n"
+       "    Transmission canceled.\n",
+       CMD_HANDLER(cmd_do_fr_canceltxlpdu), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay receive rx lpdu command */
+cmd_des_t const cmd_des_fr_receiverxlpdu = {
+       0, 0,
+       "frbtreceive*","Receive a new message",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtreceive<BUFID>\n"
+       "\n"
+       "where `<BUFID>` 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 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\n"
+       "     00 00 00 00 00 00 00 00 00\n",
+       CMD_HANDLER(cmd_do_fr_receiverxlpdu), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay check TX LPdu status command */
+cmd_des_t const cmd_des_fr_checktxlpdustatus = {
+       0, 0,
+       "frbtchecktx*","Print the status of the transmit buffer",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtchecktx<BUFID>\n"
+       "\n"
+       "where `<BUFID>` 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 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\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"
+       "    --> frbtchecktx1\n"
+       "    Message transmission is not pending.\n",
+       CMD_HANDLER(cmd_do_fr_checktxlpdustatus), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay disable LPdu command */
+cmd_des_t const cmd_des_fr_disablelpdu = {
+       0, 0,
+       "frbtdisable*","Disable the buffers assigned to the frame",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtdisable<BUFID>\n"
+       "\n"
+       "where `<BUFID>` 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 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"
+       "    --> frbtdisable3\n"
+       "    Buffer disabled.\n",
+       CMD_HANDLER(cmd_do_fr_disablelpdu), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get global time command */
+cmd_des_t const cmd_des_fr_getglobaltime = {
+       0, 0,
+       "frbtglobtime","Print actual global time of the network",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtglobtime\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetGlobalTime function from the Autosar\n"
+       "specification. The command prints the time as a number of the current\n"
+       "cycle and the offset in the cycle in macroticks.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtglobtime\n"
+       "    Cycle number: 23\n"
+       "    Macrotick number: 6\n",
+       CMD_HANDLER(cmd_do_fr_getglobaltime), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get network management vector command */
+cmd_des_t const cmd_des_fr_getnmvector = {
+       0, 0,
+       "frbtnmvector","Print network management vector of the node",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtnmvector\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetNmVector function from the Autosar\n"
+       "specification. It prints the values of the network management vector\n"
+       "as hexadecimal numbers.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtnmvector\n"
+       "    Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\n",
+       CMD_HANDLER(cmd_do_fr_getnmvector), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get network management vector command */
+cmd_des_t const cmd_des_fr_nmwatch = {
+       0, 0,
+       "frbtnmwatch","Watch the changes of the network managment vector in real-time",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtnmwatch\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "Reads the network management vector every 100 ms and prints it out.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtnmwatch\n"
+       "    Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\n",
+       CMD_HANDLER(cmd_do_fr_nmwatch), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get channel status command */
+cmd_des_t const cmd_des_fr_getchannelstatus = {
+       0, 0,
+       "frbtchstat","Print channel A and B status",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtchstat\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetChannelStatus function from the Autosar\n"
+       "specification.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtchstat\n"
+       "    Channel A status:\n"
+       "       aggregated channel status vSS!ValidFrame: TRUE\n"
+       "       aggregated channel status vSS!SyntaxError: FALSE\n"
+       "       aggregated channel status vSS!ContentError: FALSE\n"
+       "       aggregated channel status additional communication: FALSE\n"
+       "       aggregated channel status vSS!Bviolation: FALSE\n"
+       "       aggregated channel status vSS!TxConflict: FALSE\n"
+       "       Not used (0): FALSE\n"
+       "       Not used (0): FALSE\n"
+       "       symbol window status data vSS!ValidMTS: FALSE\n"
+       "       symbol window status data vSS!SyntaxError: FALSE\n"
+       "       symbol window status data vSS!Bviolation: FALSE\n"
+       "       symbol window status data vSS!TxConflict: FALSE\n"
+       "       NIT status data vSS!SyntaxError: FALSE\n"
+       "       NIT status data vSS!Bviolation: FALSE\n"
+       "       Not used (0): FALSE\n"
+       "       Not used (0): FALSE\n"
+       "    Channel B status:\n"
+       "       aggregated channel status vSS!ValidFrame: TRUE\n"
+       "       aggregated channel status vSS!SyntaxError: FALSE\n"
+       "       aggregated channel status vSS!ContentError: FALSE\n"
+       "       aggregated channel status additional communication: FALSE\n"
+       "       aggregated channel status vSS!Bviolation: FALSE\n"
+       "       aggregated channel status vSS!TxConflict: FALSE\n"
+       "       Not used (0): FALSE\n"
+       "       Not used (0): FALSE\n"
+       "       symbol window status data vSS!ValidMTS: FALSE\n"
+       "       symbol window status data vSS!SyntaxError: FALSE\n"
+       "       symbol window status data vSS!Bviolation: FALSE\n"
+       "       symbol window status data vSS!TxConflict: FALSE\n"
+       "       NIT status data vSS!SyntaxError: FALSE\n"
+       "       NIT status data vSS!Bviolation: FALSE\n"
+       "       Not used (0): FALSE\n"
+       "       Not used (0): FALSE\n",
+       CMD_HANDLER(cmd_do_fr_getchannelstatus), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get clock correction command */
+cmd_des_t const cmd_des_fr_getclockcorrection = {
+       0, 0,
+       "frbtclkcor","Print clock correction (rate and offset)",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtclkcor\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetClockCorrection function from the Autosar\n"
+       "specification.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtclkcor\n"
+       "    Rate correction: 0\n"
+       "    Offset correction: 0\n",
+       CMD_HANDLER(cmd_do_fr_getclockcorrection), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get sync frame list command */
+cmd_des_t const cmd_des_fr_getsyncframelist = {
+       0, 0,
+       "frbtgetsyncfrlist*","Print the list of sync frames transmitted on both channels via the odd and even communication cycle",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtgetsyncfrlist<LENGTH>\n"
+       "\n"
+       "where `<LENGTH>` is a decimal number in range 0 - 15, specifying the\n"
+       "length of the list to be printed.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetSyncFrameList function from the Autosar\n"
+       "specification.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtgetsyncfrlist2\n"
+       "    | Channel A even | channel B even | channel A odd  | channel B odd  |\n"
+       "    |----------------|----------------|----------------|----------------|\n"
+       "    | 1              | 1              | 1              | 1              |\n"
+       "    | 2              | 2              | 2              | 2              |\n"
+       "    |----------------|----------------|----------------|----------------|\n",
+       CMD_HANDLER(cmd_do_fr_getsyncframelist), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get sync frame list command */
+cmd_des_t const cmd_des_fr_getwakeuprxstatus = {
+       0, 0,
+       "frbtgetwurxstat","Prints whether the wake up pattern has been or has not been received",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtgetwurxstat\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetWakeupRxStatus function from the Autosar\n"
+       "specification. The status of the wake up receiving is bitcoded in the\n"
+       "controller. This command decodes and prints it in a readable format.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtgetwurxstat\n"
+       "    Wake up pattern was not yet received on channel A.\n"
+       "    Wake up pattern was not yet received on channel B.\n",
+       CMD_HANDLER(cmd_do_fr_getwakeuprxstatus), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay set absolute timer command */
+cmd_des_t const cmd_des_fr_settimer = {
+       0, 0,
+       "frbtsettimer*","Set and start timer",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtsettimer<TMID> <CYCLE> <OFFSET>\n"
+       "where\n"
+       "\n"
+       "- `<TMID>` is a number (0, 1) specifying the timer.\n"
+       "- `<CYCLE>` is a 7-bit number (0 - 127) specifying the set of cycles, in which timer interrupt should be requested. The first set bit determines the period (1, 2, ..., 64) and the lower bits determine the offset in cycles within the period.\n"
+       "- `<OFFSET>` is a decimal number (0 - 16383) specifying the offset in macroticks, where precisely in the cycle should be the timer interrupt requested.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command is similar to Fr_SetAbsoluteTimer function from the\n"
+       "Autosar specification. The difference is that the command allows to\n"
+       "specify a set of cycles, not only one of 64 cycles. It sets the timer\n"
+       "selected by the parameter and enables it.\n"
+       "\n"
+       "Before using this command, FlexRay communication has to be started\n"
+       "(see frbtstart).\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtsettimer0 32 50\n"
+       "    Timer was set for every 32-th cycle, offset 0, macrotick 50\n"
+       "    --> frbtsettimer0 31 50\n"
+       "    Timer was set for every 16-th cycle, offset 15, macrotick 50\n"
+       "    --> frbtsettimer0 0x42 0\n"
+       "    Timer was set for every 64-th cycle, offset 2, macrotick 0\n",
+       CMD_HANDLER(cmd_do_fr_settimer), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay cancel absolute timer command */
+cmd_des_t const cmd_des_fr_canceltimer = {
+       0, 0,
+       "frbtcanceltimer*","Stop the timer",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtcanceltimer<TMID>\n"
+       "where `<TMID>` is a number (0 or 1) specifying the timer.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_CancelAbsoluteTimer function from the\n"
+       "Autosar specification. It stops the timer selected by the parameter.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtcanceltimer0\n"
+       "    Timer was canceled.\n",
+       CMD_HANDLER(cmd_do_fr_canceltimer), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay absolute timer irq manipulation command */
+cmd_des_t const cmd_des_fr_timerirq = {
+       0, 0,
+       "frbttimerirq*","Perform selected action on the timer IRQ",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbttimerirq<TMID> <ACTION> - Run the <ACTION> on specified timer\n"
+       "    frbttimerirq<TMID> - Get timer IRQ status\n"
+       "\n"
+       "where\n"
+       "\n"
+       "- `<TMID>` is a number (0, 1) specifying the timer.\n"
+       "- where `<ACTION>` is a string specifying the action  to be performed on the selected timer IRQ.\n"
+       "\n"
+       "`<ACTIONS>` can be one of:\n"
+       "\n"
+       "- EN - Enable the IRQ on the selected timer\n"
+       "- DIS - Disable the IRQ on the selected timer\n"
+       "- ACK - Acknowledge the IRQ on the selected timer (reset flag in the register).\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_EnableAbsoluteTimerIRQ,\n"
+       "Fr_AckAbsoluteTimerIRQ, Fr_DisableAbsoluteTimerIRQ and\n"
+       "Fr_GetAbsoluteTimerIRQStatus functions from the Autosar specification.\n"
+       "It masks or demasks the IRQ for the timer, or acknowledges the\n"
+       "interrupt request. If no action is specified it prints whether the IRQ\n"
+       "is pending for the timer.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbttimerirq0\n"
+       "    IRQ = FALSE\n"
+       "\n"
+       "    --> frbttimerirq0 EN\n"
+       "    OK\n",
+       CMD_HANDLER(cmd_do_fr_timerirq), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get version info command */
+cmd_des_t const cmd_des_fr_getversioninfo = {
+       0, 0,
+       "frbtversion","Print FlexRay driver version information",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtversion\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_GetVersionInfo function from the Autosar\n"
+       "specification.\n"
+       "It reads and prints the information about vendor, module and version of\n"
+       "the FlexRay driver\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtversion\n"
+       "    vendorID: 0xAAAA\n"
+       "    moduleID: 0xBBBB\n"
+       "    sw_major_version: 0x1\n"
+       "    sw_minor_version: 0x2\n"
+       "    sw_patch_version: 0x4\n",
+       CMD_HANDLER(cmd_do_fr_getversioninfo), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay get controller configuration command */
+cmd_des_t const cmd_des_fr_readcconfig = {
+       0, 0,
+       "frbtccconfig*","Print value of a FlexRay cluster and node configuration parameter",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtccconfig<INDEX>\n"
+       "\n"
+       "where `<INDEX>` is an identifier of the parameter.\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_ReadCCConfig function from the Autosar\n"
+       "specification. The driver stores the configuration parameters as an\n"
+       "array. Each parameter can be indexed and returned by this command. See\n"
+       "Autosar specification of the FlexRay driver\n"
+       "(http://www.autosar.org/download/R4.1/AUTOSAR_SWS_FlexRayDriver.pdf),\n"
+       "section 8.2.1 for parameter indexes.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtccconfig1\n"
+       "    Value = 0x1\n",
+       CMD_HANDLER(cmd_do_fr_readcconfig), (void *)&cmd_list_fr_basic_test
+};
+
+/** Command descriptor for FlexRay reconfigure buffer command */
+cmd_des_t const cmd_des_fr_reconfigure_buffer = {
+       0, 0,
+       "frbtreconfigurebuf*","Reconfigure a buffer to communicate in another slot",
+       "### Command syntax ###\n"
+       "\n"
+       "    frbtreconfigurebuf id<BUFID> slot<SLOT> <CHN> cycset<CYCS> cycoffset<CYCO> max<MAX>\n"
+       "where\n"
+       "\n"
+       "- `<BUFID>` is a number specifying a slot, where the buffer is currently communicating,\n"
+       "- `<SLOT>` is a number, where buffer will be communicating after the reconfiguration,\n"
+       "- `<CHN>` is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
+       "- `<CYCS>` is the cycle set. It has to be one of 0, 1, 2, 4, 8, 16, 32, 64. It specifies together with `<CYCO>` the cycle filtering.\n"
+       "- `<CYCO>` is the cycle offset. It has to be in range 0 - `<CYCS>`-1"
+       "- `<MAX>` is the number determining the maximum payload (in hald-words).\n"
+       "\n"
+       "### Description ###\n"
+       "\n"
+       "The command stands for Fr_ReconfigLPDu function from the Autosar\n"
+       "specification. It reconfigures specified buffer to communicate in\n"
+       "different slot.\n"
+       "The reconfiguration must be allowed in node configuration parameter\n"
+       "secureBuffers. Buffers used for synchronization or assigned to the FIFO\n"
+       "are not reconfigurable.\n"
+       "The command can be called any time when the communication is running.\n"
+       "\n"
+       "### Example ###\n"
+       "\n"
+       "    --> frbtreconfigurebuf id2 slot3 AB cycset1 cycoffset0 max9\n"
+       "    frbtreconfigurebuf id2 slot3 AB cycset1 cycoffset0 max9\n",
+       CMD_HANDLER(cmd_do_fr_reconfigure_buffer), (void *)&cmd_list_fr_basic_test
+};
+
+
+/** List of commands for flexRay, defined as external */
+cmd_des_t const *cmd_list_fr_basic_test[] = {
+       &cmd_des_fr_user_config,
+       &cmd_des_fr_config_buffer,
+       &cmd_des_fr_config_fifo,
+       &cmd_des_fr_init,
+       &cmd_des_fr_start,
+       &cmd_des_fr_allslots,
+       &cmd_des_fr_halt,
+       &cmd_des_fr_abort,
+       &cmd_des_fr_sendwup,
+       &cmd_des_fr_setwuchannel,
+       &cmd_des_fr_getpocstatus,
+       &cmd_des_fr_transmittxlpdu,
+       &cmd_des_fr_canceltxlpdu,
+       &cmd_des_fr_receiverxlpdu,
+       &cmd_des_fr_checktxlpdustatus,
+       &cmd_des_fr_disablelpdu,
+       &cmd_des_fr_getglobaltime,
+       &cmd_des_fr_getnmvector,
+       &cmd_des_fr_nmwatch,
+       &cmd_des_fr_getchannelstatus,
+       &cmd_des_fr_getclockcorrection,
+       &cmd_des_fr_getsyncframelist,
+       &cmd_des_fr_getwakeuprxstatus,
+       &cmd_des_fr_settimer,
+       &cmd_des_fr_canceltimer,
+       &cmd_des_fr_timerirq,
+       &cmd_des_fr_getversioninfo,
+       &cmd_des_fr_readcconfig,
+       &cmd_des_fr_reconfigure_buffer,
+       NULL
+};