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,
182 .msgBufferInterrupt = TRUE,
183 .payloadPreambleIndicatorTr = FALSE,
184 .rejectNullFrames = FALSE,
185 .rejectStaticSegment = FALSE,
186 .singleTransmit = FALSE,
190 .channel = FR_CHANNEL_AB,
191 .cycleCounterFiltering = 0,
194 .msgBufferInterrupt = TRUE,
195 .payloadPreambleIndicatorTr = FALSE,
196 .rejectNullFrames = FALSE,
197 .rejectStaticSegment = FALSE,
198 .singleTransmit = FALSE,
202 .channel = FR_CHANNEL_AB,
203 .cycleCounterFiltering = 0,
206 .msgBufferInterrupt = TRUE,
207 .payloadPreambleIndicatorTr = FALSE,
208 .rejectNullFrames = FALSE,
209 .rejectStaticSegment = FALSE,
210 .singleTransmit = TRUE,
214 .channel = FR_CHANNEL_AB,
215 .cycleCounterFiltering = 0,
218 .msgBufferInterrupt = TRUE,
219 .payloadPreambleIndicatorTr = FALSE,
220 .rejectNullFrames = FALSE,
221 .rejectStaticSegment = FALSE,
222 .singleTransmit = TRUE,
226 .channel = FR_CHANNEL_AB,
227 .cycleCounterFiltering = 0,
230 .msgBufferInterrupt = TRUE,
231 .payloadPreambleIndicatorTr = TRUE,
232 .rejectNullFrames = FALSE,
233 .rejectStaticSegment = FALSE,
234 .singleTransmit = FALSE,
240 static Fr_TMS570LS_BufferConfigType Fr_node_B_static_buffers_config[] = {
242 .channel = FR_CHANNEL_AB,
243 .cycleCounterFiltering = 0,
246 .msgBufferInterrupt = TRUE,
247 .payloadPreambleIndicatorTr = FALSE,
248 .rejectNullFrames = FALSE,
249 .rejectStaticSegment = FALSE,
250 .singleTransmit = FALSE,
254 .channel = FR_CHANNEL_AB,
255 .cycleCounterFiltering = 0,
258 .msgBufferInterrupt = TRUE,
259 .payloadPreambleIndicatorTr = FALSE,
260 .rejectNullFrames = FALSE,
261 .rejectStaticSegment = FALSE,
262 .singleTransmit = FALSE,
266 .channel = FR_CHANNEL_AB,
267 .cycleCounterFiltering = 0,
270 .msgBufferInterrupt = TRUE,
271 .payloadPreambleIndicatorTr = FALSE,
272 .rejectNullFrames = FALSE,
273 .rejectStaticSegment = FALSE,
274 .singleTransmit = TRUE,
278 .channel = FR_CHANNEL_AB,
279 .cycleCounterFiltering = 0,
282 .msgBufferInterrupt = TRUE,
283 .payloadPreambleIndicatorTr = FALSE,
284 .rejectNullFrames = FALSE,
285 .rejectStaticSegment = FALSE,
286 .singleTransmit = TRUE,
290 .channel = FR_CHANNEL_AB,
291 .cycleCounterFiltering = 0,
294 .msgBufferInterrupt = TRUE,
295 .payloadPreambleIndicatorTr = TRUE,
296 .rejectNullFrames = FALSE,
297 .rejectStaticSegment = FALSE,
298 .singleTransmit = FALSE,
303 static Fr_TMS570LS_BufferConfigType Fr_node_A_dynamic_buffers_config[] = {
305 .channel = FR_CHANNEL_A,
306 .cycleCounterFiltering = 0,
309 .msgBufferInterrupt = TRUE,
310 .payloadPreambleIndicatorTr = FALSE,
311 .rejectNullFrames = FALSE,
312 .rejectStaticSegment = FALSE,
313 .singleTransmit = FALSE,
317 .channel = FR_CHANNEL_B,
318 .cycleCounterFiltering = 0,
321 .msgBufferInterrupt = TRUE,
322 .payloadPreambleIndicatorTr = FALSE,
323 .rejectNullFrames = FALSE,
324 .rejectStaticSegment = FALSE,
325 .singleTransmit = FALSE,
329 .channel = FR_CHANNEL_A,
330 .cycleCounterFiltering = 0,
333 .msgBufferInterrupt = TRUE,
334 .payloadPreambleIndicatorTr = FALSE,
335 .rejectNullFrames = FALSE,
336 .rejectStaticSegment = FALSE,
337 .singleTransmit = TRUE,
343 static Fr_TMS570LS_BufferConfigType Fr_node_B_dynamic_buffers_config[] = {
345 .channel = FR_CHANNEL_B,
346 .cycleCounterFiltering = 0,
349 .msgBufferInterrupt = TRUE,
350 .payloadPreambleIndicatorTr = FALSE,
351 .rejectNullFrames = FALSE,
352 .rejectStaticSegment = FALSE,
353 .singleTransmit = TRUE,
357 .channel = FR_CHANNEL_A,
358 .cycleCounterFiltering = 0,
361 .msgBufferInterrupt = TRUE,
362 .payloadPreambleIndicatorTr = FALSE,
363 .rejectNullFrames = FALSE,
364 .rejectStaticSegment = FALSE,
365 .singleTransmit = TRUE,
369 .channel = FR_CHANNEL_A,
370 .cycleCounterFiltering = 0,
373 .msgBufferInterrupt = TRUE,
374 .payloadPreambleIndicatorTr = FALSE,
375 .rejectNullFrames = FALSE,
376 .rejectStaticSegment = FALSE,
377 .singleTransmit = TRUE,
382 static Fr_TMS570LS_BufferConfigType Fr_node_A_fifo_buffers_config[] = {
384 .channel = FR_CHANNEL_AB,
385 .cycleCounterFiltering = 0,
388 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
389 .payloadPreambleIndicatorTr = FALSE,
390 .rejectNullFrames = TRUE,
391 .rejectStaticSegment = FALSE,
392 .singleTransmit = FALSE,
396 .channel = FR_CHANNEL_AB,
397 .cycleCounterFiltering = 0,
400 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
401 .payloadPreambleIndicatorTr = FALSE,
402 .rejectNullFrames = TRUE,
403 .rejectStaticSegment = FALSE,
404 .singleTransmit = FALSE,
408 .channel = FR_CHANNEL_AB,
409 .cycleCounterFiltering = 0,
412 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
413 .payloadPreambleIndicatorTr = FALSE,
414 .rejectNullFrames = TRUE,
415 .rejectStaticSegment = FALSE,
416 .singleTransmit = FALSE,
420 .channel = FR_CHANNEL_AB,
421 .cycleCounterFiltering = 0,
424 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
425 .payloadPreambleIndicatorTr = FALSE,
426 .rejectNullFrames = TRUE,
427 .rejectStaticSegment = FALSE,
428 .singleTransmit = FALSE,
432 .channel = FR_CHANNEL_AB,
433 .cycleCounterFiltering = 0,
436 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
437 .payloadPreambleIndicatorTr = FALSE,
438 .rejectNullFrames = TRUE,
439 .rejectStaticSegment = FALSE,
440 .singleTransmit = FALSE,
445 static Fr_TMS570LS_BufferConfigType Fr_node_B_fifo_buffers_config[] = {
447 .channel = FR_CHANNEL_AB,
448 .cycleCounterFiltering = 0,
451 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
452 .payloadPreambleIndicatorTr = FALSE,
453 .rejectNullFrames = TRUE,
454 .rejectStaticSegment = FALSE,
455 .singleTransmit = FALSE,
456 .slotId = 0 // No Frame is rejected
459 .channel = FR_CHANNEL_AB,
460 .cycleCounterFiltering = 0,
463 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
464 .payloadPreambleIndicatorTr = FALSE,
465 .rejectNullFrames = TRUE,
466 .rejectStaticSegment = FALSE,
467 .singleTransmit = FALSE,
468 .slotId = 0 // No Frame is rejected
471 .channel = FR_CHANNEL_AB,
472 .cycleCounterFiltering = 0,
475 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
476 .payloadPreambleIndicatorTr = FALSE,
477 .rejectNullFrames = TRUE,
478 .rejectStaticSegment = FALSE,
479 .singleTransmit = FALSE,
480 .slotId = 0 // No Frame is rejected
483 .channel = FR_CHANNEL_AB,
484 .cycleCounterFiltering = 0,
487 .msgBufferInterrupt = FALSE, // Recommended for FIFO buffers
488 .payloadPreambleIndicatorTr = FALSE,
489 .rejectNullFrames = TRUE,
490 .rejectStaticSegment = FALSE,
491 .singleTransmit = FALSE,
492 .slotId = 0 // No Frame is rejected
495 .channel = FR_CHANNEL_AB,
496 .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
509 * This is an unifying configuration structure for the node A.
510 * It joins all the configuration structure together.
512 static Fr_ConfigType Fr_config_node_A= {
513 .clusterConfiguration = &Fr_cluster_config,
514 .dynamicBufferConfigs = Fr_node_A_dynamic_buffers_config,
515 .fifoBufferConfigs = Fr_node_A_fifo_buffers_config,
516 .msgRAMConfig = &Fr_node_A_msgRAM_config,
517 .nodeConfiguration = &Fr_node_A_config,
518 .staticBufferConfigs = Fr_node_A_static_buffers_config
522 * This is an unifying configuration structure for the node A.
523 * It joins all the configuration structure together.
525 static Fr_ConfigType Fr_config_node_B= {
526 .clusterConfiguration = &Fr_cluster_config,
527 .dynamicBufferConfigs = Fr_node_B_dynamic_buffers_config,
528 .fifoBufferConfigs = Fr_node_B_fifo_buffers_config,
529 .msgRAMConfig = &Fr_node_B_msgRAM_config,
530 .nodeConfiguration = &Fr_node_B_config,
531 .staticBufferConfigs = Fr_node_B_static_buffers_config
534 /* User configuration */
536 static Fr_TMS570LS_ClusterConfigType user_cluster_config;
537 static Fr_TMS570LS_NodeConfigType user_node_config;
538 static Fr_TMS570LS_MsgRAMConfig user_msg_ram_config;
539 static Fr_TMS570LS_BufferConfigType user_static_buffer_config[RPP_FR_MAX_STATIC_BUF_CNT];
540 static Fr_TMS570LS_BufferConfigType user_dynamic_buffer_config[RPP_FR_MAX_DYNAMIC_BUF_CNT];
541 static Fr_TMS570LS_BufferConfigType user_fifo_buffer_config[RPP_FR_MAX_FIFO_BUF_DEPTH];
542 static Fr_ConfigType user_configuration = {
543 .clusterConfiguration = &user_cluster_config,
544 .nodeConfiguration = &user_node_config,
545 .msgRAMConfig = &user_msg_ram_config,
546 .staticBufferConfigs = user_static_buffer_config,
547 .dynamicBufferConfigs = user_dynamic_buffer_config,
548 .fifoBufferConfigs = user_fifo_buffer_config,
551 #define USER_CONFIG_NOT_DONE 0x0
552 #define USER_CONFIG_CLUSTER 0x1
553 #define USER_CONFIG_NODE 0x2
555 static uint8_t user_configuration_state = USER_CONFIG_NOT_DONE;
556 static uint8_t user_static_buffer_configured = 0;
557 static uint8_t user_dynamic_buffer_configured = 0;
558 static uint8_t user_fifo_buffer_depth = 0;
561 * Split string into numbers
563 * The function takes a string with hexadecimal numbers,
564 * separated by spaces, and converts it into an array of numbers.
566 * For example "0x2 0xA 0XDD 0xABCD" -> {0x2, 0xA, 0XDD, 0xABCD}
568 * @param [in] params Address of the string which will be converted
569 * @param [in] params_cnt A number of parameters, which should be found and converted from the string params
570 * @param [out] tmp_params Address, where converted array of numbers will be stored
572 * @return SUCCESS when all parameters were converted to the array of numbers,
573 * FAILURE when the string was too short, too long or some other error occurred.
575 static int8_t cmd_fr_parse_params(const char* params, uint32_t params_cnt, uint32_t* tmp_params) {
576 char cpy_params[256];
580 if (params == NULL || tmp_params == NULL) {
583 strncpy(cpy_params, params, 256);
584 token = strtok(cpy_params, " ");
588 for (i = 0; i < params_cnt; i++) {
589 if (sscanf(token, "%i", &tmp_params[i]) == EOF) { // No number found
592 if ((token = strtok(NULL, " ")) == NULL && i < params_cnt-1) { // Not enough parameters in the string
599 int8_t cmd_fr_config_cluster_params(const char* params) {
600 uint32_t tmp_params[FR_CLUSTER_PARAMS_CNT];
602 if (cmd_fr_parse_params(params, FR_CLUSTER_PARAMS_CNT, tmp_params) == FAILURE) {
606 user_cluster_config.gColdStartAttempts = tmp_params[0];
607 user_cluster_config.gListenNoise = tmp_params[1];
608 user_cluster_config.gMacroPerCycle = tmp_params[2];
609 user_cluster_config.gMaxWithoutClockCorrectionFatal = tmp_params[3];
610 user_cluster_config.gMaxWithoutClockCorrectionPassive = tmp_params[4];
611 user_cluster_config.gNetworkManagementVectorLength = tmp_params[5];
612 user_cluster_config.gNumberOfMinislots = tmp_params[6];
613 user_cluster_config.gNumberOfStaticSlots = tmp_params[7];
614 user_cluster_config.gOffsetCorrectionStart = tmp_params[8];
615 user_cluster_config.gPayloadLengthStatic = tmp_params[9];
616 user_cluster_config.gSyncNodeMax = tmp_params[10];
617 user_cluster_config.gdActionPointOffset = tmp_params[11];
618 user_cluster_config.gdCASRxLowMax = tmp_params[12];
619 user_cluster_config.gdDynamicSlotIdlePhase = tmp_params[13];
620 user_cluster_config.gdMinislot = tmp_params[14];
621 user_cluster_config.gdMinislotActionPointOffset = tmp_params[15];
622 user_cluster_config.gdNIT = tmp_params[16];
623 user_cluster_config.gdSampleClockPeriod = tmp_params[17];
624 user_cluster_config.gdStaticSlot = tmp_params[18];
625 user_cluster_config.gdTSSTransmitter = tmp_params[19];
626 user_cluster_config.gdWakeupSymbolRxIdle = tmp_params[20];
627 user_cluster_config.gdWakeupSymbolRxLow = tmp_params[21];
628 user_cluster_config.gdWakeupSymbolRxWindow = tmp_params[22];
629 user_cluster_config.gdWakeupSymbolTxIdle = tmp_params[23];
630 user_cluster_config.gdWakeupSymbolTxLow = tmp_params[24];
632 user_configuration_state |= USER_CONFIG_CLUSTER;
636 int8_t cmd_fr_config_node_params(const char* params) {
637 uint32_t tmp_params[FR_NODE_PARAMS_CNT+2]; // +2 because two more parameters from message RAM structure are expected in the string.
638 Fr_ChannelType channels[3] = {FR_CHANNEL_A, FR_CHANNEL_B, FR_CHANNEL_AB};
639 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};
641 if (cmd_fr_parse_params(params, FR_NODE_PARAMS_CNT+2, tmp_params) == FAILURE) {
645 user_node_config.pAllowHaltDueToClock = tmp_params[0];
646 user_node_config.pAllowPassiveToActive = tmp_params[1];
647 if (tmp_params[2] > 2) return FAILURE;
648 user_node_config.pChannels = channels[ tmp_params[2] ];
649 user_node_config.pClusterDriftDamping = tmp_params[3];
650 user_node_config.pDelayCompensationA = tmp_params[4];
651 user_node_config.pDelayCompensationB = tmp_params[5];
652 user_node_config.pExternOffsetCorrection = tmp_params[6];
653 user_node_config.pExternRateCorrection = tmp_params[7];
654 user_node_config.pKeySlotUsedForStartup = tmp_params[8];
655 user_node_config.pKeySlotUsedForSync = tmp_params[9];
656 user_node_config.pLatestTx = tmp_params[10];
657 user_node_config.pMacroInitialOffsetA = tmp_params[11];
658 user_node_config.pMacroInitialOffsetB = tmp_params[12];
659 user_node_config.pMicroInitialOffsetA = tmp_params[13];
660 user_node_config.pMicroInitialOffsetB = tmp_params[14];
661 user_node_config.pMicroPerCycle = tmp_params[15];
662 user_node_config.pRateCorrectionOut = tmp_params[16];
663 user_node_config.pOffsetCorrectionOut = tmp_params[17];
664 user_node_config.pSamplesPerMicrotick = tmp_params[18];
665 user_node_config.pSingleSlotEnabled = tmp_params[19];
666 if (tmp_params[20] > 1) return FAILURE;
667 user_node_config.pWakeupChannel = channels[ tmp_params[20] ];
668 user_node_config.pWakeupPattern = tmp_params[21];
669 user_node_config.pdAcceptedStartupRange = tmp_params[22];
670 user_node_config.pdListenTimeout = tmp_params[23];
671 user_node_config.pdMaxDrift = tmp_params[24];
672 user_node_config.pDecodingCorrection = tmp_params[25];
673 user_msg_ram_config.syncFramePayloadMultiplexEnabled = tmp_params[26];
674 if (tmp_params[27] > 3) return FAILURE;
675 user_msg_ram_config.secureBuffers = secure[ tmp_params[27] ];
677 user_configuration_state |= USER_CONFIG_NODE;
681 int cmd_do_fr_config_fifo(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
682 Fr_TMS570LS_BufferConfigType* fifo_buffer_ptr = &user_fifo_buffer_config[0];
684 char channel[3], rej_static_frames[8], rej_null_frames[8];
685 unsigned depth, slot, cycleset, maxpayload;
686 Fr_TMS570LS_BufferConfigType tmp_buffer;
688 if (fr_initialized) {
689 rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
690 return -CMDERR_BADCFG;
693 ret = sscanf(param[2], "slot%i depth%i %2s cyc%i max%i %10s %10s",
703 printf("Error parsing parameter %d\n", ret+1);
704 return -CMDERR_BADPAR;
707 if (depth < 1 || depth >= RPP_FR_MAX_FIFO_BUF_DEPTH)
708 return badpar("Depth too high\n");
709 user_fifo_buffer_depth = depth;
712 return badpar("Invalid slot number\n");
713 tmp_buffer.slotId = slot;
714 if (strcmp(channel, "A") == 0) tmp_buffer.channel = FR_CHANNEL_A;
715 else if (strcmp(channel, "B") == 0) tmp_buffer.channel = FR_CHANNEL_B;
716 else if (strcmp(channel, "AB") == 0) tmp_buffer.channel = FR_CHANNEL_AB;
717 else return badpar("Channel parsing error\n");
719 if (cycleset >= 0x80)
720 return badpar("Cycle set must be less than 0x80.\n");
721 tmp_buffer.cycleCounterFiltering = cycleset;
723 if (maxpayload >= 128)
724 return badpar("Maximum payload in half-words must be less than 128\n");
725 tmp_buffer.maxPayload = maxpayload;
727 if (strcmp(rej_null_frames, "rejnull") == 0) tmp_buffer.rejectNullFrames = true;
728 else if (strcmp(rej_null_frames, "accnull") == 0) tmp_buffer.rejectNullFrames = false;
729 else return badpar("Reject/accept NULL frames parsing error\n");
731 if (strcmp(rej_static_frames, "rejstat") == 0)
732 tmp_buffer.rejectStaticSegment = true;
733 else if (strcmp(rej_static_frames, "accstat") == 0)
734 tmp_buffer.rejectStaticSegment = false;
735 else return badpar("Invalid reject/accept static frame parameter");
737 for (i = 0; i < user_fifo_buffer_depth; i++) {
738 fifo_buffer_ptr[i].slotId = tmp_buffer.slotId;
739 fifo_buffer_ptr[i].maxPayload = tmp_buffer.maxPayload;
740 fifo_buffer_ptr[i].channel= tmp_buffer.channel;
741 fifo_buffer_ptr[i].cycleCounterFiltering = tmp_buffer.cycleCounterFiltering;
742 fifo_buffer_ptr[i].isTx = FALSE;
743 fifo_buffer_ptr[i].singleTransmit = FALSE;
744 fifo_buffer_ptr[i].payloadPreambleIndicatorTr = FALSE;
745 fifo_buffer_ptr[i].rejectNullFrames = tmp_buffer.rejectNullFrames;
746 fifo_buffer_ptr[i].rejectStaticSegment = tmp_buffer.rejectStaticSegment;
747 fifo_buffer_ptr[i].msgBufferInterrupt = 0;
750 printf("frbtcfgfifo slot%i depth%i %2s cyc%i max%i %10s %10s\n",
763 int cmd_do_fr_config_bufer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
765 Fr_TMS570LS_BufferConfigType *cfg;
768 char buf_type, channel[3],rxtx[3], single_continuous[11];
769 unsigned buffer, slot, cycleset, maxpayload, intr, preamb;
771 if (fr_initialized) {
772 rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
773 return -CMDERR_BADCFG;
776 ret = sscanf(param[1], "%c%i slot%i %2s cyc%i %2s max%i %10s ppi%i int%i",
789 printf("Error parsing parameter %d\n", ret+1);
790 return -CMDERR_BADPAR;
796 if (buffer >= RPP_FR_MAX_STATIC_BUF_CNT)
797 return badpar("Buffer index too high\n");
798 cfg = &user_static_buffer_config[buffer];
801 if (buffer >= RPP_FR_MAX_DYNAMIC_BUF_CNT)
802 return badpar("Buffer index too high\n");
803 cfg = &user_dynamic_buffer_config[buffer];
806 return badpar("Invalid buffer type (S, D)\n");
809 if (slot < 1 || slot > 2047)
810 return badpar("Invalid slot number\n");
813 if (strcmp(channel, "A") == 0) cfg->channel = FR_CHANNEL_A;
814 else if (strcmp(channel, "B") == 0) cfg->channel = FR_CHANNEL_B;
815 else if (strcmp(channel, "AB") == 0) cfg->channel = FR_CHANNEL_AB;
816 else return badpar("Channel parsing error\n");
817 if (buf_type == 'D' && cfg->channel == FR_CHANNEL_AB)
818 return badpar("Dynamic segment buffers cannot have AB channels.\n");
820 if (cycleset >= 0x80)
821 return badpar("Cycle set must be less than 0x80.\n");
822 cfg->cycleCounterFiltering = cycleset;
824 if (strcmp(rxtx, "tx") == 0) cfg->isTx = true;
825 else if (strcmp(rxtx, "rx") == 0) cfg->isTx = false;
826 else return badpar("RX/TX parsing error\n");
828 if (maxpayload >= 128)
829 return badpar("Maximum payload in half-words must be less than 128\n");
830 cfg->maxPayload = maxpayload;
832 if (0 == strcmp(single_continuous, "single") ||
833 0 == strcmp(single_continuous, "s"))
834 cfg->singleTransmit = true;
835 else if (0 == strcmp(single_continuous, "continuous") ||
836 0 == strcmp(single_continuous, "c"))
837 cfg->singleTransmit = false;
838 else return badpar("Invalid single/continuous parameter");
841 return badpar("Payload preamble indicator must be 0 or 1");
842 cfg->payloadPreambleIndicatorTr = preamb;
845 return badpar("Interrupt parameter must be 0 or 1");
846 cfg->msgBufferInterrupt = intr;
850 if (buffer >= user_static_buffer_configured)
851 user_static_buffer_configured = buffer + 1;
854 if (buffer >= user_dynamic_buffer_configured)
855 user_dynamic_buffer_configured = buffer + 1;
859 printf("frbtcfgbuf%c%i slot%i %2s cyc%i %2s max%i %10s ppi%i int%i\n",
878 * @brief Do the user configuration of the FlexRay cluster parameters
880 * @param[in] cmd_io Pointer to IO stack
881 * @param[in] des Pointer to command descriptor
882 * @param[in] param Parameters of command
883 * @return 0 when OK or error code
885 int cmd_do_fr_user_config(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
888 if (fr_initialized) {
889 rpp_sci_printf("FlexRay configuration can not be modified after frbtinit was called.\n");
890 return -CMDERR_BADCFG;
893 token = strtok(param[1], " ");
894 if (strcmp(token, "cluster") == 0) {
895 if (cmd_fr_config_cluster_params(param[2]) == FAILURE) {
896 rpp_sci_printf("FlexRay cluster configuration not accepted.\n");
897 return -CMDERR_BADPAR;
899 rpp_sci_printf("FlexRay cluster configuration accepted.\n");
901 else if (strcmp(token, "node") == 0) {
902 if (cmd_fr_config_node_params(param[2]) == FAILURE) {
903 rpp_sci_printf("FlexRay node configuration not accepted.\n");
904 return -CMDERR_BADPAR;
906 rpp_sci_printf("FlexRay node configuration accepted.\n");
909 return -CMDERR_BADPAR;
916 * @brief Initialize the device as FlexRay node.
918 * @param[in] cmd_io Pointer to IO stack
919 * @param[in] des Pointer to command descriptor
920 * @param[in] param Parameters of command
921 * @return 0 when OK or error code
923 int cmd_do_fr_init(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
924 const Fr_ConfigType* Fr_ConfigPtr = NULL;
925 int8_t retVal = SUCCESS;
926 uint32_t error = ERR_PARAM_NO_ERROR;
928 if (*param[1] == 'A') {
929 Fr_ConfigPtr = &Fr_config_node_A;
931 else if (*param[1] == 'B') {
932 Fr_ConfigPtr = &Fr_config_node_B;
934 else if (*param[1] == 'U') { // Select the user configuration - call config commands first
935 user_msg_ram_config.statSegmentBufferCount = user_static_buffer_configured;
936 user_msg_ram_config.dynSegmentBufferCount = user_dynamic_buffer_configured;
937 user_msg_ram_config.fifoBufferCount= user_fifo_buffer_depth;
938 Fr_ConfigPtr = &user_configuration;
941 return -CMDERR_BADPAR;
944 retVal = rpp_fr_init_driver(Fr_ConfigPtr, &error);
945 if (retVal == SUCCESS) {
946 rpp_sci_printf("FlexRay driver initialized.\r\n");
947 fr_initialized = TRUE;
950 retVal = rpp_fr_init_controller(0, &error);
951 if (retVal == SUCCESS) {
952 rpp_sci_printf("FlexRay controller reinitialized.\r\n");
956 rpp_sci_printf("FlexRay needs to be configured before initialization.\r\n");
957 return -CMDERR_BADCFG;
961 retVal = rpp_fr_init_controller(0, &error);
962 if (retVal == SUCCESS) {
963 rpp_sci_printf("FlexRay controller initialized.\r\n");
966 if (error & FR_INIT_ERR_CLUSTER_CONFIG) {
967 rpp_sci_printf("Cluster configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
969 else if (error & FR_INIT_ERR_NODE_CONFIG) {
970 rpp_sci_printf("Node configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
972 else if (error & FR_INIT_ERR_MSGRAM_CONFIG) {
973 rpp_sci_printf("Message RAM configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
975 else if (error & FR_INIT_ERR_BUFFPARAM_CONFIG) {
976 rpp_sci_printf("Buffer configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
978 else if (error & (uint32_t)FR_INIT_ERR_BUFF_CONFIG) {
979 rpp_sci_printf("Buffer configuration error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
982 rpp_sci_printf("POC state switching error.\r\n");
984 return -CMDERR_BADCFG;
990 * @brief Starts FlexRay communication
992 * @param[in] cmd_io Pointer to IO stack
993 * @param[in] des Pointer to command descriptor
994 * @param[in] param Parameters of command
995 * @return 0 when OK or error code
997 int cmd_do_fr_start(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
998 int8_t retVal = SUCCESS;
999 uint32_t error = ERR_PARAM_NO_ERROR;
1001 retVal = rpp_fr_start_communication(0, &error);
1002 if (retVal == SUCCESS) {
1003 rpp_sci_printf("FlexRay communication is running.\r\n");
1006 if (error & FR_STARTUP_ERR_SW_STUP_FOLLOW) {
1007 rpp_sci_printf("Can not switch POC to RUN state.\r\n");
1009 else if (error & FR_STARTUP_ERR_CSINH_DIS) {
1010 rpp_sci_printf("Cold start inhibit disabled error.\r\n");
1012 else if (error & FR_STARTUP_ERR_SW_STUP_READY) {
1013 rpp_sci_printf("Can not switch back to READY from STARTUP.\r\n");
1015 else if (error & FR_STARTUP_ERR_SW_STUP_AS_NCOLD) {
1016 rpp_sci_printf("Can not switch to STARTUP as non-coldstarter.\r\n");
1019 rpp_sci_printf("General error.\r\n");
1021 return -CMDERR_BADCFG;
1027 * @brief Invokes POC command ALL_SLOTS
1029 * @param[in] cmd_io Pointer to IO stack
1030 * @param[in] des Pointer to command descriptor
1031 * @param[in] param Parameters of command
1032 * @return 0 when OK or error code
1034 int cmd_do_fr_allslots(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1035 int8_t retVal = ERR_PARAM_NO_ERROR;
1036 retVal = rpp_fr_all_slots(0);
1037 if (retVal == SUCCESS) {
1038 rpp_sci_printf("FlexRay node started communication in all slots.\r\n");
1041 rpp_sci_printf("General error.\r\n");
1042 return -CMDERR_BADCFG;
1048 * @brief Halt FlexRay communication
1050 * @param[in] cmd_io Pointer to IO stack
1051 * @param[in] des Pointer to command descriptor
1052 * @param[in] param Parameters of command
1053 * @return 0 when OK or error code
1055 int cmd_do_fr_halt(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1056 int8_t retVal = ERR_PARAM_NO_ERROR;
1057 retVal = rpp_fr_halt_communication(0);
1058 if (retVal == SUCCESS) {
1059 rpp_sci_printf("FlexRay node communication halted.\r\n");
1062 rpp_sci_printf("General error.\r\n");
1063 return -CMDERR_BADCFG;
1069 * @brief Abort FlexRay communication
1071 * @param[in] cmd_io Pointer to IO stack
1072 * @param[in] des Pointer to command descriptor
1073 * @param[in] param Parameters of command
1074 * @return 0 when OK or error code
1076 int cmd_do_fr_abort(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1077 int8_t retVal = ERR_PARAM_NO_ERROR;
1078 retVal = rpp_fr_abort_communication(0);
1079 if (retVal == SUCCESS) {
1080 rpp_sci_printf("FlexRay node communication aborted.\r\n");
1083 rpp_sci_printf("General error.\r\n");
1084 return -CMDERR_BADCFG;
1090 * @brief Send wake up pattern
1092 * @param[in] cmd_io Pointer to IO stack
1093 * @param[in] des Pointer to command descriptor
1094 * @param[in] param Parameters of command
1095 * @return 0 when OK or error code
1097 int cmd_do_fr_sendwup(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1098 int8_t retVal = ERR_PARAM_NO_ERROR;
1099 retVal = rpp_fr_send_wup(0);
1100 if (retVal == SUCCESS) {
1101 rpp_sci_printf("Wake up pattern has been sent.\r\n");
1104 rpp_sci_printf("General error.\r\n");
1105 return -CMDERR_BADCFG;
1111 * @brief Set channel for wake up pattern sending.
1113 * @param[in] cmd_io Pointer to IO stack
1114 * @param[in] des Pointer to command descriptor
1115 * @param[in] param Parameters of command
1116 * @return 0 when OK or error code
1118 int cmd_do_fr_setwuchannel(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1119 int8_t retVal = ERR_PARAM_NO_ERROR;
1120 Fr_ChannelType channel = FR_CHANNEL_A;
1122 if (*param[1] == 'A') {
1123 channel = FR_CHANNEL_A;
1125 else if (*param[1] == 'B') {
1126 channel = FR_CHANNEL_B;
1129 return -CMDERR_BADPAR;
1131 retVal = rpp_fr_set_wu_channel(0, channel);
1132 if (retVal == SUCCESS) {
1133 rpp_sci_printf("Wake up channel has been set.\r\n");
1136 rpp_sci_printf("General error.\r\n");
1137 return -CMDERR_BADCFG;
1143 * @brief Get and print POC status of the FlexRay controller.
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_getpocstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1151 int8_t retVal = ERR_PARAM_NO_ERROR;
1152 Fr_POCStatusType status;
1153 char* ErrorModeStrings[] = {"ACTIVE", "HALT", "PASSIVE"};
1154 char* SlotModeStrings[] = {"KEYSLOT", "ALL_PENDING", "ALL"};
1155 char* StartupStateStrings[] = {
1156 "UNDEFINED", "COLDSTART_LISTEN", "COLDSTART_CHECK", "COLDSTART_JOIN",
1157 "COLDSTART_CONSISTENCY_CHECK", "INTEGRATION_LISTEN", "INITIALIZE_SCHEDULE", "INTEGRATION_CONSISTENCY_CHECK",
1158 "COLDSTART_GAP", "EXTERNAL_STARTUP", "ABORT", "COLDSTART_COLLISION_RESOLUTION",
1161 char* StateStrings[] = {
1162 "CONFIG", "DEFAULT_CONFIG", "HALT", "NORMAL_ACTIVE",
1163 "NORMAL_PASSIVE", "READY", "STARTUP", "LOOPBACK",
1166 char* WakeupStatusStrings[] = {
1167 "UNDEFINED", "RECEIVED_HEADER", "RECEIVED_WUP", "COLLISION_HEADER",
1168 "COLLISION_WUP", "COLLISION_UNKNOWN", "TRANSMITTED"
1171 retVal = rpp_fr_get_poc_status(0, &status);
1172 if (retVal == SUCCESS) {
1173 rpp_sci_printf("POC status:\r\n");
1174 rpp_sci_printf("CHIHaltRequest: %s\r\n", (status.CHIHaltRequest == TRUE) ? "TRUE" : "FALSE");
1175 rpp_sci_printf("CHIReadyRequest: %s\r\n", (status.CHIReadyRequest == TRUE) ? "TRUE" : "FALSE");
1176 rpp_sci_printf("ColdstartNoise: %s\r\n", (status.ColdstartNoise == TRUE) ? "TRUE" : "FALSE");
1177 rpp_sci_printf("Freeze: %s\r\n", (status.Freeze == TRUE) ? "TRUE" : "FALSE");
1178 rpp_sci_printf("ErrorMode: %s\r\n", ErrorModeStrings[status.ErrorMode]);
1179 rpp_sci_printf("SlotMode: %s\r\n", SlotModeStrings[status.SlotMode]);
1180 rpp_sci_printf("StartupState: %s\r\n", StartupStateStrings[status.StartupState]);
1181 rpp_sci_printf("State: %s\r\n", StateStrings[status.State]);
1182 rpp_sci_printf("WakeupStatus: %s\r\n", WakeupStatusStrings[status.WakeupStatus]);
1185 rpp_sci_printf("General error.\r\n");
1186 return -CMDERR_BADCFG;
1192 * @brief Send given data through the FlexRay in selected slot.
1194 * @param[in] cmd_io Pointer to IO stack
1195 * @param[in] des Pointer to command descriptor
1196 * @param[in] param Parameters of command
1197 * @return 0 when OK or error code
1199 int cmd_do_fr_transmittxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1200 int8_t retVal = ERR_PARAM_NO_ERROR;
1203 int values[MAX_PARAM_VALUES_NUM];
1204 uint8_t data[MAX_PARAM_VALUES_NUM];
1207 if (sscanf(param[1], "%d", &slotID) != 1) {
1208 return -CMDERR_BADPAR;
1210 if (sscanf(param[2], " %2x", &values[0]) != 1) {
1211 return -CMDERR_BADPAR;
1213 data[0] = (uint8_t)values[0];
1214 token = strtok(param[2], " ");
1215 token = strtok(NULL, " ");
1217 while (dataLength < MAX_PARAM_VALUES_NUM && token != NULL) {
1218 if (sscanf(token, "%2x", &values[dataLength]) == EOF) {
1221 data[dataLength] = (uint8_t)values[dataLength];
1222 token = strtok(NULL, " ");
1226 retVal = rpp_fr_transmit_lpdu(0, slotID, data, dataLength);
1227 if (retVal == SUCCESS) {
1228 rpp_sci_printf("Data were set for transmission.\r\n");
1231 rpp_sci_printf("General error.\r\n");
1232 return -CMDERR_BADCFG;
1238 * @brief Cancel the transmission in the selected slot.
1240 * @param[in] cmd_io Pointer to IO stack
1241 * @param[in] des Pointer to command descriptor
1242 * @param[in] param Parameters of command
1243 * @return 0 when OK or error code
1245 int cmd_do_fr_canceltxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1246 int8_t retVal = ERR_PARAM_NO_ERROR;
1249 if (sscanf(param[1], "%d", &slotID) != 1) {
1250 return -CMDERR_BADPAR;
1252 if (param[2] != NULL) {
1253 return -CMDERR_BADPAR;
1256 retVal = rpp_fr_cancel_transmit_lpdu(0, slotID);
1257 if (retVal == SUCCESS) {
1258 rpp_sci_printf("Transmission canceled.\r\n");
1261 rpp_sci_printf("General error.\r\n");
1262 return -CMDERR_BADCFG;
1268 * @brief Receive data from selected slot.
1270 * @param[in] cmd_io Pointer to IO stack
1271 * @param[in] des Pointer to command descriptor
1272 * @param[in] param Parameters of command
1273 * @return 0 when OK or error code
1275 int cmd_do_fr_receiverxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1276 int8_t retVal = ERR_PARAM_NO_ERROR;
1278 uint8_t data[cPayloadLengthMax];
1279 Fr_RxLPduStatusType status;
1280 uint8_t receivedLength = 0;
1283 if (sscanf(param[1], "%d", &slotID) != 1) {
1284 return -CMDERR_BADPAR;
1286 if (param[2] != NULL) {
1287 return -CMDERR_BADPAR;
1290 memset(data, 0, sizeof(data));
1292 retVal = rpp_fr_receive_lpdu(0, slotID, data, &status, &receivedLength);
1293 if (retVal == SUCCESS) {
1295 case FR_RECEIVED_MORE_DATA_AVAILABLE:
1296 rpp_sci_printf("More messages are still in FIFO:\r\n");
1298 rpp_sci_printf("Received message (%d B):\r\n", receivedLength);
1299 for (i = 0; i < receivedLength; i++) {
1300 rpp_sci_printf(" %02x", data[i]);
1302 rpp_sci_printf("\r\n");
1305 rpp_sci_printf("No message received.\r\n");
1310 rpp_sci_printf("General error.\r\n");
1311 return -CMDERR_BADCFG;
1317 * @brief Returns TX LPdu status.
1319 * @param[in] cmd_io Pointer to IO stack
1320 * @param[in] des Pointer to command descriptor
1321 * @param[in] param Parameters of command
1322 * @return 0 when OK or error code
1324 int cmd_do_fr_checktxlpdustatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1325 int8_t retVal = ERR_PARAM_NO_ERROR;
1327 Fr_TxLPduStatusType status;
1328 char* statusStrings[] = {"is not", "is"};
1330 if (sscanf(param[1], "%d", &slotID) != 1) {
1331 return -CMDERR_BADPAR;
1333 if (param[2] != NULL) {
1334 return -CMDERR_BADPAR;
1337 retVal = rpp_fr_check_tx_lpdu_status(0, slotID, &status);
1338 if (retVal == SUCCESS) {
1339 rpp_sci_printf("Message transmission %s pending.\r\n", statusStrings[status]);
1342 rpp_sci_printf("General error.\r\n");
1343 return -CMDERR_BADCFG;
1349 * @brief Disable buffer.
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_disablelpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1357 int8_t retVal = ERR_PARAM_NO_ERROR;
1360 if (sscanf(param[1], "%d", &slotID) != 1) {
1361 return -CMDERR_BADPAR;
1363 if (param[2] != NULL) {
1364 return -CMDERR_BADPAR;
1367 retVal = rpp_fr_disable_lpdu(0, slotID);
1368 if (retVal == SUCCESS) {
1369 rpp_sci_printf("Buffer disabled.\r\n");
1372 rpp_sci_printf("General error.\r\n");
1373 return -CMDERR_BADCFG;
1379 * @brief Print global time of the FlexRay network.
1381 * @param[in] cmd_io Pointer to IO stack
1382 * @param[in] des Pointer to command descriptor
1383 * @param[in] param Parameters of command
1384 * @return 0 when OK or error code
1386 int cmd_do_fr_getglobaltime(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1387 int8_t retVal = ERR_PARAM_NO_ERROR;
1389 uint16_t macroTick = 0;
1391 retVal = rpp_fr_get_global_time(0, &cycle, ¯oTick);
1392 if (retVal == SUCCESS) {
1393 rpp_sci_printf("Cycle number: %d\r\nMacrotick number: %d\r\n", cycle, macroTick);
1396 rpp_sci_printf("General error.\r\n");
1397 return -CMDERR_BADCFG;
1403 * @brief Print network management vector of the FlexRay node.
1405 * @param[in] cmd_io Pointer to IO stack
1406 * @param[in] des Pointer to command descriptor
1407 * @param[in] param Parameters of command
1408 * @return 0 when OK or error code
1410 int cmd_do_fr_getnmvector(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1411 int8_t retVal = ERR_PARAM_NO_ERROR;
1412 uint8_t nmVector[12];
1415 retVal = rpp_fr_get_network_management_vector(0, nmVector);
1416 if (retVal == SUCCESS) {
1417 rpp_sci_printf("Network management vector:");
1418 for (i = 0; i < Fr_cluster_config.gNetworkManagementVectorLength; i++) {
1419 rpp_sci_printf(" %x", nmVector[i]);
1421 rpp_sci_printf("\r\n");
1424 rpp_sci_printf("General error.\r\n");
1425 return -CMDERR_BADCFG;
1430 int cmd_do_fr_nmwatch(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1431 int8_t retVal = ERR_PARAM_NO_ERROR;
1432 uint8_t nmVector[12];
1435 // Calculate wait time in OS ticks
1436 static const portTickType freq_ticks = 100 /* ms */ / portTICK_RATE_MS;
1437 portTickType last_wake_time = xTaskGetTickCount();
1439 while(cmd_io->getc(cmd_io) < 0) {
1440 retVal = rpp_fr_get_network_management_vector(0, nmVector);
1441 if (retVal == SUCCESS) {
1442 rpp_sci_printf("Network management vector:");
1443 for (i = 0; i < Fr_cluster_config.gNetworkManagementVectorLength; i++) {
1444 rpp_sci_printf(" %02x", nmVector[i]);
1446 rpp_sci_printf("\r");
1449 rpp_sci_printf("General error.\r\n");
1450 return -CMDERR_BADCFG;
1452 vTaskDelayUntil(&last_wake_time, freq_ticks);
1454 rpp_sci_printf("\n");
1459 * @brief Print both channels status of the FlexRay node.
1461 * @param[in] cmd_io Pointer to IO stack
1462 * @param[in] des Pointer to command descriptor
1463 * @param[in] param Parameters of command
1464 * @return 0 when OK or error code
1466 int cmd_do_fr_getchannelstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1467 int8_t retVal = ERR_PARAM_NO_ERROR;
1470 char* decodeStrings[] = {
1471 "aggregated channel status vSS!ValidFrame",
1472 "aggregated channel status vSS!SyntaxError",
1473 "aggregated channel status vSS!ContentError",
1474 "aggregated channel status additional communication",
1475 "aggregated channel status vSS!Bviolation",
1476 "aggregated channel status vSS!TxConflict",
1479 "symbol window status data vSS!ValidMTS",
1480 "symbol window status data vSS!SyntaxError",
1481 "symbol window status data vSS!Bviolation",
1482 "symbol window status data vSS!TxConflict",
1483 "NIT status data vSS!SyntaxError",
1484 "NIT status data vSS!Bviolation",
1488 char* channelNames[] = {"A", "B"};
1489 char* boolStrings[] = {"FALSE", "TRUE"};
1490 uint16_t channelStatuses[2];
1492 retVal = rpp_fr_get_channel_status(0, &channelStatuses[0], &channelStatuses[1]);
1493 if (retVal == SUCCESS) {
1494 for (channel = 0; channel < 2; channel++) {
1495 rpp_sci_printf("Channel %s status:\r\n", channelNames[channel]);
1496 for (index = 0; index < 16; index++) {
1497 rpp_sci_printf("\t%s: %s\r\n", decodeStrings[index], boolStrings[ (channelStatuses[channel] >> index) & 0x1 ] );
1502 rpp_sci_printf("General error.\r\n");
1503 return -CMDERR_BADCFG;
1509 * @brief Print clock correction of the FlexRay node
1511 * @param[in] cmd_io Pointer to IO stack
1512 * @param[in] des Pointer to command descriptor
1513 * @param[in] param Parameters of command
1514 * @return 0 when OK or error code
1516 int cmd_do_fr_getclockcorrection(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1517 int8_t retVal = ERR_PARAM_NO_ERROR;
1518 int16_t rateCorrection;
1519 int32_t offsetCorrection;
1521 retVal = rpp_fr_get_clock_correction(0, &rateCorrection, &offsetCorrection);
1522 if (retVal == SUCCESS) {
1523 rpp_sci_printf("Rate correction: %d\r\nOffset correction: %d\r\n", rateCorrection, offsetCorrection);
1526 rpp_sci_printf("General error.\r\n");
1527 return -CMDERR_BADCFG;
1533 * @brief Print list of syncframec transmitted on both channels via the even and odd cycle.
1535 * @param[in] cmd_io Pointer to IO stack
1536 * @param[in] des Pointer to command descriptor
1537 * @param[in] param Parameters of command
1538 * @return 0 when OK or error code
1540 int cmd_do_fr_getsyncframelist(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1541 int8_t retVal = ERR_PARAM_NO_ERROR;
1542 uint16_t channelAEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1543 uint16_t channelBEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1544 uint16_t channelAOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1545 uint16_t channelBOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1546 uint32_t listSize = 0;
1549 if (sscanf(param[1], "%d", &listSize) != 1) {
1550 return -CMDERR_BADPAR;
1552 if (param[2] != NULL) {
1553 return -CMDERR_BADPAR;
1555 if (listSize > FR_MAX_SYNC_FRAME_LIST_SIZE) {
1556 return -CMDERR_BADPAR;
1559 retVal = rpp_fr_get_sync_frame_list(0, listSize, channelAEvenList, channelBEvenList, channelAOddList, channelBOddList);
1560 if (retVal == SUCCESS) {
1561 rpp_sci_printf("| Channel A even | channel B even | channel A odd | channel B odd |\r\n");
1562 rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
1563 for (i = 0; i < listSize; i++) {
1564 rpp_sci_printf("| %-14x | %-14x | %-14x | %-14x |\r\n", channelAEvenList[i], channelBEvenList[i], channelAOddList[i], channelBOddList[i]);
1566 rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
1570 rpp_sci_printf("General error.\r\n");
1571 return -CMDERR_BADCFG;
1577 * @brief Print status of wakeup on each channels (wakeup received on channel or not yet received).
1579 * @param[in] cmd_io Pointer to IO stack
1580 * @param[in] des Pointer to command descriptor
1581 * @param[in] param Parameters of command
1582 * @return 0 when OK or error code
1584 int cmd_do_fr_getwakeuprxstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1585 int8_t retVal = ERR_PARAM_NO_ERROR;
1587 char* statusStrings[] = {"was not yet", "was"};
1588 char* channelNames[] = {"A", "B"};
1591 retVal = rpp_fr_get_wakeup_rx_status(0, &status);
1592 if (retVal == SUCCESS) {
1593 for (i = 0; i < 2; i++) {
1594 rpp_sci_printf("Wake up pattern %s received on channel %s.\r\n", statusStrings[(status >> i) & 0x1], channelNames[i]);
1598 rpp_sci_printf("General error.\r\n");
1599 return -CMDERR_BADCFG;
1605 * @brief Set and start absolute timer.
1607 * @param[in] cmd_io Pointer to IO stack
1608 * @param[in] des Pointer to command descriptor
1609 * @param[in] param Parameters of command
1610 * @return 0 when OK or error code
1612 int cmd_do_fr_settimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1613 int8_t retVal = ERR_PARAM_NO_ERROR;
1618 if (sscanf(param[1], "%i %i %i", &timer, &cycle, &offset) != 3) {
1619 return -CMDERR_BADPAR;
1622 retVal = rpp_fr_set_timer(0, timer, cycle, offset);
1623 if (retVal == SUCCESS) {
1625 while (i && (cycle & i) == 0)
1630 rpp_sci_printf("Timer was set for every %d-th cycle, offset %d, macrotick %d\n",
1631 i, cycle & ~i, offset);
1634 rpp_sci_printf("General error.\r\n");
1635 return -CMDERR_BADCFG;
1641 * @brief Cancel selected timer
1643 * @param[in] cmd_io Pointer to IO stack
1644 * @param[in] des Pointer to command descriptor
1645 * @param[in] param Parameters of command
1646 * @return 0 when OK or error code
1648 int cmd_do_fr_canceltimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1649 int8_t retVal = ERR_PARAM_NO_ERROR;
1652 if (sscanf(param[1], "%d", &timer) != 1) {
1653 return -CMDERR_BADPAR;
1656 if (param[2] != NULL) {
1657 return -CMDERR_BADPAR;
1660 retVal = rpp_fr_cancel_timer(0, timer);
1661 if (retVal == SUCCESS) {
1662 rpp_sci_printf("Timer was canceled.\r\n");
1665 rpp_sci_printf("General error.\r\n");
1666 return -CMDERR_BADCFG;
1672 * @brief Enable/disable, acknowledge, get timer IRQ
1674 * @param[in] cmd_io Pointer to IO stack
1675 * @param[in] des Pointer to command descriptor
1676 * @param[in] param Parameters of command
1677 * @return 0 when OK or error code
1679 int cmd_do_fr_timerirq(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1680 int8_t retVal = ERR_PARAM_NO_ERROR;
1683 boolean_t status = FALSE;
1684 char* boolStrings[] = {"FALSE", "TRUE"};
1687 if (sscanf(param[1], "%d", &timer) != 1) {
1688 return -CMDERR_BADPAR;
1691 if (param[2] == NULL) { // Get timer IRQ
1692 retVal = rpp_fr_get_timer_irq_status(0, timer, &status);
1693 if (retVal == SUCCESS) {
1694 rpp_sci_printf("IRQ = %s\r\n", boolStrings[status]);
1697 rpp_sci_printf("General error.\r\n");
1698 return -CMDERR_BADCFG;
1701 else { // Some set action
1702 if (sscanf(param[2], "%4s", str) != 1) {
1703 return -CMDERR_BADPAR;
1705 if (strcmp(str, "EN") == 0) { // Enable IRQ
1706 retVal = SUCCESS; // No interrupts imlemented
1708 else if (strcmp(str, "DIS") == 0) { // Disable IRQ
1709 retVal = SUCCESS; // No interrupts implemented
1711 else if (strcmp(str, "ACK") == 0) { // Clear IRQ
1712 retVal = rpp_fr_clear_timer_irq(0, timer);
1714 else { // Bad argument
1715 return -CMDERR_BADPAR;
1718 if (retVal == SUCCESS) {
1719 rpp_sci_printf("OK\r\n");
1722 rpp_sci_printf("General error.\r\n");
1723 return -CMDERR_BADCFG;
1730 * @brief Print FlexRay driver version info.
1732 * @param[in] cmd_io Pointer to IO stack
1733 * @param[in] des Pointer to command descriptor
1734 * @param[in] param Parameters of command
1735 * @return 0 when OK or error code
1737 int cmd_do_fr_getversioninfo(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1738 Std_VersionInfoType versionInfo;
1740 rpp_fr_get_driver_version(&versionInfo);
1741 rpp_sci_printf("vendorID: %#x\r\n", versionInfo.vendorID);
1742 rpp_sci_printf("moduleID: %#x\r\n", versionInfo.moduleID);
1743 rpp_sci_printf("sw_major_version: %#x\r\n", versionInfo.sw_major_version);
1744 rpp_sci_printf("sw_minor_version: %#x\r\n", versionInfo.sw_minor_version);
1745 rpp_sci_printf("sw_patch_version: %#x\r\n", versionInfo.sw_patch_version);
1751 * @brief Print value of FlexRay configuratoin parameter.
1753 * @param[in] cmd_io Pointer to IO stack
1754 * @param[in] des Pointer to command descriptor
1755 * @param[in] param Parameters of command
1756 * @return 0 when OK or error code
1758 int cmd_do_fr_readcconfig(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1759 int8_t retVal = ERR_PARAM_NO_ERROR;
1763 if (sscanf(param[1], "%d", &index) != 1) {
1764 return -CMDERR_BADPAR;
1767 if (param[2] != NULL) {
1768 return -CMDERR_BADPAR;
1771 retVal = rpp_fr_read_com_ctrl_config(0, index, &value);
1772 if (retVal == SUCCESS) {
1773 rpp_sci_printf("Value = %#x\r\n", value);
1776 rpp_sci_printf("General error.\r\n");
1777 return -CMDERR_BADCFG;
1783 * @brief Reconfigure buffer
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_reconfigure_buffer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1793 unsigned id, slot, maxpayload, cycleset;
1794 Fr_TMS570LS_BufferConfigType tmp_buffer;
1796 ret = sscanf(param[2], "id%i slot%i %2s cyc%i max%i",
1804 printf("Error parsing parameter %d\n", ret+1);
1805 return -CMDERR_BADPAR;
1808 if (slot > 2047 || id > 2047)
1809 return badpar("Invalid slot number\n");
1810 tmp_buffer.slotId = slot;
1811 if (strcmp(channel, "A") == 0) tmp_buffer.channel = FR_CHANNEL_A;
1812 else if (strcmp(channel, "B") == 0) tmp_buffer.channel = FR_CHANNEL_B;
1813 else if (strcmp(channel, "AB") == 0) tmp_buffer.channel = FR_CHANNEL_AB;
1814 else return badpar("Channel parsing error\n");
1816 if (cycleset >= 0x80)
1817 return badpar("Cycle set must be less than 0x80.\n");
1818 tmp_buffer.cycleCounterFiltering = cycleset;
1820 if (maxpayload >= 128)
1821 return badpar("Maximum payload in half-words must be less than 128\n");
1822 tmp_buffer.maxPayload = maxpayload;
1824 if (rpp_fr_reconfigure_lpdu(0, id, tmp_buffer.slotId, tmp_buffer.channel, tmp_buffer.cycleCounterFiltering, tmp_buffer.maxPayload) == SUCCESS) {
1825 printf("frbtreconfigbuf id%i slot%i %2s cyc%i max%i\n",
1835 printf("Reconfiguration failed.\n");
1837 return -CMDERR_BADPAR;
1842 /** Command descriptor for FlexRay user config cluster command */
1843 cmd_des_t const cmd_des_fr_user_config={
1845 "frbtconfig*","Set the user configuration parameters",
1846 "=== Command syntax ===\n"
1848 " frbtconfig<TYPE> <PARAMS>\n"
1850 "* <TYPE> is a string specifying the type of parameters to be set. It can be: \"cluster\" or \"node\"\n"
1851 "* <PARAMS> is a sequence of numbers separated by spaces. Each number stands for one parameter.\n"
1853 "=== Description ===\n"
1855 "The command takes the configuration parameters in the form of a string\n"
1856 "and sets the appropriate type of the FlexRay parameters. It is\n"
1857 "necessary to configure parameters of at least cluster, and node and\n"
1858 "one static buffer (see frbtcfgbuf command). The parameters set by this\n"
1859 "command are applied by the frbtinitU command. Once frbtinit is called,\n"
1860 "it is no longer possible to change the parameters.\n"
1862 "The type of the parameters can be selected by the <TYPE> selector.\n"
1864 "Type \"cluster\" sets global FlexRay network parameters. It expects a\n"
1865 "sequence of 25 parameters in this order:\n"
1866 "* 1) gColdStartAttempts\n"
1867 "* 2) gListenNoise\n"
1868 "* 3) gMacroPerCycle\n"
1869 "* 4) gMaxWithoutClockCorrectionFatal\n"
1870 "* 5) gMaxWithoutClockCorrectionPassive\n"
1871 "* 6) gNetworkManagementVectorLength\n"
1872 "* 7) gNumberOfMinislots\n"
1873 "* 8) gNumberOfStaticSlots\n"
1874 "* 9) gOffsetCorrectionStart\n"
1875 "* 10) gPayloadLengthStatic\n"
1876 "* 11) gSyncNodeMax\n"
1877 "* 12) gdActionPointOffset\n"
1878 "* 13) gdCASRxLowMax\n"
1879 "* 14) gdDynamicSlotIdlePhase\n"
1880 "* 15) gdMinislot\n"
1881 "* 16) gdMinislotActionPointOffset\n"
1883 "* 18) gdSampleClockPeriod\n"
1884 "* 19) gdStaticSlot\n"
1885 "* 20) gdTSSTransmitter\n"
1886 "* 21) gdWakeupSymbolRxIdle\n"
1887 "* 22) gdWakeupSymbolRxLow\n"
1888 "* 23) gdWakeupSymbolRxWindow\n"
1889 "* 24) gdWakeupSymbolTxIdle\n"
1890 "* 25) gdWakeupSymbolTxLow\n"
1892 "Type \"node\" sets local FlexRay network parameters. It expects a\n"
1893 "sequence of 28 parameters in this order:\n"
1894 "* 1) pAllowHaltDueToClock\n"
1895 "* 2) pAllowPassiveToActive\n"
1896 "* 3) pChannels (0 - A, 1 - B, 2 - AB)\n"
1897 "* 4) pClusterDriftDamping\n"
1898 "* 5) pDelayCompensationA\n"
1899 "* 6) pDelayCompensationB\n"
1900 "* 7) pExternOffsetCorrection\n"
1901 "* 8) pExternRateCorrection\n"
1902 "* 9) pKeySlotUsedForStartup\n"
1903 "* 10) pKeySlotUsedForSync\n"
1905 "* 12) pMacroInitialOffsetA\n"
1906 "* 13) pMacroInitialOffsetB\n"
1907 "* 14) pMicroInitialOffsetA\n"
1908 "* 15) pMicroInitialOffsetB\n"
1909 "* 16) pMicroPerCycle\n"
1910 "* 17) pRateCorrectionOut\n"
1911 "* 18) pOffsetCorrectionOut\n"
1912 "* 19) pSamplesPerMicrotick\n"
1913 "* 20) pSingleSlotEnabled\n"
1914 "* 21) pWakeupChannel (0 - A, 1 - B)\n"
1915 "* 22) pWakeupPattern\n"
1916 "* 23) pdAcceptedStartupRange\n"
1917 "* 24) pdListenTimeout\n"
1918 "* 25) pdMaxDrift\n"
1919 "* 26) pDecodingCorrection\n"
1920 "* 27) syncFramePayloadMultiplexEnabled\n"
1921 "* 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"
1925 " --> 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"
1926 " FlexRay cluster configuration accepted.\n"
1927 " --> 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"
1928 " FlexRay node configuration accepted.\n",
1929 CMD_HANDLER(cmd_do_fr_user_config), (void *)&cmd_list_fr_basic_test
1932 cmd_des_t const cmd_des_fr_config_buffer={
1934 "frbtcfgbuf?*","Configure a message buffer in the user configuration",
1935 "=== Command syntax ===\n"
1937 " frbtcfgbuf<TYPE><NUM> slot<SLOT> <CHN> cyc<CYC> <RXTX> max<MAX> <REP> ppi<PPI> int<INT>\n"
1939 "* <TYPE> is 'S' for static segment buffers and 'D' for dynamic segment buffers,\n"
1940 "* <NUM> is the number of the buffer. Both static and dynamic buffers are numbered independently starting from zero,\n"
1941 "* <SLOT> is the number of the slot,\n"
1942 "* <CHN> is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
1943 "* <CYC> is the cycle set when to send the buffer,\n"
1944 "* <RXTX> is either string \"rx\" or \"tx\",\n"
1945 "* <MAX> is the number determining the maximum payload (in hald-words),\n"
1946 "* <REP> is a string \"s\" or \"single\" for single transmission or \"c\" or \"continuous\" for continuous transmission,\n"
1947 "* <PPI> is 0 or 1 determining whether the payload preamble indicator is set,\n"
1948 "* <INT> is 0 or 1 and is currently ignored.\n"
1950 "=== Description ===\n"
1952 "The command sets the configuration parameters for static or dynamic\n"
1953 "buffers in user configuration. The parameters set by this command are\n"
1954 "applied by the frbtinitU command. Once frbtinit is called, it is no\n"
1955 "longer possible to change the parameters.\n"
1959 " --> frbtcfgbufS0 slot2 AB cyc0 tx max9 continous ppi0 int1\n"
1960 " frbtcfgbufS0 slot2 AB cyc0 tx max9 continous ppi0 int1\n"
1961 " --> frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1\n"
1962 " frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1\n"
1963 " --> frbtcfgbufD0 slot9 A cyc0 rx max0x40 single ppi0 int0\n"
1964 " frbtcfgbufD0 slot9 A cyc0 rx max64 single ppi0 int0\n"
1965 " --> frbtcfgbufD1 slot10 A cyc0 tx max0x40 single ppi0 int0\n"
1966 " frbtcfgbufD1 slot10 A cyc0 tx max64 single ppi0 int0\n",
1967 CMD_HANDLER(cmd_do_fr_config_bufer), (void *)&cmd_list_fr_basic_test
1970 cmd_des_t const cmd_des_fr_config_fifo={
1972 "frbtcfgfifo*","Configure a RX FIFO message buffer in the user configuration",
1973 "=== Command syntax ===\n"
1975 " frbtcfgfifo slot<SLOT> depth<DEPTH> <CHN> cyc<CYC> max<MAX> <REJNULL> <REJSTAT> int<INT>\n"
1977 "* <SLOT> is the number of the slot,\n"
1978 "* <DEPTH> is a number specifying the depth of the FIFO,\n"
1979 "* <CHN> is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
1980 "* <CYC> is the cycle set when to send the buffer,\n"
1981 "* <MAX> is the number determining the maximum payload (in hald-words),\n"
1982 "* <REJNULL> is a string \"rejnull\" for rejecting NULL frames or \"accnull\" for accepting NULL frames,\n"
1983 "* <REJSTAT> is a string \"rejstat\" for rejecting frames in static segment or \"accstat\" for accepting frames from static segment,\n"
1984 "* <INT> is 0 or 1 and is currently ignored.\n"
1986 "=== Description ===\n"
1988 "The command sets the configuration parameters for RX FIFO buffer\n"
1989 "in user configuration. The parameters set by this command are\n"
1990 "applied by the frbtinitU command. Once frbtinit is called, it is no\n"
1991 "longer possible to change the parameters.\n"
1995 " --> frbtcfgfifo slot0 depth5 AB cyc0 max20 rejnull accstat int1\n"
1996 " frbtcfgfifo slot0 depth5 AB cyc0 max20 rejnull accstat int1\n",
1997 CMD_HANDLER(cmd_do_fr_config_fifo), (void *)&cmd_list_fr_basic_test
2000 /** Command descriptor for FlexRay init command */
2001 cmd_des_t const cmd_des_fr_init={
2003 "frbtinit?","Initialize a FlexRay node",
2004 "=== Command syntax ===\n"
2008 "where <CFG> identifies the configuration to use. It can be one of A, B\n"
2009 "or U. The A and B are predefined configurations. If U is specified,\n"
2010 "the user configuration previously set by frbtconfig command is used.\n"
2012 "=== Description ===\n"
2014 "The command stands for Fr_Init and Fr_ControllerInit functions from\n"
2015 "the Autosar specification. It initializes the internal data structures\n"
2016 "of the driver and then, based on those data, the controller\n"
2017 "configuration is done. During the controller configuration the\n"
2018 "parameters of the cluster, node, message RAM and buffers are checked.\n"
2019 "If anything goes bad, the command returns an error number, which can\n"
2020 "be decoded by macros defined in driver header file fr_tms570.h with\n"
2021 "prefix ERR_PARAM. If all parameters are OK, all necessary registers of\n"
2022 "the controller are initialized according to the specified\n"
2023 "configuration parameters. At the end of the command, the FlexRay\n"
2024 "controller is switched into READY state and all buffers are configured\n"
2025 "to send NULL frames. This command should be called as the very first\n"
2026 "command, when trying to communicate over the FlexRay bus.\n"
2031 " FlexRay driver initialized.\n"
2032 " FlexRay controller initialized.\n",
2033 CMD_HANDLER(cmd_do_fr_init), (void *)&cmd_list_fr_basic_test
2036 /** Command descriptor for FlexRay controller init command */
2037 cmd_des_t const cmd_des_fr_start={
2039 "frbtstart","Start a new FlexRay network or join to the existing one",
2040 "=== Command syntax ===\n"
2044 "=== Description ===\n"
2046 "The command stands for Fr_StartCommunication function from the Autosar\n"
2048 "If the FlexRay node is configured as a coldstarter node\n"
2049 "(as for example by frbtinitA/B command), then the command first listen\n"
2050 "on the bus. When it does not detect any existing bus communication, it\n"
2051 "tries to initiate a new network. If the initiation fails, the FlexRay\n"
2052 "controller is switched back to the ready state for another attempt\n"
2053 "(calling frbtstart again). If the FlexRay node is configured as\n"
2054 "non-coldstarter, it is listening on the bus until some existing\n"
2055 "communication is detected.\n"
2057 "The command should be called after the frbtinit command.\n"
2062 " FlexRay communication is running.\n",
2063 CMD_HANDLER(cmd_do_fr_start), (void *)&cmd_list_fr_basic_test
2066 /** Command descriptor for FlexRay controller all slots command */
2067 cmd_des_t const cmd_des_fr_allslots={
2069 "frbtallslots","Enables communication for all frames",
2070 "=== Command syntax ===\n"
2074 "=== Description ===\n"
2076 "The command stands for Fr_AllSlots function from the Autosar\n"
2079 "The node can be configured to communicate only on key frames by\n"
2080 "default (as in the case of frbtinitA/B). This command can be used to\n"
2081 "allow the communication on all configured frames. The command invokes\n"
2082 "the FlexRay POC command ALL_SLOTS which enables the communication on\n"
2083 "all frames. The command can be called after the controller\n"
2088 " --> frbtallslots\n"
2089 " FlexRay node started communication on all slots.\n",
2090 CMD_HANDLER(cmd_do_fr_allslots), (void *)&cmd_list_fr_basic_test
2093 /** Command descriptor for FlexRay controller halt command */
2094 cmd_des_t const cmd_des_fr_halt={
2096 "frbthalt","Halt FlexRay communication after the end of the actual communication cycle",
2097 "=== Command syntax ===\n"
2101 "=== Description ===\n"
2103 "The command stands for Fr_HaltCommunication function from the Autosar\n"
2104 "specification. The command invokes the FlexRay POC command HALT, which\n"
2105 "means that communication is stopped after the end of the actual\n"
2106 "communication cycle. On the opposite side, there is a frbtfreeze\n"
2107 "command, which stops the communication immediately. To restart the\n"
2108 "communication, the frbtinit and frbtstart commands have to be called.\n"
2113 " FlexRay node communication halted.\n",
2114 CMD_HANDLER(cmd_do_fr_halt), (void *)&cmd_list_fr_basic_test
2117 /** Command descriptor for FlexRay controller abort command */
2118 cmd_des_t const cmd_des_fr_abort={
2120 "frbtabort","Abort FlexRay communication immediately",
2121 "=== Command syntax ===\n"
2125 "=== Description ===\n"
2127 "The command stands for Fr_AbortCommunication function from the Autosar\n"
2128 "specification. The command invokes the FlexRay POC command FREEZE,\n"
2129 "which means that the communication is stopped immediately. On the\n"
2130 "opposite side there is a frbthalt command, which stops the\n"
2131 "communication after the end of the actual communication cycle. To\n"
2132 "restart the communication, the frbtinit and frbtstart commands have\n"
2138 " FlexRay node communication aborted.\n",
2139 CMD_HANDLER(cmd_do_fr_abort), (void *)&cmd_list_fr_basic_test
2142 /** Command descriptor for FlexRay controller send wake up pattern command */
2143 cmd_des_t const cmd_des_fr_sendwup={
2145 "frbtwup","Initiate the wake up procedure",
2146 "=== Command syntax ===\n"
2150 "=== Description ===\n"
2152 "The command stands for Fr_SendWUP function from the Autosar\n"
2153 "specification. It initiates the wake up procedure by switching FlexRay\n"
2154 "controller state machine to WAKEUP state.\n"
2159 " Wake up pattern has been sent.\n",
2160 CMD_HANDLER(cmd_do_fr_sendwup), (void *)&cmd_list_fr_basic_test
2163 /** Command descriptor for FlexRay controller sent wake up pattern channel command */
2164 cmd_des_t const cmd_des_fr_setwuchannel={
2166 "frbtsetwuch?","Set wake up channel",
2167 "=== Command syntax ===\n"
2169 " frbtsetwuch<CHANNEL>\n"
2171 "where <CHANNEL> is a character A or B, specifying the channel.\n"
2173 "=== Description ===\n"
2175 "The command stands for Fr_SetWakeupChannel function from the Autosar\n"
2176 "specification. Wake up channel is the channel, where Wake Up Pattern\n"
2177 "is sent. The channel can be set after the driver and controller are\n"
2178 "initialized and before the communication is running. The actual\n"
2179 "wake-up pattern is sent by the frbtwup command.\n"
2183 " --> frbtsetwuchA\n"
2184 " Wake up channel has been set.\n",
2185 CMD_HANDLER(cmd_do_fr_setwuchannel), (void *)&cmd_list_fr_basic_test
2188 /** Command descriptor for FlexRay controller get POC status command */
2189 cmd_des_t const cmd_des_fr_getpocstatus={
2191 "frbtgetpocst","Print FlexRay POC status",
2192 "=== Command syntax ===\n"
2196 "=== Description ===\n"
2198 "The command stands for Fr_GetPOCStatus function from the Autosar\n"
2199 "specification. It prints the main FlexRay POC status values in the\n"
2200 "form of a table. The command should be called after the frbtinit\n"
2205 " --> frbtgetpocst\n"
2207 " CHIHaltRequest: FALSE\n"
2208 " CHIReadyRequest: FALSE\n"
2209 " ColdstartNoise: FALSE\n"
2211 " ErrorMode: ACTIVE\n"
2213 " StartupState: UNDEFINED\n"
2215 " WakeupStatus: UNDEFINED\n",
2216 CMD_HANDLER(cmd_do_fr_getpocstatus), (void *)&cmd_list_fr_basic_test
2219 /** Command descriptor for FlexRay transmit tx lpdu command */
2220 cmd_des_t const cmd_des_fr_transmittxlpdu={
2222 "frbttransmit*","Transmit data in selected frame",
2223 "=== Command syntax ===\n"
2225 " frbttransmit<FRID> <DATA>\n"
2227 "* <FRID> is a decimal number specifying the ID of the frame for which a buffer has been configured.\n"
2228 "* <DATA> is a sequence of hexadecimal numbers separated by spaces. Each number represents one byte of the message.\n"
2230 "=== Description ===\n"
2232 "The command stands for Fr_TransmitTxLPdu function from the Autosar\n"
2233 "specification. The command finds the first buffer assigned to the\n"
2234 "specified frame ID and copies the given data into its data section in\n"
2235 "the message RAM. Transmit request is set after the data are copied, so\n"
2236 "transmission starts at the next occurrence of the frame in the\n"
2237 "communication cycle.\n"
2241 " --> frbttransmit1 12 34 56 AA BB CC\n"
2242 " Data were set for transmission.\n",
2243 CMD_HANDLER(cmd_do_fr_transmittxlpdu), (void *)&cmd_list_fr_basic_test
2246 /** Command descriptor for FlexRay cancel tx lpdu command */
2247 cmd_des_t const cmd_des_fr_canceltxlpdu={
2249 "frbtcanceltx*","Stop the transmission of the frame",
2250 "=== Command syntax ===\n"
2252 " frbtcanceltx<FRID>\n"
2254 "where <FRID> is a decimal number specifying the ID of the frame for\n"
2255 "which a buffer has been configured.\n"
2257 "=== Description ===\n"
2259 "The command stands for Fr_CancelTxLPdu function from the Autosar\n"
2260 "specification. The command finds all buffers assigned to the specified\n"
2261 "frame ID and reconfigures them to stop transmitting data. The command\n"
2262 "finishes successfully only if reconfiguration is allowed in message\n"
2263 "RAM configuration (secureBuffers configuration parameter). Only TX\n"
2264 "buffers and buffers not used for startup frames can be canceled.\n"
2268 " --> frbtcanceltx3\n"
2269 " Transmission canceled.\n",
2270 CMD_HANDLER(cmd_do_fr_canceltxlpdu), (void *)&cmd_list_fr_basic_test
2273 /** Command descriptor for FlexRay receive rx lpdu command */
2274 cmd_des_t const cmd_des_fr_receiverxlpdu={
2276 "frbtreceive*","Receive a new message",
2277 "=== Command syntax ===\n"
2279 " frbtreceive<FRID>\n"
2281 "where <FRID> is a decimal number specifying the ID of the frame for\n"
2282 "which a buffer was configured.\n"
2284 "=== Description ===\n"
2286 "The command stands for Fr_ReceiveRxLPdu function from the Autosar\n"
2287 "specification. The command finds the first buffer assigned to the\n"
2288 "specified frame ID, determines if a new message has been received and\n"
2289 "reads it out of the buffer. If no message was received, \"No message\n"
2290 "received\" is printed. If a new message was received, all message data\n"
2291 "are printed as a hexadecimal values. If a new message was retrieved\n"
2292 "from a FIFO buffer and more messages are available in it, \"More\n"
2293 "messages are still in FIFO\" is printed.\n"
2297 " --> frbtreceive0\n"
2298 " More messages are still in FIFO:\n"
2299 " Received message (32 B):\n"
2300 " 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",
2301 CMD_HANDLER(cmd_do_fr_receiverxlpdu), (void *)&cmd_list_fr_basic_test
2304 /** Command descriptor for FlexRay check TX LPdu status command */
2305 cmd_des_t const cmd_des_fr_checktxlpdustatus={
2307 "frbtchecktx*","Print the status of the transmit buffer",
2308 "=== Command syntax ===\n"
2310 " frbtchecktx<FRID>\n"
2312 "where <FRID> is a decimal number specifying the ID of the frame for\n"
2313 "which a buffer has been configured.\n"
2315 "=== Description ===\n"
2317 "The command stands for Fr_CheckTxLPduStatus function from the Autosar\n"
2318 "specification. The command finds the first buffer assigned to the\n"
2319 "specified frame ID, reads its status and prints it. The buffer can be\n"
2320 "in one of the two states:\n"
2321 "* 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"
2322 "* No message transmission is pending, which means that the buffer is in single shot mode and the message has already been sent.\n"
2326 " --> frbtchecktx1\n"
2327 " Message transmission is not pending.\n",
2328 CMD_HANDLER(cmd_do_fr_checktxlpdustatus), (void *)&cmd_list_fr_basic_test
2331 /** Command descriptor for FlexRay disable LPdu command */
2332 cmd_des_t const cmd_des_fr_disablelpdu={
2334 "frbtdisable*","Disable the buffers assigned to the frame",
2335 "=== Command syntax ===\n"
2337 " frbtdisable<FRID>\n"
2339 "where <FRID> is a decimal number specifying the ID of a frame. The\n"
2340 "buffers configure for this frame will be disabled.\n"
2342 "=== Description ===\n"
2344 "The command stands for Fr_DisableLPdu function from the Autosar\n"
2345 "specification. The command finds all buffers assigned to the specified\n"
2346 "frame ID and disables them. This means that those buffers will be\n"
2347 "unavailable for the communication until their reconfiguration (which\n"
2348 "is not yet implemented). Buffers used for startup frames and FIFO RX\n"
2349 "buffers cannot be disabled.\n"
2353 " --> frbtdisable3\n"
2354 " Buffer disabled.\n",
2355 CMD_HANDLER(cmd_do_fr_disablelpdu), (void *)&cmd_list_fr_basic_test
2358 /** Command descriptor for FlexRay get global time command */
2359 cmd_des_t const cmd_des_fr_getglobaltime={
2361 "frbtglobtime","Print actual global time of the network",
2362 "=== Command syntax ===\n"
2366 "=== Description ===\n"
2368 "The command stands for Fr_GetGlobalTime function from the Autosar\n"
2369 "specification. The command prints the time as a number of the current\n"
2370 "cycle and the offset in the cycle in macroticks.\n"
2374 " --> frbtglobtime\n"
2375 " Cycle number: 23\n"
2376 " Macrotick number: 6\n",
2377 CMD_HANDLER(cmd_do_fr_getglobaltime), (void *)&cmd_list_fr_basic_test
2380 /** Command descriptor for FlexRay get network management vector command */
2381 cmd_des_t const cmd_des_fr_getnmvector={
2383 "frbtnmvector","Print network management vector of the node",
2384 "=== Command syntax ===\n"
2388 "=== Description ===\n"
2390 "The command stands for Fr_GetNmVector function from the Autosar\n"
2391 "specification. It prints the values of the network management vector\n"
2392 "as hexadecimal numbers.\n"
2396 " --> frbtnmvector\n"
2397 " Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\n",
2398 CMD_HANDLER(cmd_do_fr_getnmvector), (void *)&cmd_list_fr_basic_test
2401 /** Command descriptor for FlexRay get network management vector command */
2402 cmd_des_t const cmd_des_fr_nmwatch={
2404 "frbtnmwatch","Watch the changes of the network managment vector in real-time",
2405 "=== Command syntax ===\n"
2409 "=== Description ===\n"
2411 "Reads the network management vector every 100 ms and prints it out.\n"
2415 " --> frbtnmwatch\n"
2416 " Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\n",
2417 CMD_HANDLER(cmd_do_fr_nmwatch), (void *)&cmd_list_fr_basic_test
2420 /** Command descriptor for FlexRay get channel status command */
2421 cmd_des_t const cmd_des_fr_getchannelstatus={
2423 "frbtchstat","Print channel A and B status",
2424 "=== Command syntax ===\n"
2428 "=== Description ===\n"
2430 "The command stands for Fr_GetChannelStatus function from the Autosar\n"
2436 " Channel A status:\n"
2437 " aggregated channel status vSS!ValidFrame: TRUE\n"
2438 " aggregated channel status vSS!SyntaxError: FALSE\n"
2439 " aggregated channel status vSS!ContentError: FALSE\n"
2440 " aggregated channel status additional communication: FALSE\n"
2441 " aggregated channel status vSS!Bviolation: FALSE\n"
2442 " aggregated channel status vSS!TxConflict: FALSE\n"
2443 " Not used (0): FALSE\n"
2444 " Not used (0): FALSE\n"
2445 " symbol window status data vSS!ValidMTS: FALSE\n"
2446 " symbol window status data vSS!SyntaxError: FALSE\n"
2447 " symbol window status data vSS!Bviolation: FALSE\n"
2448 " symbol window status data vSS!TxConflict: FALSE\n"
2449 " NIT status data vSS!SyntaxError: FALSE\n"
2450 " NIT status data vSS!Bviolation: FALSE\n"
2451 " Not used (0): FALSE\n"
2452 " Not used (0): FALSE\n"
2453 " Channel B status:\n"
2454 " aggregated channel status vSS!ValidFrame: TRUE\n"
2455 " aggregated channel status vSS!SyntaxError: FALSE\n"
2456 " aggregated channel status vSS!ContentError: FALSE\n"
2457 " aggregated channel status additional communication: FALSE\n"
2458 " aggregated channel status vSS!Bviolation: FALSE\n"
2459 " aggregated channel status vSS!TxConflict: FALSE\n"
2460 " Not used (0): FALSE\n"
2461 " Not used (0): FALSE\n"
2462 " symbol window status data vSS!ValidMTS: FALSE\n"
2463 " symbol window status data vSS!SyntaxError: FALSE\n"
2464 " symbol window status data vSS!Bviolation: FALSE\n"
2465 " symbol window status data vSS!TxConflict: FALSE\n"
2466 " NIT status data vSS!SyntaxError: FALSE\n"
2467 " NIT status data vSS!Bviolation: FALSE\n"
2468 " Not used (0): FALSE\n"
2469 " Not used (0): FALSE\n",
2470 CMD_HANDLER(cmd_do_fr_getchannelstatus), (void *)&cmd_list_fr_basic_test
2473 /** Command descriptor for FlexRay get clock correction command */
2474 cmd_des_t const cmd_des_fr_getclockcorrection={
2476 "frbtclkcor","Print clock correction (rate and offset)",
2477 "=== Command syntax ===\n"
2481 "=== Description ===\n"
2483 "The command stands for Fr_GetClockCorrection function from the Autosar\n"
2489 " Rate correction: 0\n"
2490 " Offset correction: 0\n",
2491 CMD_HANDLER(cmd_do_fr_getclockcorrection), (void *)&cmd_list_fr_basic_test
2494 /** Command descriptor for FlexRay get sync frame list command */
2495 cmd_des_t const cmd_des_fr_getsyncframelist={
2497 "frbtgetsyncfrlist*","Print the list of sync frames transmitted on both channels via the odd and even communication cycle",
2498 "=== Command syntax ===\n"
2500 " frbtgetsyncfrlist<LENGTH>\n"
2502 "where <LENGTH> is a decimal number in range 0 - 15, specifying the\n"
2503 "length of the list to be printed.\n"
2505 "=== Description ===\n"
2507 "The command stands for Fr_GetSyncFrameList function from the Autosar\n"
2512 " --> frbtgetsyncfrlist2\n"
2513 " | Channel A even | channel B even | channel A odd | channel B odd |\n"
2514 " |----------------|----------------|----------------|----------------|\n"
2515 " | 1 | 1 | 1 | 1 |\n"
2516 " | 2 | 2 | 2 | 2 |\n"
2517 " |----------------|----------------|----------------|----------------|\n",
2518 CMD_HANDLER(cmd_do_fr_getsyncframelist), (void *)&cmd_list_fr_basic_test
2521 /** Command descriptor for FlexRay get sync frame list command */
2522 cmd_des_t const cmd_des_fr_getwakeuprxstatus={
2524 "frbtgetwurxstat","Prints whether the wake up pattern has been or has not been received",
2525 "=== Command syntax ===\n"
2527 " frbtgetwurxstat\n"
2529 "=== Description ===\n"
2531 "The command stands for Fr_GetWakeupRxStatus function from the Autosar\n"
2532 "specification. The status of the wake up receiving is bitcoded in the\n"
2533 "controller. This command decodes and prints it in a readable format.\n"
2537 " --> frbtgetwurxstat\n"
2538 " Wake up pattern was not yet received on channel A.\n"
2539 " Wake up pattern was not yet received on channel B.\n",
2540 CMD_HANDLER(cmd_do_fr_getwakeuprxstatus), (void *)&cmd_list_fr_basic_test
2543 /** Command descriptor for FlexRay set absolute timer command */
2544 cmd_des_t const cmd_des_fr_settimer={
2546 "frbtsettimer*","Set and start timer",
2547 "=== Command syntax ===\n"
2549 " frbtsettimer<TMID> <CYCLE> <OFFSET>\n"
2551 "* <TMID> is a number (0, 1) specifying the timer.\n"
2552 "* <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"
2553 "* <OFFSET> is a decimal number (0 - 16383) specifying the offset in macroticks, where precisely in the cycle should be the timer interrupt requested.\n"
2555 "=== Description ===\n"
2557 "The command is similar to Fr_SetAbsoluteTimer function from the\n"
2558 "Autosar specification. The difference is that the command allows to\n"
2559 "specify a set of cycles, not only one of 64 cycles. It sets the timer\n"
2560 "selected by the parameter and enables it.\n"
2562 "Before using this command, FlexRay communication has to be started\n"
2563 "(see frbtstart).\n"
2567 " --> frbtsettimer0 32 50\n"
2568 " Timer was set for every 32-th cycle, offset 0, macrotick 50\n"
2569 " --> frbtsettimer0 31 50\n"
2570 " Timer was set for every 16-th cycle, offset 15, macrotick 50\n"
2571 " --> frbtsettimer0 0x42 0\n"
2572 " Timer was set for every 64-th cycle, offset 2, macrotick 0\n",
2573 CMD_HANDLER(cmd_do_fr_settimer), (void *)&cmd_list_fr_basic_test
2576 /** Command descriptor for FlexRay cancel absolute timer command */
2577 cmd_des_t const cmd_des_fr_canceltimer={
2579 "frbtcanceltimer*","Stop the timer",
2580 "=== Command syntax ===\n"
2582 " frbtcanceltimer<TMID>\n"
2583 "where <TMID> is a number (0 or 1) specifying the timer.\n"
2585 "=== Description ===\n"
2587 "The command stands for Fr_CancelAbsoluteTimer function from the\n"
2588 "Autosar specification. It stops the timer selected by the parameter.\n"
2592 " --> frbtcanceltimer0\n"
2593 " Timer was canceled.\n",
2594 CMD_HANDLER(cmd_do_fr_canceltimer), (void *)&cmd_list_fr_basic_test
2597 /** Command descriptor for FlexRay absolute timer irq manipulation command */
2598 cmd_des_t const cmd_des_fr_timerirq={
2600 "frbttimerirq*","Perform selected action on the timer IRQ",
2601 "=== Command syntax ===\n"
2603 " frbttimerirq<TMID> <ACTION> - Run the <ACTION> on specified timer\n"
2604 " frbttimerirq<TMID> - Get timer IRQ status\n"
2607 "* <TMID> is a number (0, 1) specifying the timer.\n"
2608 "* where <ACTION> is a string specifying the action to be performed on the selected timer IRQ.\n"
2610 "<ACTIONS> can be one of:\n"
2611 "* EN - Enable the IRQ on the selected timer\n"
2612 "* DIS - Disable the IRQ on the selected timer\n"
2613 "* ACK - Acknowledge the IRQ on the selected timer (reset flag in the register).\n"
2615 "=== Description ===\n"
2617 "The command stands for Fr_EnableAbsoluteTimerIRQ,\n"
2618 "Fr_AckAbsoluteTimerIRQ, Fr_DisableAbsoluteTimerIRQ and\n"
2619 "Fr_GetAbsoluteTimerIRQStatus functions from the Autosar specification.\n"
2620 "It masks or demasks the IRQ for the timer, or acknowledges the\n"
2621 "interrupt request. If no action is specified it prints whether the IRQ\n"
2622 "is pending for the timer.\n"
2626 " --> frbttimerirq0\n"
2629 " --> frbttimerirq0 EN\n"
2631 CMD_HANDLER(cmd_do_fr_timerirq), (void *)&cmd_list_fr_basic_test
2634 /** Command descriptor for FlexRay get version info command */
2635 cmd_des_t const cmd_des_fr_getversioninfo={
2637 "frbtversion","Print FlexRay driver version information",
2638 "=== Command syntax ===\n"
2642 "=== Description ===\n"
2644 "The command stands for Fr_GetVersionInfo function from the Autosar\n"
2646 "It reads and prints the information about vendor, module and version of\n"
2647 "the FlexRay driver\n"
2651 " --> frbtversion\n"
2652 " vendorID: 0xAAAA\n"
2653 " moduleID: 0xBBBB\n"
2654 " sw_major_version: 0x1\n"
2655 " sw_minor_version: 0x2\n"
2656 " sw_patch_version: 0x4\n",
2657 CMD_HANDLER(cmd_do_fr_getversioninfo), (void *)&cmd_list_fr_basic_test
2660 /** Command descriptor for FlexRay get controller configuration command */
2661 cmd_des_t const cmd_des_fr_readcconfig={
2663 "frbtccconfig*","Print value of a FlexRay cluster and node configuration parameter",
2664 "=== Command syntax ===\n"
2666 " frbtccconfig<INDEX>\n"
2668 "where <INDEX> is an identifier of the parameter.\n"
2670 "=== Description ===\n"
2672 "The command stands for Fr_ReadCCConfig function from the Autosar\n"
2673 "specification. The driver stores the configuration parameters as an\n"
2674 "array. Each parameter can be indexed and returned by this command. See\n"
2675 "Autosar specification of the FlexRay driver\n"
2676 "(http://www.autosar.org/download/R4.1/AUTOSAR_SWS_FlexRayDriver.pdf),\n"
2677 "section 8.2.1 for parameter indexes.\n"
2681 " --> frbtccconfig1\n"
2683 CMD_HANDLER(cmd_do_fr_readcconfig), (void *)&cmd_list_fr_basic_test
2686 /** Command descriptor for FlexRay reconfigure buffer command */
2687 cmd_des_t const cmd_des_fr_reconfigure_buffer={
2689 "frbtreconfigurebuf*","Reconfigure a buffer to communicate in another slot",
2690 "=== Command syntax ===\n"
2692 " frbtreconfigurebuf id<ID> slot<SLOT> <CHN> cyc<CYC> max<MAX>\n"
2694 "* <ID> is a number specifying a slot, where the buffer is currently communicating,\n"
2695 "* <SLOT> is a number, where buffer will be communicating after the reconfiguration,\n"
2696 "* <CHN> is one of 'A', 'B' or 'AB' and identifies the used channel,\n"
2697 "* <CYC> is the cycle set when to send the buffer,\n"
2698 "* <MAX> is the number determining the maximum payload (in hald-words).\n"
2700 "=== Description ===\n"
2702 "The command stands for Fr_ReconfigLPDu function from the Autosar\n"
2703 "specification. It reconfigures specified buffer to communicate in\n"
2705 "The reconfiguration must be allowed in node configuration parameter\n"
2706 "secureBuffers. Buffers used for synchronization or assigned to the FIFO\n"
2707 "are not reconfigurable.\n"
2711 " --> frbtreconfigurebuf id2 slot3 AB 0 9\n"
2712 " frbtreconfigurebuf id2 slot3 AB 0 9\n",
2713 CMD_HANDLER(cmd_do_fr_reconfigure_buffer), (void *)&cmd_list_fr_basic_test
2717 /** List of commands for flexRay, defined as external */
2718 cmd_des_t const *cmd_list_fr_basic_test[]={
2719 &cmd_des_fr_user_config,
2720 &cmd_des_fr_config_buffer,
2721 &cmd_des_fr_config_fifo,
2724 &cmd_des_fr_allslots,
2727 &cmd_des_fr_sendwup,
2728 &cmd_des_fr_setwuchannel,
2729 &cmd_des_fr_getpocstatus,
2730 &cmd_des_fr_transmittxlpdu,
2731 &cmd_des_fr_canceltxlpdu,
2732 &cmd_des_fr_receiverxlpdu,
2733 &cmd_des_fr_checktxlpdustatus,
2734 &cmd_des_fr_disablelpdu,
2735 &cmd_des_fr_getglobaltime,
2736 &cmd_des_fr_getnmvector,
2737 &cmd_des_fr_nmwatch,
2738 &cmd_des_fr_getchannelstatus,
2739 &cmd_des_fr_getclockcorrection,
2740 &cmd_des_fr_getsyncframelist,
2741 &cmd_des_fr_getwakeuprxstatus,
2742 &cmd_des_fr_settimer,
2743 &cmd_des_fr_canceltimer,
2744 &cmd_des_fr_timerirq,
2745 &cmd_des_fr_getversioninfo,
2746 &cmd_des_fr_readcconfig,
2747 &cmd_des_fr_reconfigure_buffer,