From 4f66bc896f3a92e1cb644e0f8488af8864e385a5 Mon Sep 17 00:00:00 2001 From: VytorCalixto <vytorcalixto@gmail.com> Date: Mon, 18 May 2015 15:05:22 -0300 Subject: [PATCH] Adicionado arquivo handlerUART.s --- cMIPS/include/handlers.s | 12 ++++++------ cMIPS/tests/handlerUART.s | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 cMIPS/tests/handlerUART.s diff --git a/cMIPS/include/handlers.s b/cMIPS/include/handlers.s index b063e41..9924160 100644 --- a/cMIPS/include/handlers.s +++ b/cMIPS/include/handlers.s @@ -68,7 +68,7 @@ extCounter: # interrupt handler for UART attached to IP6=HW4 .bss - .align 2 + .align 2 .global rx_queue,rx_hd,rx_tl # reception queue and pointers .comm rx_queue 16 .comm rx_hd 4 @@ -80,7 +80,7 @@ extCounter: .global nrx,ntx .comm nrx 4 # characters in RX_queue .comm ntx 4 # spaces left in TX_queue - .comm _uart_buff 16*4 # up to 16 registers to be saved here + .comm _uart_buff 16*4 # up to 16 registers to be saved here .set UART_rx_irq,0x08 .set UART_tx_irq,0x10 @@ -108,11 +108,11 @@ UARTinterr: #---------------------------------- # while you are developing the complete handler, # uncomment the line below and comment out lines up to UARTret - # .include "../tests/handlerUART.s" + .include "../tests/handlerUART.s" #---------------------------------- - andi $a0, $k1, UART_rx_irq # Is this reception? - beq $a0, $zero, UARTret # no, ignore it and return + # andi $a0, $k1, UART_rx_irq # Is this reception? + # beq $a0, $zero, UARTret # no, ignore it and return lui $a0, %hi(HW_uart_addr) ori $a0, $a0, %lo(HW_uart_addr) @@ -201,4 +201,4 @@ cmips_delay: nop .end cmips_delay #---------------------------------------------------------------- - \ No newline at end of file + diff --git a/cMIPS/tests/handlerUART.s b/cMIPS/tests/handlerUART.s new file mode 100644 index 0000000..4cd0d8c --- /dev/null +++ b/cMIPS/tests/handlerUART.s @@ -0,0 +1,15 @@ + #-------------------------------------------------------------------------- + # interrupt handler for UART +RX: + andi $a0, $k1, UART_rx_irq # Is this reception? + beq $a0, $zero, TX # no, test if it's transmission + nop + # TODO: Read data, store it to buffer and decrement nrx (we're reading a char) +TX: + andi $a0, $k1, UART_tx_irq # Is this transmission? + beq $a0, $zero, END # no, end handler + nop + # TODO: Increment ntx (we're sending a char) + +END: + -- GitLab