[ECOS] problems with the user interupts on e7t can anyone help?

Nick Garnett nickg@ecoscentric.com
Fri May 30 14:07:00 GMT 2003


F.T.Nilsson@hw.ac.uk writes:

> Hi all,
> 
> could anyone help me with the interupt setting for e7t. I want to create an 
> interupt if the user button is pressed. I created the interupts as follows 
> butt nothing happens
> 
> void cyg_user_start(void)//void main(void)
> {    
>   printf("in cyg_user_start\n");
> 
> //*IOPCON = 0x10;
> 
>   cyg_interrupt_enable();

Don't do this here. Interrupts will be enabled when the scheduler
starts after this function exits.

>   cyg_interrupt_configure(CYGNUM_HAL_INTERRUPT_EXT0,1,1); //tried bot high 
> and low detection	
>   cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_EXT0, 0, 0, &user_interupt,
>         NULL, &user_int0, &intr);
> 	
>   cyg_interrupt_attach(user_int0);
>   cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EXT0); 
> 
>   cyg_thread_create(4,thread2 , (cyg_addrword_t) 0, "serial_poll",
>         (void *)stack[0], STACKSIZE, &thread_handle[0], &thread[0]);
>   cyg_thread_create(4, simple_prog, (cyg_addrword_t) 1, "serial2",
>         (void *)stack[1], STACKSIZE, &thread_handle[1], &thread[1]);
> 
>   cyg_thread_resume(thread_handle[0]);
>   cyg_thread_resume(thread_handle[1]);
> }
> 
> I found a previous posting where the line *IOPCON = 0x10; was added. this 
> makes it work but it detects an interupt without the button being pressed. 
> I changed the configuration around but it doesnt't make a difference. do I 
> have to manipulate the IOPCON and INTMASK registers manualy?
> 

I don't know anything about the e7t, but if IOPCON controls the
assignment of multi-function IO pins then you may well need to program
it to assign the button input to the right functional unit. Setting it
to 0x10 appears to do the trick.

You shouldn't need to manipulate INTMASK, that's what
cyg_interrupt_unmask() is supposed to do.

You should call cyg_interrupt_acknowledge() in your ISR if you are not
doing so already. You may also need to do something to the hardware to
cancel the interrupt.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list