3
* Purpose: The top level header file for compiling OSS itself.
5
* This is the mother of all headers in OSS. All core files should include this
8
* However low level drivers must never include this file. Instead they should
9
* use the autogenerated drv_cfg.h file.
13
* This file is part of Open Sound System.
15
* Copyright (C) 4Front Technologies 1996-2008.
17
* This this source file is released under GPL v2 license (no other versions).
18
* See the COPYING file included in the main directory of this source
19
* distribution for the license terms and conditions.
26
#define NEW_DEVICE_NAMING /* /dev/sblive0_dsp0 instead of /dev/dsp0 and so on */
28
#include "soundcard.h"
31
typedef int *ioctl_arg;
33
/* Check various wrappers when changing these two function pointer defs */
34
typedef int (*oss_tophalf_handler_t) (struct _oss_device_t * osdev);
35
typedef void (*oss_bottomhalf_handler_t) (struct _oss_device_t * osdev);
37
#include <ossddk/oss_exports.h>
38
#include <local_config.h>
41
#include <ossddk/ossddk.h>
44
#error OS_VERSION not defined in os.h
48
* Memory block allocation (oss_memblk.h/c)
50
#include <oss_memblk.h>
53
* Memory allocation/free routines for structures to be freed automatically
54
* when OSS is unloaded.
56
#define PMALLOC(osdev, size) oss_memblk_malloc(&oss_global_memblk, size)
57
#define PMFREE(osdev, addr) oss_memblk_free(&oss_global_memblk, addr)
60
* Currently /dev/dsp is managed in user land by ossdevlinks instead of
61
* using the previous kernel level device lists feature (earlier maintained by
62
* the ossctl utility). Define MANAGE_DEV_DSP to return back this functionality
63
* in the driver. Also remove the related code in the user land tools
69
#define ERESTARTSYS EAGAIN
77
#define OSS_PAGE_MASK (-1)
84
#ifndef GET_PROCESS_NAME
85
#define GET_PROCESS_NAME() NULL
88
#ifndef GET_PROCESS_PID
89
#define GET_PROCESS_PID() -1
93
/* FMA is only available under Solaris */
94
#define FMA_EREPORT(osdev, detail, name, type, value)
95
#define FMA_IMPACT(osdev, impact)
98
#include "oss_version.h"
100
#define EXCLUDE_GUS_IODETECT
102
#ifndef IOC_IS_OUTPUT
103
#define IOC_IS_OUTPUT(cmd) cmd & SIOC_IN
106
#define DSP_DEFAULT_SPEED 48000
107
#define DSP_DEFAULT_FMT AFMT_S16_LE
112
typedef struct oss_wait_queue oss_wait_queue_t;
114
#include "audio_core.h"
115
#include "mixer_core.h"
116
#include "oss_calls.h"
117
#include "internal.h"
131
#define TIMER_ARMED 121234
132
#define TIMER_NOT_ARMED 1
135
extern void oss_vmem_check (char *file, int line, oss_native_word offs,
137
extern void oss_pmem_check (char *file, int line, oss_native_word offs,
139
# define VMEM_CHECK(offs, bytes) oss_vmem_check(__FILE__, __LINE__, (oss_native_word)offs, bytes)
140
# define PMEM_CHECK(offs, bytes) oss_pmem_check(__FILE__, __LINE__, (oss_native_word)offs, bytes)
142
# define VMEM_CHECK(offs, bytes)
143
# define PMEM_CHECK(offs, bytes)
146
#ifndef OSS_BIG_ENDIAN
152
char *const key, *const name;
153
} oss_device_table_t;
159
int (*open) (int dev, int dev_class, struct fileinfo * file,
160
int recursive, int open_flags, int *redirect);
161
void (*close) (int dev, struct fileinfo * file);
162
int (*read) (int dev, struct fileinfo * file, uio_t * buf, int count);
163
int (*write) (int dev, struct fileinfo * file, uio_t * buf, int count);
164
int (*ioctl) (int dev, struct fileinfo * file,
165
unsigned int cmd, ioctl_arg arg);
166
int (*chpoll) (int dev, struct fileinfo * file, oss_poll_event_t * ev);
172
typedef struct _oss_cdev_t oss_cdev_t;
179
oss_cdev_t *hl; /* Hash link (for operating system ports that use it) */
189
struct fileinfo file;
192
extern oss_cdev_t **oss_cdevs;
193
extern int oss_num_cdevs;
196
* Global initialization and cleanup functions (common to all operating systems)
198
extern void oss_common_init (oss_device_t * osdev);
199
extern void oss_unload_drivers (void);
201
* The following calls are operating system dependent. They should be defined
202
* in os.c for each operating system.
204
extern int oss_register_device (oss_device_t * osdev, const char *name);
205
extern void oss_unregister_device (oss_device_t * osdev);
206
extern int oss_find_minor (int dev_class, int instance);
207
extern int oss_disable_device (oss_device_t * osdev);
208
extern void oss_install_chrdev (oss_device_t * osdev, char *name,
209
int dev_class, int instance,
210
oss_cdev_drv_t * drv, int flags);
211
#define CHDEV_VIRTUAL 0x00000001
212
#define CHDEV_REPLUG 0x00000002 /* Hot (un)pluggable device got replugged */
213
extern int oss_register_interrupts (oss_device_t * osdev, int intrnum,
214
oss_tophalf_handler_t top,
215
oss_bottomhalf_handler_t bottom);
216
extern void oss_unregister_interrupts (oss_device_t * osdev);
219
* DMA buffer management
221
extern int oss_alloc_dmabuf (int dev, dmap_p dmap, int direction);
222
extern int __oss_alloc_dmabuf (int dev, dmap_p dmap, unsigned int alloc_flags,
223
oss_uint64_t maxaddr, int direction);
225
#define DMABUF_NONCONTIG 0x00000001
226
#define DMABUF_ISA 0x00000002
227
#define DMABUF_QUIET 0x00000004
228
#define DMABUF_SIZE_16BITS 0x00000008 /* Max buffer size 64k-1 */
229
#define DMABUF_LARGE 0x00000010 /* Allocate a 356k buffer */
231
#define MEMLIMIT_ISA 0x0000000000ffffffLL
232
#define MEMLIMIT_28BITS 0x000000000fffffffLL
233
#define MEMLIMIT_30BITS 0x000000003fffffffLL
234
#define MEMLIMIT_31BITS 0x000000007fffffffLL
235
#define MEMLIMIT_32BITS 0x00000000ffffffffLL
236
#define MEMLIMIT_64BITS 0xffffffffffffffffLL
237
extern void oss_free_dmabuf (int dev, dmap_p dmap);
240
* Device management routines
242
extern void *oss_get_osid (oss_device_t * osdev);
243
extern void oss_reserve_device (oss_device_t * osdev);
244
extern void oss_unreserve_device (oss_device_t * osdev, int decrement);
246
* Sleep/wakeup support (os.c)
248
extern oss_wait_queue_t *oss_create_wait_queue (oss_device_t * osdev,
250
extern void oss_reset_wait_queue (oss_wait_queue_t * wq);
251
extern void oss_remove_wait_queue (oss_wait_queue_t * wq);
252
extern int oss_sleep (oss_wait_queue_t * wq, oss_mutex_t * mutex, int ticks,
253
oss_native_word * flags, unsigned int *status);
254
extern int oss_register_poll (oss_wait_queue_t * wq, oss_mutex_t * mutex,
255
oss_native_word * flags, oss_poll_event_t * ev);
256
extern void oss_wakeup (oss_wait_queue_t * wq, oss_mutex_t * mutex,
257
oss_native_word * flags, short events);
259
* Wait status flags (make sure these match osscore.c for Linux)
262
#define WK_WAKEUP 0x01
263
#define WK_TIMEOUT 0x02
264
#define WK_SIGNAL 0x04
265
#define WK_SLEEP 0x08
266
#define WK_SELECT 0x10
269
* Mutex hierarchy levels
270
* Used by LOCK_ALLOC in UnixWare/OpenServer
277
#define OSS_HISTORY_SIZE 5
278
#define OSS_HISTORY_STRSIZE 256
279
typedef char oss_history_t[OSS_HISTORY_STRSIZE];
280
extern oss_history_t oss_history[OSS_HISTORY_SIZE];
281
extern int oss_history_p;
283
#ifdef LICENSED_VERSION
287
extern void create_new_card (char *shortname, char *longname);
290
* Config option support.
298
extern void oss_load_options (oss_device_t * osdev, oss_option_map_t map[]);
299
extern oss_option_map_t oss_global_options[];
301
extern int detect_trace;
303
extern int oss_num_cards;
304
extern int oss_get_cardinfo (int cardnum, oss_card_info * ci);
305
extern oss_device_t *osdev_create (dev_info_t * dip, int dev_type,
306
int instance, const char *nick,
308
extern oss_device_t *osdev_clone (oss_device_t * orig_osdev,
310
extern void osdev_delete (oss_device_t * osdev);
313
* oss_pci_byteswap() turns on/off hardware level byte swapping.
314
* mode=0 : Don't do byte swapping in the bus interface (default)
315
* mode=1 : Do automatic byte swapping (BE machines) on the bus interface.
317
extern void oss_pci_byteswap (oss_device_t * osdev, int mode);
319
extern void oss_pcie_init (oss_device_t * osdev, int flags);
322
* Process information routines
325
extern int oss_get_procinfo(int what);
326
#define OSS_GET_PROCINFO_UID 1
327
#define OSS_GET_PROCINFO_GID 2
328
#define OSS_GET_PROCINFO_PGID 3
335
extern void oss_audio_set_error (int dev, int mode, int err, int parm);
336
#define OSSERR(cntx, msg) cntx
339
* DMA/cache syncronization macros (should be defined in os.h if they
340
* are necessary for the OS/arch.
343
//# define OSS_DMA_SYNC_INBOUND For direction device to CPU
344
//# define OSS_DMA_SYNC_OUTBOUND For direction CPU to device
345
# define OSS_DMA_SYNC(handle, offs, len, direc) do { \
350
* Ensure that various obsolete OSS 3.x features are not used any more
353
#define osp osp_is_obsolete[]
354
#define CREATE_OSP(osdev) CREATE_OSP_is_obsolete
355
#define printk() printk_is_obsolete
356
#define REQUEST_REGION(start, len, name) REQUEST_REGION_is_obsolete
357
#define CHECK_REGION(start, len) CHECK_REGION_is_obsolete
358
#define RELEASE_REGION(start, len) RELEASE_REGION_is_obsolete
359
#define ALLOCATE_DMA_CHN ALLOCATE_DMA_CHN_is_obsolete
360
#define FREE_DMA_CHN FREE_DMA_CHN_is_obsolete
361
#define OPEN_DMA_CHN OPEN_DMA_CHN_is_obsolete
362
#define CLOSE_DMA_CHN OPEN_DMA_CHN_is_obsolete
363
#if !defined(__bsdi__)
364
#define tenmicrosec(x) tenmicrosec_is_obsolete()
366
#define request_sound_timer(x) request_sound_timer_is_obsolete
367
#define sound_stop_timer(x) sound_stop_timer_is_obsolete
368
#define snd_set_irq_handler(x) snd_set_irq_handler_is_obsolete
369
#define snd_release_irq (vect, x) snd_release_irq_is_obsolete
370
#define conf_printf (name, hw_config) conf_printf_is_obsolete
371
#define conf_printf2 (name, base, irq, dma, dma2) conf_printf2_is_obsolete
372
#define sound_disable_module (void) sound_disable_module_is_obsolete
373
#define IOCTL_GET IOCTL_GET_is_obsolete
374
#define IOCTL_OUT IOCTL_OUT_is_obsolete
375
#define CONTIG_MALLOC_ISA CONTIG_MALLOC_ISA_is_obsolete()