Working with c5471 interrupts
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@42 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
44117a7ecc
commit
c55287ab0e
9 changed files with 44 additions and 11 deletions
|
@ -212,7 +212,7 @@ static inline void system_call(swint_t func, int parm1,
|
|||
"mov\tr0,%0\n\t"
|
||||
"mov\tr1,%1\n\t"
|
||||
"mov\tr2,%2\n\t"
|
||||
"mov\tr2,%3\n\t"
|
||||
"mov\tr3,%3\n\t"
|
||||
"swi\t0x900001\n\t"
|
||||
:
|
||||
: "r" ((long)(func)), "r" ((long)(parm1)),
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
|
@ -55,6 +58,21 @@
|
|||
* Private Functions
|
||||
************************************************************/
|
||||
|
||||
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
|
||||
{
|
||||
/* Are we in an interrupt handler or the idle task? */
|
||||
|
||||
if (current_regs || ((_TCB*)g_readytorun.head)->pid == 0)
|
||||
{
|
||||
(void)irqsave();
|
||||
for(;;);
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(errorcode);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
|
@ -67,7 +85,7 @@ void up_assert(const ubyte *filename, int lineno)
|
|||
{
|
||||
dbg("Assertion failed at file:%s line: %d\n",
|
||||
filename, lineno);
|
||||
exit(EXIT_FAILURE);
|
||||
_up_assert(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
|
@ -78,5 +96,5 @@ void up_assert_code(const ubyte *filename, int lineno, int errorcode)
|
|||
{
|
||||
dbg("Assertion failed at file:%s line: %d error code: %d\n",
|
||||
filename, lineno, errorcode);
|
||||
exit(errorcode);
|
||||
_up_assert(errorcode);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <assert.h>
|
||||
#include "c5471.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
|
@ -66,6 +68,9 @@
|
|||
|
||||
void up_doirq(int irq, uint32* regs)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
#else
|
||||
if ((unsigned)irq < NR_IRQS)
|
||||
{
|
||||
/* Mask and acknowledge the interrupt */
|
||||
|
@ -80,4 +85,5 @@ void up_doirq(int irq, uint32* regs)
|
|||
|
||||
up_enable_irq(irq);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -75,5 +75,12 @@
|
|||
|
||||
void up_idle(void)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
/* If the system is idle, then process "fake" timer interrupts.
|
||||
* Hopefully, something will wake up.
|
||||
*/
|
||||
|
||||
sched_process_timer();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
/* Bring-up debug configurations */
|
||||
|
||||
#define CONFIG_SUPPRESS_INTERRUPTS 1 /* Do not enable interrupts */
|
||||
#define CONFIG_SUPPRESS_UART_CONFIG 1 /* Do not reconfig UART */
|
||||
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
|
||||
|
||||
/************************************************************
|
||||
* Public Types
|
||||
|
|
|
@ -136,6 +136,7 @@ static inline void up_vectorinitialize(void)
|
|||
up_vector_t *src = g_vectorinittab;
|
||||
up_vector_t *dest = (up_vector_t*)&_svectors;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NVECTORS; i++)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
|
|
|
@ -96,8 +96,8 @@ struct up_dev_s
|
|||
ubyte xmit_fifo_size; /* Size of transmit FIFO */
|
||||
ubyte irq; /* IRQ associated with
|
||||
* this UART */
|
||||
boolean parity; /* 0=none, 1=odd, 2=even */
|
||||
boolean bits; /* Number of bits (7 or 8) */
|
||||
ubyte parity; /* 0=none, 1=odd, 2=even */
|
||||
ubyte bits; /* Number of bits (7 or 8) */
|
||||
#ifdef CONFIG_UART_HWFLOWCONTROL
|
||||
boolean flowcontrol; /* TRUE: Hardware flow control
|
||||
* is enabled. */
|
||||
|
@ -1140,3 +1140,4 @@ int up_putc(int ch)
|
|||
up_restoreuartint(&CONSOLE_DEV, ier);
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ up_vectorirq:
|
|||
* no pending interrupt */
|
||||
.Lhaveirq:
|
||||
#endif
|
||||
/* Then call the data abort handler with interrupt disabled.
|
||||
/* Then call the IRQ handler with interrupt disabled.
|
||||
* rq_dispatch(int irq, struct xcptcontext *xcp)
|
||||
*/
|
||||
|
||||
|
@ -297,7 +297,7 @@ up_vectorprefetch:
|
|||
add r0, sp, #(4*REG_PC) /* Offset to pc, cpsr storage */
|
||||
stmia r0, {r1, r2}
|
||||
|
||||
/* Then call the data abort handler with interrupt disabled.
|
||||
/* Then call the prefetch abort handler with interrupt disabled.
|
||||
* void up_prefetchabort(struct xcptcontext *xcp)
|
||||
*/
|
||||
|
||||
|
@ -352,7 +352,7 @@ up_vectorundefinsn:
|
|||
add r0, sp, #(4*REG_PC) /* Offset to pc, cpsr storage */
|
||||
stmia r0, {r1, r2}
|
||||
|
||||
/* Then call the data abort handler with interrupt disabled.
|
||||
/* Then call the undef insn handler with interrupt disabled.
|
||||
* void up_undefinedinsn(struct xcptcontext *xcp)
|
||||
*/
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@
|
|||
|
||||
void up_idle(void)
|
||||
{
|
||||
/* If the system, then process timer interrupts. Hopefully
|
||||
* something will wake up.
|
||||
/* If the system is idle, then process "fake" timer interrupts.
|
||||
* Hopefully, something will wake up.
|
||||
*/
|
||||
|
||||
sched_process_timer();
|
||||
|
|
Loading…
Reference in a new issue