This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Redboot Questions
- To: Jesper Skov <jskov at cambridge dot redhat dot com>
- Subject: Re: [ECOS] Redboot Questions
- From: Carlos Camargo <carlos_ivan_camargo at yahoo dot com>
- Date: Tue, 10 Jul 2001 03:28:01 -0700 (PDT)
- Cc: ecos-discuss at sources dot redhat dot com
> Carlos> Exists any problem with spurious interrupts
> an CTRL-C
> Carlos> support???
>
> Not understood.
>
> Jesper
My question is:
Due that my interrupt source is EXT0 with the same
vector of spurious interrupt. This have any
problem????
I have the following program:
/****************************************************************
*
* File : counter.c
* Description : Segment Display Programm
* Author : Carlos Camargo
* Date : 22/06/2001
*
****************************************************************/
#include <cyg/kernel/kapi.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <cyg/hal/hal_intr.h>
#include "segment.h"
#define SYSCFG 0x03ff0000
#define IOPMOD ((volatile unsigned
*)(SYSCFG+0x5000))
#define IOPDATA ((volatile unsigned
*)(SYSCFG+0x5008))
#define FOREVER (1)
cyg_thread thread_s[2]; /* space for two thread
objects */
char stack[2][4096]; /* space for two 4K stacks */
cyg_handle_t simple_threadA, simple_threadB; /*
handles for the thread */
cyg_thread_entry_t program_A, program_B; /* variables
for the procedure which is the thread */
cyg_handle_t int_0_ISR_H;
cyg_interrupt intr;
int toggle = 0;
cyg_uint32 int_0_isr(cyg_vector_t
vector,cyg_addrword_t data)
{
/* ISRs must acknowledge the interrupt, or they
might be invoked again */
cyg_interrupt_acknowledge(vector);
return CYG_ISR_CALL_DSR;
}
/* this is the DSR for ext 0 interrupts */
void int_0_dsr(cyg_vector_t vector, cyg_ucount32
count, cyg_addrword_t data)
{
if ( toggle == 0){
cyg_thread_suspend( simple_threadA );
cyg_thread_resume( simple_threadB );
toggle = 1;
}
else {
cyg_thread_suspend ( simple_threadB );
cyg_thread_resume ( simple_threadA );
toggle = 0;
}
}
static unsigned int numeric_display [16] =
{
DISP_0, DISP_1, DISP_2, DISP_3, DISP_4,
DISP_5, DISP_6, DISP_7, DISP_8, DISP_9,
DISP_A, DISP_B, DISP_C, DISP_D, DISP_E,
DISP_F
};
void cyg_user_start(void)
{
// printf("Entering test' cyg_user_start()
function\n");
// printf("Create Thread_A and Thread_B\n");
cyg_thread_create(4, program_A, (cyg_addrword_t)
'A',
"Thread A", (void *) stack[0], 4096,
&simple_threadA, &thread_s[0]);
cyg_thread_create(4, program_B, (cyg_addrword_t)
'B',
"Thread B", (void *) stack[1], 4096,
&simple_threadB, &thread_s[1]);
/* create an interrupt handler with int_0_isr() as
the ISR and int_0_dsr() as the DSR.*/
cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_EXT0, 0,
0, &int_0_isr,
&int_0_dsr, &int_0_ISR_H,
&intr);
cyg_interrupt_attach(int_0_ISR_H);
cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EXT0);
cyg_thread_resume(simple_threadB);
}
void program_A(cyg_addrword_t data)
{
char message = data;
int seg;
while ( FOREVER ){
for ( seg=0xf; seg>=0; seg--) {
if ( (seg >= 0) & (seg <= 0xf) ){
*IOPDATA &= ~SEG_MASK;
*IOPDATA |= numeric_display[seg];
}
cyg_thread_delay(100);
}
}
}
void program_B(cyg_addrword_t data)
{
char message = data;
int seg;
// printf("Beginning execution; thread data is %c\n",
message);
while ( FOREVER ){
for ( seg=0; seg<=0xf; seg++) {
if ( (seg >= 0) & (seg <= 0xf) ){
*IOPDATA &= ~SEG_MASK;
*IOPDATA |= numeric_display[seg];
}
cyg_thread_delay(100);
}
}
}
/****************************************************************
* END OF counter.c
****************************************************************/
When i run this program from insight The thread
simple_threadB running correctly, but when i press the
external button attach to EXT0, no acurrs any
interrupt.
My code is good, or i have any error.
Thanks
Carlos Camargo
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/