forked from Imagelibrary/rtems
libchip/serial/ns16550.c: Transmit the character in the polled write
function within a critical section for printk() compatibility.
This commit is contained in:
@@ -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-10-02 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2008-10-02 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
* libchip/i2c/spi-sd-card.c: Update for status-checks.h changes.
|
* libchip/i2c/spi-sd-card.c: Update for status-checks.h changes.
|
||||||
|
|||||||
@@ -196,44 +196,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user