summaryrefslogtreecommitdiff
path: root/nuttx/arch/hc/src/m9s12
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-02-20 19:47:40 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-02-20 19:47:40 +0000
commit06fa41316a30d98aeda6a6016b5c139dbeaa34d6 (patch)
treec7548477e32b4cbe2c1017a0f4496de5f5099230 /nuttx/arch/hc/src/m9s12
parent78538c8d3257913599ea721b55b6ce56fd8988f3 (diff)
downloadpx4-nuttx-06fa41316a30d98aeda6a6016b5c139dbeaa34d6.tar.gz
px4-nuttx-06fa41316a30d98aeda6a6016b5c139dbeaa34d6.tar.bz2
px4-nuttx-06fa41316a30d98aeda6a6016b5c139dbeaa34d6.zip
Finish m9s12x interrupt logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3307 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/hc/src/m9s12')
-rw-r--r--nuttx/arch/hc/src/m9s12/m9s12_assert.c17
-rw-r--r--nuttx/arch/hc/src/m9s12/m9s12_initialstate.c8
-rwxr-xr-xnuttx/arch/hc/src/m9s12/m9s12_irq.c43
-rwxr-xr-xnuttx/arch/hc/src/m9s12/m9s12_serial.c24
-rwxr-xr-xnuttx/arch/hc/src/m9s12/m9s12_timerisr.c4
5 files changed, 17 insertions, 79 deletions
diff --git a/nuttx/arch/hc/src/m9s12/m9s12_assert.c b/nuttx/arch/hc/src/m9s12/m9s12_assert.c
index 7b167d183..97d18b64f 100644
--- a/nuttx/arch/hc/src/m9s12/m9s12_assert.c
+++ b/nuttx/arch/hc/src/m9s12/m9s12_assert.c
@@ -87,23 +87,6 @@
****************************************************************************/
/****************************************************************************
- * Name: up_getsp
- ****************************************************************************/
-
-/* I don't know if the builtin to get SP is enabled */
-
-static inline uint16_t up_getsp(void)
-{
- uint16_t spval;
- __asm__
- (
- "\tsts spval\n"
- : "=A"(spval) :
- );
- return spval;
-}
-
-/****************************************************************************
* Name: up_stackdump
****************************************************************************/
diff --git a/nuttx/arch/hc/src/m9s12/m9s12_initialstate.c b/nuttx/arch/hc/src/m9s12/m9s12_initialstate.c
index 7efe77942..c537546b1 100644
--- a/nuttx/arch/hc/src/m9s12/m9s12_initialstate.c
+++ b/nuttx/arch/hc/src/m9s12/m9s12_initialstate.c
@@ -113,9 +113,13 @@ void up_initial_state(_TCB *tcb)
*/
# ifdef CONFIG_SUPPRESS_INTERRUPTS
- xcp->regs[REG_CCR] = 0xd0; /* Disable STOP, Mask I- and Z- interrupts */
+ /* Disable STOP, Mask I- and Z- interrupts */
+
+ xcp->regs[REG_CCR] = HCS12_CCR_S|HCS12_CCR_X|HCS12_CCR_I;
# else
- xcp->regs[REG_CCR] = 0x80; /* Disable STOP, Enable I- and Z-interrupts */
+ /* Disable STOP, Enable I- and Z-interrupts */
+
+ xcp->regs[REG_CCR] = HCS12_CCR_S;
# endif
}
diff --git a/nuttx/arch/hc/src/m9s12/m9s12_irq.c b/nuttx/arch/hc/src/m9s12/m9s12_irq.c
index 20a86e1ef..1fb59d551 100755
--- a/nuttx/arch/hc/src/m9s12/m9s12_irq.c
+++ b/nuttx/arch/hc/src/m9s12/m9s12_irq.c
@@ -80,50 +80,7 @@ uint8_t *current_regs;
void up_irqinitialize(void)
{
- /* Disable all interrupts */
-#warning "Missing Logic"
-
/* currents_regs is non-NULL only while processing an interrupt */
current_regs = NULL;
-
-}
-
-/****************************************************************************
- * Name: up_disable_irq
- *
- * Description:
- * Disable the IRQ specified by 'irq'
- *
- ****************************************************************************/
-
-void up_disable_irq(int irq)
-{
-#warning "Missing Logic"
-}
-
-/****************************************************************************
- * Name: up_enable_irq
- *
- * Description:
- * Enable the IRQ specified by 'irq'
- *
- ****************************************************************************/
-
-void up_enable_irq(int irq)
-{
-#warning "Missing Logic"
-}
-
-/****************************************************************************
- * Name: up_maskack_irq
- *
- * Description:
- * Mask the IRQ and acknowledge it
- *
- ****************************************************************************/
-
-void up_maskack_irq(int irq)
-{
-#warning "Missing Logic"
}
diff --git a/nuttx/arch/hc/src/m9s12/m9s12_serial.c b/nuttx/arch/hc/src/m9s12/m9s12_serial.c
index 6d60ee9bc..7b5ba365e 100755
--- a/nuttx/arch/hc/src/m9s12/m9s12_serial.c
+++ b/nuttx/arch/hc/src/m9s12/m9s12_serial.c
@@ -331,7 +331,9 @@ static int up_setup(struct uart_dev_s *dev)
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
#ifndef CONFIG_SUPPRESS_SCI_CONFIG
uint8_t cr1;
+#endif
+#ifndef CONFIG_SUPPRESS_SCI_CONFIG
/* Calculate the BAUD divisor */
tmp = SCIBR_VALUE(priv->baud);
@@ -371,17 +373,12 @@ static int up_setup(struct uart_dev_s *dev)
up_serialout(priv, HCS12_SCI_CR1_OFFSET, cr1);
#endif
- /* Enable Rx interrupts from the SCI. We don't want Tx interrupts until we
- * have something to send. We will check for serial errors as part of Rx
- * interrupt processing. Interrupts won't be fully enabled until the
- * interrupt vector is attached.
+ /* Enable Rx and Tx, keeping all interrupts disabled. We don't want
+ * interrupts until the interrupt vector is attached.
*/
- priv->im = SCI_CR2_RIE;
-
- /* Enable Rx and Tx */
-
- up_serialout(priv, HCS12_SCI_CR2_OFFSET, (SCI_CR2_RIE|SCI_CR2_TE|SCI_CR2_RE));
+ priv->im = 0;
+ up_serialout(priv, HCS12_SCI_CR2_OFFSET, (SCI_CR2_TE|SCI_CR2_RE));
return OK;
}
@@ -424,11 +421,12 @@ static int up_attach(struct uart_dev_s *dev)
ret = irq_attach(priv->irq, up_interrupt);
if (ret == OK)
{
- /* Enable the interrupt (RX and TX interrupts are still disabled
- * in the SCI
+ /* Enable the Rx interrupt (the TX interrupt is still disabled
+ * until we have something to send).
*/
- up_enable_irq(priv->irq);
+ priv->im = SCI_CR2_RIE;
+ up_setsciint(priv);
}
return ret;
}
@@ -446,7 +444,7 @@ static int up_attach(struct uart_dev_s *dev)
static void up_detach(struct uart_dev_s *dev)
{
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
- up_disable_irq(priv->irq);
+ up_disablesciint(priv, NULL);
irq_detach(priv->irq);
}
diff --git a/nuttx/arch/hc/src/m9s12/m9s12_timerisr.c b/nuttx/arch/hc/src/m9s12/m9s12_timerisr.c
index 3839badf2..22e76d7ee 100755
--- a/nuttx/arch/hc/src/m9s12/m9s12_timerisr.c
+++ b/nuttx/arch/hc/src/m9s12/m9s12_timerisr.c
@@ -182,8 +182,4 @@ void up_timerinit(void)
regval = getreg8(HCS12_CRG_CRGINT);
regval |= CRG_CRGINT_RTIE;
putreg8(regval, HCS12_CRG_CRGINT);
-
- /* And enable the timer interrupt */
-
- up_enable_irq(HCS12_IRQ_VRTI);
}