channel_if.m revision 139749
1139749Simp#-
273765Scg# KOBJ
370134Scg#
470134Scg# Copyright (c) 2000 Cameron Grant <cg@freebsd.org>
570134Scg# All rights reserved.
670134Scg#
770134Scg# Redistribution and use in source and binary forms, with or without
870134Scg# modification, are permitted provided that the following conditions
970134Scg# are met:
1070134Scg# 1. Redistributions of source code must retain the above copyright
1170134Scg#    notice, this list of conditions and the following disclaimer.
1270134Scg# 2. Redistributions in binary form must reproduce the above copyright
1370134Scg#    notice, this list of conditions and the following disclaimer in the
1470134Scg#    documentation and/or other materials provided with the distribution.
1570134Scg#
1670134Scg# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1770134Scg# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1870134Scg# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1970134Scg# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2070134Scg# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2170134Scg# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2270134Scg# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2370134Scg# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2470134Scg# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2570134Scg# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2670134Scg# SUCH DAMAGE.
2770134Scg#
2870134Scg# $FreeBSD: head/sys/dev/sound/pcm/channel_if.m 139749 2005-01-06 01:43:34Z imp $
2970134Scg#
3070134Scg
3170134Scg#include <dev/sound/pcm/sound.h>
3270134Scg
3370134ScgINTERFACE channel;
3470134Scg
3570134ScgCODE {
3670134Scg
3770134Scg	static int
3870134Scg	channel_nosetdir(kobj_t obj, void *data, int dir)
3970134Scg	{
4070134Scg		return 0;
4170134Scg	}
4270134Scg
4370134Scg	static int
4470134Scg	channel_noreset(kobj_t obj, void *data)
4570134Scg	{
4670134Scg		return 0;
4770134Scg	}
4870134Scg
4970134Scg	static int
5070134Scg	channel_noresetdone(kobj_t obj, void *data)
5170134Scg	{
5270134Scg		return 0;
5370134Scg	}
5470134Scg
5570134Scg	static int
5670134Scg	channel_nofree(kobj_t obj, void *data)
5770134Scg	{
5870134Scg		return 1;
5970134Scg	}
6070134Scg
6177269Scg	static u_int32_t
6277269Scg	channel_nogetptr(kobj_t obj, void *data)
6377269Scg	{
6477269Scg		return 0;
6577269Scg	}
6677269Scg
6777269Scg	static int
6877269Scg	channel_nonotify(kobj_t obj, void *data, u_int32_t changed)
6977269Scg	{
7077269Scg		return 0;
7177269Scg	}
7277269Scg
7370134Scg};
7470134Scg
7570134ScgMETHOD void* init {
7670134Scg	kobj_t obj;
7770134Scg	void *devinfo;
7874763Scg	struct snd_dbuf *b;
7974763Scg	struct pcm_channel *c;
8070134Scg	int dir;
8170134Scg};
8270134Scg
8370134ScgMETHOD int free {
8470134Scg	kobj_t obj;
8570134Scg	void *data;
8670134Scg} DEFAULT channel_nofree;
8770134Scg
8870134ScgMETHOD int reset {
8970134Scg	kobj_t obj;
9070134Scg	void *data;
9170134Scg} DEFAULT channel_noreset;
9270134Scg
9370134ScgMETHOD int resetdone {
9470134Scg	kobj_t obj;
9570134Scg	void *data;
9670134Scg} DEFAULT channel_noresetdone;
9770134Scg
9870134ScgMETHOD int setdir {
9970134Scg	kobj_t obj;
10070134Scg	void *data;
10170134Scg	int dir;
10270134Scg} DEFAULT channel_nosetdir;
10370134Scg
10470134ScgMETHOD u_int32_t setformat {
10570134Scg	kobj_t obj;
10670134Scg	void *data;
10770134Scg	u_int32_t format;
10870134Scg};
10970134Scg
11070134ScgMETHOD u_int32_t setspeed {
11170134Scg	kobj_t obj;
11270134Scg	void *data;
11370134Scg	u_int32_t speed;
11470134Scg};
11570134Scg
11670134ScgMETHOD u_int32_t setblocksize {
11770134Scg	kobj_t obj;
11870134Scg	void *data;
11970134Scg	u_int32_t blocksize;
12070134Scg};
12170134Scg
12270134ScgMETHOD int trigger {
12370134Scg	kobj_t obj;
12470134Scg	void *data;
12570134Scg	int go;
12670134Scg};
12770134Scg
12870134ScgMETHOD u_int32_t getptr {
12970134Scg	kobj_t obj;
13070134Scg	void *data;
13177269Scg} DEFAULT channel_nogetptr;
13270134Scg
13374763ScgMETHOD struct pcmchan_caps* getcaps {
13470134Scg	kobj_t obj;
13570134Scg	void *data;
13670134Scg};
13770134Scg
13877269ScgMETHOD int notify {
13977269Scg	kobj_t obj;
14077269Scg	void *data;
14177269Scg	u_int32_t changed;
14277269Scg} DEFAULT channel_nonotify;
143