[ECOS] question about interrupt service?
li hui
lhbyron@yahoo.com
Thu Nov 22 18:08:00 GMT 2001
I had tried to revise my code,but it still failed to
response interrupt! I set my mouse on com2, My code is
below, please give me some advice to let it run.
#include <pkgconf/system.h>
#include <cyg/infra/cyg_type.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/infra/diag.h>
#include <cyg/hal/drv_api.h>
#include <pkgconf/net.h>
#include <cyg/kernel/kapi.h>
#include <cyg/io/tvga/tvga.h>
#include <stdlib.h>
#include <stdio.h>
#define MOUSE_BASE 0x300
#define MOUSE_IRQ 35
static int mouse_user=0; /* User count */
static int mouse_dx=0; /* Position changes
*/
static int mouse_dy=0;
static int mouse_event=0; /* Mouse hase moved
*/
static unsigned char mouse_buttons=0;
static cyg_handle_t interupt_handle;
static cyg_interrupt interupt_obj;
static cyg_drv_cond_t mouse_wait;
static cyg_drv_mutex_t mouse_lock;
static cyg_drv_mutex_t cond_lock;
static void mouse_interupt(cyg_vector_t vector,
cyg_ucount32 count, cyg_addrword_t data);
static cyg_uint32 isr(cyg_vector_t
vector,cyg_addrword_t data)
{
vga_setcolor(3);
ticks++;
//vga_drawpixel(20,20+ticks*5);
cyg_interrupt_acknowledge(MOUSE_IRQ);
return CYG_ISR_HANDLED|CYG_ISR_CALL_DSR ;
}
static int mouse_lookup()
{
if (mouse_user++)
{
return 0;
}
/****************************/
/*****omit request IRQ ******/
/****************************/
/******ecos IRQ**************/
vga_setmode(G360x480x256);
diag_printf("enter init\n");
cyg_interrupt_create ( MOUSE_IRQ, 99, 0, isr,
mouse_interupt, &interupt_handle, &interupt_obj);
cyg_interrupt_attach (interupt_handle);
cyg_drv_interrupt_unmask (MOUSE_IRQ);
HAL_ENABLE_INTERRUPTS();
while(ticks<10)
{}
printf("I reach!\n");
return 0;
}
static void mouse_interupt(cyg_vector_t vector,
cyg_ucount32 count, cyg_addrword_t data)
{
//vga_setcolor(15);
//vga_drawpixel(50,50+ticks*5);
diag_print("in DSR\n);
}
int main()
{
mouse_lookup();
return 0;
}
--- Jonathan Larmour <jlarmour@redhat.com> wrote:
> li hui wrote:
> >
> > I try to write a mouse driver for ecos(i386).I
> meet a
> > problem, I can't make my interrupt routine
> response
> > the interrupt.my code is bleow,please give me some
> > advice.
> >
> > #define MOUSE_BASE 0x300
> > #define MOUSE_IRQ CYGNUM_HAL_INTERRUPT_COM2 //35
> > static cyg_uint32 isr(cyg_vector_t
> > vector,cyg_addrword_t data)
> > {
> > return 1;
> > }
>
> You should return CYG_ISR_HANDLED|CYG_ISR_CALL_DSR
> otherwise your DSR
> won't be called.
>
> Jifl
> --
> Red Hat, Rustat House, Clifton Road, Cambridge, UK.
> Tel: +44 (1223) 271062
> Maybe this world is another planet's Hell -Aldous
> Huxley || Opinions==mine
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
More information about the Ecos-discuss
mailing list