терминал UART драйвер без включенного прерывания
void TerminalInit_polledio(int term_num)
{
int BAUD_RATE = 9600;
int divisor = 115200 / BAUD_RATE;
// first setup our vars
terminals[term_num].echo_mode = TRUE;
terminals[term_num].missed_intr = TRUE;
// Use a pair of sems. One limits available space in the output queue
// (terminal display), the other limits chars that are typed from the
// terminal. As part of initialization, the count of the output queue
// is set to the capacity of the char queue
// terminals[term_num].out_sid = SemInit(CHAR_Q_SIZE);
// a circular q, capacity CHAR_Q_SIZE
// terminals[term_num].in_sid = SemInit(0);
InitCharQ(&terminals[term_num].in_q); // initially empty
InitCharQ(&terminals[term_num].out_q); // initially empty
InitCharQ(&terminals[term_num].echo_q); // initially empty
// then setup the terminal for 7-E-1 at 9600 baud
// abbrevs:
// CFCR Char Format Control Reg, MSR Modem Status Reg, IIR Intr Indicator Reg
// MCR Modem Control Reg, IER Intr Enable Reg, LSR Line Status Reg
// ERXRDY Enable Recv Ready, ETXRDY Enable Xmit Ready
// LSR_TSRE Line Status Reg Xmit+Shift Regs Empty
outportb(terminals[term_num].io_base + CFCR, CFCR_DLAB); // CFCR_DLAB is 0x80
outportb(terminals[term_num].io_base + BAUDLO,LOBYTE(divisor));
outportb(terminals[term_num].io_base + BAUDHI,HIBYTE(divisor));
outportb(terminals[term_num].io_base + CFCR,CFCR_8BITS ); //8-N-1
outportb(terminals[term_num].io_base + IER,0);
// raise DTR & RTS of the serial port to start read/write
outportb(terminals[term_num].io_base + MCR, MCR_DTR | MCR_RTS | MCR_IENABLE);
outportb(terminals[term_num].io_base + IER,0);
//IO_DELAY();
//outportb(terminals[term_num].io_base + IER, IER_ERXRDY | IER_ETXRDY);
//IO_DELAY();
//FIFO stuff
outportb(terminals[term_num].io_base + FIFO, FIFO_ENABLE | FIFO_TRIGGER_8);
outportb(terminals[term_num].io_base + FIFO, FIFO_RCV_RESET | FIFO_XMT_RESET);
}
u8 get_serial_char_polledio() {
u8 status;
//printf("=>");
while(!(inportb(terminals[FT_TERM].io_base + LSR) & LSR_RXRDY)){
//cons_printf("%2.0x_",status);
}
return (inportb(terminals[FT_TERM].io_base + DATA) & 0x7F);
}
void put_serial_char_polledio(u8 ch) {
char status = inportb(terminals[FT_TERM].io_base + LSR) & LSR_TXRDY ;
while(!status) {
//cons_printf(" <%2.0x_%c> ",status,ch);
}
outportb(terminals[FT_TERM].io_base + DATA, ch);
inportb(terminals[FT_TERM].io_base + LSR) & LSR_TXRDY ;
// cons_printf(" <%2.0x_%c> ",status,ch);
}
void uart_out(){
char ch = 'A';
while(1){
put_serial_char_polledio(ch);
//printf("%c ",get_serial_char_polledio());
}
}
uart_out () - это метод, который отправляется и запускается как процесс в моей операционной системе, но после однократной установки или передачи символа A процесс останавливается и больше символов не выводится. я что-то пропустил?