Jasper van Woudenberg
09/13/2023, 1:35 AMJasper van Woudenberg
09/13/2023, 1:35 AMstatic uint8_t serial_send(uint8_t data) {
// Sends one character over the line and returns the status to the caller.
while (uart_txfull_read()); // Block until we have space
reg_uart_data = data;
return STATUS_OK;
}
static uint8_t serial_recv(uint8_t* data) {
// Receives 1 byte and stores it in the data argument. This function must be blocking.
// while (uart_rxempty_read()) {}; // Block until we have a character
uint32_t data32;
do {
data32 = reg_uart_data;
} while (data32 == 0xffffffff);
*data = data32 & 0xff; // Load character
return STATUS_OK;
}
Jasper van Woudenberg
09/13/2023, 1:35 AMprint("Hello RISCAsic!\n");
while (1) {
uint8_t recvStatus = serial_recv(&cmd);
serial_send(cmd);
}
Jasper van Woudenberg
09/13/2023, 1:36 AMJasper van Woudenberg
09/13/2023, 1:41 AM#define UART_EV_PEND (*(volatile uint32_t*) 0xf0005810)
#define UART_EV_RX 0x2
UART_EV_PEND = UART_EV_RX;
If I put that after my receive code, it works.Tim Edwards
09/13/2023, 1:49 AMMatt Venn
09/13/2023, 1:06 PM