aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/isa/sound/os.h
blob: 104906917ec4b2fd6eebd6c61cb15608b86e5670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * os.h -- only included by sound_config.h right after local.h
 *
 */

#ifndef _OS_H_
#define _OS_H_

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/filio.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/poll.h>
#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/signalvar.h>

#if NSND > 0

#include <machine/soundcard.h>
#undef DELAY
#define DELAY(x)  tenmicrosec(x)
typedef struct uio snd_rw_buf;

struct snd_wait {
	int             mode;
	int             aborting;
};


unsigned long   get_time(void);

#endif	/* NSND > 0 */
#endif	/* _OS_H_ */

typedef caddr_t ioctl_arg;

typedef struct sound_os_info {
	int             unit;
}               sound_os_info;


/*
 * The following macro calls tsleep. It should be implemented such that
 * the process is resumed if it receives a signal.
 * The q parameter is a wait_queue defined with DEFINE_WAIT_QUEUE(),
 * and the second is a workarea parameter. The third is a timeout 
 * in ticks. Zero means no timeout.
 */
#define DO_SLEEP(q, f, time_limit)	\
	{ \
	  int flag; \
	  f.mode = WK_SLEEP; \
	  flag=tsleep(&q, (PRIBIO-5)|PCATCH, "sndint", time_limit); \
	  f.mode &= ~WK_SLEEP; \
	  if (flag == EWOULDBLOCK) { \
		f.mode |= WK_TIMEOUT; \
		f.aborting = 0; \
	  } else \
		f.aborting = flag; \
	}

#define DO_SLEEP1(q, f, time_limit)	\
	{ \
	  int flag; \
	  f.mode = WK_SLEEP; \
	  flag=tsleep(&q, (PRIBIO-5)|PCATCH, "snd1", time_limit); \
	  f.mode &= ~WK_SLEEP; \
	  if (flag == EWOULDBLOCK) { \
		f.mode |= WK_TIMEOUT; \
		f.aborting = 0; \
	  } else \
		f.aborting = flag; \
	}

#define DO_SLEEP2(q, f, time_limit)	\
	{ \
	  int flag; \
	  f.mode = WK_SLEEP; \
	  flag=tsleep(&q, (PRIBIO-5)|PCATCH, "snd2", time_limit); \
	  f.mode &= ~WK_SLEEP; \
	  if (flag == EWOULDBLOCK) { \
		f.mode |= WK_TIMEOUT; \
		f.aborting = 0; \
	  } else \
		f.aborting = flag; \
	}

#define PROCESS_ABORTING( f) (f.aborting || CURSIG(curproc))
#define TIMED_OUT( f) (f.mode & WK_TIMEOUT)

#ifdef ALLOW_POLL
typedef struct proc select_table;
extern struct selinfo selinfo[];
#endif