EmbeddedRelated.com
Forums

arm926ejs simple interrupts

Started by kumori0 March 7, 2008
kumori0 schrieb:
> I'm afraid I don't have IAR compiler, I'm using gcc, after Lynch's
> tutorial. I have located the macros that should enable and disable the
> interrupts in my hello world example, but I can't figure out what
> exactly do they do.

Did you look at the ARM assembly syntax ?

The macros just copy the CPSR into key lock interrupts (and change to
SYS-mode) or key into CPSR.

--
42Bastian

Note: SPAM-only account, direct mail to bs42@...

I'm afraid I don't have IAR compiler, I'm using gcc, after Lynch's
tutorial. I have located the macros that should enable and disable the
interrupts in my hello world example, but I can't figure out what
exactly do they do.
Could someone help me with this?

I have the following code: http://pastebin.com/m663dc4d

And I can't figure out how exactly to use them. Macro demands some
sort of key as an input argument. What is that key? I tried to enter 1
for it and it seems to unlock the interrupts in status register but I
would feel a lot better if I knew what exactly is it that I should input.

I'm saying that is seems to unlock the interrupts because now when I'm
debugging with jtag the my program gets lost somewhere. When I halt it
I get a message source not found which I think is probably caused by
staying in the interrupt forever. Problem is, I have breakpoints set
in all my interrupt handling routines so I think it should stop when
it reaches them.

One other thing, at the bottom of the file for enabling and disabling
interrupts I have this:

void ARM_reset(void);
void ARM_undef(void);
void ARM_swi(void);
void ARM_pAbort(void);
void ARM_dAbort(void);
void ARM_reserved(void);
void ARM_irq(void);
void ARM_fiq(void);

What is that for? I thought that all you have to do is declare the
interrupt handler like this:
static void PIT_IRQ_isr(void) __attribute__ ((interrupt("IRQ")));
Then create the routine itself like this:
void PIT_IRQ_isr ( void ) {
//Acknowledge interrupt by reading Periodic Interval Value
Register(PIT_PIVR);
unsigned int dummy = pitGetPIVR();
numINT++;
uart0_putc('Z');
(void)dummy; //suppress warning "dummy" was set but never used
}
Thanks in advance,
Jani

--- In A..., Johan Ingvast wrote:
>
> For the IAR compiler there is an intrisic function
> __enable_interrupt();
> For all interrupts. You can also set fiq and irq separately with
> something like
> __enable_irq()
> __enable_fiq()
> There are of course corresponding __disable commands
> Hope this helps.
> /johan
>
> kumori0 skrev:
> >
> >
> > Thanks, this should be the problem. I now have one very newbie
> > question. How do I change the CPSR value in code? I can't find the
> > memory location for it in AT91SAM9260 definitions where the memory
> > addresses are. Do I have to use some assembly command?
> >
> > Jani
> >
> > --- In A... ,
> > "ICLI, Bekir (EXT)"
> > wrote:
> > >
> > > Hi Jani,
> > >
> > > Looking at your CPSR, you are masking I and F (bits 6-7) bits. That
> > means, both fiq and irq interrupts are masked..
> > >
> > >
> > > Mit freundlichem Gru/ Best regards
> > > Bekir ICLI
> > >
> > >
> > >
> > >
> > > ________________________________
> > >
> > > Von: A...
> > [mailto:A... ] Im
> > Auftrag von kumori0
> > > Gesendet: Freitag, 4. April 2008 10:31
> > > An: A...
> > > Betreff: [AT91SAM] Re: arm926ejs simple interrupts
> > >
> > >
> > >
> > > Hello everyone,
> > >
> > > I'm still trying to get the interrupts working. I have
implemented the
> > > code from the examples that I got but so far they're still not
working.
> > >
> > > When I check the registers with jtag I can see that there is an
> > > interrupt pending (return (pAic->AIC_IPR & (0x1 << irq_id));)
but for
> > > some reason the active interrupt (return (pAic->AIC_ISR & (0x1 <<
> > > irq_id));) is always 0.
> > >
> > > When I look at the interrupt mask, to see which interrupts are
enabled
> > > I can see that the PIT interrupt and the software interrupt are
> > > enabled (SYS value of AIC_IMR=1).
> > >
> > > I also tried to trigge the interrupts manually by writing 1 in
> > > AIC_ISCR but nothing happens.
> > >
> > > You can see my source code here:
> > > aic.c - http://pastebin.com/m61920f16

> > >
> > > aic.h - http://pastebin.com/m2653e9ef

> > >
> > > main.c - http://pastebin.com/m51a7958b
> > > > >
> > > main.h - http://pastebin.com/m63a31dd0
> > > > >
> > > pit.c - http://pastebin.com/m13cd9e02

> > >
> > > pit.h - http://pastebin.com/m54f75450

> > >
> > > CS1275.c(hw init) - http://pastebin.com/m2fe34e30
> >
> > >
> > >
> > > The value of my CPSR is: 00100000 00000000 00000000 11010011
> > >
> > > I'm runing my code through debugger, does that disable interrupts?
> > >
> > > Let me know if more info about configuration and/or source code is
> > > needed.
> > >
> > > Thanks in advance,
> > > Jani
> > >
> >
> >
>
> --
> Johan Ingvast, PhD, CEO BioServo Technologies AB
> Mob. +46 70 34 34 498 http://www.bioservo.com
> Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
>