~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

« back to all changes in this revision

Viewing changes to kernel/framework/include/oss_config.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-16 20:37:48 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110616203748-jbrxik6ql33z54co
Tags: 4.2-build2004-1ubuntu1
* Merge from Debian unstable.
  - Supports our current kernel (LP: #746048)
  Remaining changes:
  - debian/oss4-dkms.dkms.in: s/source/build/ in Kernel headers paths.
* ld-as-needed.patch: Re-order CC arguments to enable building with ld
  --as-needed (LP: #770972)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* oss_config.h
 
2
 *
 
3
 * Purpose: The top level header file for compiling OSS itself.
 
4
 *
 
5
 * This is the mother of all headers in OSS. All core files should include this
 
6
 * file.
 
7
 *
 
8
 * However low level drivers must never include this file. Instead they should
 
9
 * use the autogenerated drv_cfg.h file.
 
10
 */
 
11
/*
 
12
 *
 
13
 * This file is part of Open Sound System.
 
14
 *
 
15
 * Copyright (C) 4Front Technologies 1996-2008.
 
16
 *
 
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.
 
20
 *
 
21
 */
 
22
 
 
23
#ifndef OSS_CONFIG_H
 
24
#define OSS_CONFIG_H
 
25
 
 
26
#define NEW_DEVICE_NAMING       /* /dev/sblive0_dsp0 instead of /dev/dsp0 and so on */
 
27
 
 
28
#include "soundcard.h"
 
29
 
 
30
struct _oss_device_t;
 
31
typedef int *ioctl_arg;
 
32
 
 
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);
 
36
 
 
37
#include <ossddk/oss_exports.h>
 
38
#include <local_config.h>
 
39
#include <os.h>
 
40
 
 
41
#include <ossddk/ossddk.h>
 
42
 
 
43
#ifndef OS_VERSION
 
44
#error OS_VERSION not defined in os.h
 
45
#endif
 
46
 
 
47
/*
 
48
 * Memory block allocation (oss_memblk.h/c)
 
49
 */
 
50
#include <oss_memblk.h>
 
51
 
 
52
/*
 
53
 * Memory allocation/free routines for structures to be freed automatically
 
54
 * when OSS is unloaded.
 
55
 */
 
56
#define PMALLOC(osdev, size) oss_memblk_malloc(&oss_global_memblk, size)
 
57
#define PMFREE(osdev, addr) oss_memblk_free(&oss_global_memblk, addr)
 
58
 
 
59
/*
 
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
 
64
 * (ossdevlinks).
 
65
 */
 
66
#undef  MANAGE_DEV_DSP
 
67
 
 
68
#ifndef ERESTARTSYS
 
69
#define ERESTARTSYS EAGAIN
 
70
#endif
 
71
 
 
72
#ifndef OSS_HZ
 
73
#define OSS_HZ HZ
 
74
#endif
 
75
 
 
76
#ifndef OSS_PAGE_MASK
 
77
#define OSS_PAGE_MASK (-1)
 
78
#endif
 
79
 
 
80
#ifndef HW_PRINTF
 
81
#define HW_PRINTF(x)
 
82
#endif
 
83
 
 
84
#ifndef GET_PROCESS_NAME
 
85
#define GET_PROCESS_NAME() NULL
 
86
#endif
 
87
 
 
88
#ifndef GET_PROCESS_PID
 
89
#define GET_PROCESS_PID() -1
 
90
#endif
 
91
 
 
92
#ifndef FMA_EREPORT
 
93
/* FMA is only available under Solaris */
 
94
#define FMA_EREPORT(osdev, detail, name, type, value)
 
95
#define FMA_IMPACT(osdev, impact)
 
96
#endif
 
97
 
 
98
#include "oss_version.h"
 
99
/* #include "aw.h" */
 
100
#define EXCLUDE_GUS_IODETECT
 
101
 
 
102
#ifndef IOC_IS_OUTPUT
 
103
#define IOC_IS_OUTPUT(cmd) cmd & SIOC_IN
 
104
#endif
 
105
 
 
106
#define DSP_DEFAULT_SPEED       48000
 
107
#define DSP_DEFAULT_FMT         AFMT_S16_LE
 
108
 
 
109
#define ON              1
 
110
#define OFF             0
 
111
 
 
112
typedef struct oss_wait_queue oss_wait_queue_t;
 
113
 
 
114
#include "audio_core.h"
 
115
#include "mixer_core.h"
 
116
#include "oss_calls.h"
 
117
#include "internal.h"
 
118
 
 
119
#ifndef DEB
 
120
#define DEB(x)
 
121
#endif
 
122
 
 
123
#ifndef DDB
 
124
#define DDB(x)  {}
 
125
#endif
 
126
 
 
127
#ifndef CDB
 
128
#define CDB(x)  {}
 
129
#endif
 
130
 
 
131
#define TIMER_ARMED     121234
 
132
#define TIMER_NOT_ARMED 1
 
133
 
 
134
#ifdef DO_MEMDEBUG
 
135
extern void oss_vmem_check (char *file, int line, oss_native_word offs,
 
136
                            int bytes);
 
137
extern void oss_pmem_check (char *file, int line, oss_native_word offs,
 
138
                            int bytes);
 
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)
 
