Browse Source

usbuart: Begun refactoring the physical UART code to seperate out the mixed interests

fix/newlib-file-io-hooks
dragonmux 2 years ago
parent
commit
3e1985e961
No known key found for this signature in database GPG Key ID: 64861EA89B35507A
  1. 2
      src/platforms/96b_carbon/platform.c
  2. 2
      src/platforms/blackpillv2/platform.c
  3. 2
      src/platforms/common/usbuart.h
  4. 2
      src/platforms/f072/platform.c
  5. 2
      src/platforms/f3/platform.c
  6. 2
      src/platforms/f4discovery/platform.c
  7. 2
      src/platforms/hydrabus/platform.c
  8. 2
      src/platforms/launchpad-icdi/platform.c
  9. 2
      src/platforms/native/platform.c
  10. 4
      src/platforms/stlink/platform.c
  11. 2
      src/platforms/stm32/usbuart.c
  12. 2
      src/platforms/swlink/platform.c
  13. 6
      src/platforms/tm4c/usbuart.c

2
src/platforms/96b_carbon/platform.c

@ -69,7 +69,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
} }
void platform_nrst_set_val(bool assert) void platform_nrst_set_val(bool assert)

2
src/platforms/blackpillv2/platform.c

@ -108,7 +108,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
// https://github.com/libopencm3/libopencm3/pull/1256#issuecomment-779424001 // https://github.com/libopencm3/libopencm3/pull/1256#issuecomment-779424001
OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS | OTG_GCCFG_PWRDWN; OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS | OTG_GCCFG_PWRDWN;

2
src/platforms/common/usbuart.h

@ -23,7 +23,7 @@
#include <libopencm3/usb/usbd.h> #include <libopencm3/usb/usbd.h>
#include <libopencm3/usb/cdc.h> #include <libopencm3/usb/cdc.h>
void usbuart_init(void); void aux_serial_init(void);
void usbuart_set_line_coding(struct usb_cdc_line_coding *coding); void usbuart_set_line_coding(struct usb_cdc_line_coding *coding);
void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep); void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep);

2
src/platforms/f072/platform.c

@ -85,7 +85,7 @@ void platform_init(void)
GPIO_OSPEED_2MHZ, NRST_PIN); GPIO_OSPEED_2MHZ, NRST_PIN);
platform_timing_init(); platform_timing_init();
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
} }
void platform_nrst_set_val(bool assert) void platform_nrst_set_val(bool assert)

2
src/platforms/f3/platform.c

@ -89,7 +89,7 @@ void platform_init(void)
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12); gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12);
gpio_set_af(GPIOA, GPIO_AF14, GPIO11 | GPIO12); gpio_set_af(GPIOA, GPIO_AF14, GPIO11 | GPIO12);
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
} }
void platform_nrst_set_val(bool assert) void platform_nrst_set_val(bool assert)

2
src/platforms/f4discovery/platform.c

@ -107,7 +107,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
} }
void platform_nrst_set_val(bool assert) { (void)assert; } void platform_nrst_set_val(bool assert) { (void)assert; }

2
src/platforms/hydrabus/platform.c

@ -77,7 +77,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
} }
void platform_nrst_set_val(bool assert) { (void)assert; } void platform_nrst_set_val(bool assert) { (void)assert; }

2
src/platforms/launchpad-icdi/platform.c

@ -82,7 +82,7 @@ void platform_init(void)
__asm__("nop"); __asm__("nop"); __asm__("nop"); __asm__("nop"); __asm__("nop"); __asm__("nop");
gpio_mode_setup(GPIOD_BASE, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO4|GPIO5); gpio_mode_setup(GPIOD_BASE, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO4|GPIO5);
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
usb_enable_interrupts(USB_INT_RESET | USB_INT_DISCON | usb_enable_interrupts(USB_INT_RESET | USB_INT_DISCON |
USB_INT_RESUME | USB_INT_SUSPEND, 0xff, 0xff); USB_INT_RESUME | USB_INT_SUSPEND, 0xff, 0xff);

2
src/platforms/native/platform.c

@ -221,7 +221,7 @@ void platform_init(void)
/* On hardware version 1 and 2, UART and SWD share connector pins. /* On hardware version 1 and 2, UART and SWD share connector pins.
* Don't enable UART if we're being debugged. */ * Don't enable UART if we're being debugged. */
if (platform_hwversion() == 0 || platform_hwversion() >= 3 || !(SCS_DEMCR & SCS_DEMCR_TRCENA)) if (platform_hwversion() == 0 || platform_hwversion() >= 3 || !(SCS_DEMCR & SCS_DEMCR_TRCENA))
usbuart_init(); aux_serial_init();
setup_vbus_irq(); setup_vbus_irq();
} }

4
src/platforms/stlink/platform.c

@ -89,8 +89,8 @@ void platform_init(void)
/* Don't enable UART if we're being debugged. */ /* Don't enable UART if we're being debugged. */
if (!(SCS_DEMCR & SCS_DEMCR_TRCENA)) if (!(SCS_DEMCR & SCS_DEMCR_TRCENA))
usbuart_init(); aux_serial_init();
adc_init(); adc_init();
} }
void platform_nrst_set_val(bool assert) void platform_nrst_set_val(bool assert)

2
src/platforms/stm32/usbuart.c

@ -105,7 +105,7 @@ static void usbuart_set_led_state(uint8_t ledn, bool state)
} }
} }
void usbuart_init(void) void aux_serial_init(void)
{ {
/* Enable clocks */ /* Enable clocks */
rcc_periph_clock_enable(USBUSART_CLK); rcc_periph_clock_enable(USBUSART_CLK);

2
src/platforms/swlink/platform.c

@ -110,7 +110,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
blackmagic_usb_init(); blackmagic_usb_init();
usbuart_init(); aux_serial_init();
} }
void platform_nrst_set_val(bool assert) void platform_nrst_set_val(bool assert)

6
src/platforms/tm4c/usbuart.c

@ -39,12 +39,14 @@ static uint8_t buf_rx_in;
/* Fifo out pointer, writes assumed to be atomic, should be only incremented outside RX ISR */ /* Fifo out pointer, writes assumed to be atomic, should be only incremented outside RX ISR */
static uint8_t buf_rx_out; static uint8_t buf_rx_out;
void usbuart_init(void) void aux_serial_init(void)
{ {
UART_PIN_SETUP(); UART_PIN_SETUP();
periph_clock_enable(USBUART_CLK); periph_clock_enable(USBUART_CLK);
__asm__("nop"); __asm__("nop"); __asm__("nop"); __asm__("nop");
__asm__("nop");
__asm__("nop");
uart_disable(USBUART); uart_disable(USBUART);

Loading…
Cancel
Save