/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ #include #include #include "../../../libsys/uart.h" #include "../../../libsys/irq.h" #include "../../../libsys/uart.h" const uart_if_t uart_if[] = { {(uint32_t*)SYS_UART0_STAT, (uint32_t*)SYS_UART0_DATA, (uint32_t*)SYS_UART0_BAUD}, {(uint32_t*)SYS_UART1_STAT, (uint32_t*)SYS_UART1_DATA, (uint32_t*)SYS_UART1_BAUD} }; void _dbg_writechar(uart_if_t const *pUart, char c) { UART_writechar(pUart, c); } char _dbg_readchar(uart_if_t const *pUart) { int c; // busy read do { c = UART_readchar(pUart); } while(c < 0); return (char)c; } void dbg_putchar(char c) { if (c == 0x0A) { _dbg_writechar(&uart_if[UART_DEBUGGER], 0x0D); } _dbg_writechar(&uart_if[UART_DEBUGGER], c); } char dbg_getchar() { return (char)_dbg_readchar(&uart_if[UART_DEBUGGER]); } uint32_t getBootOffset(uint32_t sel) { return 0x100000 *(1+sel); } void board_init(void) { volatile uint32_t *pBaud = (uint32_t)SYS_UART_BAUD; *pBaud = UART_CALC_BAUD(460800); }