Skip to content

Commit b5e0af7

Browse files
henrikbrixandersenjgl-meta
authored andcommitted
drivers: can: mcan: add CAN_MCAN_DT_MRBA() and CAN_MCAN_DT_INST_MRBA()
Add CAN_MCAN_DT_MRBA() and CAN_MCAN_DT_INST_MRBA() macros for retrieving the Bosch M_CAN Message RAM Base Address (MRBA) and clarify that the existing CAN_MCAN_DT_MRAM_ADDR() and CAN_MCAN_DT_INST_MRAM_ADDR() macros do not retrieve the base address, but rather the base address + the offset, if any. Signed-off-by: Henrik Brix Andersen <[email protected]> (cherry picked from commit 71a7afa)
1 parent aa3f810 commit b5e0af7

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

include/zephyr/drivers/can/can_mcan.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,13 +573,25 @@
573573
* @brief Get the Bosch M_CAN Message RAM base address
574574
*
575575
* For devicetree nodes with dedicated Message RAM area defined via devicetree, this macro returns
576-
* the base address of the Message RAM, taking in the Message RAM offset into account.
576+
* the base address of the Message RAM.
577577
*
578578
* @param node_id node identifier
579-
* @return the Bosch M_CAN Message RAM base address
579+
* @return the Bosch M_CAN Message RAM base address (MRBA)
580+
*/
581+
#define CAN_MCAN_DT_MRBA(node_id) \
582+
(mem_addr_t)DT_REG_ADDR_BY_NAME(node_id, message_ram)
583+
584+
/**
585+
* @brief Get the Bosch M_CAN Message RAM address
586+
*
587+
* For devicetree nodes with dedicated Message RAM area defined via devicetree, this macro returns
588+
* the address of the Message RAM, taking in the Message RAM offset into account.
589+
*
590+
* @param node_id node identifier
591+
* @return the Bosch M_CAN Message RAM address
580592
*/
581593
#define CAN_MCAN_DT_MRAM_ADDR(node_id) \
582-
(mem_addr_t)(DT_REG_ADDR_BY_NAME(node_id, message_ram) + CAN_MCAN_DT_MRAM_OFFSET(node_id))
594+
(mem_addr_t)(CAN_MCAN_DT_MRBA(node_id) + CAN_MCAN_DT_MRAM_OFFSET(node_id))
583595

584596
/**
585597
* @brief Get the Bosch M_CAN Message RAM size
@@ -782,10 +794,18 @@
782794
*/
783795
#define CAN_MCAN_DT_INST_MCAN_ADDR(inst) CAN_MCAN_DT_MCAN_ADDR(DT_DRV_INST(inst))
784796

797+
/**
798+
* @brief Equivalent to CAN_MCAN_DT_MRBA(DT_DRV_INST(inst))
799+
* @param inst DT_DRV_COMPAT instance number
800+
* @return the Bosch M_CAN Message RAM Base Address (MRBA)
801+
* @see CAN_MCAN_DT_MRBA()
802+
*/
803+
#define CAN_MCAN_DT_INST_MRBA(inst) CAN_MCAN_DT_MRBA(DT_DRV_INST(inst))
804+
785805
/**
786806
* @brief Equivalent to CAN_MCAN_DT_MRAM_ADDR(DT_DRV_INST(inst))
787807
* @param inst DT_DRV_COMPAT instance number
788-
* @return the Bosch M_CAN Message RAM base address
808+
* @return the Bosch M_CAN Message RAM address
789809
* @see CAN_MCAN_DT_MRAM_ADDR()
790810
*/
791811
#define CAN_MCAN_DT_INST_MRAM_ADDR(inst) CAN_MCAN_DT_MRAM_ADDR(DT_DRV_INST(inst))

0 commit comments

Comments
 (0)