Lines Matching +full:timing +full:- +full:config +full:- +full:mask
6 * SPDX-License-Identifier: Apache-2.0
45 * @brief Bit mask for a standard (11-bit) CAN identifier.
50 * @brief Bit mask for an extended (29-bit) CAN identifier.
103 /** Controller requires manual recovery after entering bus-off state */
122 /** Error-active state (RX/TX error count < 96). */
124 /** Error-warning state (RX/TX error count < 128). */
126 /** Error-passive state (RX/TX error count < 256). */
128 /** Bus-off state (RX/TX error count >= 256). */
141 /** Frame uses extended (29-bit) CAN ID */
153 /** CAN FD Error State Indicator (ESI). Indicates that the transmitting node is in error-passive
164 /** Standard (11-bit) or extended (29-bit) CAN identifier. */
171 /** Captured value of the free-running timer in the CAN controller when
201 /** Filter matches frames with extended (29-bit) CAN IDs */
212 /** CAN identifier matching mask. If a bit in this mask is 0, the value
215 uint32_t mask; member
231 * @brief CAN bus timing structure
233 * This struct is used to pass bus timing values to the configuration and
244 * +---------+----------+------------+------------+
246 * +---------+----------+------------+------------+
248 * Sampling-Point
315 * @brief Calculate Transmitter Delay Compensation Offset from data phase timing parameters.
318 * prescaler specified by a set of data phase timing parameters.
322 * @param _timing_data Pointer to data phase timing parameters.
328 CLAMP((1U + _timing_data->prop_seg + _timing_data->phase_seg1) * _timing_data->prescaler, \
335 * the object pointed to by the config field in the device structure.
406 * @brief Callback API upon setting CAN bus timing
410 const struct can_timing *timing);
413 * @brief Optional callback API upon setting CAN FD bus timing for the data phase.
471 * @brief Optional callback API upon manually recovering the CAN controller from bus-off state
519 /* Min values for the timing registers */
521 /* Max values for the timing registers */
525 /* Min values for the timing registers during the data phase */
527 /* Max values for the timing registers during the data phase */
581 CONTAINER_OF(dev_->state, struct can_device_state, devstate)->stats
664 * fixed-form bit field containing illegal bits.
724 CONTAINER_OF(dev->state, struct can_device_state, devstate); \
725 stats_init(&state->stats.s_hdr, STATS_SIZE_32, 8, \
727 stats_register(dev->name, &(state->stats.s_hdr)); \
748 * @param config The address to the structure containing the configuration
757 #define CAN_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ argument
764 pm, data, config, level, prio, api, \
780 #define CAN_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ argument
782 DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \
819 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_core_clock()
821 return api->get_core_clock(dev, rate); in z_impl_can_get_core_clock()
831 * rate and the minimum CAN timing limits.
844 const struct can_driver_config *common = (const struct can_driver_config *)dev->config; in z_impl_can_get_bitrate_min()
846 return common->min_bitrate; in z_impl_can_get_bitrate_min()
856 * rate and the maximum CAN timing limits.
869 const struct can_driver_config *common = (const struct can_driver_config *)dev->config; in z_impl_can_get_bitrate_max()
871 return common->max_bitrate; in z_impl_can_get_bitrate_max()
875 * @brief Get the minimum supported timing parameter values.
879 * @return Pointer to the minimum supported timing parameter values.
885 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_min()
887 return &api->timing_min; in z_impl_can_get_timing_min()
891 * @brief Get the maximum supported timing parameter values.
895 * @return Pointer to the maximum supported timing parameter values.
901 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_max()
903 return &api->timing_max; in z_impl_can_get_timing_max()
907 * @brief Calculate timing parameters from bitrate and sample point
909 * Calculate the timing parameters from a given bitrate in bits/s and the
912 * -EINVAL is returned.
928 * @retval -EINVAL if the requested bitrate or sample point is out of range.
929 * @retval -ENOTSUP if the requested bitrate is not supported.
930 * @retval -EIO if @a can_get_core_clock() is not available.
936 * @brief Get the minimum supported timing parameter values for the data phase.
945 * @return Pointer to the minimum supported timing parameter values, or NULL if
953 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_data_min()
955 return &api->timing_data_min; in z_impl_can_get_timing_data_min()
960 * @brief Get the maximum supported timing parameter values for the data phase.
969 * @return Pointer to the maximum supported timing parameter values, or NULL if
977 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_timing_data_max()
979 return &api->timing_data_max; in z_impl_can_get_timing_data_max()
984 * @brief Calculate timing parameters for the data phase
999 * @retval -EINVAL if the requested bitrate or sample point is out of range.
1000 * @retval -ENOTSUP if the requested bitrate is not supported.
1001 * @retval -EIO if @a can_get_core_clock() is not available.
1007 * @brief Configure the bus timing for the data phase of a CAN FD controller.
1018 * @retval -EBUSY if the CAN controller is not in stopped state.
1019 * @retval -EIO General input/output error, failed to configure device.
1020 * @retval -ENOTSUP if the timing parameters are not supported by the driver.
1021 * @retval -ENOSYS if CAN FD support is not implemented by the driver.
1047 * @retval -EBUSY if the CAN controller is not in stopped state.
1048 * @retval -EINVAL if the requested bitrate is out of range.
1049 * @retval -ENOTSUP if the requested bitrate not supported by the CAN controller/transceiver
1051 * @retval -ERANGE if the resulting sample point is off by more than +/- 5%.
1052 * @retval -EIO General input/output error, failed to set bitrate.
1057 * @brief Configure the bus timing of a CAN controller.
1062 * @param timing Bus timings.
1065 * @retval -EBUSY if the CAN controller is not in stopped state.
1066 * @retval -ENOTSUP if the timing parameters are not supported by the driver.
1067 * @retval -EIO General input/output error, failed to configure device.
1070 const struct can_timing *timing);
1083 * @retval -EIO General input/output error, failed to get capabilities.
1089 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_capabilities()
1091 return api->get_capabilities(dev, cap); in z_impl_can_get_capabilities()
1107 const struct can_driver_config *common = (const struct can_driver_config *)dev->config; in z_impl_can_get_transceiver()
1109 return common->phy; in z_impl_can_get_transceiver()
1126 * @retval -EALREADY if the device is already started.
1127 * @retval -EIO General input/output error, failed to start device.
1133 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_start()
1135 return api->start(dev); in z_impl_can_start()
1150 * @retval -EALREADY if the device is already stopped.
1151 * @retval -EIO General input/output error, failed to stop device.
1157 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_stop()
1159 return api->stop(dev); in z_impl_can_stop()
1169 * @retval -EBUSY if the CAN controller is not in stopped state.
1170 * @retval -EIO General input/output error, failed to configure device.
1176 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_set_mode()
1178 return api->set_mode(dev, mode); in z_impl_can_set_mode()
1192 const struct can_driver_data *common = (const struct can_driver_data *)dev->data; in z_impl_can_get_mode()
1194 return common->mode; in z_impl_can_get_mode()
1215 * @retval -EBUSY if the CAN controller is not in stopped state.
1216 * @retval -EINVAL if the requested bitrate is out of range.
1217 * @retval -ENOTSUP if the requested bitrate not supported by the CAN controller/transceiver
1219 * @retval -ERANGE if the resulting sample point is off by more than +/- 5%.
1220 * @retval -EIO General input/output error, failed to set bitrate.
1239 * - The lower the CAN-ID, the higher the priority.
1240 * - Data frames have higher priority than Remote Transmission Request (RTR)
1241 * frames with identical CAN-IDs.
1242 * - Frames with standard (11-bit) identifiers have higher priority than frames
1243 * with extended (29-bit) identifiers with identical base IDs (the higher 11
1245 * - Transmission order for queued frames with the same priority is hardware
1249 * identical CAN-IDs, the sender must ensure to only queue one frame at a time
1266 * @retval -EINVAL if an invalid parameter was passed to the function.
1267 * @retval -ENOTSUP if an unsupported parameter was passed to the function.
1268 * @retval -ENETDOWN if the CAN controller is in stopped state.
1269 * @retval -ENETUNREACH if the CAN controller is in bus-off state.
1270 * @retval -EBUSY if CAN bus arbitration was lost (only applicable if automatic
1272 * @retval -EIO if a general transmit error occurred (e.g. missing ACK if
1274 * @retval -EAGAIN on timeout.
1307 * @retval -ENOSPC if there are no free filters.
1308 * @retval -EINVAL if the requested filter type is invalid.
1309 * @retval -ENOTSUP if the requested filter type is not supported.
1350 * @retval -ENOSPC if there are no free filters.
1351 * @retval -ENOTSUP if the requested filter type is not supported.
1369 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_remove_rx_filter()
1371 api->remove_rx_filter(dev, filter_id); in z_impl_can_remove_rx_filter()
1380 * @param ide Get the maximum standard (11-bit) CAN ID filters if false, or extended (29-bit) CAN ID
1384 * @retval -EIO General input/output error.
1385 * @retval -ENOSYS If this function is not implemented by the driver.
1391 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_max_filters()
1393 if (api->get_max_filters == NULL) { in z_impl_can_get_max_filters()
1394 return -ENOSYS; in z_impl_can_get_max_filters()
1397 return api->get_max_filters(dev, ide); in z_impl_can_get_max_filters()
1419 * @retval -EIO General input/output error, failed to get state.
1427 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_get_state()
1429 return api->get_state(dev, state, err_cnt); in z_impl_can_get_state()
1433 * @brief Recover from bus-off state
1435 * Recover the CAN controller from bus-off state to error-active state.
1444 * @retval -ENOTSUP if the CAN controller is not in manual recovery mode.
1445 * @retval -ENETDOWN if the CAN controller is in stopped state.
1446 * @retval -EAGAIN on timeout.
1447 * @retval -ENOSYS If this function is not implemented by the driver.
1454 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in z_impl_can_recover()
1456 if (api->recover == NULL) { in z_impl_can_recover()
1457 return -ENOSYS; in z_impl_can_recover()
1460 return api->recover(dev, timeout); in z_impl_can_recover()
1481 const struct can_driver_api *api = (const struct can_driver_api *)dev->api; in can_set_state_change_callback()
1483 api->set_state_change_callback(dev, callback, user_data); in can_set_state_change_callback()
1607 * fixed-form bit field containing illegal bits.
1687 return dlc_table[MIN(dlc, ARRAY_SIZE(dlc_table) - 1)]; in can_dlc_to_bytes()
1719 if ((frame->flags & CAN_FRAME_IDE) != 0 && (filter->flags & CAN_FILTER_IDE) == 0) { in can_frame_matches_filter()
1720 /* Extended (29-bit) ID frame, standard (11-bit) filter */ in can_frame_matches_filter()
1724 if ((frame->flags & CAN_FRAME_IDE) == 0 && (filter->flags & CAN_FILTER_IDE) != 0) { in can_frame_matches_filter()
1725 /* Standard (11-bit) ID frame, extended (29-bit) filter */ in can_frame_matches_filter()
1729 if ((frame->id ^ filter->id) & filter->mask) { in can_frame_matches_filter()