2 * Copyright (C) 2012-2013 Czech Technical University in Prague
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 * File : cmd_fr_basic_test.c
25 * The file contains a set of commands to control the FlexRay driver.
26 * Those commands can be used to configure RPP board as a FlexRay node,
27 * configure a set of TX and RX buffers, get status of the buffers and
28 * the FlexRay controller, manipulate with timers and control the transmission
33 #include "cmd_fr_basic_test.h"
38 #include "cmdproc_utils.h"
44 #define printf rpp_sci_printf
46 static inline int badpar(const char *msg)
49 return -CMDERR_BADPAR;
53 * Flag to recognize whether the FlexRay driver was already initialized. If it was, no further configuration is allowed.
55 static boolean_t fr_initialized = FALSE;
58 * This structure contains global FlexRay configuration.
59 * All nodes in the network have to use the same values for
60 * all parameters of this structure.
62 static Fr_TMS570LS_ClusterConfigType Fr_cluster_config = {
63 .gColdStartAttempts = 0x2,
65 .gMacroPerCycle = 0x15E0, // (cycle period, 5.6us)
66 .gMaxWithoutClockCorrectionFatal = 0xF,
67 .gMaxWithoutClockCorrectionPassive = 0xF,
68 .gNetworkManagementVectorLength = 12,
69 .gNumberOfMinislots = 0x15A,
70 .gNumberOfStaticSlots = 0x8,
71 .gOffsetCorrectionStart = 0xAE4,
72 .gPayloadLengthStatic = 0x9,
74 .gdActionPointOffset = 0x4,
75 .gdCASRxLowMax = 0x43,
76 .gdDynamicSlotIdlePhase = 0x1,
78 .gdMinislotActionPointOffset = 0x2,
80 .gdSampleClockPeriod = 0, // 10mbit/sec
82 .gdTSSTransmitter = 0xA,
83 .gdWakeupSymbolRxIdle = 18,
84 .gdWakeupSymbolRxLow = 18,
85 .gdWakeupSymbolRxWindow = 76,
86 .gdWakeupSymbolTxIdle = 180,
87 .gdWakeupSymbolTxLow = 60
91 * This structure contains local configuration of the FlexRay node A.
92 * All nodes in the network shall have their own local configuraion,
93 * but it does not matters if they share some together, until their
94 * buffer configuration differs.
96 static Fr_TMS570LS_NodeConfigType Fr_node_A_config = {
97 .pAllowHaltDueToClock = 0,
98 .pAllowPassiveToActive = 0xF,
99 .pChannels = FR_CHANNEL_AB,
100 .pClusterDriftDamping = 0x1,
101 .pDelayCompensationA = 0x3,
102 .pDelayCompensationB = 0x3,
103 .pExternOffsetCorrection = 0,
104 .pExternRateCorrection = 0,
105 .pKeySlotUsedForStartup = TRUE,
106 .pKeySlotUsedForSync = TRUE,
108 .pMacroInitialOffsetA = 0x6,
109 .pMacroInitialOffsetB = 0x6,
110 .pMicroInitialOffsetA = 0x18,
111 .pMicroInitialOffsetB = 0x18,
112 .pMicroPerCycle = 0x36B00,
113 .pRateCorrectionOut = 0xCD,
114 .pOffsetCorrectionOut = 0x151,
115 .pSamplesPerMicrotick = 0, // 10 mbit/sec
116 .pSingleSlotEnabled = TRUE,
117 .pWakeupChannel = FR_CHANNEL_A,
119 .pdAcceptedStartupRange = 0x81,
120 .pdListenTimeout = 0x36DA2,
122 .pDecodingCorrection = 0x33
126 * This structure contains local configuration of the FlexRay node B.
127 * All nodes in the network shall have their own local configuraion,
128 * but it does not matters if they share some together, until their
129 * buffer configuration differs.
131 static Fr_TMS570LS_NodeConfigType Fr_node_B_config = {
132 .pAllowHaltDueToClock = 0,
133 .pAllowPassiveToActive = 0xF,
134 .pChannels = FR_CHANNEL_AB,
135 .pClusterDriftDamping = 0x1,
136 .pDelayCompensationA = 0x3,
137 .pDelayCompensationB = 0x3,
138 .pExternOffsetCorrection = 0,
139 .pExternRateCorrection = 0,
140 .pKeySlotUsedForStartup = TRUE,
141 .pKeySlotUsedForSync = TRUE,
143 .pMacroInitialOffsetA = 0x6,
144 .pMacroInitialOffsetB = 0x6,
145 .pMicroInitialOffsetA = 0x18,
146 .pMicroInitialOffsetB = 0x18,
147 .pMicroPerCycle = 0x36B00,
148 .pRateCorrectionOut = 0xCD,
149 .pOffsetCorrectionOut = 0x151,
150 .pSamplesPerMicrotick = 0, // 10 mbit/sec
151 .pSingleSlotEnabled = TRUE,
152 .pWakeupChannel = FR_CHANNEL_A,
154 .pdAcceptedStartupRange = 0x81,
155 .pdListenTimeout = 0x36DA2,
157 .pDecodingCorrection = 0x33
160 static Fr_TMS570LS_MsgRAMConfig Fr_node_A_msgRAM_config = {
161 .dynSegmentBufferCount = 3,
162 .fifoBufferCount = 5,
163 .secureBuffers = FR_SB_RECONFIG_ENABLED,
164 .statSegmentBufferCount = 5,
165 .syncFramePayloadMultiplexEnabled = 0
168 static Fr_TMS570LS_MsgRAMConfig Fr_node_B_msgRAM_config = {
169 .dynSegmentBufferCount = 3,
170 .fifoBufferCount = 5,
171 .secureBuffers = FR_SB_RECONFIG_ENABLED,
172 .statSegmentBufferCount = 5,
173 .syncFramePayloadMultiplexEnabled = 0
176 static Fr_TMS570LS_BufferConfigType Fr_node_A_static_buffers_config[] = {
178 .channel = FR_CHANNEL_AB,
179 .cycleCounterFiltering = 0,
183 .msgBufferInterrupt = TRUE,
184 .payloadPreambleIndicatorTr = FALSE,
185 .rejectNullFrames = FALSE,
186 .rejectStaticSegment = FALSE,
187 .singleTransmit = FALSE,
191 .channel = FR_CHANNEL_AB,
192 .cycleCounterFiltering = 0,
196 .msgBufferInterrupt = TRUE,
197 .payloadPreambleIndicatorTr = FALSE,
198 .rejectNullFrames = FALSE,
199 .rejectStaticSegment = FALSE,
200 .singleTransmit = FALSE,
204 .channel = FR_CHANNEL_AB,
205 .cycleCounterFiltering = 0,
209 .msgBufferInterrupt = TRUE,
210 .payloadPreambleIndicatorTr = FALSE,
211 .rejectNullFrames = FALSE,
212 .rejectStaticSegment = FALSE,
213 .singleTransmit = TRUE,
217 .channel = FR_CHANNEL_AB,
218 .cycleCounterFiltering = 0,
222 .msgBufferInterrupt = TRUE,
223 .payloadPreambleIndicatorTr = FALSE,
224 .rejectNullFrames = FALSE,
225 .rejectStaticSegment = FALSE,
226 .singleTransmit = TRUE,
230 .channel = FR_CHANNEL_AB,
231 .cycleCounterFiltering = 0,
235 .msgBufferInterrupt = TRUE,
236 .payloadPreambleIndicatorTr = TRUE,
237 .rejectNullFrames = FALSE,
238 .rejectStaticSegment = FALSE,
239 .singleTransmit = FALSE,
245 static Fr_TMS570LS_BufferConfigType Fr_node_B_static_buffers_config[] = {
247 .channel = FR_CHANNEL_AB,
248 .cycleCounterFiltering = 0,
252 .msgBufferInterrupt = TRUE,
253 .payloadPreambleIndicatorTr = FALSE,
254 .rejectNullFrames = FALSE,
255 .rejectStaticSegment = FALSE,
256 .singleTransmit = FALSE,
260 .channel = FR_CHANNEL_AB,
261 .cycleCounterFiltering = 0,
265 .msgBufferInterrupt = TRUE,
266 .payloadPreambleIndicatorTr = FALSE,
267 .rejectNullFrames = FALSE,
268 .rejectStaticSegment = FALSE,
269 .singleTransmit = FALSE,
273 .channel = FR_CHANNEL_AB,
274 .cycleCounterFiltering = 0,
278 .msgBufferInterrupt = TRUE,
279 .payloadPreambleIndicatorTr = FALSE,
280 .rejectNullFrames = FALSE,
281 .rejectStaticSegment = FALSE,
282 .singleTransmit = TRUE,
286 .channel = FR_CHANNEL_AB,
287 .cycleCounterFiltering = 0,
291 .msgBufferInterrupt = TRUE,
292 .payloadPreambleIndicatorTr = FALSE,
293 .rejectNullFrames = FALSE,
294 .rejectStaticSegment = FALSE,
295 .singleTransmit = TRUE,
299 .channel = FR_CHANNEL_AB,
300 .cycleCounterFiltering = 0,
304 .msgBufferInterrupt = TRUE,
305 .payloadPreambleIndicatorTr = TRUE,
306 .rejectNullFrames = FALSE,
307 .rejectStaticSegment = FALSE,
308 .singleTransmit = FALSE,
313 static Fr_TMS570LS_BufferConfigType Fr_node_A_dynamic_buffers_config[] = {
315 .channel = FR_CHANNEL_A,
316 .cycleCounterFiltering = 0,
320 .msgBufferInterrupt = TRUE,
321 .payloadPreambleIndicatorTr = FALSE,
322 .rejectNullFrames = FALSE,
323 .rejectStaticSegment = FALSE,
324 .singleTransmit = FALSE,
328 .channel = FR_CHANNEL_B,
329 .cycleCounterFiltering = 0,
333 .msgBufferInterrupt = TRUE,
334 .payloadPreambleIndicatorTr = FALSE,
335 .rejectNullFrames = FALSE,
336 .rejectStaticSegment = FALSE,
337 .singleTransmit = FALSE,
341 .channel = FR_CHANNEL_A,
342 .cycleCounterFiltering = 0,
346 .msgBufferInterrupt = TRUE,
347 .payloadPreambleIndicatorTr = FALSE,
348 .rejectNullFrames = FALSE,
349 .rejectStaticSegment = FALSE,
350 .singleTransmit = TRUE,
356 static Fr_TMS570LS_BufferConfigType Fr_node_B_dynamic_buffers_config[] = {
358 .channel = FR_CHANNEL_B,
359 .cycleCounterFiltering = 0,
363 .msgBufferInterrupt = TRUE,
364 .payloadPreambleIndicatorTr = FALSE,
365 .rejectNullFrames = FALSE,
366 .rejectStaticSegment = FALSE,
367 .singleTransmit = TRUE,
371 .channel = FR_CHANNEL_A,
372 .cycleCounterFiltering = 0,
376 .msgBufferInterrupt = TRUE,
377 .payloadPreambleIndicatorTr = FALSE,
378 .rejectNullFrames = FALSE,
379 .rejectStaticSegment = FALSE,
380 .singleTransmit = TRUE,
384 .channel = FR_CHANNEL_A,
385 .cycleCounterFiltering = 0,
389 .msgBufferInterrupt = TRUE,
390 .payloadPreambleIndicatorTr = FALSE,
391 .rejectNullFrames = FALSE,
392 .rejectStaticSegment = FALSE,
393 .singleTransmit = TRUE,
398 static Fr_TMS570LS_BufferConfigType Fr_node_A_fifo_buffers_config[] = {
400 .channel = FR_CHANNEL_AB,
401 .cycleCounterFiltering = 0,
405 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
406 .payloadPreambleIndicatorTr = FALSE,
407 .rejectNullFrames = TRUE,
408 .rejectStaticSegment = FALSE,
409 .singleTransmit = FALSE,
413 .channel = FR_CHANNEL_AB,
414 .cycleCounterFiltering = 0,
418 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
419 .payloadPreambleIndicatorTr = FALSE,
420 .rejectNullFrames = TRUE,
421 .rejectStaticSegment = FALSE,
422 .singleTransmit = FALSE,
426 .channel = FR_CHANNEL_AB,
427 .cycleCounterFiltering = 0,
431 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
432 .payloadPreambleIndicatorTr = FALSE,
433 .rejectNullFrames = TRUE,
434 .rejectStaticSegment = FALSE,
435 .singleTransmit = FALSE,
439 .channel = FR_CHANNEL_AB,
440 .cycleCounterFiltering = 0,
444 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
445 .payloadPreambleIndicatorTr = FALSE,
446 .rejectNullFrames = TRUE,
447 .rejectStaticSegment = FALSE,
448 .singleTransmit = FALSE,
452 .channel = FR_CHANNEL_AB,
453 .cycleCounterFiltering = 0,
457 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
458 .payloadPreambleIndicatorTr = FALSE,
459 .rejectNullFrames = TRUE,
460 .rejectStaticSegment = FALSE,
461 .singleTransmit = FALSE,
466 static Fr_TMS570LS_BufferConfigType Fr_node_B_fifo_buffers_config[] = {
468 .channel = FR_CHANNEL_AB,
469 .cycleCounterFiltering = 0,
473 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
474 .payloadPreambleIndicatorTr = FALSE,
475 .rejectNullFrames = TRUE,
476 .rejectStaticSegment = FALSE,
477 .singleTransmit = FALSE,
478 .slotId = 0 // No Frame is rejected
481 .channel = FR_CHANNEL_AB,
482 .cycleCounterFiltering = 0,
486 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
487 .payloadPreambleIndicatorTr = FALSE,
488 .rejectNullFrames = TRUE,
489 .rejectStaticSegment = FALSE,
490 .singleTransmit = FALSE,
491 .slotId = 0 // No Frame is rejected
494 .channel = FR_CHANNEL_AB,
495 .cycleCounterFiltering = 0,
499 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
500 .payloadPreambleIndicatorTr = FALSE,
501 .rejectNullFrames = TRUE,
502 .rejectStaticSegment = FALSE,
503 .singleTransmit = FALSE,
504 .slotId = 0 // No Frame is rejected
507 .channel = FR_CHANNEL_AB,
508 .cycleCounterFiltering = 0,
512 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
513 .payloadPreambleIndicatorTr = FALSE,
514 .rejectNullFrames = TRUE,
515 .rejectStaticSegment = FALSE,
516 .singleTransmit = FALSE,
517 .slotId = 0 // No Frame is rejected
520 .channel = FR_CHANNEL_AB,
521 .cycleCounterFiltering = 0,
525 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
526 .payloadPreambleIndicatorTr = FALSE,
527 .rejectNullFrames = TRUE,
528 .rejectStaticSegment = FALSE,
529 .singleTransmit = FALSE,
530 .slotId = 0 // No Frame is rejected
535 * This is an unifying configuration structure for the node A.
536 * It joins all the configuration structure together.
538 static Fr_ConfigType Fr_config_node_A= {
539 .clusterConfiguration = &Fr_cluster_config,
540 .dynamicBufferConfigs = Fr_node_A_dynamic_buffers_config,
541 .fifoBufferConfigs = Fr_node_A_fifo_buffers_config,
542 .msgRAMConfig = &Fr_node_A_msgRAM_config,
543 .nodeConfiguration = &Fr_node_A_config,
544 .staticBufferConfigs = Fr_node_A_static_buffers_config
548 * This is an unifying configuration structure for the node A.
549 * It joins all the configuration structure together.
551 static Fr_ConfigType Fr_config_node_B= {
552 .clusterConfiguration = &Fr_cluster_config,
553 .dynamicBufferConfigs = Fr_node_B_dynamic_buffers_config,
554 .fifoBufferConfigs = Fr_node_B_fifo_buffers_config,
555 .msgRAMConfig = &Fr_node_B_msgRAM_config,
556 .nodeConfiguration = &Fr_node_B_config,
557 .staticBufferConfigs = Fr_node_B_static_buffers_config
560 /* User configuration */
562 static Fr_TMS570LS_ClusterConfigType user_cluster_config;
563 static Fr_TMS570LS_NodeConfigType user_node_config;
564 static Fr_TMS570LS_MsgRAMConfig user_msg_ram_config;
565 static Fr_TMS570LS_BufferConfigType user_static_buffer_config[RPP_FR_MAX_STATIC_BUF_CNT];
566 static Fr_TMS570LS_BufferConfigType user_dynamic_buffer_config[RPP_FR_MAX_DYNAMIC_BUF_CNT];
567 static Fr_TMS570LS_BufferConfigType user_fifo_buffer_config[RPP_FR_MAX_FIFO_BUF_DEPTH];
568 static Fr_ConfigType user_configuration = {
569 .clusterConfiguration = &user_cluster_config,
570 .nodeConfiguration = &user_node_config,
571 .msgRAMConfig = &user_msg_ram_config,
572 .staticBufferConfigs = user_static_buffer_config,
573 .dynamicBufferConfigs = user_dynamic_buffer_config,
574 .fifoBufferConfigs = user_fifo_buffer_config,
577 #define USER_CONFIG_NOT_DONE 0x0
578 #define USER_CONFIG_CLUSTER 0x1
579 #define USER_CONFIG_NODE 0x2
581 static uint8_t user_configuration_state = USER_CONFIG_NOT_DONE;
582 static uint8_t user_static_buffer_configured = 0;
583 static uint8_t user_dynamic_buffer_configured = 0;
584 static uint8_t user_fifo_buffer_depth = 0;
587 * Split string into numbers
589 * The function takes a string with hexadecimal numbers,
590 * separated by spaces, and converts it into an array of numbers.
592 * For example "0x2 0xA 0XDD 0xABCD" -> {0x2, 0xA, 0XDD, 0xABCD}
594 * @param [in] params Address of the string which will be converted
595 * @param [in] params_cnt A number of parameters, which should be found and converted from the string params
596 * @param [out] tmp_params Address, where converted array of numbers will be stored
598 * @return SUCCESS when all parameters were converted to the array of numbers,
599 * FAILURE when the string was too short, too long or some other error occurred.
601 static int8_t cmd_fr_parse_params(const char* params, uint32_t params_cnt, uint32_t* tmp_params) {
602 char cpy_params[256];
606 if (params == NULL || tmp_params == NULL) {
609 strncpy(cpy_params, params, 256);
610 token = strtok(cpy_params, " ");
614 for (i = 0; i < params_cnt; i++) {
615 if (sscanf(token, "%i", &tmp_params[i]) == EOF) { // No number found
618 if ((token = strtok(NULL, " ")) == NULL && i < params_cnt-1) { // Not enough parameters in the string
625 int8_t cmd_fr_config_cluster_params(const char* params) {
626 uint32_t tmp_params[FR_CLUSTER_PARAMS_CNT];
628 if (cmd_fr_parse_params(params, FR_CLUSTER_PARAMS_CNT, tmp_params) == FAILURE) {
632 user_cluster_config.gColdStartAttempts = tmp_params[0];
633 user_cluster_config.gListenNoise = tmp_params[1];
634 user_cluster_config.gMacroPerCycle = tmp_params[2];
635 user_cluster_config.gMaxWithoutClockCorrectionFatal = tmp_params[3];
636 user_cluster_config.gMaxWithoutClockCorrectionPassive = tmp_params[4];
637 user_cluster_config.gNetworkManagementVectorLength = tmp_params[5];
638 user_cluster_config.gNumberOfMinislots = tmp_params[6];
639 user_cluster_config.gNumberOfStaticSlots = tmp_params[7];
640 user_cluster_config.gOffsetCorrectionStart = tmp_params[8];
641 user_cluster_config.gPayloadLengthStatic = tmp_params[9];
642 user_cluster_config.gSyncNodeMax = tmp_params[10];
643 user_cluster_config.gdActionPointOffset = tmp_params[11];
644 user_cluster_config.gdCASRxLowMax = tmp_params[12];
645 user_cluster_config.gdDynamicSlotIdlePhase = tmp_params[13];
646 user_cluster_config.gdMinislot = tmp_params[14];
647 user_cluster_config.gdMinislotActionPointOffset = tmp_params[15];
648 user_cluster_config.gdNIT = tmp_params[16];
649 user_cluster_config.gdSampleClockPeriod = tmp_params[17];
650 user_cluster_config.gdStaticSlot = tmp_params[18];
651 user_cluster_config.gdTSSTransmitter = tmp_params[19];
652 user_cluster_config.gdWakeupSymbolRxIdle = tmp_params[20];
653 user_cluster_config.gdWakeupSymbolRxLow = tmp_params[21];
654 user_cluster_config.gdWakeupSymbolRxWindow = tmp_params[22];
655 user_cluster_config.gdWakeupSymbolTxIdle = tmp_params[23];
656 user_cluster_config.gdWakeupSymbolTxLow = tmp_params[24];
658 user_configuration_state |= USER_CONFIG_CLUSTER;
662 int8_t cmd_fr_config_node_params(const char* params) {
663 uint32_t tmp_params[FR_NODE_PARAMS_CNT+2]; // +2 because two more parameters from message RAM structure are expected in the string.
664 Fr_ChannelType channels[3] = {FR_CHANNEL_A, FR_CHANNEL_B, FR_CHANNEL_AB};
665 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};
667 if (cmd_fr_parse_params(params, FR_NODE_PARAMS_CNT+2, tmp_params) == FAILURE) {
671 user_node_config.pAllowHaltDueToClock = tmp_params[0];
672 user_node_config.pAllowPassiveToActive = tmp_params[1];
673 if (tmp_params[2] > 2) return FAILURE;
674 user_node_config.pChannels = channels[ tmp_params[2] ];
675 user_node_config.pClusterDriftDamping = tmp_params[3];
676 user_node_config.pDelayCompensationA = tmp_params[4];
677 user_node_config.pDelayCompensationB = tmp_params[5];
678 user_node_config.pExternOffsetCorrection = tmp_params[6];
679 user_node_config.pExternRateCorrection = tmp_params[7];
680 user_node_config.pKeySlotUsedForStartup = tmp_params[8];
681 user_node_config.pKeySlotUsedForSync = tmp_params[9];
682 user_node_config.pLatestTx = tmp_params[10];
683 user_node_config.pMacroInitialOffsetA = tmp_params[11];
684 user_node_config.pMacroInitialOffsetB = tmp_params[12];
685 user_node_config.pMicroInitialOffsetA = tmp_params[13];
686 user_node_config.pMicroInitialOffsetB = tmp_params[14];
687 user_node_config.pMicroPerCycle = tmp_params[15];
688 user_node_config.pRateCorrectionOut = tmp_params[16];
689 user_node_config.pOffsetCorrectionOut = tmp_params[17];
690 user_node_config.pSamplesPerMicrotick = tmp_params[18];
691 user_node_config.pSingleSlotEnabled = tmp_params[19];
692 if (tmp_params[20] > 1) return FAILURE;
693 user_node_config.pWakeupChannel = channels[ tmp_params[20] ];
694 user_node_config.pWakeupPattern = tmp_params[21];
695 user_node_config.pdAcceptedStartupRange = tmp_params[22];
696 user_node_config.pdListenTimeout = tmp_params[23];
697 user_node_config.pdMaxDrift = tmp_params[24];
698 user_node_config.pDecodingCorrection = tmp_params[25];
699 user_msg_ram_config.syncFramePayloadMultiplexEnabled = tmp_params[26];
700 if (tmp_params[27] > 3) return FAILURE;
701 user_msg_ram_config.secureBuffers = secure[ tmp_params[27] ];
703 user_configuration_state |= USER_CONFIG_NODE;
707 int cmd_do_fr_config_fifo(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
708 Fr_TMS570LS_BufferConfigType* fifo_buffer_ptr = &user_fifo_buffer_config[0];
710 char channel[3], rej_static_frames[8], rej_null_frames[8];
711 unsigned depth, slot, cycleset, maxpayload, mask;
712 Fr_TMS570LS_BufferConfigType tmp_buffer;
714 if (fr_initialized) {
715 rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
716 return -CMDERR_BADCFG;
719 ret = sscanf(param[2], "rejslot%i slotmask%i depth%i %2s cyc%i max%i %10s %10s",
730 printf("Error parsing parameter %d\n", ret+1);
731 return -CMDERR_BADPAR;
734 if (depth < 1 || depth >= RPP_FR_MAX_FIFO_BUF_DEPTH)
735 return badpar("Depth too high\n");
736 user_fifo_buffer_depth = depth;
739 return badpar("Invalid slot number\n");
740 tmp_buffer.slotId = slot;
742 return badpar("Invalid mask\n");
743 tmp_buffer.fidMask = mask;
744 if (strcmp(channel, "A") == 0) tmp_buffer.channel = FR_CHANNEL_A;
745 else if (strcmp(channel, "B") == 0) tmp_buffer.channel = FR_CHANNEL_B;
746 else if (strcmp(channel, "AB") == 0) tmp_buffer.channel = FR_CHANNEL_AB;
747 else return badpar("Channel parsing error\n");
749 if (cycleset >= 0x80)
750 return badpar("Cycle set must be less than 0x80.\n");
751 tmp_buffer.cycleCounterFiltering = cycleset;
753 if (maxpayload >= 128)
754 return badpar("Maximum payload in half-words must be less than 128\n");
755 tmp_buffer.maxPayload = maxpayload;
757 if (strcmp(rej_null_frames, "rejnull") == 0) tmp_buffer.rejectNullFrames = true;
758 else if (strcmp(rej_null_frames, "accnull") == 0) tmp_buffer.rejectNullFrames = false;
759 else return badpar("Reject/accept NULL frames parsing error\n");
761 if (strcmp(rej_static_frames, "rejstat") == 0)
762 tmp_buffer.rejectStaticSegment = true;
763 else if (strcmp(rej_static_frames, "accstat") == 0)
764 tmp_buffer.rejectStaticSegment = false;
765 else return badpar("Invalid reject/accept static frame parameter");
767 for (i = 0; i < user_fifo_buffer_depth; i++) {
768 fifo_buffer_ptr[i].slotId = tmp_buffer.slotId;
769 fifo_buffer_ptr[i].fidMask = tmp_buffer.fidMask;
770 fifo_buffer_ptr[i].maxPayload = tmp_buffer.maxPayload;
771 fifo_buffer_ptr[i].channel= tmp_buffer.channel;
772 fifo_buffer_ptr[i].cycleCounterFiltering = tmp_buffer.cycleCounterFiltering;
773 fifo_buffer_ptr[i].isTx = FALSE;
774 fifo_buffer_ptr[i].singleTransmit = FALSE;
775 fifo_buffer_ptr[i].payloadPreambleIndicatorTr = FALSE;
776 fifo_buffer_ptr[i].rejectNullFrames = tmp_buffer.rejectNullFrames;
777 fifo_buffer_ptr[i].rejectStaticSegment = tmp_buffer.rejectStaticSegment;
778 fifo_buffer_ptr[i].msgBufferInterrupt = 0;
781 printf("frbtcfgfifo rejslot%i slotmask%i depth%i %2s cyc%i max%i %10s %10s\n",
795 int cmd_do_fr_config_bufer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
797 Fr_TMS570LS_BufferConfigType *cfg;
800 char buf_type, channel[3],rxtx[3], single_continuous[11];
801 unsigned buffer, slot, cycleset, maxpayload, intr, preamb;
803 if (fr_initialized) {
804 rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
805 return -CMDERR_BADCFG;
808 ret = sscanf(param[1], "%c%i slot%i %2s cyc%i %2s max%i %10s ppi%i int%i",
821 printf("Error parsing parameter %d\n", ret+1);
822 return -CMDERR_BADPAR;
828 if (buffer >= RPP_FR_MAX_STATIC_BUF_CNT)
829 return badpar("Buffer index too high\n");
830 cfg = &user_static_buffer_config[buffer];
833 if (buffer >= RPP_FR_MAX_DYNAMIC_BUF_CNT)
834 return badpar("Buffer index too high\n");
835 cfg = &user_dynamic_buffer_config[buffer];
838 return badpar("Invalid buffer type (S, D)\n");
841 if (slot < 1 || slot > 2047)
842 return badpar("Invalid slot number\n");
845 if (strcmp(channel, "A") == 0) cfg->channel = FR_CHANNEL_A;
846 else if (strcmp(channel, "B") == 0) cfg->channel = FR_CHANNEL_B;
847 else if (strcmp(channel, "AB") == 0) cfg->channel = FR_CHANNEL_AB;
848 else return badpar("Channel parsing error\n");
849 if (buf_type == 'D' && cfg->channel == FR_CHANNEL_AB)
850 return badpar("Dynamic segment buffers cannot have AB channels.\n");
852 if (cycleset >= 0x80)
853 return badpar("Cycle set must be less than 0x80.\n");
854 cfg->cycleCounterFiltering = cycleset;
856 if (strcmp(rxtx, "tx") == 0) cfg->isTx = true;
857 else if (strcmp(rxtx, "rx") == 0) cfg->isTx = false;
858 else return badpar("RX/TX parsing error\n");
860 if (maxpayload >= 128)
861 return badpar("Maximum payload in half-words must be less than 128\n");
862 cfg->maxPayload = maxpayload;
864 if (0 == strcmp(single_continuous, "single") ||
865 0 == strcmp(single_continuous, "s"))
866 cfg->singleTransmit = true;
867 else if (0 == strcmp(single_continuous, "continuous") ||
868 0 == strcmp(single_continuous, "c"))
869 cfg->singleTransmit = false;
870 else return badpar("Invalid single/continuous parameter");
873 return badpar("Payload preamble indicator must be 0 or 1");
874 cfg->payloadPreambleIndicatorTr = preamb;
877 return badpar("Interrupt parameter must be 0 or 1");
878 cfg->msgBufferInterrupt = intr;
882 if (buffer >= user_static_buffer_configured)
883 user_static_buffer_configured = buffer + 1;
886 if (buffer >= user_dynamic_buffer_configured)
887 user_dynamic_buffer_configured = buffer + 1;
891 printf("frbtcfgbuf%c%i slot%i %2s cyc%i %2s max%i %10s ppi%i int%i\n",
910 * @brief Do the user configuration of the FlexRay cluster parameters
912 * @param[in] cmd_io Pointer to IO stack
913 * @param[in] des Pointer to command descriptor
914 * @param[in] param Parameters of command
915 * @return 0 when OK or error code
917 int cmd_do_fr_user_config(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
920 if (fr_initialized) {
921 rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
922 return -CMDERR_BADCFG;
925 token = strtok(param[1], " ");
926 if (strcmp(token, "cluster") == 0) {
927 if (cmd_fr_config_cluster_params(param[2]) == FAILURE) {
928 rpp_sci_printf("FlexRay cluster configuration not accepted.\n");
929 return -CMDERR_BADPAR;
931 rpp_sci_printf("FlexRay cluster configuration accepted.\n");
933 else if (strcmp(token, "node") == 0) {
934 if (cmd_fr_config_node_params(param[2]) == FAILURE) {
935 rpp_sci_printf("FlexRay node configuration not accepted.\n");
936 return -CMDERR_BADPAR;
938 rpp_sci_printf("FlexRay node configuration accepted.\n");
941 return -CMDERR_BADPAR;
948 * @brief Initialize the device as FlexRay node.
950 * @param[in] cmd_io Pointer to IO stack
951 * @param[in] des Pointer to command descriptor
952 * @param[in] param Parameters of command
953 * @return 0 when OK or error code
955 int cmd_do_fr_init(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
956 const Fr_ConfigType* Fr_ConfigPtr = NULL;
957 int8_t retVal = SUCCESS;
958 uint32_t error = ERR_PARAM_NO_ERROR;
960 if (*param[1] == 'A') {
961 Fr_ConfigPtr = &Fr_config_node_A;
963 else if (*param[1] == 'B') {
964 Fr_ConfigPtr = &Fr_config_node_B;
966 else if (*param[1] == 'U') { // Select the user configuration - call config commands first
967 user_msg_ram_config.statSegmentBufferCount = user_static_buffer_configured;
968 user_msg_ram_config.dynSegmentBufferCount = user_dynamic_buffer_configured;
969 user_msg_ram_config.fifoBufferCount= user_fifo_buffer_depth;
970 Fr_ConfigPtr = &user_configuration;
973 return -CMDERR_BADPAR;
976 retVal = rpp_fr_init_driver(Fr_ConfigPtr, &error);
977 if (retVal == SUCCESS) {
978 rpp_sci_printf("FlexRay driver initialized.\r\n");
979 fr_initialized = TRUE;
982 retVal = rpp_fr_init_controller(0, &error);
983 if (retVal == SUCCESS) {
984 rpp_sci_printf("FlexRay controller reinitialized.\r\n");
988 rpp_sci_printf("FlexRay needs to be configured before initialization.\r\n");
989 return -CMDERR_BADCFG;
993 retVal = rpp_fr_init_controller(0, &error);
994 if (retVal == SUCCESS) {
995 rpp_sci_printf("FlexRay controller initialized.\r\n");
998 if (error & FR_INIT_ERR_CLUSTER_CONFIG) {
999 rpp_sci_printf("Cluster configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
1001 else if (error & FR_INIT_ERR_NODE_CONFIG) {
1002 rpp_sci_printf("Node configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
1004 else if (error & FR_INIT_ERR_MSGRAM_CONFIG) {
1005 rpp_sci_printf("Message RAM configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
1007 else if (error & FR_INIT_ERR_BUFFPARAM_CONFIG) {
1008 rpp_sci_printf("Buffer configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
1010 else if (error & (uint32_t)FR_INIT_ERR_BUFF_CONFIG) {
1011 rpp_sci_printf("Buffer configuration error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
1014 rpp_sci_printf("POC state switching error.\r\n");
1016 return -CMDERR_BADCFG;
1022 * @brief Starts FlexRay communication
1024 * @param[in] cmd_io Pointer to IO stack
1025 * @param[in] des Pointer to command descriptor
1026 * @param[in] param Parameters of command
1027 * @return 0 when OK or error code
1029 int cmd_do_fr_start(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1030 int8_t retVal = SUCCESS;
1031 uint32_t error = ERR_PARAM_NO_ERROR;
1033 retVal = rpp_fr_start_communication(0, &error);
1034 if (retVal == SUCCESS) {
1035 rpp_sci_printf("FlexRay communication is running.\r\n");
1038 if (error & FR_STARTUP_ERR_SW_STUP_FOLLOW) {
1039 rpp_sci_printf("Can not switch POC to RUN state.\r\n");
1041 else if (error & FR_STARTUP_ERR_CSINH_DIS) {
1042 rpp_sci_printf("Cold start inhibit disabled error.\r\n");
1044 else if (error & FR_STARTUP_ERR_SW_STUP_READY) {
1045 rpp_sci_printf("Can not switch back to READY from STARTUP.\r\n");
1047 else if (error & FR_STARTUP_ERR_SW_STUP_AS_NCOLD) {
1048 rpp_sci_printf("Can not switch to STARTUP as non-coldstarter.\r\n");
1051 rpp_sci_printf("General error.\r\n");
1053 return -CMDERR_BADCFG;
1059 * @brief Invokes POC command ALL_SLOTS
1061 * @param[in] cmd_io Pointer to IO stack
1062 * @param[in] des Pointer to command descriptor
1063 * @param[in] param Parameters of command
1064 * @return 0 when OK or error code
1066 int cmd_do_fr_allslots(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1067 int8_t retVal = ERR_PARAM_NO_ERROR;
1068 retVal = rpp_fr_all_slots(0);
1069 if (retVal == SUCCESS) {
1070 rpp_sci_printf("FlexRay node started communication in all slots.\r\n");
1073 rpp_sci_printf("General error.\r\n");
1074 return -CMDERR_BADCFG;
1080 * @brief Halt FlexRay communication
1082 * @param[in] cmd_io Pointer to IO stack
1083 * @param[in] des Pointer to command descriptor
1084 * @param[in] param Parameters of command
1085 * @return 0 when OK or error code
1087 int cmd_do_fr_halt(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1088 int8_t retVal = ERR_PARAM_NO_ERROR;
1089 retVal = rpp_fr_halt_communication(0);
1090 if (retVal == SUCCESS) {
1091 rpp_sci_printf("FlexRay node communication halted.\r\n");
1094 rpp_sci_printf("General error.\r\n");
1095 return -CMDERR_BADCFG;
1101 * @brief Abort FlexRay communication
1103 * @param[in] cmd_io Pointer to IO stack
1104 * @param[in] des Pointer to command descriptor
1105 * @param[in] param Parameters of command
1106 * @return 0 when OK or error code
1108 int cmd_do_fr_abort(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1109 int8_t retVal = ERR_PARAM_NO_ERROR;
1110 retVal = rpp_fr_abort_communication(0);
1111 if (retVal == SUCCESS) {
1112 rpp_sci_printf("FlexRay node communication aborted.\r\n");
1115 rpp_sci_printf("General error.\r\n");
1116 return -CMDERR_BADCFG;
1122 * @brief Send wake up pattern
1124 * @param[in] cmd_io Pointer to IO stack
1125 * @param[in] des Pointer to command descriptor
1126 * @param[in] param Parameters of command
1127 * @return 0 when OK or error code
1129 int cmd_do_fr_sendwup(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1130 int8_t retVal = ERR_PARAM_NO_ERROR;
1131 retVal = rpp_fr_send_wup(0);
1132 if (retVal == SUCCESS) {
1133 rpp_sci_printf("Wake up pattern has been sent.\r\n");
1136 rpp_sci_printf("General error.\r\n");
1137 return -CMDERR_BADCFG;
1143 * @brief Set channel for wake up pattern sending.
1145 * @param[in] cmd_io Pointer to IO stack
1146 * @param[in] des Pointer to command descriptor
1147 * @param[in] param Parameters of command
1148 * @return 0 when OK or error code
1150 int cmd_do_fr_setwuchannel(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1151 int8_t retVal = ERR_PARAM_NO_ERROR;
1152 Fr_ChannelType channel = FR_CHANNEL_A;
1154 if (*param[1] == 'A') {
1155 channel = FR_CHANNEL_A;
1157 else if (*param[1] == 'B') {
1158 channel = FR_CHANNEL_B;
1161 return -CMDERR_BADPAR;
1163 retVal = rpp_fr_set_wu_channel(0, channel);
1164 if (retVal == SUCCESS) {
1165 rpp_sci_printf("Wake up channel has been set.\r\n");
1168 rpp_sci_printf("General error.\r\n");
1169 return -CMDERR_BADCFG;
1175 * @brief Get and print POC status of the FlexRay controller.
1177 * @param[in] cmd_io Pointer to IO stack
1178 * @param[in] des Pointer to command descriptor
1179 * @param[in] param Parameters of command
1180 * @return 0 when OK or error code
1182 int cmd_do_fr_getpocstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1183 int8_t retVal = ERR_PARAM_NO_ERROR;
1184 Fr_POCStatusType status;
1185 char* ErrorModeStrings[] = {"ACTIVE", "HALT", "PASSIVE"};
1186 char* SlotModeStrings[] = {"KEYSLOT", "ALL_PENDING", "ALL"};
1187 char* StartupStateStrings[] = {
1188 "UNDEFINED", "COLDSTART_LISTEN", "COLDSTART_CHECK", "COLDSTART_JOIN",
1189 "COLDSTART_CONSISTENCY_CHECK", "INTEGRATION_LISTEN", "INITIALIZE_SCHEDULE", "INTEGRATION_CONSISTENCY_CHECK",
1190 "COLDSTART_GAP", "EXTERNAL_STARTUP", "ABORT", "COLDSTART_COLLISION_RESOLUTION",
1193 char* StateStrings[] = {
1194 "CONFIG", "DEFAULT_CONFIG", "HALT", "NORMAL_ACTIVE",
1195 "NORMAL_PASSIVE", "READY", "STARTUP", "LOOPBACK",
1198 char* WakeupStatusStrings[] = {
1199 "UNDEFINED", "RECEIVED_HEADER", "RECEIVED_WUP", "COLLISION_HEADER",
1200 "COLLISION_WUP", "COLLISION_UNKNOWN", "TRANSMITTED"
1203 retVal = rpp_fr_get_poc_status(0, &status);
1204 if (retVal == SUCCESS) {
1205 rpp_sci_printf("POC status:\r\n");
1206 rpp_sci_printf("CHIHaltRequest: %s\r\n", (status.CHIHaltRequest == TRUE) ? "TRUE" : "FALSE");
1207 rpp_sci_printf("CHIReadyRequest: %s\r\n", (status.CHIReadyRequest == TRUE) ? "TRUE" : "FALSE");
1208 rpp_sci_printf("ColdstartNoise: %s\r\n", (status.ColdstartNoise == TRUE) ? "TRUE" : "FALSE");
1209 rpp_sci_printf("Freeze: %s\r\n", (status.Freeze == TRUE) ? "TRUE" : "FALSE");
1210 rpp_sci_printf("ErrorMode: %s\r\n", ErrorModeStrings[status.ErrorMode]);
1211 rpp_sci_printf("SlotMode: %s\r\n", SlotModeStrings[status.SlotMode]);
1212 rpp_sci_printf("StartupState: %s\r\n", StartupStateStrings[status.StartupState]);
1213 rpp_sci_printf("State: %s\r\n", StateStrings[status.State]);
1214 rpp_sci_printf("WakeupStatus: %s\r\n", WakeupStatusStrings[status.WakeupStatus]);
1217 rpp_sci_printf("General error.\r\n");
1218 return -CMDERR_BADCFG;
1224 * @brief Send given data through the FlexRay in selected slot.
1226 * @param[in] cmd_io Pointer to IO stack
1227 * @param[in] des Pointer to command descriptor
1228 * @param[in] param Parameters of command
1229 * @return 0 when OK or error code
1231 int cmd_do_fr_transmittxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1232 int8_t retVal = ERR_PARAM_NO_ERROR;
1235 int values[MAX_PARAM_VALUES_NUM];
1236 uint8_t data[MAX_PARAM_VALUES_NUM];
1239 if (sscanf(param[1], "%d", &slotID) != 1) {
1240 return -CMDERR_BADPAR;
1242 if (sscanf(param[2], " %2x", &values[0]) != 1) {
1243 return -CMDERR_BADPAR;
1245 data[0] = (uint8_t)values[0];
1246 token = strtok(param[2], " ");
1247 token = strtok(NULL, " ");
1249 while (dataLength < MAX_PARAM_VALUES_NUM && token != NULL) {
1250 if (sscanf(token, "%2x", &values[dataLength]) == EOF) {
1253 data[dataLength] = (uint8_t)values[dataLength];
1254 token = strtok(NULL, " ");
1258 retVal = rpp_fr_transmit_lpdu(0, slotID, data, dataLength);
1259 if (retVal == SUCCESS) {
1260 rpp_sci_printf("Data were set for transmission.\r\n");
1263 rpp_sci_printf("General error.\r\n");
1264 return -CMDERR_BADCFG;
1270 * @brief Cancel the transmission in the selected slot.
1272 * @param[in] cmd_io Pointer to IO stack
1273 * @param[in] des Pointer to command descriptor
1274 * @param[in] param Parameters of command
1275 * @return 0 when OK or error code
1277 int cmd_do_fr_canceltxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1278 int8_t retVal = ERR_PARAM_NO_ERROR;
1281 if (sscanf(param[1], "%d", &slotID) != 1) {
1282 return -CMDERR_BADPAR;
1284 if (param[2] != NULL) {
1285 return -CMDERR_BADPAR;
1288 retVal = rpp_fr_cancel_transmit_lpdu(0, slotID);
1289 if (retVal == SUCCESS) {
1290 rpp_sci_printf("Transmission canceled.\r\n");
1293 rpp_sci_printf("General error.\r\n");
1294 return -CMDERR_BADCFG;
1300 * @brief Receive data from selected slot.
1302 * @param[in] cmd_io Pointer to IO stack
1303 * @param[in] des Pointer to command descriptor
1304 * @param[in] param Parameters of command
1305 * @return 0 when OK or error code
1307 int cmd_do_fr_receiverxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1308 int8_t retVal = ERR_PARAM_NO_ERROR;
1310 uint8_t data[cPayloadLengthMax];
1311 Fr_RxLPduStatusType status;
1312 uint8_t receivedLength = 0;
1315 if (sscanf(param[1], "%d", &slotID) != 1) {
1316 return -CMDERR_BADPAR;
1318 if (param[2] != NULL) {
1319 return -CMDERR_BADPAR;
1322 memset(data, 0, sizeof(data));
1324 retVal = rpp_fr_receive_lpdu(0, slotID, data, &status, &receivedLength);
1325 if (retVal == SUCCESS) {
1327 case FR_RECEIVED_MORE_DATA_AVAILABLE:
1328 rpp_sci_printf("More messages are still in FIFO:\r\n");
1330 rpp_sci_printf("Received message (%d B):\r\n", receivedLength);
1331 for (i = 0; i < receivedLength; i++) {
1332 rpp_sci_printf(" %02x", data[i]);
1334 rpp_sci_printf("\r\n");
1337 rpp_sci_printf("No message received.\r\n");
1342 rpp_sci_printf("General error.\r\n");
1343 return -CMDERR_BADCFG;
1349 * @brief Returns TX LPdu status.
1351 * @param[in] cmd_io Pointer to IO stack
1352 * @param[in] des Pointer to command descriptor
1353 * @param[in] param Parameters of command
1354 * @return 0 when OK or error code
1356 int cmd_do_fr_checktxlpdustatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1357 int8_t retVal = ERR_PARAM_NO_ERROR;
1359 Fr_TxLPduStatusType status;
1360 char* statusStrings[] = {"is not", "is"};
1362 if (sscanf(param[1], "%d", &slotID) != 1) {
1363 return -CMDERR_BADPAR;
1365 if (param[2] != NULL) {
1366 return -CMDERR_BADPAR;
1369 retVal = rpp_fr_check_tx_lpdu_status(0, slotID, &status);
1370 if (retVal == SUCCESS) {
1371 rpp_sci_printf("Message transmission %s pending.\r\n", statusStrings[status]);
1374 rpp_sci_printf("General error.\r\n");
1375 return -CMDERR_BADCFG;
1381 * @brief Disable buffer.
1383 * @param[in] cmd_io Pointer to IO stack
1384 * @param[in] des Pointer to command descriptor
1385 * @param[in] param Parameters of command
1386 * @return 0 when OK or error code
1388 int cmd_do_fr_disablelpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1389 int8_t retVal = ERR_PARAM_NO_ERROR;
1392 if (sscanf(param[1], "%d", &slotID) != 1) {
1393 return -CMDERR_BADPAR;
1395 if (param[2] != NULL) {
1396 return -CMDERR_BADPAR;
1399 retVal = rpp_fr_disable_lpdu(0, slotID);
1400 if (retVal == SUCCESS) {
1401 rpp_sci_printf("Buffer disabled.\r\n");
1404 rpp_sci_printf("General error.\r\n");
1405 return -CMDERR_BADCFG;
1411 * @brief Print global time of the FlexRay network.
1413 * @param[in] cmd_io Pointer to IO stack
1414 * @param[in] des Pointer to command descriptor
1415 * @param[in] param Parameters of command
1416 * @return 0 when OK or error code
1418 int cmd_do_fr_getglobaltime(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1419 int8_t retVal = ERR_PARAM_NO_ERROR;
1421 uint16_t macroTick = 0;
1423 retVal = rpp_fr_get_global_time(0, &cycle, ¯oTick);
1424 if (retVal == SUCCESS) {
1425 rpp_sci_printf("Cycle number: %d\r\nMacrotick number: %d\r\n", cycle, macroTick);
1428 rpp_sci_printf("General error.\r\n");
1429 return -CMDERR_BADCFG;
1435 * @brief Print network management vector of the FlexRay node.
1437 * @param[in] cmd_io Pointer to IO stack
1438 * @param[in] des Pointer to command descriptor
1439 * @param[in] param Parameters of command
1440 * @return 0 when OK or error code
1442 int cmd_do_fr_getnmvector(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1443 int8_t retVal = ERR_PARAM_NO_ERROR;
1444 uint8_t nmVector[12];
1447 retVal = rpp_fr_get_network_management_vector(0, nmVector);
1448 if (retVal == SUCCESS) {
1449 rpp_sci_printf("Network management vector:");
1450 for (i = 0; i < Fr_cluster_config.gNetworkManagementVectorLength; i++) {
1451 rpp_sci_printf(" %x", nmVector[i]);
1453 rpp_sci_printf("\r\n");
1456 rpp_sci_printf("General error.\r\n");
1457 return -CMDERR_BADCFG;
1462 int cmd_do_fr_nmwatch(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1463 int8_t retVal = ERR_PARAM_NO_ERROR;
1464 uint8_t nmVector[12];
1467 // Calculate wait time in OS ticks
1468 static const portTickType freq_ticks = 100 /* ms */ / portTICK_RATE_MS;
1469 portTickType last_wake_time = xTaskGetTickCount();
1471 while(cmd_io->getc(cmd_io) < 0) {
1472 retVal = rpp_fr_get_network_management_vector(0, nmVector);
1473 if (retVal == SUCCESS) {
1474 rpp_sci_printf("Network management vector:");
1475 for (i = 0; i < Fr_cluster_config.gNetworkManagementVectorLength; i++) {
1476 rpp_sci_printf(" %02x", nmVector[i]);
1478 rpp_sci_printf("\r");
1481 rpp_sci_printf("General error.\r\n");
1482 return -CMDERR_BADCFG;
1484 vTaskDelayUntil(&last_wake_time, freq_ticks);
1486 rpp_sci_printf("\n");
1491 * @brief Print both channels status of the FlexRay node.
1493 * @param[in] cmd_io Pointer to IO stack
1494 * @param[in] des Pointer to command descriptor
1495 * @param[in] param Parameters of command
1496 * @return 0 when OK or error code
1498 int cmd_do_fr_getchannelstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1499 int8_t retVal = ERR_PARAM_NO_ERROR;
1502 char* decodeStrings[] = {
1503 "aggregated channel status vSS!ValidFrame",
1504 "aggregated channel status vSS!SyntaxError",
1505 "aggregated channel status vSS!ContentError",
1506 "aggregated channel status additional communication",
1507 "aggregated channel status vSS!Bviolation",
1508 "aggregated channel status vSS!TxConflict",
1511 "symbol window status data vSS!ValidMTS",
1512 "symbol window status data vSS!SyntaxError",
1513 "symbol window status data vSS!Bviolation",
1514 "symbol window status data vSS!TxConflict",
1515 "NIT status data vSS!SyntaxError",
1516 "NIT status data vSS!Bviolation",
1520 char* channelNames[] = {"A", "B"};
1521 char* boolStrings[] = {"FALSE", "TRUE"};
1522 uint16_t channelStatuses[2];
1524 retVal = rpp_fr_get_channel_status(0, &channelStatuses[0], &channelStatuses[1]);
1525 if (retVal == SUCCESS) {
1526 for (channel = 0; channel < 2; channel++) {
1527 rpp_sci_printf("Channel %s status:\r\n", channelNames[channel]);
1528 for (index = 0; index < 16; index++) {
1529 rpp_sci_printf("\t%s: %s\r\n", decodeStrings[index], boolStrings[ (channelStatuses[channel] >> index) & 0x1 ] );
1534 rpp_sci_printf("General error.\r\n");
1535 return -CMDERR_BADCFG;
1541 * @brief Print clock correction of the FlexRay node
1543 * @param[in] cmd_io Pointer to IO stack
1544 * @param[in] des Pointer to command descriptor
1545 * @param[in] param Parameters of command
1546 * @return 0 when OK or error code
1548 int cmd_do_fr_getclockcorrection(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1549 int8_t retVal = ERR_PARAM_NO_ERROR;
1550 int16_t rateCorrection;
1551 int32_t offsetCorrection;
1553 retVal = rpp_fr_get_clock_correction(0, &rateCorrection, &offsetCorrection);
1554 if (retVal == SUCCESS) {
1555 rpp_sci_printf("Rate correction: %d\r\nOffset correction: %d\r\n", rateCorrection, offsetCorrection);
1558 rpp_sci_printf("General error.\r\n");
1559 return -CMDERR_BADCFG;
1565 * @brief Print list of syncframec transmitted on both channels via the even and odd cycle.
1567 * @param[in] cmd_io Pointer to IO stack
1568 * @param[in] des Pointer to command descriptor
1569 * @param[in] param Parameters of command
1570 * @return 0 when OK or error code
1572 int cmd_do_fr_getsyncframelist(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1573 int8_t retVal = ERR_PARAM_NO_ERROR;
1574 uint16_t channelAEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1575 uint16_t channelBEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1576 uint16_t channelAOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1577 uint16_t channelBOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1578 uint32_t listSize = 0;
1581 if (sscanf(param[1], "%d", &listSize) != 1) {
1582 return -CMDERR_BADPAR;
1584 if (param[2] != NULL) {
1585 return -CMDERR_BADPAR;
1587 if (listSize > FR_MAX_SYNC_FRAME_LIST_SIZE) {
1588 return -CMDERR_BADPAR;
1591 retVal = rpp_fr_get_sync_frame_list(0, listSize, channelAEvenList, channelBEvenList, channelAOddList, channelBOddList);
1592 if (retVal == SUCCESS) {
1593 rpp_sci_printf("| Channel A even | channel B even | channel A odd | channel B odd |\r\n");
1594 rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
1595 for (i = 0; i < listSize; i++) {
1596 rpp_sci_printf("| %-14x | %-14x | %-14x | %-14x |\r\n", channelAEvenList[i], channelBEvenList[i], channelAOddList[i], channelBOddList[i]);
1598 rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
1602 rpp_sci_printf("General error.\r\n");
1603 return -CMDERR_BADCFG;
1609 * @brief Print status of wakeup on each channels (wakeup received on channel or not yet received).
1611 * @param[in] cmd_io Pointer to IO stack
1612 * @param[in] des Pointer to command descriptor
1613 * @param[in] param Parameters of command
1614 * @return 0 when OK or error code
1616 int cmd_do_fr_getwakeuprxstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1617 int8_t retVal = ERR_PARAM_NO_ERROR;
1619 char* statusStrings[] = {"was not yet", "was"};
1620 char* channelNames[] = {"A", "B"};
1623 retVal = rpp_fr_get_wakeup_rx_status(0, &status);
1624 if (retVal == SUCCESS) {
1625 for (i = 0; i < 2; i++) {
1626 rpp_sci_printf("Wake up pattern %s received on channel %s.\r\n", statusStrings[(status >> i) & 0x1], channelNames[i]);
1630 rpp_sci_printf("General error.\r\n");
1631 return -CMDERR_BADCFG;
1637 * @brief Set and start absolute timer.
1639 * @param[in] cmd_io Pointer to IO stack
1640 * @param[in] des Pointer to command descriptor
1641 * @param[in] param Parameters of command
1642 * @return 0 when OK or error code
1644 int cmd_do_fr_settimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1645 int8_t retVal = ERR_PARAM_NO_ERROR;
1650 if (sscanf(param[1], "%i %i %i", &timer, &cycle, &offset) != 3) {
1651 return -CMDERR_BADPAR;
1654 retVal = rpp_fr_set_timer(0, timer, cycle, offset);
1655 if (retVal == SUCCESS) {
1657 while (i && (cycle & i) == 0)
1662 rpp_sci_printf("Timer was set for every %d-th cycle, offset %d, macrotick %d\n",
1663 i, cycle & ~i, offset);
1666 rpp_sci_printf("General error.\r\n");
1667 return -CMDERR_BADCFG;
1673 * @brief Cancel selected timer
1675 * @param[in] cmd_io Pointer to IO stack
1676 * @param[in] des Pointer to command descriptor
1677 * @param[in] param Parameters of command
1678 * @return 0 when OK or error code
1680 int cmd_do_fr_canceltimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1681 int8_t retVal = ERR_PARAM_NO_ERROR;
1684 if (sscanf(param[1], "%d", &timer) != 1) {
1685 return -CMDERR_BADPAR;
1688 if (param[2] != NULL) {
1689 return -CMDERR_BADPAR;
1692 retVal = rpp_fr_cancel_timer(0, timer);
1693 if (retVal == SUCCESS) {
1694 rpp_sci_printf("Timer was canceled.\r\n");
1697 rpp_sci_printf("General error.\r\n");
1698 return -CMDERR_BADCFG;
1704 * @brief Enable/disable, acknowledge, get timer IRQ
1706 * @param[in] cmd_io Pointer to IO stack
1707 * @param[in] des Pointer to command descriptor
1708 * @param[in] param Parameters of command
1709 * @return 0 when OK or error code
1711 int cmd_do_fr_timerirq(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1712 int8_t retVal = ERR_PARAM_NO_ERROR;
1715 boolean_t status = FALSE;
1716 char* boolStrings[] = {"FALSE", "TRUE"};
1719 if (sscanf(param[1], "%d", &timer) != 1) {
1720 return -CMDERR_BADPAR;
1723 if (param[2] == NULL) { // Get timer IRQ
1724 retVal = rpp_fr_get_timer_irq_status(0, timer, &status);
1725 if (retVal == SUCCESS) {
1726 rpp_sci_printf("IRQ = %s\r\n", boolStrings[status]);
1729 rpp_sci_printf("General error.\r\n");
1730 return -CMDERR_BADCFG;
1733 else { // Some set action
1734 if (sscanf(param[2], "%4s", str) != 1) {
1735 return -CMDERR_BADPAR;
1737 if (strcmp(str, "EN") == 0) { // Enable IRQ
1738 retVal = SUCCESS; // No interrupts imlemented
1740 else if (strcmp(str, "DIS") == 0) { // Disable IRQ
1741 retVal = SUCCESS; // No interrupts implemented
1743 else if (strcmp(str, "ACK") == 0) { // Clear IRQ
1744 retVal = rpp_fr_clear_timer_irq(0, timer);
1746 else { // Bad argument
1747 return -CMDERR_BADPAR;
1750 if (retVal == SUCCESS) {
1751 rpp_sci_printf("OK\r\n");
1754 rpp_sci_printf("General error.\r\n");
1755 return -CMDERR_BADCFG;
1762 * @brief Print FlexRay driver version info.
1764 * @param[in] cmd_io Pointer to IO stack
1765 * @param[in] des Pointer to command descriptor
1766 * @param[in] param Parameters of command
1767 * @return 0 when OK or error code
1769 int cmd_do_fr_getversioninfo(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1770 Std_VersionInfoType versionInfo;
1772 rpp_fr_get_driver_version(&versionInfo);
1773 rpp_sci_printf("vendorID: %#x\r\n", versionInfo.vendorID);
1774 rpp_sci_printf("moduleID: %#x\r\n", versionInfo.moduleID);
1775 rpp_sci_printf("sw_major_version: %#x\r\n", versionInfo.sw_major_version);
1776 rpp_sci_printf("sw_minor_version: %#x\r\n", versionInfo.sw_minor_version);
1777 rpp_sci_printf("sw_patch_version: %#x\r\n", versionInfo.sw_patch_version);
1783 * @brief Print value of FlexRay configuratoin parameter.
1785 * @param[in] cmd_io Pointer to IO stack
1786 * @param[in] des Pointer to command descriptor
1787 * @param[in] param Parameters of command
1788 * @return 0 when OK or error code
1790 int cmd_do_fr_readcconfig(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1791 int8_t retVal = ERR_PARAM_NO_ERROR;
1795 if (sscanf(param[1], "%d", &index) != 1) {
1796 return -CMDERR_BADPAR;
1799 if (param[2] != NULL) {
1800 return -CMDERR_BADPAR;
1803 retVal = rpp_fr_read_com_ctrl_config(0, index, &value);
1804 if (retVal == SUCCESS) {
1805 rpp_sci_printf("Value = %#x\r\n", value);
1808 rpp_sci_printf("General error.\r\n");
1809 return -CMDERR_BADCFG;
1815 * @brief Reconfigure buffer
1817 * @param[in] cmd_io Pointer to IO stack
1818 * @param[in] des Pointer to command descriptor
1819 * @param[in] param Parameters of command
1820 * @return 0 when OK or error code
1822 int cmd_do_fr_reconfigure_buffer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1825 unsigned id, slot, maxpayload, cycleset;
1826 Fr_TMS570LS_BufferConfigType tmp_buffer;
1828 ret = sscanf(param[2], "id%i slot%i %2s cyc%i max%i",
1836 printf("Error parsing parameter %d\n", ret+1);
1837 return -CMDERR_BADPAR;
1840 if (slot > 2047 || id > 2047)
1841 return badpar("Invalid slot number\n");
1842 tmp_buffer.slotId = slot;
1843 if (strcmp(channel, "A") == 0) tmp_buffer.channel = FR_CHANNEL_A;
1844 else if (strcmp(channel, "B") == 0) tmp_buffer.channel = FR_CHANNEL_B;
1845 else if (strcmp(channel, "AB") == 0) tmp_buffer.channel = FR_CHANNEL_AB;
1846 else return badpar("Channel parsing error\n");
1848 if (cycleset >= 0x80)
1849 return badpar("Cycle set must be less than 0x80.\n");
1850 tmp_buffer.cycleCounterFiltering = cycleset;
1852 if (maxpayload >= 128)
1853 return badpar("Maximum payload in half-words must be less than 128\n");
1854 tmp_buffer.maxPayload = maxpayload;
1856 if (rpp_fr_reconfigure_lpdu(0, id, tmp_buffer.slotId, tmp_buffer.channel, tmp_buffer.cycleCounterFiltering, tmp_buffer.maxPayload) == SUCCESS) {
1857 printf("frbtreconfigbuf id%i slot%i %2s cyc%i max%i\n",
1867 printf("Reconfiguration failed.\n");
1869 return -CMDERR_BADPAR;
1874 /** Command descriptor for FlexRay user config cluster command */
1875 cmd_des_t const cmd_des_fr_user_config={
1877 "frbtconfig*","Set the user configuration parameters",
1878 "=== Command syntax ===\n"
1880 " frbtconfig<TYPE> <PARAMS>\n"
1882 "* <TYPE> is a string specifying the type of parameters to be set. It can be: \"cluster\" or \"node\"\n"
1883 "* <PARAMS> is a sequence of numbers separated by spaces. Each number stands for one parameter.\n"
1885 "=== Description ===\n"
1887 "The command takes the configuration parameters in the form of a string\n"
1888 "and sets the appropriate type of the FlexRay parameters. It is\n"
1889 "necessary to configure parameters of at least cluster, and node and\n"
1890 "one static buffer (see frbtcfgbuf command). The parameters set by this\n"
1891 "command are applied by the frbtinitU command. Once frbtinit is called,\n"
1892 "it is no longer possible to change the parameters.\n"
1894 "The type of the parameters can be selected by the <TYPE> selector.\n"
1896 "Type \"cluster\" sets global FlexRay network parameters. It expects a\n"
1897 "sequence of 25 parameters in this order:\n"
1898 "* 1) gColdStartAttempts\n"
1899 "* 2) gListenNoise\n"
1900 "* 3) gMacroPerCycle\n"
1901 "* 4) gMaxWithoutClockCorrectionFatal\n"
1902 "* 5) gMaxWithoutClockCorrectionPassive\n"
1903 "* 6) gNetworkManagementVectorLength\n"
1904 "* 7) gNumberOfMinislots\n"
1905 "* 8) gNumberOfStaticSlots\n"
1906 "* 9) gOffsetCorrectionStart\n"
1907 "* 10) gPayloadLengthStatic\n"
1908 "* 11) gSyncNodeMax\n"
1909 "* 12) gdActionPointOffset\n"
1910 "* 13) gdCASRxLowMax\n"
1911 "* 14) gdDynamicSlotIdlePhase\n"
1912 "* 15) gdMinislot\n"
1913 "* 16) gdMinislotActionPointOffset\n"
1915 "* 18) gdSampleClockPeriod\n"
1916 "* 19) gdStaticSlot\n"
1917 "* 20) gdTSSTransmitter\n"
1918 "* 21) gdWakeupSymbolRxIdle\n"
1919 "* 22) gdWakeupSymbolRxLow\n"
1920 "* 23) gdWakeupSymbolRxWindow\n"
1921 "* 24) gdWakeupSymbolTxIdle\n"
1922 "* 25) gdWakeupSymbolTxLow\n"
1924 "Type \"node\" sets local FlexRay network parameters. It expects a\n"
1925 "sequence of 28 parameters in this order:\n"
1926 "* 1) pAllowHaltDueToClock\n"
1927 "* 2) pAllowPassiveToActive\n"
1928 "* 3) pChannels (0 - A, 1 - B, 2 - AB)\n"
1929 "* 4) pClusterDriftDamping\n"
1930 "* 5) pDelayCompensationA\n"
1931 "* 6) pDelayCompensationB\n"
1932 "* 7) pExternOffsetCorrection\n"
1933 "* 8) pExternRateCorrection\n"
1934 "* 9) pKeySlotUsedForStartup\n"
1935 "* 10) pKeySlotUsedForSync\n"
1937 "* 12) pMacroInitialOffsetA\n"
1938 "* 13) pMacroInitialOffsetB\n"
1939 "* 14) pMicroInitialOffsetA\n"
1940 "* 15) pMicroInitialOffsetB\n"
1941 "* 16) pMicroPerCycle\n"
1942 "* 17) pRateCorrectionOut\n"
1943 "* 18) pOffsetCorrectionOut\n"
1944 "* 19) pSamplesPerMicrotick\n"
1945 "* 20) pSingleSlotEnabled\n"
1946 "* 21) pWakeupChannel (0 - A, 1 - B)\n"
1947 "* 22) pWakeupPattern\n"
1948 "* 23) pdAcceptedStartupRange\n"
1949 "* 24) pdListenTimeout\n"
1950 "* 25) pdMaxDrift\n"
1951 "* 26) pDecodingCorrection\n"
1952 "* 27) syncFramePayloadMultiplexEnabled\n"
1953 "* 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"
1957 " --> 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"
1958 " FlexRay cluster configuration accepted.\n"
1959 " --> 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"
1960 " FlexRay node configuration accepted.\n",
1961 CMD_HANDLER(cmd_do_fr_user_config), (void *)&cmd_list_fr_basic_test
1964 cmd_des_t const cmd_des_fr_config_buffer={
1966 "frbtcfgbuf?*","Configure a message buffer in the user configuration",
1967 "=== Command syntax ===\n"
1969 " frbtcfgbuf<TYPE><NUM> slot<SLOT> <CHN> cyc<CYC> <RXTX> max<MAX> <REP> ppi<PPI> int<INT>\n"
1971 "* <TYPE> is 'S' for static segment buffers and 'D' for dynamic segment buffers,\n"
1972 "* <NUM> is the number of the buffer. Both static and dynamic buffers are numbered independently starting from zero,\n"
1973 "* <SLOT> is the number of the slot,\n"
1974 "* <CHN> is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
1975 "* <CYC> is the cycle set when to send the buffer,\n"
1976 "* <RXTX> is either string \"rx\" or \"tx\",\n"
1977 "* <MAX> is the number determining the maximum payload (in hald-words),\n"
1978 "* <REP> is a string \"s\" or \"single\" for single transmission or \"c\" or \"continuous\" for continuous transmission,\n"
1979 "* <PPI> is 0 or 1 determining whether the payload preamble indicator is set,\n"
1980 "* <INT> is 0 or 1 and is currently ignored.\n"
1982 "=== Description ===\n"
1984 "The command sets the configuration parameters for static or dynamic\n"
1985 "buffers in user configuration. The parameters set by this command are\n"
1986 "applied by the frbtinitU command. Once frbtinit is called, it is no\n"
1987 "longer possible to change the parameters.\n"
1991 " --> frbtcfgbufS0 slot2 AB cyc0 tx max9 continous ppi0 int1\n"
1992 " frbtcfgbufS0 slot2 AB cyc0 tx max9 continous ppi0 int1\n"
1993 " --> frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1\n"
1994 " frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1\n"
1995 " --> frbtcfgbufD0 slot9 A cyc0 rx max0x40 single ppi0 int0\n"
1996 " frbtcfgbufD0 slot9 A cyc0 rx max64 single ppi0 int0\n"
1997 " --> frbtcfgbufD1 slot10 A cyc0 tx max0x40 single ppi0 int0\n"
1998 " frbtcfgbufD1 slot10 A cyc0 tx max64 single ppi0 int0\n",
1999 CMD_HANDLER(cmd_do_fr_config_bufer), (void *)&cmd_list_fr_basic_test
2002 cmd_des_t const cmd_des_fr_config_fifo={
2004 "frbtcfgfifo*","Configure a RX FIFO message buffer in the user configuration",
2005 "=== Command syntax ===\n"
2007 " frbtcfgfifo rejslot<SLOT> slotmask<MASK> depth<DEPTH> <CHN> cyc<CYC> max<MAX> <REJNULL> <REJSTAT>\n"
2009 "* <SLOT> is the number of the slot that will be rejected. If it is 0, no slot will be rejected,\n"
2010 "* <MASK> is a number specifying which bits of the <SLOT> will be ignored,"
2011 "* <DEPTH> is a number specifying the depth of the FIFO,\n"
2012 "* <CHN> is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
2013 "* <CYC> is the cycle set when to send the buffer,\n"
2014 "* <MAX> is the number determining the maximum payload (in hald-words),\n"
2015 "* <REJNULL> is a string \"rejnull\" for rejecting NULL frames or \"accnull\" for accepting NULL frames,\n"
2016 "* <REJSTAT> is a string \"rejstat\" for rejecting frames in static segment or \"accstat\" for accepting frames from static segment,\n"
2018 "=== Description ===\n"
2020 "The command sets the configuration parameters for RX FIFO buffer\n"
2021 "in user configuration. The parameters set by this command are\n"
2022 "applied by the frbtinitU command. Once frbtinit is called, it is no\n"
2023 "longer possible to change the parameters.\n"
2024 "Those messages, which are not accepted by any other buffer and pass the\n"
2025 "FIFO rejection filter will be stored in the RX FIFO buffer.\n"
2029 " --> frbtcfgfifo rejslot6 slotmask6 depth5 AB cyc0 max0x20 rejnull accstat\n"
2030 " frbtcfgfifo rejslot6 slotmask6 depth5 AB cyc0 max0x20 rejnull accstat\n",
2031 CMD_HANDLER(cmd_do_fr_config_fifo), (void *)&cmd_list_fr_basic_test
2034 /** Command descriptor for FlexRay init command */
2035 cmd_des_t const cmd_des_fr_init={
2037 "frbtinit?","Initialize a FlexRay node",
2038 "=== Command syntax ===\n"
2042 "where <CFG> identifies the configuration to use. It can be one of A, B\n"
2043 "or U. The A and B are predefined configurations. If U is specified,\n"
2044 "the user configuration previously set by frbtconfig command is used.\n"
2046 "=== Description ===\n"
2048 "The command stands for Fr_Init and Fr_ControllerInit functions from\n"
2049 "the Autosar specification. It initializes the internal data structures\n"
2050 "of the driver and then, based on those data, the controller\n"
2051 "configuration is done. During the controller configuration the\n"
2052 "parameters of the cluster, node, message RAM and buffers are checked.\n"
2053 "If anything goes bad, the command returns an error number, which can\n"
2054 "be decoded by macros defined in driver header file fr_tms570.h with\n"
2055 "prefix ERR_PARAM. If all parameters are OK, all necessary registers of\n"
2056 "the controller are initialized according to the specified\n"
2057 "configuration parameters. At the end of the command, the FlexRay\n"
2058 "controller is switched into READY state and all buffers are configured\n"
2059 "to send NULL frames. This command should be called as the very first\n"
2060 "command, when trying to communicate over the FlexRay bus.\n"
2065 " FlexRay driver initialized.\n"
2066 " FlexRay controller initialized.\n",
2067 CMD_HANDLER(cmd_do_fr_init), (void *)&cmd_list_fr_basic_test
2070 /** Command descriptor for FlexRay controller init command */
2071 cmd_des_t const cmd_des_fr_start={
2073 "frbtstart","Start a new FlexRay network or join to the existing one",
2074 "=== Command syntax ===\n"
2078 "=== Description ===\n"
2080 "The command stands for Fr_StartCommunication function from the Autosar\n"
2082 "If the FlexRay node is configured as a coldstarter node\n"
2083 "(as for example by frbtinitA/B command), then the command first listen\n"
2084 "on the bus. When it does not detect any existing bus communication, it\n"
2085 "tries to initiate a new network. If the initiation fails, the FlexRay\n"
2086 "controller is switched back to the ready state for another attempt\n"
2087 "(calling frbtstart again). If the FlexRay node is configured as\n"
2088 "non-coldstarter, it is listening on the bus until some existing\n"
2089 "communication is detected.\n"
2091 "The command should be called after the frbtinit command.\n"
2096 " FlexRay communication is running.\n",
2097 CMD_HANDLER(cmd_do_fr_start), (void *)&cmd_list_fr_basic_test
2100 /** Command descriptor for FlexRay controller all slots command */
2101 cmd_des_t const cmd_des_fr_allslots={
2103 "frbtallslots","Enables communication for all frames",
2104 "=== Command syntax ===\n"
2108 "=== Description ===\n"
2110 "The command stands for Fr_AllSlots function from the Autosar\n"
2113 "The node can be configured to communicate only on key frames by\n"
2114 "default (as in the case of frbtinitA/B). This command can be used to\n"
2115 "allow the communication on all configured frames. The command invokes\n"
2116 "the FlexRay POC command ALL_SLOTS which enables the communication on\n"
2117 "all frames. The command can be called after the controller\n"
2122 " --> frbtallslots\n"
2123 " FlexRay node started communication on all slots.\n",
2124 CMD_HANDLER(cmd_do_fr_allslots), (void *)&cmd_list_fr_basic_test
2127 /** Command descriptor for FlexRay controller halt command */
2128 cmd_des_t const cmd_des_fr_halt={
2130 "frbthalt","Halt FlexRay communication after the end of the actual communication cycle",
2131 "=== Command syntax ===\n"
2135 "=== Description ===\n"
2137 "The command stands for Fr_HaltCommunication function from the Autosar\n"
2138 "specification. The command invokes the FlexRay POC command HALT, which\n"
2139 "means that communication is stopped after the end of the actual\n"
2140 "communication cycle. On the opposite side, there is a frbtfreeze\n"
2141 "command, which stops the communication immediately. To restart the\n"
2142 "communication, the frbtinit and frbtstart commands have to be called.\n"
2147 " FlexRay node communication halted.\n",
2148 CMD_HANDLER(cmd_do_fr_halt), (void *)&cmd_list_fr_basic_test
2151 /** Command descriptor for FlexRay controller abort command */
2152 cmd_des_t const cmd_des_fr_abort={
2154 "frbtabort","Abort FlexRay communication immediately",
2155 "=== Command syntax ===\n"
2159 "=== Description ===\n"
2161 "The command stands for Fr_AbortCommunication function from the Autosar\n"
2162 "specification. The command invokes the FlexRay POC command FREEZE,\n"
2163 "which means that the communication is stopped immediately. On the\n"
2164 "opposite side there is a frbthalt command, which stops the\n"
2165 "communication after the end of the actual communication cycle. To\n"
2166 "restart the communication, the frbtinit and frbtstart commands have\n"
2172 " FlexRay node communication aborted.\n",
2173 CMD_HANDLER(cmd_do_fr_abort), (void *)&cmd_list_fr_basic_test
2176 /** Command descriptor for FlexRay controller send wake up pattern command */
2177 cmd_des_t const cmd_des_fr_sendwup={
2179 "frbtwup","Initiate the wake up procedure",
2180 "=== Command syntax ===\n"
2184 "=== Description ===\n"
2186 "The command stands for Fr_SendWUP function from the Autosar\n"
2187 "specification. It initiates the wake up procedure by switching FlexRay\n"
2188 "controller state machine to WAKEUP state.\n"
2193 " Wake up pattern has been sent.\n",
2194 CMD_HANDLER(cmd_do_fr_sendwup), (void *)&cmd_list_fr_basic_test
2197 /** Command descriptor for FlexRay controller sent wake up pattern channel command */
2198 cmd_des_t const cmd_des_fr_setwuchannel={
2200 "frbtsetwuch?","Set wake up channel",
2201 "=== Command syntax ===\n"
2203 " frbtsetwuch<CHANNEL>\n"
2205 "where <CHANNEL> is a character A or B, specifying the channel.\n"
2207 "=== Description ===\n"
2209 "The command stands for Fr_SetWakeupChannel function from the Autosar\n"
2210 "specification. Wake up channel is the channel, where Wake Up Pattern\n"
2211 "is sent. The channel can be set after the driver and controller are\n"
2212 "initialized and before the communication is running. The actual\n"
2213 "wake-up pattern is sent by the frbtwup command.\n"
2217 " --> frbtsetwuchA\n"
2218 " Wake up channel has been set.\n",
2219 CMD_HANDLER(cmd_do_fr_setwuchannel), (void *)&cmd_list_fr_basic_test
2222 /** Command descriptor for FlexRay controller get POC status command */
2223 cmd_des_t const cmd_des_fr_getpocstatus={
2225 "frbtgetpocst","Print FlexRay POC status",
2226 "=== Command syntax ===\n"
2230 "=== Description ===\n"
2232 "The command stands for Fr_GetPOCStatus function from the Autosar\n"
2233 "specification. It prints the main FlexRay POC status values in the\n"
2234 "form of a table. The command should be called after the frbtinit\n"
2239 " --> frbtgetpocst\n"
2241 " CHIHaltRequest: FALSE\n"
2242 " CHIReadyRequest: FALSE\n"
2243 " ColdstartNoise: FALSE\n"
2245 " ErrorMode: ACTIVE\n"
2247 " StartupState: UNDEFINED\n"
2249 " WakeupStatus: UNDEFINED\n",
2250 CMD_HANDLER(cmd_do_fr_getpocstatus), (void *)&cmd_list_fr_basic_test
2253 /** Command descriptor for FlexRay transmit tx lpdu command */
2254 cmd_des_t const cmd_des_fr_transmittxlpdu={
2256 "frbttransmit*","Transmit data in selected frame",
2257 "=== Command syntax ===\n"
2259 " frbttransmit<FRID> <DATA>\n"
2261 "* <FRID> is a decimal number specifying the ID of the frame for which a buffer has been configured.\n"
2262 "* <DATA> is a sequence of hexadecimal numbers separated by spaces. Each number represents one byte of the message.\n"
2264 "=== Description ===\n"
2266 "The command stands for Fr_TransmitTxLPdu function from the Autosar\n"
2267 "specification. The command finds the first buffer assigned to the\n"
2268 "specified frame ID and copies the given data into its data section in\n"
2269 "the message RAM. Transmit request is set after the data are copied, so\n"
2270 "transmission starts at the next occurrence of the frame in the\n"
2271 "communication cycle.\n"
2275 " --> frbttransmit1 12 34 56 AA BB CC\n"
2276 " Data were set for transmission.\n",
2277 CMD_HANDLER(cmd_do_fr_transmittxlpdu), (void *)&cmd_list_fr_basic_test
2280 /** Command descriptor for FlexRay cancel tx lpdu command */
2281 cmd_des_t const cmd_des_fr_canceltxlpdu={
2283 "frbtcanceltx*","Stop the transmission of the frame",
2284 "=== Command syntax ===\n"
2286 " frbtcanceltx<FRID>\n"
2288 "where <FRID> is a decimal number specifying the ID of the frame for\n"
2289 "which a buffer has been configured.\n"
2291 "=== Description ===\n"
2293 "The command stands for Fr_CancelTxLPdu function from the Autosar\n"
2294 "specification. The command finds all buffers assigned to the specified\n"
2295 "frame ID and reconfigures them to stop transmitting data. The command\n"
2296 "finishes successfully only if reconfiguration is allowed in message\n"
2297 "RAM configuration (secureBuffers configuration parameter). Only TX\n"
2298 "buffers and buffers not used for startup frames can be canceled.\n"
2302 " --> frbtcanceltx3\n"
2303 " Transmission canceled.\n",
2304 CMD_HANDLER(cmd_do_fr_canceltxlpdu), (void *)&cmd_list_fr_basic_test
2307 /** Command descriptor for FlexRay receive rx lpdu command */
2308 cmd_des_t const cmd_des_fr_receiverxlpdu={
2310 "frbtreceive*","Receive a new message",
2311 "=== Command syntax ===\n"
2313 " frbtreceive<FRID>\n"
2315 "where <FRID> is a decimal number specifying the ID of the frame for\n"
2316 "which a buffer was configured.\n"
2318 "=== Description ===\n"
2320 "The command stands for Fr_ReceiveRxLPdu function from the Autosar\n"
2321 "specification. The command finds the first buffer assigned to the\n"
2322 "specified frame ID, determines if a new message has been received and\n"
2323 "reads it out of the buffer. If no message was received, \"No message\n"
2324 "received\" is printed. If a new message was received, all message data\n"
2325 "are printed as a hexadecimal values. If a new message was retrieved\n"
2326 "from a FIFO buffer and more messages are available in it, \"More\n"
2327 "messages are still in FIFO\" is printed.\n"
2331 " --> frbtreceive0\n"
2332 " More messages are still in FIFO:\n"
2333 " Received message (32 B):\n"
2334 " 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",
2335 CMD_HANDLER(cmd_do_fr_receiverxlpdu), (void *)&cmd_list_fr_basic_test
2338 /** Command descriptor for FlexRay check TX LPdu status command */
2339 cmd_des_t const cmd_des_fr_checktxlpdustatus={
2341 "frbtchecktx*","Print the status of the transmit buffer",
2342 "=== Command syntax ===\n"
2344 " frbtchecktx<FRID>\n"
2346 "where <FRID> is a decimal number specifying the ID of the frame for\n"
2347 "which a buffer has been configured.\n"
2349 "=== Description ===\n"
2351 "The command stands for Fr_CheckTxLPduStatus function from the Autosar\n"
2352 "specification. The command finds the first buffer assigned to the\n"
2353 "specified frame ID, reads its status and prints it. The buffer can be\n"
2354 "in one of the two states:\n"
2355 "* 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"
2356 "* No message transmission is pending, which means that the buffer is in single shot mode and the message has already been sent.\n"
2360 " --> frbtchecktx1\n"
2361 " Message transmission is not pending.\n",
2362 CMD_HANDLER(cmd_do_fr_checktxlpdustatus), (void *)&cmd_list_fr_basic_test
2365 /** Command descriptor for FlexRay disable LPdu command */
2366 cmd_des_t const cmd_des_fr_disablelpdu={
2368 "frbtdisable*","Disable the buffers assigned to the frame",
2369 "=== Command syntax ===\n"
2371 " frbtdisable<FRID>\n"
2373 "where <FRID> is a decimal number specifying the ID of a frame. The\n"
2374 "buffers configure for this frame will be disabled.\n"
2376 "=== Description ===\n"
2378 "The command stands for Fr_DisableLPdu function from the Autosar\n"
2379 "specification. The command finds all buffers assigned to the specified\n"
2380 "frame ID and disables them. This means that those buffers will be\n"
2381 "unavailable for the communication until their reconfiguration (which\n"
2382 "is not yet implemented). Buffers used for startup frames and FIFO RX\n"
2383 "buffers cannot be disabled.\n"
2387 " --> frbtdisable3\n"
2388 " Buffer disabled.\n",
2389 CMD_HANDLER(cmd_do_fr_disablelpdu), (void *)&cmd_list_fr_basic_test
2392 /** Command descriptor for FlexRay get global time command */
2393 cmd_des_t const cmd_des_fr_getglobaltime={
2395 "frbtglobtime","Print actual global time of the network",
2396 "=== Command syntax ===\n"
2400 "=== Description ===\n"
2402 "The command stands for Fr_GetGlobalTime function from the Autosar\n"
2403 "specification. The command prints the time as a number of the current\n"
2404 "cycle and the offset in the cycle in macroticks.\n"
2408 " --> frbtglobtime\n"
2409 " Cycle number: 23\n"
2410 " Macrotick number: 6\n",
2411 CMD_HANDLER(cmd_do_fr_getglobaltime), (void *)&cmd_list_fr_basic_test
2414 /** Command descriptor for FlexRay get network management vector command */
2415 cmd_des_t const cmd_des_fr_getnmvector={
2417 "frbtnmvector","Print network management vector of the node",
2418 "=== Command syntax ===\n"
2422 "=== Description ===\n"
2424 "The command stands for Fr_GetNmVector function from the Autosar\n"
2425 "specification. It prints the values of the network management vector\n"
2426 "as hexadecimal numbers.\n"
2430 " --> frbtnmvector\n"
2431 " Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\n",
2432 CMD_HANDLER(cmd_do_fr_getnmvector), (void *)&cmd_list_fr_basic_test
2435 /** Command descriptor for FlexRay get network management vector command */
2436 cmd_des_t const cmd_des_fr_nmwatch={
2438 "frbtnmwatch","Watch the changes of the network managment vector in real-time",
2439 "=== Command syntax ===\n"
2443 "=== Description ===\n"
2445 "Reads the network management vector every 100 ms and prints it out.\n"
2449 " --> frbtnmwatch\n"
2450 " Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\n",
2451 CMD_HANDLER(cmd_do_fr_nmwatch), (void *)&cmd_list_fr_basic_test
2454 /** Command descriptor for FlexRay get channel status command */
2455 cmd_des_t const cmd_des_fr_getchannelstatus={
2457 "frbtchstat","Print channel A and B status",
2458 "=== Command syntax ===\n"
2462 "=== Description ===\n"
2464 "The command stands for Fr_GetChannelStatus function from the Autosar\n"
2470 " Channel A status:\n"
2471 " aggregated channel status vSS!ValidFrame: TRUE\n"
2472 " aggregated channel status vSS!SyntaxError: FALSE\n"
2473 " aggregated channel status vSS!ContentError: FALSE\n"
2474 " aggregated channel status additional communication: FALSE\n"
2475 " aggregated channel status vSS!Bviolation: FALSE\n"
2476 " aggregated channel status vSS!TxConflict: FALSE\n"
2477 " Not used (0): FALSE\n"
2478 " Not used (0): FALSE\n"
2479 " symbol window status data vSS!ValidMTS: FALSE\n"
2480 " symbol window status data vSS!SyntaxError: FALSE\n"
2481 " symbol window status data vSS!Bviolation: FALSE\n"
2482 " symbol window status data vSS!TxConflict: FALSE\n"
2483 " NIT status data vSS!SyntaxError: FALSE\n"
2484 " NIT status data vSS!Bviolation: FALSE\n"
2485 " Not used (0): FALSE\n"
2486 " Not used (0): FALSE\n"
2487 " Channel B status:\n"
2488 " aggregated channel status vSS!ValidFrame: TRUE\n"
2489 " aggregated channel status vSS!SyntaxError: FALSE\n"
2490 " aggregated channel status vSS!ContentError: FALSE\n"
2491 " aggregated channel status additional communication: FALSE\n"
2492 " aggregated channel status vSS!Bviolation: FALSE\n"
2493 " aggregated channel status vSS!TxConflict: FALSE\n"
2494 " Not used (0): FALSE\n"
2495 " Not used (0): FALSE\n"
2496 " symbol window status data vSS!ValidMTS: FALSE\n"
2497 " symbol window status data vSS!SyntaxError: FALSE\n"
2498 " symbol window status data vSS!Bviolation: FALSE\n"
2499 " symbol window status data vSS!TxConflict: FALSE\n"
2500 " NIT status data vSS!SyntaxError: FALSE\n"
2501 " NIT status data vSS!Bviolation: FALSE\n"
2502 " Not used (0): FALSE\n"
2503 " Not used (0): FALSE\n",
2504 CMD_HANDLER(cmd_do_fr_getchannelstatus), (void *)&cmd_list_fr_basic_test
2507 /** Command descriptor for FlexRay get clock correction command */
2508 cmd_des_t const cmd_des_fr_getclockcorrection={
2510 "frbtclkcor","Print clock correction (rate and offset)",
2511 "=== Command syntax ===\n"
2515 "=== Description ===\n"
2517 "The command stands for Fr_GetClockCorrection function from the Autosar\n"
2523 " Rate correction: 0\n"
2524 " Offset correction: 0\n",
2525 CMD_HANDLER(cmd_do_fr_getclockcorrection), (void *)&cmd_list_fr_basic_test
2528 /** Command descriptor for FlexRay get sync frame list command */
2529 cmd_des_t const cmd_des_fr_getsyncframelist={
2531 "frbtgetsyncfrlist*","Print the list of sync frames transmitted on both channels via the odd and even communication cycle",
2532 "=== Command syntax ===\n"
2534 " frbtgetsyncfrlist<LENGTH>\n"
2536 "where <LENGTH> is a decimal number in range 0 - 15, specifying the\n"
2537 "length of the list to be printed.\n"
2539 "=== Description ===\n"
2541 "The command stands for Fr_GetSyncFrameList function from the Autosar\n"
2546 " --> frbtgetsyncfrlist2\n"
2547 " | Channel A even | channel B even | channel A odd | channel B odd |\n"
2548 " |----------------|----------------|----------------|----------------|\n"
2549 " | 1 | 1 | 1 | 1 |\n"
2550 " | 2 | 2 | 2 | 2 |\n"
2551 " |----------------|----------------|----------------|----------------|\n",
2552 CMD_HANDLER(cmd_do_fr_getsyncframelist), (void *)&cmd_list_fr_basic_test
2555 /** Command descriptor for FlexRay get sync frame list command */
2556 cmd_des_t const cmd_des_fr_getwakeuprxstatus={
2558 "frbtgetwurxstat","Prints whether the wake up pattern has been or has not been received",
2559 "=== Command syntax ===\n"
2561 " frbtgetwurxstat\n"
2563 "=== Description ===\n"
2565 "The command stands for Fr_GetWakeupRxStatus function from the Autosar\n"
2566 "specification. The status of the wake up receiving is bitcoded in the\n"
2567 "controller. This command decodes and prints it in a readable format.\n"
2571 " --> frbtgetwurxstat\n"
2572 " Wake up pattern was not yet received on channel A.\n"
2573 " Wake up pattern was not yet received on channel B.\n",
2574 CMD_HANDLER(cmd_do_fr_getwakeuprxstatus), (void *)&cmd_list_fr_basic_test
2577 /** Command descriptor for FlexRay set absolute timer command */
2578 cmd_des_t const cmd_des_fr_settimer={
2580 "frbtsettimer*","Set and start timer",
2581 "=== Command syntax ===\n"
2583 " frbtsettimer<TMID> <CYCLE> <OFFSET>\n"
2585 "* <TMID> is a number (0, 1) specifying the timer.\n"
2586 "* <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"
2587 "* <OFFSET> is a decimal number (0 - 16383) specifying the offset in macroticks, where precisely in the cycle should be the timer interrupt requested.\n"
2589 "=== Description ===\n"
2591 "The command is similar to Fr_SetAbsoluteTimer function from the\n"
2592 "Autosar specification. The difference is that the command allows to\n"
2593 "specify a set of cycles, not only one of 64 cycles. It sets the timer\n"
2594 "selected by the parameter and enables it.\n"
2596 "Before using this command, FlexRay communication has to be started\n"
2597 "(see frbtstart).\n"
2601 " --> frbtsettimer0 32 50\n"
2602 " Timer was set for every 32-th cycle, offset 0, macrotick 50\n"
2603 " --> frbtsettimer0 31 50\n"
2604 " Timer was set for every 16-th cycle, offset 15, macrotick 50\n"
2605 " --> frbtsettimer0 0x42 0\n"
2606 " Timer was set for every 64-th cycle, offset 2, macrotick 0\n",
2607 CMD_HANDLER(cmd_do_fr_settimer), (void *)&cmd_list_fr_basic_test
2610 /** Command descriptor for FlexRay cancel absolute timer command */
2611 cmd_des_t const cmd_des_fr_canceltimer={
2613 "frbtcanceltimer*","Stop the timer",
2614 "=== Command syntax ===\n"
2616 " frbtcanceltimer<TMID>\n"
2617 "where <TMID> is a number (0 or 1) specifying the timer.\n"
2619 "=== Description ===\n"
2621 "The command stands for Fr_CancelAbsoluteTimer function from the\n"
2622 "Autosar specification. It stops the timer selected by the parameter.\n"
2626 " --> frbtcanceltimer0\n"
2627 " Timer was canceled.\n",
2628 CMD_HANDLER(cmd_do_fr_canceltimer), (void *)&cmd_list_fr_basic_test
2631 /** Command descriptor for FlexRay absolute timer irq manipulation command */
2632 cmd_des_t const cmd_des_fr_timerirq={
2634 "frbttimerirq*","Perform selected action on the timer IRQ",
2635 "=== Command syntax ===\n"
2637 " frbttimerirq<TMID> <ACTION> - Run the <ACTION> on specified timer\n"
2638 " frbttimerirq<TMID> - Get timer IRQ status\n"
2641 "* <TMID> is a number (0, 1) specifying the timer.\n"
2642 "* where <ACTION> is a string specifying the action to be performed on the selected timer IRQ.\n"
2644 "<ACTIONS> can be one of:\n"
2645 "* EN - Enable the IRQ on the selected timer\n"
2646 "* DIS - Disable the IRQ on the selected timer\n"
2647 "* ACK - Acknowledge the IRQ on the selected timer (reset flag in the register).\n"
2649 "=== Description ===\n"
2651 "The command stands for Fr_EnableAbsoluteTimerIRQ,\n"
2652 "Fr_AckAbsoluteTimerIRQ, Fr_DisableAbsoluteTimerIRQ and\n"
2653 "Fr_GetAbsoluteTimerIRQStatus functions from the Autosar specification.\n"
2654 "It masks or demasks the IRQ for the timer, or acknowledges the\n"
2655 "interrupt request. If no action is specified it prints whether the IRQ\n"
2656 "is pending for the timer.\n"
2660 " --> frbttimerirq0\n"
2663 " --> frbttimerirq0 EN\n"
2665 CMD_HANDLER(cmd_do_fr_timerirq), (void *)&cmd_list_fr_basic_test
2668 /** Command descriptor for FlexRay get version info command */
2669 cmd_des_t const cmd_des_fr_getversioninfo={
2671 "frbtversion","Print FlexRay driver version information",
2672 "=== Command syntax ===\n"
2676 "=== Description ===\n"
2678 "The command stands for Fr_GetVersionInfo function from the Autosar\n"
2680 "It reads and prints the information about vendor, module and version of\n"
2681 "the FlexRay driver\n"
2685 " --> frbtversion\n"
2686 " vendorID: 0xAAAA\n"
2687 " moduleID: 0xBBBB\n"
2688 " sw_major_version: 0x1\n"
2689 " sw_minor_version: 0x2\n"
2690 " sw_patch_version: 0x4\n",
2691 CMD_HANDLER(cmd_do_fr_getversioninfo), (void *)&cmd_list_fr_basic_test
2694 /** Command descriptor for FlexRay get controller configuration command */
2695 cmd_des_t const cmd_des_fr_readcconfig={
2697 "frbtccconfig*","Print value of a FlexRay cluster and node configuration parameter",
2698 "=== Command syntax ===\n"
2700 " frbtccconfig<INDEX>\n"
2702 "where <INDEX> is an identifier of the parameter.\n"
2704 "=== Description ===\n"
2706 "The command stands for Fr_ReadCCConfig function from the Autosar\n"
2707 "specification. The driver stores the configuration parameters as an\n"
2708 "array. Each parameter can be indexed and returned by this command. See\n"
2709 "Autosar specification of the FlexRay driver\n"
2710 "(http://www.autosar.org/download/R4.1/AUTOSAR_SWS_FlexRayDriver.pdf),\n"
2711 "section 8.2.1 for parameter indexes.\n"
2715 " --> frbtccconfig1\n"
2717 CMD_HANDLER(cmd_do_fr_readcconfig), (void *)&cmd_list_fr_basic_test
2720 /** Command descriptor for FlexRay reconfigure buffer command */
2721 cmd_des_t const cmd_des_fr_reconfigure_buffer={
2723 "frbtreconfigurebuf*","Reconfigure a buffer to communicate in another slot",
2724 "=== Command syntax ===\n"
2726 " frbtreconfigurebuf id<ID> slot<SLOT> <CHN> cyc<CYC> max<MAX>\n"
2728 "* <ID> is a number specifying a slot, where the buffer is currently communicating,\n"
2729 "* <SLOT> is a number, where buffer will be communicating after the reconfiguration,\n"
2730 "* <CHN> is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
2731 "* <CYC> is the cycle set when to send the buffer,\n"
2732 "* <MAX> is the number determining the maximum payload (in hald-words).\n"
2734 "=== Description ===\n"
2736 "The command stands for Fr_ReconfigLPDu function from the Autosar\n"
2737 "specification. It reconfigures specified buffer to communicate in\n"
2739 "The reconfiguration must be allowed in node configuration parameter\n"
2740 "secureBuffers. Buffers used for synchronization or assigned to the FIFO\n"
2741 "are not reconfigurable.\n"
2745 " --> frbtreconfigurebuf id2 slot3 AB 0 9\n"
2746 " frbtreconfigurebuf id2 slot3 AB 0 9\n",
2747 CMD_HANDLER(cmd_do_fr_reconfigure_buffer), (void *)&cmd_list_fr_basic_test
2751 /** List of commands for flexRay, defined as external */
2752 cmd_des_t const *cmd_list_fr_basic_test[]={
2753 &cmd_des_fr_user_config,
2754 &cmd_des_fr_config_buffer,
2755 &cmd_des_fr_config_fifo,
2758 &cmd_des_fr_allslots,
2761 &cmd_des_fr_sendwup,
2762 &cmd_des_fr_setwuchannel,
2763 &cmd_des_fr_getpocstatus,
2764 &cmd_des_fr_transmittxlpdu,
2765 &cmd_des_fr_canceltxlpdu,
2766 &cmd_des_fr_receiverxlpdu,
2767 &cmd_des_fr_checktxlpdustatus,
2768 &cmd_des_fr_disablelpdu,
2769 &cmd_des_fr_getglobaltime,
2770 &cmd_des_fr_getnmvector,
2771 &cmd_des_fr_nmwatch,
2772 &cmd_des_fr_getchannelstatus,
2773 &cmd_des_fr_getclockcorrection,
2774 &cmd_des_fr_getsyncframelist,
2775 &cmd_des_fr_getwakeuprxstatus,
2776 &cmd_des_fr_settimer,
2777 &cmd_des_fr_canceltimer,
2778 &cmd_des_fr_timerirq,
2779 &cmd_des_fr_getversioninfo,
2780 &cmd_des_fr_readcconfig,
2781 &cmd_des_fr_reconfigure_buffer,