kernel tree reorganization stage 1: Major cvs repository work (not logged as
[dragonfly.git] / sys / platform / pc32 / isa / sound / os.h
1 /*
2  * os.h -- only included by sound_config.h right after local.h
3  *
4  * $FreeBSD: src/sys/i386/isa/sound/os.h,v 1.40.2.1 2000/08/03 01:01:27 peter Exp $
5  * $DragonFly: src/sys/platform/pc32/isa/sound/Attic/os.h,v 1.4 2003/08/07 21:17:23 dillon Exp $
6  */
7
8 #ifndef _OS_H_
9 #define _OS_H_
10
11 #include <sys/param.h>
12 #include <sys/systm.h>
13 #include <sys/proc.h>
14 #include <sys/conf.h>
15 #include <sys/fcntl.h>
16 #include <sys/filio.h>
17 #include <sys/uio.h>
18 #include <sys/kernel.h>
19 #include <sys/poll.h>
20 #include <sys/malloc.h>
21 #include <sys/buf.h>
22 #include <sys/signalvar.h>
23
24 #include <sys/soundcard.h>
25
26 #include <bus/isa/i386/isa_device.h>
27
28 #undef DELAY
29 #define DELAY(x)  tenmicrosec(x)
30 typedef struct uio snd_rw_buf;
31
32 struct snd_wait {
33         int             mode;
34         int             aborting;
35 };
36
37
38 unsigned long   get_time(void);
39
40 #endif  /* _OS_H_ */
41
42 typedef caddr_t ioctl_arg;
43
44 typedef struct sound_os_info {
45         int             unit;
46 }               sound_os_info;
47
48
49 /*
50  * The following macro calls tsleep. It should be implemented such that
51  * the process is resumed if it receives a signal.
52  * The q parameter is a wait_queue defined with DEFINE_WAIT_QUEUE(),
53  * and the second is a workarea parameter. The third is a timeout 
54  * in ticks. Zero means no timeout.
55  */
56 #define DO_SLEEP(q, f, time_limit)      \
57         { \
58           int flag; \
59           f.mode = WK_SLEEP; \
60           flag=tsleep(&q, PCATCH, "sndint", time_limit); \
61           f.mode &= ~WK_SLEEP; \
62           if (flag == EWOULDBLOCK) { \
63                 f.mode |= WK_TIMEOUT; \
64                 f.aborting = 0; \
65           } else \
66                 f.aborting = flag; \
67         }
68
69 #define DO_SLEEP1(q, f, time_limit)     \
70         { \
71           int flag; \
72           f.mode = WK_SLEEP; \
73           flag=tsleep(&q, PCATCH, "snd1", time_limit); \
74           f.mode &= ~WK_SLEEP; \
75           if (flag == EWOULDBLOCK) { \
76                 f.mode |= WK_TIMEOUT; \
77                 f.aborting = 0; \
78           } else \
79                 f.aborting = flag; \
80         }
81
82 #define DO_SLEEP2(q, f, time_limit)     \
83         { \
84           int flag; \
85           f.mode = WK_SLEEP; \
86           flag=tsleep(&q, PCATCH, "snd2", time_limit); \
87           f.mode &= ~WK_SLEEP; \
88           if (flag == EWOULDBLOCK) { \
89                 f.mode |= WK_TIMEOUT; \
90                 f.aborting = 0; \
91           } else \
92                 f.aborting = flag; \
93         }
94
95 #define PROCESS_ABORTING( f) (f.aborting || CURSIG(curproc))
96 #define TIMED_OUT( f) (f.mode & WK_TIMEOUT)
97
98 #ifdef ALLOW_POLL
99 typedef struct proc select_table;
100 extern struct selinfo selinfo[];
101 #endif