Annotation of src/usr.bin/aucat/dev.h, Revision 1.30
1.30 ! ratchov 1: /* $OpenBSD: dev.h,v 1.29 2011/06/20 20:18:44 ratchov Exp $ */
1.1 ratchov 2: /*
3: * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
4: *
5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
8: *
9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: */
17: #ifndef DEV_H
18: #define DEV_H
19:
1.27 ratchov 20: #include "aparams.h"
21:
1.2 ratchov 22: struct aproc;
23: struct abuf;
1.1 ratchov 24:
1.24 ratchov 25: struct dev {
26: struct dev *next;
27:
28: /*
29: * desired parameters
30: */
31: unsigned reqmode; /* mode */
32: struct aparams reqipar, reqopar; /* parameters */
33: unsigned reqbufsz; /* buffer size */
34: unsigned reqround; /* block size */
35: unsigned reqrate; /* sample rate */
36: unsigned hold; /* hold the device open ? */
1.28 ratchov 37: unsigned autovol; /* auto adjust playvol ? */
1.30 ! ratchov 38: unsigned autostart; /* don't wait for MMC start */
1.24 ratchov 39: unsigned refcnt; /* number of openers */
40: #define DEV_CLOSED 0 /* closed */
41: #define DEV_INIT 1 /* stopped */
42: #define DEV_START 2 /* ready to start */
43: #define DEV_RUN 3 /* started */
44: unsigned pstate; /* on of DEV_xxx */
45: char *path; /* sio path */
46:
47: /*
48: * actual parameters and runtime state (i.e. once opened)
49: */
50: unsigned mode; /* bitmap of MODE_xxx */
51: unsigned bufsz, round, rate;
52: struct aparams ipar, opar;
53: struct aproc *mix, *sub, *submon;
54: struct aproc *rec, *play, *mon;
55: struct aproc *midi;
1.29 ratchov 56: struct devctl {
57: struct devctl *next;
58: unsigned mode;
59: char *path;
60: } *ctl_list;
1.24 ratchov 61: };
62:
63: extern struct dev *dev_list;
64:
1.30 ! ratchov 65: int dev_init(struct dev *);
1.24 ratchov 66: int dev_run(struct dev *);
67: int dev_ref(struct dev *);
68: void dev_unref(struct dev *);
69: void dev_del(struct dev *);
70: void dev_wakeup(struct dev *);
1.26 ratchov 71: void dev_drain(struct dev *);
1.30 ! ratchov 72: struct dev *dev_new(char *, unsigned, unsigned, unsigned, unsigned, unsigned);
! 73: void dev_adjpar(struct dev *, unsigned, struct aparams *, struct aparams *);
1.29 ratchov 74: int devctl_add(struct dev *, char *, unsigned);
1.24 ratchov 75: void dev_midiattach(struct dev *, struct abuf *, struct abuf *);
76: unsigned dev_roundof(struct dev *, unsigned);
77: int dev_getpos(struct dev *);
78: void dev_attach(struct dev *, char *, unsigned,
1.21 ratchov 79: struct abuf *, struct aparams *, unsigned,
80: struct abuf *, struct aparams *, unsigned,
81: unsigned, int);
1.24 ratchov 82: void dev_setvol(struct dev *, struct abuf *, int);
1.1 ratchov 83:
84: #endif /* !define(DEV_H) */