summaryrefslogtreecommitdiff
path: root/components/drivers
diff options
context:
space:
mode:
authorCXSforHPU <[email protected]>2026-11-07 17:16:10 +0800
committerRbb666 <[email protected]>2026-11-18 09:11:48 +0800
commit629a7970ebb0902383db6cbc003e5bc248ff76d6 (patch)
tree222a4396ec34b3a15a0e158809f2ddbb469f791c /components/drivers
parent265116d74d753d5605546f798a9a8f54c571b22b (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/drivers')
-rw-r--r--components/drivers/include/drivers/dev_pin.h2
-rw-r--r--components/drivers/include/drivers/dev_serial_v2.h11
2 files changed, 9 insertions, 4 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