X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=ROM2%2Fcomm.c;h=c3743476efa6ec731b46e1949296b632af6ff783;hb=91c2cae2d1a21bbff2dc3e4a7bec4f6e7baa7a2d;hp=09ad2a16c89c9015d0a309019b874718ee7f4517;hpb=2e7a8beb908896930042bc0564fbd16f3e0b0b62;p=uccvend-snackrom.git diff --git a/ROM2/comm.c b/ROM2/comm.c index 09ad2a1..c374347 100644 --- a/ROM2/comm.c +++ b/ROM2/comm.c @@ -40,7 +40,7 @@ u8 uart_init() { _uart_regs[UART_INT_ENABLE] = IE_RECEIVER_READY | IE_TRANSMITTER_READY | IE_LINE_STATUS_CHANGE; - /* Use the FIFO and empty them */ + /* Enable the FIFO and empty them */ _uart_regs[UART_FIFO_CTL] = FIFO_ENABLE | FIFO_RX_CLEAR | FIFO_TX_CLEAR | FIFO_LVL_1; @@ -143,6 +143,22 @@ void uart_interrupt() { * End of interrupt handler */ +void send_ack() { + wait_for_tx_free(); + tx_buffer[0] = '!'; + tx_buffer[1] = '\n'; + tx_buffer[2] = 0; + send_packet(); +} + +void send_nack() { + wait_for_tx_free(); + tx_buffer[0] = '?'; + tx_buffer[1] = '\n'; + tx_buffer[2] = 0; + send_packet(); +} + /* sends the packet in tx_buffer and doesn't return until it's been sent */ void send_packet() { bset((void*)&tx_queue_state, 0x01);