usb_serial: Moved usbuart_send_stdout() into the usb_serial code
This commit is contained in:
parent
099540cccb
commit
70e24f4203
|
@ -46,6 +46,7 @@
|
|||
#endif
|
||||
#include "usbuart.h"
|
||||
|
||||
#include <libopencm3/cm3/nvic.h>
|
||||
#include <libopencm3/usb/cdc.h>
|
||||
|
||||
static bool gdb_uart_dtr = true;
|
||||
|
@ -170,3 +171,17 @@ void usb_serial_set_config(usbd_device *dev, uint16_t value)
|
|||
initialise_monitor_handles();
|
||||
#endif
|
||||
}
|
||||
|
||||
void usbuart_send_stdout(const uint8_t *data, uint32_t len)
|
||||
{
|
||||
while (len) {
|
||||
uint32_t cnt = CDCACM_PACKET_SIZE;
|
||||
if (cnt > len)
|
||||
cnt = len;
|
||||
nvic_disable_irq(USB_IRQ);
|
||||
cnt = usbd_ep_write_packet(usbdev, CDCACM_UART_ENDPOINT, data, cnt);
|
||||
nvic_enable_irq(USB_IRQ);
|
||||
data += cnt;
|
||||
len -= cnt;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,20 +192,6 @@ void aux_serial_init(void)
|
|||
usart_enable_rx_dma(USBUSART);
|
||||
}
|
||||
|
||||
void usbuart_send_stdout(const uint8_t *data, uint32_t len)
|
||||
{
|
||||
while (len) {
|
||||
uint32_t cnt = CDCACM_PACKET_SIZE;
|
||||
if (cnt > len)
|
||||
cnt = len;
|
||||
nvic_disable_irq(USB_IRQ);
|
||||
cnt = usbd_ep_write_packet(usbdev, CDCACM_UART_ENDPOINT, data, cnt);
|
||||
nvic_enable_irq(USB_IRQ);
|
||||
data += cnt;
|
||||
len -= cnt;
|
||||
}
|
||||
}
|
||||
|
||||
void usbuart_set_line_coding(struct usb_cdc_line_coding *coding)
|
||||
{
|
||||
usart_set_baudrate(USBUSART, coding->dwDTERate);
|
||||
|
|
|
@ -76,20 +76,6 @@ void aux_serial_init(void)
|
|||
nvic_enable_irq(USBUART_IRQ);
|
||||
}
|
||||
|
||||
void usbuart_send_stdout(const uint8_t *data, uint32_t len)
|
||||
{
|
||||
while (len) {
|
||||
uint32_t cnt = CDCACM_PACKET_SIZE;
|
||||
if (cnt > len)
|
||||
cnt = len;
|
||||
nvic_disable_irq(USBUART_IRQ);
|
||||
cnt = usbd_ep_write_packet(usbdev, CDCACM_UART_ENDPOINT, data, cnt);
|
||||
nvic_enable_irq(USBUART_IRQ);
|
||||
data += cnt;
|
||||
len -= cnt;
|
||||
}
|
||||
}
|
||||
|
||||
void usbuart_set_line_coding(struct usb_cdc_line_coding *coding)
|
||||
{
|
||||
uart_set_baudrate(USBUART, coding->dwDTERate);
|
||||
|
|
Loading…
Reference in New Issue