update(class/cdc): change serial state macro

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2026-01-26 21:16:12 +08:00
parent 2783329509
commit bad94dfc67
2 changed files with 11 additions and 11 deletions

View File

@@ -217,12 +217,12 @@
#define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */ #define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */
#define CDC_SERIAL_STATE_BREAK_Pos (2) #define CDC_SERIAL_STATE_BREAK_Pos (2)
#define CDC_SERIAL_STATE_BREAK_Msk (1 << CDC_SERIAL_STATE_BREAK_Pos) #define CDC_SERIAL_STATE_BREAK_Msk (1 << CDC_SERIAL_STATE_BREAK_Pos)
#define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */ #define CDC_SERIAL_STATE_DSR (1 << 1) /* state of transmission carrier */
#define CDC_SERIAL_STATE_TX_CARRIER_Pos (1) #define CDC_SERIAL_STATE_DSR_Pos (1)
#define CDC_SERIAL_STATE_TX_CARRIER_Msk (1 << CDC_SERIAL_STATE_TX_CARRIER_Pos) #define CDC_SERIAL_STATE_DSR_Msk (1 << CDC_SERIAL_STATE_DSR_Pos)
#define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */ #define CDC_SERIAL_STATE_DCD (1 << 0) /* state of receiver carrier */
#define CDC_SERIAL_STATE_RX_CARRIER_Pos (0) #define CDC_SERIAL_STATE_DCD_Pos (0)
#define CDC_SERIAL_STATE_RX_CARRIER_Msk (1 << CDC_SERIAL_STATE_RX_CARRIER_Pos) #define CDC_SERIAL_STATE_DCD_Msk (1 << CDC_SERIAL_STATE_DCD_Pos)
#define CDC_ECM_XMIT_OK (1 << 0) #define CDC_ECM_XMIT_OK (1 << 0)
#define CDC_ECM_RVC_OK (1 << 1) #define CDC_ECM_RVC_OK (1 << 1)

View File

@@ -147,9 +147,9 @@ static int usbh_cdc_acm_get_modem_status(struct usbh_serial *serial)
cdc_acm_class = (struct usbh_cdc_acm *)serial->priv; cdc_acm_class = (struct usbh_cdc_acm *)serial->priv;
status = (cdc_acm_class->modem_status & CDC_SERIAL_STATE_TX_CARRIER ? USBH_SERIAL_TIOCM_DSR : 0) | status = (cdc_acm_class->modem_status & CDC_SERIAL_STATE_DSR ? USBH_SERIAL_TIOCM_DSR : 0) |
(cdc_acm_class->modem_status & CDC_SERIAL_STATE_RING ? USBH_SERIAL_TIOCM_RI : 0) | (cdc_acm_class->modem_status & CDC_SERIAL_STATE_RING ? USBH_SERIAL_TIOCM_RI : 0) |
(cdc_acm_class->modem_status & CDC_SERIAL_STATE_RX_CARRIER ? USBH_SERIAL_TIOCM_CD : 0) | (cdc_acm_class->modem_status & CDC_SERIAL_STATE_DCD ? USBH_SERIAL_TIOCM_CD : 0) |
(serial->line_state & USBH_SERIAL_TIOCM_DTR ? USBH_SERIAL_TIOCM_DTR : 0) | (serial->line_state & USBH_SERIAL_TIOCM_DTR ? USBH_SERIAL_TIOCM_DTR : 0) |
(serial->line_state & USBH_SERIAL_TIOCM_RTS ? USBH_SERIAL_TIOCM_RTS : 0); (serial->line_state & USBH_SERIAL_TIOCM_RTS ? USBH_SERIAL_TIOCM_RTS : 0);
@@ -192,10 +192,10 @@ static int __usbh_cdc_acm_get_modem_status(struct usbh_serial *serial)
difference = cdc_acm_class->modem_status ^ notification->data; difference = cdc_acm_class->modem_status ^ notification->data;
cdc_acm_class->modem_status = notification->data; cdc_acm_class->modem_status = notification->data;
if (difference & CDC_SERIAL_STATE_TX_CARRIER) if (difference & CDC_SERIAL_STATE_DSR)
serial->iocount.dsr++;
if (difference & CDC_SERIAL_STATE_RX_CARRIER)
serial->iocount.dsr++; serial->iocount.dsr++;
if (difference & CDC_SERIAL_STATE_DCD)
serial->iocount.dcd++;
if (notification->data & CDC_SERIAL_STATE_BREAK) if (notification->data & CDC_SERIAL_STATE_BREAK)
serial->iocount.brk++; serial->iocount.brk++;
if (notification->data & CDC_SERIAL_STATE_FRAMING) if (notification->data & CDC_SERIAL_STATE_FRAMING)