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

« back to all changes in this revision

Viewing changes to .pc/libsalsa_fixes.patch/lib/libsalsa/timer.c

  • Committer: Package Import Robot
  • Author(s): Sebastien NOEL
  • Date: 2012-11-19 11:47:24 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20121119114724-svu8mq7x3pk64nez
Tags: 4.2-build2007-1
* New upstream release.
* Acknowledge NMU, thanks Michael Gilbert.
* Add debian/patches/110_ld-as-needed.patch: Rearrange order of linker
  arguments to fix building with "ld --as-needed" (closes: #630737).
* Add missing dependency on dpkg-dev to oss4-dkms and oss4-source
  (closes: #687086).
* Fix typo in the changelog (closes: #628876, #675933)
* Add debian/patches/002_fix-linux-oss_native_word.patch (closes: #693657).
  Thanks to Ben Hutchings.
* Add debian/patches/003_linux-error-logging-fixes.patch (closes: #693657).
  Thanks to Ben Hutchings.
* check for /lib/modules/${kernelver}/build in addition of
  /lib/modules/${kernelver}/source (closes: #587191).
* oss4-dkms.dkms.in: fix 'CLEAN' rules (closes: #653374).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (c) 2004 by Hannu Savolainen < hannu@opensound.com>
3
 
 *
4
 
 *   This library is free software; you can redistribute it and/or modify
5
 
 *   it under the terms of the GNU Lesser General Public License version 2.1 as
6
 
 *   published by the Free Software Foundation.
7
 
 *
8
 
 *   This program is distributed in the hope that it will be useful,
9
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 *   GNU Lesser General Public License for more details.
12
 
 *
13
 
 *   You should have received a copy of the GNU Lesser General Public
14
 
 *   License along with this library; if not, write to the Free Software
15
 
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16
 
 *
17
 
 */
18
 
#include <stdio.h>
19
 
#include "local.h"
20
 
 
21
 
struct _snd_timer
22
 
{
23
 
  int dummy;
24
 
};
25
 
 
26
 
struct _snd_timer_id
27
 
{
28
 
  int dummy;
29
 
};
30
 
 
31
 
struct _snd_timer_info
32
 
{
33
 
  int dummy;
34
 
};
35
 
 
36
 
/**
37
 
 * \brief Opens a new connection to the timer interface.
38
 
 * \param timer Returned handle (NULL if not wanted)
39
 
 * \param name ASCII identifier of the timer handle
40
 
 * \param mode Open mode
41
 
 * \return 0 on success otherwise a negative error code
42
 
 *
43
 
 * Opens a new connection to the timer interface specified with
44
 
 * an ASCII identifier and mode.
45
 
 */
46
 
int
47
 
snd_timer_open (snd_timer_t ** tmr, const char *name, int mode)
48
 
{
49
 
  snd_timer_t *timer;
50
 
 
51
 
  ALIB_INIT ();
52
 
  if (!alib_appcheck ())
53
 
    {
54
 
      dbg_printf ("snd_timer_open(%s, %x) refused,\n", name, mode);
55
 
      return -ENODEV;
56
 
    }
57
 
 
58
 
  timer = malloc (sizeof (*timer));
59
 
 
60
 
  dbg_printf ("snd_timer_open(name='%s', mode=%x)=%x\n", name, mode, timer);
61
 
 
62
 
  if (timer == NULL)
63
 
    return -ENOMEM;
64
 
 
65
 
  *tmr = timer;
66
 
 
67
 
  return 0;
68
 
}
69
 
 
70
 
/**
71
 
 * \brief close timer handle
72
 
 * \param timer timer handle
73
 
 * \return 0 on success otherwise a negative error code
74
 
 *
75
 
 * Closes the specified timer handle and frees all associated
76
 
 * resources.
77
 
 */
78
 
int
79
 
snd_timer_close (snd_timer_t * timer)
80
 
{
81
 
  dbg_printf ("snd_timer_close(%x)\n", timer);
82
 
 
83
 
  free (timer);
84
 
  return 0;
85
 
}
86
 
 
87
 
/**
88
 
 * \brief get size of the snd_timer_id_t structure in bytes
89
 
 * \return size of the snd_timer_id_t structure in bytes
90
 
 */
91
 
size_t
92
 
snd_timer_id_sizeof ()
93
 
{
94
 
  return sizeof (snd_timer_id_t);
95
 
}
96
 
 
97
 
/**
98
 
 * \brief get timer card
99
 
 * \param params pointer to #snd_timer_id_t structure
100
 
 * \return timer card number
101
 
 */
102
 
int
103
 
snd_timer_id_get_card (snd_timer_id_t * tid)
104
 
{
105
 
  dbg_printf ("snd_timer_id_get_card(tid=%x)\n", tid);
106
 
 
107
 
  return 0;                     // TODO
108
 
}
109
 
 
110
 
/**
111
 
 * \brief get timer class
112
 
 * \param tid pointer to #snd_timer_id_t structure
113
 
 * \return timer class
114
 
 */
115
 
int
116
 
snd_timer_id_get_class (snd_timer_id_t * tid)
117
 
{
118
 
  dbg_printf ("snd_timer_id_get_class(tid=%x)\n", tid);
119
 
 
120
 
  return 0;                     // TODO
121
 
}
122
 
 
123
 
 
124
 
/**
125
 
 * \brief get timer device
126
 
 * \param params pointer to #snd_timer_id_t structure
127
 
 * \return timer device number
128
 
 */
129
 
int
130
 
snd_timer_id_get_device (snd_timer_id_t * tid)
131
 
{
132
 
  dbg_printf ("snd_timer_id_get_device(tid=%x)\n", tid);
133
 
 
134
 
  return 0;                     // TODO
135
 
}
136
 
 
137
 
/**
138
 
 * \brief get timer sub-class
139
 
 * \param params pointer to #snd_timer_id_t structure
140
 
 * \return timer sub-class
141
 
 */
142
 
int
143
 
snd_timer_id_get_sclass (snd_timer_id_t * tid)
144
 
{
145
 
  dbg_printf ("snd_timer_id_get_sclass(tid=%x)\n", tid);
146
 
 
147
 
  return 0;                     // TODO
148
 
}
149
 
 
150
 
/**
151
 
 * \brief get timer subdevice
152
 
 * \param params pointer to #snd_timer_id_t structure
153
 
 * \return timer subdevice number
154
 
 */
155
 
int
156
 
snd_timer_id_get_subdevice (snd_timer_id_t * tid)
157
 
{
158
 
  dbg_printf ("snd_timer_id_get_subdevice(tid=%x)\n", tid);
159
 
 
160
 
  return 0;                     // TODO
161
 
}
162
 
 
163
 
/**
164
 
 * \brief set timer card
165
 
 * \param tid pointer to #snd_timer_id_t structure
166
 
 * \param card card number
167
 
 */
168
 
void
169
 
snd_timer_id_set_card (snd_timer_id_t * tid, int card)
170
 
{
171
 
  dbg_printf ("snd_timer_id_set_card(tid=%x, card=%d)\n", tid, card);
172
 
 
173
 
  // TODO
174
 
}
175
 
 
176
 
/**
177
 
 * \brief set timer class
178
 
 * \param tid pointer to #snd_timer_id_t structure
179
 
 * \param dev_class class of timer device
180
 
 */
181
 
void
182
 
snd_timer_id_set_class (snd_timer_id_t * tid, int dev_class)
183
 
{
184
 
  dbg_printf ("snd_timer_id_set_class(tid=%x, dev_class=%d)\n", tid,
185
 
              dev_class);
186
 
  // TODO
187
 
}
188
 
 
189
 
/**
190
 
 * \brief set timer device
191
 
 * \param tid pointer to #snd_timer_id_t structure
192
 
 * \param device device number
193
 
 */
194
 
void
195
 
snd_timer_id_set_device (snd_timer_id_t * tid, int device)
196
 
{
197
 
  dbg_printf ("snd_timer_id_set_device(tid=%x, device=%d)\n", tid, device);
198
 
 
199
 
  // TODO
200
 
}
201
 
 
202
 
/**
203
 
 * \brief set timer sub-class
204
 
 * \param tid pointer to #snd_timer_id_t structure
205
 
 * \param dev_sclass sub-class of timer device
206
 
 */
207
 
void
208
 
snd_timer_id_set_sclass (snd_timer_id_t * tid, int dev_sclass)
209
 
{
210
 
  dbg_printf ("snd_timer_id_set_sclass(tid=%x, dev_sclass=%d)\n",
211
 
              tid, dev_sclass);
212
 
  // TODO
213
 
}
214
 
 
215
 
/**
216
 
 * \brief set timer subdevice
217
 
 * \param tid pointer to #snd_timer_id_t structure
218
 
 * \param subdevice subdevice number
219
 
 */
220
 
void
221
 
snd_timer_id_set_subdevice (snd_timer_id_t * tid, int subdevice)
222
 
{
223
 
  dbg_printf ("snd_timer_id_set_subdevice(tid=%x, subdevice=%d)\n",
224
 
              tid, subdevice);
225
 
 
226
 
  // TODO
227
 
}
228
 
 
229
 
/**
230
 
 * \brief get size of the snd_timer_info_t structure in bytes
231
 
 * \return size of the snd_timer_info_t structure in bytes
232
 
 */
233
 
size_t
234
 
snd_timer_info_sizeof ()
235
 
{
236
 
  return sizeof (snd_timer_info_t);
237
 
}
238
 
 
239
 
/**
240
 
 * \brief allocate a new snd_timer_info_t structure
241
 
 * \param ptr returned pointer
242
 
 * \return 0 on success otherwise a negative error code if fails
243
 
 *
244
 
 * Allocates a new snd_timer_info_t structure using the standard
245
 
 * malloc C library function.
246
 
 */
247
 
int
248
 
snd_timer_info_malloc (snd_timer_info_t ** info)
249
 
{
250
 
  *info = calloc (1, sizeof (snd_timer_info_t));
251
 
  dbg_printf ("snd_timer_info_malloc()=%x\n", *info);
252
 
  if (!*info)
253
 
    return -ENOMEM;
254
 
  return 0;
255
 
}
256
 
 
257
 
/**
258
 
 * \brief frees the snd_timer_info_t structure
259
 
 * \param info pointer to the snd_timer_info_t structure to free
260
 
 *
261
 
 * Frees the given snd_timer_info_t structure using the standard
262
 
 * free C library function.
263
 
 */
264
 
void
265
 
snd_timer_info_free (snd_timer_info_t * info)
266
 
{
267
 
  dbg_printf ("snd_timer_info_free(%x)\n", info);
268
 
  free (info);
269
 
}
270
 
 
271
 
/**
272
 
 * \brief get information about timer handle
273
 
 * \param timer timer handle
274
 
 * \param info pointer to a snd_timer_info_t structure to be filled
275
 
 * \return 0 on success otherwise a negative error code
276
 
 */
277
 
int
278
 
snd_timer_info (snd_timer_t * timer, snd_timer_info_t * info)
279
 
{
280
 
  dbg_printf ("snd_timer_info(timer=%x, info=%x)\n", timer, info);
281
 
 
282
 
  // TODO
283
 
 
284
 
  return 0;
285
 
}
286
 
 
287
 
/**
288
 
 * \brief get timer name
289
 
 * \param info pointer to #snd_timer_info_t structure
290
 
 * \return timer name
291
 
 */
292
 
const char *
293
 
snd_timer_info_get_name (snd_timer_info_t * info)
294
 
{
295
 
  dbg_printf ("snd_timer_info_get_name(info=%x)\n", info);
296
 
 
297
 
  return "OSS Timer";           // TODO
298
 
}
299
 
 
300
 
 
301
 
/**
302
 
 * \brief get timer resolution in us
303
 
 * \param info pointer to #snd_timer_info_t structure
304
 
 * \return timer resolution
305
 
 */
306
 
long
307
 
snd_timer_info_get_resolution (snd_timer_info_t * info)
308
 
{
309
 
  dbg_printf ("snd_timer_info_get_resolution(info=%x)\n", info);
310
 
 
311
 
  return 1000;                  // TODO
312
 
}
313
 
 
314
 
 
315
 
static int
316
 
snd_timer_query_open_conf (snd_timer_query_t ** timer,
317
 
                           const char *name, snd_config_t * timer_root,
318
 
                           snd_config_t * timer_conf, int mode)
319
 
{
320
 
  dbg_printf
321
 
    ("snd_timer_query_open_conf(name='%s', root=%x, conf=%x, mode=%x)\n",
322
 
     name, timer_root, timer_conf, mode);
323
 
  ALIB_INIT ();
324
 
  if (!alib_appcheck ())
325
 
    return -ENODEV;
326
 
 
327
 
  return -EIO;
328
 
}
329
 
 
330
 
/**
331
 
 * \brief close timer query handle
332
 
 * \param timer timer handle
333
 
 * \return 0 on success otherwise a negative error code
334
 
 *
335
 
 * Closes the specified timer handle and frees all associated
336
 
 * resources.
337
 
 */
338
 
int
339
 
snd_timer_query_close (snd_timer_query_t * timer)
340
 
{
341
 
  dbg_printf ("snd_timer_query_close(timer=%x)\n", timer);
342
 
 
343
 
  return 0;
344
 
}
345
 
 
346
 
/**
347
 
 * \brief obtain the next timer identification
348
 
 * \param timer timer handle
349
 
 * \param tid timer identification
350
 
 * \return 0 on success otherwise a negative error code
351
 
 *
352
 
 * if tid->dev_class is -1, then the first device is returned
353
 
 * if result tid->dev_class is -1, no more devices are left
354
 
 */
355
 
int
356
 
snd_timer_query_next_device (snd_timer_query_t * timer, snd_timer_id_t * tid)
357
 
{
358
 
  dbg_printf ("snd_timer_query_next_device(timer=%x, tid=%x)\n", timer, tid);
359
 
 
360
 
  return -1;
361
 
}