summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2015-12-07 16:59:35 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2016-10-02 11:31:18 +0200
commitd830414e6944549343365d23d9783704833e6a5a (patch)
treed31cdd113689bb145de061bb47b0cb27034019ba
parentbsp/tms570: update pinmux to provide support for initialization lists and cle... (diff)
downloadrtems-d830414e6944549343365d23d9783704833e6a5a.tar.bz2
bsp/tms570: include complete peripheral initialization to SCI driver.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
-rw-r--r--c/src/lib/libbsp/arm/tms570/console/tms570-sci.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c b/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
index fac258d3b2..4464859dc0 100644
--- a/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
+++ b/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
@@ -95,6 +95,40 @@ rtems_device_driver console_initialize(
++minor
) {
tms570_sci_context *ctx = &driver_context_table[minor];
+ uint32_t rx_pin = 1 << 1;
+ uint32_t tx_pin = 1 << 2;
+
+ /* Resec SCI peripheral */
+ ctx->regs->GCR0 = TMS570_SCI_GCR0_RESET * 0;
+ ctx->regs->GCR0 = TMS570_SCI_GCR0_RESET * 1;
+
+ /* Clear all interrupt sources */
+ ctx->regs->CLEARINT = 0xffffffff;
+
+ /* Map all interrupts to SCI INT0 line */
+ ctx->regs->CLEARINTLVL = 0xffffffff;
+
+ ctx->regs->GCR1 = TMS570_SCI_GCR1_TXENA * 0 |
+ TMS570_SCI_GCR1_RXENA * 0 |
+ TMS570_SCI_GCR1_CONT * 0 | /* continue operation when debugged */
+ TMS570_SCI_GCR1_LOOP_BACK * 0 |
+ TMS570_SCI_GCR1_POWERDOWN * 0 |
+ TMS570_SCI_GCR1_SLEEP * 0 |
+ TMS570_SCI_GCR1_SWnRST * 0 | /* reset state */
+ TMS570_SCI_GCR1_CLOCK * 1 | /* internal clock */
+ TMS570_SCI_GCR1_TIMING_MODE * 1 |
+ TMS570_SCI_GCR1_COMM_MODE * 0;
+
+ /* Setup connection of SCI peripheral Rx and Tx pins */
+ ctx->regs->PIO0 = rx_pin * 1 | tx_pin * 1; /* Rx and Tx pins are not GPIO */
+ ctx->regs->PIO3 = rx_pin * 0 | tx_pin * 0; /* Default output low */
+ ctx->regs->PIO1 = rx_pin * 0 | tx_pin * 0; /* Input when not used by SCI */
+ ctx->regs->PIO6 = rx_pin * 0 | tx_pin * 0; /* No open drain */
+ ctx->regs->PIO7 = rx_pin * 0 | tx_pin * 0; /* Pull-up/down enabled */
+ ctx->regs->PIO8 = rx_pin * 1 | tx_pin * 1; /* Select pull-up */
+
+ /* Bring device out of software reset */
+ ctx->regs->GCR1 |= TMS570_SCI_GCR1_SWnRST;
/*
* Install this device in the file system and Termios. In order
@@ -107,7 +141,7 @@ rtems_device_driver console_initialize(
major,
minor,
handler,
- NULL,
+ NULL,
&ctx->base
);
if ( sc != RTEMS_SUCCESSFUL ) {
@@ -473,7 +507,7 @@ static bool tms570_sci_interrupt_first_open(
if ( ret == false ) {
return false;
}
- ctx->regs->SETINTLVL = 0;
+
/* Register Interrupt handler */
sc = rtems_interrupt_handler_install(ctx->irq,
ctx->device_name,