Fix some confusion in the code about vectored interrupts; fix so that it builds with prioritized interrutps disabed

This commit is contained in:
Gregory Nutt 2014-03-08 10:57:11 -06:00
parent c86c40f4e4
commit 95038604f6
4 changed files with 33 additions and 25 deletions

View File

@ -14,14 +14,14 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@ -61,8 +61,8 @@
#ifndef __ASSEMBLY__
#ifdef CONFIG_ARCH_LEDS
extern void up_statledoff(void);
extern void up_statledon(void);
extern void lpc2378_statledoff(void);
extern void lpc2378_statledon(void);
#endif
#endif

View File

@ -58,7 +58,7 @@
#include "lpc23xx_vic.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -121,22 +121,24 @@ void up_irqinitialize(void)
* VIC registers can be accessed in User or privileged mode
***********************************************************************/
#if 0 /* Not used */
static void up_enable_irq_protect(void)
{
// ~ uint32_t reg32 = vic_getreg(VIC_PROTECTION_OFFSET);
// ~ reg32 &= ~(0xFFFFFFFF);
vic_putreg(0x01, VIC_PROTECTION_OFFSET);
}
#endif
/***********************************************************************
* Name: up_disable_irq_protect
* VIC registers can only be accessed in privileged mode
***********************************************************************/
#if 0 /* Not used */
static void up_disable_irq_protect(void)
{
vic_putreg(0, VIC_PROTECTION_OFFSET);
}
#endif
/***********************************************************************
* Name: up_disable_irq
@ -227,17 +229,21 @@ void up_maskack_irq(int irq)
* MOD
****************************************************************************/
#ifdef CONFIG_ARCH_IRQPRIO
int up_prioritize_irq(int irq, int priority)
{
/* The default priority on reset is 16 */
if (irq < NR_IRQS && priority > 0 && priority < 16)
{
int offset = irq << 2;
vic_putreg(priority, VIC_VECTPRIORITY0_OFFSET + offset);
return OK;
}
return -EINVAL;
}
#endif
/****************************************************************************
* Name: up_attach_vector
@ -262,11 +268,13 @@ void up_attach_vector(int irq, int vector, vic_vector_t handler)
/* Save the vector address */
vic_putreg((uint32_t) handler, VIC_VECTADDR0_OFFSET + offset);
vic_putreg((uint32_t)handler, VIC_VECTADDR0_OFFSET + offset);
#ifdef CONFIG_ARCH_IRQPRIO
/* Set the interrupt priority */
up_prioritize_irq(irq, vector);
up_prioritize_irq(irq, PRIORITY_HIGHEST);
#endif
/* Enable the vectored interrupt */

View File

@ -537,17 +537,13 @@ static int up_attach(struct uart_dev_s *dev)
up_enable_irq(priv->irq);
/* Set the uart interrupt priority (the default value is one) */
if (priv->uartbase == UART0_BASE_ADDR)
{
up_prioritize_irq(priv->irq, PRIORITY_LOWEST);
}
else if (priv->uartbase == UART2_BASE_ADDR)
{
up_prioritize_irq(priv->irq, 10);
}
#ifdef CONFIG_ARCH_IRQPRIO
/* Set the UART interrupt priority */
up_prioritize_irq(priv->irq, PRIORITY_HIGHEST);
#endif
}
return ret;
}

View File

@ -127,10 +127,12 @@ int up_timerisr(int irq, uint32_t * regs)
if (tick++ > 100)
{
tick = 0;
up_statledoff();
lpc2378_statledoff();
}
else
up_statledon();
{
lpc2378_statledon();
}
return 0;
}
@ -190,10 +192,12 @@ void up_timerinit(void)
/* Attach the timer interrupt vector */
#ifdef CONFIG_VECTORED_INTERRUPTS
up_attach_vector(IRQ_SYSTIMER, PRIORITY_HIGHEST, (vic_vector_t) up_timerisr);
up_attach_vector(IRQ_SYSTIMER, ???, (vic_vector_t) up_timerisr);
#else
(void)irq_attach(IRQ_SYSTIMER, (xcpt_t) up_timerisr);
#ifdef CONFIG_ARCH_IRQPRIO
up_prioritize_irq(IRQ_SYSTIMER, PRIORITY_HIGHEST);
#endif
#endif
/* And enable the system timer interrupt */