~ubuntu-branches/ubuntu/wily/oss4/wily

« back to all changes in this revision

Viewing changes to kernel/OS/Linux/wrapper/wrap.h

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis, Samuel Thibault, Romain Beauxis, Sebastien NOEL
  • Date: 2011-06-14 10:06:56 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110614100656-cx4oc7u426zn812z
Tags: 4.2-build2004-1
[ Samuel Thibault ]
* debian/control: Add liboss4-salsa2, liboss4-salsa-dev and
  liboss4-salsa-asound2 packages, equivalent to (and will replace) those from
  the oss-libsalsa package (Closes: #589127).
* debian/patches/liboss4-salsa.patch: New patch to rename libsalsa into
  liboss4-salsa to avoid conflicts in the archive for no good reason.
* debian/rules: Make in libOSSlib and libsalsa.
* debian/liboss4-salsa-dev.install, debian/liboss4-salsa2.install,
  debian/liboss4-salsa-asound2.links, debian/liboss4-salsa-dev.links:
  Install liboss4-salsa libraries like was done in the oss-libsalsa package.
* include-alsa: Add a copy of ALSA 1.0.5 headers: Cf ALSA_1.0.* symbols in
  libsalsa, this is the roughly supported version.
* debian/copyright: Update for new include-alsa files.
* alsa.pc: New file for compatibility with libasound-dev.
* debian/control:
  - Add Vcs-Browser and Vcs-Svn fields.
  - Use linux-any instead of the list of Linux archs (Closes: #604679).
  - Make dkms dependency linux-any only.
* debian/patches/hurd_iot.patch: New patch to fix soundcard.h usage in
  libsalsa on hurd-i386.
* debian/patches/libsalsa_fixes.patch: New patch to fix some printf usages
  and ioctl declaration in libsalsa.
* debian/patches/no_EBADE.patch: New patch to cope with hurd-i386 not having
  EBADE.
* debian/patches/CFLAGS.patch: New patch to make oss4 take debian/rules
  CFLAGS into account.
* debian/patches/snd_asoundlib_version.patch: New patch to add
  snd_asoundlib_version().
* debian/patches/generic_srccconf.patch: New patch to fix source
  configuration on unknown archs.

[ Romain Beauxis ]
* Fixed README.Debian to only mention dkms' modules.
* Switch to dpkg-source 3.0 (quilt) format
* Added DM-Upload-Allowed: yes

[ Sebastien NOEL ]
* New upstream release (Closes: #595298, #619272).
* Fix typo in initscript (Closes: #627149).
* debian/control: adjust linux-headers dependencies (Closes: #628879).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Purpose: Wrapper routines for Linux kernel services
 
3
 *
 
4
 * The functions and structures declared here are part of the osscore.c
 
5
 * file that is compiled in the target system. This file must not be
 
6
 * modified in the target system because the precompiled binaries included
 
7
 * in the OSS installation package depend on it too.
 
8
 */
 
9
/*
 
10
 *
 
11
 * This file is part of Open Sound System.
 
12
 *
 
13
 * Copyright (C) 4Front Technologies 1996-2008.
 
14
 *
 
15
 * This this source file is released under GPL v2 license (no other versions).
 
16
 * See the COPYING file included in the main directory of this source
 
17
 * distribution for the license terms and conditions.
 
18
 *
 
19
 */
 
20
 
 
21
/*
 
22
 * Some integer types
 
23
 */
 
24
#if defined(__x86_64__)
 
25
typedef unsigned long long oss_native_word;     /* Same as the address and status register size */
 
26
#else
 
27
typedef unsigned long oss_native_word;  /* Same as the address and status register size */
 
28
#endif
 
29
typedef long long oss_int64_t;                  /* Signed 64 bit integer */
 
30
typedef unsigned long long oss_uint64_t;        /* Unsigned 64 bit integer */
 
31
 
 
32
extern char *oss_strcpy (char *s1, const char *s2);
 
33
extern void *oss_memcpy (void *t_, const void *f_, size_t l);
 
34
extern void *oss_memset (void *t, int val, size_t l);
 
35
extern int oss_strcmp (const char *s1, const char *s2);
 
36
extern size_t oss_strlen (const char *s);
 
37
extern char *oss_strncpy (char *s1, const char *s2, size_t l);
 
38
extern void oss_udelay (unsigned long d);
 
39
 
 
40
typedef struct _oss_mutex_t *oss_mutex_t;
 
41
typedef struct _poll_table_handle oss_poll_table_handle_t;
 
42
typedef struct _file_handle_t oss_file_handle_t;
 
43
 
 
44
struct _oss_poll_event_t
 
45
{
 
46
  short events, revents;
 
47
  oss_poll_table_handle_t *wait;
 
48
  oss_file_handle_t *file;
 
49
};
 
50
typedef struct _oss_poll_event_t oss_poll_event_t;
 
51
 
 
52
extern oss_mutex_t oss_mutex_init (void);
 
53
extern void oss_mutex_cleanup (oss_mutex_t mutex);
 
54
extern void oss_spin_lock_irqsave (oss_mutex_t mutex,
 
55
                                   oss_native_word * flags);
 
56
extern void oss_spin_unlock_irqrestore (oss_mutex_t mutex,
 
57
                                        oss_native_word flags);
 
58
extern void oss_spin_lock (oss_mutex_t mutex);
 
59
extern void oss_spin_unlock (oss_mutex_t mutex);
 
60
extern unsigned long long oss_get_jiffies (void);
 
61
extern char *oss_get_procname (void);
 
62
extern int oss_get_pid (void);
 
63
extern int oss_get_uid (void);
 
64
 
 
65
struct oss_wait_queue;
 
66
struct module;
 
67
struct _oss_device_t;
 
68
struct pci_dev;
 
69
 
 
70
typedef void *oss_dma_handle_t; /* Unused type */
 
71
 
 
72
/*
 
73
 * Sleep/wakeup/poll support. These definitions are duplicates from
 
74
 * oss_config.h which is the official place. Both definitions must match.
 
75
 */
 
76
 
 
77
extern struct oss_wait_queue *oss_create_wait_queue (oss_device_t * osdev,
 
78
                                                     const char *name);
 
79
extern void oss_reset_wait_queue (struct oss_wait_queue *wq);
 
80
extern void oss_remove_wait_queue (struct oss_wait_queue *wq);
 
81
extern int oss_sleep (struct oss_wait_queue *wq, oss_mutex_t * mutex,
 
82
                      int ticks, oss_native_word * flags,
 
83
                      unsigned int *status);
 
84
extern int oss_register_poll (struct oss_wait_queue *wq, oss_mutex_t * mutex,
 
85
                              oss_native_word * flags, oss_poll_event_t * ev);
 
86
extern void oss_wakeup (struct oss_wait_queue *wq, oss_mutex_t * mutex,
 
87
                        oss_native_word * flags, short events);
 
88
 
 
89
extern void oss_cmn_err (int level, const char *format, ...);
 
90
#define CE_CONT         0
 
91
#define CE_NOTE         1
 
92
#define CE_WARN         2
 
93
#define CE_PANIC        3
 
94
 
 
95
typedef int timeout_id_t;
 
96
extern timeout_id_t oss_timeout (void (*func) (void *), void *arg,
 
97
                                 unsigned long long ticks);
 
98
extern void oss_untimeout (timeout_id_t id);
 
99
 
 
100
extern int sprintf (char *buf, const char *s, ...);
 
101
 
 
102
typedef enum uio_rw
 
103
{ UIO_READ, UIO_WRITE } uio_rw_t;
 
104
struct uio
 
105
{
 
106
  char *ptr;
 
107
  int resid;
 
108
  int kernel_space;             /* Set if this uio points to a kernel space buffer */
 
109
  uio_rw_t rw;
 
110
};
 
111
typedef struct uio uio_t;
 
112
 
 
113
extern int oss_uiomove (void *address, size_t nbytes, enum uio_rw rwflag,
 
114
                        uio_t * uio_p);
 
115
extern int oss_create_uio (uio_t * uiop, char *buf, size_t count, uio_rw_t rw,
 
116
                           int is_kernel);
 
117
extern void *oss_kmem_alloc (size_t size);
 
118
extern void oss_kmem_free (void *addr);
 
119
extern void *oss_pmalloc (size_t sz);
 
120
extern oss_native_word oss_virt_to_bus (void *addr);
 
121
extern void oss_reserve_pages (oss_native_word start_addr,
 
122
                               oss_native_word end_addr);
 
123
extern void oss_unreserve_pages (oss_native_word start_addr,
 
124
                                 oss_native_word end_addr);
 
125
extern void *oss_contig_malloc (oss_device_t * osdev, int sz,
 
126
                                oss_uint64_t memlimit,
 
127
                                oss_native_word * phaddr);
 
128
extern void oss_contig_free (oss_device_t * osdev, void *p, int sz);
 
129
 
 
130
extern time_t oss_get_time (void);
 
131
 
 
132
typedef struct _inode_handle_t oss_inode_handle_t;
 
133
typedef struct _vm_aread_handle oss_vm_area_handle_t;
 
134
 
 
135
extern int oss_vma_get_flags (oss_vm_area_handle_t *);
 
136
 
 
137
typedef struct oss_file_operation_handle
 
138
{
 
139
  ssize_t (*read) (oss_file_handle_t *, char *, size_t, loff_t *);
 
140
  ssize_t (*write) (oss_file_handle_t *, char *, size_t, loff_t *);
 
141
  int (*readdir) (oss_inode_handle_t *, oss_file_handle_t *, void *, int);
 
142
  unsigned int (*poll) (oss_file_handle_t *, oss_poll_table_handle_t *);
 
143
  int (*ioctl) (oss_inode_handle_t *, oss_file_handle_t *, unsigned int,
 
144
                unsigned long);
 
145
  int (*mmap) (oss_file_handle_t *, oss_vm_area_handle_t *);
 
146
  int (*open) (oss_inode_handle_t *, oss_file_handle_t *);
 
147
  int (*release) (oss_inode_handle_t *, oss_file_handle_t *);
 
148
  long (*compat_ioctl) (oss_file_handle_t *, unsigned int, unsigned long);
 
149
  long (*unlocked_ioctl) (oss_file_handle_t *, unsigned int, unsigned long);
 
150
  int (*fsync) (oss_inode_handle_t *, oss_file_handle_t *);
 
151
  int (*fasync) (oss_inode_handle_t *, oss_file_handle_t *, int);
 
152
}
 
153
oss_file_operation_handle_t;
 
154
 
 
155
extern int oss_do_mmap (oss_vm_area_handle_t * vma,
 
156
                        oss_native_word dmabuf_phys, int bytes_in_use);
 
157
extern int oss_register_chrdev (oss_device_t * osdev, unsigned int major,
 
158
                                const char *name,
 
159
                                oss_file_operation_handle_t * op);
 
160
extern void oss_register_minor (int major, int minor, char *name);
 
161
extern int oss_unregister_chrdev (unsigned int major, const char *name);
 
162
 
 
163
extern int oss_inode_get_minor (oss_inode_handle_t * inode);
 
164
extern int oss_file_get_flags (oss_file_handle_t * file);
 
165
extern void *oss_file_get_private (oss_file_handle_t * file);
 
166
extern void oss_file_set_private (oss_file_handle_t * file, void *v);
 
167
 
 
168
extern void oss_inc_refcounts (void);
 
169
extern void oss_dec_refcounts (void);
 
170
 
 
171
/*
 
172
 * Redefinitions of some routines defined in oss_config.h
 
173
 * just to ensure they are defined in the same way in both places. The
 
174
 * osscore/wrapper modules only include wrap.h so they can't see the "official"
 
175
 * declarations in oss_config.h.
 
176
 */
 
177
 
 
178
typedef struct _dev_info_t dev_info_t;
 
179
extern dev_info_t *oss_create_pcidip (struct pci_dev *pcidev);
 
180
extern oss_device_t *osdev_create (dev_info_t * dip, int dev_type,
 
181
                                   int instance, const char *nick,
 
182
                                   const char *handle);
 
183
 
 
184
extern void osdev_delete (oss_device_t * osdev);
 
185
 
 
186
/*
 
187
 * PCI config space access (in osscore.c)
 
188
 */
 
189
extern char *oss_pci_read_devpath (dev_info_t * dip);
 
190
extern int osscore_pci_read_config_byte (dev_info_t * dip, unsigned int where,
 
191
                                         unsigned char *val);
 
192
extern int osscore_pci_read_config_irq (dev_info_t * dip, unsigned int where,
 
193
                                        unsigned char *val);
 
194
extern int osscore_pci_read_config_word (dev_info_t * dip, unsigned int where,
 
195
                                         unsigned short *val);
 
196
extern int osscore_pci_read_config_dword (dev_info_t * dip,
 
197
                                          unsigned int where,
 
198
                                          unsigned int *val);
 
199
extern int osscore_pci_write_config_byte (dev_info_t * dip,
 
200
                                          unsigned int where,
 
201
                                          unsigned char val);
 
202
extern int osscore_pci_write_config_word (dev_info_t * dip,
 
203
                                          unsigned int where,
 
204
                                          unsigned short val);
 
205
extern int osscore_pci_write_config_dword (dev_info_t * dip,
 
206
                                           unsigned int where,
 
207
                                           unsigned int val);
 
208
 
 
209
extern int osscore_pci_enable_msi (dev_info_t * dip);
 
210
 
 
211
extern void *oss_map_pci_mem (oss_device_t * osdev, int size,
 
212
                              unsigned long offset);
 
213
 
 
214
extern void oss_unmap_pci_mem (void *addr);
 
215
 
 
216
extern int oss_copy_to_user (void *to, const void *from, unsigned long n);
 
217
extern int oss_copy_from_user (void *to, const void *from, unsigned long n);
 
218
 
 
219
extern void oss_register_module (struct module *mod);
 
220
extern void oss_unregister_module (struct module *mod);
 
221
 
 
222
#ifdef _KERNEL
 
223
extern char *oss_strcpy (char *s1, const char *s2);
 
224
#undef strcpy
 
225
#define strcpy oss_strcpy
 
226
 
 
227
extern void *oss_memcpy (void *t_, const void *f_, size_t l);
 
228
#undef memcpy
 
229
#define memcpy oss_memcpy
 
230
 
 
231
extern void *oss_memset (void *t, int val, size_t l);
 
232
#undef memset
 
233
#define memset oss_memset
 
234
 
 
235
extern int oss_strcmp (const char *s1, const char *s2);
 
236
#undef strcmp
 
237
#define strcmp oss_strcmp
 
238
extern int oss_strncmp (const char *s1, const char *s2, size_t len);
 
239
#undef strncmp
 
240
#define strncmp oss_strncmp
 
241
 
 
242
#undef strlen
 
243
#define strlen oss_strlen
 
244
 
 
245
#undef strncpy
 
246
#define strncpy oss_strncpy
 
247
#endif // KERNEL
 
248
 
 
249
#undef timeout
 
250
#define timeout oss_timeout
 
251
 
 
252
#undef untimeout
 
253
#define untimeout oss_untimeout
 
254
 
 
255
#define drv_usecwait oss_udelay
 
256
 
 
257
#define uiomove oss_uiomove
 
258
 
 
259
#define cmn_err oss_cmn_err
 
260
 
 
261
struct fileinfo
 
262
{
 
263
  int mode;                     /* Open mode */
 
264
  int acc_flags;
 
265
};
 
266
#define ISSET_FILE_FLAG(fileinfo, flag)  (fileinfo->acc_flags & (flag) ? 1:0)
 
267
 
 
268
/*
 
269
 * USB related definitions
 
270
 */
 
271
typedef struct udi_usb_devc udi_usb_devc;
 
272
 
 
273
/*
 
274
 * Functions exported by os.c
 
275
 */
 
276
extern int oss_init_osscore (oss_device_t * osdev);
 
277
extern void oss_uninit_osscore (oss_device_t * osdev);
 
278
extern void osdev_set_owner (oss_device_t * osdev, struct module *owner);
 
279
extern void osdev_set_major (oss_device_t * osdev, int major);
 
280
extern void osdev_set_irqparms (oss_device_t * osdev, void *irqparms);
 
281
extern void *osdev_get_irqparms (oss_device_t * osdev);
 
282
extern void oss_inc_intrcount(oss_device_t *osdev, int claimed);
 
283
extern struct module *osdev_get_owner (oss_device_t * osdev);
 
284
extern char *osdev_get_nick (oss_device_t * osdev);
 
285
extern int osdev_get_instance (oss_device_t * osdev);
 
286
extern int oss_request_major (oss_device_t * osdev, int major, char *module);
 
287
extern int oss_register_device (oss_device_t * osdev, const char *name);        /* from oss_config.h */
 
288