This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Problems with cyg_interrupt_attach
- From: Alluitz <alluitz at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Mon, 5 Dec 2005 10:08:06 +0100
- Subject: [ECOS] Problems with cyg_interrupt_attach
Hello,
We have got many problems with an interruption in IRQ0.
In our program(It is below), when executing the "cyg_interrupt_attach"
function, AIC_SMR31 bits are erased. Whe don´t know if it is right or
the function must be executed at the beginning.
The interrupt goes on everytime if we set it to execute with low
level. Do anybody know what does it occur?
Then, in the main program, if we put "while(1)" it seem the chip locks.
Can anybody help us?
Thank you very much.
----------This is our programm----------
#include <cyg/kernel/kapi.h>
#include <cyg/kernel/diag.h>
static cyg_interrupt int1;
static cyg_handle_t int1_handle;
static int counter;
#define CYGNUM_HAL_PRI_HIGH 0
//
// Interrupt service routine for interrupt 1.
//
cyg_uint32 interrupt_1_isr(
cyg_vector_t vector,
cyg_addrword_t data)
{
// Block this interrupt from occurring until
// the DSR completes.
cyg_interrupt_mask( vector );
// Tell the processor that we have received
// the interrupt.
cyg_interrupt_acknowledge( vector );
// Tell the kernel that chained interrupt processing
// is done and the DSR needs to be executed next.
return( CYG_ISR_HANDLED | CYG_ISR_CALL_DSR );
}
//
// Deferred service routine for interrupt 1.
//
void interrupt_1_dsr(
cyg_vector_t vector,
cyg_ucount32 count,
cyg_addrword_t data)
{
hal_at91_led_on(1); //Turn on the LED
hal_at91_led_off(1); //Turn off the LED
counter=1;
// Allow this interrupt to occur again.
cyg_interrupt_unmask( vector );
}
//
// Main starting point for the application.
//
void cyg_user_start(
void)
{
cyg_vector_t int1_vector = CYGNUM_HAL_INTERRUPT_EXT0; //IRQ0
cyg_priority_t int1_priority = CYGNUM_HAL_PRI_HIGH;
cyg_bool_t level=1; // The interruption will execute because of 1
(signal level) or 0 (signal edge).
cyg_bool_t up=0; // 1 (Rising edge/high level ) or 0 (faling edge/low level)
// Create interrupt 1.
//
counter=0;
cyg_interrupt_create(
int1_vector,
int1_priority,
0,
&interrupt_1_isr,
&interrupt_1_dsr,
&int1_handle,
&int1);
// Attach the interrupt created to the vector.
cyg_interrupt_attach( int1_handle );
// Set interrupt configuration
cyg_interrupt_configure(int1_vector,level,up);
// Unmask the interrupt we just configured.
cyg_interrupt_unmask( int1_vector );
cyg_interrupt_enable();
// while(1)
// {
// if (counter==1)
// {
// diag_printf("The program goes to the interruption\n");
// counter=0;
// }
// else
// {
// diag_printf(".");
// }
// }
}
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss