diff options
| author | CXSforHPU <[email protected]> | 2026-11-07 17:16:10 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-11-18 09:11:48 +0800 |
| commit | 629a7970ebb0902383db6cbc003e5bc248ff76d6 (patch) | |
| tree | 222a4396ec34b3a15a0e158809f2ddbb469f791c /components | |
| parent | 265116d74d753d5605546f798a9a8f54c571b22b (diff) | |
[components][dfs]Class-encode RT_DEVICE_CTRL_* commands to fix POSIX/dev command collisions: class in high byte, index low byte.
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/include/drivers/dev_pin.h | 2 | ||||
| -rw-r--r-- | components/drivers/include/drivers/dev_serial_v2.h | 11 | ||||
| -rw-r--r-- | components/utilities/rt-link/inc/rtlink_dev.h | 10 | ||||
| -rw-r--r-- | components/utilities/rt-link/src/rtlink_dev.c | 2 |
4 files changed, 15 insertions, 10 deletions
diff --git a/components/drivers/include/drivers/dev_pin.h b/components/drivers/include/drivers/dev_pin.h index 2039870983..7155ef0624 100644 --- a/components/drivers/include/drivers/dev_pin.h +++ b/components/drivers/include/drivers/dev_pin.h @@ -122,7 +122,7 @@ struct rt_device_pin #ifdef RT_USING_PINCTRL enum { - PIN_CONFIG_BIAS_BUS_HOLD, + PIN_CONFIG_BIAS_BUS_HOLD = RT_DEVICE_CTRL_BASE(Pin) + 1, PIN_CONFIG_BIAS_DISABLE, PIN_CONFIG_BIAS_HIGH_IMPEDANCE, PIN_CONFIG_BIAS_PULL_DOWN, diff --git a/components/drivers/include/drivers/dev_serial_v2.h b/components/drivers/include/drivers/dev_serial_v2.h index 2a8d9145e6..daa1a0ef58 100644 --- a/components/drivers/include/drivers/dev_serial_v2.h +++ b/components/drivers/include/drivers/dev_serial_v2.h @@ -186,10 +186,15 @@ /** * hw serial control commands + * + * The 0x40-0x4f index range is reserved for hardware serial controls. */ -#define RT_HW_SERIAL_CTRL_GETC 0x01 /* Tx irq get char */ -#define RT_HW_SERIAL_CTRL_PUTC 0x02 /* Rx irq put char */ -#define RT_HW_SERIAL_CTRL_GET_DMA_PING_BUF 0x03 /* Get DMA ping-pong buffer */ +typedef enum rt_hw_serial_ctrl_cmd +{ + RT_HW_SERIAL_CTRL_GETC = RT_DEVICE_CTRL_BASE(Char) + 0x40, /* Tx irq get char */ + RT_HW_SERIAL_CTRL_PUTC, /* Rx irq put char */ + RT_HW_SERIAL_CTRL_GET_DMA_PING_BUF, /* Get DMA ping-pong buffer */ +} rt_hw_serial_ctrl_cmd_t; /** * hw isr event diff --git a/components/utilities/rt-link/inc/rtlink_dev.h b/components/utilities/rt-link/inc/rtlink_dev.h index 01fd04373c..0445e4d868 100644 --- a/components/utilities/rt-link/inc/rtlink_dev.h +++ b/components/utilities/rt-link/inc/rtlink_dev.h @@ -11,11 +11,11 @@ #include <rtthread.h> #include <rtlink.h> -#define RT_LINK_RX_NONBLOCKING 0x1000 -#define RT_LINK_RX_BLOCKING 0x2000 -#define RT_LINK_TX_NONBLOCKING 0x4000 -#define RT_LINK_TX_BLOCKING 0x8000 -#define RT_LINK_DEVICE_MASK 0xf000 +#define RT_LINK_RX_NONBLOCKING 0x01000000 +#define RT_LINK_RX_BLOCKING 0x02000000 +#define RT_LINK_TX_NONBLOCKING 0x04000000 +#define RT_LINK_TX_BLOCKING 0x08000000 +#define RT_LINK_DEVICE_MASK 0x0f000000 struct rtlink_recv_list { diff --git a/components/utilities/rt-link/src/rtlink_dev.c b/components/utilities/rt-link/src/rtlink_dev.c index b4f1add678..b130b27927 100644 --- a/components/utilities/rt-link/src/rtlink_dev.c +++ b/components/utilities/rt-link/src/rtlink_dev.c @@ -320,7 +320,7 @@ rt_err_t rt_link_dev_control(rt_device_t dev, int cmd, void *args) { RT_ASSERT(dev != RT_NULL); - if (cmd & RT_DEVICE_CTRL_CONFIG) + if ((cmd & ~RT_LINK_DEVICE_MASK) == RT_DEVICE_CTRL_CONFIG) { if (args == RT_NULL) return -RT_EINVAL; |
