mimxrt/machine_can: Define CAN_HW_MAX_FILTER and CAN_TX_QUEUE_LEN.

These were define with default values, but port specific values can
be used instead.

Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
robert-hh
2026-04-15 16:37:33 +02:00
committed by Damien George
parent 49510efae6
commit 4c6892e4db
2 changed files with 3 additions and 8 deletions
+3 -2
View File
@@ -76,8 +76,9 @@
#define CAN_SJW_MAX ((CAN_CTRL1_RJW_MASK >> CAN_CTRL1_RJW_SHIFT) + 1)
#define CAN_USE_UPSTREAM_TIMING (1)
#define CAN_IDFILTERNUM_MAX (((CAN_CTRL2_RFFN_MASK >> CAN_CTRL2_RFFN_SHIFT) + 1) * 8)
#define CAN_HW_MAX_FILTER (((CAN_CTRL2_RFFN_MASK >> CAN_CTRL2_RFFN_SHIFT) + 1) * 8)
#define CAN_FILTER_MASK_NUM (64)
#define CAN_TX_QUEUE_LEN (64 - 7 - (CAN_HW_MAX_FILTER / 4))
// matches fsl_flexcan.c enum _flexcan_mb_code_tx
#define kFLEXCAN_TxMbInactive (0x8)
@@ -264,7 +265,7 @@ static void machine_can_port_init(machine_can_obj_t *self) {
// Set the number of filters here. RFFN will be set accordingly.
// This largest possible value is (CAN_CTRL2_RFFN_MASK >> CAN_CTRL2_RFFN_SHIFT) + 1) * 8.
// If needed, lower these in steps of 8.
mp_uint_t idFilterNum = CAN_IDFILTERNUM_MAX;
mp_uint_t idFilterNum = CAN_HW_MAX_FILTER;
port->flexcan_rx_fifo_config->idFilterNum = idFilterNum;
port->flexcan_rx_fifo_config->idFilterType = kFLEXCAN_RxFifoFilterTypeA;
port->flexcan_rx_fifo_config->priority = kFLEXCAN_RxFifoPrioHigh;
-6
View File
@@ -110,12 +110,6 @@ uint32_t trng_random_u32(void);
#ifndef MICROPY_HW_CAN_IS_RESERVED
#define MICROPY_HW_CAN_IS_RESERVED(can_id) (false)
#endif
#ifndef CAN_TX_QUEUE_LEN
#define CAN_TX_QUEUE_LEN (16) // Must be checked
#endif
#ifndef CAN_HW_MAX_FILTER
#define CAN_HW_MAX_FILTER (128)
#endif
#ifndef MICROPY_PY_MACHINE_I2C_TARGET
#define MICROPY_PY_MACHINE_I2C_TARGET (1)
#define MICROPY_PY_MACHINE_I2C_TARGET_INCLUDEFILE "ports/mimxrt/machine_i2c_target.c"