okey now i am using ur programme only with creating one thread which will glow led ,so here initially the thread will runnig and when interrupt will come it will go to the isr and then dsr that i can see with the help of leds but after dsr it iwill not come again back to the thread..so here what should be the reason.?
i am a newbie,please give some suggestions,.
NIrav
# include <cyg/hal/io.h> // for IOWR and IORD# include <cyg/kernel/kapi.h>
unsigned char ledpio;
cyg_interrupt int_pio;
cyg_handle_t int_pio_handle;
cyg_uint32 isr_pio( cyg_vector_t vector,
cyg_addrword_t data){
ledpio = 0x1; //
IOWR (LED_PIO_BASE , 0, ledpio);
cyg_interrupt_mask(vector);
cyg_interrupt_acknowledge(vector);
IOWR(BUTTON_PIO_BASE , 3, 0x00); // Reset the edgecapture register
ledpio = 0x8; //
IOWR (LED_PIO_BASE , 0, ledpio);
return( CYG_ISR_CALL_DSR);
}
void dsr_pio( cyg_vector_t vector,
cyg_ucount32 count,
cyg_addrword_t data){
ledpio = 0x7; //
IOWR (LED_PIO_BASE , 0, ledpio);
cyg_interrupt_unmask(vector);
ledpio = 0x3; //
IOWR (LED_PIO_BASE , 0, ledpio);
}
static void ledglow(cyg_addrword_t data)
{
ledpio = 0x8; //
IOWR (LED_PIO_BASE , 0, ledpio);
}
void cyg_user_start(void)
{
# define STACK_SIZE 0x1000
static char stack[STACK_SIZE];
static cyg_thread thread_data;
static cyg_handle_t thread_handle;
cyg_thread_create(10,ledglow,0,"interrupt test",&stack[0],STACK_SIZE, &thread_handle,&thread_data);
cyg_thread_resume( thread_handle);
cyg_interrupt_create(
BUTTON_PIO_IRQ, // in /include/cyg/hal/system.h
99,
55,
&isr_pio,
&dsr_pio,
&int_pio_handle,
&int_pio);
cyg_interrupt_attach(int_pio_handle);
cyg_interrupt_unmask( BUTTON_PIO_IRQ);
IOWR(BUTTON_PIO_BASE , 1, 0x00);// PIO in input
IOWR(BUTTON_PIO_BASE , 3, 0x00);// Reset the edgecapture register
IOWR(BUTTON_PIO_BASE , 2, 0x01);// unmask bit0 all other masked
}
-----------------------------------------------------------------------------------------
--- Quote Start ---
originally posted by glecordier@Feb 8 2006, 04:29 AM
it is not exactly the same
i use the isr and dsr routine
the source of interrupt is masked in the isr "cyg_interrupt_mask(vector);"
and unmasked in the dsr " cyg_interrupt_unmask(vector);"
in your code you use only the isr routine
so mask and unmask in the isr
or do not mask the source of the interrupt,
the edgecapture register masks for you until it is reset
the isr could be :
cyg_uint32 isr_pio( cyg_vector_t vector ,cyg_addrword_t data)
{
// cyg_interrupt_mask(vector);
cyg_interrupt_acknowledge(vector);
iowr(button_pio_base , 3, 0x00); // reset the edgecapture register
ledpio = 0x8; //
iowr (led_pio_base , 0, ledpio);
return(cyg_isr_handled);
}
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=12626)
--- quote end ---
--- Quote End ---