Lines Matching +full:timestamp +full:- +full:prescaler

6  * SPDX-License-Identifier: Apache-2.0
38 * @brief Bit mask for a standard (11-bit) CAN identifier.
42 * @brief Maximum value for a standard (11-bit) CAN identifier.
46 * @brief Bit mask for an extended (29-bit) CAN identifier.
50 * @brief Maximum value for an extended (29-bit) CAN identifier.
58 * @brief Maximum data length code for CAN-FD.
92 /** Controller allows transmitting/receiving CAN-FD frames. */
117 /** Error-active state (RX/TX error count < 96). */
119 /** Error-warning state (RX/TX error count < 128). */
121 /** Error-passive state (RX/TX error count < 256). */
123 /** Bus-off state (RX/TX error count >= 256). */
136 /** Frame uses extended (29-bit) CAN ID */
142 /** Frame uses CAN-FD format (FDF) */
145 /** Frame uses CAN-FD Baud Rate Switch (BRS). Only valid in combination with ``CAN_FRAME_FDF``. */
148 /** CAN-FD Error State Indicator (ESI). Indicates that the transmitting node is in error-passive
159 /** Standard (11-bit) or extended (29-bit) CAN identifier. */
169 /** Captured value of the free-running timer in the CAN controller when
176 uint16_t timestamp; member
196 /** Filter matches frames with extended (29-bit) CAN IDs */
205 /** Filter matches CAN-FD frames (FDF) */
251 * +---------+----------+------------+------------+
253 * +---------+----------+------------+------------+
255 * Sampling-Point
259 * 1 time quantum (tq) has the length of 1/(core_clock / prescaler). The bitrate
260 * is defined by the core clock divided by the prescaler and the sum of the
263 * br = (core_clock / prescaler) / (1 + prop_seg + phase_seg1 + phase_seg2)
278 /** Prescaler value. */
279 uint16_t prescaler; member
329 * @brief Optional callback API upon setting CAN-FD bus timing for the data phase.
500 CONTAINER_OF(dev_->state, struct can_device_state, devstate)->stats
552 * fixed-form bit field containing illegal bits.
612 CONTAINER_OF(dev->state, struct can_device_state, devstate); \
613 stats_init(&state->stats.s_hdr, STATS_SIZE_32, 7, \
615 stats_register(dev->name, &(state->stats.s_hdr)); \
704 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_core_clock()
706 return api->get_core_clock(dev, rate); in z_impl_can_get_core_clock()
718 * @retval -EIO General input/output error.
719 * @retval -ENOSYS If this function is not implemented by the driver.
725 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_max_bitrate()
727 if (api->get_max_bitrate == NULL) { in z_impl_can_get_max_bitrate()
728 return -ENOSYS; in z_impl_can_get_max_bitrate()
731 return api->get_max_bitrate(dev, max_bitrate); in z_impl_can_get_max_bitrate()
745 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_min()
747 return &api->timing_min; in z_impl_can_get_timing_min()
761 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_max()
763 return &api->timing_max; in z_impl_can_get_timing_max()
772 * -EINVAL is returned.
783 * @retval -EINVAL if the requested bitrate or sample point is out of range.
784 * @retval -ENOTSUP if the requested bitrate is not supported.
785 * @retval -EIO if @a can_get_core_clock() is not available.
801 * CAN-FD support is not implemented by the driver.
808 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_data_min()
810 return &api->timing_data_min; in z_impl_can_get_timing_data_min()
825 * CAN-FD support is not implemented by the driver.
832 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_data_max()
834 return &api->timing_data_max; in z_impl_can_get_timing_data_max()
853 * @retval -EINVAL if the requested bitrate or sample point is out of range.
854 * @retval -ENOTSUP if the requested bitrate is not supported.
855 * @retval -EIO if @a can_get_core_clock() is not available.
861 * @brief Configure the bus timing for the data phase of a CAN-FD controller.
872 * @retval -EBUSY if the CAN controller is not in stopped state.
873 * @retval -EIO General input/output error, failed to configure device.
874 * @retval -ENOTSUP if the timing parameters are not supported by the driver.
875 * @retval -ENOSYS if CAN-FD support is not implemented by the driver.
881 * @brief Set the bitrate for the data phase of the CAN-FD controller
901 * @retval -EBUSY if the CAN controller is not in stopped state.
902 * @retval -EINVAL if the requested bitrate is out of range.
903 * @retval -ENOTSUP if the requested bitrate not supported by the CAN controller/transceiver
905 * @retval -ERANGE if the resulting sample point is off by more than +/- 5%.
906 * @retval -EIO General input/output error, failed to set bitrate.
911 * @brief Fill in the prescaler value for a given bitrate and timing
913 * Fill the prescaler value in the timing struct. The sjw, prop_seg, phase_seg1
938 * @retval -EBUSY if the CAN controller is not in stopped state.
939 * @retval -ENOTSUP if the timing parameters are not supported by the driver.
940 * @retval -EIO General input/output error, failed to configure device.
956 * @retval -EIO General input/output error, failed to get capabilities.
962 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_capabilities()
964 return api->get_capabilities(dev, cap); in z_impl_can_get_capabilities()
979 * @retval -EALREADY if the device is already started.
980 * @retval -EIO General input/output error, failed to start device.
986 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_start()
988 return api->start(dev); in z_impl_can_start()
1003 * @retval -EALREADY if the device is already stopped.
1004 * @retval -EIO General input/output error, failed to stop device.
1010 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_stop()
1012 return api->stop(dev); in z_impl_can_stop()
1022 * @retval -EBUSY if the CAN controller is not in stopped state.
1023 * @retval -EIO General input/output error, failed to configure device.
1029 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_set_mode()
1031 return api->set_mode(dev, mode); in z_impl_can_set_mode()
1052 * @retval -EBUSY if the CAN controller is not in stopped state.
1053 * @retval -EINVAL if the requested bitrate is out of range.
1054 * @retval -ENOTSUP if the requested bitrate not supported by the CAN controller/transceiver
1056 * @retval -ERANGE if the resulting sample point is off by more than +/- 5%.
1057 * @retval -EIO General input/output error, failed to set bitrate.
1076 * - The lower the CAN-ID, the higher the priority.
1077 * - Data frames have higher priority than Remote Transmission Request (RTR)
1078 * frames with identical CAN-IDs.
1079 * - Frames with standard (11-bit) identifiers have higher priority than frames
1080 * with extended (29-bit) identifiers with identical base IDs (the higher 11
1082 * - Transmission order for queued frames with the same priority is hardware
1086 * identical CAN-IDs, the sender must ensure to only queue one frame at a time
1103 * @retval -EINVAL if an invalid parameter was passed to the function.
1104 * @retval -ENOTSUP if an unsupported parameter was passed to the function.
1105 * @retval -ENETDOWN if the CAN controller is in stopped state.
1106 * @retval -ENETUNREACH if the CAN controller is in bus-off state.
1107 * @retval -EBUSY if CAN bus arbitration was lost (only applicable if automatic
1109 * @retval -EIO if a general transmit error occurred (e.g. missing ACK if
1111 * @retval -EAGAIN on timeout.
1144 * @retval -ENOSPC if there are no free filters.
1145 * @retval -EINVAL if the requested filter type is invalid.
1146 * @retval -ENOTSUP if the requested filter type is not supported.
1151 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in can_add_rx_filter()
1153 if (filter == NULL || (filter->flags & (CAN_FILTER_DATA | CAN_FILTER_RTR)) == 0) { in can_add_rx_filter()
1154 return -EINVAL; in can_add_rx_filter()
1157 return api->add_rx_filter(dev, callback, user_data, filter); in can_add_rx_filter()
1196 * @retval -ENOSPC if there are no free filters.
1197 * @retval -ENOTSUP if the requested filter type is not supported.
1215 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_remove_rx_filter()
1217 return api->remove_rx_filter(dev, filter_id); in z_impl_can_remove_rx_filter()
1226 * @param ide Get the maximum standard (11-bit) CAN ID filters if false, or extended (29-bit) CAN ID
1230 * @retval -EIO General input/output error.
1231 * @retval -ENOSYS If this function is not implemented by the driver.
1237 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_max_filters()
1239 if (api->get_max_filters == NULL) { in z_impl_can_get_max_filters()
1240 return -ENOSYS; in z_impl_can_get_max_filters()
1243 return api->get_max_filters(dev, ide); in z_impl_can_get_max_filters()
1265 * @retval -EIO General input/output error, failed to get state.
1273 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_state()
1275 return api->get_state(dev, state, err_cnt); in z_impl_can_get_state()
1279 * @brief Recover from bus-off state
1281 * Recover the CAN controller from bus-off state to error-active state.
1290 * @retval -ENETDOWN if the CAN controller is in stopped state.
1291 * @retval -EAGAIN on timeout.
1298 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_recover()
1300 return api->recover(dev, timeout); in z_impl_can_recover()
1329 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in can_set_state_change_callback()
1331 api->set_state_change_callback(dev, callback, user_data); in can_set_state_change_callback()
1354 return dlc_table[MIN(dlc, ARRAY_SIZE(dlc_table) - 1)]; in can_dlc_to_bytes()
1386 if ((frame->flags & CAN_FRAME_IDE) != 0 && (filter->flags & CAN_FILTER_IDE) == 0) { in can_frame_matches_filter()
1387 /* Extended (29-bit) ID frame, standard (11-bit) filter */ in can_frame_matches_filter()
1391 if ((frame->flags & CAN_FRAME_IDE) == 0 && (filter->flags & CAN_FILTER_IDE) != 0) { in can_frame_matches_filter()
1392 /* Standard (11-bit) ID frame, extended (29-bit) filter */ in can_frame_matches_filter()
1396 if ((frame->flags & CAN_FRAME_RTR) == 0 && (filter->flags & CAN_FILTER_DATA) == 0) { in can_frame_matches_filter()
1397 /* non-RTR frame, remote transmission request (RTR) filter */ in can_frame_matches_filter()
1401 if ((frame->flags & CAN_FRAME_RTR) != 0 && (filter->flags & CAN_FILTER_RTR) == 0) { in can_frame_matches_filter()
1402 /* Remote transmission request (RTR) frame, non-RTR filter */ in can_frame_matches_filter()
1406 if ((frame->flags & CAN_FRAME_FDF) != 0 && (filter->flags & CAN_FILTER_FDF) == 0) { in can_frame_matches_filter()
1407 /* CAN-FD format frame, classic format filter */ in can_frame_matches_filter()
1411 if ((frame->flags & CAN_FRAME_FDF) == 0 && (filter->flags & CAN_FILTER_FDF) != 0) { in can_frame_matches_filter()
1412 /* Classic frame, CAN-FD format filter */ in can_frame_matches_filter()
1416 if ((frame->id ^ filter->id) & filter->mask) { in can_frame_matches_filter()