libchip/serial/ns16550.c: Transmit the character in the polled write

function within a critical section for printk() compatibility.
This commit is contained in:
Thomas Doerfler
2008-11-18 11:28:53 +00:00
parent 2fafea29f9
commit d65b2da6cf
2 changed files with 33 additions and 33 deletions

View File

@@ -1,3 +1,8 @@
2008-11-13 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libchip/serial/ns16550.c: Transmit the character in the polled write
function within a critical section for printk() compatibility.
2008-09-10 Ralf Corsépius <ralf.corsepius@rtems.org> 2008-09-10 Ralf Corsépius <ralf.corsepius@rtems.org>
* aclocal/prog-cc.m4: Remove pre-production testing CFLAGS. * aclocal/prog-cc.m4: Remove pre-production testing CFLAGS.

View File

@@ -183,44 +183,39 @@ NS16550_STATIC int ns16550_close(
return(RTEMS_SUCCESSFUL); return(RTEMS_SUCCESSFUL);
} }
/* /**
* ns16550_write_polled * @brief Polled write for NS16550.
*/ */
NS16550_STATIC void ns16550_write_polled( int minor, char c)
NS16550_STATIC void ns16550_write_polled(
int minor,
char cChar
)
{ {
uint32_t pNS16550; uint32_t port = Console_Port_Tbl [minor].ulCtrlPort1;
unsigned char ucLineStatus; getRegister_f get = Console_Port_Tbl [minor].getRegister;
getRegister_f getReg; setRegister_f set = Console_Port_Tbl [minor].setRegister;
setRegister_f setReg; uint32_t status;
rtems_interrupt_level level;
pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; while (1) {
getReg = Console_Port_Tbl[minor].getRegister; /* Try to transmit the character in a critical section */
setReg = Console_Port_Tbl[minor].setRegister; rtems_interrupt_disable( level);
/* /* Read the transmitter holding register and check it */
* wait for transmitter holding register to be empty status = get( port, NS16550_LINE_STATUS);
*/ if ((status & SP_LSR_THOLD) != 0) {
ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS); /* Transmit character */
while ((ucLineStatus & SP_LSR_THOLD) == 0) { set( port, NS16550_TRANSMIT_BUFFER, c);
/*
* Yield while we wait /* Finished */
*/ rtems_interrupt_enable( level);
#if 0 break;
if(_System_state_Is_up(_System_state_Get())) { } else {
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); rtems_interrupt_enable( level);
}
#endif
ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS);
} }
/* /* Wait for transmitter holding register to be empty */
* transmit character do {
*/ status = get( port, NS16550_LINE_STATUS);
(*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, cChar); } while ((status & SP_LSR_THOLD) == 0);
}
} }
/* /*