Skip to content

Commit 20faef8

Browse files
committed
update(class/cdc): change serial state macro
Signed-off-by: sakumisu <[email protected]>
1 parent fb8dbce commit 20faef8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

class/cdc/usb_cdc.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@
217217
#define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */
218218
#define CDC_SERIAL_STATE_BREAK_Pos (2)
219219
#define CDC_SERIAL_STATE_BREAK_Msk (1 << CDC_SERIAL_STATE_BREAK_Pos)
220-
#define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */
221-
#define CDC_SERIAL_STATE_TX_CARRIER_Pos (1)
222-
#define CDC_SERIAL_STATE_TX_CARRIER_Msk (1 << CDC_SERIAL_STATE_TX_CARRIER_Pos)
223-
#define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */
224-
#define CDC_SERIAL_STATE_RX_CARRIER_Pos (0)
225-
#define CDC_SERIAL_STATE_RX_CARRIER_Msk (1 << CDC_SERIAL_STATE_RX_CARRIER_Pos)
220+
#define CDC_SERIAL_STATE_DSR (1 << 1) /* state of transmission carrier */
221+
#define CDC_SERIAL_STATE_DSR_Pos (1)
222+
#define CDC_SERIAL_STATE_DSR_Msk (1 << CDC_SERIAL_STATE_DSR_Pos)
223+
#define CDC_SERIAL_STATE_DCD (1 << 0) /* state of receiver carrier */
224+
#define CDC_SERIAL_STATE_DCD_Pos (0)
225+
#define CDC_SERIAL_STATE_DCD_Msk (1 << CDC_SERIAL_STATE_DCD_Pos)
226226

227227
#define CDC_ECM_XMIT_OK (1 << 0)
228228
#define CDC_ECM_RVC_OK (1 << 1)

class/serial/usbh_cdc_acm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ static int usbh_cdc_acm_get_modem_status(struct usbh_serial *serial)
147147

148148
cdc_acm_class = (struct usbh_cdc_acm *)serial->priv;
149149

150-
status = (cdc_acm_class->modem_status & CDC_SERIAL_STATE_TX_CARRIER ? USBH_SERIAL_TIOCM_DSR : 0) |
150+
status = (cdc_acm_class->modem_status & CDC_SERIAL_STATE_DSR ? USBH_SERIAL_TIOCM_DSR : 0) |
151151
(cdc_acm_class->modem_status & CDC_SERIAL_STATE_RING ? USBH_SERIAL_TIOCM_RI : 0) |
152-
(cdc_acm_class->modem_status & CDC_SERIAL_STATE_RX_CARRIER ? USBH_SERIAL_TIOCM_CD : 0) |
152+
(cdc_acm_class->modem_status & CDC_SERIAL_STATE_DCD ? USBH_SERIAL_TIOCM_CD : 0) |
153153
(serial->line_state & USBH_SERIAL_TIOCM_DTR ? USBH_SERIAL_TIOCM_DTR : 0) |
154154
(serial->line_state & USBH_SERIAL_TIOCM_RTS ? USBH_SERIAL_TIOCM_RTS : 0);
155155

@@ -192,10 +192,10 @@ static int __usbh_cdc_acm_get_modem_status(struct usbh_serial *serial)
192192
difference = cdc_acm_class->modem_status ^ notification->data;
193193
cdc_acm_class->modem_status = notification->data;
194194

195-
if (difference & CDC_SERIAL_STATE_TX_CARRIER)
196-
serial->iocount.dsr++;
197-
if (difference & CDC_SERIAL_STATE_RX_CARRIER)
195+
if (difference & CDC_SERIAL_STATE_DSR)
198196
serial->iocount.dsr++;
197+
if (difference & CDC_SERIAL_STATE_DCD)
198+
serial->iocount.dcd++;
199199
if (notification->data & CDC_SERIAL_STATE_BREAK)
200200
serial->iocount.brk++;
201201
if (notification->data & CDC_SERIAL_STATE_FRAMING)

0 commit comments

Comments
 (0)