11 #include <drivers/uart/adi_uart.h> 12 #include <retarget_uart_config.h> 16 #define ADI_UART_MEMORY_SIZE (ADI_UART_BIDIR_MEMORY_SIZE) 18 #define UART_DEVICE_NUM 0 24 static uint8_t UartDeviceMem[ADI_UART_MEMORY_SIZE];
26 bool Init_Uart(
void) {
27 #if ADI_UART_SETUP_PINMUX 28 static bool pinmux_done =
false;
32 uint32_t gpio0_cfg = *pREG_GPIO0_CFG;
33 gpio0_cfg &= ~(BITM_GPIO_CFG_PIN10 | BITM_GPIO_CFG_PIN11);
34 gpio0_cfg |= (1u << BITP_GPIO_CFG_PIN10) | (1u << BITP_GPIO_CFG_PIN11);
35 *pREG_GPIO0_CFG = gpio0_cfg;
40 if (hDevice == NULL) {
54 void Uninit_Uart(
void) {
60 static int write_to_uart(
int ch) {
69 int stdout_putchar(
int ch) {
70 return write_to_uart(ch);
73 int stderr_putchar(
int ch) {
74 return write_to_uart(ch);
77 int stdin_getchar(
void) {
82 return write_to_uart(ch);
85 void _sys_exit(
int exit_value) {
86 #if ADI_UART_EXIT_BREAKPOINT
ADI_UART_RESULT adi_uart_Close(ADI_UART_HANDLE const hDevice)
Uninitialize the memory for the specified UART instance.
ADI_UART_RESULT adi_uart_Write(ADI_UART_HANDLE const hDevice, void *const pBuffer, uint32_t const nBufSize, bool const bDMA, uint32_t *pHwError)
Submit the buffer for transmitting the data in ADI_UART_DATA_TRANSFER_MODE_BLOCKING. Call to this function will not return until the entire buffer is transmitted. Returns error if this function is called when device is operating in ADI_UART_DATA_TRANSFER_MODE_NONBLOCKING. i.e Function "adi_uart_SubmitTxBuffer()" is called and the transfer is not yet complete.
struct _ADI_UART_DEVICE * ADI_UART_HANDLE
ADI_UART_RESULT adi_uart_Open(uint32_t const nDeviceNum, ADI_UART_DIRECTION const eDirection, void *pMemory, uint32_t const nMemSize, ADI_UART_HANDLE *const phDevice)
Initialization function for the UART device.