support multi port api for device
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
const char *stop_name[] = { "1", "1.5", "2" };
|
||||
const char *parity_name[] = { "N", "O", "E", "M", "S" };
|
||||
|
||||
static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
|
||||
static int cdc_acm_class_interface_request_handler(uint8_t busid, struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
|
||||
{
|
||||
USB_LOG_DBG("CDC Class request: "
|
||||
"bRequest 0x%02x\r\n",
|
||||
@@ -47,7 +47,7 @@ static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setu
|
||||
parity_name[line_coding.bParityType],
|
||||
stop_name[line_coding.bCharFormat]);
|
||||
|
||||
usbd_cdc_acm_set_line_coding(intf_num, &line_coding);
|
||||
usbd_cdc_acm_set_line_coding(busid, intf_num, &line_coding);
|
||||
break;
|
||||
|
||||
case CDC_REQUEST_SET_CONTROL_LINE_STATE:
|
||||
@@ -57,12 +57,12 @@ static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setu
|
||||
intf_num,
|
||||
dtr,
|
||||
rts);
|
||||
usbd_cdc_acm_set_dtr(intf_num, dtr);
|
||||
usbd_cdc_acm_set_rts(intf_num, rts);
|
||||
usbd_cdc_acm_set_dtr(busid, intf_num, dtr);
|
||||
usbd_cdc_acm_set_rts(busid, intf_num, rts);
|
||||
break;
|
||||
|
||||
case CDC_REQUEST_GET_LINE_CODING:
|
||||
usbd_cdc_acm_get_line_coding(intf_num, &line_coding);
|
||||
usbd_cdc_acm_get_line_coding(busid, intf_num, &line_coding);
|
||||
memcpy(*data, &line_coding, 7);
|
||||
*len = 7;
|
||||
USB_LOG_DBG("Get intf:%d linecoding %d %d %d %d\r\n",
|
||||
@@ -73,7 +73,7 @@ static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setu
|
||||
line_coding.bDataBits);
|
||||
break;
|
||||
case CDC_REQUEST_SEND_BREAK:
|
||||
usbd_cdc_acm_send_break(intf_num);
|
||||
usbd_cdc_acm_send_break(busid, intf_num);
|
||||
break;
|
||||
default:
|
||||
USB_LOG_WRN("Unhandled CDC Class bRequest 0x%02x\r\n", setup->bRequest);
|
||||
@@ -83,7 +83,7 @@ static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setu
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct usbd_interface *usbd_cdc_acm_init_intf(struct usbd_interface *intf)
|
||||
struct usbd_interface *usbd_cdc_acm_init_intf(uint8_t busid, struct usbd_interface *intf)
|
||||
{
|
||||
intf->class_interface_handler = cdc_acm_class_interface_request_handler;
|
||||
intf->class_endpoint_handler = NULL;
|
||||
@@ -93,11 +93,11 @@ struct usbd_interface *usbd_cdc_acm_init_intf(struct usbd_interface *intf)
|
||||
return intf;
|
||||
}
|
||||
|
||||
__WEAK void usbd_cdc_acm_set_line_coding(uint8_t intf, struct cdc_line_coding *line_coding)
|
||||
__WEAK void usbd_cdc_acm_set_line_coding(uint8_t busid, uint8_t intf, struct cdc_line_coding *line_coding)
|
||||
{
|
||||
}
|
||||
|
||||
__WEAK void usbd_cdc_acm_get_line_coding(uint8_t intf, struct cdc_line_coding *line_coding)
|
||||
__WEAK void usbd_cdc_acm_get_line_coding(uint8_t busid, uint8_t intf, struct cdc_line_coding *line_coding)
|
||||
{
|
||||
line_coding->dwDTERate = 2000000;
|
||||
line_coding->bDataBits = 8;
|
||||
@@ -105,14 +105,14 @@ __WEAK void usbd_cdc_acm_get_line_coding(uint8_t intf, struct cdc_line_coding *l
|
||||
line_coding->bCharFormat = 0;
|
||||
}
|
||||
|
||||
__WEAK void usbd_cdc_acm_set_dtr(uint8_t intf, bool dtr)
|
||||
__WEAK void usbd_cdc_acm_set_dtr(uint8_t busid, uint8_t intf, bool dtr)
|
||||
{
|
||||
}
|
||||
|
||||
__WEAK void usbd_cdc_acm_set_rts(uint8_t intf, bool rts)
|
||||
__WEAK void usbd_cdc_acm_set_rts(uint8_t busid, uint8_t intf, bool rts)
|
||||
{
|
||||
}
|
||||
|
||||
__WEAK void usbd_cdc_acm_send_break(uint8_t intf)
|
||||
__WEAK void usbd_cdc_acm_send_break(uint8_t busid, uint8_t intf)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user