Skip to content

Commit

Permalink
platforms/traceswoasync: Add shims for _get_baudrate()
Browse files Browse the repository at this point in the history
* command.c sees "platform.h" and SWO_UART/TRACEUART macros
  but not usart_get_baudrate() of <libopencm3/stm32/usart.h>
* traceswoasync.c also sees "platform.h" and usart.h, so
  create visible small helpers which resolve to correct function
  • Loading branch information
ALTracer committed Aug 22, 2024
1 parent 5869556 commit c6dd594
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/platforms/common/stm32/traceswoasync.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ void trace_buf_drain(usbd_device *dev, uint8_t ep)
atomic_flag_clear_explicit(&reentry_flag, memory_order_relaxed);
}

uint32_t traceswo_get_baudrate(void)
{
return usart_get_baudrate(SWO_UART);
}

void traceswo_setspeed(uint32_t baudrate)
{
dma_disable_channel(SWO_DMA_BUS, SWO_DMA_CHAN);
Expand Down
5 changes: 5 additions & 0 deletions src/platforms/common/stm32/traceswoasync_f723.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ void trace_buf_drain(usbd_device *dev, uint8_t ep)
atomic_flag_clear_explicit(&reentry_flag, memory_order_relaxed);
}

uint32_t traceswo_get_baudrate(void)
{
return usart_get_baudrate(SWO_UART);
}

void traceswo_setspeed(uint32_t baudrate)
{
dma_disable_stream(SWO_DMA_BUS, SWO_DMA_STREAM);
Expand Down
5 changes: 5 additions & 0 deletions src/platforms/common/tm4c/traceswo.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ void traceswo_baud(unsigned int baud)
uart_set_databits(TRACEUART, 8);
}

uint32_t traceswo_get_baudrate(void)
{
return uart_get_baudrate(TRACEUART);
}

#define FIFO_SIZE 256U

/* RX Fifo buffer */
Expand Down
1 change: 1 addition & 0 deletions src/platforms/common/traceswo.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define SWO_DEFAULT_BAUD 2250000U
void traceswo_init(uint32_t baudrate, uint32_t swo_chan_bitmask);
void traceswo_deinit(void);
uint32_t traceswo_get_baudrate(void);
#else
void traceswo_init(uint32_t swo_chan_bitmask);
#endif
Expand Down

0 comments on commit c6dd594

Please sign in to comment.