~ubuntu-branches/ubuntu/vivid/oss4/vivid

« back to all changes in this revision

Viewing changes to setup/Linux/oss/build/module.inc

  • 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: Template for OSS modules under Linux
 
3
 *
 
4
 * This file is included by the low level driver modules when they are
 
5
 * compiled in the target system. In this way this file can be modified
 
6
 * for non-standard kernels by the customer. Compiling in the target is
 
7
 * necessary because the driver/module framework of Linux cannot support
 
8
 * binary drivers. Another reason is that the kbuild mechanism used to build
 
9
 * kernel modules under Linux is not compatible with the way how the source
 
10
 * code of OSS is organized.
 
11
 */
 
12
/*
 
13
 * Copyright (C) 4Front Technologies 2005-2007. Released under GPL2 license.
 
14
 */
 
15
#define strcpy dummy_strcpy
 
16
#include <linux/version.h>
 
17
#include <linux/init.h>
 
18
#include <linux/module.h>
 
19
#include <linux/errno.h>
 
20
#include <linux/kernel.h>
 
21
#include <linux/pci.h>
 
22
#include "timestamp.h"
 
23
#include "oss_exports.h"
 
24
#include "wrap.h"
 
25
#include "ossddk.h"
 
26
#include "ossdip.h"
 
27
#undef strcpy
 
28
#define strcpy oss_strcpy
 
29
#undef strlen
 
30
#define strlen oss_strlen
 
31
 
 
32
static int module_major = 0;
 
33
static int instance = 0;
 
34
 
 
35
MODULE_LICENSE ("GPL v2");
 
36
MODULE_DESCRIPTION ("Open Sound System '" DRIVER_PURPOSE "' driver module");
 
37
MODULE_AUTHOR ("4Front Technologies (support@opensound.com)");
 
38
 
 
39
extern int DRIVER_ATTACH (oss_device_t * osdev);
 
40
extern int DRIVER_DETACH (oss_device_t * osdev);
 
41
 
 
42
#if DRIVER_TYPE==DRV_PCI
 
43
#define DRIVER_TYPE_OK
 
44
 
 
45
#include "pci_wrapper.inc"
 
46
 
 
47
// MODULE_DEVICE_TABLE(pci, id_table);
 
48
static struct pci_driver osspci_driver = {
 
49
  .name = DRIVER_NICK,
 
50
  .id_table = id_table,
 
51
  .probe = osspci_probe,
 
52
  .remove = osspci_remove
 
53
};
 
54
 
 
55
static int __init
 
56
pcidrv_init (void)
 
57
{
 
58
  int err;
 
59
 
 
60
  if ((err = pci_register_driver (&osspci_driver)) < 0)
 
61
    return err;
 
62
  oss_register_module (THIS_MODULE);
 
63
  return 0;
 
64
}
 
65
 
 
66
static void __exit
 
67
pcidrv_exit (void)
 
68
{
 
69
  if (module_major > 0)
 
70
    {
 
71
      oss_unregister_chrdev (module_major, DRIVER_NICK);
 
72
    }
 
73
  pci_unregister_driver (&osspci_driver);
 
74
  oss_unregister_module (THIS_MODULE);
 
75
}
 
76
 
 
77
module_init (pcidrv_init);
 
78
module_exit (pcidrv_exit);
 
79
#endif /* PCI driver */
 
80
 
 
81
#if DRIVER_TYPE==DRV_VIRTUAL || DRIVER_TYPE==DRV_VMIX
 
82
#define DRIVER_TYPE_OK
 
83
static oss_device_t *osdev = NULL;
 
84
 
 
85
static int
 
86
virtualdrv_init (void)
 
87
{
 
88
  static int instance = 0, maj;
 
89
 
 
90
  if ((osdev =
 
91
       osdev_create (NULL, DRIVER_TYPE, instance++, DRIVER_NICK,
 
92
                     NULL)) == NULL)
 
93
    {
 
94
      return -ENOMEM;
 
95
    }
 
96
  osdev_set_owner (osdev, THIS_MODULE);
 
97
  maj = oss_request_major (osdev, 0, DRIVER_NICK);
 
98
  osdev_set_major (osdev, maj);
 
99
  if (!DRIVER_ATTACH (osdev))
 
100
    return -EIO;
 
101
  oss_register_module (THIS_MODULE);
 
102
  oss_audio_delayed_attach ();
 
103
  return 0;
 
104
}
 
105
 
 
106
static void
 
107
virtualdrv_exit (void)
 
108
{
 
109
 
 
110
  if (!DRIVER_DETACH (osdev))
 
111
    printk (KERN_ALERT DRIVER_NICK ": Unloading busy device\n");
 
112
  osdev_delete (osdev);
 
113
  oss_unregister_module (THIS_MODULE);
 
114
}
 
