Subversion Repositories shark

Rev

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

Rev Author Line No. Line
42 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>
83 pj 28
#include <ll/sys/ll/time.h>
29
#include <ll/sys/ll/ll-data.h>
30
 
42 pj 31
BEGIN_DEF
32
 
122 giacomo 33
#define MAX_EVENT 250
42 pj 34
 
35
struct event {
36
        struct event *next;             /* Next event in an event queue */
37
        void *par;                      /* Handler's parameter          */
38
        void (*handler)(void *p);       /* Event Handler                */
39
        struct timespec time;           /* Time at which the event
40
                                           will raise */
41
        int index;                      /* Event ID                     */
42
};
43
 
44
/* Event management functions... */
45
 
46
void event_setprologue(void *p);
47
void event_setepilogue(void *p);
48
 
49
void event_setlasthandler(void *p);
50
 
51
int (*event_post)(struct timespec time, void (*handler)(void *p), void *par);
52
int (*event_delete)(int index);
53
 
54
int oneshot_event_post(struct timespec time, void (*handler)(void *p), void *par);
55
int oneshot_event_delete(int index);
56
int periodic_event_post(struct timespec time, void (*handler)(void *p), void *par);
57
int periodic_event_delete(int index);
58
void event_init(struct ll_initparms *l);
59
 
60
/* Interrupt handler entry */
61
struct intentry {
62
        void *par;                      /* Handler's parameter          */
63
        void (*handler)(void *p);       /* Interrupt Handler            */
64
        int index;                      /* Interrupt number             */
65
        DWORD status;                   /* Interrupt status
66
                                                no handler --> FREE
67
                                                handler --> ASSIGNED
68
                                                being served --> BUSY
69
                                                                        */
70
        DWORD flags;
71
};
72
 
73
#define INT_PREEMPTABLE 1
74
#define INT_FORCE       2
75
 
76
#define INTSTAT_FREE            1
77
#define INTSTAT_ASSIGNED        2
78
#define INTSTAT_BUSY            3
79
 
80
void irq_init(void);
81
int irq_bind(int irq, void (*handler)(void *p), DWORD flags);
82
int ll_ActiveInt();
83
 
84
END_DEF
85
#endif