Lines Matching +full:timestamp +full:- +full:prescaler
5 * SPDX-License-Identifier: Apache-2.0
36 /* zephyr-keep-sorted-start */
38 CAN_SHELL_MODE_MAPPING("listen-only", CAN_MODE_LISTENONLY),
40 CAN_SHELL_MODE_MAPPING("manual-recovery", CAN_MODE_MANUAL_RECOVERY),
42 CAN_SHELL_MODE_MAPPING("one-shot", CAN_MODE_ONE_SHOT),
43 CAN_SHELL_MODE_MAPPING("triple-sampling", CAN_MODE_3_SAMPLES),
44 /* zephyr-keep-sorted-stop */
88 uint8_t nbytes = can_dlc_to_bytes(frame->dlc); in can_shell_print_frame()
97 /* Timestamp */ in can_shell_print_frame()
98 shell_fprintf_normal(sh, "(%05d) ", frame->timestamp); in can_shell_print_frame()
101 shell_fprintf_normal(sh, "%s ", dev->name); in can_shell_print_frame()
106 (frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B', in can_shell_print_frame()
107 (frame->flags & CAN_FRAME_ESI) == 0 ? '-' : 'P'); in can_shell_print_frame()
112 (frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "", in can_shell_print_frame()
113 (frame->flags & CAN_FRAME_IDE) != 0 ? 8 : 3, in can_shell_print_frame()
114 (frame->flags & CAN_FRAME_IDE) != 0 ? in can_shell_print_frame()
115 frame->id & CAN_EXT_ID_MASK : frame->id & CAN_STD_ID_MASK); in can_shell_print_frame()
119 (frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ", in can_shell_print_frame()
120 (frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1, in can_shell_print_frame()
124 if ((frame->flags & CAN_FRAME_RTR) != 0) { in can_shell_print_frame()
128 shell_fprintf_normal(sh, "%02x ", frame->data[i]); in can_shell_print_frame()
242 return "error-active"; in can_shell_state_to_string()
244 return "error-warning"; in can_shell_state_to_string()
246 return "error-passive"; in can_shell_state_to_string()
248 return "bus-off"; in can_shell_state_to_string()
289 return -ENODEV; in cmd_can_start()
310 return -ENODEV; in cmd_can_stop()
341 return -ENODEV; in cmd_can_show()
353 if (max_std_filters < 0 && max_std_filters != -ENOSYS) { in cmd_can_show()
354 shell_error(sh, "failed to get maximum standard (11-bit) filters (err %d)", err); in cmd_can_show()
359 if (max_ext_filters < 0 && max_ext_filters != -ENOSYS) { in cmd_can_show()
360 shell_error(sh, "failed to get maximum extended (29-bit) filters (err %d)", err); in cmd_can_show()
397 "phase_seg1 %u..%u, phase_seg2 %u..%u, prescaler %u..%u", in cmd_can_show()
398 timing_min->sjw, timing_max->sjw, in cmd_can_show()
399 timing_min->prop_seg, timing_max->prop_seg, in cmd_can_show()
400 timing_min->phase_seg1, timing_max->phase_seg1, in cmd_can_show()
401 timing_min->phase_seg2, timing_max->phase_seg2, in cmd_can_show()
402 timing_min->prescaler, timing_max->prescaler); in cmd_can_show()
409 "phase_seg1 %u..%u, phase_seg2 %u..%u, prescaler %u..%u", in cmd_can_show()
410 timing_min->sjw, timing_max->sjw, in cmd_can_show()
411 timing_min->prop_seg, timing_max->prop_seg, in cmd_can_show()
412 timing_min->phase_seg1, timing_max->phase_seg1, in cmd_can_show()
413 timing_min->phase_seg2, timing_max->phase_seg2, in cmd_can_show()
414 timing_min->prescaler, timing_max->prescaler); in cmd_can_show()
418 shell_print(sh, "transceiver: %s", phy != NULL ? phy->name : "passive/none"); in cmd_can_show()
446 return -ENODEV; in cmd_can_bitrate_set()
452 return -EINVAL; in cmd_can_bitrate_set()
459 return -EINVAL; in cmd_can_bitrate_set()
471 /* Overwrite calculated default SJW with user-provided value */ in cmd_can_bitrate_set()
475 return -EINVAL; in cmd_can_bitrate_set()
480 "(+/- %d.%d%%), sjw %d", in cmd_can_bitrate_set()
484 LOG_DBG("sjw %u, prop_seg %u, phase_seg1 %u, phase_seg2 %u, prescaler %u", in cmd_can_bitrate_set()
486 timing.prescaler); in cmd_can_bitrate_set()
517 return -ENODEV; in cmd_can_dbitrate_set()
523 return -EINVAL; in cmd_can_dbitrate_set()
530 return -EINVAL; in cmd_can_dbitrate_set()
542 /* Overwrite calculated default SJW with user-provided value */ in cmd_can_dbitrate_set()
546 return -EINVAL; in cmd_can_dbitrate_set()
551 "(+/- %d.%d%%), sjw %d", in cmd_can_dbitrate_set()
555 LOG_DBG("sjw %u, prop_seg %u, phase_seg1 %u, phase_seg2 %u, prescaler %u", in cmd_can_dbitrate_set()
557 timing.prescaler); in cmd_can_dbitrate_set()
582 timing->sjw = (uint32_t)strtoul(argv[2], &endptr, 10); in can_shell_parse_timing()
585 return -EINVAL; in can_shell_parse_timing()
588 timing->prop_seg = (uint32_t)strtoul(argv[3], &endptr, 10); in can_shell_parse_timing()
591 return -EINVAL; in can_shell_parse_timing()
594 timing->phase_seg1 = (uint32_t)strtoul(argv[4], &endptr, 10); in can_shell_parse_timing()
597 return -EINVAL; in can_shell_parse_timing()
600 timing->phase_seg2 = (uint32_t)strtoul(argv[5], &endptr, 10); in can_shell_parse_timing()
603 return -EINVAL; in can_shell_parse_timing()
606 timing->prescaler = (uint32_t)strtoul(argv[6], &endptr, 10); in can_shell_parse_timing()
608 shell_error(sh, "failed to parse prescaler"); in can_shell_parse_timing()
609 return -EINVAL; in can_shell_parse_timing()
623 return -ENODEV; in cmd_can_timing_set()
632 "prescaler %u", timing.sjw, timing.prop_seg, timing.phase_seg1, in cmd_can_timing_set()
633 timing.phase_seg2, timing.prescaler); in cmd_can_timing_set()
652 return -ENODEV; in cmd_can_dtiming_set()
661 "phase_seg2 %u, prescaler %u", timing.sjw, timing.prop_seg, timing.phase_seg1, in cmd_can_dtiming_set()
662 timing.phase_seg2, timing.prescaler); in cmd_can_dtiming_set()
685 return -ENODEV; in cmd_can_mode_set()
706 return -EINVAL; in cmd_can_mode_set()
737 return -ENODEV; in cmd_can_send()
746 while (argidx < argc && strncmp(argv[argidx], "-", 1) == 0) { in cmd_can_send()
747 if (strcmp(argv[argidx], "--") == 0) { in cmd_can_send()
750 } else if (strcmp(argv[argidx], "-e") == 0) { in cmd_can_send()
754 } else if (strcmp(argv[argidx], "-r") == 0) { in cmd_can_send()
757 } else if (strcmp(argv[argidx], "-f") == 0) { in cmd_can_send()
760 } else if (strcmp(argv[argidx], "-b") == 0) { in cmd_can_send()
780 return -EINVAL; in cmd_can_send()
787 return -EINVAL; in cmd_can_send()
792 nbytes = argc - argidx; in cmd_can_send()
795 return -EINVAL; in cmd_can_send()
805 return -EINVAL; in cmd_can_send()
810 return -EINVAL; in cmd_can_send()
823 shell_print(sh, "enqueuing CAN frame #%u with %s (%d-bit) CAN ID 0x%0*x, " in cmd_can_send()
854 return -ENODEV; in cmd_can_filter_add()
862 while (argidx < argc && strncmp(argv[argidx], "-", 1) == 0) { in cmd_can_filter_add()
863 if (strcmp(argv[argidx], "--") == 0) { in cmd_can_filter_add()
866 } else if (strcmp(argv[argidx], "-e") == 0) { in cmd_can_filter_add()
887 return -EINVAL; in cmd_can_filter_add()
894 return -EINVAL; in cmd_can_filter_add()
904 return -EINVAL; in cmd_can_filter_add()
911 return -EINVAL; in cmd_can_filter_add()
925 shell_print(sh, "adding filter with %s (%d-bit) CAN ID 0x%0*x, CAN ID mask 0x%0*x", in cmd_can_filter_add()
950 return -ENODEV; in cmd_can_filter_remove()
957 return -EINVAL; in cmd_can_filter_remove()
976 return -ENODEV; in cmd_can_recover()
984 return -EINVAL; in cmd_can_recover()
995 shell_error(sh, "failed to recover CAN controller from bus-off (err %d)", err); in cmd_can_recover()
1006 entry->syntax = (dev != NULL) ? dev->name : NULL; in cmd_can_device_name()
1007 entry->handler = NULL; in cmd_can_device_name()
1008 entry->help = NULL; in cmd_can_device_name()
1009 entry->subcmd = NULL; in cmd_can_device_name()
1021 entry->syntax = can_shell_mode_map[idx].name; in cmd_can_mode()
1024 entry->syntax = NULL; in cmd_can_mode()
1027 entry->handler = NULL; in cmd_can_mode()
1028 entry->help = NULL; in cmd_can_mode()
1029 entry->subcmd = &dsub_can_mode; in cmd_can_mode()
1036 entry->syntax = (dev != NULL) ? dev->name : NULL; in cmd_can_device_name_mode()
1037 entry->handler = NULL; in cmd_can_device_name_mode()
1038 entry->help = NULL; in cmd_can_device_name_mode()
1039 entry->subcmd = &dsub_can_mode; in cmd_can_device_name_mode()
1047 "Usage: can filter add <device> [-e] <CAN ID> [CAN ID mask]\n"
1048 "-e use extended (29-bit) CAN ID/CAN ID mask\n",
1081 "Usage: can timing <device> <sjw> <prop_seg> <phase_seg1> <phase_seg2> <prescaler>",
1086 "Usage: can dtiming <device> <sjw> <prop_seg> <phase_seg1> <phase_seg2> <prescaler>",
1094 "Usage: can send <device> [-e] [-r] [-f] [-b] <CAN ID> [data] [...]\n"
1095 "-e use extended (29-bit) CAN ID\n"
1096 "-r send Remote Transmission Request (RTR) frame\n"
1097 "-f use CAN FD frame format\n"
1098 "-b use CAN FD Bit Rate Switching (BRS)",
1106 "Manually recover CAN controller from bus-off state\n"