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