Skip to content
Snippets Groups Projects
Commit 023d33a1 authored by Jedian Marcos Brambilla's avatar Jedian Marcos Brambilla
Browse files

Overrun sinalizado, falta fazer o nrx ser o rxnum e iniciar os testes de verdade

parent ecb1da7c
Branches
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ extCounter:
# interrupt handler for UART attached to IP6=HW4
# for UART's address see vhdl/packageMemory.vhd
#
.global Ud, _uart_buff
.global Ud, _uart_buff, proberxs
.bss
.align 2
Ud:
......@@ -83,6 +83,12 @@ tx_q: .space 16 # transmission queue and pointers
nrx: .space 4 # characters in RX_queue
ntx: .space 4 # spaces left in TX_queue
proberxs:
framing:.space 1
overun: .space 1
ign22: .space 22
rxnum: .space 8
_uart_buff: .space 16*4 # up to 16 registers to be saved here
.set UART_rx_irq,0x08
......
......@@ -47,4 +47,13 @@ typedef struct serial {
TctlStat cs; // @ (int *)IO_UART_ADDR
Tdata d; // @ (int *)(IO_UART_ADDR+1)
} Tserial;
typedef struct proberx {
unsigned int
framing : 1, // framing error
overun : 1, // overrun
ign22 : 22, // padding
rxnum : 8; // até 255 caracteres na fila (são <= 16)
} Tproberx;
#endif
......@@ -106,8 +106,18 @@ UARTrxinter:
nop
overrun:
jal print
li $a0, 64017
lui $5, %hi(proberxs)
ori $5, $5, %lo(proberxs)
lw $7, 0($5)
nop
la $6, 0x40000000
or $6, $6, $7
sw $6, 0($5)
nop
#jal print
#move $a0, $6
# move $a0, $7
# do something if rx queue is full or tx is empty
# set overrun bit on uart statusReg
......
......@@ -5,6 +5,8 @@
#define MAXPOW 7
extern UARTdriver Ud ;
extern Tproberx proberxs ;
volatile Tserial *uart; // tell GCC not to optimize away code
int proberx () {
......@@ -142,13 +144,18 @@ int main(void) { // receive a string through the UART serial interface
uart = (void *)IO_UART_ADDR; // bottom of UART address range
Ud.ntx = 16; // initializing number of empty spaces in tx queue
ioctl(ctrl_util(2, 1, 1, 1)); // Speed = 2, intRX = 1, intTX = 1, rts = 1
ioctl(ctrl_util(1, 1, 1, 1)); // Speed = 2, intRX = 1, intTX = 1, rts = 1
do {
state++; // state is a volatile variable just for optimize blocking
while(!proberx()) to_stdout('-'); // wait until first reception
if(proberxs.overun){
to_stdout('e');
to_stdout('r');
to_stdout('r');
to_stdout('\0');
return state;
}
while((c=Getc()) != -1){ // dump the reception queue to the big queue
filona[tlona] = c;
tlona++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment