1:解决未使用串口设备时,bulkout端点接收数据触发断言的问题。
This commit is contained in:
parent
174787ce69
commit
2ea318cc03
@ -176,7 +176,7 @@ const static struct ucdc_comm_descriptor _comm_desc =
|
|||||||
USB_DESC_TYPE_ENDPOINT,
|
USB_DESC_TYPE_ENDPOINT,
|
||||||
USB_DYNAMIC | USB_DIR_IN,
|
USB_DYNAMIC | USB_DIR_IN,
|
||||||
USB_EP_ATTR_INT,
|
USB_EP_ATTR_INT,
|
||||||
0x08,
|
0x0008,
|
||||||
0xFF,
|
0xFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -300,6 +300,9 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
|
|||||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_out_handler %d\n", size));
|
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_out_handler %d\n", size));
|
||||||
|
|
||||||
data = (struct vcom*)func->user_data;
|
data = (struct vcom*)func->user_data;
|
||||||
|
/* ensure serial is active */
|
||||||
|
if(data->serial.parent.open_flag & RT_DEVICE_FLAG_ACTIVATED)
|
||||||
|
{
|
||||||
/* receive data from USB VCOM */
|
/* receive data from USB VCOM */
|
||||||
level = rt_hw_interrupt_disable();
|
level = rt_hw_interrupt_disable();
|
||||||
|
|
||||||
@ -308,6 +311,7 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
|
|||||||
|
|
||||||
/* notify receive data */
|
/* notify receive data */
|
||||||
rt_hw_serial_isr(&data->serial,RT_SERIAL_EVENT_RX_IND);
|
rt_hw_serial_isr(&data->serial,RT_SERIAL_EVENT_RX_IND);
|
||||||
|
}
|
||||||
|
|
||||||
data->ep_out->request.buffer = data->ep_out->buffer;
|
data->ep_out->request.buffer = data->ep_out->buffer;
|
||||||
data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
|
data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
|
||||||
@ -879,7 +883,7 @@ static void rt_usb_vcom_init(struct ufunction *func)
|
|||||||
rt_ringbuffer_init(&data->rx_ringbuffer, data->rx_rbp, CDC_RX_BUFSIZE);
|
rt_ringbuffer_init(&data->rx_ringbuffer, data->rx_rbp, CDC_RX_BUFSIZE);
|
||||||
rt_ringbuffer_init(&data->tx_ringbuffer, data->tx_rbp, CDC_TX_BUFSIZE);
|
rt_ringbuffer_init(&data->tx_ringbuffer, data->tx_rbp, CDC_TX_BUFSIZE);
|
||||||
|
|
||||||
rt_event_init(&data->tx_event, "vom", RT_IPC_FLAG_FIFO);
|
rt_event_init(&data->tx_event, "vcom", RT_IPC_FLAG_FIFO);
|
||||||
|
|
||||||
config.baud_rate = BAUD_RATE_115200;
|
config.baud_rate = BAUD_RATE_115200;
|
||||||
config.data_bits = DATA_BITS_8;
|
config.data_bits = DATA_BITS_8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user