]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/commitdiff
Remove commands for excessive peripherals from the command processor
authorMichal Horn <hornmich@fel.cvut.cz>
Wed, 29 Oct 2014 13:32:43 +0000 (14:32 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 3 Dec 2014 17:51:36 +0000 (18:51 +0100)
This commit refs #1024

30 files changed:
rpp-test-sw/commands/cmd.c
rpp-test-sw/commands/cmd_dac.c [deleted file]
rpp-test-sw/commands/cmd_dac.h [deleted file]
rpp-test-sw/commands/cmd_emac.c [deleted file]
rpp-test-sw/commands/cmd_emac.h [deleted file]
rpp-test-sw/commands/cmd_fr_basic_test.c [deleted file]
rpp-test-sw/commands/cmd_fr_basic_test.h [deleted file]
rpp-test-sw/commands/cmd_fray.c [deleted file]
rpp-test-sw/commands/cmd_fray.h [deleted file]
rpp-test-sw/commands/cmd_hbr.c [deleted file]
rpp-test-sw/commands/cmd_hbr.h [deleted file]
rpp-test-sw/commands/cmd_hout.c [deleted file]
rpp-test-sw/commands/cmd_hout.h [deleted file]
rpp-test-sw/commands/cmd_lin.c [deleted file]
rpp-test-sw/commands/cmd_lin.h [deleted file]
rpp-test-sw/commands/cmd_lout.c [deleted file]
rpp-test-sw/commands/cmd_lout.h [deleted file]
rpp-test-sw/commands/cmd_motor_example.c [deleted file]
rpp-test-sw/commands/cmd_motor_example.h [deleted file]
rpp-test-sw/commands/cmd_nc.c [deleted file]
rpp-test-sw/commands/cmd_nc.h [deleted file]
rpp-test-sw/commands/cmd_netstats.c [deleted file]
rpp-test-sw/commands/cmd_netstats.h [deleted file]
rpp-test-sw/commands/cmd_sdram.c [deleted file]
rpp-test-sw/commands/cmd_sdram.h [deleted file]
rpp-test-sw/commands/cmd_spi.c [deleted file]
rpp-test-sw/commands/cmd_spi.h [deleted file]
rpp-test-sw/commands/cmd_vbat.c [deleted file]
rpp-test-sw/commands/cmd_vbat.h [deleted file]
rpp-test-sw/commands/fray_demo.txt [deleted file]

index 9c9734db610ada16634ea36f8abea14f828503ca..2ef5a5aad583bca464d896b68b02afadee0bcd61 100644 (file)
 #include "cmdproc.h"
 #include "cmd.h"
 #include "cmd_adc.h"
-#include "cmd_dac.h"
-#include "cmd_emac.h"
-#include "cmd_fray.h"
 #include "cmd_can.h"
 #include "cmd_din.h"
-#include "cmd_hbr.h"
-#include "cmd_hout.h"
-#include "cmd_lin.h"
-#include "cmd_lout.h"
-#include "cmd_nc.h"
-#include "cmd_netstats.h"
 #include "cmd_pin.h"
 #include "cmd_port.h"
-#include "cmd_sdram.h"
-#include "cmd_spi.h"
-#include "cmd_vbat.h"
-#include "cmd_motor_example.h"
-#include "cmd_fr_basic_test.h"
 
 #ifndef DOCGEN
 
@@ -146,23 +132,9 @@ cmd_des_t const *cmd_list_main[] = {
        &cmd_des_version,
        CMD_DES_INCLUDE_SUBLIST(cmd_list_adc),
        CMD_DES_INCLUDE_SUBLIST(cmd_list_can),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_dac),
        CMD_DES_INCLUDE_SUBLIST(cmd_list_din),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_emac),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_fray),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_hbr),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_hout),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_lin),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_lout),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_nc),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_netstats),
        CMD_DES_INCLUDE_SUBLIST(cmd_list_pin),
        CMD_DES_INCLUDE_SUBLIST(cmd_list_port),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_sdram),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_spi),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_vbat),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_motor_example),
-       CMD_DES_INCLUDE_SUBLIST(cmd_list_fr_basic_test),
        NULL
 };
 
