@@ -571,54 +571,6 @@ static int usbd_cdc_acm_init(struct usbd_class_data *const c_data)
571
571
return 0 ;
572
572
}
573
573
574
- static inline int cdc_acm_send_notification (const struct device * dev ,
575
- const uint16_t serial_state )
576
- {
577
- struct cdc_acm_notification notification = {
578
- .bmRequestType = 0xA1 ,
579
- .bNotificationType = USB_CDC_SERIAL_STATE ,
580
- .wValue = 0 ,
581
- .wIndex = 0 ,
582
- .wLength = sys_cpu_to_le16 (sizeof (uint16_t )),
583
- .data = sys_cpu_to_le16 (serial_state ),
584
- };
585
- struct cdc_acm_uart_data * data = dev -> data ;
586
- const struct cdc_acm_uart_config * cfg = dev -> config ;
587
- struct usbd_class_data * c_data = cfg -> c_data ;
588
- struct net_buf * buf ;
589
- uint8_t ep ;
590
- int ret ;
591
-
592
- if (!atomic_test_bit (& data -> state , CDC_ACM_CLASS_ENABLED )) {
593
- LOG_INF ("USB configuration is not enabled" );
594
- return - EACCES ;
595
- }
596
-
597
- if (atomic_test_bit (& data -> state , CDC_ACM_CLASS_SUSPENDED )) {
598
- LOG_INF ("USB support is suspended (FIXME)" );
599
- return - EACCES ;
600
- }
601
-
602
- ep = cdc_acm_get_int_in (c_data );
603
- buf = usbd_ep_buf_alloc (c_data , ep , sizeof (struct cdc_acm_notification ));
604
- if (buf == NULL ) {
605
- return - ENOMEM ;
606
- }
607
-
608
- net_buf_add_mem (buf , & notification , sizeof (struct cdc_acm_notification ));
609
- ret = usbd_ep_enqueue (c_data , buf );
610
- if (ret ) {
611
- net_buf_unref (buf );
612
- return ret ;
613
- }
614
-
615
- if (k_sem_take (& data -> notif_sem , K_FOREVER ) == - EAGAIN ) {
616
- return - ECANCELED ;
617
- }
618
-
619
- return ret ;
620
- }
621
-
622
574
/*
623
575
* TX handler is triggered when the state of TX fifo has been altered.
624
576
*/
@@ -1019,6 +971,54 @@ static void cdc_acm_poll_out(const struct device *dev, const unsigned char c)
1019
971
}
1020
972
1021
973
#ifdef CONFIG_UART_LINE_CTRL
974
+ static inline int cdc_acm_send_notification (const struct device * dev ,
975
+ const uint16_t serial_state )
976
+ {
977
+ struct cdc_acm_notification notification = {
978
+ .bmRequestType = 0xA1 ,
979
+ .bNotificationType = USB_CDC_SERIAL_STATE ,
980
+ .wValue = 0 ,
981
+ .wIndex = 0 ,
982
+ .wLength = sys_cpu_to_le16 (sizeof (uint16_t )),
983
+ .data = sys_cpu_to_le16 (serial_state ),
984
+ };
985
+ struct cdc_acm_uart_data * data = dev -> data ;
986
+ const struct cdc_acm_uart_config * cfg = dev -> config ;
987
+ struct usbd_class_data * c_data = cfg -> c_data ;
988
+ struct net_buf * buf ;
989
+ uint8_t ep ;
990
+ int ret ;
991
+
992
+ if (!atomic_test_bit (& data -> state , CDC_ACM_CLASS_ENABLED )) {
993
+ LOG_INF ("USB configuration is not enabled" );
994
+ return - EACCES ;
995
+ }
996
+
997
+ if (atomic_test_bit (& data -> state , CDC_ACM_CLASS_SUSPENDED )) {
998
+ LOG_INF ("USB support is suspended (FIXME)" );
999
+ return - EACCES ;
1000
+ }
1001
+
1002
+ ep = cdc_acm_get_int_in (c_data );
1003
+ buf = usbd_ep_buf_alloc (c_data , ep , sizeof (struct cdc_acm_notification ));
1004
+ if (buf == NULL ) {
1005
+ return - ENOMEM ;
1006
+ }
1007
+
1008
+ net_buf_add_mem (buf , & notification , sizeof (struct cdc_acm_notification ));
1009
+ ret = usbd_ep_enqueue (c_data , buf );
1010
+ if (ret ) {
1011
+ net_buf_unref (buf );
1012
+ return ret ;
1013
+ }
1014
+
1015
+ if (k_sem_take (& data -> notif_sem , K_FOREVER ) == - EAGAIN ) {
1016
+ return - ECANCELED ;
1017
+ }
1018
+
1019
+ return ret ;
1020
+ }
1021
+
1022
1022
static int cdc_acm_line_ctrl_set (const struct device * dev ,
1023
1023
const uint32_t ctrl , const uint32_t val )
1024
1024
{
0 commit comments