vchan.h revision 170161
1139749Simp/*- 2119853Scg * Copyright (c) 2001 Cameron Grant <cg@freebsd.org> 377269Scg * All rights reserved. 477269Scg * 577269Scg * Redistribution and use in source and binary forms, with or without 677269Scg * modification, are permitted provided that the following conditions 777269Scg * are met: 877269Scg * 1. Redistributions of source code must retain the above copyright 977269Scg * notice, this list of conditions and the following disclaimer. 1077269Scg * 2. Redistributions in binary form must reproduce the above copyright 1177269Scg * notice, this list of conditions and the following disclaimer in the 1277269Scg * documentation and/or other materials provided with the distribution. 1377269Scg * 1477269Scg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1577269Scg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1677269Scg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1777269Scg * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1877269Scg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1977269Scg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2077269Scg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2177269Scg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2277269Scg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2377269Scg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2477269Scg * SUCH DAMAGE. 2577269Scg * 2677269Scg * $FreeBSD: head/sys/dev/sound/pcm/vchan.h 170161 2007-05-31 18:43:33Z ariff $ 2777269Scg */ 2877269Scg 29170161Sariffint vchan_create(struct pcm_channel *parent, int num); 3077269Scgint vchan_destroy(struct pcm_channel *c); 3182180Scgint vchan_initsys(device_t dev); 3277269Scg 33170161Sariff/* 34170161Sariff * Default speed / format 35170161Sariff */ 36170161Sariff#define VCHAN_DEFAULT_SPEED 48000 37170161Sariff#define VCHAN_DEFAULT_AFMT (AFMT_S16_LE | AFMT_STEREO) 38170161Sariff#define VCHAN_DEFAULT_STRFMT "s16le" 3977269Scg 40170161Sariff#define VCHAN_PLAY 0 41170161Sariff#define VCHAN_REC 1 42170161Sariff 43170161Sariff/* 44170161Sariff * Offset by +/- 1 so we can distinguish bogus pointer. 45170161Sariff */ 46170161Sariff#define VCHAN_SYSCTL_DATA(x, y) \ 47170161Sariff ((void *)((intptr_t)(((((x) + 1) & 0xfff) << 2) | \ 48170161Sariff (((VCHAN_##y) + 1) & 0x3)))) 49170161Sariff 50170161Sariff#define VCHAN_SYSCTL_DATA_SIZE sizeof(void *) 51170161Sariff#define VCHAN_SYSCTL_UNIT(x) ((int)(((intptr_t)(x) >> 2) & 0xfff) - 1) 52170161Sariff#define VCHAN_SYSCTL_DIR(x) ((int)((intptr_t)(x) & 0x3) - 1) 53