diff --git a/rpp-test-sw/commands/cmd_dac.c b/rpp-test-sw/commands/cmd_dac.c
deleted file mode 100644 (file)
index 744c998..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.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_dac.c
- *
- * Abstract:
- *      This file contains commands for DAC control. User can setup DIN pin as active or inactive, set voltage in mV units and set raw value on pin.
- *
- */
-
-#include "cmd_dac.h"
-#include "stdio.h"
-
-#ifndef DOCGEN
-
-#include "cmdproc_utils.h"
-#include "rpp/rpp.h"
-
-
-/**
- * @brief      Setup DAC pin enable or disable
- *
- * @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_dac_pin_setup(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-       int enabled;
-       int ret;
-
-       if (sscanf(p, "%d %d %1s", &pin, &enabled, &spareParams) != 2)
-               return -CMDERR_BADPAR;
-       ret = rpp_dac_setup(pin, enabled);
-       if (ret == -1) {
-               rpp_sci_printf("Pin out of range.\n");
-               return -CMDERR_BADPAR;
-       }
-
-       if (rpp_dac_update() == FAILURE) {
-               rpp_sci_printf("DAC update failed.\n");
-               return -CMDERR_EIO;
-       }
-
-       return cmd_opchar_replong(cmd_io, param, enabled, 0, 10);
-}
-
-/**
- * @brief      Set DAC pin raw value
- *
- * @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_dac_pin_set_val(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-       int val;
-       int ret;
-
-       if (sscanf(p, "%d %d %1s", &pin, &val, &spareParams) != 2)
-               return -CMDERR_BADPAR;
-       ret = rpp_dac_set(pin, val);
-       if (ret == -1) {
-               rpp_sci_printf("Pin out of range.\n");
-               return -CMDERR_BADPAR;
-       }
-       else if (ret == -2) {
-               rpp_sci_printf("Value out of range.\n");
-               return -CMDERR_BADPAR;
-       }
-
-       if (rpp_dac_update() == FAILURE) {
-               rpp_sci_printf("DAC update failed.\n");
-               return -CMDERR_EIO;
-       }
-       return cmd_opchar_replong(cmd_io, param, val, 0, 10);
-}
-
-/**
- * @brief      Set DAC pin voltage value in mV units
- *
- * @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_dac_pin_set_voltage(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-       int mV;
-       int ret;
-
-       if (sscanf(p, "%d %d %1s", &pin, &mV, &spareParams) != 2)
-               return -CMDERR_BADPAR;
-       ret = rpp_dac_set_voltage(pin, mV);
-       if (ret == -1) {
-               rpp_sci_printf("Pin out of range.\n");
-               return -CMDERR_BADPAR;
-       }
-       else if (ret == -2) {
-               rpp_sci_printf("Voltage out of range.\n");
-               return -CMDERR_BADPAR;
-       }
-
-       if (rpp_dac_update() == FAILURE) {
-               rpp_sci_printf("DAC update failed.\n");
-               return -CMDERR_EIO;
-       }
-       return cmd_opchar_replong(cmd_io, param, mV, 0, 10);
-}
-
-#endif  /* DOCGEN */
-
-/** Descriptor of command for dac pin setup */
-cmd_des_t const cmd_des_dac_pin_setup = {
-       0, 0,
-       "dacpinenable*","Enable or disable a DAC pin",
-       "### Command syntax ###\n"
-       "\n"
-       "    dacpinenable<PIN> <VALUE>\n"
-       "where\n"
-       "\n"
-       "- `<PIN>` is a number in range 1-4\n"
-       "- `<VALUE>` is a number 0 (disable) or 1 (enable)\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "Command for enabling or disabling of a DAC pin.\n"
-       "\n"
-       "Command always prints the actual state of the selected pin.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> dacpinenable1 1\n"
-       "    dacpinenable1=1\n"
-       "\n"
-       "Enables pin DAC1 and prints its actual state (which will be 1)\n",
-       CMD_HANDLER(cmd_do_dac_pin_setup), (void *)&cmd_list_dac
-};
-
-/** Descriptor of command for dac pin value set */
-cmd_des_t const cmd_des_dac_pin_set_val = {
-       0, 0,
-       "dacpinval*","Set raw value of a DAC register",
-       "### Command syntax ###\n"
-       "\n"
-       "    dacpinval<PIN> <VALUE>\n"
-       "where\n"
-       "\n"
-       "- `<PIN>` is a number in range 1-4\n"
-       "- `<VALUE>` is a number in range 0-4095\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command writes a raw value to DAC register that controls the DAC\n"
-       "output voltage according to the formula described in the datasheet.\n"
-       "`<PIN>` parameter selects which DAC pin to use.\n"
-       "\n"
-       "Command always prints the written raw value of the selected pin. There\n"
-       "is no way how to read the value out of the register.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> dacpinval1 4095\n"
-       "    dacpinval1 =4095\n"
-       "\n"
-       "Set pin DAC1 voltage to 12V, and prints the value (4095).\n",
-       CMD_HANDLER(cmd_do_dac_pin_set_val), (void *)&cmd_list_dac
-};
-
-/** Descriptor of command for dac pin voltage set */
-cmd_des_t const cmd_des_dac_pin_set_voltage = {
-       0, 0,
-       "dacpinvoltage*","Set voltage in mV of a DAC pin",
-       "### Command syntax ###\n"
-       "\n"
-       "    dacpinvoltage<PIN> <VALUE>\n"
-       "where\n"
-       "\n"
-       "- `<PIN>` is a number in range 1-4\n"
-       "- `<VALUE>` is a number in range 0-12000\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command sets the voltage on a DAC pin.\n"
-       "\n"
-       "The command always prints the actually set voltage of selected pin.\n"
-       "There is no way how to read the value back out of the pin.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> dacpinvoltage1 8000\n"
-       "    dacpinvoltage1 =8000\n"
-       "\n"
-       "Sets pin DAC1 to 8V, prints the actual voltage (8000)\n"
-       "\n"
-       "    --> dacpinvoltage2 500\n"
-       "    dacpinvoltage2 =500\n"
-       "\n"
-       "Sets pin DAC2 to 500mV, prints actual voltage (500)\n",
-       CMD_HANDLER(cmd_do_dac_pin_set_voltage), (void *)&cmd_list_dac
-};
-
-/** List of commands for dac, defined as external */
-cmd_des_t const *cmd_list_dac[] = {
-       &cmd_des_dac_pin_setup,
-       &cmd_des_dac_pin_set_val,
-       &cmd_des_dac_pin_set_voltage,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_dac.h b/rpp-test-sw/commands/cmd_dac.h
deleted file mode 100644 (file)
index 17aaf27..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_dac.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_DAC_H_
-#define CMD_DAC_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_dac[];
-
-
-#endif /* CMD_DAC_H_ */
diff --git a/rpp-test-sw/commands/cmd_emac.c b/rpp-test-sw/commands/cmd_emac.c
deleted file mode 100644 (file)
index 89350cd..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.2013
- *
- * Authors:
- *     - Rostislav LisovĂ˝
- *
- * 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_emac.c
- *
- * Abstract:
- *             Test command for Ethernet PHY
- *
- */
-#include "cmd_emac.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "sys/sys.h"
-#include "sys/phy_dp83848h.h"
-#include "types.h"
-
-/* ************************************************* */
-/*   Emac frame buffer related stuff                 */
-/* ************************************************* */
-typedef struct _EMAC_Desc {
-       struct _EMAC_Desc *pNext;   /* Pointer to next descriptor in chain */
-       uint8_t *pBuffer;           /* Pointer to data buffer */
-       uint32_t BufOffLen;         /* Buffer Offset(MSW) and Length(LSW) */
-       uint32_t PktFlgLen;         /* Packet Flags(MSW) and Length(LSW) */
-} EMAC_Desc;
-
-/* Packet Flags */
-#define EMAC_DSC_FLAG_SOP           0x80000000u
-#define EMAC_DSC_FLAG_EOP           0x40000000u
-#define EMAC_DSC_FLAG_OWNER         0x20000000u
-#define EMAC_DSC_FLAG_EOQ           0x10000000u
-#define EMAC_DSC_FLAG_TDOWNCMPLT    0x08000000u
-#define EMAC_DSC_FLAG_PASSCRC       0x04000000u
-
-/* ************************************************* */
-/*   Ethernet frame                                  */
-/* ************************************************* */
-typedef struct {
-       uint8_t destination[6];
-       uint8_t source[6];
-       uint16_t len;
-       uint8_t data[50];
-       uint32_t fcs;
-} eth_frame_t;
-
-/* ************************************************* */
-
-
-
-unsigned int emacCtrlBase   = EMAC_CTRL_BASE;
-unsigned int emacBase       = EMAC_BASE;
-unsigned int emacCtrlRamBase    = EMAC_CTRL_RAM_BASE;
-unsigned int mdioBase       = MDIO_BASE;
-
-int rx_irq_cnt; /* Interrupt counters */
-int tx_irq_cnt;
-
-unsigned int phyalive;
-unsigned int phylink;
-
-unsigned int intvect;
-unsigned int intvectraw;
-
-uint8_t emacAddress[6]  = {0x12, 0x34, 0x56, 0x78, 0x90, 0xab};
-uint32_t emacPhyAddress = 0x1;  /* Address of PHY on "MDIO bus"
-                                   (depends on PHY configuration) */
-int channel = 0;    /* Emac has 8 RX and TX channels; we use only one */
-
-EMAC_Desc fr1 __attribute__((aligned(4)));  /* Frame descriptor of Ethernet frame to be sent */
-
-/* Frame descriptor used for receiving frames --
-   it might be placed in normal RAM or in CPPI ram of EMAC */
-//EMAC_Desc rx_desc __attribute__((aligned(4)));
-volatile EMAC_Desc *rx_desc = ((EMAC_Desc *)EMAC_CTRL_RAM_BASE);
-
-
-#define BUFF_SIZE   2048
-uint8_t rx_buff[BUFF_SIZE]; /* Buffer for data reception */
-
-eth_frame_t efr1;   /* Buffer for TX -- Before sending some data we have to
-                       prepare it in "Ethernet frame" format */
-
-
-void dummy_wait()
-{
-       volatile int i;
-
-       for (i = 0; i < 65555; i++)
-               ;
-}
-
-int emac_test(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int chan;
-       unsigned char input = 0;
-       volatile unsigned int delay = 0xfff;
-       unsigned short data;
-       int j;
-
-       /* Deactivate reset pin of PHY */
-       dmmREG->PC4 = (1 << DMM_CLK); /* Set to H */
-       dummy_wait();
-       dmmREG->PC5 = (1 << DMM_CLK); /* Set to L */
-       dummy_wait();
-       dmmREG->PC4 = (1 << DMM_CLK); /* Set to H */
-       dummy_wait();
-
-       /* Prepare RX Packet buffer descriptor */
-       rx_desc->pBuffer = rx_buff;
-       rx_desc->PktFlgLen = EMAC_DSC_FLAG_OWNER;
-       rx_desc->pNext = NULL;
-       rx_desc->BufOffLen = BUFF_SIZE;
-
-
-       /* Fill some testing Ethernet frame with relevant data */
-       efr1.destination[0] = 0x00;
-       efr1.destination[1] = 0x21;
-       efr1.destination[2] = 0x70;
-       efr1.destination[3] = 0xb5;
-       efr1.destination[4] = 0x4b;
-       efr1.destination[5] = 0xea;
-       efr1.source[0]      = 0xff;
-       efr1.source[1]      = 0xff;
-       efr1.source[2]      = 0xff;
-       efr1.source[3]      = 0xff;
-       efr1.source[4]      = 0xff;
-       efr1.source[5]      = 0xff;
-
-       efr1.len = 46;
-       efr1.data[0] = 0xaa;
-
-       _enable_IRQ();
-       _enable_FIQ();
-
-
-       EMACInit(emacCtrlBase, emacBase);
-       MDIOInit(mdioBase, 0x0, 0x0);
-       dummy_wait();   // FIXME
-
-       EMACMACSrcAddrSet(emacBase, emacAddress);
-       /*  Be sure to program all eight MAC address registers -
-        *  whether the receive channel is to be enabled or not.
-        */
-       for (chan = 0; chan < 8; chan++)
-               EMACMACAddrSet(emacBase, chan, emacAddress, EMAC_MACADDR_NO_MATCH_NO_FILTER);
-
-       phyalive = MDIOPhyAliveStatusGet(mdioBase);
-       if (!phyalive) {
-               rpp_sci_printf("PHY not alive\r\n");
-               return -1;
-       }
-
-       phylink = MDIOPhyLinkStatusGet(mdioBase);
-       if (!phylink)
-               rpp_sci_printf("PHY link down\r\n");
-       else
-               rpp_sci_printf("PHY link up\r\n");
-
-       rpp_sci_printf("Configuring PHY and EMAC...\r\n");
-       PHY_auto_negotiate(mdioBase, emacPhyAddress, PHY_100BASETXDUPL_m | PHY_100BASETX_m | PHY_10BASETDUPL_m | PHY_10BASET_m);
-
-       /* Set the EMAC with the negotiation results if it is successful */
-       PHY_partner_ability_get(mdioBase, emacPhyAddress, &data);
-       if (data & PHY_100BASETXDUPL_m) {
-               EMACDuplexSet(emacBase, EMAC_DUPLEX_FULL);
-               dummy_wait();
-       }
-       else if (data & PHY_100BASETX_m) {
-               EMACDuplexSet(emacBase, EMAC_DUPLEX_HALF);
-               dummy_wait();
-       }
-       else
-               while (1)
-                       ;
-
-       for (chan = 0; chan < 8; chan++) {
-               EMACTxHdrDescPtrWrite(emacBase, 0, chan);
-               EMACRxHdrDescPtrWrite(emacBase, 0, chan);
-       }
-
-       //EMACCoreIntAck(emacBase, EMAC_INT_CORE0_RX);
-       //EMACCoreIntAck(emacBase, EMAC_INT_CORE0_TX);
-
-       EMACRxBroadCastEnable(emacBase, channel);
-       EMACRxPromiscEnable(emacBase, channel);
-
-       EMACTxIntPulseEnable(emacBase, emacCtrlBase, 0, channel);
-       EMACRxIntPulseEnable(emacBase, emacCtrlBase, 0, channel);
-
-       EMACRxHdrDescPtrWrite(emacBase, (unsigned int)rx_desc, channel);
-
-       //EMACRxUnicastSet(emacBase, 0);
-       EMACTxEnable(emacBase);
-       EMACRxEnable(emacBase);
-
-       EMACMIIEnable(emacBase);
-
-       phylink = MDIOPhyLinkStatusGet(mdioBase);
-       if (!phylink)
-               rpp_sci_printf("PHY link down\r\n");
-       else
-               rpp_sci_printf("PHY link up\r\n");
-
-
-       /* TX */
-       for (j = 0; j < 8; j++) {
-               fr1.pNext = NULL;
-               fr1.pBuffer = (uint8_t *)&efr1;
-               fr1.BufOffLen = 65;
-               fr1.PktFlgLen = (EMAC_DSC_FLAG_SOP | EMAC_DSC_FLAG_EOP | EMAC_DSC_FLAG_OWNER | 65);
-
-               EMACTxHdrDescPtrWrite(emacBase, (unsigned int)&fr1, channel);
-               rpp_sci_printf("Packet sent\r\n");
-               while (fr1.PktFlgLen == EMAC_DSC_FLAG_OWNER)
-                       if (rpp_sci_read_nb(1, &input) == SUCCESS)
-                               return -1;
-               dummy_wait();
-               intvect = EMACIntVectorGet(emacBase);
-               intvectraw = EMACIntVectorRawGet(emacBase);
-       }
-
-       /* Dummy RX */
-       {
-               char rx_fr[10];
-               int i;
-
-               rpp_sci_printf("Trying to receive some data\r\n");
-               EMACRxIntPulseEnable(emacBase, emacCtrlBase, 0, channel);
-
-               for (j = 0; j < 8; j++) {
-                       while (!(rx_desc->PktFlgLen & EMAC_DSC_FLAG_SOP))
-                               if (rpp_sci_read_nb(1, &input) == SUCCESS)
-                                       return -1;
-
-                       ;
-
-                       rpp_sci_printf("Received packet:\r\n");
-                       rpp_sci_printf("Length: %d\r\n", rx_desc->PktFlgLen & 0xffff);
-
-                       for (i = 0; i < (rx_desc->PktFlgLen & 0xffff); i++) {
-                               i2str(rx_fr, rx_desc->pBuffer[i], 0, 16);
-                               rpp_sci_printf("%x ", rx_desc->pBuffer[i]);
-                               if (((i+1) % 8) == 0)
-                                       rpp_sci_printf("\r\n");
-                       }
-
-                       /* Reinitialize RX buffer */
-                       rx_desc->pBuffer = rx_buff;
-                       rx_desc->PktFlgLen = EMAC_DSC_FLAG_OWNER;
-                       rx_desc->pNext = NULL;
-                       rx_desc->BufOffLen = BUFF_SIZE;
-                       EMACRxHdrDescPtrWrite(emacBase, (unsigned int)rx_desc, channel);
-                       rpp_sci_printf("\r\n-------------------------------------------\r\n");
-               }
-
-               EMACRxIntPulseDisable(emacBase, emacCtrlBase, 0, channel);
-       }
-
-
-
-       return 0;
-}
-
-#endif  /* DOCGEN */
-
-cmd_des_t const cmd_des_test_ethernet = {
-       0, 0,
-       "ethernet", "Temporary command to test Ethernet communication",
-       "### Command syntax ###\n"
-       "\n"
-       "    ethernet\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "Command tries to send a few ethernet frames. No real connection or\n"
-       "meaningful packets are sent. This only tests, if Ethernet is just\n"
-       "working.\n",
-       CMD_HANDLER(emac_test), (void *)&cmd_list_emac
-};
-
-cmd_des_t const *cmd_list_emac[] = {
-       &cmd_des_test_ethernet,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_emac.h b/rpp-test-sw/commands/cmd_emac.h
deleted file mode 100644 (file)
index 98132a0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _EMAC_TEST_H_
-#define _EMAC_TEST_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_emac[];
-
-#endif /* _EMAC_TEST_H_ */
diff --git a/rpp-test-sw/commands/cmd_fr_basic_test.c b/rpp-test-sw/commands/cmd_fr_basic_test.c
deleted file mode 100644 (file)
index 081ab54..0000000
+++ /dev/null
@@ -1,2765 +0,0 @@
-/*
- * 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 slotID;
-       uint8_t dataLength;
-       int values[MAX_PARAM_VALUES_NUM];
-       uint8_t data[MAX_PARAM_VALUES_NUM];
-       char *token = NULL;
-
-       if (sscanf(param[1], "%d", &slotID) != 1)
-               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, slotID, 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 slotID;
-
-       if (sscanf(param[1], "%d", &slotID) != 1)
-               return -CMDERR_BADPAR;
-       if (param[2] != NULL)
-               return -CMDERR_BADPAR;
-
-       retVal = rpp_fr_cancel_transmit_lpdu(0, slotID);
-       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 slotID;
-       uint8_t data[cPayloadLengthMax];
-       Fr_RxLPduStatusType status;
-       uint8_t receivedLength = 0;
-       uint8_t i;
-
-       if (sscanf(param[1], "%d", &slotID) != 1)
-               return -CMDERR_BADPAR;
-       if (param[2] != NULL)
-               return -CMDERR_BADPAR;
-
-       memset(data, 0, sizeof(data));
-
-       retVal = rpp_fr_receive_lpdu(0, slotID, data, &status, &receivedLength);
-       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 slotID;
-       Fr_TxLPduStatusType status;
-       char *statusStrings[] = {"is not", "is"};
-
-       if (sscanf(param[1], "%d", &slotID) != 1)
-               return -CMDERR_BADPAR;
-       if (param[2] != NULL)
-               return -CMDERR_BADPAR;
-
-       retVal = rpp_fr_check_tx_lpdu_status(0, slotID, &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 slotID;
-
-       if (sscanf(param[1], "%d", &slotID) != 1)
-               return -CMDERR_BADPAR;
-       if (param[2] != NULL)
-               return -CMDERR_BADPAR;
-
-       retVal = rpp_fr_disable_lpdu(0, slotID);
-       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 id, slot, maxpayload, cycleset, cycleoffset;
-       Fr_TMS570LS_BufferConfigType tmp_buffer;
-       boolean_t is_pow2;
-       uint8_t pow2;
-
-       ret = sscanf(param[2], "id%i slot%i %2s cycset%i cycoffset%i max%i",
-                                &id,
-                                &slot,
-                                channel,
-                                &cycleset,
-                                &cycleoffset,
-                                &maxpayload
-                                );
-       if (ret != 6) {
-               printf("Error parsing parameter %d\n", ret+1);
-               return -CMDERR_BADPAR;
-       }
-
-       if (slot > 2047 || id > 2047)
-               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, id, tmp_buffer.slotId, tmp_buffer.channel, cycleset, cycleoffset, tmp_buffer.maxPayload, 0) == SUCCESS) {
-               printf("id%i slot%i %2s cycset%i cycoffset%i max%i\n",
-                          id,
-                          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><NUM> 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"
-       "- `<NUM>` 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"
-       "### 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 in selected frame",
-       "### Command syntax ###\n"
-       "\n"
-       "    frbttransmit<FRID> <DATA>\n"
-       "where\n"
-       "\n"
-       "- `<FRID>` is a decimal number specifying the ID of the frame for which a buffer has been configured.\n"
-       "- `<DATA>` is a sequence of hexadecimal numbers separated by spaces. Each number represents one byte of the message.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command stands for Fr_TransmitTxLPdu function from the Autosar\n"
-       "specification. The command finds the first buffer assigned to the\n"
-       "specified frame ID and copies the given data into its data section in\n"
-       "the message RAM. Transmit request is set after the data are copied, so\n"
-       "transmission starts at the next occurrence of the frame in the\n"
-       "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 of the frame",
-       "### Command syntax ###\n"
-       "\n"
-       "    frbtcanceltx<FRID>\n"
-       "\n"
-       "where `<FRID>` is a decimal number specifying the ID of the frame for\n"
-       "which a buffer has been configured.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command stands for Fr_CancelTxLPdu function from the Autosar\n"
-       "specification. The command finds all buffers assigned to the specified\n"
-       "frame ID and reconfigures them to stop transmitting data. The command\n"
-       "finishes successfully only if reconfiguration is allowed in message\n"
-       "RAM configuration (secureBuffers configuration parameter). Only TX\n"
-       "buffers and buffers not used for startup frames can be canceled.\n"
-       "\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<FRID>\n"
-       "\n"
-       "where `<FRID>` is a decimal number specifying the ID of the frame for\n"
-       "which a buffer was configured.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command stands for Fr_ReceiveRxLPdu function from the Autosar\n"
-       "specification. The command finds the first buffer assigned to the\n"
-       "specified frame ID, determines if a new message has been received and\n"
-       "reads it out of the buffer. If no message was received, \"No message\n"
-       "received\" is printed. If a new message was received, all message data\n"
-       "are printed as a hexadecimal values. If a new message was retrieved\n"
-       "from a FIFO buffer and more messages are available in it, \"More\n"
-       "messages are still in FIFO\" is printed.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> frbtreceive0\n"
-       "    More messages are still in FIFO:\n"
-       "    Received message (32 B):\n"
-       "     ee ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n",
-       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<FRID>\n"
-       "\n"
-       "where `<FRID>` is a decimal number specifying the ID of the frame for\n"
-       "which a buffer has been configured.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command stands for Fr_CheckTxLPduStatus function from the Autosar\n"
-       "specification. The command finds the first buffer assigned to the\n"
-       "specified frame ID, reads its status and prints it. The buffer can be\n"
-       "in one of the two states:\n"
-       "\n"
-       "- Message transmission is pending, which means that the buffer has not yet sent its message in single shot mode or that it is in continuous mode.\n"
-       "- No message transmission is pending, which means that the buffer is in single shot mode and the message has already been sent.\n"
-       "\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<FRID>\n"
-       "\n"
-       "where `<FRID>` is a decimal number specifying the ID of a frame. The\n"
-       "buffers configure for this frame will be disabled.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command stands for Fr_DisableLPdu function from the Autosar\n"
-       "specification. The command finds all buffers assigned to the specified\n"
-       "frame ID and disables them. This means that those buffers will be\n"
-       "unavailable for the communication until their reconfiguration (which\n"
-       "is not yet implemented). Buffers used for startup frames and FIFO RX\n"
-       "buffers cannot be disabled.\n"
-       "\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<ID> slot<SLOT> <CHN> cycset<CYCS> cycoffset<CYCO> max<MAX>\n"
-       "where\n"
-       "\n"
-       "- `<ID>` 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
-};
diff --git a/rpp-test-sw/commands/cmd_fr_basic_test.h b/rpp-test-sw/commands/cmd_fr_basic_test.h
deleted file mode 100644 (file)
index 7fa614a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * FlexRay Communication RPP API header file.
- *
- * @file cmd_fr_basic_test.h
- *
- * @copyright Copyright (C) 2013 Czech Technical University in Prague
- *
- * @author Michal Horn <hornmich@fel.cvut.cz>
- */
-
-
-#ifndef CMD_FR_BASIC_TEST_H_
-#define CMD_FR_BASIC_TEST_H_
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_fr_basic_test[];
-
-
-#endif /* CMD_FR_BASIC_TEST_H_ */
diff --git a/rpp-test-sw/commands/cmd_fray.c b/rpp-test-sw/commands/cmd_fray.c
deleted file mode 100644 (file)
index e21bf20..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.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_fray.c
- *
- * Abstract:
- *  Commands for control FlexRay
- *  - Getting status of FlexRay from chips on SPI
- *  - Sending test data on FRAY
- *  - Receiving test data on FRAY
- *
- *  There are FlexRay test commands, to test the connection between two FlexRay nodes A and B
- *  The node A is sending a message 100 times with some period.
- *  The node B is receiving this message and check if it fits the pattern.
- *  Commands are counting the number of errors, which is printed at the end of the test.
- *  After 100 transmissions both nodes are halted.
- */
-
-#include "cmd_fray.h"
-#include "stdio.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "drv/fray.h"
-#include "cmdproc_utils.h"
-#include "hal/hal.h"
-#include "cmdproc.h"
-#include "sys/ti_drv_fray.h"
-
-/**
- * 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,   // Macrotick = 1us
-       .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.
- * That is the node that transmits messages to the node B.
- */
-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,      // (cycle period, 5.6ms), uT = 25ns@10Mbit/sec,  25ns@5Mbit/sec, 50ns@2.5Mbit/sec
-       .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.
- * That is the node that receives messages from the node A.
- */
-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
-};
-
-/**
- * FlexRay node A message RAM configuration.
- * Reconfiguration is disabled, 2 static buffers are configured.
- */
-static Fr_TMS570LS_MsgRAMConfig Fr_node_A_msgRAM_config = {
-       .dynSegmentBufferCount = 0,
-       .fifoBufferCount = 0,
-       .secureBuffers = FR_SB_ALL_REC_DISABLED,
-       .statSegmentBufferCount = 2,
-       .syncFramePayloadMultiplexEnabled = 0
-};
-
-/**
- * FlexRay node B message RAM configuration.
- * Reconfiguration is disabled, 2 static buffers are configured.
- */
-static Fr_TMS570LS_MsgRAMConfig Fr_node_B_msgRAM_config = {
-       .dynSegmentBufferCount = 0,
-       .fifoBufferCount = 0,
-       .secureBuffers = FR_SB_ALL_REC_DISABLED,
-       .statSegmentBufferCount = 2,
-       .syncFramePayloadMultiplexEnabled = 0
-};
-
-/**
- * The FlexRay node A is a sync node and coldstarter. That is why the first buffer
- * (buffer 0) is configured as TX. All coldstarters and sync nodes must have the
- * first buffer configured as TX. The FlexRay network has to contain at least two
- * sync nodes and coldstarters.
- * The second buffer is used for messages transmission. It is TX and configured as
- * single-shot to send only one message after some period.
- */
-static Fr_TMS570LS_BufferConfigType Fr_node_A_static_buffers_config[] = {
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = TRUE,
-               .fidMask = 0,
-               .maxPayload = 9,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = FALSE,
-               .slotId = 1
-       },
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = TRUE,
-               .fidMask = 0,
-               .maxPayload = 9,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = TRUE,
-               .slotId = 3
-       }
-};
-
-/**
- * The FlexRay node B is a sync node and coldstarter. That is why the first buffer
- * (buffer 0) is configured as TX. All coldstarters and sync nodes must have the
- * first buffer configured as TX. The FlexRay network has to contain at least two
- * sync nodes and coldstarters.
- * The second buffer is used for messages receiving.
- */
-static Fr_TMS570LS_BufferConfigType Fr_node_B_static_buffers_config[] = {
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = TRUE,
-               .fidMask = 0,
-               .maxPayload = 9,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = FALSE,
-               .slotId = 2
-       },
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = FALSE,
-               .fidMask = 0,
-               .maxPayload = 9,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = TRUE,
-               .slotId = 3
-       }
-};
-
-/**
- * Unifying configuration structure for the node A.
- */
-static Fr_ConfigType Fr_config_node_A = {
-       .clusterConfiguration = &Fr_cluster_config,
-       .dynamicBufferConfigs = NULL,
-       .fifoBufferConfigs = NULL,
-       .msgRAMConfig = &Fr_node_A_msgRAM_config,
-       .nodeConfiguration = &Fr_node_A_config,
-       .staticBufferConfigs = Fr_node_A_static_buffers_config
-};
-
-/**
- * Unifying configuration structure for the node B.
- */
-static Fr_ConfigType Fr_config_node_B = {
-       .clusterConfiguration = &Fr_cluster_config,
-       .dynamicBufferConfigs = NULL,
-       .fifoBufferConfigs = NULL,
-       .msgRAMConfig = &Fr_node_B_msgRAM_config,
-       .nodeConfiguration = &Fr_node_B_config,
-       .staticBufferConfigs = Fr_node_B_static_buffers_config
-};
-
-/**
- *  Loads data into TX buffer for FlexRay node A.
- *  Set TX Request for the buffer to start the transmission.
- */
-int8_t transmit_node_a()
-{
-       uint8_t data[18];
-       int i;
-
-       // Write payload for the buffer
-       for (i = 0; i < 18; i++) {
-               data[i] = i;
-       }
-       return rpp_fr_transmit_lpdu(0, 3, data, 18);
-}
-
-/**
- *     Check data of the received message for correctness.
- *     @return  0 if message was received and is correct
- *                      1 if message was received and is incorrect
- */
-int check_message(const uint8_t *data)
-{
-       int i;
-
-       for (i = 0; i < 18; i++) {
-               if (data[i] != i)
-                       return 1;
-       }
-       return 0;
-}
-
-
-/**
- *  @brief     Get FlexRay status in human readable form
- *
- *  Command sends some data on SPI (data do not matters, chips are read only) and retreives a response.
- *  The response is translated and displayed as readable text.
- *
- * @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_fray_status(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       char *p;
-       int pin;
-       uint32_t numCmdDesc;
-       int i;
-       uint32_t numFieldDesc;
-
-       p = param[1];
-       if (sscanf(p, "%d", &pin) != 1)
-               return -CMDERR_BADPAR;
-       pin--; // Highlevel command has pin number mapped according the board scheme, this switches to internal representation
-       if (pin > FRAY_NUM_PORTS || pin < 0) return -CMDERR_BADPAR;
-
-       if (Fr_spi_transfer(pin) != 0) return -CMDERR_BADDIO;
-
-       spitr_reg_translate_table_t translatedData;
-       const spitr_cmd_map_t *cmdDesc = get_spi_cmd_map(PORT_NAME_FRAY1, -1, &numCmdDesc);
-       if (cmdDesc == NULL) return -CMDERR_BADREG;
-
-       const spitr_field_desc_t *fieldDescs = get_spi_field_desc(cmdDesc, numCmdDesc, Fr_spi_get_cmd(pin), &numFieldDesc);
-       if (fieldDescs == NULL)
-               return -CMDERR_BADPAR;
-       uint32_t fr_spi_response = Fr_spi_response(pin);
-       uint32_t lsbResponse = 0 | ((fr_spi_response & 0xFF) << 8) | ((fr_spi_response & 0xFF00) >> 8);
-       spitr_fill_tr_table(fieldDescs, numFieldDesc, lsbResponse, &translatedData);
-       for (i = 0; i < translatedData.num_rows; i++) {
-               rpp_sci_printf("%s: %x\r\n", translatedData.row[i].field_name, translatedData.row[i].value);
-       }
-       return 0;
-}
-
-/**
- *  @brief     Start sending data on the FlexRay as node A
- *
- * @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_test_frayA(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       uint32_t i;
-       uint32_t error = 0;
-       uint32_t msg_cnt = 0;
-       uint32_t count = 100;
-       Fr_TxLPduStatusType status;
-       Fr_POCStatusType poc_status;
-
-       if (param[1] && sscanf(param[1], "%d", &count) != 1)
-               return -CMDERR_BADPAR;
-
-       if (rpp_fr_init_driver(&Fr_config_node_A, &error) == FAILURE) {
-               rpp_sci_printf("Fray driver initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_init_controller(0, &error) == FAILURE) {
-               rpp_sci_printf("Fray control node initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       rpp_sci_printf("Fray control node initialized.\r\n");
-       rpp_sci_printf("Waiting for network connection...\r\n");
-
-       if (rpp_fr_start_communication(0, &error) == FAILURE) {
-               rpp_sci_printf("Integration to the network failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_all_slots(0) == FAILURE) {
-               rpp_sci_printf("All slots mode selection failed.\n");
-               return -CMDERR_BADCFG;
-       }
-
-       rpp_sci_printf("Connected. Frames transmission is starting. O means OK, X means Error\r\n");
-       if (rpp_fr_clear_timer_irq(0,0) == FAILURE ||
-               rpp_fr_set_timer(0,0,10,1) == FAILURE
-               ) {
-               rpp_sci_printf("Absolute timer setting failed.\n");
-               return -CMDERR_BADCFG;
-       }
-       for (i = 0; i < count; i++) {
-               if (transmit_node_a() == FAILURE) {
-                       rpp_sci_printf("X");
-                       error++;
-               }
-               else
-                       rpp_sci_printf("O");
-               msg_cnt++;
-
-               do {
-                       rpp_fr_check_tx_lpdu_status(0, 3, &status);
-                       rpp_fr_get_poc_status(0, &poc_status);
-               } while (status == FR_NOT_TRANSMITTED && poc_status.ErrorMode == FR_ERRORMODE_ACTIVE);
-
-               if (poc_status.ErrorMode != FR_ERRORMODE_ACTIVE) {
-                       rpp_sci_printf("\nFlexRay exited active mode (see command frbtgetpocst)!\n");
-                       break;
-               }
-
-       }
-       rpp_sci_printf("\r\nTransmitted %d messages with %d errors.\r\n", msg_cnt, error);
-       if (rpp_fr_halt_communication(0) != SUCCESS)
-               rpp_sci_printf("FlexRay HALT command failed, please reset the board to stop transmission.\r\n");
-       else
-               rpp_sci_printf("FlexRay halted, reset the board to make FlexRay usable again.\r\n");
-       return 0;
-}
-
-/**
- *  @brief     Start receiving data on the FlexRay as node B
- *
- * @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_test_frayB(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       uint32_t i;
-       uint32_t error = 0;
-       uint32_t msg_cnt = 0;
-       uint32_t count = 100;
-
-       if (param[1] && sscanf(param[1], "%d", &count) != 1)
-               return -CMDERR_BADPAR;
-
-       if (rpp_fr_init_driver(&Fr_config_node_B, &error) == FAILURE) {
-               rpp_sci_printf("Fray driver initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_init_controller(0, &error) == FAILURE) {
-               rpp_sci_printf("Fray control node initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       rpp_sci_printf("Fray control node initialized.\r\n");
-       rpp_sci_printf("Waiting for network connection...\r\n");
-
-       if (rpp_fr_start_communication(0, &error) == FAILURE) {
-               rpp_sci_printf("Integration to the network failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_all_slots(0) == FAILURE) {
-               rpp_sci_printf("All slots mode selection failed.\n");
-               return -CMDERR_BADCFG;
-       }
-
-       rpp_sci_printf("Connected. Frames transmission is starting. O means OK, X means Error, T means timeout.\r\n");
-       for (i = 0; i < count; i++) {
-               uint8_t data[18];
-               Fr_RxLPduStatusType status;
-               uint8_t size;
-               uint8_t cycle1, cycle2;
-               uint16_t mtick;
-
-               rpp_fr_get_global_time(0, &cycle1, &mtick);
-               do {
-                       if (rpp_fr_receive_lpdu(0, 3, data, &status, &size) == FAILURE) {
-                               rpp_sci_printf("\nMessage receiving failed!\n");
-                               break;
-                       }
-                       rpp_fr_get_global_time(0, &cycle2, &mtick);
-               } while (status == FR_NOT_RECEIVED && (cycle2 != ((cycle1-1) & 0x3F)));
-
-               if (status == FR_NOT_RECEIVED)
-                       rpp_sci_printf("T");
-               else if (check_message(data) == 0) {
-                       rpp_sci_printf("O");
-                       msg_cnt++;
-               }
-               else {
-                       rpp_sci_printf("X");
-                       error++;
-                       msg_cnt++;
-               }
-       }
-       rpp_sci_printf("\r\nReceived %d messages with %d errors.\r\n", msg_cnt, error);
-       if (rpp_fr_halt_communication(0) != SUCCESS)
-               rpp_sci_printf("FlexRay HALT command failed, please reset the board to stop transmission.\r\n");
-       else
-               rpp_sci_printf("FlexRay halted\r\n");
-       return 0;
-}
-
-#endif  /* DOCGEN */
-
-/** Command descriptor for FlexRay status command */
-cmd_des_t const cmd_des_fray_stat = {
-       0, 0,
-       "frayxcvrstat#","Get the status of a FlexRay transceiver in a human readable form",
-       "### Command syntax ###\n"
-       "\n"
-       "    frayxcvrstat<CHN>\n"
-       "where CHN is a number in range 1-2\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command receives response from a FlexRay transceiver via SPI, and\n"
-       "prints in the form of attribute-value table.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> frayxcvrstat1\n"
-       "\n"
-       "Prints the status of FRAY1 transceiver.\n",
-       CMD_HANDLER(cmd_do_fray_status), (void *)&cmd_list_fray
-};
-
-/** Command descriptor for FlexRay 1 test node A */
-cmd_des_t const cmd_des_test_fray_a = {
-       0, 0,
-       "fraytestA","Run the FlexRay test as A node",
-       "### Command syntax ###\n"
-       "\n"
-       "    fraytestA [<COUNT>]\n"
-       "\n"
-       "where `<COUNT>` is an optional number of messages to send. The default\n"
-       "is 100.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The commands creates FlexRay node A and starts sending a message\n"
-       "approximately every communication cycle. COUNT messages are sent for the\n"
-       "test of the connection. The command should be run with two devices\n"
-       "connected by a FlexRay bus and the second device should be running the\n"
-       "fraytestB command (it is necessary to run both commands shortly after\n"
-       "each other).\n"
-       "\n"
-       "When the command transmits a message a character is printed. O means\n"
-       "that the message was transmitted correctly, X signals a transmission\n"
-       "error. The number of TX errors and successfully transmitted messages\n"
-       "is maintained during the test and printed at the end.\n",
-       CMD_HANDLER(cmd_do_test_frayA), (void *)&cmd_list_fray
-};
-
-/** Command descriptor for FlexRay 1 test node B */
-cmd_des_t const cmd_des_test_fray_b = {
-       0, 0,
-       "fraytestB","Run the FlexRay test as B node",
-       "### Command syntax ###\n"
-       "\n"
-       "    fraytestB [<COUNT>]\n"
-       "\n"
-       "where `<COUNT>` is an optional number of messages to receive. The default\n"
-       "is 100.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The commands creates FlexRay node B and starts receiving a messages.\n"
-       "100 messages should be received. The command should be run with two\n"
-       "devices connected by a FlexRay bus and the second device should be\n"
-       "running the fraytestA command (it is necessary to run both commands\n"
-       "shortly after each other).\n"
-       "\n"
-       "When the command receives a message a character is printed. O means\n"
-       "that the message was received correctly, X signals an error in data, T\n"
-       "means timeout (i.e. no message was received within 63 cycles). The\n"
-       "number of RX errors and successfully received messages is maintained\n"
-       "during the test and printed at the end.\n",
-       CMD_HANDLER(cmd_do_test_frayB), (void *)&cmd_list_fray
-};
-
-/** List of commands for din, defined as external */
-cmd_des_t const *cmd_list_fray[] = {
-       &cmd_des_fray_stat,
-       &cmd_des_test_fray_a,
-       &cmd_des_test_fray_b,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_fray.h b/rpp-test-sw/commands/cmd_fray.h
deleted file mode 100644 (file)
index a6e772a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_fray.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_FRAY_H_
-#define CMD_FRAY_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_fray[];
-
-
-#endif /* CMD_FRAY_H_ */
diff --git a/rpp-test-sw/commands/cmd_hbr.c b/rpp-test-sw/commands/cmd_hbr.c
deleted file mode 100644 (file)
index 1e60dce..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 2012-2014 Czech Technical University in Prague
- *
- * Created on: 28.2.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_hbr.c
- *
- * Abstract:
- *      This file contains commands controlling H-bridge
- *
- */
-
-#include "cmd_hbr.h"
-#include "stdio.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "cmdproc_utils.h"
-#include "drv/drv.h"
-
-
-/**
- * @brief      Enable HBR driver with given period of PWM
- *
- * @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_hbr_enable(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       uint32_t period;
-       int ret;
-       char *p = param[1];
-       char spareParams;
-
-       if (sscanf(p, "%d %1s", &period, &spareParams) != 1)
-               return -CMDERR_BADPAR;
-
-       ret = rpp_hbr_enable(period);
-       if (ret == FAILURE) {
-               rpp_sci_printf("Enable procedure failed.\n");
-               return -1;
-       }
-
-       rpp_sci_printf("hbrenable =%d\n", period, ret);
-       return 0;
-}
-
-/**
- * @brief      Control HBR driver with given value <-100; 100>
- *
- * @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_hbr_control(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int cmd;
-       int ret;
-       char *p = param[1];
-       char spareParams;
-
-       if (sscanf(p, "%d %1s", &cmd, &spareParams) != 1)
-               return -CMDERR_BADPAR;
-
-       ret = rpp_hbr_control((double)cmd/(double)100);
-       if (ret == -1) {
-               rpp_sci_printf("H-bridge not enabled.\n");
-               return -1;
-       }
-       else if (ret == -2) {
-               rpp_sci_printf("Command out of range.\n");
-               return -CMDERR_BADPAR;
-       }
-       rpp_sci_printf("hbrcontrol =%d\n", cmd, ret);
-       return 0;
-}
-
-/**
- * @brief      Disable HBR driver.
- *
- * @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_hbr_disable(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int ret;
-
-       ret = rpp_hbr_disable();
-       if (ret == FAILURE)
-               rpp_sci_printf("H-bridge already disabled.\n");
-       return cmd_opchar_replong(cmd_io, param, ret, 0, 10);
-}
-
-#endif  /* DOCGEN */
-
-/** Command descriptor for HBR enable command */
-cmd_des_t const cmd_des_hbr_enable = {
-       0, 0,
-       "hbrenable*","Enable the H-bridge and set its PWM period",
-       "### Command syntax ###\n"
-       "\n"
-       "    hbrenable<PER>\n"
-       "\n"
-       "where `<PER>` is PWM period in microseconds.\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command enables the H-bridge (HBR pin), i.e. the enable signal\n"
-       "the H-bridge chip is set, the watchdog reset task is started and the\n"
-       "PWM is configured with the specified period and duty cycle 0%.\n"
-       "\n"
-       "If the period is zero, the default frequency of 18kHz is\n"
-       "used instead. Minimum period is 50. This command should be\n"
-       "called before any other command\n"
-       "starting with hbr is used. If H-bridge is already enabled, an error is\n"
-       "printed.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> hbrenable1000\n"
-       "    hbrenable =1000\n"
-       "\n"
-       "Enables HBR with period 1000 microseconds (frequency 1 kHz). HBR\n"
-       "output is still inactive, but ready for other commands.\n",
-       CMD_HANDLER(cmd_do_hbr_enable), (void *)&cmd_list_hbr
-};
-
-/** Command descriptor for HBR control command */
-cmd_des_t const cmd_des_hbr_control = {
-       0, 0,
-       "hbrcontrol*","Set the motor voltage direction and size in percent",
-       "### Command syntax ###\n"
-       "\n"
-       "    hbrcontrol<SPEED>\n"
-       "\n"
-       "where `<SPEED>` specifies direction and PWM duty cycle in percent (a\n"
-       "number in range -100, 100).\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command sets the direction and the size of the voltage at the HBR\n"
-       "output.\n"
-       "\n"
-       "HBR has to be enabled by the `hbrenable` command before calling this\n"
-       "command.\n"
-       "\n"
-       "### Examples ###\n"
-       "\n"
-       "    --> hbrcontrol-25\n"
-       "    hbrcontrol =-25\n"
-       "\n"
-       "Rotates the motor to the left with 25% duty cycle.\n"
-       "\n"
-       "    --> hbrcontrol25\n"
-       "    hbrcontrol =25\n"
-       "\n"
-       "Rotates the motor to the right with 25% duty cycle.\n"
-       "\n"
-       "    --> hbrcontrol0\n"
-       "    hbrcontrol =0\n"
-       "\n"
-       "Stops the motor, but the H-Bridge output is active (low-side active\n"
-       "free wheeling).\n",
-       CMD_HANDLER(cmd_do_hbr_control), (void *)&cmd_list_hbr
-};
-
-/** Command descriptor for HBR disable command */
-cmd_des_t const cmd_des_hbr_disable = {
-       0, 0,
-       "hbrdisable","Disable the H-bridge",
-       "### Command syntax ###\n"
-       "\n"
-       "    hbrdisable\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command disables the H-bridge HBR, which means that the PWM is\n"
-       "stopped and the enable signal is cleared. The watchdog task is left\n"
-       "running, because it is harmless.\n"
-       "\n"
-       "After the H-bridge is disabled, it cannot be controlled by any command\n"
-       "until it is enabled again by the `hbrenable` command.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> hbrdisable\n"
-       "    hbrdisable=0\n"
-       "\n"
-       "Stops motor and disables the H-bridge.\n",
-       CMD_HANDLER(cmd_do_hbr_disable), (void *)&cmd_list_hbr
-};
-
-/** List of commands for hbr, defined as external */
-cmd_des_t const *cmd_list_hbr[] = {
-       &cmd_des_hbr_enable,
-       &cmd_des_hbr_control,
-       &cmd_des_hbr_disable,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_hbr.h b/rpp-test-sw/commands/cmd_hbr.h
deleted file mode 100644 (file)
index 9dcbf72..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_hbr.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_HBR_H_
-#define CMD_HBR_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_hbr[];
-
-
-#endif /* CMD_HBR_H_ */
diff --git a/rpp-test-sw/commands/cmd_hout.c b/rpp-test-sw/commands/cmd_hout.c
deleted file mode 100644 (file)
index 40fd97b..0000000
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.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_hout.c
- *
- * Abstract:
- *      This file contains commands for HOUT control.
- *
- */
-
-#include "cmd_hout.h"
-#include "stdio.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "hal/hal.h"
-#include "drv/drv.h"
-#include "cmdproc_utils.h"
-
-
-/**
- * @brief      Reads values from HOUT_IFBK pins (subset of ADC)
- *
- * @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_read_hout_ifbk_values(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       uint32_t i;                     // Cycle control variable
-       port_desc_t *desc;
-       uint32_t values[PORT_HOUTIFBK_CHANNEL_NUM*2];
-       int ret;
-
-       desc = hal_port_get_dsc(PORT_NAME_HOUTIFBK, -1);
-
-       ret = desc->port_getfnc_ptr(desc->config, PORT_HOUTIFBK_CHANNEL_NUM, values);
-       if (ret < 0)
-               return ret;
-
-       for (i = 0; i < PORT_HOUTIFBK_CHANNEL_NUM; i++) {
-               rpp_sci_printf("HOUT%d: %d\n", i+1, values[i]);
-       }
-       return 0;
-}
-
-/**
- * @brief      Runs test of selected HOUT pin.
- *
- * @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_test_hout_fault(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-
-       if (sscanf(p, "%d %1s", &pin, &spareParams) != 1)
-               return -CMDERR_BADPAR;
-       pin--;
-       if (pin < 0 || pin > 5) return -CMDERR_BADPAR;
-
-       switch (hout_fail(pin)) {
-       case HOUT_OK:
-               rpp_sci_printf("OK");
-               break;
-       case HOUT_FAILED:
-               rpp_sci_printf("FAIL");
-               break;
-       case HOUT_NOT_ON:
-               rpp_sci_printf("NOT RUNNING");
-               break;
-       default:
-               rpp_sci_printf("Bad pin selected");
-               break;
-       }
-       rpp_sci_printf("\n");
-       return 0;
-}
-
-/**
- *  @brief     Set or get actual pwm 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_hout_pwm(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       char *p;
-       uint32_t values[MAX_PARAM_VALUES_NUM];
-       char spareParams;
-       int pin;
-
-       p = param[1];
-       if (sscanf(p, "%d", &pin) != 1)
-               return -CMDERR_BADPAR;
-       pin--;
-       if (pin < 0 || pin > 5) return -CMDERR_BADPAR;
-
-       if (param[2] != NULL) {     // More parameters = set values
-               p = param[2];
-               if (sscanf(p, "%d %d %1s", &values[0], &values[1], &spareParams) != 2)
-                       return -CMDERR_BADPAR;
-               if (values[1] > 100) return -CMDERR_BADPAR;
-               hout_pwm_set_signal(pin, (double)values[0], values[1]);
-               return 0;
-       }
-       else {  // No more parameters = get values
-               double period = hout_pwm_get_period(pin);
-               uint32_t duty = hout_pwm_get_duty(pin);
-
-               rpp_sci_printf("houtpwm%d_period=%g\r\nhoutpwm%d_duty=%u%%", pin+1, period, pin+1, duty);
-               return 0;
-       }
-}
-
-/**
- *  @brief     Start PWM, if it was previously set by houtpwm command
- *
- * @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_hout_pwm_start(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-
-       if (sscanf(p, "%d %1s", &pin, &spareParams) != 1)
-               return -CMDERR_BADPAR;
-       pin--;
-       if (pin < 0 || pin > 5) return -CMDERR_BADPAR;
-       int ret = hout_pwm_start(pin);
-       if (ret == -1) {
-               rpp_sci_printf("PWM was not initialized.\r\n");
-               return -CMDERR_BADCFG;
-       }
-       else
-               return 0;
-}
-
-/**
- *  @brief     Stop PWM
- *
- * @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_hout_pwm_stop(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-
-       if (sscanf(p, "%d %1s", &pin, &spareParams) != 1)
-               return -CMDERR_BADPAR;
-       pin--;
-       if (pin < 0 || pin > 5) return -CMDERR_BADPAR;
-       hout_pwm_stop(pin);
-       return 0;
-}
-
-#endif  /* DOCGEN */
-
-/** Command descriptor for test hout fault state command */
-cmd_des_t const cmd_des_test_hout_fail = {
-       0, 0,
-       "houtfail*","Test if some HOUT pin is in the fault state",
-       "### Command syntax ###\n"
-       "\n"
-       "    houtfail<PIN>\n"
-       "where `<PIN>` is in range 1-6\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command tests, if HOUT pin is in a good condition. When the\n"
-       "circuit controlling HOUT pin detects some failure, it signals that on\n"
-       "HOUT_DIAG output. This command is supposed to read this output and\n"
-       "print its state.\n"
-       "\n"
-       "Possible outputs of this command:\n"
-       "\n"
-       "- OK - no failure detected\n"
-       "- FAIL - a failure detected\n"
-       "- NOT RUNNING - PWM was set set up and started\n"
-       "\n"
-       "Note: Before using this command, houtpwmstart and houtpwm commands\n"
-       "should be called.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> houtpwm6 1000 25\n"
-       "    --> houtpwmstart6\n"
-       "    --> houtfail6\n"
-       "    OK\n"
-       "\n"
-       "Detects the state of the HOUT1 and prints OK, FAIL or NOT RUNNING.\n",
-       CMD_HANDLER(cmd_do_test_hout_fault), (void *)&cmd_list_hout
-};
-
-/** Command descriptor for hout read IFBK command */
-cmd_des_t const cmd_des_read_hifbk = {
-       0, 0,
-       "houtifbk","Read values from HOUT current feedback",
-       "### Command syntax ###\n"
-       "\n"
-       "    houtifbk\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command reads analog values from HOUT_IFBK pins and prints\n"
-       "them in a table.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "  --> houtifbk\n"
-       "  HOUT1: 0\n"
-       "  HOUT2: 134223784\n"
-       "  HOUT3: 134223784\n"
-       "  HOUT4: 0\n"
-       "  HOUT5: 38924\n"
-       "  HOUT6: 1342231444\n",
-       CMD_HANDLER(cmd_do_read_hout_ifbk_values), (void *)&cmd_list_hout
-};
-
-/** Command descriptor for HOUT set PWM command */
-cmd_des_t const cmd_des_hout_pwm = {
-       0, 0,
-       "houtpwm*","Set or get actual PWM parameters",
-       "### Command syntax ###\n"
-       "\n"
-       "    houtpwm<PIN> <PER> <DUTY>\n"
-       "    houtpwm<PIN>\n"
-       "where\n"
-       "\n"
-       "- `<PIN>` is a number in range 1-6\n"
-       "- `<PER>` is a length of the PWM period in microseconds\n"
-       "- `<DUTY>` is a the PWM duty cycle in percent (0-100)\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command can be used to set or get HOUT PWM parameters.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> houtpwm1 1000 25\n"
-       "\n"
-       "HOUT1 PWM will have the period of 1ms and will be active for 25% of\n"
-       "this period.\n"
-       "\n"
-       "    --> houtpwm1\n"
-       "    houtpwm1_period=1000\n"
-       "    houtpwm1_duty=25\n"
-       "\n"
-       "Prints the actual period of HOUT1 PWM in microseconds and the duty\n"
-       "cycle in percents.\n",
-       CMD_HANDLER(cmd_do_hout_pwm), (void *)&cmd_list_hout
-};
-
-/** Command descriptor for PWM start command */
-cmd_des_t const cmd_des_hout_pwm_start = {
-       0, 0,
-       "houtstartpwm*","Start generating PWM signal on HOUT",
-       "### Command syntax ###\n"
-       "\n"
-       "    houtstartpwm<PIN>\n"
-       "where `<PIN>` is a number in range 1-6\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command starts to generate the PWM signal on the specified HOUT\n"
-       "pin. The HOUT PWM has to be previously set by the houtpwm command,\n"
-       "otherwise an error is printed.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> houtpwm1 1000 25\n"
-       "    --> houtstartpwm1\n"
-       "\n"
-       "HOUT1 PWM generation will be started.\n",
-       CMD_HANDLER(cmd_do_hout_pwm_start), (void *)&cmd_list_hout
-};
-
-/** Command descriptor for PWM stop command */
-cmd_des_t const cmd_des_hout_pwm_stop = {
-       0, 0,
-       "houtstoppwm*","Stop generating of PWM signal on HOUT",
-       "### Command syntax ###\n"
-       "\n"
-       "    houtstoppwm<PIN>\n"
-       "where `<PIN>` is a number in range 1-6\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command stops generating the PWM signal on the selected pin.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> houtstoppwm1\n"
-       "\n"
-       "HOUT1 PWM generation will be deactivated.\n",
-       CMD_HANDLER(cmd_do_hout_pwm_stop), (void *)&cmd_list_hout
-};
-
-/** List of commands for hout, defined as external */
-cmd_des_t const *cmd_list_hout[] = {
-       &cmd_des_test_hout_fail,
-       &cmd_des_read_hifbk,
-       &cmd_des_hout_pwm,
-       &cmd_des_hout_pwm_start,
-       &cmd_des_hout_pwm_stop,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_hout.h b/rpp-test-sw/commands/cmd_hout.h
deleted file mode 100644 (file)
index d091d36..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_hout.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_HOUT_H_
-#define CMD_HOUT_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_hout[];
-
-
-#endif /* CMD_HOUT_H_ */
diff --git a/rpp-test-sw/commands/cmd_lin.c b/rpp-test-sw/commands/cmd_lin.c
deleted file mode 100644 (file)
index 602ad75..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.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_lin.c
- *
- * Abstract:
- *      This file contains commands for LIN control.
- *
- */
-
-
-#include "cmd_lin.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "sys/sys.h"
-#include "hal/hal.h"
-
-/** Semaphore used to stop command, until message is received */
-extern xSemaphoreHandle linMsgReceived;
-/** Semaphore used to stop command, until ID is received */
-extern xSemaphoreHandle linIDReceived;
-
-/**    @brief Command for testing LIN loopback
- *
- * @param[in]  cmd_io  Pointer to IO functions
- * @param[in]  cmd_des Pointer to command descriptor
- * @param[in]  param   Pointer to an array of parameters
- *
- * @return
- */
-int cmd_do_lin_loop_back(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       uint8_t txData[8] = {'L', 'I', 'N', ' ', 'T', 'E', 'S', 'T'};
-       uint8_t rxData[8];
-       uint8_t txID = 0xAC;
-       uint8_t rxID = 0;
-
-       linEnableLoopback(linREG, Digital);
-       hal_gpio_pin_set_value(PIN_DSC_LIN1NSLP, 1);
-       linIDReceived = xSemaphoreCreateCounting(1, 0);
-       linMsgReceived = xSemaphoreCreateCounting(1, 0);
-
-       linSetLength(linREG, 8);
-       linSendHeader(linREG, txID);
-       while (!linIsTxReady(linREG)) ;
-       xSemaphoreTake(linIDReceived, portMAX_DELAY);
-       rxID = linGetIdentifier(linREG);
-       if (rxID == txID) {
-               linSend(linREG, txData);
-               while (!linIsTxReady(linREG)) ;
-               xSemaphoreTake(linMsgReceived, portMAX_DELAY);
-               linGetData(linREG, rxData);
-               uint8_t errCnt = 0;
-               uint8_t i;
-               for (i = 0; i < 8; i++) {
-                       if (txData[i] != rxData[i]) errCnt++;
-               }
-
-               if (!errCnt)
-                       rpp_sci_printf("OK");
-               else
-                       rpp_sci_printf("Transmission errors: %d\r\n", errCnt);
-       }
-       else
-               rpp_sci_printf("FAILED: Sent and Received ID does not match.");
-       vSemaphoreDelete(linIDReceived);
-       vSemaphoreDelete(linMsgReceived);
-       hal_gpio_pin_set_value(PIN_DSC_LIN1NSLP, 0);
-       return 0;
-}
-
-#endif  /* DOCGEN */
-
-/** Descriptor of command for lin loopback test */
-cmd_des_t const cmd_des_lin_loop_back = {
-       0, 0,
-       "lintest","Test the digital loopback on LIN",
-       "### Command syntax ###\n"
-       "\n"
-       "    lintest\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command can be used for testing the LIN. The command starts to\n"
-       "send a short message on the LIN port and is testing if it is correctly\n"
-       "received via an internal loopback.\n",
-       CMD_HANDLER(cmd_do_lin_loop_back), (void *)&cmd_list_lin
-};
-
-/** List of commands for lin, defined as external */
-cmd_des_t const *cmd_list_lin[] = {
-       &cmd_des_lin_loop_back,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_lin.h b/rpp-test-sw/commands/cmd_lin.h
deleted file mode 100644 (file)
index 085f0d9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * cmd_lin.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_LIN_H_
-#define CMD_LIN_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_lin[];
-
-#endif /* CMD_LIN_H_ */
diff --git a/rpp-test-sw/commands/cmd_lout.c b/rpp-test-sw/commands/cmd_lout.c
deleted file mode 100644 (file)
index 6922fea..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.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_lout.c
- *
- * Abstract:
- *      This file contains commands for testing LOUT (8x100mA Digital output).
- *
- */
-
-
-#include "cmd_lout.h"
-#include "stdio.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "cmdproc_utils.h"
-#include "drv/drv.h"
-
-/**
- * @brief Set digital value to LOUT pin
- *
- * @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 lower than 0
- */
-int cmd_do_lout_set(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-       int val;
-       int ret;
-
-       if (sscanf(p, "%d %d %1s", &pin, &val, &spareParams) != 2)
-               return -CMDERR_BADPAR;
-       ret = rpp_lout_set(pin, val);
-       if (ret == -1) {
-               rpp_sci_printf("Pin out of range.");
-               return -CMDERR_BADPAR;
-       }
-
-       if (rpp_lout_update() == FAILURE) {
-               rpp_sci_printf("LOUT update failed.");
-               return -CMDERR_EIO;
-       }
-
-       return cmd_opchar_replong(cmd_io, param, val, 0, 10);
-}
-
-/**
- * @brief Read digital diagnostic value from LOUT DIAG pin
- *
- * @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 lower than 0
- */
-int cmd_do_lout_diag(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int pin;
-       char *p = param[1];
-       char spareParams;
-       int ret;
-
-       if (sscanf(p, "%d %1s", &pin, &spareParams) != 1)
-               return -CMDERR_BADPAR;
-
-       if (rpp_lout_update() == FAILURE) {
-               rpp_sci_printf("LOUT update failed.");
-               return -CMDERR_EIO;
-       }
-
-       ret = rpp_lout_diag(pin);
-       if (ret == -1) {
-               rpp_sci_printf("Pin out of range.");
-               return -CMDERR_BADPAR;
-       }
-
-       rpp_sci_printf("loutdiag%d=%d\n", pin, ret, ret);
-       return 0;
-}
-
-#endif  /* DOCGEN */
-
-/** Command descriptor for lout set port value */
-cmd_des_t const cmd_des_lout_set = {
-       0, 0,
-       "loutset*","Set a value of the LOUT pin",
-       "### Command syntax ###\n"
-       "\n"
-       "    loutset<PIN> <VALUE>\n"
-       "where\n"
-       "\n"
-       "- `<PIN>` is a number in range 1-8\n"
-       "- `<VALUE>` is a binary value to be set (0 or 1)\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command sets the digital value on the LOUT pin.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> loutset1 1\n"
-       "\n"
-       "Sets LOUT1 to 1.\n"
-       "\n"
-       "    --> loutset2 0\n"
-       "\n"
-       "Sets LOUT2 to 0.\n",
-       CMD_HANDLER(cmd_do_lout_set), (void *)&cmd_list_lout
-};
-
-/** Command descriptor for lout get pin diag value */
-cmd_des_t const cmd_des_lout_diag = {
-       0, 0,
-       "loutdiag*","Read a diagnostic value from an LOUT pin",
-       "### Command syntax ###\n"
-       "\n"
-       "    loutdiag<PIN>\n"
-       "\n"
-       "where `<PIN>` is a number in range 1-8\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command reads a logical value of the LOUT diagnostic signal.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> loutdiag1\n"
-       "\n"
-       "Reads value of the LOUT1 diagnostic signal.\n",
-       CMD_HANDLER(cmd_do_lout_diag), (void *)&cmd_list_lout
-};
-
-
-/** List of commands for hout, defined as external */
-cmd_des_t const *cmd_list_lout[] = {
-       &cmd_des_lout_set,
-       &cmd_des_lout_diag,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_lout.h b/rpp-test-sw/commands/cmd_lout.h
deleted file mode 100644 (file)
index e60823b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_lout.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_LOUT_H_
-#define CMD_LOUT_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_lout[];
-
-
-#endif /* CMD_LOUT_H_ */
diff --git a/rpp-test-sw/commands/cmd_motor_example.c b/rpp-test-sw/commands/cmd_motor_example.c
deleted file mode 100644 (file)
index 475734f..0000000
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 16.5.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_pin.c
- *
- * Abstract:
- *             Example commands for motor controlling over FlexRay. The first board has connected a control panel
- *      with two buttons and variable resistor, the second board has a DC motor connected to the H-bridge.
- *      Both boards are connected by the FlexRay bus and user can drive the motor by the control panel
- *      (speed, direction and enabling).
- */
-
-#include "cmd_motor_example.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "hal/hal.h"
-#include "drv/drv.h"
-#include "cmdproc.h"
-
-#define ADC_MAX_VALUE 0x0983
-#define RX_ERROR_MAX 100
-#define ENABLE_DEBOUNCE_TIME    2
-#define DIRECTION_DEBOUNCE_TIME 2
-
-/**
- * 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 = 0x2,
-       .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 for
- * the control panel reading and sending the data.
- */
-static Fr_TMS570LS_NodeConfigType Fr_node_control_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 for
- * the motor driving. This node receives control data from the FlexRay
- * and configures the H-bridge.
- */
-static Fr_TMS570LS_NodeConfigType Fr_node_motor_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
-};
-
-/**
- * Message RAM configuration for the node reading the control panel.
- */
-static Fr_TMS570LS_MsgRAMConfig Fr_node_control_msgRAM_config = {
-       .dynSegmentBufferCount = 0,
-       .fifoBufferCount = 0,
-       .secureBuffers = FR_SB_ALL_REC_DISABLED,
-       .statSegmentBufferCount = 2,
-       .syncFramePayloadMultiplexEnabled = 0
-};
-
-/**
- * Message RAM configuration for the node receiving the control data and driving the H=bridge.
- */
-static Fr_TMS570LS_MsgRAMConfig Fr_node_motor_msgRAM_config = {
-       .dynSegmentBufferCount = 0,
-       .fifoBufferCount = 0,
-       .secureBuffers = FR_SB_ALL_REC_DISABLED,
-       .statSegmentBufferCount = 2,
-       .syncFramePayloadMultiplexEnabled = 0
-};
-
-/**
- * Static buffers configuration for the node reading the control panel.
- * The node is configured as coldstarter and sync node. This is why the first buffer
- * is configured as TX.
- * The second buffer is configured as TX in single-shot mode. The buffer is used to
- * transfer the control data.
- */
-static Fr_TMS570LS_BufferConfigType Fr_node_control_static_buffers_config[] = {
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = TRUE,
-               .maxPayload = 2,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = FALSE,
-               .slotId = 1
-       },
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = TRUE,
-               .maxPayload = 2,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = FALSE,
-               .slotId = 3
-       }
-};
-
-/**
- * Static buffers configuration for the node driving the motor.
- * The node is configured as coldstarter and sync node. This is why the first buffer
- * is configured as TX.
- * The second buffer is configured as RX and is receiving the control data.
- */
-static Fr_TMS570LS_BufferConfigType Fr_node_motor_static_buffers_config[] = {
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = TRUE,
-               .maxPayload = 2,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = FALSE,
-               .slotId = 2
-       },
-       {
-               .channel = FR_CHANNEL_AB,
-               .cycleCounterFiltering = 0,
-               .isTx = FALSE,
-               .maxPayload = 2,
-               .msgBufferInterrupt = TRUE,
-               .payloadPreambleIndicatorTr = FALSE,
-               .rejectNullFrames = FALSE,
-               .rejectStaticSegment = FALSE,
-               .singleTransmit = FALSE,
-               .slotId = 3
-       }
-};
-
-/**
- * Unifying configuration structure for the node reading the control panel.
- */
-static Fr_ConfigType Fr_config_node_control = {
-       .clusterConfiguration = &Fr_cluster_config,
-       .dynamicBufferConfigs = NULL,
-       .fifoBufferConfigs = NULL,
-       .msgRAMConfig = &Fr_node_control_msgRAM_config,
-       .nodeConfiguration = &Fr_node_control_config,
-       .staticBufferConfigs = Fr_node_control_static_buffers_config
-};
-
-/**
- * Unifying configuration structure for the node driving the motor.
- */
-static Fr_ConfigType Fr_config_node_motor = {
-       .clusterConfiguration = &Fr_cluster_config,
-       .dynamicBufferConfigs = NULL,
-       .fifoBufferConfigs = NULL,
-       .msgRAMConfig = &Fr_node_motor_msgRAM_config,
-       .nodeConfiguration = &Fr_node_motor_config,
-       .staticBufferConfigs = Fr_node_motor_static_buffers_config
-};
-
-/**
- *  Loads data into TX buffers for FlexRay node sending the control data.
- *
- *  After data are copied into TX buffer, the TX request is enabled, which
- *  means that message will be transmitted as soon as the frame occures in the
- *  communication cycle.
- *
- *  @param     enable  enable flag to be send
- *  @param  direction  direction flag to be send
- *  @param     duty    duty cycle value to be send
- *
- *  @return SUCCESS when data were succesfully sent
- *          FAILURE when some error occured.
- */
-int8_t transmit_control_data(int enable, int direction, int duty)
-{
-       uint8_t data[3];
-
-       // Write payload for buffer associated with frame 1
-       data[0] = duty;
-       data[1] = direction;
-       data[2] = enable;
-       return rpp_fr_transmit_lpdu(0, 3, data, 3);
-}
-
-/**
- *     Checks if some message was received on message buffer 2 of the FlexRay motor controller node.
- *
- *     If new message was received, the function copies the data from the buffer.
- *
- *     @param enable   pointer to variable, where received enable flag will be stored
- *     @param direction pointer to variable, where received direction flag will be stored
- *     @param duty     pointer to variable, where received duty cycle value will be stored
- *     @return 0 if message was received and is correct
- *                     1 if message no message was received
- *                     2 if receiving failed
- */
-int receive_control_data(int *enable, int *direction, int *duty)
-{
-       uint8_t data[3];
-       Fr_RxLPduStatusType status;
-       uint8_t size;
-
-       if (rpp_fr_receive_lpdu(0, 3, data, &status, &size) == FAILURE)
-               return 2;
-       if (status == FR_NOT_RECEIVED)
-               return 1;
-       else {
-               *duty = data[0];
-               *direction = data[1];
-               *enable = data[2];
-               return 0;
-       }
-}
-
-/**
- * @brief      Read data from control panel and send them to motor controller through FlexRay
- *
- * This node reads periodically each 10ms the ADC1 channel and computes
- * the duty cycle. Then reads DIN0, which is connected to the red
- * button on the control panel (connected as switch to battery) and then
- * it reads the DIN1, which is connected to the black button (connected as
- * switch to ground).
- * Finally all data are sent on the Frame 3.
- *
- *
- * @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_control(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       port_desc_t *adc_desc;
-       uint32_t adc_values[PORT_ADC_CHANNEL_NUM*2];
-       int ret;
-       int duty = 0;
-       int button = 0;
-       int enable = 0;
-       int direction = 1;
-       int enable_cnt = 0;         // Debounce counter for enable button
-       int dir_cnt = 0;            // Debounce counter for direction button
-       uint32_t error;
-
-       adc_desc = hal_port_get_dsc(PORT_NAME_ADC, -1);
-
-       if (rpp_din_setup(0, FALSE, TRUE, FALSE) == FAILURE) {  // For the red button, which is switch to battery
-               rpp_sci_printf("Din 0 setup failed.\n");
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_din_setup(1, FALSE, TRUE, FALSE) == FAILURE) {  // For the black button, which is switch to ground
-               rpp_sci_printf("Din 1 setup failed.\n");
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_din_update() == FAILURE) {
-               rpp_sci_printf("Din update failed.\n");
-               return -CMDERR_BADCFG;
-       }
-
-       if (rpp_fr_init_driver(&Fr_config_node_control, &error) == FAILURE) {
-               rpp_sci_printf("Fray driver initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_init_controller(0, &error) == FAILURE) {
-               rpp_sci_printf("Fray control node initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       rpp_sci_printf("Fray control node initialized.\r\n");
-       rpp_sci_printf("Waiting for network connection...\r\n");
-
-       if (rpp_fr_start_communication(0, &error) == FAILURE) {
-               rpp_sci_printf("Integration to the network failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_all_slots(0) == FAILURE) {
-               rpp_sci_printf("All slots mode selection failed.\n");
-               return -CMDERR_BADCFG;
-       }
-
-       rpp_sci_printf("Connected.\r\n");
-
-       while (1) {
-               vTaskDelay(10/portTICK_RATE_MS);
-               ret = adc_desc->port_getfnc_ptr(adc_desc->config, PORT_ADC_CHANNEL_NUM, adc_values);
-               if (ret < 0) {
-                       rpp_sci_printf("ADC read failed!\n");
-                       break;
-               }
-               duty = (100*adc_values[0])/ADC_MAX_VALUE;
-               if (rpp_din_update() == FAILURE) {
-                       rpp_sci_printf("Din update failed.\n");
-                       break;
-               }
-               button = !rpp_din_get(0);
-               if (button == 1) {
-                       if (enable_cnt++ == ENABLE_DEBOUNCE_TIME)
-                               enable = !enable;
-                       else
-                               enable_cnt++;
-               }
-               else
-                       enable_cnt = 0;
-               button = rpp_din_get(1);
-               if (button == 1) {
-                       if (dir_cnt++ == DIRECTION_DEBOUNCE_TIME)
-                               direction = !direction;
-                       else
-                               dir_cnt++;
-               }
-               else
-                       dir_cnt = 0;
-
-               if (transmit_control_data(enable, direction, duty) == FAILURE) {
-                       rpp_sci_printf("Data transmission failed!\n");
-                       break;
-               }
-               rpp_sci_printf("Enable: %d, Direction: %s, Duty: %d%%\r", enable, (direction == 1) ? "L" : "R", duty);
-       }
-
-       if (rpp_fr_halt_communication(0) == FAILURE)
-               rpp_sci_printf("FlexRay HALT command failed, please reset the board to stop transmission.\n");
-       else
-               rpp_sci_printf("FlexRay halted, reset the board to make FlexRay usable again.\r\n");
-       return 0;
-}
-
-/**
- * @brief      Receive data from FlexRay and control motor on HBR
- *
- * This FlexRay node receives the control data from the FlexRay network
- * and configures the H-bridge to drive the DC motor according the
- * parameters from the received message.
- *
- * @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_motor(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       double hbr_period = 50; // us
-       double control = 0.0;
-       int hbr_duty = 0;
-       int direction = 1;
-       int enable = 0;
-       uint32_t rx_error = 0;
-       int ret;
-       uint32_t error;
-
-       if (rpp_hbr_enable(hbr_period) == FAILURE ||
-               rpp_hbr_control(0) == FAILURE
-               ) {
-               rpp_sci_printf("H-bridge initialization failed.\n");
-               return -CMDERR_BADCFG;
-       }
-
-       if (rpp_fr_init_driver(&Fr_config_node_motor, &error) == FAILURE) {
-               rpp_sci_printf("Fray driver initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_init_controller(0, &error) == FAILURE) {
-               rpp_sci_printf("Fray motor node initialization failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       rpp_sci_printf("Fray motor node initialized.\r\n");
-       rpp_sci_printf("Waiting for network connection...\r\n");
-
-       if (rpp_fr_start_communication(0, &error) == FAILURE) {
-               rpp_sci_printf("Integration to the network failed: %#x.\n", error);
-               return -CMDERR_BADCFG;
-       }
-       if (rpp_fr_all_slots(0) == FAILURE) {
-               rpp_sci_printf("All slots mode selection failed.\n");
-               return -CMDERR_BADCFG;
-       }
-
-       rpp_sci_printf("Connected.\r\n");
-
-       while (1) {
-               ret = receive_control_data(&enable, &direction, &hbr_duty);
-               if (ret == 2) { // receiving failed
-                       rx_error++;
-                       if (rx_error > RX_ERROR_MAX) {
-                               rpp_sci_printf("Maximum RX errors reached!\n");
-                               break;
-                       }
-               }
-               else if (ret == 0) {    // message received
-                       control = hbr_duty/((double)100) * ((direction == 1) ? -1 : 1) * enable;
-                       rpp_sci_printf("Enable: %d, Direction: %s, Duty: %d%%\r", enable, (direction == 1) ? "L" : "R", hbr_duty);
-                       if (rpp_hbr_control(control) == FAILURE) {
-                               rpp_sci_printf("H-bridge control failed!\n");
-                               break;
-                       }
-               }
-       }
-       if (rpp_hbr_disable() == FAILURE)
-               rpp_sci_printf("H-bridge disabling failed!\n");
-       else
-               rpp_sci_printf("H-bridge disabled.\n");
-       if (rpp_fr_halt_communication(0) == FAILURE)
-               rpp_sci_printf("FlexRay HALT command failed, please reset the board to stop transmission.\n");
-       else
-               rpp_sci_printf("FlexRay halted, reset the board to make FlexRay usable again.\r\n");
-       return 0;
-}
-
-#endif  /* DOCGEN */
-
-/** Command descriptor for control */
-cmd_des_t const cmd_des_control = {
-       0, 0,
-       "demomotctrl","Run motor control demo - reads input and sends it",
-       "### Command syntax ###\n"
-       "\n"
-       "    demomotctrl\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command creates a FlexRay node and starts to read buttons\n"
-       "(connected to DIN0 and DIN1) and a potentiometer (ADC1) from a control\n"
-       "panel. The read data are sent via FlexRay to the second node, created\n"
-       "by running demomotdrive command.\n"
-       "\n"
-       "The purpose of this pair of commands is to demonstrate functionality\n"
-       "of the FlexRay, ADC, DIN and HBR peripherals.\n",
-       CMD_HANDLER(cmd_do_control), (void *)&cmd_list_motor_example
-};
-
-/** Command descriptor for motor */
-cmd_des_t const cmd_des_motor = {
-       0, 0,
-       "demomotdrive","Run motor control demo - drives the DC motor",
-       "### Command syntax ###\n"
-       "\n"
-       "    demomotdrive\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command creates a FlexRay node and starts to receive the data\n"
-       "from another node created by command demomotctrl. The received data\n"
-       "are applied to HBR to control the DC motor.\n"
-       "\n"
-       "The purpose of this pair of commands is to demonstrate functionality\n"
-       "of the FlexRay, ADC, DIN and HBR peripherals.\n",
-       CMD_HANDLER(cmd_do_motor), (void *)&cmd_list_motor_example
-};
-
-/** List of commands for example, defined as external */
-cmd_des_t const *cmd_list_motor_example[] = {
-       &cmd_des_control,
-       &cmd_des_motor,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_motor_example.h b/rpp-test-sw/commands/cmd_motor_example.h
deleted file mode 100644 (file)
index fd2248a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_motor_example.h
- *
- *  Created on: 16.5.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_MOTOR_EXAMPLE_H_
-#define CMD_MOTOR_EXAMPLE_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_motor_example[];
-
-
-#endif /* CMD_MOTOR_EXAMPLE_H_ */
diff --git a/rpp-test-sw/commands/cmd_nc.c b/rpp-test-sw/commands/cmd_nc.c
deleted file mode 100644 (file)
index 3ecaffd..0000000
+++ /dev/null
@@ -1,1010 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: Aug 9, 2013
- *
- * Authors:
- *     - Jan DoleĹľal
- *
- * 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_lwip.c
- *
- * Abstract:
- *      This file contains commands for LwIP test
- *
- */
-
-#include "cmd_nc.h"
-
-#ifndef DOCGEN
-
-#include <string.h>
-#include <ctype.h>
-
-#include "rpp/rpp.h"
-#include "lwip/udp.h"
-#if !NO_SYS
-#include "lwip/api.h" //netconn
-#else
-#include "lwip/timers.h" //for updating timers, when NO_SYS == 1
-#include "lwip/tcp.h"
-#include "lwip/tcp_impl.h"
-#endif
-
-#define INTERFACE_INSTANCE_NUMBER 0
-
-#define BUF_SIZE 80
-/* only for use in interactive mode (not thread) */
-char in_buffer[BUF_SIZE];
-uint8_t buff_index = 0;
-
-/* when -p option not given, srcPort is used; when nc run repeatedly,
- * even though netconn was removed, netconn_new() with previously used port
- * might still cause errors like address in use, therefore in srcPort
- * there next port NO prepared to be used */
-uint16_t srcPort = 1025; /* initial value */
-
-#if !NO_SYS
-uint8_t tasks_running = 0, taskNameNum = 0;
-boolean_t closeths; /* variable controling threads closing */
-
-/* argument storing parameters from command line, if started as thread, they are coppied to stack of thread and cmd_do_init_nc() is acknowledged by semaphore */
-struct nc_arg {
-       uint16_t portNO, srcPortNO;
-       ip_addr_t remoteIP;
-       xSemaphoreHandle args_coppied;
-       boolean_t thread; /* variable controling whether this instance should run as thread */
-       boolean_t udp, listen, netLoop, test, srcPortSpec;
-       err_t err;
-};
-
-
-/* nc task */
-void run_nc(void *arg)
-{
-       err_t err = ERR_OK;
-       uint8_t input = 0;
-       uint8_t tries;
-       uint32_t index;
-       uint8_t *payload;
-       struct netconn *netconn, *newconn;
-
-       newconn = NULL;
-       struct netbuf *remoteData = NULL, *localData = NULL;
-       struct pbuf *p;
-       boolean_t ncStop = FALSE;
-       boolean_t flush = FALSE;
-       struct nc_arg *nc_arg = (struct nc_arg *)arg;
-       struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
-
-       /* fill options from argument */
-       uint16_t portNO = nc_arg->portNO, srcPortNO = nc_arg->srcPortNO;
-       ip_addr_t remoteIP = nc_arg->remoteIP;
-       boolean_t udp = nc_arg->udp, listen = nc_arg->listen, srcPortSpec = nc_arg->srcPortSpec, netLoop = nc_arg->netLoop, test = nc_arg->test;
-       boolean_t thread = nc_arg->thread; /* variable controling whether this instance should run as thread */
-#if DEBUG
-       uint8_t thread_inst = (taskNameNum-1); /* store number of this thread */
-#endif
-       tasks_running++;
-
-
-       /* switch off closing of tasks/threads */
-       closeths = FALSE;
-
-
-       /*** make connection ***/
-       while (!closeths) { /* shouldn't get here twice, used only for break which leads us down to unalocating of sources */
-               /* let nc initiator go */
-               if (thread && /* just in case --> */ nc_arg->args_coppied != NULL && xSemaphoreGive(nc_arg->args_coppied) != pdTRUE) break;
-               /* fill netconn struct */
-               netconn = netconn_new(udp ? NETCONN_UDP : NETCONN_TCP);
-               if (netconn == NULL) {
-                       err = ERR_NETCONN_NEW;
-                       break;
-               }
-
-               tries = 15; /* how many local ports to try */
-               /* bind filled netconn with local interface address and source port number */
-               while ( tries-- && (err = netconn_bind(netconn, &(netif->ip_addr), srcPortNO) ) == ERR_USE && !closeths) {
-                       if (srcPortSpec) break;  /* if port was explicitly specified (we shouldn't change user's port number just like that ;) ) */
-                       srcPort++;
-                       srcPortNO = srcPort;
-               }
-               if (err != ERR_OK || !tries) {
-                       newconn = netconn; /* deleting newconn is done anyway, so delete netconn this way */
-                       err = ERR_BINDING;
-                       break;
-               }
-
-               /* adjust recvtimeout time and tries to different values, if user shouldn't loose control over cmd processor at any time */
-               netconn_set_recvtimeout(netconn, CONNECTING_TIMEO);
-               tries = CONNECTING_TRIES;
-
-               if (listen) { /* -l <PORT> option */
-                       if (!udp) { /* TCP - make connection */
-                               /* make listening netconn */
-                               netconn_listen(netconn);
-                               /* accept connection to newconn */
-                               while ( tries-- && (err = netconn_accept(netconn, &newconn)) == ERR_TIMEOUT && (thread || rpp_sci_read_nb(1, &input) != SUCCESS)) ;
-                               if (err != ERR_OK) {
-                                       newconn = netconn;
-                                       err = ERR_CONN_ACCEPT;
-                                       break;
-                               }
-                               else
-                                       netconn_delete(netconn);  /* we don't need listening netconn anymore */
-                       }
-                       else
-                       {
-                               while (tries-- && !closeths) {
-                                       /* allow user to interrupt waiting for "udp connection" - in case this is not thread */
-                                       if (!thread && (rpp_sci_read_nb(1, &input) == SUCCESS)) {
-                                               newconn = netconn; /* deleting newconn is done anyway, so delete netconn this way */
-                                               err = ERR_CONNECTING;
-                                               break;
-                                       }
-
-                                       if ((err = netconn_recv(netconn, &remoteData)) == ERR_OK) { /* wait for data, from which we will determine our peer address and portNO */
-                                               remoteIP = remoteData->addr;
-                                               portNO = remoteData->port;
-                                               if (test) netbuf_delete(remoteData);
-                                               break;
-                                       }
-                                       else
-                                       {
-                                               if (err == ERR_TIMEOUT) continue;
-                                               else
-                                               {
-                                                       newconn = netconn;
-                                                       break;
-                                               }
-                                       }
-                               }
-                               if (!tries) {
-                                       newconn = netconn;
-                                       err = ERR_CONNECTING;
-                                       break;
-                               }
-                       }
-               }
-
-               if (!listen || (listen && udp) ) { /* connect to remote node */
-                       newconn = netconn;
-                       netconn = NULL;
-                       if ( ( err = netconn_connect(newconn, &remoteIP, portNO) ) != ERR_OK )
-                               break;
-               }
-
-               /* we will block for time specified on next line on netconn to receive data, if it does not come, we block for user sci input */
-               netconn_set_recvtimeout(newconn, 50);
-
-               if (udp && (localData = netbuf_new()) == NULL) {
-                       err = ERR_MEM;
-                       break;
-               }
-
-               if (test) { /* -d option; sends packets to the opposite node and doesn't receive anything */
-                       index = 0;
-                       char strbuf[13];
-                       int strlen;
-                       //netconn_set_recvtimeout(newconn, 1);
-                       while (!closeths && index++ < 4294967295) {
-                               /* destroy all incomming data to prevent pbufs from running out */
-                               /*while(remoteData != NULL ||  (err = netconn_recv ( newconn, &remoteData )) != ERR_TIMEOUT){
-                                   netbuf_delete(remoteData);
-                                   remoteData = NULL;
-                                  }*/
-                               /* allow user to interrupt sending */
-                               if (!thread && (rpp_sci_read_nb(1, &input) == SUCCESS)) break;
-                               strlen = sprintf(strbuf,"%d\r\n",index);
-                               if (!udp) {
-                                       if ((err = netconn_write(newconn, strbuf, strlen, NETCONN_COPY)) != ERR_OK) break;
-                               }
-                               else
-                               {
-                                       payload = netbuf_alloc(localData,strlen);
-                                       if (payload != NULL) {
-                                               netbuf_take(localData,strbuf,strlen);
-                                               netbuf_len(localData) = strlen;
-                                               if ((err = netconn_send(newconn, localData)) != ERR_OK) break;
-                                       }
-                                       else
-                                       {
-                                               err = ERR_MEM;
-                                               break;
-                                       }
-                               }
-                       }
-                       break;
-               }
-
-               if (netLoop) { /* -m option */
-                       err = ERR_OK;
-                       /* send some data to opposite node so it knows its peer (this node) ; ATENTION if opposite node was not running in time this is send, then it wont get known this node's connection info */
-                       if (udp && !listen) {
-                               payload = netbuf_alloc(localData,1);
-                               if (payload != NULL) {
-                                       input = 0;
-                                       netbuf_take(localData,&input,1);
-                                       netbuf_len(localData) = 1;
-                                       if ((err = netconn_send(newconn, localData)) != ERR_OK) break;
-                               }
-                               else
-                               {
-                                       err = ERR_MEM;
-                                       break;
-                               }
-                       }
-                       while (!closeths) {
-                               if (!thread && (rpp_sci_read_nb(1, &input) == SUCCESS)) break;  /* allow user to interrupt operation */
-                               if ( remoteData != NULL ||  (err = netconn_recv( newconn, &remoteData )) != ERR_TIMEOUT ) {
-                                       if (err == ERR_OK) {
-                                               p = remoteData->p;
-                                               /**/
-                                               while (p->ref > 1) /* if (p->ref > 1) p->ref = 1; */
-                                                       pbuf_free(p);
-                                               /**/
-                                               while (p != NULL) {
-                                                       if (!udp)
-                                                               netconn_write(newconn, p->payload, p->len, NETCONN_COPY);  /*NETCONN_DONTBLOCK*/
-                                                       else
-                                                       {
-                                                               payload = netbuf_alloc(localData,p->len);
-                                                               if (payload != NULL) {
-                                                                       netbuf_take(localData,p->payload,p->len);
-                                                                       netbuf_len(localData) = p->len;
-                                                                       if ((err = netconn_send(newconn, localData)) != ERR_OK) break;
-                                                               }
-                                                               else
-                                                               {
-                                                                       err = ERR_MEM;
-                                                                       break;
-                                                               }
-                                                       }
-                                                       p = p->next;
-                                               }
-                                               netbuf_delete(remoteData);
-                                               remoteData = NULL;
-                                       }
-                                       else
-                                               break;
-                               }
-                       }
-                       if (err == ERR_TIMEOUT) err = ERR_OK;  /* timeout is not error here, this occurs on interrupt of while cycle */
-                       break;
-               }
-
-               /* only active user can control this section XXX: maybe should move to init startup condition handler */
-               if (thread) break;
-
-               /* INTERACTIVE PART */
-
-               /* receive remote data and print them to sci, receive sci data and write them to netconn */
-               while (!ncStop) {
-                       if (rpp_sci_read_nb(1, &input) != SUCCESS) {
-                               if ( remoteData != NULL || (err = netconn_recv( newconn, &remoteData )) != ERR_TIMEOUT) {
-                                       if (err == ERR_OK) {
-                                               /* print remote data to SCI */
-                                               p = remoteData->p;
-                                               while (p != NULL) {
-                                                       index = 0;
-                                                       payload = p->payload;
-                                                       while (index < p->len) {
-                                                               rpp_sci_printf("%c",payload[index]);
-                                                               index++;
-                                                       }
-                                                       p = p->next;
-                                               }
-                                               netbuf_delete(remoteData);
-                                               remoteData = NULL;
-                                       }
-                                       else
-                                               break;  /* receive error - e.g. newconn was closed */
-                               }
-                               if (err == ERR_TIMEOUT) err = ERR_OK;
-                               continue;
-                       }
-
-                       // Backspace and Delete
-                       if (input == 8 || input == 127) {
-                               if (buff_index > 0) {
-                                       buff_index--;
-                                       rpp_sci_putc('\b');
-                                       rpp_sci_putc(' ' );
-                                       rpp_sci_putc('\b');
-                               }
-
-                               // Line feed or Carriage return
-                       }
-                       else if (input == 10 || input == 13) {
-                               in_buffer[buff_index] = 13;
-                               buff_index++;
-                               in_buffer[buff_index] = 10;
-                               buff_index++;
-                               flush = TRUE;
-                               rpp_sci_putc('\r');
-                               rpp_sci_putc('\n');
-
-                               // If is any printable character
-                       }
-                       else if (isprint(input) || input == 9) {
-
-                               // Store character and increment buffer index
-                               in_buffer[buff_index] = input;
-                               buff_index++;
-                               rpp_sci_putc(input);
-
-                               // Check if buffer is full and force flush
-                               if (buff_index == BUF_SIZE - 3)
-                                       flush = TRUE;
-                               // All other character stops nc
-                       }
-                       else {
-                               ncStop = TRUE;
-                               flush = TRUE;
-                       }
-
-                       if (flush) {
-                               if (!udp)
-                                       netconn_write(newconn, in_buffer, buff_index, NETCONN_COPY);
-                               else
-                               {
-                                       payload = netbuf_alloc(localData,buff_index);
-                                       if (payload != NULL) {
-                                               netbuf_take(localData,in_buffer,buff_index);
-                                               netbuf_len(localData) = buff_index;
-                                               if ((err = netconn_send(newconn, localData)) != ERR_OK) break;
-                                       }
-                                       else
-                                       {
-                                               err = ERR_MEM;
-                                               break;
-                                       }
-                               }
-                               // Reset variables
-                               buff_index = 0;
-                               flush = FALSE;
-                       }
-               }
-               break;
-       }
-#ifdef DEBUG
-       if (thread) rpp_sci_printf("NC: THREAD NO.%d FINISHED\r\n", thread_inst);
-#endif
-       if (udp && localData != NULL) netbuf_delete(localData);
-       if (remoteData != NULL) netbuf_delete(remoteData);
-       if (newconn != NULL && !udp) netconn_close(newconn);
-       netconn_delete(newconn);
-       tasks_running--;
-       if (!thread)
-               nc_arg->err = err;  /* only user controlled task is in front */
-       if (thread) vTaskDelete(NULL);
-}
-#else /* if !NO_SYS */
-boolean_t connected;
-boolean_t sent;
-boolean_t ncStop;
-
-err_t nc_recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
-{
-       uint16_t index;
-       uint8_t *payload;
-
-       if (err == ERR_ABRT) {
-               rpp_sci_printk("recv abrt\n");
-               return ERR_ABRT;
-       }
-       /* print remote data to SCI */
-       while (p != NULL) {
-               index = 0;
-               payload = p->payload;
-               while (index < p->len) {
-                       rpp_sci_printk("%c",payload[index]);
-                       index++;
-               }
-               p = p->next;
-       }
-       return ERR_OK;
-}
-
-void nc_udp_recv_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
-{
-       uint16_t index;
-       uint8_t *payload;
-
-       /* print remote data to SCI */
-       while (p != NULL) {
-               index = 0;
-               payload = p->payload;
-               while (index < p->len) {
-                       rpp_sci_printk("%c",payload[index]);
-                       index++;
-               }
-               p = p->next;
-       }
-       //pbuf_free(p);
-}
-
-void nc_udp_listen_recv_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
-{
-       connected = TRUE;
-       err_t err = udp_connect(pcb, addr, port);
-       LWIP_ASSERT(("nc_init: udp_listen_connect failed"), err == ERR_OK);
-       udp_recv(pcb, nc_udp_recv_callback, NULL);
-       nc_udp_recv_callback(arg, pcb, p, addr, port);
-}
-
-void nc_err_callback(void *arg, err_t err)
-{
-       rpp_sci_printk("err clbck\n");
-       LWIP_DEBUGF(LWIP_DBG_ON, ("nc_err: %s", lwip_strerr(err)));
-
-       ncStop = TRUE;
-}
-
-err_t nc_sent_callback(void *arg, struct tcp_pcb *pcb, u16_t len)
-{
-       sent = TRUE;
-       return ERR_OK;
-}
-
-err_t nc_accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err)
-{
-       struct tcp_pcb **newone = arg;
-
-       *newone = newpcb; /* pass accepted connection to main app loop */
-
-       connected = TRUE;
-
-       /* Set up the various callback functions */
-       tcp_recv(newpcb, nc_recv_callback);
-       tcp_err(newpcb, nc_err_callback);
-       tcp_sent(newpcb, nc_sent_callback);
-
-       return ERR_OK;
-}
-
-err_t nc_connected_callback(void *arg, struct tcp_pcb *tpcb, err_t err)
-{
-
-       /* Set up the various callback functions */
-       tcp_recv(tpcb, nc_recv_callback);
-       tcp_err(tpcb, nc_err_callback);
-       tcp_sent(tpcb, nc_sent_callback);
-
-       connected = TRUE;
-       rpp_sci_printk("connected\n");
-       return ERR_OK;
-}
-
-err_t nc_tmirror_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
-{
-       if (err == ERR_ABRT) {
-               rpp_sci_printk("recv abrt\n");
-               return ERR_ABRT;
-       }
-       while (p != NULL) {
-               if (tcp_write(tpcb, p->payload, p->len, TCP_WRITE_FLAG_COPY) != ERR_OK) {
-                       rpp_sci_printk("error writing to newpcb - tcp_write\n");
-                       return -1;
-               }
-               if (tcp_output(tpcb) != ERR_OK) { /* when we want to send data immediately */
-                       rpp_sci_printk("newpcb output err - tcp\n");
-                       return -1;
-               }
-               p = p->next;
-       }
-       return ERR_OK;
-}
-
-void nc_umirror_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
-{
-       struct pbuf *pbuf;
-
-       while (p != NULL) {
-               pbuf = pbuf_alloc(PBUF_TRANSPORT, p->len, PBUF_RAM);
-               if (pbuf == NULL) {
-                       rpp_sci_printk("error allocating pbuf - udp_send\n");
-                       //p = p->next;
-                       continue;
-               }
-               if (pbuf_take(pbuf, p->payload, p->len) != ERR_OK) {
-                       rpp_sci_printk("pbuf mem err (small pbuf) - udp_send\n");
-                       continue;
-               }
-               if (udp_send(pcb, pbuf) != ERR_OK) {
-                       rpp_sci_printk("error sending to pcb - udp_send\n");
-                       continue;
-               }
-               p = p->next;
-       }
-}
-
-
-#endif /* !NO_SYS */
-
-/*
- * this function has two operational modes, depending on LwIP settings
- * NO_SYS == 1 - this is for testing raw API, there is only one task working with IP stack allowed when using this mode
- * NO_SYS == 0 - this is for testing netconn API, you can let more tasks to work with IP stack
- */
-int cmd_do_init_nc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       if (!isPostInitialized()) {
-               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
-               return FAILURE;
-       }
-       err_t err = ERR_OK;
-       uint16_t portNO, srcPortNO = 0;
-       ip_addr_t remoteIP;
-       boolean_t help = FALSE, udp = FALSE, listen = FALSE, netLoop = FALSE, test = FALSE, srcPortSpec = FALSE;
-       uint8_t pindex;
-
-       buff_index = 0;
-       /* initialize arguments and thread name */
-#if !NO_SYS
-       uint8_t name[5] = "nc";
-       name[4] = '\0';
-       struct nc_arg nc_arg; /* create space for handing args to nc_run() */
-       nc_arg.thread = FALSE;
-#else
-       uint8_t input = 0;
-       boolean_t flush = FALSE;
-       uint32_t index;
-       struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
-       struct tcp_pcb *tpcb, *tnewpcb;
-       struct udp_pcb *pcb;
-       struct pbuf *p; /* udp send */
-#endif
-
-       /* examine parameters */
-       for (pindex = 1; param[pindex] != 0; pindex++) {
-               if        (strncmp((char *)param[pindex], "-h", 3) == 0) {
-                       help = TRUE;
-                       break;
-               }
-               else if (strncmp((char *)param[pindex], "-u", 3) == 0) {
-                       udp = TRUE;
-#if !NO_SYS
-               }
-               else if (strncmp((char *)param[pindex], "-t", 3) == 0)
-                       nc_arg.thread = TRUE;
-               else if (strncmp((char *)param[pindex], "-c", 3) == 0) {
-                       closeths = TRUE;
-                       return ERR_OK;
-#endif
-               }
-               else if (strncmp((char *)param[pindex], "-l", 3) == 0 && !srcPortSpec) {
-                       listen = TRUE;
-                       srcPortNO = rpp_eth_portStrToInt((uint8_t *)param[++pindex]);
-                       if (srcPortNO == 0) {
-                               rpp_sci_printf("E wrong portNO, portNO must follow immediately after -l option\r\n");
-                               return BAD_PORT_NO;
-                       }
-                       srcPortSpec = TRUE;
-               }
-               else if (strncmp((char *)param[pindex], "-p", 3) == 0 && !srcPortSpec) {
-                       srcPortNO = rpp_eth_portStrToInt((uint8_t *)param[++pindex]);
-                       if (srcPortNO == 0) {
-                               rpp_sci_printf("E wrong portNO, portNO must follow immediately after -p option\r\n");
-                               return BAD_PORT_NO;
-                       }
-                       srcPortSpec = TRUE;
-               }
-               else if (strncmp((char *)param[pindex], "-m", 3) == 0)
-                       netLoop = TRUE;
-               else if (strncmp((char *)param[pindex], "-d", 3) == 0)
-                       test = TRUE;
-               else if ( (err = rpp_eth_stringToIP(&remoteIP, (uint8_t *)param[pindex])) == SUCCESS ) {
-                       portNO = rpp_eth_portStrToInt((uint8_t *)param[++pindex]);
-                       if (portNO == 0) {
-                               rpp_sci_printf("E wrong portNO, portNO must follow immediately after IP address\r\n");
-                               return BAD_PORT_NO;
-                       }
-               }
-               else {
-                       rpp_sci_printf("ERR: check option name, option combination, IP address format\r\n");
-                       help = TRUE;
-                       err = BAD_OPTION;
-                       break;
-               }
-       }
-
-       /* TODO: additional testing of parameters mutual exclusion */
-       /* valid combinations:
-          nc <addr> <port> [-p <port>] [-u] [-t]
-          nc -l <port> [-u] [-t]
-          nc <addr> <port> -m [-p <port>] [-u] [-t]
-          nc <addr> <port> -d [-p <port>] [-u] [-t]
-          nc -l <port> -m [-u] [-t]
-          nc -l <port> -d [-u] [-t]
-        */
-
-       /* usage of command */
-       if (help || !param[1]) {
-               rpp_sci_printf("-u udp, -t thread, -c close tasks, -l listen, -p source port, -m ping/mirror, -d test\r\n\n");
-               rpp_sci_printf("usage:\tnc -l <port> [-u] [-m [-t] | -d [-t]]\r\n\t\tlistens on port for connection\r\n");
-               rpp_sci_printf("\tnc <address> <port> [-p <port>] [-u] [-m [-t] | -d [-t]]\r\n\t\tconnects to the address on port NO.\r\n");
-               rpp_sci_printf("\tnc -c\r\n\t\tdeletes all running threads.\r\n");
-               rpp_sci_printf("opts:\t-t run as stand alone task\r\n\t-c close all stand alone tasks\r\n");
-               rpp_sci_printf("\t-l <port> listen on given port for incomming connection\r\n\t-p <port> use as local port when connecting to remote node\r\n\t");
-               rpp_sci_printf("\t-m send all incomming data back to sender\r\n\t-d sends many testing packets containing packet number in ASCII as data\r\n");
-               rpp_sci_printf("Note: when using udp -u and listening -l options, first node data was received from is considered as peer for communication.\r\n");
-               return err;
-       }
-
-       /* determine srcPortNO from predefined value if not done yet (from argument given) */
-       if (!srcPortSpec)
-               //udp_new_port();
-               srcPortNO = srcPort++;
-
-#if !NO_SYS /* netconn api */
-
-       /* prepare args */
-       nc_arg.srcPortNO = srcPortNO;
-       nc_arg.portNO = portNO;
-       nc_arg.remoteIP.addr = remoteIP.addr;
-       nc_arg.udp = udp;
-       nc_arg.listen = listen;
-       nc_arg.netLoop = netLoop;
-       nc_arg.test = test;
-       nc_arg.srcPortSpec = srcPortSpec;
-
-       if (nc_arg.thread) {
-               /* prepare semaphore */
-               vSemaphoreCreateBinary(nc_arg.args_coppied);
-               xSemaphoreTake(nc_arg.args_coppied, 0);
-               /* add number to task name */
-               taskNameNum = (taskNameNum%100);
-               name[2] = (taskNameNum/10) + '0';
-               name[3] = (taskNameNum%10) + '0';
-               rpp_sci_printf("STARTING THREAD: %s\r\n", name);
-               taskNameNum++;
-               /* start thread */
-               if ((err = xTaskCreate(&run_nc,(const signed char *)name, ncTaskStackSize, &nc_arg, ncTaskPriority, NULL)) == pdPASS) {
-                       /* block on semaphore, till new thread copies arg to own stack */
-                       xSemaphoreTake( nc_arg.args_coppied, portMAX_DELAY );
-                       vSemaphoreDelete(nc_arg.args_coppied);
-               }
-               else {
-                       vSemaphoreDelete(nc_arg.args_coppied);
-                       return err;
-               }
-       }
-       else
-       {
-               taskNameNum++;
-               run_nc(&nc_arg);
-               return nc_arg.err;
-       }
-#else /* raw LwIP API */
-       ncStop = FALSE;
-       connected = FALSE;
-       sent = TRUE;
-       if (udp) {
-               pcb = udp_new();
-               LWIP_ASSERT(("nc_init: udp_new failed"), pcb != NULL);
-               if (pcb == NULL) return -1;
-               err = udp_bind(pcb, &(netif->ip_addr), srcPortNO);
-               CC_ASSERT(("nc_init: udp_bind failed: %s", lwip_strerr(err)), err == ERR_OK);
-               if (err != ERR_OK) return -1;
-       }
-       else
-       {
-               tpcb = tcp_new();
-               LWIP_ASSERT(("nc_init: tcp_new failed"), tpcb != NULL);
-               if (tpcb == NULL) return -1;
-               err = tcp_bind(tpcb, &(netif->ip_addr), srcPortNO);
-               CC_ASSERT(("nc_init: tcp_bind failed: %s", lwip_strerr(err)), err == ERR_OK);
-               if (err != ERR_OK) return -1;
-       }
-
-       if (!udp) {
-               if (listen) {
-                       tpcb = tcp_listen(tpcb);
-                       LWIP_ASSERT(("nc_init: tcp_listen failed"), tpcb != NULL);
-                       /* initialize callback arg and accept callback */
-                       tcp_arg(tpcb, &tnewpcb);
-                       tcp_accept(tpcb, nc_accept_callback);
-               }
-               else
-               {
-                       tnewpcb = tpcb;
-                       tpcb = NULL;
-                       err = tcp_connect(tnewpcb, &remoteIP, portNO, nc_connected_callback);
-                       LWIP_ASSERT(("nc_init: tcp_connect failed"), err == ERR_OK);
-               }
-       }
-       else
-       {
-               if (listen)
-                       udp_recv(pcb, nc_udp_listen_recv_callback, NULL);
-               else
-               {
-                       err = udp_connect(pcb, &remoteIP, portNO);
-                       LWIP_ASSERT(("nc_init: udp_connect failed"), err == ERR_OK);
-                       //connected = TRUE;
-                       /* set udp recv callback */
-                       udp_recv(pcb, nc_udp_recv_callback, NULL);
-               }
-       }
-
-       /* wait for connection to be established */
-       if (listen || !udp) {
-               while (!connected) {
-                       if (rpp_sci_read_nb(1, &input) == SUCCESS) {
-                               ncStop = TRUE;
-                               break;
-                       }
-                       sys_check_timeouts();
-                       vTaskDelay(10); /* just because we have no other business here */
-               }
-               if (!udp && listen && tcp_close(tpcb) != ERR_OK) rpp_sci_printk("closing listening tcp pcb err\n");  /* close listening pcb */
-       }
-
-       /* mode handlers in loop, so we can jump out of it on error or finish and clean after us */
-       do {
-               /*************************************** 1 mirror mode *****************************************/
-
-               if (netLoop) { /* -m option */
-                       err = ERR_OK;
-                       /* send some data to opposite node so it knows its peer (this node) ; ATENTION if opposite node was not running in time this is send, then it wont get known this node's connection info */
-/*          if(udp && !listen){
-                payload = netbuf_alloc(localData,1);
-                if(payload != NULL){
-                    input = 0;
-                    netbuf_take(localData,&input,1);
-                    netbuf_len(localData) = 1;
-                    if((err = netconn_send(newconn, localData)) != ERR_OK)break;
-                }
-                else
-                {
-                    err = ERR_MEM;
-                    break;
-                }
-            }*/
-                       /* register callback function which sends all the recevd data back to remote host */
-                       if (!udp)
-                               tcp_recv(tnewpcb, nc_tmirror_callback);
-                       else
-                               udp_recv(pcb, nc_umirror_callback, NULL);
-
-                       while (rpp_sci_read_nb(1, &input) != SUCCESS) {
-                               sys_check_timeouts();
-                               vTaskDelay(10);
-                       }
-                       break;
-               }
-
-               /*************************************** 2 testing mode *****************************************/
-
-               if (test) { /* -d option; sends packets to the opposite node and doesn't receive anything */
-                       index = 0;
-                       char strbuf[13];
-                       int strlen;
-                       //netconn_set_recvtimeout(newconn, 1);
-                       while (index++ < 4294967295) {
-                               /* allow user to interrupt sending */
-                               if (rpp_sci_read_nb(1, &input) == SUCCESS) break;
-                               strlen = sprintf(strbuf,"%d\r\n",index);
-                               if (!udp) {
-                                       sys_check_timeouts();
-                                       if (tcp_write(tnewpcb, strbuf, strlen, TCP_WRITE_FLAG_COPY) != ERR_OK) {
-                                               rpp_sci_printf("error writing to newpcb - tcp_write testing\n");
-                                               break;
-                                       }
-                                       if (tcp_output(tnewpcb) != ERR_OK) { /* when we want to send data immediately */
-                                               rpp_sci_printf("newpcb output err - tcp testing\n");
-                                               break;
-                                       }
-                               }
-                               else
-                               {
-                                       p = pbuf_alloc(PBUF_TRANSPORT, strlen, PBUF_RAM);
-                                       if (p == NULL) {
-                                               rpp_sci_printf("error allocating pbuf - udp_send testing\n");
-                                               continue;
-                                       }
-                                       if (pbuf_take(p, strbuf, strlen) != ERR_OK) {
-                                               rpp_sci_printf("pbuf mem err (small pbuf) - udp_send testing\n");
-                                               continue;
-                                       }
-                                       if (udp_send(pcb, p) != ERR_OK) {
-                                               rpp_sci_printf("error sending to pcb - udp_send testing\n");
-                                               continue;
-                                       }
-                               }
-                       }
-                       break;
-               }
-
-               /*************************************** 3 interactive mode *****************************************/
-
-               while (!ncStop) {
-                       if (!udp && tnewpcb->state != ESTABLISHED) {
-                               ncStop = TRUE;
-                               break;
-                       }
-                       if (rpp_sci_read_nb(1, &input) != SUCCESS) {
-                               /* updating lwip timers here */
-                               sys_check_timeouts();
-                               continue;
-                       }
-
-                       // Backspace and Delete
-                       if (input == 8 || input == 127) {
-                               if (buff_index > 0) {
-                                       buff_index--;
-                                       rpp_sci_putc('\b');
-                                       rpp_sci_putc(' ' );
-                                       rpp_sci_putc('\b');
-                               }
-
-                               // Line feed or Carriage return
-                       }
-                       else if (input == 10 || input == 13) {
-                               in_buffer[buff_index] = 13;
-                               buff_index++;
-                               in_buffer[buff_index] = 10;
-                               buff_index++;
-                               flush = TRUE;
-                               rpp_sci_putc('\r');
-                               rpp_sci_putc('\n');
-
-                               // If is any printable character
-                       }
-                       else if (isprint(input) || input == 9) {
-
-                               // Store character and increment buffer index
-                               in_buffer[buff_index] = input;
-                               buff_index++;
-                               rpp_sci_putc(input);
-
-                               // Check if buffer is full and force flush
-                               if (buff_index == BUF_SIZE - 3)
-                                       flush = TRUE;
-                               // All other character stops nc
-                       }
-                       else {
-                               ncStop = TRUE;
-                               flush = TRUE;
-                       }
-
-                       if (flush) {
-                               while (!udp && !ncStop && !sent) {
-                                       sys_check_timeouts();
-                                       vTaskDelay(10);
-                               }
-                               if (ncStop) break;
-                               if (!udp) {
-                                       if (tcp_write(tnewpcb, in_buffer, buff_index, TCP_WRITE_FLAG_COPY) != ERR_OK) {
-                                               rpp_sci_printf("error writing to newpcb - tcp_write\n");
-                                               continue;
-                                       }
-                                       if (tcp_output(tnewpcb) != ERR_OK) { /* when we want to send data immediately */
-                                               rpp_sci_printf("newpcb output err - tcp\n");
-                                               continue;
-                                       }
-                               }
-                               else
-                               {
-                                       p = pbuf_alloc(PBUF_TRANSPORT, buff_index, PBUF_RAM);
-                                       if (p == NULL) {
-                                               rpp_sci_printf("error allocating pbuf - udp_send\n");
-                                               continue;
-                                       }
-                                       if (pbuf_take(p, in_buffer, buff_index) != ERR_OK) {
-                                               rpp_sci_printf("pbuf mem err (small pbuf) - udp_send\n");
-                                               continue;
-                                       }
-                                       if (udp_send(pcb, p) != ERR_OK) {
-                                               rpp_sci_printf("error sending to pcb - udp_send\n");
-                                               continue;
-                                       }
-                               }
-                               // Reset variables
-                               sent = FALSE;
-                               buff_index = 0;
-                               flush = FALSE;
-                       }
-               }
-
-       } while (0);
-
-/* close connection and clean */
-       if (!udp) {
-               tcp_recv(tnewpcb, NULL);
-               err = tcp_close(tnewpcb);
-               if (err != ERR_OK) {
-                       rpp_sci_printf("newpcb closing error\n");
-                       /* closing failed, try again later */
-                       LWIP_DEBUGF(LWIP_DBG_ON, ("Error %s closing pcb=0x%08X\n", lwip_strerr(err), pcb));
-                       tcp_recv(tnewpcb, nc_recv_callback);
-               }
-               else {
-                       /* closing succeeded */
-                       tcp_arg(tnewpcb, NULL);
-                       tcp_sent(tnewpcb, NULL);
-               }
-       }
-       else
-       {
-               udp_disconnect(pcb);
-               udp_remove(pcb);
-       }
-       buff_index = 0;
-#endif /* if !NO_SYS */
-       return ERR_OK;
-}
-
-#endif  /* DOCGEN */
-
-cmd_des_t const cmd_des_nc = {
-       0,CDESM_SPACE_SEP,
-       "ethnc","Start very simple netcat",
-
-       "### Command syntax ###\n"
-       "\n"
-       "     ethnc <IP> <PORT> [-p <PORT>] [-u] [-m [-t] | -d [-t]] [-c]\n"
-       "     ethnc -l <PORT> [-u] [-m [-t] | -d [-t]] [-c]\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "Netcat is a program which allows to communicate using TCP or UDP\n"
-       "protocols. First a connection is established by either:\n"
-       "\n"
-       "- connecting to a specified IP address and PORT (without option -l) or by\n"
-       "- listening for a new connection on a given PORT (with option -l).\n"
-       "\n"
-       "When no -u option is specified ethnc command works with TCP\n"
-       "connections. With -u option UDP communication is used. Listening for\n"
-       "connection on UDP means waiting for reception of any UDP datagram.\n"
-       "\n"
-       "Once the connection is established the command works in one of the\n"
-       "following modes:\n"
-       "\n"
-       "- interactive mode in which received data are forwarded to serial line and data received on serial line are sent to the connection when either new line is encountered or when internal buffer is full,\n"
-       "- sending of testing data (increasing ASCII formatted numbers) (option -d),\n"
-       "- looping of incoming data back to the connection's peer (option -m).\n"
-       "\n"
-       "Note: When trying to use a same local TCP port number multiple times\n"
-       "in a row (-l or -p options) there might be several minutes delay\n"
-       "before the port is available after closing the previous connection.\n"
-       "This situation is singled with ERROR 31.\n"
-       "\n"
-       "Other options:\n"
-       "\n"
-       "- -p specifies local port for outgoing connections.\n"
-       "- -u use UDP protocol instead of the default TCP.\n"
-       "- -t send and/or receive data in a background thread (works only with -d or -m options).\n"
-       "- -c stop all running background tasks\n"
-       "\n"
-       "### Examples ###\n"
-       "\n"
-       "Listen for incoming TCP connection on local port 2000:\n"
-       "     --> ethnc -l 2000\n"
-       "\n"
-       "Connect using TCP to address 192.168.247.15 to remote port 80 using local port 1500:\n"
-       "     --> ethnc 192.168.247.15 80 -p 1500\n"
-       "\n"
-       "Send testing data to the remote node:\n"
-       "     --> ethnc -d 192.168.247.2 1025\n"
-       "\n"
-       "Loop back all data coming from remote node's UDP port 1025:\n"
-       "     --> ethnc -m -u 192.168.247.2 1025\n"
-       "\n"
-       "Wait for a TCP connection on local port 30000 and loop all incoming data\n"
-       "back:\n"
-       "     --> ethnc -l 30000 -m\n",
-       CMD_HANDLER(cmd_do_init_nc), (void *)&cmd_list_nc
-};
-
-/** List of commands for lwip, defined as external */
-cmd_des_t const *cmd_list_nc[] = {
-       &cmd_des_nc,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_nc.h b/rpp-test-sw/commands/cmd_nc.h
deleted file mode 100644 (file)
index a04ad3b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * cmd_lwip.h
- *
- *  Created on: 9.8.2013
- *      Author: Jan DoleĹľal
- */
-
-#ifndef CMD_LWIP_H_
-#define CMD_LWIP_H_
-
-/* nc config values */
-/* 1 minute = (1000ms*60/1000ms)/60s */
-#define CONNECTING_TIMEO 1000 /* timeout in ms; to preserve responsibility of the system (command processor) this value shouldn't be too high */
-#define CONNECTING_TRIES 60   /* nc will try to connect or listen for connection for CONNECTING_TRIES*CONNECTING_TIMEO/1000 seconds */
-
-#define ncTaskStackSize 400
-#define ncTaskPriority  0
-
-/* nc return values */
-#define BAD_IP_ADDR     -21
-#define BAD_PORT_NO     -22
-#define BAD_OPTION      -23
-#define ERR_NETCONN_NEW -30
-#define ERR_BINDING     -31
-#define ERR_CONN_ACCEPT -32
-#define ERR_CONNECTING  -33
-#define ERR_SENDING     -34
-#define ERR_RECEIVING   -35
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_nc[];
-
-
-#endif /* CMD_LWIP_H_ */
diff --git a/rpp-test-sw/commands/cmd_netstats.c b/rpp-test-sw/commands/cmd_netstats.c
deleted file mode 100644 (file)
index 924e546..0000000
+++ /dev/null
@@ -1,653 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: Aug 23, 2013
- *
- * Authors:
- *     - Jan Dolezal <pm.jenik@gmail.com>
- *
- * 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_netstats.c
- *
- * Abstract:
- *      This file contains commands for net statistics (ethernet interface and LwIP)
- *
- */
-
-#include "cmd_netstats.h"
-
-#ifndef DOCGEN
-
-#include <string.h>
-
-#include "rpp/rpp.h"
-#include "drv/emac.h"
-#include "lwip/opt.h"
-#include "lwip/stats.h"
-
-#define INTERFACE_INSTANCE_NUMBER 0
-
-int cmd_do_read_linkstat(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       if (!isPostInitialized()) {
-               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
-               return FAILURE;
-       }
-       struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
-       if (rpp_eth_phylinkstat(INTERFACE_INSTANCE_NUMBER))
-               rpp_sci_printf("%c%c%d : UP\r\n", netif->name[0], netif->name[1], netif->num);
-       else
-               rpp_sci_printf("%c%c%d : DOWN\r\n", netif->name[0], netif->name[1], netif->num);
-       return SUCCESS;
-}
-
-int cmd_do_read_mac(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       if (!isPostInitialized()) {
-               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
-               return FAILURE;
-       }
-       uint8_t macaddr[18];
-       rpp_eth_get_macAddrStr(INTERFACE_INSTANCE_NUMBER,macaddr);
-       rpp_sci_printf((const char *)"%s\n", macaddr);
-       return SUCCESS;
-}
-
-int cmd_do_read_ip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       if (!isPostInitialized()) {
-               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
-               return FAILURE;
-       }
-       struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
-       uint8_t ipString[16];
-       rpp_eth_getIPDecimalStr(netif->ip_addr, ipString);
-       rpp_sci_printf("Address: %s\r\n", ipString);
-       rpp_eth_getIPDecimalStr(netif->netmask, ipString);
-       rpp_sci_printf("Netmask: %s\r\n", ipString);
-       rpp_eth_getIPDecimalStr(netif->gw, ipString);
-       rpp_sci_printf("Gateway: %s\r\n", ipString);
-       return SUCCESS;
-}
-
-
-
-
-/*      --- EMAC DESCRIPTOR FORMAT ---
- *                                         bit fields
- * WORD   |
- * OFFSET | 31                               16 | 15                                 0
- * ------------------------------------------------------------------------------------
- *    0   |                         *Next Descriptor Pointer
- *    1   |                           *Data Buffer Pointer
- *    2   |            Buffer Offset            |            Buffer Length
- *    3   |                Flags                |            Packet Length
- *    4   |                                  *pbuf
- */
-
-boolean_t bd_SOP(volatile struct emac_tx_bd *bufferDescriptor)
-{
-       return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_SOP);
-}
-
-boolean_t bd_EOP(volatile struct emac_tx_bd *bufferDescriptor)
-{
-       return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_EOP);
-}
-
-boolean_t bd_OWNER(volatile struct emac_tx_bd *bufferDescriptor)
-{
-       return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_OWNER);
-}
-
-boolean_t bd_EOQ(volatile struct emac_tx_bd *bufferDescriptor)
-{
-       return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_EOQ);
-}
-
-uint32_t bd_addr(uint16_t bd_num)
-{
-       return EMAC_CTRL_RAM_BASE_m(0) + bd_num*sizeof(struct emac_tx_bd);
-}
-
-volatile struct emac_tx_bd *findPreviousBD(volatile struct emac_tx_bd *bufferDescriptor)
-{
-       volatile struct emac_tx_bd *temporary = bufferDescriptor - 1;
-
-       /* first try space before given bd */
-       if ((uint32_t)temporary >= EMAC_CTRL_RAM_BASE_m(0) && temporary->next == bufferDescriptor)
-               return temporary;
-       temporary = bufferDescriptor->next;
-       while (temporary != bufferDescriptor && temporary != NULL) {
-               if (temporary->next == bufferDescriptor)
-                       return temporary;
-               temporary = (temporary + 1); /* going through memory, if you want to go through bd chains put here 'temporary = temporary->next;' */
-               if ( (uint32_t)(temporary+1) > EMAC_CTRL_RAM_BASE_m(0)+SIZE_EMAC_CTRL_RAM) /* when out of CPPI RAM */
-                       temporary = (struct emac_tx_bd *)EMAC_CTRL_RAM_BASE_m(0);  /* continue scanning from the beginning */
-       }
-       return (struct emac_tx_bd *)-1;  /* not found */
-}
-
-void print_bd_content(volatile struct emac_tx_bd *bufferDescriptor, boolean_t humanReadable)
-{
-       uint16_t data;
-
-       rpp_sci_printf("Buffer Descriptor at 0x%08x\n", bufferDescriptor);
-       rpp_sci_printf("Next BD:\t0x%08x\n", bufferDescriptor->next);
-       rpp_sci_printf("Data ptr:\t0x%08x\n", bufferDescriptor->bufptr);
-       rpp_sci_printf("Buf offset:\t%d\tBuf length:\t%d\n", (bufferDescriptor->bufoff_len >> 16), (bufferDescriptor->bufoff_len & 0xffff));
-       if (!humanReadable)
-               rpp_sci_printf("Flags:\t\t0x%04x\t", (bufferDescriptor->flags_pktlen >> 16));
-       else
-       {
-               data = bufferDescriptor->flags_pktlen;
-               rpp_sci_printf("Flags:\t%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n", (data & EMAC_DSC_FLAG_SOP) ? "SOP" : "", (data & EMAC_DSC_FLAG_EOP) ? "EOP" : "", (data & EMAC_DSC_FLAG_OWNER) ? "OWNER" : "", (data & EMAC_DSC_FLAG_EOQ) ? "EOQ" : "", (data & EMAC_DSC_FLAG_TDOWNCMPLT) ? "TDWN" : "", (data & EMAC_DSC_FLAG_PASSCRC) ? "PSCRC" : "", (data & EMAC_DSC_FLAG_JABBER) ? "JBR" : "", (data & EMAC_DSC_FLAG_OVERSIZE) ? "OVSZ" : "", (data & EMAC_DSC_FLAG_FRAGMENT) ? "FRGM" : "", (data & EMAC_DSC_FLAG_UNDERSIZED) ? "UNSZ" : "", (data & EMAC_DSC_FLAG_CONTROL) ? "CTRL" : "", (data & EMAC_DSC_FLAG_OVERRUN) ? "OVRUN" : "", (data & EMAC_DSC_FLAG_CODEERROR) ? "CODEERR" : "", (data & EMAC_DSC_FLAG_ALIGNERROR) ? "ALGNERR" : "", (data & EMAC_DSC_FLAG_CRCERROR) ? "CRCERR" : "", (data & EMAC_DSC_FLAG_NOMATCH) ? "NOMATCH" : "");
-       }
-       rpp_sci_printf("Pkt length:\t%d\n", (bufferDescriptor->flags_pktlen & 0xffff));
-       rpp_sci_printf("Pbuf ptr:\t0x%08x\n", bufferDescriptor->pbuf);
-}
-
-/*
- * mode: 0 flags -> param says which flag (0-15)
- *       1 bd->next == NULL, no param
- */
-void print_bds_state(uint8_t mode, uint8_t param)
-{
-       volatile struct emac_tx_bd *bufferDescriptor = (struct emac_tx_bd *)EMAC_CTRL_RAM_BASE_m(0);
-       uint16_t index = 0;
-
-       rpp_sci_printf("TX:");
-       while (index < 409) {
-               if (!(index%10)) {
-                       rpp_sci_printf(" ");
-                       if (!(index%50)) rpp_sci_printf("\n");
-               }
-               if (index == 204)
-                       rpp_sci_printf("\nRX: ");
-               if      (mode == 0) {
-                       if (bufferDescriptor->flags_pktlen & ((1 << 15) >> (param%16)))
-                               rpp_sci_printf("f");
-                       else
-                               rpp_sci_printf(".");
-               }
-               else if (mode == 1) {
-                       if (bufferDescriptor->next == NULL)
-                               rpp_sci_printf("0");
-                       else
-                               rpp_sci_printf(".");
-               }
-               else return;
-               bufferDescriptor++;
-               index++;
-       }
-       rpp_sci_printf("\n");
-}
-
-#define BUF_SIZE 15
-
-unsigned long readNum(uint8_t minamount, uint8_t maxamount, boolean_t hex)
-{
-       unsigned long out = 0;
-       uint8_t input_buffer[BUF_SIZE];
-       uint8_t buf_index = 0;
-       uint8_t input;
-
-       do {
-               input = rpp_sci_getc();
-               if (input == '\b' && buf_index > 0) {
-                       input_buffer[buf_index] = '\0';
-                       buf_index--;
-                       echo('\b');
-                       echo( ' ');
-                       echo('\b');
-               }
-               else if (buf_index >= maxamount)
-                       continue;
-               else if (input <= '9' && input >= '0') {
-                       input_buffer[buf_index] = input - '0';
-                       echo(input);
-                       buf_index++;
-               }
-               else if (hex && (input <= 'f' && input >= 'a')) {
-                       input_buffer[buf_index] = input - ('a' - 10);
-                       echo(input);
-                       buf_index++;
-               }
-               else if (hex && (input <= 'F' && input >= 'A')) {
-                       input_buffer[buf_index] = input - ('A' - 10);
-                       echo((input + ('a' - 'A')));
-                       buf_index++;
-               }
-       } while ( (input != '\r' && input != '\n' && buf_index < BUF_SIZE) || buf_index < minamount);
-       input = 0; /* use as index */
-       while (input < buf_index) {
-               if (hex)
-                       out = (out << 4) + input_buffer[input];
-               else
-                       out = (out*10) + input_buffer[input];
-               input++;
-       }
-       return out;
-}
-
-int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       uint8_t pindex;
-       uint8_t input;
-       volatile struct emac_tx_bd *bufferDescriptor;
-       boolean_t run = TRUE, interactive = FALSE, overview = FALSE;
-
-#if RPP_ETH_STATS
-       boolean_t isrRun = FALSE, rb = FALSE, tb = FALSE;
-#endif
-
-       /* if eth not initialized return */
-       if (!isPostInitialized()) {
-               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
-               return FAILURE;
-       }
-
-       /* examine parameters */
-       for (pindex = 1; param[pindex] != 0; pindex++) {
-               if        (strncmp((char *)param[pindex], "-i", 3) == 0) {
-                       interactive = TRUE;
-                       break;
-               }
-               else if (strncmp((char *)param[pindex], "-o", 3) == 0) {
-                       overview = TRUE;
-                       break;
-               }
-#if RPP_ETH_STATS
-               else if (strncmp((char *)param[pindex], "-r", 3) == 0) {
-                       isrRun = TRUE;
-                       break;
-               }
-               else if (strncmp((char *)param[pindex], "-rb", 4) == 0) {
-                       rb = TRUE;
-                       break;
-               }
-               else if (strncmp((char *)param[pindex], "-tb", 4) == 0) {
-                       tb = TRUE;
-                       break;
-               }
-#endif
-       }
-       struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
-       if (netif == NULL) {
-               rpp_sci_printf("netif err\n");
-               return -1;
-       }
-
-       if (interactive)
-               while (run) {
-                       input = rpp_sci_getc();
-
-                       if (input == 'b') { /* print buffer descriptor at given address */
-                               rpp_sci_printf("-? 0x");
-                               bufferDescriptor = (struct emac_tx_bd *)readNum(8,8,TRUE);
-                               rpp_sci_printf("\n");
-                               /* check it fits EMAC CPPI RAM */
-                               /*if(bufferDescriptor >= EMAC_CTRL_RAM_BASE_m(INTERFACE_INSTANCE_NUMBER) && (bufferDescriptor + sizeof(struct emac_tx_bd)) <= EMAC_CTRL_RAM_BASE_m(INTERFACE_INSTANCE_NUMBER) + SIZE_EMAC_CTRL_RAM)
-                                  {*/
-                               print_bd_content(bufferDescriptor, FALSE);
-                               /*}
-                                  else
-                                  {
-                                   rpp_sci_printf("address not from BD CPPI RAM range\n");
-                                  }*/
-                               while (1) {
-                                       input = rpp_sci_getc();
-                                       if      (input == 'n') { /* next */
-                                               bufferDescriptor = bufferDescriptor->next;
-                                               if (bufferDescriptor != NULL)
-                                                       print_bd_content(bufferDescriptor, FALSE);
-                                               else {
-                                                       rpp_sci_printf("NULL\n");
-                                                       break;
-                                               }
-                                       }
-                                       else if (input == 'p') { /* previous */
-                                               bufferDescriptor = findPreviousBD(bufferDescriptor);
-                                               if ((int32_t)bufferDescriptor != -1) {
-                                                       if (bufferDescriptor == NULL) {
-                                                               rpp_sci_printf("NULL\n");
-                                                               break;
-                                                       }
-                                                       else
-                                                               print_bd_content(bufferDescriptor, FALSE);
-                                               }
-                                               else
-                                               {
-                                                       rpp_sci_printf("not found\n");
-                                                       break;
-                                               }
-                                       }
-                                       else if (input == 'r') { /* reprint */
-                                               if ((int32_t)bufferDescriptor == -1 || bufferDescriptor == NULL) break;
-                                               print_bd_content(bufferDescriptor, FALSE);
-                                       }
-                                       else break;
-                               }
-                       }
-
-                       if      (input == 'q') { /* quit */
-                               run = FALSE;
-                               continue;
-                       }
-#if RPP_ETH_STATS
-                       else if (input == 's') /* general statistics */
-                               printStatistics();
-                       else if (input == 't') { /* print tx channel */
-                               print_tx_channel_stat();
-                               continue;
-                       }
-                       else if (input == 'r') { /* print rx channel */
-                               print_rx_channel_stat();
-                               continue;
-                       }
-#endif
-                       else if (input == 'a') { /* autocheck consistency of buffer descriptors */
-
-                       }
-                       else if (input == 'o') { /* overview */
-                               uint8_t mode = rpp_sci_getc() - '0';
-                               uint8_t param = rpp_sci_getc() - '0';
-                               print_bds_state(mode, param);
-                       }
-                       else if (input == 'c')  /* convert */
-                               rpp_sci_printf("0x%08x", bd_addr((uint16_t)readNum(1, 3, FALSE)));
-               }
-       else
-       {
-               if (overview) {
-                       rpp_sci_printf(" --- OVERVIEWS ---\n");
-                       rpp_sci_printf("bd->next points to NULL\n");
-                       print_bds_state(1, 0);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_SOP\n");
-                       print_bds_state(0, 0);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_EOP\n");
-                       print_bds_state(0, 1);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_OWNER\n");
-                       print_bds_state(0, 2);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_EOQ\n");
-                       print_bds_state(0, 3);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_TDOWNCMPLT\n");
-                       print_bds_state(0, 4);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_PASSCRC\n");
-                       print_bds_state(0, 5);
-                       rpp_sci_printf("\nPress any key ...\r");
-                       rpp_sci_getc();
-                       /* These flags are not so much important */
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_JABBER\n");
-                       print_bds_state(0, 6);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_OVERSIZE\n");
-                       print_bds_state(0, 7);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_FRAGMENT\n");
-                       print_bds_state(0, 8);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_UNDERSIZED\n");
-                       print_bds_state(0, 9);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_CONTROL\n");
-                       print_bds_state(0, 10);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_OVERRUN\n");
-                       print_bds_state(0, 11);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_CODEERROR\n");
-                       print_bds_state(0, 12);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_ALIGNERROR\n");
-                       print_bds_state(0, 13);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_CRCERROR\n");
-                       print_bds_state(0, 14);
-                       rpp_sci_printf("bds with EMAC_DSC_FLAG_NOMATCH\n");
-                       print_bds_state(0, 15);
-               }
-#if RPP_ETH_STATS
-               if (isrRun) {
-                       rpp_sci_printf(" --- NUMBER OF ISR RUNS ---\n");
-                       rpp_sci_printf("TxIsr: %d", countEMACCore0TxIsr);
-                       rpp_sci_printf("RxIsr: %d", countEMACCore0RxIsr);
-               }
-#endif
-
-
-       }
-       return ERR_OK;
-}
-
-#if LWIP_DHCP
-int cmd_do_dhcp(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       if (!isPostInitialized()) {
-               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
-               return FAILURE;
-       }
-       rpp_sci_printf("not implemented yet.");
-       return ERR_OK;
-}
-#endif
-
-#if LWIP_STATS_DISPLAY
-int cmd_do_lwip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       if (!isPostInitialized()) {
-               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
-               return FAILURE;
-       }
-       stats_display();
-       rpp_sci_printf("\n");
-       return ERR_OK;
-}
-#endif
-
-int cmd_do_ethinit(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int8_t retVal = rpp_eth_init_postInit(0, NULL); /* post OS startup init of eth (LwIP) for application usage -- waits for a while, for auto-negotiation of ethernet speed and DHCP if used */
-
-       switch (retVal) {
-       case FAILURE:
-               rpp_sci_printf("already initialized\n");
-               break;
-       case NETIF_ADD_ERR:
-               rpp_sci_printf("initialization of physical part of ethernet failed\n");
-               break;
-       case DHCP_MEM_ERR:
-               rpp_sci_printf("DHCP couldn't be started due to insufficient memory\n");
-               break;
-       case PHY_LINK_DOWN:
-               rpp_sci_printf("cable is not connected\n");
-               break;
-       default:
-               rpp_sci_printf("ethinit DONE\n");
-       }
-       return retVal;
-}
-
-#endif  /* DOCGEN */
-
-cmd_des_t const cmd_des_linkstat = {
-       0,0,
-       "ethlinkstat","Print current status of ethernet interface",
-
-       "### Command syntax ###\n"
-       "\n"
-       "    ethlinkstat\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command reads PHY link status assigned to ethernet interface and\n"
-       "prints interface name and informs about PHY's status to the output.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> ethlinkstat\n"
-       "    et0 : UP\n"
-       "\n"
-       "    --> ethlinkstat\n"
-       "    et0 : DOWN\n",
-       CMD_HANDLER(cmd_do_read_linkstat), (void *)&cmd_list_netstats
-};
-
-cmd_des_t const cmd_des_mac = {
-       0,0,
-       "ethmac","Print current MAC address of ethernet interface",
-
-       "### Command syntax ###\n"
-       "\n"
-       "    ethmac\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command obtains MAC address from ethernet interface structure\n"
-       "and prints it to the output.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> ethmac\n"
-       "    12:34:56:78:9a:bc\n",
-       CMD_HANDLER(cmd_do_read_mac), (void *)&cmd_list_netstats
-};
-
-cmd_des_t const cmd_des_ip = {
-       0,0,
-       "ethip","Print current IP address of network interface",
-
-       "### Command syntax ###\n"
-       "\n"
-       "    ethip\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command reads current IP address, netmask and gateway of network\n"
-       "interface and prints these to the output.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> ethip\n"
-       "    Address: 192.168.247.1\n"
-       "    Netmask: 255.255.255.0\n"
-       "    Gateway: 192.168.247.255\n",
-       CMD_HANDLER(cmd_do_read_ip), (void *)&cmd_list_netstats
-};
-
-cmd_des_t const cmd_des_bufferdescriptors = {
-       0,CDESM_SPACE_SEP,
-       "ethbd","Examine emac buffer descriptors",
-
-       "### Command syntax ###\n"
-       "\n"
-       "    ethbd\n"
-       "\n"
-       "### Description ###\n"
-       "After startup you use keys to control what will be done.\n"
-       "\n"
-       "- q - quit\n"
-       "- s - general statistics\n"
-       "- t - transmit channel status\n"
-       "- r - receive channel status\n"
-       "- b - after giving address of bd it prints bd content\n"
-       "- a - checks consistency of buffer descriptors\n"
-       "\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> ethbd\n",
-       CMD_HANDLER(cmd_do_bufferdescriptors), (void *)&cmd_list_netstats
-};
-
-#if LWIP_DHCP
-cmd_des_t const cmd_des_dhcp = {
-       0,0,
-       "dhcp","Prints and controls DHCP",
-
-       "### Command syntax ###\n"
-       "\n"
-       "    dhcp\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "\n"
-       ".\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> dhcp\n"
-       "    \n",
-       CMD_HANDLER(cmd_do_dhcp), (void *)&cmd_list_netstats
-};
-#endif
-
-#if LWIP_STATS_DISPLAY
-cmd_des_t const cmd_des_lwip = {
-       0,0,
-       "lwip","Prints statistics for the LwIP stack",
-
-       "### Command syntax ###\n"
-       "\n"
-       "    lwip\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "Sections printed:\n"
-       "LINK\n"
-       "ETHARP\n"
-       "IP\n"
-       "ICMP\n"
-       "UDP\n"
-       "TCP\n"
-       "MEM HEAP\n"
-       "MEM RAW_PCB\n"
-       "MEM UDP_PCB\n"
-       "MEM TCP_PCB\n"
-       "MEM TCP_PCB_LISTEN\n"
-       "MEM TCP_SEB\n"
-       "MEM NETBUF\n"
-       "MEM NETCONN\n"
-       "MEM TCPIP_MSG_API\n"
-       "MEM TCPIP_MSG_INPKT\n"
-       "MEM SYS_TIMEOUT\n"
-       "MEM PBUF_REF/ROM\n"
-       "MEM PBUF_POOL\n"
-       "SYS\n"
-       ".\n"
-       "Shown sections depends on modules compiled in.\n"
-       "    \n",
-       CMD_HANDLER(cmd_do_lwip), (void *)&cmd_list_netstats
-};
-#endif /* if LWIP_STATS_DISPLAY */
-
-cmd_des_t const cmd_des_ethinit = {
-       0,0,
-       "ethinit","Post OS startup eth initialization",
-
-       "### Command syntax ###\n"
-       "\n"
-       "    ethinit\n"
-       "\n"
-       "### Description ###\n"
-       "This command finishes autonegotiation of PHY and initialize LwIP stack.\n"
-       "\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> ethinit\n"
-       "    \n",
-       CMD_HANDLER(cmd_do_ethinit), (void *)&cmd_list_netstats
-};
-
-/** List of commands for lwip, defined as external */
-cmd_des_t const *cmd_list_netstats[] = {
-       &cmd_des_linkstat,
-       &cmd_des_mac,
-       &cmd_des_ip,
-       &cmd_des_bufferdescriptors,
-#if LWIP_DHCP
-       &cmd_des_dhcp,
-#endif
-#if LWIP_STATS_DISPLAY
-       &cmd_des_lwip,
-#endif
-       &cmd_des_ethinit,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_netstats.h b/rpp-test-sw/commands/cmd_netstats.h
deleted file mode 100644 (file)
index ae12a61..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * cmd_netstats.h
- *
- *  Created on: 23.8.2013
- *      Author: Jan DoleĹľal
- */
-
-#ifndef CMD_NETSTATS_H_
-#define CMD_NETSTATS_H_
-
-#include "cmdproc.h"
-
-#define echo(x) rpp_sci_putc(x)
-
-extern cmd_des_t const *cmd_list_netstats[];
-
-#endif /* CMD_NETSTATS_H_ */
diff --git a/rpp-test-sw/commands/cmd_sdram.c b/rpp-test-sw/commands/cmd_sdram.c
deleted file mode 100644 (file)
index 908639b..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.2013
- *
- * Authors:
- *     - Michal Horn
- *     - Carlos Jenkins <carlos@jenkins.co.cr>
- *
- * 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_sdram.c
- *
- * Abstract:
- *      This file contains commands for testing external SDRAM of RPP board.
- *
- */
-
-#include "cmd_sdram.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include <stdlib.h>
-
-#define BASE_FREQ_MILLIS    1000
-#define FREQ_VARIABILITY    100
-#define TEST_TASK_PRIORITY  0
-#define TEST_TASK_STACK     512
-#define INPUT_IDLE          50
-
-
-// Task control
-extern xSemaphoreHandle rpp_sdr_cmdproc_semaphore;
-static boolean_t stop_tasks = FALSE;    /**< Flag for stopping all related tasks. */
-static uint8_t tasks_running = 0;       /**< Task counter - incremented each time task is spawn, decremented when task is deleted */
-
-/**
- * @brief Set flag for tasks to finish.
- *
- * All tasks are reading the flag during their work and when
- * they detect this flag is up, they stop the routine, decrement
- * task counter and delete themselves.
- */
-static void wait_tasks_to_finish()
-{
-       stop_tasks = TRUE;
-       while (tasks_running > 0)
-               taskYIELD();
-       stop_tasks = FALSE;
-}
-
-/**
- * @brief Wait for user input "q" to quit the loop.
- */
-void wait_for_quit()
-{
-       while (rpp_sci_getc() < 0)
-               vTaskDelay(INPUT_IDLE / portTICK_RATE_MS);
-}
-
-
-/**
- * FreeRTOS Task that send some noise to the log from time to time.
- */
-void sdr_test_task(void *par)
-{
-       // Calculate wait time in OS ticks
-       static const portTickType freq_ticks = BASE_FREQ_MILLIS / portTICK_RATE_MS;
-       portTickType last_wake_time = xTaskGetTickCount();
-
-       // Initialize rand
-       srand(2097925); // They are random, I swear xD
-
-       uint32_t i = 0;
-       uint32_t variation = 0;
-       int8_t plus_minus = 1;
-       while (!stop_tasks) {
-
-               // Put something in the log
-               rpp_sdr_printf((const char *)
-                                          "This is the noise generator at iteration %d "
-                                          "putting some noise value %d.", i, rand()
-                                          );
-               i++;
-
-               if (!stop_tasks) {
-                       variation = freq_ticks +
-                                               (plus_minus * ((rand() % FREQ_VARIABILITY) + 1));
-                       plus_minus = plus_minus * -1;
-                       vTaskDelayUntil(&last_wake_time, variation);
-               }
-       }
-
-       // Delete myself
-       tasks_running--;
-       vTaskDelete(NULL);
-}
-
-/**
- * SDR Test entry point.
- */
-void test_sdr()
-{
-       /// Configure module
-       // - See note below.
-
-
-       /// Spawn tasks
-       xTaskHandle test_task_handle;
-
-       // Spawn noise task first, and later enable logging. Depending on the time
-       // required the first logs might not be registered, but that's ok, is better
-       // to check if logging could be enabled after data is being sent that enable
-       // command processor (which output messages to the SCI), and that inmediatly
-       // after the noise task could not be created, forcing to close the just
-       // opened command processor.
-       portBASE_TYPE task_created = xTaskCreate(sdr_test_task,
-                                                                                        (const signed char *)"sdr_test_task",
-                                                                                        TEST_TASK_STACK, NULL, TEST_TASK_PRIORITY,
-                                                                                        &test_task_handle
-                                                                                        );
-
-       if (task_created != pdPASS) {
-
-               rpp_sci_printf((const char *)
-                                          "ERROR: Problem spawning the test task. "
-                                          "Error code: %d\r\n", (uint32_t)task_created
-                                          );
-
-               wait_for_quit();
-               return;
-       }
-       tasks_running++;
-
-       if (rpp_sdr_setup(TRUE) != SUCCESS) {
-               rpp_sci_printf((const char *)
-                                          "ERROR: Problem enabling the logging module. "
-                                          );
-               wait_for_quit();
-               wait_tasks_to_finish();
-               return;
-       }
-
-       // Wait for the SDR included command processor to finish
-       xSemaphoreTake(rpp_sdr_cmdproc_semaphore, portMAX_DELAY);
-       wait_tasks_to_finish();
-
-       /// Reset module configuration
-       if (rpp_sdr_setup(FALSE) != SUCCESS) {
-               rpp_sci_printf((const char *)
-                                          "ERROR: Could not stop logging module.\r\n"
-                                          );
-               wait_for_quit();
-       }
-
-       rpp_sci_printf((const char *)"\r\n");
-
-       return;
-}
-
-
-/**
- * @brief Start SDR test routine
- *
- * @param[in]  cmd_io  Pointer to IO stack
- * @param[in]  des             Pointer to command descriptor
- * @param[in]  param   Parameters of command
- * @return always 0
- */
-int cmd_do_test_log(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       test_sdr();
-       return 0;
-}
-
-/**
- * @brief      Tests the capacity and fitness of connected SDRAM
- *
- * @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_test_ram(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       volatile uint32_t *addrPtr = (uint32_t *)0x80000000U;
-       volatile uint32_t *endAddr = (uint32_t *)0x83FFFFFFU;
-       uint32_t pattern = 0x55555555U;
-       uint32_t cnt = 0;
-       uint32_t errCnt = 0;
-       uint32_t readVal = 0;
-
-       while (addrPtr <= endAddr) {
-               *addrPtr = pattern;
-               pattern += 0x55555555U;
-               addrPtr++;
-       }
-
-       addrPtr = (uint32_t *)0x80000000U;
-       pattern = 0x55555555U;
-       while (addrPtr <= endAddr) {
-               readVal = *addrPtr;
-               if (pattern == readVal) cnt++;
-               else if (errCnt++ <= 10)
-                       rpp_sci_printf("Error at %h\r\n",addrPtr);
-               else break;
-               pattern += 0x55555555U;
-               addrPtr++;
-       }
-
-       cnt = cnt * sizeof(uint32_t) / 1024 / 1024;
-       if (cnt == 0)
-               rpp_sci_printf("SDRAM not connected.");
-       else
-               rpp_sci_printf("SDRAM installed: %d MB", cnt);
-
-       return 0;
-}
-
-#endif  /* DOCGEN */
-
-/** Command descriptor for test SDRAM */
-cmd_des_t const cmd_des_test_sdram = {
-       0, 0,
-       "sdramtest","Test if the SDRAM module is connected and if so, measures its capacity",
-       "### Command syntax ###\n"
-       "\n"
-       "    sdramtest\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command tests SDRAM address space by writing and reading a\n"
-       "pattern to/from it. It detects the SDRAM capacity.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> sdramtest\n"
-       "    SDRAM installed: 64 MB\n",
-       CMD_HANDLER(cmd_do_test_ram), (void *)&cmd_list_sdram
-};
-
-/** Command descriptor for test log to SDRAM */
-cmd_des_t const cmd_des_test_log = {
-       0, 0,
-       "sdramlogtest","Open a command subprocessor for managing SDRAM logging",
-       "### Command syntax ###\n"
-       "\n"
-       "    sdramlogtest\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command opens a subcommand processor, which contains testing\n"
-       "commands for logging into SDRAM.\n",
-       CMD_HANDLER(cmd_do_test_log), (void *)&cmd_list_sdram
-};
-
-/** List of commands for sdram, defined as external */
-cmd_des_t const *cmd_list_sdram[] = {
-       &cmd_des_test_sdram,
-       &cmd_des_test_log,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_sdram.h b/rpp-test-sw/commands/cmd_sdram.h
deleted file mode 100644 (file)
index 490b461..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_sdram.h
- *
- *  Created on: 28.2.2013
- *      Author: michal
- */
-
-#ifndef CMD_SDRAM_H_
-#define CMD_SDRAM_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_sdram[];
-
-
-#endif /* CMD_SDRAM_H_ */
diff --git a/rpp-test-sw/commands/cmd_spi.c b/rpp-test-sw/commands/cmd_spi.c
deleted file mode 100644 (file)
index d3d5b40..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.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_spi.c
- *
- * Abstract:
- *      Command for processing data from SPI and
- *      lowlevel command for sending data on SPI
- *
- */
-
-#include "cmd_spi.h"
-#include "stdio.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "cmdproc_utils.h"
-#include "drv/drv.h"
-#include <_isfuncdcl.h>
-
-/**
- *  @brief     Translate SPI response according the command and peripheral type
- *
- * @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_spi_translate(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       char *p;
-       int i;
-       uint32_t ret;
-       uint32_t values[MAX_PARAM_VALUES_NUM];
-       uint32_t numFieldDesc;
-       uint32_t numCmdDesc;
-       uint32_t command;
-       uint32_t response;
-       spitr_reg_translate_table_t translatedData;
-       char peripheralName[32];
-       char spareParams;
-
-       p = param[1];
-       if (sscanf(p, "%31s ", peripheralName) != 1)
-               return -CMDERR_BADPAR;
-
-       const spitr_cmd_map_t *cmdDesc = cmdDesc = get_spi_cmd_map(peripheralName, -1, &numCmdDesc);
-       if (cmdDesc == NULL) return -CMDERR_BADREG;
-
-
-       if (param[2] != NULL) {         // More parameters expected
-               p = param[2];
-               if (sscanf(p, "%x %x %1s", &values[0], &values[1], &spareParams) != 2)
-                       return -CMDERR_BADPAR;
-               command = values[0];
-               response = values[1];
-
-               const spitr_field_desc_t *fieldDescs = get_spi_field_desc(cmdDesc, numCmdDesc, command, &numFieldDesc);
-               if (fieldDescs == NULL)
-                       return -CMDERR_BADPAR;
-
-               ret = spitr_fill_tr_table(fieldDescs, numFieldDesc, response, &translatedData);
-
-               for (i = 0; i < translatedData.num_rows; i++) {
-                       rpp_sci_printf("%s: %x\r\n", translatedData.row[i].field_name, translatedData.row[i].value);
-               }
-               return cmd_opchar_replong(cmd_io, param, ret, 0, 10);
-       }
-       else
-               return -CMDERR_BADPAR;
-}
-
-
-/* SPI Master testing command */
-#define TEST_BUF 64
-uint8_t spi_test_buf_tx[TEST_BUF];
-uint8_t spi_test_buf_rx[TEST_BUF];
-
-int spimst_print_rx(struct spi_drv *ifc, int status, int addr, uint8_t *buf)
-{
-       int i;
-
-       if (status < 0) {
-               rpp_sci_printf("spirx failed: %d\n", status);
-               return -1;
-       }
-
-       rpp_sci_printf("spirx:%#x(", addr);
-       for (i = 0; i < status; i++) {
-               rpp_sci_printf("%#x", buf[i]);
-               if (i < status-1)
-                       rpp_sci_printf(",");
-       }
-       rpp_sci_printf(")\n");
-
-       return 0;
-}
-
-
-/**
- *  @brief     Send SPI command on SPI and receive response
- *
- * @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_spimst(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       spi_drv_t *ifc;
-       int i;
-       char *p;
-       char *token;
-       int ret;
-       unsigned int addr;
-       unsigned int rq_len;
-       int spi;
-       int values[MAX_PARAM_VALUES_NUM];
-
-       p = param[1];
-       if (sscanf(p, "%d", &spi) != 1)
-               return -CMDERR_BADPAR;
-       p = param[2];
-       if (sscanf(p, " %d", &addr) != 1)
-               return -CMDERR_BADPAR;
-       token = strtok(p, " ");
-       token = strtok(NULL, " ");
-       i = 0;
-       while (i < MAX_PARAM_VALUES_NUM && token != NULL) {
-               if (sscanf(token, "%x", &values[i]) == EOF)
-                       break;
-               token = strtok(NULL, " ");
-               spi_test_buf_tx[i] = (uint8_t)values[i];
-               i++;
-       }
-
-
-       ifc = spi_find_drv(NULL, spi);
-       if (ifc == NULL)
-               return -CMDERR_NODEV;
-
-       if (!(ifc->flags & SPI_IFC_ON))
-               //if (spi_tms570_init(ifc) < 0)
-               return -CMDERR_BADCFG;
-
-       rq_len = i;
-
-       ret = spi_transfer(ifc, addr, rq_len, spi_test_buf_tx, spi_test_buf_rx);
-       spimst_print_rx(ifc, ret, addr, spi_test_buf_rx);
-       return 0;
-}
-
-#endif  /* DOCGEN */
-/** Command descriptor for SPI response translation */
-cmd_des_t const cmd_des_spi_translate = {
-       0, CDESM_OPCHR|CDESM_RW,
-       "spitr*","Translate response from an SPI peripheral",
-       "### Command syntax ###\n"
-       "\n"
-       "    spitr<NAME> <CMD> <RESP>\n"
-       "where\n"
-       "\n"
-       "- `<NAME>` is a string specifying the name of the peripheral (one of DINSPI, LOUT, DAC12, DAC34, HBR, FRAY1 and FRAY2)\n"
-       "- `<CMD>` is a hexadecimal number in range 0 - FFFFFFFF\n"
-       "- `<RESP>` is a hexadecimal number in range 0 - FFFFFFFF\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command translates a response from SPI from many different\n"
-       "peripherals into a human readable form. The SPI response is in the\n"
-       "form of a hexadecimal number, which encodes the information. This\n"
-       "commands takes this response, the command which produced this\n"
-       "response, the name of the peripheral and translates the response into\n"
-       "the attribute-value table.\n"
-       "\n"
-       "### Example ###\n"
-       "    --> portvalDINSPI 7F 00 00\n"
-       "    portvalDINSPI=AAC03F\n"
-       "    --> spitrDINSPI 7F0000 3FC0AA\n"
-       "    Thermal flag       : 0\n"
-       "    INT flag   : 0\n"
-       "    SP0  - DIN0        : 1\n"
-       "    SP1  - DIN1        : 1\n"
-       "    SP2  - DIN2        : 1\n"
-       "    SP3  - DIN3        : 1\n"
-       "    SP4  - DIN4        : 1\n"
-       "    SP5  - DIN5        : 1\n"
-       "    SP6  - DIN6        : 1\n"
-       "    SP7  - DIN7        : 1\n"
-       "    SG0  - DIN8        : 0\n"
-       "    SG1  - DIN9        : 1\n"
-       "    SG2  - DIN10       : 0\n"
-       "    SG3  - DIN11       : 1\n"
-       "    SG4  - DIN12       : 0\n"
-       "    SG5  - DIN13       : 1\n"
-       "    SG6  - DIN14       : 0\n"
-       "    SG7  - DIN15       : 1\n"
-       "    SG8  - NA  : 0\n"
-       "    SG9  - NA  : 0\n"
-       "    SG10 - NA  : 0\n"
-       "    SG11 - NA  : 0\n"
-       "    SG12 - NA  : 0\n"
-       "    SG13 - NA  : 0\n"
-       "    spitrDINSPI=24\n"
-       "\n"
-       "Translates response 0x3FC0AA returned by command 0x7F0000 into a human\n"
-       "readable form.\n"
-       "Please notice LSB->MSB conversion of the portval result. The necessity\n"
-       "of the conversion depends on the controller of the examined port.\n",
-       CMD_HANDLER(cmd_do_spi_translate), (void *)&cmd_list_spi
-};
-
-/** Command descriptor for SPI trasfer */
-cmd_des_t const cmd_des_spimst = {
-       0, 0,
-       "spimst*", "Request SPI master communication",
-       "### Command syntax ###\n"
-       "\n"
-       "    spimst<SPI> <ADDR> <DATA>\n"
-       "where\n"
-       "\n"
-       "- `<SPI>` is a number in range 0 - 4\n"
-       "- `<ADDR>` is a number in range 0 - 2\n"
-       "- `<DATA>` is a sequence of hexadecimal numbers, separated by spaces, e.g. 12 AA CD\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "The command sends given data to the SPI peripheral and prints the\n"
-       "response. The response contains the address and the received data in\n"
-       "parentheses.\n"
-       "\n"
-       "### Example ###\n"
-       "\n"
-       "    --> spimst1 0 7F 00 00\n"
-       "    spirx:0x0(0x3f,0xc0,0xff)\n"
-       "\n"
-       "Sends reset command (0x7F0000) to the DIN peripheral.\n",
-       CMD_HANDLER(cmd_do_spimst), (void *)&cmd_list_spi
-};
-
-/** List of commands for SPI, defined as external */
-cmd_des_t const *cmd_list_spi[] = {
-       &cmd_des_spi_translate,
-       &cmd_des_spimst,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_spi.h b/rpp-test-sw/commands/cmd_spi.h
deleted file mode 100644 (file)
index a505815..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_spi.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_SPI_H_
-#define CMD_SPI_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_spi[];
-
-
-#endif /* CMD_SPI_H_ */
diff --git a/rpp-test-sw/commands/cmd_vbat.c b/rpp-test-sw/commands/cmd_vbat.c
deleted file mode 100644 (file)
index e575a04..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Created on: 28.2.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_vbat.c
- *
- * Abstract:
- *      Commands for VBAT control
- *          - Power VBAT1 on and off using PWM to charge capacitors
- *
- */
-
-#include "cmd_vbat.h"
-
-#ifndef DOCGEN
-
-#include "rpp/rpp.h"
-#include "hal/hal.h"
-
-#define VBATPWM_PERIOD 400
-
-/** Delay between set and clear vbat */
-static int vbatPwmRampProfile[] = {
-       19,
-       20,
-       21,
-       23,
-       27,
-       30,
-       0
-};
-
-/**
- *     @brief  Runs PWM defined by ramp profile on VBAT1
- *
- *     @return value on VBAT port
- */
-int vbat1_pwm()
-{
-       int *ppwm = vbatPwmRampProfile;
-       int pwm;
-       volatile uint8_t val = 1;
-       int i, j;
-       int pulse_cnt = 100;
-       uint32_t desc;
-
-       desc = PIN_DSC_VBAT1EN;
-       hal_gpio_pin_set_value(desc, 0);
-       hal_gpio_pin_direction_output(desc, 0);
-       vTaskDelay(10/portTICK_RATE_MS+2);
-       _disable_IRQ();
-       while ((pwm = *(ppwm++)))
-               for (i = 0; i < pulse_cnt; i++) {
-                       hal_gpio_pin_set_value(desc, 1);
-                       for (j = 0; j < pwm; j++)
-                               ;
-                       hal_gpio_pin_set_value(desc, 0);
-                       for (j = 0; j < VBATPWM_PERIOD - pwm; j++)
-                               ;
-               }
-       hal_gpio_pin_set_value(desc, 1);
-       _enable_IRQ();
-       return hal_gpio_pin_get_value(desc);
-}
-
-/**
- * @brief      Power on VBAT and VBAT1 using PWM
- *
- * @param[in]  cmd_io  Pointer to IO stack
- * @param[in]  des             Pointer to command descriptor
- * @param[in]  param   Parameters of command
- * @return     value on VBAT port
- */
-int cmd_do_power_on(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int ret = 0;
-
-       hal_gpio_pin_set_value(PIN_DSC_VBATEN, 1);
-       ret = hal_gpio_pin_get_value(PIN_DSC_VBATEN);
-       ret |= vbat1_pwm() << 1;
-       return cmd_opchar_replong(cmd_io, param, ret, 0, 0);
-}
-
-/**
- * @brief      Power off VBAT and VBAT1 using PWM
- *
- * @param[in]  cmd_io  Pointer to IO stack
- * @param[in]  des             Pointer to command descriptor
- * @param[in]  param   Parameters of command
- * @return     value on VBAT port
- */
-int cmd_do_power_off(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{
-       int ret = 0;
-
-       hal_gpio_pin_set_value(PIN_DSC_VBAT1EN, 0);
-       ret = hal_gpio_pin_get_value(PIN_DSC_VBAT1EN);
-       hal_gpio_pin_set_value(PIN_DSC_VBATEN, 0);
-       ret |= hal_gpio_pin_get_value(PIN_DSC_VBATEN) << 1;
-       return cmd_opchar_replong(cmd_io, param, ret, 0, 0);
-}
-
-#endif  /* DOCGEN */
-
-/** Command descriptor for poweron */
-cmd_des_t const cmd_des_power_on = {
-       0, 0,
-       "poweron","Enable VBATEN and VBAT1EN power supply by using PWM hack",
-       "### Command syntax ###\n"
-       "\n"
-       "    poweron\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command tries to work around error on VBAT power supply wiring\n"
-       "and attempts to switch the power supply on.\n"
-       "\n"
-       "It turns on the VBAT voltage by slowly charging the capacitors\n"
-       "connected to the VBAT1 signal by using the software-generated PWM\n"
-       "signal with increasing duty cycle.\n"
-       "\n"
-       "The poweron command has to be launched before any access to any SPI\n"
-       "peripherals, otherwise they will not work (or the power supply has to\n"
-       "be electrically bypassed).\n"
-       "\n"
-       "Please note that parameters for the PWM signal may change from device\n"
-       "to device and it might be necessary to tune them (in source code) for\n"
-       "each device.\n",
-       CMD_HANDLER(cmd_do_power_on), (void *)&cmd_list_vbat
-};
-
-/** Command descriptor for poweroff */
-cmd_des_t const cmd_des_power_off = {
-       0, 0,
-       "poweroff","Disables VBATEN and VBAT1EN power supply",
-       "### Command syntax ###\n"
-       "\n"
-       "    poweroff\n"
-       "\n"
-       "### Description ###\n"
-       "\n"
-       "This command turns off VBAT and VBAT1 voltages.\n",
-       CMD_HANDLER(cmd_do_power_off), (void *)&cmd_list_vbat
-};
-
-/** List of commands for vbat, defined as external */
-cmd_des_t const *cmd_list_vbat[] = {
-       &cmd_des_power_on,
-       &cmd_des_power_off,
-       NULL
-};
diff --git a/rpp-test-sw/commands/cmd_vbat.h b/rpp-test-sw/commands/cmd_vbat.h
deleted file mode 100644 (file)
index 795ab0c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * cmd_vbat.h
- *
- *  Created on: 28.2.2013
- *      Author: Michal Horn
- */
-
-#ifndef CMD_VBAT_H_
-#define CMD_VBAT_H_
-
-#include "cmdproc.h"
-
-extern cmd_des_t const *cmd_list_vbat[];
-
-
-#endif /* CMD_VBAT_H_ */
diff --git a/rpp-test-sw/commands/fray_demo.txt b/rpp-test-sw/commands/fray_demo.txt
deleted file mode 100644 (file)
index a0cfb50..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-FlexRay simple test of the connection
-===========================================
-This test starts a new FlaxRay network communication. Node A sends 100 messages,
-one message each 10th communication cycle, and node B is suppose to receive all
-of the messages correctly.
-Node A:
-       fraytestA
-Node B:
-       fraytestB
-
-FlexRay motor remote controlling
-===========================================
-Connection:
-       control panel is connected to the node A.
-               black - AIN1 (Low)
-               green - AIN1 (High)
-               white - GND
-               red - 12V
-               yellow - DIN0
-               blue - DIN1
-       DC motor is connected to the node B to the HBR outputs.
-
-Node A:
-       demomotctrl
-Node B:
-       demomotdrive
-Node C
-       simulink demo fray_motor_demo
-
-FlexRay commands example
-===========================================
-Node init:
-------------
-       #Node A configuration
-       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
-       frbtconfignode 0x0 0xF 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
-       ## Stat buffer TX - continuous mode
-       frbtcfgbufS0 slot1 AB cyc0 tx max9 continuous ppi0 int1
-       ## Receiving stat buffer from B
-       frbtcfgbufS1 slot2 AB cyc0 rx max9 continuous ppi0 int1
-       ## Buffer sending message to FIFO in node B - single shot mode
-       frbtcfgbufS2 slot3 B cyc0 tx max9 single ppi0 int1
-       ## NM vector sending and receiving
-       frbtcfgbufS3 slot5 AB cyc0 rx max9 continuous ppi1 int1
-       frbtcfgbufS4 slot4 AB cyc0 tx max9 continuous ppi1 int1
-       ## Dynamic buffers for TX and RX, single shot mode
-       frbtcfgbufD0  slot9  A cyc0 tx max9 single ppi0 int0
-       frbtcfgbufD1  slot10 A cyc0 rx max9 single ppi0 int0
-       ## RX FIFO buffer to accept messages from all aother slots
-       frbtcfgfifo rejslot0 slotmask0 depth5 AB cyc0 max0x20 rejnull accstat
-       # FlexRay start
-       frbtinitU
-       frbtstart
-       frbtallslots
-
-       #Node B configuration
-       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
-       frbtconfignode 0x0 0xF 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
-       ## Stat buffer TX - continuous mode
-       frbtcfgbufS0 slot2 AB cyc0 tx max9 continuous ppi0 int1
-       ## Receiving stat buffer from A
-       frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1
-       ## Buffer sending to FIFO in node A
-       frbtcfgbufS2 slot6 A cyc0 tx max9 single ppi0 int1
-       ## NM vector sending and receiving
-       frbtcfgbufS3 slot4 AB cyc0 rx max9 continuous ppi1 int1
-       frbtcfgbufS4 slot5 AB cyc0 tx max9 continuous ppi1 int1
-       ## Dynamic buffers for TX and RX, single shot mode
-       frbtcfgbufD0  slot9  A cyc0 rx max9 single ppi0 int0
-       frbtcfgbufD1  slot10 A cyc0 tx max9 single ppi0 int0
-       ## RX FIFO buffer to accept messages from all buffers except 0x#9, 0x#B, 0x#D, 0x#F
-       frbtcfgfifo rejslot9 slotmask6 depth5 B cyc0 max0x20 rejnull accstat
-       # FlexRay start
-       frbtinitU
-       frbtstart
-       frbtallslots
-
-       #Node C configuration (receive network management)
-       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
-       frbtconfignode 0x0 0xF 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
-       ## Stat buffer TX - continuous mode
-       ## NM vector sending and receiving
-       frbtcfgbufS0 slot7 AB cyc0 tx max9 continuous ppi0 int1
-       frbtcfgbufS1 slot4 AB cyc0 rx max9 continuous ppi1 int1
-       frbtcfgbufS2 slot5 AB cyc0 rx max9 continuous ppi1 int1
-       # FlexRay start
-       frbtinitU
-       frbtstart
-       frbtallslots
-
-       # NM Vector demo
-       frbtnmwatch
-
-Test static segment:
---------------------
-Starts sending a message from A in every cycle in Slot 1. The message is received by node B.
-After the message is sent from A, When the frbtreceive1 command on the node B is called every
-communication cycle after slot 1 has passed, the newly received message should be retrieved.
-Node A:
-       frbttransmit1 AA 
-Node B:
-       frbtreceive1
-
-Test dynamic segment:
---------------------
-Sends a message from node A in slot 9, which is in dynamic segment of the communication cycle.
-The buffer for this slot is configured as single-shot mode, so the message is sent only once.
-The message is received by node B. When the command frbtreceive9 is called after the message was
-sent from the A node, the newly received message should be retrieved. Every later calling should
-return with a 'No message received'.
-Node A:
-       frbttransmit9 99 99 99 99 99
-NodeB:
-       frbtreceive9
-
-Test FIFO:
---------------------
-Sends 6 messages from node A in the slot 3, which is in static segment of the communication cycle.
-Node B is configured to receive messages from slot 3 in a FIFO RX buffer. The FIFO has storage space
-for 5 messages, which means that the first message will be thrown away.
-Calling the frbtreceive0 command 5 times after all messages were sent from node A should retrieve the
-last 5 received messages. First 4 calling should return with 'More messages are still in FIFO', the last
-calling should return with 'Received message'. Every later calling should return with the
-'No message received'.
-Node A:
-       frbttransmit3 12 12 12 12 12
-       frbttransmit3 34 34 34 34 34
-       frbttransmit3 56 56 56 56 56
-       frbttransmit3 78 78 78 78 78
-       frbttransmit3 90 90 90 90 90
-       frbttransmit3 AB AB AB AB AB
-Node B:
-       frbtreceive3
-
-Test Network management vector:
---------------------
-Starts sending a network management vector. The vector has to be manualy sent by the command frbttransmit4
-from the node A. It is then received and processed automaticaly by the node B. Processed network management
-vector can be obtained by calling the command frbtnmvector on the node B.
-Node A:
-       frbttransmit4 FF 00 00 00 00 00 00 00 00 00 00 00
-Node B:
-       frbttransmit5 00 FF 00 00 00 00 00 00 00 00 00 00
-Node C:
-       frbtnmvector
-
-Canceling continuous TX:
---------------------
-When message was sent on the slot 4 ba calling the command frbttransmit4 on the node A and buffer assigned to
-the slot 4 is configured as continuous mode, it can be canceled by calling the command frbtcanceltx4 on the node A.
-If the frbtreceive4 command is called on the node B after message was sent for the first time from the node A, it
-shoud retrieved the newly received message.
-If the frbtreceive4 command is called after frbtcanceltx4, the last received message should be retrieved and for
-later calling it should return with 'No message received'.
-Node A:
-       frbttransmit4 12 34 56 78 90 AB CD EF EE EE EE EE
-       frbtcanceltx4
-Node B:
-       frbtreceive4
-
-Buffer reconfiguration example:
---------------------
-Reconfigures message buffer on the node A to transmit in slot 11 channel B instead of slot 9 channel A
-Reconfigures message buffer on the node B to receive from slot 11 channel B instead of slot 9 channel A.
-Node A:
-       frbtreconfigurebuf id9 slot11 B cycset1 cycoffset0 max9
-Node B:
-       frbtreconfigurebuf id9 slot11 B cycset1 cycoffset0 max9
-
-Three nodes test
-===========================================
-Node A is sending a message in single-shot mode in slot 4. This message is received by nodes B and C into the static segment RX buffer.
-Node B is sending a message in single-shot mode in slot 5. This message is received by node A into the static segment RX buffer.
-Node C is sending a message in single shot mode in slot 6. This message is received by node B into the FIFO RX buffer.
-       #Node A configuration
-       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
-       frbtconfignode 0x0 0xF 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
-       ## Stat buffer TX
-       frbtcfgbufS0 slot1 AB cyc0 tx max9 continuous ppi0 int1
-       frbtcfgbufS1 slot4 AB cyc0 tx max9 single ppi0 int1
-       ## Stat buffer RX
-       frbtcfgbufS2 slot5 AB cyc0 rx max9 single ppi0 int1
-       # FlexRay start
-       frbtinitU
-       frbtstart
-       frbtallslots
-
-       #Node B configuration
-       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
-       frbtconfignode 0x0 0xF 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
-       ## Stat buffer TX
-       frbtcfgbufS0 slot2 AB cyc0 tx max9 continuous ppi0 int1
-       frbtcfgbufS1 slot5 AB cyc0 tx max9 single ppi0 int1
-       ## Stat buffer RX
-       frbtcfgbufS2 slot4 AB cyc0 rx max9 single ppi0 int1
-       ## RX FIFO buffer
-       #              dpt ch  cyc  pl  rnf rsf fid
-       frbtcfgfifo rejslot0 slotmask0 depth5 AB cyc0 max0x20 rejnull accstat
-       # FlexRay start
-       frbtinitU
-       frbtstart
-       frbtallslots
-
-       #Node C configuration
-       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
-       frbtconfignode 0x0 0xF 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
-       ## Stat buffer TX
-       frbtcfgbufS0 slot3 AB cyc0 tx max9 continuous ppi0 int1
-       frbtcfgbufS1 slot6 A cyc0 tx max9 single ppi0 int1
-       ## Stat buffer RX
-       frbtcfgbufS2 slot4 AB cyc0 rx max9 single ppi0 int1
-       # FlexRay start
-       frbtinitU
-       frbtstart
-       frbtallslots
-
-Test of the broadcast
---------------------
-Sends a message from node A in slot 4. The message should be received by node A and B, once on each of the nodes.
-Node A:
-       frbttransmit4 AA BB CC
-Node B:
-       frbtreceive4
-Node C:
-       frbtreceive4
-
-Test of the A-B exclusive communication
---------------------
-Sends a message from the node B in slot 5. The message should be received only by node A.
-Node B:
-       frbttransmit5 BB AA
-Node A:
-       frbtreceive5
-Node C:
-       frbtreceive5
-
-Test of the B-C exclusive communication and the FIFO RX buffer
---------------------
-Sends a messages from the node C in slot 6. 5 latest messages should be received only by node B.
-Node C:
-       frbttransmit6 CC BB 01
-       frbttransmit6 CC BB 02
-       frbttransmit6 CC BB 03
-       frbttransmit6 CC BB 04
-       frbttransmit6 CC BB 05
-       frbttransmit6 CC BB 06
-Node A:
-       frbtreceive0
-Node B:
-       frbtreceive0
-       frbtreceive0
-       frbtreceive0
-       frbtreceive0
-       frbtreceive0
-       frbtreceive0