aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/can_lld.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms/STM32/can_lld.h')
-rw-r--r--os/hal/platforms/STM32/can_lld.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/os/hal/platforms/STM32/can_lld.h b/os/hal/platforms/STM32/can_lld.h
index 132cd207a..a15226f4a 100644
--- a/os/hal/platforms/STM32/can_lld.h
+++ b/os/hal/platforms/STM32/can_lld.h
@@ -51,6 +51,16 @@
#define CAN_SUPPORTS_SLEEP TRUE
/**
+ * @brief This implementation supports three transmit mailboxes.
+ */
+#define CAN_TX_MAILBOXES 3
+
+/**
+ * @brief This implementation supports two receive mailboxes.
+ */
+#define CAN_RX_MAILBOXES 3
+
+/**
* @name CAN registers helper macros
* @{
*/
@@ -131,6 +141,11 @@
/*===========================================================================*/
/**
+ * @brief Type of a transmission mailbox index.
+ */
+typedef uint32_t canmbx_t;
+
+/**
* @brief CAN transmission frame.
* @note Accessing the frame data as word16 or word32 is not portable because
* machine data endianness, it can be still useful for a quick filling.
@@ -270,14 +285,21 @@ typedef struct {
* repeatedly invoking @p chReceive() when listening to this event.
* This behavior minimizes the interrupt served by the system
* because CAN traffic.
+ * @note The flags associated to the listeners will indicate which
+ * receive mailboxes become non-empty.
*/
EventSource rxfull_event;
/**
- * @brief One or more transmission slots become available.
+ * @brief One or more transmission mailbox become available.
+ * @note The flags associated to the listeners will indicate which
+ * transmit mailboxes become empty.
+ *
*/
EventSource txempty_event;
/**
* @brief A CAN bus error happened.
+ * @note The flags associated to the listeners will indicate the
+ * error(s) that have occurred.
*/
EventSource error_event;
#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)
@@ -319,10 +341,16 @@ extern "C" {
void can_lld_init(void);
void can_lld_start(CANDriver *canp);
void can_lld_stop(CANDriver *canp);
- bool_t can_lld_can_transmit(CANDriver *canp);
- void can_lld_transmit(CANDriver *canp, const CANTxFrame *crfp);
- bool_t can_lld_can_receive(CANDriver *canp);
- void can_lld_receive(CANDriver *canp, CANRxFrame *ctfp);
+ bool_t can_lld_is_tx_empty(CANDriver *canp,
+ canmbx_t mailbox);
+ void can_lld_transmit(CANDriver *canp,
+ canmbx_t mailbox,
+ const CANTxFrame *crfp);
+ bool_t can_lld_is_rx_nonempty(CANDriver *canp,
+ canmbx_t mailbox);
+ void can_lld_receive(CANDriver *canp,
+ canmbx_t mailbox,
+ CANRxFrame *ctfp);
#if CAN_USE_SLEEP_MODE
void can_lld_sleep(CANDriver *canp);
void can_lld_wakeup(CANDriver *canp);