141
#else
 
142
# define VMEM_CHECK(offs, bytes)
 
143
# define PMEM_CHECK(offs, bytes)
 
144
#endif
 
145
 
 
146
#ifndef OSS_BIG_ENDIAN
 
147
#define USE_REMUX
 
148
#endif
 
149
 
 
150
typedef struct
 
151
{
 
152
  char *const key, *const name;
 
153
} oss_device_table_t;
 
154
 
 
155
 
 
156
typedef struct
 
157
{
 
158
#ifdef _KERNEL
 
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);
 
167
#else
 
168
  int dummy;
 
169
#endif
 
170
} oss_cdev_drv_t;
 
171
 
 
172
typedef struct _oss_cdev_t oss_cdev_t;
 
173
 
 
174
struct _oss_cdev_t
 
175
{
 
176
#ifdef DEV_HDR
 
177
  DEV_HDR devHdr;
 
178
#endif
 
179
  oss_cdev_t *hl;       /* Hash link (for operating system ports that use it) */
 
180
  int minor;
 
181
  int dev_class;
 
182
  int instance;
 
183
  oss_cdev_drv_t *d;
 
184
  char name[32];
 
185
  oss_device_t *osdev;
 
186
  void *info;
 
187
  int active;
 
188
  int open_count;
 
189
  struct fileinfo file;
 
190
};
 
191
 
 
192
extern oss_cdev_t **oss_cdevs;
 
193
extern int oss_num_cdevs;
 
194
 
 
195
/*
 
196
 * Global initialization and cleanup functions (common to all operating systems)
 
197
 */
 
198
extern void oss_common_init (oss_device_t * osdev);
 
199
extern void oss_unload_drivers (void);
 
200
/*
 
201
 * The following calls are operating system dependent. They should be defined
 
202
 * in os.c for each operating system.
 
203
 */
 
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);
 
217
 
 
218
/*
 
219
 * DMA buffer management
 
220
 */
 
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);
 
224
/* Alloc flags */
 
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 */
 
230
/* Maxaddr defs */
 
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);
 
238
 
 
239
/*
 
240
 * Device management routines
 
241
 */
 
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);
 
245
/*
 
246
 * Sleep/wakeup support (os.c)
 
247
 */
 
248
extern oss_wait_queue_t *oss_create_wait_queue (oss_device_t * osdev,
 
249
                                                const char *name);
 
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);
 
258
/*
 
259
 * Wait status flags (make sure these match osscore.c for Linux)
 
260
 */
 
261
#define WK_NONE         0x00
 
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
 
267
 
 
268
/*
 
269
 * Mutex hierarchy levels
 
270
 * Used by LOCK_ALLOC in UnixWare/OpenServer
 
271
 */
 
272
#define MH_GLOBAL       1
 
273
#define MH_FRAMEW       5
 
274
#define MH_DRV          10
 
275
#define MH_TOP          20
 
276
 
 
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;
 
282
 
 
283
#ifdef LICENSED_VERSION
 
284
#include <license.h>
 
285
#endif
 
286
 
 
287
extern void create_new_card (char *shortname, char *longname);
 
288
 
 
289
/*
 
290
 * Config option support.
 
291
 */
 
292
typedef struct
 
293
{
 
294
  char *name;
 
295
  int *ptr;
 
296
} oss_option_map_t;
 
297
 
 
298
extern void oss_load_options (oss_device_t * osdev, oss_option_map_t map[]);
 
299
extern oss_option_map_t oss_global_options[];
 
300
 
 
301
extern int detect_trace;
 
302
 
 
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,
 
307
                                   const char *handle);
 
308
extern oss_device_t *osdev_clone (oss_device_t * orig_osdev,
 
309
                                  int new_instance);
 
310
extern void osdev_delete (oss_device_t * osdev);
 
311
 
 
312
/*
 
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.
 
316
 */
 
317
extern void oss_pci_byteswap (oss_device_t * osdev, int mode);
 
318
 
 
319
extern void oss_pcie_init (oss_device_t * osdev, int flags);
 
320
 
 
321
/*
 
322
 * Process information routines
 
323
 */
 
324
 
 
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
 
329
 
 
330
/*
 
331
 * Error reporting
 
332
 */
 
333
#define E_REC   1
 
334
#define E_PLAY  2
 
335
extern void oss_audio_set_error (int dev, int mode, int err, int parm);
 
336
#define OSSERR(cntx, msg) cntx
 
337
 
 
338
/*
 
339
 * DMA/cache syncronization macros (should be defined in os.h if they
 
340
 * are necessary for the OS/arch.
 
341
 */
 
342
#ifndef OSS_DMA_SYNC
 
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 { \
 
346
  } while (0)
 
347
#endif
 
348
 
 
349
/*
 
350
 * Ensure that various obsolete OSS 3.x features are not used any more
 
351
 * in the drivers.
 
352
 */
 
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()
 
365
#endif
 
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()
 
376
 
 
377
#endif