8 #include "cmd_fr_basic_test.h"
12 #include "cmdproc_utils.h"
19 * This structure contains global FlexRay configuration.
20 * All nodes in the network have to use the same values for
21 * all parameters of this structure.
23 static Fr_TMS570LS_ClusterConfigType Fr_cluster_config = {
24 .gColdStartAttempts = 0x2,
26 .gMacroPerCycle = 0x15E0, // (cycle period, 5.6us)
27 .gMaxWithoutClockCorrectionFatal = 0xF,
28 .gMaxWithoutClockCorrectionPassive = 0xF,
29 .gNetworkManagementVectorLength = 12,
30 .gNumberOfMinislots = 0x15A,
31 .gNumberOfStaticSlots = 0x8,
32 .gOffsetCorrectionStart = 0xAE4,
33 .gPayloadLengthStatic = 0x9,
35 .gdActionPointOffset = 0x4,
36 .gdCASRxLowMax = 0x43,
37 .gdDynamicSlotIdlePhase = 0x1,
39 .gdMinislotActionPointOffset = 0x2,
41 .gdSampleClockPeriod = 0, // 10mbit/sec
43 .gdTSSTransmitter = 0xA,
44 .gdWakeupSymbolRxIdle = 18,
45 .gdWakeupSymbolRxLow = 18,
46 .gdWakeupSymbolRxWindow = 76,
47 .gdWakeupSymbolTxIdle = 180,
48 .gdWakeupSymbolTxLow = 60
52 * This structure contains local configuration of the FlexRay node A.
53 * All nodes in the network shall have their own local configuraion,
54 * but it does not matters if they share some together, until their
55 * buffer configuration differs.
57 static Fr_TMS570LS_NodeConfigType Fr_node_A_config = {
58 .pAllowHaltDueToClock = 0,
59 .pAllowPassiveToActive = FALSE,
60 .pChannels = FR_CHANNEL_AB,
61 .pClusterDriftDamping = 0x1,
62 .pDelayCompensationA = 0x3,
63 .pDelayCompensationB = 0x3,
64 .pExternOffsetCorrection = 0,
65 .pExternRateCorrection = 0,
66 .pKeySlotUsedForStartup = TRUE,
67 .pKeySlotUsedForSync = TRUE,
69 .pMacroInitialOffsetA = 0x6,
70 .pMacroInitialOffsetB = 0x6,
71 .pMicroInitialOffsetA = 0x18,
72 .pMicroInitialOffsetB = 0x18,
73 .pMicroPerCycle = 0x36B00,
74 .pRateCorrectionOut = 0xCD,
75 .pOffsetCorrectionOut = 0x151,
76 .pSamplesPerMicrotick = 0, // 10 mbit/sec
77 .pSingleSlotEnabled = TRUE,
78 .pWakeupChannel = FR_CHANNEL_A,
80 .pdAcceptedStartupRange = 0x81,
81 .pdListenTimeout = 0x36DA2,
83 .pDecodingCorrection = 0x33
87 * This structure contains local configuration of the FlexRay node B.
88 * All nodes in the network shall have their own local configuraion,
89 * but it does not matters if they share some together, until their
90 * buffer configuration differs.
92 static Fr_TMS570LS_NodeConfigType Fr_node_B_config = {
93 .pAllowHaltDueToClock = 0,
94 .pAllowPassiveToActive = FALSE,
95 .pChannels = FR_CHANNEL_AB,
96 .pClusterDriftDamping = 0x1,
97 .pDelayCompensationA = 0x3,
98 .pDelayCompensationB = 0x3,
99 .pExternOffsetCorrection = 0,
100 .pExternRateCorrection = 0,
101 .pKeySlotUsedForStartup = TRUE,
102 .pKeySlotUsedForSync = TRUE,
104 .pMacroInitialOffsetA = 0x6,
105 .pMacroInitialOffsetB = 0x6,
106 .pMicroInitialOffsetA = 0x18,
107 .pMicroInitialOffsetB = 0x18,
108 .pMicroPerCycle = 0x36B00,
109 .pRateCorrectionOut = 0xCD,
110 .pOffsetCorrectionOut = 0x151,
111 .pSamplesPerMicrotick = 0, // 10 mbit/sec
112 .pSingleSlotEnabled = TRUE,
113 .pWakeupChannel = FR_CHANNEL_A,
115 .pdAcceptedStartupRange = 0x81,
116 .pdListenTimeout = 0x36DA2,
118 .pDecodingCorrection = 0x33
121 static Fr_TMS570LS_MsgRAMConfig Fr_node_A_msgRAM_config = {
122 .dynSegmentBufferCount = 3,
123 .fifoBufferCount = 5,
124 .secureBuffers = FR_SB_RECONFIG_ENABLED,
125 .statSegmentBufferCount = 5,
126 .syncFramePayloadMultiplexEnabled = 0
129 static Fr_TMS570LS_MsgRAMConfig Fr_node_B_msgRAM_config = {
130 .dynSegmentBufferCount = 3,
131 .fifoBufferCount = 5,
132 .secureBuffers = FR_SB_RECONFIG_ENABLED,
133 .statSegmentBufferCount = 5,
134 .syncFramePayloadMultiplexEnabled = 0
137 static Fr_TMS570LS_BufferConfigType Fr_node_A_static_buffers_config[] = {
139 .channel = FR_CHANNEL_AB,
140 .cycleCounterFiltering = 0,
143 .msgBufferInterrupt = TRUE,
144 .payloadPreambleIndicatorTr = FALSE,
145 .rejectNullFrames = FALSE,
146 .rejectStaticSegment = FALSE,
147 .singleTransmit = FALSE,
151 .channel = FR_CHANNEL_AB,
152 .cycleCounterFiltering = 0,
155 .msgBufferInterrupt = TRUE,
156 .payloadPreambleIndicatorTr = FALSE,
157 .rejectNullFrames = FALSE,
158 .rejectStaticSegment = FALSE,
159 .singleTransmit = FALSE,
163 .channel = FR_CHANNEL_AB,
164 .cycleCounterFiltering = 0,
167 .msgBufferInterrupt = TRUE,
168 .payloadPreambleIndicatorTr = FALSE,
169 .rejectNullFrames = FALSE,
170 .rejectStaticSegment = FALSE,
171 .singleTransmit = TRUE,
175 .channel = FR_CHANNEL_AB,
176 .cycleCounterFiltering = 0,
179 .msgBufferInterrupt = TRUE,
180 .payloadPreambleIndicatorTr = FALSE,
181 .rejectNullFrames = FALSE,
182 .rejectStaticSegment = FALSE,
183 .singleTransmit = TRUE,
187 .channel = FR_CHANNEL_AB,
188 .cycleCounterFiltering = 0,
191 .msgBufferInterrupt = TRUE,
192 .payloadPreambleIndicatorTr = TRUE,
193 .rejectNullFrames = FALSE,
194 .rejectStaticSegment = FALSE,
195 .singleTransmit = FALSE,
201 static Fr_TMS570LS_BufferConfigType Fr_node_B_static_buffers_config[] = {
203 .channel = FR_CHANNEL_AB,
204 .cycleCounterFiltering = 0,
207 .msgBufferInterrupt = TRUE,
208 .payloadPreambleIndicatorTr = FALSE,
209 .rejectNullFrames = FALSE,
210 .rejectStaticSegment = FALSE,
211 .singleTransmit = FALSE,
215 .channel = FR_CHANNEL_AB,
216 .cycleCounterFiltering = 0,
219 .msgBufferInterrupt = TRUE,
220 .payloadPreambleIndicatorTr = FALSE,
221 .rejectNullFrames = FALSE,
222 .rejectStaticSegment = FALSE,
223 .singleTransmit = FALSE,
227 .channel = FR_CHANNEL_AB,
228 .cycleCounterFiltering = 0,
231 .msgBufferInterrupt = TRUE,
232 .payloadPreambleIndicatorTr = FALSE,
233 .rejectNullFrames = FALSE,
234 .rejectStaticSegment = FALSE,
235 .singleTransmit = TRUE,
239 .channel = FR_CHANNEL_AB,
240 .cycleCounterFiltering = 0,
243 .msgBufferInterrupt = TRUE,
244 .payloadPreambleIndicatorTr = FALSE,
245 .rejectNullFrames = FALSE,
246 .rejectStaticSegment = FALSE,
247 .singleTransmit = TRUE,
251 .channel = FR_CHANNEL_AB,
252 .cycleCounterFiltering = 0,
255 .msgBufferInterrupt = TRUE,
256 .payloadPreambleIndicatorTr = TRUE,
257 .rejectNullFrames = FALSE,
258 .rejectStaticSegment = FALSE,
259 .singleTransmit = FALSE,
264 static Fr_TMS570LS_BufferConfigType Fr_node_A_dynamic_buffers_config[] = {
266 .channel = FR_CHANNEL_A,
267 .cycleCounterFiltering = 0,
270 .msgBufferInterrupt = TRUE,
271 .payloadPreambleIndicatorTr = FALSE,
272 .rejectNullFrames = FALSE,
273 .rejectStaticSegment = FALSE,
274 .singleTransmit = FALSE,
278 .channel = FR_CHANNEL_B,
279 .cycleCounterFiltering = 0,
282 .msgBufferInterrupt = TRUE,
283 .payloadPreambleIndicatorTr = FALSE,
284 .rejectNullFrames = FALSE,
285 .rejectStaticSegment = FALSE,
286 .singleTransmit = FALSE,
290 .channel = FR_CHANNEL_A,
291 .cycleCounterFiltering = 0,
294 .msgBufferInterrupt = TRUE,
295 .payloadPreambleIndicatorTr = FALSE,
296 .rejectNullFrames = FALSE,
297 .rejectStaticSegment = FALSE,
298 .singleTransmit = TRUE,
304 static Fr_TMS570LS_BufferConfigType Fr_node_B_dynamic_buffers_config[] = {
306 .channel = FR_CHANNEL_B,
307 .cycleCounterFiltering = 0,
310 .msgBufferInterrupt = TRUE,
311 .payloadPreambleIndicatorTr = FALSE,
312 .rejectNullFrames = FALSE,
313 .rejectStaticSegment = FALSE,
314 .singleTransmit = TRUE,
318 .channel = FR_CHANNEL_A,
319 .cycleCounterFiltering = 0,
322 .msgBufferInterrupt = TRUE,
323 .payloadPreambleIndicatorTr = FALSE,
324 .rejectNullFrames = FALSE,
325 .rejectStaticSegment = FALSE,
326 .singleTransmit = TRUE,
330 .channel = FR_CHANNEL_A,
331 .cycleCounterFiltering = 0,
334 .msgBufferInterrupt = TRUE,
335 .payloadPreambleIndicatorTr = FALSE,
336 .rejectNullFrames = FALSE,
337 .rejectStaticSegment = FALSE,
338 .singleTransmit = TRUE,
343 static Fr_TMS570LS_BufferConfigType Fr_node_A_fifo_buffers_config[] = {
345 .channel = FR_CHANNEL_AB,
346 .cycleCounterFiltering = 0,
349 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
350 .payloadPreambleIndicatorTr = FALSE,
351 .rejectNullFrames = TRUE,
352 .rejectStaticSegment = FALSE,
353 .singleTransmit = FALSE,
357 .channel = FR_CHANNEL_AB,
358 .cycleCounterFiltering = 0,
361 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
362 .payloadPreambleIndicatorTr = FALSE,
363 .rejectNullFrames = TRUE,
364 .rejectStaticSegment = FALSE,
365 .singleTransmit = FALSE,
369 .channel = FR_CHANNEL_AB,
370 .cycleCounterFiltering = 0,
373 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
374 .payloadPreambleIndicatorTr = FALSE,
375 .rejectNullFrames = TRUE,
376 .rejectStaticSegment = FALSE,
377 .singleTransmit = FALSE,
381 .channel = FR_CHANNEL_AB,
382 .cycleCounterFiltering = 0,
385 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
386 .payloadPreambleIndicatorTr = FALSE,
387 .rejectNullFrames = TRUE,
388 .rejectStaticSegment = FALSE,
389 .singleTransmit = FALSE,
393 .channel = FR_CHANNEL_AB,
394 .cycleCounterFiltering = 0,
397 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
398 .payloadPreambleIndicatorTr = FALSE,
399 .rejectNullFrames = TRUE,
400 .rejectStaticSegment = FALSE,
401 .singleTransmit = FALSE,
406 static Fr_TMS570LS_BufferConfigType Fr_node_B_fifo_buffers_config[] = {
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,
417 .slotId = 0 // No Frame is rejected
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,
429 .slotId = 0 // No Frame is rejected
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,
441 .slotId = 0 // No Frame is rejected
444 .channel = FR_CHANNEL_AB,
445 .cycleCounterFiltering = 0,
448 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
449 .payloadPreambleIndicatorTr = FALSE,
450 .rejectNullFrames = TRUE,
451 .rejectStaticSegment = FALSE,
452 .singleTransmit = FALSE,
453 .slotId = 0 // No Frame is rejected
456 .channel = FR_CHANNEL_AB,
457 .cycleCounterFiltering = 0,
460 .msgBufferInterrupt = FALSE, // Recomended for FIFO buffers
461 .payloadPreambleIndicatorTr = FALSE,
462 .rejectNullFrames = TRUE,
463 .rejectStaticSegment = FALSE,
464 .singleTransmit = FALSE,
465 .slotId = 0 // No Frame is rejected
470 static Fr_ConfigType Fr_config_node_A= {
471 .clusterConfiguration = &Fr_cluster_config,
472 .dynamicBufferConfigs = Fr_node_A_dynamic_buffers_config,
473 .fifoBufferConfigs = Fr_node_A_fifo_buffers_config,
474 .msgRAMConfig = &Fr_node_A_msgRAM_config,
475 .nodeConfiguration = &Fr_node_A_config,
476 .staticBufferConfigs = Fr_node_A_static_buffers_config
479 static Fr_ConfigType Fr_config_node_B= {
480 .clusterConfiguration = &Fr_cluster_config,
481 .dynamicBufferConfigs = Fr_node_B_dynamic_buffers_config,
482 .fifoBufferConfigs = Fr_node_B_fifo_buffers_config,
483 .msgRAMConfig = &Fr_node_B_msgRAM_config,
484 .nodeConfiguration = &Fr_node_B_config,
485 .staticBufferConfigs = Fr_node_B_static_buffers_config
489 * @brief Do the user configuration of the FlexRay cluster parameters
491 * @param[in] cmd_io Pointer to IO stack
492 * @param[in] des Pointer to command descriptor
493 * @param[in] param Parameters of command
494 * @return 0 when OK or error code
496 int cmd_do_fr_user_config(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
498 token = strtok(param[1], " ");
499 if (strcmp(token, "cluster") == 0) {
500 if (rpp_fr_config_cluster_params(param[2]) == FAILURE) {
501 rpp_sci_printf("FlexRay cluster configuration not accepted.\n");
502 return -CMDERR_BADPAR;
504 rpp_sci_printf("FlexRay cluster configuration accepted.\n");
506 else if (strcmp(token, "node") == 0) {
507 if (rpp_fr_config_node_params(param[2]) == FAILURE) {
508 rpp_sci_printf("FlexRay node configuration not accepted.\n");
509 return -CMDERR_BADPAR;
511 rpp_sci_printf("FlexRay node configuration accepted.\n");
513 else if (strcmp(token, "stat") == 0) {
514 if (rpp_fr_config_static_buffer(param[2]) == FAILURE) {
515 rpp_sci_printf("Static buffer configuration not accepted.\n");
516 return -CMDERR_BADPAR;
518 rpp_sci_printf("Static buffer configuration accepted.\n");
520 else if (strcmp(token, "dyn") == 0) {
521 if (rpp_fr_config_dynamic_buffer(param[2]) == FAILURE) {
522 rpp_sci_printf("Dynamic buffer configuration not accepted.\n");
523 return -CMDERR_BADPAR;
525 rpp_sci_printf("Dynamic buffer configuration accepted.\n");
528 else if (strcmp(token, "fifo") == 0) {
529 if (rpp_fr_config_fifo_buffer(param[2]) == FAILURE) {
530 rpp_sci_printf("FIFO buffer configuration not accepted.\n");
531 return -CMDERR_BADPAR;
533 rpp_sci_printf("FIFO buffer configuration accepted.\n");
536 return -CMDERR_BADPAR;
543 * @brief Initialize the device as FlexRay node.
545 * @param[in] cmd_io Pointer to IO stack
546 * @param[in] des Pointer to command descriptor
547 * @param[in] param Parameters of command
548 * @return 0 when OK or error code
550 int cmd_do_fr_init(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
551 const Fr_ConfigType* Fr_ConfigPtr = NULL;
552 int8_t retVal = SUCCESS;
553 uint32_t error = ERR_PARAM_NO_ERROR;
555 if (*param[1] == 'A') {
556 Fr_ConfigPtr = &Fr_config_node_A;
558 else if (*param[1] == 'B') {
559 Fr_ConfigPtr = &Fr_config_node_B;
561 else if (*param[1] == 'U') { // Select the user configuration - call config commands first
565 return -CMDERR_BADPAR;
568 retVal = rpp_fr_init_driver(Fr_ConfigPtr, &error);
569 if (retVal == SUCCESS) {
570 rpp_sci_printf("FlexRay driver initialized.\r\n");
573 rpp_sci_printf("FlexRay needs to be configured before initialization.\r\n");
574 return -CMDERR_BADCFG;
577 retVal = rpp_fr_init_controller(0, &error);
578 if (retVal == SUCCESS) {
579 rpp_sci_printf("FlexRay controller initialized.\r\n");
582 if (error & FR_INIT_ERR_CLUSTER_CONFIG) {
583 rpp_sci_printf("Cluster configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
585 else if (error & FR_INIT_ERR_NODE_CONFIG) {
586 rpp_sci_printf("Node configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
588 else if (error & FR_INIT_ERR_MSGRAM_CONFIG) {
589 rpp_sci_printf("Message RAM configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
591 else if (error & FR_INIT_ERR_BUFFPARAM_CONFIG) {
592 rpp_sci_printf("Buffer configuration data error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
594 else if (error & (uint32_t)FR_INIT_ERR_BUFF_CONFIG) {
595 rpp_sci_printf("Buffer configuration error: %x\r\n", (retVal & 0x3FFFFFE) >> 1 );
598 rpp_sci_printf("POC state switching error.\r\n");
600 return -CMDERR_BADCFG;
606 * @brief Starts FlexRay communication
608 * @param[in] cmd_io Pointer to IO stack
609 * @param[in] des Pointer to command descriptor
610 * @param[in] param Parameters of command
611 * @return 0 when OK or error code
613 int cmd_do_fr_start(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
614 int8_t retVal = SUCCESS;
615 uint32_t error = ERR_PARAM_NO_ERROR;
617 retVal = rpp_fr_start_communication(0, &error);
618 if (retVal == SUCCESS) {
619 rpp_sci_printf("FlexRay communication is running.\r\n");
622 if (error & FR_STARTUP_ERR_SW_STUP_FOLLOW) {
623 rpp_sci_printf("Can not switch POC to RUN state.\r\n");
625 else if (error & FR_STARTUP_ERR_CSINH_DIS) {
626 rpp_sci_printf("Cold start inhibit disabled error.\r\n");
628 else if (error & FR_STARTUP_ERR_SW_STUP_READY) {
629 rpp_sci_printf("Can not switch back to READY from STARTUP.\r\n");
631 else if (error & FR_STARTUP_ERR_SW_STUP_AS_NCOLD) {
632 rpp_sci_printf("Can not switch to STARTUP as non-coldstarter.\r\n");
635 rpp_sci_printf("General error.\r\n");
637 return -CMDERR_BADCFG;
643 * @brief Invokes POC command ALL_SLOTS
645 * @param[in] cmd_io Pointer to IO stack
646 * @param[in] des Pointer to command descriptor
647 * @param[in] param Parameters of command
648 * @return 0 when OK or error code
650 int cmd_do_fr_allslots(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
651 int8_t retVal = ERR_PARAM_NO_ERROR;
652 retVal = rpp_fr_all_slots(0);
653 if (retVal == SUCCESS) {
654 rpp_sci_printf("FlexRay node is communicating in all slots.\r\n");
657 rpp_sci_printf("General error.\r\n");
658 return -CMDERR_BADCFG;
664 * @brief Halt FlexRay communication
666 * @param[in] cmd_io Pointer to IO stack
667 * @param[in] des Pointer to command descriptor
668 * @param[in] param Parameters of command
669 * @return 0 when OK or error code
671 int cmd_do_fr_halt(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
672 int8_t retVal = ERR_PARAM_NO_ERROR;
673 retVal = rpp_fr_halt_communication(0);
674 if (retVal == SUCCESS) {
675 rpp_sci_printf("FlexRay node communication halted.\r\n");
678 rpp_sci_printf("General error.\r\n");
679 return -CMDERR_BADCFG;
685 * @brief Abort FlexRay communication
687 * @param[in] cmd_io Pointer to IO stack
688 * @param[in] des Pointer to command descriptor
689 * @param[in] param Parameters of command
690 * @return 0 when OK or error code
692 int cmd_do_fr_abort(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
693 int8_t retVal = ERR_PARAM_NO_ERROR;
694 retVal = rpp_fr_abort_communication(0);
695 if (retVal == SUCCESS) {
696 rpp_sci_printf("FlexRay node communication aborted.\r\n");
699 rpp_sci_printf("General error.\r\n");
700 return -CMDERR_BADCFG;
706 * @brief Send wake up pattern
708 * @param[in] cmd_io Pointer to IO stack
709 * @param[in] des Pointer to command descriptor
710 * @param[in] param Parameters of command
711 * @return 0 when OK or error code
713 int cmd_do_fr_sendwup(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
714 int8_t retVal = ERR_PARAM_NO_ERROR;
715 retVal = rpp_fr_send_wup(0);
716 if (retVal == SUCCESS) {
717 rpp_sci_printf("Wake up pattern has been sent.\r\n");
720 rpp_sci_printf("General error.\r\n");
721 return -CMDERR_BADCFG;
727 * @brief Set channel for wake up pattern sending.
729 * @param[in] cmd_io Pointer to IO stack
730 * @param[in] des Pointer to command descriptor
731 * @param[in] param Parameters of command
732 * @return 0 when OK or error code
734 int cmd_do_fr_setwuchannel(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
735 int8_t retVal = ERR_PARAM_NO_ERROR;
736 Fr_ChannelType channel = FR_CHANNEL_A;
738 if (*param[1] == 'A') {
739 channel = FR_CHANNEL_A;
741 else if (*param[1] == 'B') {
742 channel = FR_CHANNEL_B;
745 return -CMDERR_BADPAR;
747 retVal = rpp_fr_set_wu_channel(0, channel);
748 if (retVal == SUCCESS) {
749 rpp_sci_printf("Wake up channel has been set.\r\n");
752 rpp_sci_printf("General error.\r\n");
753 return -CMDERR_BADCFG;
759 * @brief Get and print POC status of the FlexRay controller.
761 * @param[in] cmd_io Pointer to IO stack
762 * @param[in] des Pointer to command descriptor
763 * @param[in] param Parameters of command
764 * @return 0 when OK or error code
766 int cmd_do_fr_getpocstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
767 int8_t retVal = ERR_PARAM_NO_ERROR;
768 Fr_POCStatusType status;
769 char* ErrorModeStrings[] = {"ACTIVE", "HALT", "PASSIVE"};
770 char* SlotModeStrings[] = {"KEYSLOT", "ALL_PENDING", "ALL"};
771 char* StartupStateStrings[] = {
772 "UNDEFINED", "COLDSTART_LISTEN", "COLDSTART_CHECK", "COLDSTART_JOIN",
773 "COLDSTART_CONSISTENCY_CHECK", "INTEGRATION_LISTEN", "INITIALIZE_SCHEDULE", "INTEGRATION_CONSISTENCY_CHECK",
774 "COLDSTART_GAP", "EXTERNAL_STARTUP", "ABORT", "COLDSTART_COLLISION_RESOLUTION",
777 char* StateStrings[] = {
778 "CONFIG", "DEFAULT_CONFIG", "HALT", "NORMAL_ACTIVE",
779 "NORMAL_PASSIVE", "READY", "STARTUP", "LOOPBACK",
782 char* WakeupStatusStrings[] = {
783 "UNDEFINED", "RECEIVED_HEADER", "RECEIVED_WUP", "COLLISION_HEADER",
784 "COLLISION_WUP", "COLLISION_UNKNOWN", "TRANSMITTED"
787 retVal = rpp_fr_get_poc_status(0, &status);
788 if (retVal == SUCCESS) {
789 rpp_sci_printf("POC status:\r\n");
790 rpp_sci_printf("CHIHaltRequest: %s\r\n", (status.CHIHaltRequest == TRUE) ? "TRUE" : "FALSE");
791 rpp_sci_printf("CHIReadyRequest: %s\r\n", (status.CHIReadyRequest == TRUE) ? "TRUE" : "FALSE");
792 rpp_sci_printf("ColdstartNoise: %s\r\n", (status.ColdstartNoise == TRUE) ? "TRUE" : "FALSE");
793 rpp_sci_printf("Freeze: %s\r\n", (status.Freeze == TRUE) ? "TRUE" : "FALSE");
794 rpp_sci_printf("ErrorMode: %s\r\n", ErrorModeStrings[status.ErrorMode]);
795 rpp_sci_printf("SlotMode: %s\r\n", SlotModeStrings[status.SlotMode]);
796 rpp_sci_printf("StartupState: %s\r\n", StartupStateStrings[status.StartupState]);
797 rpp_sci_printf("State: %s\r\n", StateStrings[status.State]);
798 rpp_sci_printf("WakeupStatus: %s\r\n", WakeupStatusStrings[status.WakeupStatus]);
801 rpp_sci_printf("General error.\r\n");
802 return -CMDERR_BADCFG;
808 * @brief Send given data through the FlexRay in selected slot.
810 * @param[in] cmd_io Pointer to IO stack
811 * @param[in] des Pointer to command descriptor
812 * @param[in] param Parameters of command
813 * @return 0 when OK or error code
815 int cmd_do_fr_transmittxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
816 int8_t retVal = ERR_PARAM_NO_ERROR;
819 int values[MAX_PARAM_VALUES_NUM];
820 uint8_t data[MAX_PARAM_VALUES_NUM];
823 if (sscanf(param[1], "%d", &slotID) != 1) {
824 return -CMDERR_BADPAR;
826 if (sscanf(param[2], " %2x", &values[0]) != 1) {
827 return -CMDERR_BADPAR;
829 data[0] = (uint8_t)values[0];
830 token = strtok(param[2], " ");
831 token = strtok(NULL, " ");
833 while (dataLength < MAX_PARAM_VALUES_NUM && token != NULL) {
834 if (sscanf(token, "%2x", &values[dataLength]) == EOF) {
837 data[dataLength] = (uint8_t)values[dataLength];
838 token = strtok(NULL, " ");
842 retVal = rpp_fr_transmit_lpdu(0, slotID, data, dataLength);
843 if (retVal == SUCCESS) {
844 rpp_sci_printf("Data were sent.\r\n");
847 rpp_sci_printf("General error.\r\n");
848 return -CMDERR_BADCFG;
854 * @brief Cancel the transmission in the selected slot.
856 * @param[in] cmd_io Pointer to IO stack
857 * @param[in] des Pointer to command descriptor
858 * @param[in] param Parameters of command
859 * @return 0 when OK or error code
861 int cmd_do_fr_canceltxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
862 int8_t retVal = ERR_PARAM_NO_ERROR;
865 if (sscanf(param[1], "%d", &slotID) != 1) {
866 return -CMDERR_BADPAR;
868 if (param[2] != NULL) {
869 return -CMDERR_BADPAR;
872 retVal = rpp_fr_cancel_transmit_lpdu(0, slotID);
873 if (retVal == SUCCESS) {
874 rpp_sci_printf("Transmission canceled.\r\n");
877 rpp_sci_printf("General error.\r\n");
878 return -CMDERR_BADCFG;
884 * @brief Receive data from selected slot.
886 * @param[in] cmd_io Pointer to IO stack
887 * @param[in] des Pointer to command descriptor
888 * @param[in] param Parameters of command
889 * @return 0 when OK or error code
891 int cmd_do_fr_receiverxlpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
892 int8_t retVal = ERR_PARAM_NO_ERROR;
894 uint8_t data[cPayloadLengthMax];
895 Fr_RxLPduStatusType status;
896 uint8_t receivedLength = 0;
899 if (sscanf(param[1], "%d", &slotID) != 1) {
900 return -CMDERR_BADPAR;
902 if (param[2] != NULL) {
903 return -CMDERR_BADPAR;
906 retVal = rpp_fr_receive_lpdu(0, slotID, data, &status, &receivedLength);
907 if (retVal == SUCCESS) {
909 case FR_RECEIVED_MORE_DATA_AVAILABLE:
910 rpp_sci_printf("More messages are still in FIFO:\r\n");
912 rpp_sci_printf("Received message (%d B):\r\n", receivedLength);
913 for (i = 0; i < receivedLength; i++) {
914 rpp_sci_printf(" %x", data[i]);
916 rpp_sci_printf("\r\n");
919 rpp_sci_printf("No message received.\r\n");
924 rpp_sci_printf("General error.\r\n");
925 return -CMDERR_BADCFG;
931 * @brief Returns TX LPdu status.
933 * @param[in] cmd_io Pointer to IO stack
934 * @param[in] des Pointer to command descriptor
935 * @param[in] param Parameters of command
936 * @return 0 when OK or error code
938 int cmd_do_fr_checktxlpdustatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
939 int8_t retVal = ERR_PARAM_NO_ERROR;
941 Fr_TxLPduStatusType status;
942 char* statusStrings[] = {"is not", "is"};
944 if (sscanf(param[1], "%d", &slotID) != 1) {
945 return -CMDERR_BADPAR;
947 if (param[2] != NULL) {
948 return -CMDERR_BADPAR;
951 retVal = rpp_fr_check_tx_lpdu_status(0, slotID, &status);
952 if (retVal == SUCCESS) {
953 rpp_sci_printf("Message transmission %s pending.\r\n", statusStrings[status]);
956 rpp_sci_printf("General error.\r\n");
957 return -CMDERR_BADCFG;
963 * @brief Disable buffer.
965 * @param[in] cmd_io Pointer to IO stack
966 * @param[in] des Pointer to command descriptor
967 * @param[in] param Parameters of command
968 * @return 0 when OK or error code
970 int cmd_do_fr_disablelpdu(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
971 int8_t retVal = ERR_PARAM_NO_ERROR;
974 if (sscanf(param[1], "%d", &slotID) != 1) {
975 return -CMDERR_BADPAR;
977 if (param[2] != NULL) {
978 return -CMDERR_BADPAR;
981 retVal = rpp_fr_disable_lpdu(0, slotID);
982 if (retVal == SUCCESS) {
983 rpp_sci_printf("Buffer disabled.\r\n");
986 rpp_sci_printf("General error.\r\n");
987 return -CMDERR_BADCFG;
993 * @brief Print global time of the FlexRay network.
995 * @param[in] cmd_io Pointer to IO stack
996 * @param[in] des Pointer to command descriptor
997 * @param[in] param Parameters of command
998 * @return 0 when OK or error code
1000 int cmd_do_fr_getglobaltime(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1001 int8_t retVal = ERR_PARAM_NO_ERROR;
1003 uint16_t macroTick = 0;
1005 retVal = rpp_fr_get_global_time(0, &cycle, ¯oTick);
1006 if (retVal == SUCCESS) {
1007 rpp_sci_printf("Cycle number: %d\r\nMacrotick number: %d\r\n", cycle, macroTick);
1010 rpp_sci_printf("General error.\r\n");
1011 return -CMDERR_BADCFG;
1017 * @brief Print network management vector of the FlexRay node.
1019 * @param[in] cmd_io Pointer to IO stack
1020 * @param[in] des Pointer to command descriptor
1021 * @param[in] param Parameters of command
1022 * @return 0 when OK or error code
1024 int cmd_do_fr_getnmvector(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1025 int8_t retVal = ERR_PARAM_NO_ERROR;
1026 uint8_t nmVector[12];
1029 retVal = rpp_fr_get_network_management_vector(0, nmVector);
1030 if (retVal == SUCCESS) {
1031 rpp_sci_printf("Network management vector:");
1032 for (i = 0; i < Fr_cluster_config.gNetworkManagementVectorLength; i++) {
1033 rpp_sci_printf(" %x", nmVector[i]);
1035 rpp_sci_printf("\r\n");
1038 rpp_sci_printf("General error.\r\n");
1039 return -CMDERR_BADCFG;
1045 * @brief Print both channels status of the FlexRay node.
1047 * @param[in] cmd_io Pointer to IO stack
1048 * @param[in] des Pointer to command descriptor
1049 * @param[in] param Parameters of command
1050 * @return 0 when OK or error code
1052 int cmd_do_fr_getchannelstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1053 int8_t retVal = ERR_PARAM_NO_ERROR;
1056 char* decodeStrings[] = {
1057 "aggregated channel status vSS!ValidFrame",
1058 "aggregated channel status vSS!SyntaxError",
1059 "aggregated channel status vSS!ContentError",
1060 "aggregated channel status additional communication",
1061 "aggregated channel status vSS!Bviolation",
1062 "aggregated channel status vSS!TxConflict",
1065 "symbol window status data vSS!ValidMTS",
1066 "symbol window status data vSS!SyntaxError",
1067 "symbol window status data vSS!Bviolation",
1068 "symbol window status data vSS!TxConflict",
1069 "NIT status data vSS!SyntaxError",
1070 "NIT status data vSS!Bviolation",
1074 char* channelNames[] = {"A", "B"};
1075 char* boolStrings[] = {"FALSE", "TRUE"};
1076 uint16_t channelStatuses[2];
1078 retVal = rpp_fr_get_channel_status(0, &channelStatuses[0], &channelStatuses[1]);
1079 if (retVal == SUCCESS) {
1080 for (channel = 0; channel < 2; channel++) {
1081 rpp_sci_printf("Channel %s status:\r\n", channelNames[channel]);
1082 for (index = 0; index < 16; index++) {
1083 rpp_sci_printf("\t%s: %s\r\n", decodeStrings[index], boolStrings[ (channelStatuses[channel] >> index) & 0x1 ] );
1088 rpp_sci_printf("General error.\r\n");
1089 return -CMDERR_BADCFG;
1095 * @brief Print clock correction of the FlexRay node
1097 * @param[in] cmd_io Pointer to IO stack
1098 * @param[in] des Pointer to command descriptor
1099 * @param[in] param Parameters of command
1100 * @return 0 when OK or error code
1102 int cmd_do_fr_getclockcorrection(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1103 int8_t retVal = ERR_PARAM_NO_ERROR;
1104 int16_t rateCorrection;
1105 int32_t offsetCorrection;
1107 retVal = rpp_fr_get_clock_correction(0, &rateCorrection, &offsetCorrection);
1108 if (retVal == SUCCESS) {
1109 rpp_sci_printf("Rate correction: %d\r\nOffset correction: %d\r\n", rateCorrection, offsetCorrection);
1112 rpp_sci_printf("General error.\r\n");
1113 return -CMDERR_BADCFG;
1119 * @brief Print list of syncframec transmitted on both channels via the even and odd cycle.
1121 * @param[in] cmd_io Pointer to IO stack
1122 * @param[in] des Pointer to command descriptor
1123 * @param[in] param Parameters of command
1124 * @return 0 when OK or error code
1126 int cmd_do_fr_getsyncframelist(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1127 int8_t retVal = ERR_PARAM_NO_ERROR;
1128 uint16_t channelAEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1129 uint16_t channelBEvenList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1130 uint16_t channelAOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1131 uint16_t channelBOddList[FR_MAX_SYNC_FRAME_LIST_SIZE];
1132 uint32_t listSize = 0;
1135 if (sscanf(param[1], "%d", &listSize) != 1) {
1136 return -CMDERR_BADPAR;
1138 if (param[2] != NULL) {
1139 return -CMDERR_BADPAR;
1141 if (listSize > FR_MAX_SYNC_FRAME_LIST_SIZE) {
1142 return -CMDERR_BADPAR;
1145 retVal = rpp_fr_get_sync_frame_list(0, listSize, channelAEvenList, channelBEvenList, channelAOddList, channelBOddList);
1146 if (retVal == SUCCESS) {
1147 rpp_sci_printf("| Channel A even | channel B even | channel A odd | channel B odd |\r\n");
1148 rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
1149 for (i = 0; i < listSize; i++) {
1150 rpp_sci_printf("| %-14x | %-14x | %-14x | %-14x |\r\n", channelAEvenList[i], channelBEvenList[i], channelAOddList[i], channelBOddList[i]);
1152 rpp_sci_printf("|----------------|----------------|----------------|----------------|\r\n");
1156 rpp_sci_printf("General error.\r\n");
1157 return -CMDERR_BADCFG;
1163 * @brief Print status of wakeup on each channels (wakeup received on channel or not yet received).
1165 * @param[in] cmd_io Pointer to IO stack
1166 * @param[in] des Pointer to command descriptor
1167 * @param[in] param Parameters of command
1168 * @return 0 when OK or error code
1170 int cmd_do_fr_getwakeuprxstatus(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1171 int8_t retVal = ERR_PARAM_NO_ERROR;
1173 char* statusStrings[] = {"was not yet", "was"};
1174 char* channelNames[] = {"A", "B"};
1177 retVal = rpp_fr_get_wakeup_rx_status(0, &status);
1178 if (retVal == SUCCESS) {
1179 for (i = 0; i < 2; i++) {
1180 rpp_sci_printf("Wake up pattern %s received on channel %s.\r\n", statusStrings[(status >> i) & 0x1], channelNames[i]);
1184 rpp_sci_printf("General error.\r\n");
1185 return -CMDERR_BADCFG;
1191 * @brief Set and start absolute timer.
1193 * @param[in] cmd_io Pointer to IO stack
1194 * @param[in] des Pointer to command descriptor
1195 * @param[in] param Parameters of command
1196 * @return 0 when OK or error code
1198 int cmd_do_fr_settimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1199 int8_t retVal = ERR_PARAM_NO_ERROR;
1205 if (sscanf(param[1], "%d", &timer) != 1) {
1206 return -CMDERR_BADPAR;
1208 if ((token = strtok(param[2], " ")) == NULL) {
1209 return -CMDERR_BADPAR;
1211 if (sscanf(token, " %d", &cycle) != 1) {
1212 return -CMDERR_BADPAR;
1214 if ((token = strtok(NULL, " ")) == NULL) {
1215 return -CMDERR_BADPAR;
1217 if (sscanf(token, " %d", &offset) != 1) {
1218 return -CMDERR_BADPAR;
1220 if ((token = strtok(NULL, " ")) != NULL) {
1221 return -CMDERR_BADPAR;
1224 retVal = rpp_fr_set_timer(0, timer, cycle, offset);
1225 if (retVal == SUCCESS) {
1226 rpp_sci_printf("Timer was set.\r\n");
1229 rpp_sci_printf("General error.\r\n");
1230 return -CMDERR_BADCFG;
1236 * @brief Cancel selected timer
1238 * @param[in] cmd_io Pointer to IO stack
1239 * @param[in] des Pointer to command descriptor
1240 * @param[in] param Parameters of command
1241 * @return 0 when OK or error code
1243 int cmd_do_fr_canceltimer(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1244 int8_t retVal = ERR_PARAM_NO_ERROR;
1247 if (sscanf(param[1], "%d", &timer) != 1) {
1248 return -CMDERR_BADPAR;
1251 if (param[2] != NULL) {
1252 return -CMDERR_BADPAR;
1255 retVal = rpp_fr_cancel_timer(0, timer);
1256 if (retVal == SUCCESS) {
1257 rpp_sci_printf("Timer was canceled.\r\n");
1260 rpp_sci_printf("General error.\r\n");
1261 return -CMDERR_BADCFG;
1267 * @brief Enable/disable, acknowledge, get timer IRQ
1269 * @param[in] cmd_io Pointer to IO stack
1270 * @param[in] des Pointer to command descriptor
1271 * @param[in] param Parameters of command
1272 * @return 0 when OK or error code
1274 int cmd_do_fr_timerirq(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1275 int8_t retVal = ERR_PARAM_NO_ERROR;
1278 boolean_t status = FALSE;
1279 char* boolStrings[] = {"FALSE", "TRUE"};
1282 if (sscanf(param[1], "%d", &timer) != 1) {
1283 return -CMDERR_BADPAR;
1286 if (param[2] == NULL) { // Get timer IRQ
1287 retVal = rpp_fr_get_timer_irq_status(0, timer, &status);
1288 if (retVal == SUCCESS) {
1289 rpp_sci_printf("IRQ = %s\r\n", boolStrings[status]);
1292 rpp_sci_printf("General error.\r\n");
1293 return -CMDERR_BADCFG;
1296 else { // Some set action
1297 if (sscanf(param[2], "%4s", str) != 1) {
1298 return -CMDERR_BADPAR;
1300 if (strcmp(str, "EN") == 0) { // Enable IRQ
1301 retVal = SUCCESS; // No interrupts imlemented
1303 else if (strcmp(str, "DIS") == 0) { // Disable IRQ
1304 retVal = SUCCESS; // No interrupts implemented
1306 else if (strcmp(str, "ACK") == 0) { // Clear IRQ
1307 retVal = rpp_fr_clear_timer_irq(0, timer);
1309 else { // Bad argument
1310 return -CMDERR_BADPAR;
1313 if (retVal == SUCCESS) {
1314 rpp_sci_printf("OK\r\n");
1317 rpp_sci_printf("General error.\r\n");
1318 return -CMDERR_BADCFG;
1325 * @brief Print FlexRay driver version info.
1327 * @param[in] cmd_io Pointer to IO stack
1328 * @param[in] des Pointer to command descriptor
1329 * @param[in] param Parameters of command
1330 * @return 0 when OK or error code
1332 int cmd_do_fr_getversioninfo(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1333 Std_VersionInfoType versionInfo;
1335 rpp_fr_get_driver_version(&versionInfo);
1336 rpp_sci_printf("vendorID: %#x\r\n", versionInfo.vendorID);
1337 rpp_sci_printf("moduleID: %#x\r\n", versionInfo.moduleID);
1338 rpp_sci_printf("sw_major_version: %#x\r\n", versionInfo.sw_major_version);
1339 rpp_sci_printf("sw_minor_version: %#x\r\n", versionInfo.sw_minor_version);
1340 rpp_sci_printf("sw_patch_version: %#x\r\n", versionInfo.sw_patch_version);
1346 * @brief Print value of FlexRay configuratoin parameter.
1348 * @param[in] cmd_io Pointer to IO stack
1349 * @param[in] des Pointer to command descriptor
1350 * @param[in] param Parameters of command
1351 * @return 0 when OK or error code
1353 int cmd_do_fr_readcconfig(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
1354 int8_t retVal = ERR_PARAM_NO_ERROR;
1358 if (sscanf(param[1], "%d", &index) != 1) {
1359 return -CMDERR_BADPAR;
1362 if (param[2] != NULL) {
1363 return -CMDERR_BADPAR;
1366 retVal = rpp_fr_read_com_ctrl_config(0, index, &value);
1367 if (retVal == SUCCESS) {
1368 rpp_sci_printf("Value = %#x\r\n", value);
1371 rpp_sci_printf("General error.\r\n");
1372 return -CMDERR_BADCFG;
1379 /** Command descriptor for FlexRay user config cluster command */
1380 cmd_des_t const cmd_des_fr_user_config={
1382 "frbtuser*","Set the user configuration parameters",
1383 "=== Command syntax ===\n"
1385 " frbtuser<TYPE> <PARAMS>\n"
1387 "* <TYPE> is a string, which is selecting the type of parameters to be set. It can be: \"cluster\", \"node\", \"stat\", \"fifo\" or \"dyn\"\n"
1388 "* <PARAMS> is a string, containing hexadecimal numbers separated by spaces. Each number stands for one parameter.\n"
1390 "=== Description ===\n"
1392 "The command takes the configuration parameters in form of string and set the\n"
1393 "appropriate type of the FlexRay parameters.\n"
1394 "It is necessary to configure at least cluster, node and one static buffer.\n"
1395 "The type of the parameters can be selected by <TYPE> selector.\n"
1396 "The type \"cluster\" sets global FlexRay network parameters. 25 parameters in\n"
1397 "the string is expected in this order:\n"
1398 "1) gColdStartAttempts\n"
1399 "2) gdActionPointOffset\n"
1400 "3) gdCASRxLowMax\n"
1401 "4) gdDynamicSlotIdlePhase\n"
1403 "6) gdMinislotActionPointOffset\n"
1405 "8) gdTSSTransmitter\n"
1406 "9) gdWakeupSymbolRxIdle\n"
1407 "10) gdWakeupSymbolRxLow\n"
1408 "11) gdWakeupSymbolRxWindow\n"
1409 "12) gdWakeupSymbolTxIdle\n"
1410 "13) gdWakeupSymbolTxLow\n"
1411 "14) gListenNoise\n"
1412 "15) gMacroPerCycle\n"
1413 "16) gMaxWithoutClockCorrectionFatal\n"
1414 "17) gMaxWithoutClockCorrectionPassive\n"
1415 "18) gNumberOfMinislots\n"
1416 "19) gNumberOfStaticSlots\n"
1417 "20) gOffsetCorrectionStart\n"
1418 "21) gPayloadLengthStatic\n"
1419 "22) gSyncNodeMax\n"
1421 "24) gdSampleClockPeriod\n"
1422 "25) gNetworkManagementVectorLength\n"
1424 "The type \"node\" sets local FlexRay network parameters. 28 parameters in\n"
1425 "the string is expected in this order:\n"
1426 "1) pAllowHaltDueToClock\n"
1427 "2) pAllowPassiveToActive\n"
1428 "3) pChannels (0 - A, 1 - B, 2 - AB)\n"
1429 "4) pClusterDriftDamping\n"
1430 "5) pDelayCompensationA\n"
1431 "6) pDelayCompensationB\n"
1432 "7) pExternOffsetCorrection\n"
1433 "8) pExternRateCorrection\n"
1434 "9) pKeySlotUsedForStartup\n"
1435 "10) pKeySlotUsedForSync\n"
1437 "12) pMacroInitialOffsetA\n"
1438 "13) pMacroInitialOffsetB\n"
1439 "14) pMicroInitialOffsetA\n"
1440 "15) pMicroInitialOffsetB\n"
1441 "16) pMicroPerCycle\n"
1442 "17) pRateCorrectionOut\n"
1443 "18) pOffsetCorrectionOut\n"
1444 "19) pSamplesPerMicrotick\n"
1445 "20) pSingleSlotEnabled\n"
1446 "21) pWakeupChannel (0 - A, 1 - B)\n"
1447 "22) pWakeupPattern\n"
1448 "23) pdAcceptedStartupRange\n"
1449 "24) pdListenTimeout\n"
1451 "25) pDecodingCorrection\n"
1452 "25) syncFramePayloadMultiplexEnabled\n"
1453 "25) 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"
1455 "The type \"stat\" adds new static buffer. At least one buffer must be configured.\n"
1456 "8 parameters in the string is expected in this order:\n"
1457 "1) channel (0 - A, 1 - B, 2 - AB)\n"
1458 "2) cycleCounterFiltering\n"
1460 "4) maxPayload (number of 16b words)\n"
1461 "5) msgBufferInterrupt\n"
1462 "6) payloadPreambleIndicatorTr\n"
1463 "7) singleTransmit\n"
1466 "The type \"dyn\" adds new dynamic buffer. No dynamic buffer is obligatory.\n"
1467 "8 parameters in the string is expected in this order:\n"
1468 "1) channel (0 - A, 1 - B)\n"
1469 "2) cycleCounterFiltering\n"
1471 "4) maxPayload (number of 16b words)\n"
1472 "5) msgBufferInterrupt\n"
1473 "6) payloadPreambleIndicatorTr\n"
1474 "7) singleTransmit\n"
1477 "The type \"fifo\" adds new FIFO buffer. No dynamic buffer is obligatory.\n"
1478 "7 parameters in the string is expected in this order:\n"
1479 "1) depth of the FIFO\n"
1480 "2) channel (0 - A, 1 - B, 2 - AB)\n"
1481 "3) cycleCounterFiltering\n"
1482 "4) maxPayload (number of 16b words)\n"
1483 "5) rejectNullFrames\n"
1484 "6) rejectStaticSegment\n"
1489 " --> frbtusercluster 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"
1490 " FlexRay cluster configuration accepted.\n"
1491 " --> frbtusernode 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"
1492 " FlexRay node configuration accepted.\n"
1493 " --> frbtuserstat 0x2 0x0 0x1 0x9 0x1 0x0 0x0 0x1\n"
1494 " Static buffer configuration accepted.\n",
1495 CMD_HANDLER(cmd_do_fr_user_config), (void *)&cmd_list_fr_basic_test
1499 /** Command descriptor for FlexRay init command */
1500 cmd_des_t const cmd_des_fr_init={
1502 "frbtinit?","Initialize FlexRay node",
1503 "=== Command syntax ===\n"
1507 "* <NODE> is an identificator of the node. It can be A, B or U. The A and B are using default configuration, if U specified, user configuration (frbtuser command) must be done before calling this command.\n"
1509 "=== Description ===\n"
1511 "The command stands for Fr_Init and Fr_ControllerInit functions\n"
1512 "from the Autosar specification.\n"
1513 "It initializes the internal data structures of the driver and then,\n"
1514 "based on those data, the controller configuration is done.\n"
1515 "During the controller configuration the parameters of the cluster, node,\n"
1516 "message RAM and buffers are checked. If anything goes bad, the command\n"
1517 "returns an error number, which can be decoded by macros defined in driver\n"
1518 "header file fr_tms570.h with prefix ERR_PARAM.\n"
1519 "If all parameters are OK, all necessary registers of the controller are\n"
1520 "initialized by those parameters."
1521 "At the end of the command, the FlexRay controller is switched into READY state\n"
1522 "and all buffers are configured to send NULL frames.\n"
1523 "This command should be called as the very first command, when trying to\n"
1524 "communicate over the FlexRay bus.\n"
1529 " FlexRay driver initialized.\n"
1530 " FlexRay controller initialized.\n",
1531 CMD_HANDLER(cmd_do_fr_init), (void *)&cmd_list_fr_basic_test
1534 /** Command descriptor for FlexRay controller init command */
1535 cmd_des_t const cmd_des_fr_start={
1537 "frbtstart","Initiate new FlexRay network or join to the existing one",
1538 "=== Command syntax ===\n"
1542 "=== Description ===\n"
1544 "The command stands for Fr_StartCommunication function from the Autosar\n"
1546 "If the FlexRay node is configured as a coldstarter, then the command tries to listen\n"
1547 "on the bus at first. When it does not detect any existing bus communication,\n"
1548 "it tries to initiate the new network. If the initiation fails, the FlexRay\n"
1549 "controller is switched back to ready state for another attempt.\n"
1550 "If the FlexRay node is configured as non-coldstarter, it is listening on the\n"
1551 "bus until some existing communication is detected.\n"
1553 "The command should be called after the frbtinit command\n"
1558 " FlexRay communication is running.\n",
1559 CMD_HANDLER(cmd_do_fr_start), (void *)&cmd_list_fr_basic_test
1562 /** Command descriptor for FlexRay controller all slots command */
1563 cmd_des_t const cmd_des_fr_allslots={
1565 "frbtallslots","Enables communication for all frames",
1566 "=== Command syntax ===\n"
1570 "=== Description ===\n"
1572 "The command stands for Fr_AllSlots function from the Autosar\n"
1574 "The node can be configured to communicate only on key frames\n"
1575 "by default. This command can be used to allow communication on all\n"
1576 "configured frames.\n"
1577 "The command invokes the FlexRay POC command ALL_SLOTS which\n"
1578 "allows communication on all frames.\n"
1579 "The command can be called after controller initialization.\n"
1583 " --> frbtallslots\n"
1584 " FlexRay node is communicating on all slots.\n",
1585 CMD_HANDLER(cmd_do_fr_allslots), (void *)&cmd_list_fr_basic_test
1588 /** Command descriptor for FlexRay controller halt command */
1589 cmd_des_t const cmd_des_fr_halt={
1591 "frbthalt","Halt FlexRay communication after the end of actual communication cycle",
1592 "=== Command syntax ===\n"
1596 "=== Description ===\n"
1598 "The command stands for Fr_HaltCommunication function from the Autosar\n"
1600 "The command invokes the FlexRay POC command HALT, which means that\n"
1601 "communication is stopped after the end of actual communication cycle.\n"
1602 "On the opposite side, there is a freeze command, which stops communication\n"
1604 "To start the communication again, the device has to be reseted.\n"
1609 " FlexRay node communication halted.\n",
1610 CMD_HANDLER(cmd_do_fr_halt), (void *)&cmd_list_fr_basic_test
1613 /** Command descriptor for FlexRay controller abort command */
1614 cmd_des_t const cmd_des_fr_abort={
1616 "frbtabort","Abort FlexRay communication immediately",
1617 "=== Command syntax ===\n"
1621 "=== Description ===\n"
1623 "The command stands for Fr_AbortCommunication function from the Autosar\n"
1625 "The command invokes the FlexRay POC command FREEZE, which means that\n"
1626 "communication is stopped immediately.\n"
1627 "On the opposite side there is a halt command, which stops communication after\n"
1628 "the end of actual communication cycle.\n"
1629 "To start the communication again, the device has to be reseted.\n"
1634 " FlexRay node communication aborted.\n",
1635 CMD_HANDLER(cmd_do_fr_abort), (void *)&cmd_list_fr_basic_test
1638 /** Command descriptor for FlexRay controller send wake up pattern command */
1639 cmd_des_t const cmd_des_fr_sendwup={
1641 "frbtwup","Initiates the wake up procedure",
1642 "=== Command syntax ===\n"
1646 "=== Description ===\n"
1648 "The command stands for Fr_SendWUP function from the Autosar\n"
1650 "It initiates the wake up procedure by switching FlexRay controller\n"
1651 "state machine in WAKEUP state.\n"
1656 " Wake up pattern has been sent.\n",
1657 CMD_HANDLER(cmd_do_fr_sendwup), (void *)&cmd_list_fr_basic_test
1660 /** Command descriptor for FlexRay controller sent wake up pattern channel command */
1661 cmd_des_t const cmd_des_fr_setwuchannel={
1663 "frbtsetwuch?","Set wake up channel",
1664 "=== Command syntax ===\n"
1666 " frbtsetwuch<CHANNEL>\n"
1668 "* <CHANNEL> is a character A or B, specifying the channel.\n"
1670 "=== Description ===\n"
1672 "The command stands for Fr_SetWakeupChannel function from the Autosar\n"
1674 "Wake up channel is the channel, where Wake Up Pattern is sent.\n"
1675 "The channel can be set after driver and controller are initialized\n"
1676 "and before communication is running.\n"
1680 " --> frbtsetwuchA\n"
1681 " Wake up channel has been set.\n",
1682 CMD_HANDLER(cmd_do_fr_setwuchannel), (void *)&cmd_list_fr_basic_test
1685 /** Command descriptor for FlexRay controller get POC status command */
1686 cmd_des_t const cmd_des_fr_getpocstatus={
1688 "frbtgetpocst","Print FlexRay POC status",
1689 "=== Command syntax ===\n"
1693 "=== Description ===\n"
1695 "The command stands for Fr_GetPOCStatus function from the Autosar\n"
1697 "It prints the main FlexRay POC status values in form of table.\n"
1698 "The command should be called after the frbtctrlinit command.\n"
1702 " --> frbtgetpocst\n"
1704 " CHIHaltRequest: FALSE\n"
1705 " CHIReadyRequest: FALSE\n"
1706 " ColdstartNoise: FALSE\n"
1708 " ErrorMode: ACTIVE\n"
1710 " StartupState: UNDEFINED\n"
1712 " WakeupStatus: UNDEFINED\n",
1713 CMD_HANDLER(cmd_do_fr_getpocstatus), (void *)&cmd_list_fr_basic_test
1716 /** Command descriptor for FlexRay transmit tx lpdu command */
1717 cmd_des_t const cmd_des_fr_transmittxlpdu={
1719 "frbttransmit*","Transmit data in selected frame",
1720 "=== Command syntax ===\n"
1722 " frbttransmit<FRID> <DATA>\n"
1724 "* <FRID> is a decimal number specifying the ID of the frame to which the buffer is assigned.\n"
1725 "* <DATA> are 8 bit hexadecimal numbers separated by spaces. Each number represents one byte of the message.\n"
1727 "=== Description ===\n"
1729 "The command stands for Fr_TransmitTxLPdu function from the Autosar\n"
1731 "The command finds the first buffer assigned to the specified frame ID\n"
1732 "and copies given data into its data section in the message RAM.\n"
1733 "Transmit request is set after data are copied, so transmission starts\n"
1734 "in next occurrence of the frame in the communication cycle.\n"
1738 " --> frbttransmit1 12 34 56 AA BB CC\n"
1739 " Data were sent.\n",
1740 CMD_HANDLER(cmd_do_fr_transmittxlpdu), (void *)&cmd_list_fr_basic_test
1743 /** Command descriptor for FlexRay cancel tx lpdu command */
1744 cmd_des_t const cmd_des_fr_canceltxlpdu={
1746 "frbtcanceltx*","Stop the transmission of the frame",
1747 "=== Command syntax ===\n"
1749 " frbtcanceltx<FRID>\n"
1751 "* <FRID> is a decimal number specifying the ID of the frame to which\n"
1752 "the buffers are assigned.\n"
1754 "=== Description ===\n"
1756 "The command stands for Fr_CancelTxLPdu function from the Autosar\n"
1758 "The command finds all buffers assigned to the specified frame ID\n"
1759 "and reconfigures them to stop transmitting data.\n"
1760 "The command finishes successfully only if reconfiguration is allowed\n"
1761 "in message RAM configuration (secureBuffers parameter).\n"
1762 "Only TX buffers and buffers not used in startup frames can be canceled.\n"
1766 " --> frbtcanceltx3\n"
1767 " Transmission canceled.\n",
1768 CMD_HANDLER(cmd_do_fr_canceltxlpdu), (void *)&cmd_list_fr_basic_test
1771 /** Command descriptor for FlexRay receive rx lpdu command */
1772 cmd_des_t const cmd_des_fr_receiverxlpdu={
1774 "frbtreceive*","Receive new message",
1775 "=== Command syntax ===\n"
1777 " frbtreceive<FRID>\n"
1779 "* <FRID> is a decimal number specifying the ID of the frame to which the buffer is assigned.\n"
1781 "=== Description ===\n"
1783 "The command stands for Fr_ReceiveRxLPdu function from the Autosar\n"
1785 "The command finds the first buffer assigned to the specified frame ID,\n"
1786 "determines if new message has been received and reads it out of the buffer.\n"
1787 "If no message was received, \"No message received\" is printed\n"
1788 "If new message was received, all message data are printed as a hexadecimal values.\n"
1789 "If new message was retrieved from a FIFO buffer and more messages are available\n"
1790 "in it, \"More messages are still in FIFO\" is printed.\n"
1794 " --> frbtreceive0\n"
1795 " More messages are still in FIFO:\n"
1796 " Received message (32 B):\n"
1797 " ee ff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
1798 CMD_HANDLER(cmd_do_fr_receiverxlpdu), (void *)&cmd_list_fr_basic_test
1801 /** Command descriptor for FlexRay check TX LPdu status command */
1802 cmd_des_t const cmd_des_fr_checktxlpdustatus={
1804 "frbtchecktx*","Print status of the transmit buffer",
1805 "=== Command syntax ===\n"
1807 " frbtchecktx<FRID>\n"
1809 "* <FRID> is a decimal number specifying the ID of the frame to which the buffer is assigned.\n"
1811 "=== Description ===\n"
1813 "The command stands for Fr_CheckTxLPduStatus function from the Autosar\n"
1815 "The command finds the first buffer assigned to the specified frame ID,\n"
1816 "reads its status and prints it.\n"
1817 "The buffer can be in one of the two states:\n"
1818 "* Some 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"
1819 "* No message transmission is pending, which means that the buffer is in single shot mode and the message has been already sent.\n"
1823 " --> frbtchecktx1\n"
1824 " Message transmission is not pending.\n",
1825 CMD_HANDLER(cmd_do_fr_checktxlpdustatus), (void *)&cmd_list_fr_basic_test
1828 /** Command descriptor for FlexRay disable LPdu command */
1829 cmd_des_t const cmd_des_fr_disablelpdu={
1831 "frbtdisable*","Disables buffers assigned to the frame",
1832 "=== Command syntax ===\n"
1834 " frbtdisable<FRID>\n"
1836 "* <FRID> is a decimal number specifying the ID of the frame. The buffers assigned to this frame will be disabled.\n"
1838 "=== Description ===\n"
1840 "The command stands for Fr_DisableLPdu function from the Autosar\n"
1842 "The command finds all buffer assigned to the specified frame ID and\n"
1843 "disables them. This means that those buffers will be unavailable for the\n"
1844 "communication until their reconfiguration (which is not yet implemented).\n"
1845 "Buffers used in startup frames and FIFO RX buffers can not be disabled.\n"
1849 " --> frbtdisable3\n"
1850 " Buffer disabled.\n",
1851 CMD_HANDLER(cmd_do_fr_disablelpdu), (void *)&cmd_list_fr_basic_test
1854 /** Command descriptor for FlexRay get global time command */
1855 cmd_des_t const cmd_des_fr_getglobaltime={
1857 "frbtglobtime","Prints actual global time of the network.",
1858 "=== Command syntax ===\n"
1862 "=== Description ===\n"
1864 "The command stands for Fr_GetGlobalTime function from the Autosar\n"
1866 "The command prints time as number of the cycle and offset in the cycle\n"
1871 " --> frbtglobtime\n"
1872 " Cycle number: 23\n"
1873 " Macrotick number: 6\n",
1874 CMD_HANDLER(cmd_do_fr_getglobaltime), (void *)&cmd_list_fr_basic_test
1877 /** Command descriptor for FlexRay get network management vector command */
1878 cmd_des_t const cmd_des_fr_getnmvector={
1880 "frbtnmvector","Prints network management vector of the node",
1881 "=== Command syntax ===\n"
1885 "=== Description ===\n"
1887 "The command stands for Fr_GetNmVector function from the Autosar\n"
1892 " --> frbtnmvector\n"
1893 " Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\n",
1894 CMD_HANDLER(cmd_do_fr_getnmvector), (void *)&cmd_list_fr_basic_test
1897 /** Command descriptor for FlexRay get channel status command */
1898 cmd_des_t const cmd_des_fr_getchannelstatus={
1900 "frbtchstat","Prints channel A and B status",
1901 "=== Command syntax ===\n"
1905 "=== Description ===\n"
1907 "The command stands for Fr_GetChannelStatus function from the Autosar\n"
1913 " Channel A status:\n"
1914 " aggregated channel status vSS!ValidFrame: TRUE\n"
1915 " aggregated channel status vSS!SyntaxError: FALSE\n"
1916 " aggregated channel status vSS!ContentError: FALSE\n"
1917 " aggregated channel status additional communication: FALSE\n"
1918 " aggregated channel status vSS!Bviolation: FALSE\n"
1919 " aggregated channel status vSS!TxConflict: FALSE\n"
1920 " Not used (0): FALSE\n"
1921 " Not used (0): FALSE\n"
1922 " symbol window status data vSS!ValidMTS: FALSE\n"
1923 " symbol window status data vSS!SyntaxError: FALSE\n"
1924 " symbol window status data vSS!Bviolation: FALSE\n"
1925 " symbol window status data vSS!TxConflict: FALSE\n"
1926 " NIT status data vSS!SyntaxError: FALSE\n"
1927 " NIT status data vSS!Bviolation: FALSE\n"
1928 " Not used (0): FALSE\n"
1929 " Not used (0): FALSE\n"
1930 " Channel B status:\n"
1931 " aggregated channel status vSS!ValidFrame: TRUE\n"
1932 " aggregated channel status vSS!SyntaxError: FALSE\n"
1933 " aggregated channel status vSS!ContentError: FALSE\n"
1934 " aggregated channel status additional communication: FALSE\n"
1935 " aggregated channel status vSS!Bviolation: FALSE\n"
1936 " aggregated channel status vSS!TxConflict: FALSE\n"
1937 " Not used (0): FALSE\n"
1938 " Not used (0): FALSE\n"
1939 " symbol window status data vSS!ValidMTS: FALSE\n"
1940 " symbol window status data vSS!SyntaxError: FALSE\n"
1941 " symbol window status data vSS!Bviolation: FALSE\n"
1942 " symbol window status data vSS!TxConflict: FALSE\n"
1943 " NIT status data vSS!SyntaxError: FALSE\n"
1944 " NIT status data vSS!Bviolation: FALSE\n"
1945 " Not used (0): FALSE\n"
1946 " Not used (0): FALSE\n",
1947 CMD_HANDLER(cmd_do_fr_getchannelstatus), (void *)&cmd_list_fr_basic_test
1950 /** Command descriptor for FlexRay get clock correction command */
1951 cmd_des_t const cmd_des_fr_getclockcorrection={
1953 "frbtclkcor","Prints clock correction (rate and offset)",
1954 "=== Command syntax ===\n"
1958 "=== Description ===\n"
1960 "The command stands for Fr_GetClockCorrection function from the Autosar\n"
1966 " Rate correction: 0\n"
1967 " Offset correction: 0\n",
1968 CMD_HANDLER(cmd_do_fr_getclockcorrection), (void *)&cmd_list_fr_basic_test
1971 /** Command descriptor for FlexRay get sync frame list command */
1972 cmd_des_t const cmd_des_fr_getsyncframelist={
1974 "frbtgetsyncfrlist*","Prints list of sync frames transmitted on both channels via the odd and even communication cycle",
1975 "=== Command syntax ===\n"
1977 " frbtgetsyncfrlist<LENGTH>\n"
1979 "* <LENGTH> is a decimal number in range 0 - 15, specifying the length of the list to be printed.\n"
1981 "=== Description ===\n"
1983 "The command stands for Fr_GetSyncFrameList function from the Autosar\n"
1988 " --> frbtgetsyncfrlist2\n"
1989 " | Channel A even | channel B even | channel A odd | channel B odd |\n"
1990 " |----------------|----------------|----------------|----------------|\n"
1991 " | 1 | 1 | 1 | 1 |\n"
1992 " | 2 | 2 | 2 | 2 |\n"
1993 " |----------------|----------------|----------------|----------------|\n",
1994 CMD_HANDLER(cmd_do_fr_getsyncframelist), (void *)&cmd_list_fr_basic_test
1997 /** Command descriptor for FlexRay get sync frame list command */
1998 cmd_des_t const cmd_des_fr_getwakeuprxstatus={
2000 "frbtgetwurxstat","Prints if wake up pattern was or was not received",
2001 "=== Command syntax ===\n"
2003 " frbtgetwurxstat\n"
2005 "=== Description ===\n"
2007 "The command stands for Fr_GetWakeupRxStatus function from the Autosar\n"
2009 "The status of the wake up receiving is bitcoded in the controller. This\n"
2010 "command decodes and prints it in readable format.\n"
2014 " --> frbtgetwurxstat\n"
2015 " Wake up pattern was not yet received on channel A.\n"
2016 " Wake up pattern was not yet received on channel B.\n",
2017 CMD_HANDLER(cmd_do_fr_getwakeuprxstatus), (void *)&cmd_list_fr_basic_test
2020 /** Command descriptor for FlexRay set absolute timer command */
2021 cmd_des_t const cmd_des_fr_settimer={
2023 "frbtsettimer*","Set and start timer",
2024 "=== Command syntax ===\n"
2026 " frbtsettimer<TMID> <CYCLE> <OFFSET>"
2028 "* <TMID> is a decimal number (0 - 1) specifying the number of the timer.\n"
2029 "* <CYCLE> is a decimal number (0 - 255) specifying the number of the cycle, in which timer interrupt should be requested.\n"
2030 "* <OFFSET> is a decimal number (0 - 16383) specifying the offset in macroticks, where precisly in the cycle should be the timer interrupt requested.\n"
2032 "=== Description ===\n"
2034 "The command stands for Fr_SetAbsoluteTimer function from the Autosar\n"
2036 "It sets the timer selected by the parameter and enables it.\n"
2040 " --> frbtsettimer0 32 50\n"
2041 " Timer was set.\n",
2042 CMD_HANDLER(cmd_do_fr_settimer), (void *)&cmd_list_fr_basic_test
2045 /** Command descriptor for FlexRay cancel absolute timer command */
2046 cmd_des_t const cmd_des_fr_canceltimer={
2048 "frbtcanceltimer*","Stop the timer",
2049 "=== Command syntax ===\n"
2051 " frbtcanceltimer<TMID>\n"
2053 "* <TMID> is a decimal number (0 - 1) specifying the number of the timer.\n"
2055 "=== Description ===\n"
2057 "The command stands for Fr_CancelAbsoluteTimer function from the Autosar\n"
2059 "It stops the timer selected by the parameter.\n"
2063 " --> frbtcanceltimer0\n"
2064 " Timer was canceled.\n",
2065 CMD_HANDLER(cmd_do_fr_canceltimer), (void *)&cmd_list_fr_basic_test
2068 /** Command descriptor for FlexRay absolute timer irq manipulation command */
2069 cmd_des_t const cmd_des_fr_timerirq={
2071 "frbttimerirq*","Do something with the timer IRQ",
2072 "=== Command syntax ===\n"
2074 " frbttimerirq<TMID> <ACTION> - Run the <ACTION> on specified timer\n"
2075 " frbttimerirq<TMID> - Get timet IRQ status\n"
2078 "* <TMID> is a decimal number (0 - 1) specifying the number of the timer.\n"
2079 "* where <ACTION> is a string if the action to be processed on the selected timer.\n"
2080 "<ACTIONS> can be one of these strings\n"
2081 "* EN - Enable IRQ on selected timer\n"
2082 "* DIS - Disable IRQ on selected timer\n"
2083 "* ACK - Acknowledge IRQ on selected timer (Reset flag in the register).\n"
2085 "=== Description ===\n"
2087 "The command stands for Fr_EnableAbsoluteTimerIRQ, Fr_AckAbsoluteTimerIRQ,\n"
2088 "Fr_DisableAbsoluteTimerIRQ and Fr_GetAbsoluteTimerIRQStatus functions from\n"
2089 "the Autosar specification.\n"
2090 "It enables or disables masking of the IRQ for the timer, or acknowledges the\n"
2091 "interrupt request when processed by clearing its flag in the register, or gets\n"
2092 "whether the IRQ is pending for the timer.\n"
2096 " --> frbttimerirq0\n"
2099 " --> frbttimerirq0 EN\n"
2101 CMD_HANDLER(cmd_do_fr_timerirq), (void *)&cmd_list_fr_basic_test
2104 /** Command descriptor for FlexRay get version info command */
2105 cmd_des_t const cmd_des_fr_getversioninfo={
2107 "frbtversion","Prints FlexRay driver version information",
2108 "=== Command syntax ===\n"
2112 "=== Description ===\n"
2114 "The command stands for Fr_GetVersionInfo function from the Autosar\n"
2116 "It reads and prints the information about vendor, module and version of\n"
2117 "the FlexRay driver\n"
2121 " --> frbtversion\n"
2122 " vendorID: 0xAAAA\n"
2123 " moduleID: 0xBBBB\n"
2124 " sw_major_version: 0x1\n"
2125 " sw_minor_version: 0x2\n"
2126 " sw_patch_version: 0x4\n",
2127 CMD_HANDLER(cmd_do_fr_getversioninfo), (void *)&cmd_list_fr_basic_test
2130 /** Command descriptor for FlexRay get controller configuration command */
2131 cmd_des_t const cmd_des_fr_readcconfig={
2133 "frbtccconfig*","Print value of a FlexRay cluster and node configuration parameter",
2134 "=== Command syntax ===\n"
2136 " frbtccconfig<INDEX>\n"
2139 "* <INDEX> is an identificator of the parameter, specified by Autosar specification in section 8.2.1.\n"
2141 "=== Description ===\n"
2143 "The command stands for Fr_ReadCCConfig function from the Autosar\n"
2145 "The driver stores configuration parameters as an array. Each parameter\n"
2146 "can be indexed and returned by this command.\n"
2147 "See Autosar specification of the FlexRay driver, section 8.2.1 for\n"
2148 "parameter indexes.\n"
2152 " --> frbtccconfig1\n"
2154 CMD_HANDLER(cmd_do_fr_readcconfig), (void *)&cmd_list_fr_basic_test
2157 /** List of commands for flexRay, defined as external */
2158 cmd_des_t const *cmd_list_fr_basic_test[]={
2159 &cmd_des_fr_user_config,
2162 &cmd_des_fr_allslots,
2165 &cmd_des_fr_sendwup,
2166 &cmd_des_fr_setwuchannel,
2167 &cmd_des_fr_getpocstatus,
2168 &cmd_des_fr_transmittxlpdu,
2169 &cmd_des_fr_canceltxlpdu,
2170 &cmd_des_fr_receiverxlpdu,
2171 &cmd_des_fr_checktxlpdustatus,
2172 &cmd_des_fr_disablelpdu,
2173 &cmd_des_fr_getglobaltime,
2174 &cmd_des_fr_getnmvector,
2175 &cmd_des_fr_getchannelstatus,
2176 &cmd_des_fr_getclockcorrection,
2177 &cmd_des_fr_getsyncframelist,
2178 &cmd_des_fr_getwakeuprxstatus,
2179 &cmd_des_fr_settimer,
2180 &cmd_des_fr_canceltimer,
2181 &cmd_des_fr_timerirq,
2182 &cmd_des_fr_getversioninfo,
2183 &cmd_des_fr_readcconfig,