diff --git a/cMIPS/tests/handlerUARTjedi2.s b/cMIPS/tests/handlerUARTjedi2.s index 2c9b6890757e4da8c8be6f742828d44534f078d5..ec4f00b10019483187cd265c12b3407f8ecdedc3 100644 --- a/cMIPS/tests/handlerUARTjedi2.s +++ b/cMIPS/tests/handlerUARTjedi2.s @@ -17,42 +17,41 @@ # Jedian: when a new char is on the UART's buffer, # i have to enqueue it and update nrx. - #ACHO QUE ELE NAO TA RESETANDO O INTERRUPTION REQUEST, AI FICA TRAVADAO # saving used registers on _uart_buff sw $5, 9*4($k0) sw $6, 10*4($k0) sw $7, 11*4($k0) # enqueue - lui $5, %hi(rx_hd) # get rx head address - ori $5, $5, %lo(rx_hd) + lui $5, %hi(rx_tl) # get rx tail address + ori $5, $5, %lo(rx_tl) lw $7, 0($5) + nop + addiu $7, $7, 1 # increment in 1 the tail of the circular queue + andi $7, $7, 0xf # % 16 + sw $7, 0($5) - #### stores on queue on head + #### stores on queue on tail lui $6, %hi(rx_q) # get queue address ori $6, $6, %lo(rx_q) - sll $7, $7, 2 # multiply by 4 addu $6, $7, $6 # calculate address to move new char lw $7, 2*4($k0) # get char to be stored nop - sw $7, 0($6) # and store it! + sb $7, 0($6) # and store it! - #### process rx_hd -- updates head - lw $7, 0($5) - nop - addiu $7, $7, 1 # increment in 1 the head of the circular queue - andi $7, $7, 0xf # % 16 - sw $7, 0($5) - -#FIZ TUDO ERRADO, ERA NO TAIL QUE EU TINHA QUE MUDAR, EXEMPLO NA APOSTILA PAG 142 + #### process rx_tl -- update tail + #lw $7, 0($5) + #nop # loading back used registers lw $5, 9*4($k0) lw $6, 10*4($k0) lw $7, 11*4($k0) + #Precisa coisar o nrx (incrementar) + #UARTinterr2: # andi $a1, $k1, UART_tx_irq # Is this transmission? # beq $a1, $zero, UARTret # no, ignore it and return