2011-03-03 Joel Sherrill <joel.sherrilL@OARcorp.com>

PR 1750/bsps
	* console/erc32_console.c, make/custom/erc32.cfg: The new console
	driver did not support polled mode. It also had a bug in which it
	could lose a transmitter interrupt.
This commit is contained in:
Joel Sherrill
2011-03-03 14:03:41 +00:00
parent 8a5d6ac18c
commit f787428f33
2 changed files with 163 additions and 156 deletions

View File

@@ -1,3 +1,10 @@
2011-03-03 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1750/bsps
* console/erc32_console.c, make/custom/erc32.cfg: The new console
driver did not support polled mode. It also had a bug in which it
could lose a transmitter interrupt.
2011-02-28 Joel Sherrill <joel.sherrill@oarcorp.com>
* console/erc32_console.c: Add polled support. Tinker with interrupt

View File

@@ -49,11 +49,11 @@ static void erc32_console_set_register(uint32_t addr, uint8_t i, uint8_t val)
static int erc32_console_first_open(int major, int minor, void *arg);
#if (CONSOLE_USE_INTERRUPTS)
static ssize_t erc32_console_write_support_int(
static ssize_t erc32_console_write_support_int(
int minor, const char *buf, size_t len);
#else
int console_inbyte_nonblocking( int port );
static ssize_t erc32_console_write_support_polled(
int console_inbyte_nonblocking( int port );
static ssize_t erc32_console_write_support_polled(
int minor, const char *buf, size_t len);
#endif
static void erc32_console_initialize(int minor);
@@ -159,12 +159,14 @@ static ssize_t erc32_console_write_support_int(int minor, const char *buf, size_
int k = 0;
if (minor == 0) { /* uart a */
for (k = 0; k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA); k ++) {
for (k = 0;
k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA); k ++) {
ERC32_MEC.UART_Channel_A = (unsigned char)buf[k];
}
ERC32_Force_interrupt(ERC32_INTERRUPT_UART_A_RX_TX);
} else { /* uart b */
for (k = 0; k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB); k ++) {
for (k = 0;
k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB); k ++) {
ERC32_MEC.UART_Channel_B = (unsigned char)buf[k];
}
ERC32_Force_interrupt(ERC32_INTERRUPT_UART_B_RX_TX);
@@ -198,24 +200,23 @@ static void erc32_console_isr_a(
/* enqueue received chars */
while (i < CONSOLE_BUF_SIZE) {
if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRA) {
if (!(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRA))
break;
buf[i] = ERC32_MEC.UART_Channel_A;
++i;
} else {
break;
}
}
if ( i )
rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
/* dequeue transmitted chars */
cd->pDeviceContext = 0;
if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) {
rv = rtems_termios_dequeue_characters(
cd->termios_data, chars_to_dequeue);
if ( !rv ) {
cd->pDeviceContext = 0;
cd->bActive = false;
ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_A_RX_TX);
}
ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_A_RX_TX);
}
} while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_A_RX_TX));
}
@@ -240,24 +241,23 @@ static void erc32_console_isr_b(
/* enqueue received chars */
while (i < CONSOLE_BUF_SIZE) {
if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRB) {
if (!(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRB))
break;
buf[i] = ERC32_MEC.UART_Channel_B;
++i;
} else {
break;
}
}
if ( i )
rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
/* dequeue transmitted chars */
cd->pDeviceContext = 0;
if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) {
rv = rtems_termios_dequeue_characters(
cd->termios_data, chars_to_dequeue);
if ( !rv ) {
cd->pDeviceContext = 0;
cd->bActive = false;
ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_B_RX_TX);
}
ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_B_RX_TX);
}
} while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_B_RX_TX));
}
@@ -307,8 +307,8 @@ static void erc32_console_initialize(
/*
* Initialize Hardware
*/
#if (CONSOLE_USE_INTERRUPTS)
#if (CONSOLE_USE_INTERRUPTS)
set_vector(erc32_console_isr_a, CONSOLE_UART_A_TRAP, 1);
set_vector(erc32_console_isr_b, CONSOLE_UART_B_TRAP, 1);
#endif
#endif
}