Lines Matching full:can

11  * @brief Controller Area Network (CAN) driver API.
31 * @brief CAN Interface
32 * @defgroup can_interface CAN Interface
40 * @name CAN frame definitions
45 * @brief Bit mask for a standard (11-bit) CAN identifier.
50 * @brief Bit mask for an extended (29-bit) CAN identifier.
55 * @brief Maximum data length code for CAN 2.0A/2.0B.
60 * @brief Maximum data length code for CAN FD.
79 * @name CAN controller mode flags
94 /** Controller allows transmitting/receiving CAN FD frames. */
109 * @brief Provides a type to hold CAN controller configuration flags.
111 * The lower 24 bits are reserved for common CAN controller mode flags. The upper 8 bits are
112 * reserved for CAN controller/driver specific flags.
119 * @brief Defines the state of the CAN controller
130 /** CAN controller is stopped and does not participate in CAN communication. */
135 * @name CAN frame flags
141 /** Frame uses extended (29-bit) CAN ID */
147 /** Frame uses CAN FD format (FDF) */
150 /** Frame uses CAN FD Baud Rate Switch (BRS). Only valid in combination with ``CAN_FRAME_FDF``. */
153 /** CAN FD Error State Indicator (ESI). Indicates that the transmitting node is in error-passive
161 * @brief CAN frame structure
164 /** Standard (11-bit) or extended (29-bit) CAN identifier. */
171 /** Captured value of the free-running timer in the CAN controller when
195 * @name CAN filter flags
201 /** Filter matches frames with extended (29-bit) CAN IDs */
207 * @brief CAN filter structure
210 /** CAN identifier to match. */
212 /** CAN identifier matching mask. If a bit in this mask is 0, the value
221 * @brief CAN controller error counters
224 /** Value of the CAN controller transmit error counter. */
226 /** Value of the CAN controller receive error counter. */
231 * @brief CAN bus timing structure
259 * sample point can be moved. The sample point is moved when resynchronization
299 * @param state State of the CAN controller.
300 * @param err_cnt CAN controller error counter values.
317 * Calculates the TDC Offset in minimum time quanta (mtq) using the sample point and CAN core clock
332 * @brief Common CAN controller driver configuration.
334 * This structure is common to all CAN controller drivers and is expected to be the first element in
338 /** Pointer to the device structure for the associated CAN transceiver device or NULL. */
340 /** The minimum bitrate supported by the CAN controller/transceiver combination. */
342 /** The maximum bitrate supported by the CAN controller/transceiver combination. */
344 /** Initial CAN classic/CAN FD arbitration phase bitrate. */
346 /** Initial CAN classic/CAN FD arbitration phase sample point in permille. */
349 /** Initial CAN FD data phase sample point in permille. */
351 /** Initial CAN FD data phase bitrate. */
360 * @param _min_bitrate minimum bitrate supported by the CAN controller
361 * @param _max_bitrate maximum bitrate supported by the CAN controller
381 * @param _min_bitrate minimum bitrate supported by the CAN controller
382 * @param _max_bitrate maximum bitrate supported by the CAN controller
389 * @brief Common CAN controller driver data.
391 * This structure is common to all CAN controller drivers and is expected to be the first element in
395 /** Current CAN controller mode. */
397 /** True if the CAN controller is started, false otherwise. */
406 * @brief Callback API upon setting CAN bus timing
413 * @brief Optional callback API upon setting CAN FD bus timing for the data phase.
420 * @brief Callback API upon getting CAN controller capabilities
426 * @brief Callback API upon starting CAN controller
432 * @brief Callback API upon stopping CAN controller
438 * @brief Callback API upon setting CAN controller mode
444 * @brief Callback API upon sending a CAN frame
471 * @brief Optional callback API upon manually recovering the CAN controller from bus-off state
477 * @brief Callback API upon getting the CAN controller state
492 * @brief Callback API upon getting the CAN core clock rate
498 * @brief Optional callback API upon getting the maximum number of concurrent CAN RX filters
540 STATS_SECT_START(can)
551 STATS_NAME_START(can)
552 STATS_NAME(can, bit_error)
553 STATS_NAME(can, bit0_error)
554 STATS_NAME(can, bit1_error)
555 STATS_NAME(can, stuff_error)
556 STATS_NAME(can, crc_error)
557 STATS_NAME(can, form_error)
558 STATS_NAME(can, ack_error)
559 STATS_NAME(can, rx_overrun)
560 STATS_NAME_END(can);
565 * @brief CAN specific device state which allows for CAN device class specific
571 /** CAN device statistics */
578 * @brief Get pointer to CAN statistics structure
586 * @brief Increment the bit error counter for a CAN device
588 * The bit error counter is incremented when the CAN controller is unable to
591 * @note This error counter should only be incremented if the CAN controller is unable to
593 * the CAN controller supports distinguishing between the two, the `bit0` or `bit1` error counter
605 * @brief Increment the bit0 error counter for a CAN device
607 * The bit0 error counter is incremented when the CAN controller is unable to
622 * @brief Increment the bit1 (recessive) error counter for a CAN device
624 * The bit1 error counter is incremented when the CAN controller is unable to
639 * @brief Increment the stuffing error counter for a CAN device
641 * The stuffing error counter is incremented when the CAN controller detects a
650 * @brief Increment the CRC error counter for a CAN device
652 * The CRC error counter is incremented when the CAN controller detects a frame
661 * @brief Increment the form error counter for a CAN device
663 * The form error counter is incremented when the CAN controller detects a
672 * @brief Increment the acknowledge error counter for a CAN device
674 * The acknowledge error counter is incremented when the CAN controller does not
683 * @brief Increment the RX overrun counter for a CAN device
685 * The RX overrun counter is incremented when the CAN controller receives a CAN
695 * @brief Zero all statistics for a CAN device
697 * The driver is responsible for resetting the statistics before starting the CAN
708 * @brief Define a statically allocated and section assigned CAN device state
715 * @brief Define a CAN device init wrapper function
726 STATS_NAME_INIT_PARMS(can)); \
738 * @brief Like DEVICE_DT_DEFINE() with CAN device specifics.
740 * @details Defines a device which implements the CAN API. May generate a custom
755 * used by the driver. Can be NULL.
798 * @name CAN controller configuration
804 * @brief Get the CAN core clock rate
806 * Returns the CAN core clock rate. One minimum time quantum (mtq) is 1/(core clock rate). The CAN
807 * core clock can be further divided by the CAN clock prescaler (see the @a can_timing struct),
811 * @param[out] rate CAN core clock rate in Hz.
827 * Get the minimum supported bitrate for the CAN controller/transceiver combination.
829 * @note The minimum bitrate represents limitations of the CAN controller/transceiver
830 * combination. Whether the CAN controller can achieve this bitrate depends on the CAN core clock
831 * rate and the minimum CAN timing limits.
852 * Get the maximum supported bitrate for the CAN controller/transceiver combination.
854 * @note The maximum bitrate represents limitations of the CAN controller/transceiver
855 * combination. Whether the CAN controller can achieve this bitrate depends on the CAN core clock
856 * rate and the maximum CAN timing limits.
911 * always match perfectly. If no result can be reached for the given parameters,
946 * CAN FD support is not implemented by the driver.
970 * CAN FD support is not implemented by the driver.
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.
1021 * @retval -ENOSYS if CAN FD support is not implemented by the driver.
1027 * @brief Set the bitrate for the data phase of the CAN FD controller
1029 * CAN in Automation (CiA) 301 v4.2.0 recommends a sample point location of
1030 * 87.5% percent for all bitrates. However, some CAN controllers have
1047 * @retval -EBUSY if the CAN controller is not in stopped state.
1049 * @retval -ENOTSUP if the requested bitrate not supported by the CAN controller/transceiver
1057 * @brief Configure the bus timing of a CAN controller.
1065 * @retval -EBUSY if the CAN controller is not in stopped state.
1073 * @brief Get the supported modes of the CAN controller
1075 * The returned capabilities may not necessarily be supported at the same time (e.g. some CAN
1095 * @brief Get the CAN transceiver associated with the CAN controller
1097 * Get a pointer to the device structure for the CAN transceiver associated with the CAN controller.
1100 * @return Pointer to the device structure for the associated CAN transceiver driver instance, or
1113 * @brief Start the CAN controller
1115 * Bring the CAN controller out of `CAN_STATE_STOPPED`. This will reset the RX/TX error counters,
1116 * enable the CAN controller to participate in CAN communication, and enable the CAN transceiver, if
1119 * Starting the CAN controller resets all the CAN controller statistics.
1139 * @brief Stop the CAN controller
1141 * Bring the CAN controller into `CAN_STATE_STOPPED`. This will disallow the CAN controller from
1142 * participating in CAN communication, abort any pending CAN frame transmissions, and disable the
1143 * CAN transceiver, if supported.
1163 * @brief Set the CAN controller to the given operation mode
1169 * @retval -EBUSY if the CAN controller is not in stopped state.
1182 * @brief Get the operation mode of the CAN controller
1198 * @brief Set the bitrate of the CAN controller
1200 * CAN in Automation (CiA) 301 v4.2.0 recommends a sample point location of
1201 * 87.5% percent for all bitrates. However, some CAN controllers have
1215 * @retval -EBUSY if the CAN controller is not in stopped state.
1217 * @retval -ENOTSUP if the requested bitrate not supported by the CAN controller/transceiver
1227 * @name Transmitting CAN frames
1233 * @brief Queue a CAN frame for transmission on the CAN bus
1235 * Queue a CAN frame for transmission on the CAN bus with optional timeout and
1238 * Queued CAN frames are transmitted in order according to the their priority:
1239 * - The lower the CAN-ID, the higher the priority.
1241 * frames with identical CAN-IDs.
1248 * @note If transmitting segmented messages spanning multiple CAN frames with
1249 * identical CAN-IDs, the sender must ensure to only queue one frame at a time
1252 * By default, the CAN controller will automatically retry transmission in case
1253 * of lost bus arbitration or missing acknowledge. Some CAN controllers support
1257 * @param frame CAN frame to transmit.
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
1283 * @name Receiving CAN frames
1289 * @brief Add a callback function for a given CAN filter
1291 * Add a callback to CAN identifiers specified by a filter. When a received CAN
1292 * frame matching the filter is received by the CAN controller, the callback
1298 * The same callback function can be used for multiple filters.
1301 * @param callback This function is called by the CAN controller driver whenever
1315 * @brief Statically define and initialize a CAN RX message queue.
1317 * The message queue's ring buffer contains space for @a max_frames CAN frames.
1322 * @param max_frames Maximum number of CAN frames that can be queued.
1330 * Wrapper function for @a can_add_rx_filter() which puts received CAN frames
1336 * The same message queue can be used for multiple filters.
1342 * discarded. Custom error handling can be implemented by using
1357 * @brief Remove a CAN RX filter
1359 * This routine removes a CAN RX filter based on the filter ID returned by @a
1377 * Get the maximum number of concurrent RX filters for the CAN controller.
1380 * @param ide Get the maximum standard (11-bit) CAN ID filters if false, or extended (29-bit) CAN ID
1403 * @name CAN bus error reporting and handling
1409 * @brief Get current CAN controller state
1411 * Returns the current state and optionally the error counter values of the CAN
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.
1465 * @brief Set a callback for CAN controller state change events
1467 * Set the callback for CAN controller state change events. The callback
1470 * Only one callback can be registered per controller. Calling this function
1489 * @name CAN statistics
1495 * @brief Get the bit error counter for a CAN device
1497 * The bit error counter is incremented when the CAN controller is unable to
1516 * @brief Get the bit0 error counter for a CAN device
1518 * The bit0 error counter is incremented when the CAN controller is unable to
1539 * @brief Get the bit1 error counter for a CAN device
1541 * The bit1 error counter is incremented when the CAN controller is unable to
1562 * @brief Get the stuffing error counter for a CAN device
1564 * The stuffing error counter is incremented when the CAN controller detects a
1583 * @brief Get the CRC error counter for a CAN device
1585 * The CRC error counter is incremented when the CAN controller detects a frame
1604 * @brief Get the form error counter for a CAN device
1606 * The form error counter is incremented when the CAN controller detects a
1625 * @brief Get the acknowledge error counter for a CAN device
1627 * The acknowledge error counter is incremented when the CAN controller does not
1646 * @brief Get the RX overrun counter for a CAN device
1648 * The RX overrun counter is incremented when the CAN controller receives a CAN
1670 * @name CAN utility functions
1710 * @brief Check if a CAN frame matches a CAN filter
1712 * @param frame CAN frame.
1713 * @param filter CAN filter.
1714 * @return true if the CAN frame matches the CAN filter, false otherwise
1747 #include <zephyr/syscalls/can.h>