115
 
 
116
module_init (virtualdrv_init);
 
117
module_exit (virtualdrv_exit);
 
118
#endif /* Virtual driver */
 
119
 
 
120
#if DRIVER_TYPE==DRV_USB
 
121
#define DRIVER_TYPE_OK
 
122
oss_device_t *osdev = NULL;
 
123
static int usb_major = 0;
 
124
 
 
125
#include "usb_wrapper.inc"
 
126
 
 
127
static int
 
128
usbdrv_init (void)
 
129
{
 
130
  int res;
 
131
 
 
132
  if (udi_usb_installed)
 
133
    return 0;
 
134
  if ((osdev =
 
135
       osdev_create (NULL, DRV_VIRTUAL, instance++, DRIVER_NICK,
 
136
                     NULL)) == NULL)
 
137
    {
 
138
      return -ENOMEM;
 
139
    }
 
140
  osdev_set_owner (osdev, THIS_MODULE);
 
141
  usb_major = oss_request_major (osdev, 0, DRIVER_NICK);
 
142
  if (usb_major < 0)
 
143
    {
 
144
      oss_cmn_err (CE_WARN, "Failed to allocate USB major (%d)\n", usb_major);
 
145
      return -EIO;
 
146
    }
 
147
  osdev_set_major (osdev, usb_major);
 
148
  oss_register_device (osdev, "USB audio core services");
 
149
  if (!DRIVER_ATTACH (osdev))
 
150
    return -EIO;
 
151
  oss_register_module (THIS_MODULE);
 
152
  oss_audio_delayed_attach ();
 
153
 
 
154
  udi_usb_installed = 1;
 
155
 
 
156
  if ((res = usb_register (&oss_usb)) < 0)
 
157
    {
 
158
      printk ("oss: usb_register failed, err=%d\n", res);
 
159
      drv = NULL;
 
160
      return -ENXIO;
 
161
    }
 
162
  return 0;
 
163
}
 
164
 
 
165
static void
 
166
usbdrv_exit (void)
 
167
{
 
168
  if (!udi_usb_installed)
 
169
    return;
 
170
  if (!DRIVER_DETACH (osdev))
 
171
    printk (KERN_ALERT DRIVER_NICK ": Unloading busy device\n");
 
172
  usb_deregister (&oss_usb);
 
173
  udi_usb_installed = 0;
 
174
  known_devices = NULL;
 
175
  osdev_delete (osdev);
 
176
  osdev = NULL;
 
177
  oss_unregister_module (THIS_MODULE);
 
178
}
 
179
 
 
180
module_init (usbdrv_init);
 
181
module_exit (usbdrv_exit);
 
182
#endif /* USB driver */
 
183
 
 
184
#ifndef DRIVER_TYPE_OK
 
185
#error Unrecognized driver type
 
186
#endif
 
187
 
 
188
char *
 
189
strcpy (char *s1, const char *s2)
 
190
{
 
191
  char *s = s1;
 
192
 
 
193
  while (*s2)
 
194
    *s1++ = *s2++;
 
195
  *s1 = 0;
 
196
  return s;
 
197
}
 
198
 
 
199
void
 
200
oss_cmn_err (int level, const char *s, ...)
 
201
{
 
202
  char tmp[1024], *a[6];
 
203
  va_list ap;
 
204
  int i, n = 0;
 
205
 
 
206
  va_start (ap, s);
 
207
 
 
208
  for (i = 0; i < strlen (s); i++)
 
209
    if (s[i] == '%')
 
210
      n++;
 
211
 
 
212
  for (i = 0; i < n && i < 6; i++)
 
213
    {
 
214
      a[i] = va_arg (ap, char *);
 
215
    }
 
216
 
 
217
  for (i = n; i < 6; i++)
 
218
    a[i] = NULL;
 
219
 
 
220
  if (level == CE_CONT)
 
221
    {
 
222
      sprintf (tmp, s, a[0], a[1], a[2], a[3], a[4], a[5], NULL,
 
223
               NULL, NULL, NULL);
 
224
      printk ("%s", tmp);
 
225
    }
 
226
  else
 
227
    {
 
228
      strcpy (tmp, DRIVER_NICK ": ");
 
229
 
 
230
      sprintf (tmp + strlen (tmp), s, a[0], a[1], a[2], a[3], a[4], a[5],
 
231
               NULL, NULL, NULL, NULL);
 
232
      if (level == CE_PANIC)
 
233
        panic (tmp);
 
234
      printk (KERN_ALERT "%s", tmp);
 
235
    }
 
236
#if 0
 
237
  /* This may cause a crash under SMP */
 
238
  if (sound_started)
 
239
    store_msg (tmp);
 
240
#endif
 
241
 
 
242
  va_end (ap);
 
243
}
 
244
 
 
245
#include "osscore_symbols.inc"