From 629a7970ebb0902383db6cbc003e5bc248ff76d6 Mon Sep 17 00:00:00 2001 From: CXSforHPU <19511928573@163.com> Date: Sat, 7 Nov 2026 17:16:10 +0800 Subject: [components][dfs]Class-encode RT_DEVICE_CTRL_* commands to fix POSIX/dev command collisions: class in high byte, index low byte. --- components/drivers/include/drivers/dev_pin.h | 2 +- components/drivers/include/drivers/dev_serial_v2.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'components/drivers/include') 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 -- cgit v1.3.1