17 #include <drivers/uart/adi_uart.h> 18 #include <retarget_uart_config.h> 22 #define ADI_UART_MEMORY_SIZE (ADI_UART_BIDIR_MEMORY_SIZE) 24 #define UART_DEVICE_NUM 0 30 static uint8_t UartDeviceMem[ADI_UART_MEMORY_SIZE];
32 bool Init_Uart(
void) {
33 #if ADI_UART_SETUP_PINMUX 34 static bool pinmux_done =
false;
38 uint32_t gpio0_cfg = *pREG_GPIO0_CFG;
39 gpio0_cfg &= ~(BITM_GPIO_CFG_PIN10 | BITM_GPIO_CFG_PIN11);
40 gpio0_cfg |= (1u << BITP_GPIO_CFG_PIN10) | (1u << BITP_GPIO_CFG_PIN11);
41 *pREG_GPIO0_CFG = gpio0_cfg;
46 if (hDevice == NULL) {
60 void Uninit_Uart(
void) {
66 static int write_to_uart(
int ch) {
75 int stdout_putchar(
int ch) {
76 return write_to_uart(ch);
79 int stderr_putchar(
int ch) {
80 return write_to_uart(ch);
83 int stdin_getchar(
void) {
88 return write_to_uart(ch);
91 void _sys_exit(
int exit_value) {
92 #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....
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.