Subversion Repositories shark

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/* Project:     OSLib
2
 * Description: The OS Construction Kit
3
 * Date:                1.6.2000
4
 * Idea by:             Luca Abeni & Gerardo Lamastra
5
 *
6
 * OSLib is an SO project aimed at developing a common, easy-to-use
7
 * low-level infrastructure for developing OS kernels and Embedded
8
 * Applications; it partially derives from the HARTIK project but it
9
 * currently is independently developed.
10
 *
11
 * OSLib is distributed under GPL License, and some of its code has
12
 * been derived from the Linux kernel source; also some important
13
 * ideas come from studying the DJGPP go32 extender.
14
 *
15
 * We acknowledge the Linux Community, Free Software Foundation,
16
 * D.J. Delorie and all the other developers who believe in the
17
 * freedom of software and ideas.
18
 *
19
 * For legalese, check out the included GPL license.
20
 */
21
 
22
/*      Time event management functions */
23
 
24
#ifndef __LL_SYS_LL_EVENT_H__
25
#define __LL_SYS_LL_EVENT_H__
26
 
27
#include <ll/i386/defs.h>
28
BEGIN_DEF
29
 
30
#include <ll/sys/ll/time.h>
31
#include <ll/sys/ll/ll-data.h>
32
#define MAX_EVENT 100
33
 
34
struct event {
35
        struct event *next;             /* Next event in an event queue */
36
        void *par;                      /* Handler's parameter          */
37
        void (*handler)(void *p);       /* Event Handler                */
38
        struct timespec time;           /* Time at which the event
39
                                           will raise */
40
        int index;                      /* Event ID                     */
41
};
42
 
43
/* Event management functions... */
44
 
45
void event_setprologue(void *p);
46
void event_setepilogue(void *p);
47
 
48
void event_setlasthandler(void *p);
49
 
50
int (*event_post)(struct timespec time, void (*handler)(void *p), void *par);
51
int (*event_delete)(int index);
52
 
53
int oneshot_event_post(struct timespec time, void (*handler)(void *p), void *par);
54
int oneshot_event_delete(int index);
55
int periodic_event_post(struct timespec time, void (*handler)(void *p), void *par);
56
int periodic_event_delete(int index);
57
void event_init(struct ll_initparms *l);
58
 
59
/* Interrupt handler entry */
60
struct intentry {
61
        void *par;                      /* Handler's parameter          */
62
        void (*handler)(void *p);       /* Interrupt Handler            */
63
        int index;                      /* Interrupt number             */
64
        DWORD status;                   /* Interrupt status
65
                                                no handler --> FREE
66
                                                handler --> ASSIGNED
67
                                                being served --> BUSY
68
                                                                        */
69
        DWORD flags;
70
};
71
 
72
#define INT_PREEMPTABLE 1
73
#define INT_FORCE       2
74
 
75
#define INTSTAT_FREE            1
76
#define INTSTAT_ASSIGNED        2
77
#define INTSTAT_BUSY            3
78
 
79
void irq_init(void);
80
int irq_bind(int irq, void (*handler)(void *p), DWORD flags);
81
int ll_ActiveInt();
82
 
83
END_DEF
84
#endif