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