]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/commitdiff
FlexRay buffer reconfiguratoin tuned to accept two parameters for cycle filtering...
authorMichal Horn <hornmich@fel.cvut.cz>
Mon, 23 Sep 2013 16:02:06 +0000 (18:02 +0200)
committerMichal Horn <hornmich@fel.cvut.cz>
Mon, 23 Sep 2013 16:02:06 +0000 (18:02 +0200)
rpp-lib
rpp-test-sw/commands/cmd_fr_basic_test.c
rpp-test-sw/commands/fray_demo.txt

diff --git a/rpp-lib b/rpp-lib
index 8a4ccc349ec4db780de800fd741d9083cf25ed01..b478e09f43c7f4cd53920a72660dbd321c284c72 160000 (submodule)
--- a/rpp-lib
+++ b/rpp-lib
@@ -1 +1 @@
-Subproject commit 8a4ccc349ec4db780de800fd741d9083cf25ed01
+Subproject commit b478e09f43c7f4cd53920a72660dbd321c284c72
index 5846fccd5af7962194f11dee5620298bf4d031ca..ff009bfb84353a3d02f63405927fcff72e3d974d 100644 (file)
@@ -1822,17 +1822,20 @@ int cmd_do_fr_readcconfig(cmd_io_t *cmd_io, const struct cmd_des *des, char *par
 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;
+       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 cyc%i max%i",
+       ret = sscanf(param[2], "id%i slot%i %2s cycset%i cycoffset%i max%i",
                     &id,
                     &slot,
                     channel,
                     &cycleset,
+                    &cycleoffset,
                     &maxpayload
                     );
-       if (ret != 5) {
+       if (ret != 6) {
                printf("Error parsing parameter %d\n", ret+1);
                return -CMDERR_BADPAR;
        }
@@ -1844,21 +1847,31 @@ int cmd_do_fr_reconfigure_buffer(cmd_io_t *cmd_io, const struct cmd_des *des, ch
        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 (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");
+       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, tmp_buffer.cycleCounterFiltering, tmp_buffer.maxPayload) == SUCCESS) {
-               printf("frbtreconfigbuf id%i slot%i %2s cyc%i max%i\n",
+       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;
@@ -2723,12 +2736,13 @@ cmd_des_t const cmd_des_fr_reconfigure_buffer={
        "frbtreconfigurebuf*","Reconfigure a buffer to communicate in another slot",
        "=== Command syntax ===\n"
        "\n"
-       "   frbtreconfigurebuf id<ID> slot<SLOT> <CHN> cyc<CYC> max<MAX>\n"
+       "   frbtreconfigurebuf id<ID> slot<SLOT> <CHN> cycset<CYCS> cycoffset<CYCO> max<MAX>\n"
        "where\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"
-       "* <CYC> is the cycle set when to send the buffer,\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"
@@ -2739,11 +2753,12 @@ cmd_des_t const cmd_des_fr_reconfigure_buffer={
        "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 9\n"
-       "   frbtreconfigurebuf id2 slot3 AB 9\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
 };
 
index 3f4d385d5292f9a9396629ca6a93b9ca81544b51..a0cfb50cccbdaa7b67b621f726d575f2e3fdb3d4 100644 (file)
@@ -27,8 +27,8 @@ Node B:
 Node C
        simulink demo fray_motor_demo
 
-
-
+FlexRay commands example
+===========================================
 Node init:
 ------------
        #Node A configuration
@@ -44,8 +44,8 @@ Node init:
        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 max0x40 single ppi0 int0
-       frbtcfgbufD1  slot10 A cyc0 rx max0x40 single ppi0 int0
+       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
@@ -66,8 +66,8 @@ Node init:
        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 max0x40 single ppi0 int0
-       frbtcfgbufD1  slot10 A cyc0 tx max0x40 single ppi0 int0
+       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
@@ -158,6 +158,15 @@ Node A:
 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.