summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/mrm332/console/sci.c
diff options
context:
space:
mode:
authorJames Fitzsimons <james.fitzsimons@gmail.com>2014-03-24 22:32:10 +1300
committerGedare Bloom <gedare@rtems.org>2014-03-26 11:32:52 -0400
commit89aa1ec87da68b8a6cff2233552a739173e676a4 (patch)
tree5127f83e144564b4a21250775cb3c93fbdc69628 /c/src/lib/libbsp/m68k/mrm332/console/sci.c
parenttests: Produce proper begin/end messages (diff)
downloadrtems-89aa1ec87da68b8a6cff2233552a739173e676a4.tar.bz2
m68k/mrm332: changes required to get the mrm332 bsp working again.
Changed console driver to use interrupts instead of polling. Change to avoid overwriting CPU32Bug interrupt vector when setting up the Sci interrupt handler. Fixed type for boolean flag in bsp.h. Changed mrm332.h to use 25Mhz clock. Fixes to mrm332.cfg to use correct mcpu32 value for RTEMS_CPU_MODEL instead of m68332 which is no longer supported. Added -mcpu=cpu32 to compiler options. Removed broken ROM linker script and replaced broken RAM linker script with working ROM linker script. Removed no longer required file except_vect_332_ROM.S. Enabled 0xbeefbeef magic string in start.S to allow MRM version of CPU32Bug to auto run RTEMS. Removed old code from start.S Changed compiler optimization flag to optimize for size.
Diffstat (limited to 'c/src/lib/libbsp/m68k/mrm332/console/sci.c')
-rw-r--r--c/src/lib/libbsp/m68k/mrm332/console/sci.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/c/src/lib/libbsp/m68k/mrm332/console/sci.c b/c/src/lib/libbsp/m68k/mrm332/console/sci.c
index 4b67c33f5b..a671fb0f6b 100644
--- a/c/src/lib/libbsp/m68k/mrm332/console/sci.c
+++ b/c/src/lib/libbsp/m68k/mrm332/console/sci.c
@@ -351,8 +351,8 @@ rtems_isr SciIsr( rtems_vector_number vector )
if ( (*SCSR) & SCI_ERROR_OVERRUN ) SciErrorsOverrun ++;
/* see if it was a transmit interrupt */
-
- if ( (*SCSR) & SCI_XMTR_AVAILABLE ) /* data reg empty, xmt complete */
+ /* data reg empty, xmt complete */
+ if ( ( *SCCR1 & SCI_ENABLE_INT_TX ) && ( (*SCSR) & SCI_XMTR_AVAILABLE ) )
{
SciDisableTransmitInterrupts();
@@ -554,12 +554,17 @@ int SciInterruptOpen(
SciSetDataBits(SCI_8_DATA_BITS); /* set data bits to 8 */
- /* Install our interrupt handler into RTEMS, where does 66 come from? */
+ /* Install our interrupt handler into RTEMS. */
+ /* 68 is an unused user-defined vector. Note that the vector must be */
+ /* even - it sets the low bit for SPI interrupts, and clears it for */
+ /* SCI interrupts. Also note that vector 66 is used by CPU32bug on */
+ /* the mrm332. */
- rtems_interrupt_catch( SciIsr, 66, &old_vector );
+ rtems_interrupt_catch( SciIsr, 68, &old_vector );
- *QIVR = 66;
- *QIVR &= 0xf8;
+ *QSMCR = (*QSMCR & ~IARB) | 1; // Is 1 a good value for qsm iarb?
+ *QIVR = 68;
+ *QILR &= 0xf8;
*QILR |= 0x06 & 0x07;
SciEnableTransmitter(); /* enable the transmitter */
@@ -1382,7 +1387,7 @@ void SciWriteCharWait(uint8_t c)
{
/* poll the fifo, waiting for room for another character */
- while ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
+ while ( ( *SCSR & SCI_XMTR_AVAILABLE ) != SCI_XMTR_AVAILABLE )
{
/* Either we are writing to the fifo faster than
* the uart can clock bytes out onto the cable,