18#ifndef __VSF_USBD_CDCACM_H__
19#define __VSF_USBD_CDCACM_H__
25#if VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_USE_CDCACM == ENABLED
30#if defined(__VSF_USBD_CDCACM_CLASS_IMPLEMENT)
31# undef __VSF_USBD_CDCACM_CLASS_IMPLEMENT
32# define __VSF_CLASS_IMPLEMENT__
42#define USB_CDC_ACM_PARAM(__INT_IN_EP, __BULK_IN_EP, __BULK_OUT_EP, __STREAM_RX, __STREAM_TX, ...)\
44 .notify = (__INT_IN_EP), \
45 .out = (__BULK_OUT_EP), \
46 .in = (__BULK_IN_EP), \
48 .line_coding = __VA_ARGS__, \
49 .stream.tx.stream = (vsf_stream_t *)(__STREAM_TX), \
50 .stream.rx.stream = (vsf_stream_t *)(__STREAM_RX),
52#define USB_CDC_ACM_PARITY_NONE 0
53#define USB_CDC_ACM_PARITY_ODD 1
54#define USB_CDC_ACM_PARITY_EVEN 2
56#define USB_CDC_ACM_STOPBIT_1 0
57#define USB_CDC_ACM_STOPBIT_1P5 1
58#define USB_CDC_ACM_STOPBIT_2 2
60#define USB_CDC_ACM_LINECODE(__BAUDRATE, __BITLEN, __PARITY, __STOP) \
62 .bitrate = (__BAUDRATE), \
64 .parity = (__PARITY), \
65 .datalen = (__BITLEN), \
68#define USB_CDC_ACM_LINECODE_115200_8N1 \
69 USB_CDC_ACM_LINECODE(115200, 8, USB_CDC_ACM_PARITY_NONE, USB_CDC_ACM_STOPBIT_1)
71#define USB_CDC_ACM_IFS_NUM USB_CDC_IFS_NUM
72#define USB_CDC_ACM_IFS_CONTROL(__CDC_ACM_PARAM) \
73 USB_IFS(&vk_usbd_cdcacm_control, &__CDC_ACM_PARAM)
74#define USB_CDC_ACM_IFS_DATA(__CDC_ACM_PARAM) \
75 USB_IFS(&vk_usbd_cdcacm_data, &__CDC_ACM_PARAM)
79#define __usbd_cdc_acm_desc_iad(__name, __ifs_start, __i_func, \
80 __int_in_ep, __bulk_in_ep, __bulk_out_ep, \
81 __bulk_ep_size, __int_ep_interval) \
82 USB_DESC_CDC_ACM_IAD((__ifs_start), (__i_func), \
83 (__int_in_ep), (__bulk_in_ep), (__bulk_out_ep), \
84 (__bulk_ep_size), (__int_ep_interval))
86#define __usbd_cdc_acm_func(__name, __func_id, __str_func, __i_func, __ifs_start,\
87 __int_in_ep, __bulk_in_ep, __bulk_out_ep, __bulk_ep_size, __int_ep_interval,\
88 __stream_rx, __stream_tx, ...) \
90 __##__name##_CDCACM##__func_id##_IFS_START = (__ifs_start), \
91 __##__name##_CDCACM##__func_id##_I_FUNC = (__i_func), \
92 __##__name##_CDCACM##__func_id##_INTIN_EP = (__int_in_ep), \
93 __##__name##_CDCACM##__func_id##_BULKIN_EP = (__bulk_in_ep), \
94 __##__name##_CDCACM##__func_id##_BULKOUT_EP = (__bulk_out_ep), \
95 __##__name##_CDCACM##__func_id##_BULK_EP_SIZE = (__bulk_ep_size),\
96 __##__name##_CDCACM##__func_id##_BULK_EP_INTERVAL = (__int_ep_interval),\
98 usbd_func_str_desc(__name, __func_id, __str_func) \
99 vk_usbd_cdcacm_t __##__name##_CDCACM##__func_id = { \
100 USB_CDC_ACM_PARAM((__int_in_ep), (__bulk_in_ep), (__bulk_out_ep),\
101 (__stream_rx), (__stream_tx), __VA_ARGS__) \
104#define __usbd_cdc_acm_ifs(__name, __func_id) \
105 USB_CDC_ACM_IFS_CONTROL(__##__name##_CDCACM##__func_id) \
106 USB_CDC_ACM_IFS_DATA(__##__name##_CDCACM##__func_id)
108#define usbd_cdc_acm_desc_iad(__name, __func_id) \
109 __usbd_cdc_acm_desc_iad(__name, \
110 __##__name##_CDCACM##__func_id##_IFS_START, \
111 4 + __##__name##_CDCACM##__func_id##_I_FUNC, \
112 __##__name##_CDCACM##__func_id##_INTIN_EP, \
113 __##__name##_CDCACM##__func_id##_BULKIN_EP, \
114 __##__name##_CDCACM##__func_id##_BULKOUT_EP, \
115 __##__name##_CDCACM##__func_id##_BULK_EP_SIZE, \
116 __##__name##_CDCACM##__func_id##_BULK_EP_INTERVAL)
117#define usbd_cdc_acm_desc_table(__name, __func_id) \
118 usbd_func_str_desc_table(__name, __func_id)
119#define usbd_cdc_acm_func(__name, __func_id, __str_func, __i_func, __ifs_start, \
120 __int_in_ep, __bulk_in_ep, __bulk_out_ep, __bulk_ep_size, __int_ep_interval,\
121 __stream_rx, __stream_tx, ...) \
122 __usbd_cdc_acm_func(__name, __func_id, (__str_func), (__i_func), (__ifs_start),\
123 (__int_in_ep), (__bulk_in_ep), (__bulk_out_ep), (__bulk_ep_size), (__int_ep_interval),\
124 (__stream_rx), (__stream_tx), __VA_ARGS__)
125#define usbd_cdc_acm_ifs(__name, __func_id) \
126 __usbd_cdc_acm_ifs(__name, __func_id)
128#define usbd_cdcacm_desc_iad(...) usbd_cdc_acm_desc_iad(__VA_ARGS__)
129#define usbd_cdcacm_desc_table(...) usbd_cdc_acm_desc_table(__VA_ARGS__)
130#define usbd_cdcacm_func(...) usbd_cdc_acm_func(__VA_ARGS__)
131#define usbd_cdcacm_ifs(...) usbd_cdc_acm_ifs(__VA_ARGS__)
vsf_err_t
Definition __type.h:42
Definition vsf_usbd_CDC.h:74
Definition vsf_usbd_CDCACM.h:136
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_usb_CDCACM.h:31
const vk_usbd_class_op_t vk_usbd_cdcacm_control
const vk_usbd_class_op_t vk_usbd_cdcacm_data