From owner-p4-projects@FreeBSD.ORG Sat Dec 9 04:52:30 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DCF0016A416; Sat, 9 Dec 2006 04:52:29 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 953EE16A403 for ; Sat, 9 Dec 2006 04:52:29 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D5C243C9D for ; Sat, 9 Dec 2006 04:51:27 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kB94qTaH062922 for ; Sat, 9 Dec 2006 04:52:29 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kB94qTUX062919 for perforce@freebsd.org; Sat, 9 Dec 2006 04:52:29 GMT (envelope-from marcel@freebsd.org) Date: Sat, 9 Dec 2006 04:52:29 GMT Message-Id: <200612090452.kB94qTUX062919@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 111313 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Dec 2006 04:52:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=111313 Change 111313 by marcel@marcel_cluster on 2006/12/09 04:51:28 Fix merge botch. Affected files ... .. //depot/projects/powerpc/sys/dev/sound/midi/midi.h#4 edit .. //depot/projects/powerpc/sys/dev/sound/midi/sequencer.h#4 edit Differences ... ==== //depot/projects/powerpc/sys/dev/sound/midi/midi.h#4 (text+ko) ==== @@ -1,334 +1,55 @@ -/* - * Include file for midi driver. +/*- + * (c) 2003 Mathew Kanner * - * Copyright by Seigo Tanimura 1999. - * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * modification, are permitted provided that the following conditions are + * met: 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. 2. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/sound/midi/midi.h,v 1.10 2002/03/25 09:23:41 mike Exp $ - * + * $FreeBSD: src/sys/dev/sound/midi/midi.h,v 1.14 2006/05/27 16:32:05 netchild Exp $ */ -/* - * first, include kernel header files. - */ +#ifndef MIDI_H +#define MIDI_H -#ifndef _MIDI_H_ -#define _MIDI_H_ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include /* for DATA_SET */ - -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include /* for DELAY */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +MALLOC_DECLARE(M_MIDI); -#define MIDI_CDEV_MAJOR 30 +#define M_RX 0x01 +#define M_TX 0x02 +#define M_RXEN 0x04 +#define M_TXEN 0x08 -/*#define MIDI_OUTOFGIANT*/ +#define MIDI_TYPE unsigned char -/* - * The order of mutex lock (from the first to the last) - * - * 1. sequencer flags, queues, timer and device list - * 2. midi synth voice and channel - * 3. midi synth status - * 4. generic midi flags and queues - * 5. midi device - */ +struct snd_midi; -/* - * descriptor of midi operations ... - * - */ +struct snd_midi *midi_init(kobj_class_t _mpu_cls, int _unit, int _channel, + void *cookie); +int midi_uninit(struct snd_midi * _m); +int midi_out(struct snd_midi * _m, MIDI_TYPE * _buf, int _size); +int midi_in(struct snd_midi * _m, MIDI_TYPE * _buf, int _size); -struct _mididev_info { +kobj_t midimapper_addseq(void *arg1, int *unit, void **cookie); +int midimapper_open(void *arg1, void **cookie); +int midimapper_close(void *arg1, void *cookie); +kobj_t midimapper_fetch_synth(void *arg, void *cookie, int unit); - /* - * the first part of the descriptor is filled up from a - * template. - */ - char name[64]; - - int type; - - d_open_t *open; - d_close_t *close; - d_ioctl_t *ioctl; - midi_callback_t *callback; - - /* - * combinations of the following flags are used as second argument in - * the callback from the dma module to the device-specific routines. - */ - -#define MIDI_CB_RD 0x100 /* read callback */ -#define MIDI_CB_WR 0x200 /* write callback */ -#define MIDI_CB_REASON_MASK 0xff -#define MIDI_CB_START 0x01 /* start dma op */ -#define MIDI_CB_STOP 0x03 /* stop dma op */ -#define MIDI_CB_ABORT 0x04 /* abort dma op */ -#define MIDI_CB_INIT 0x05 /* init board parameters */ - - /* - * callback extensions - */ -#define MIDI_CB_DMADONE 0x10 -#define MIDI_CB_DMAUPDATE 0x11 -#define MIDI_CB_DMASTOP 0x12 - - /* init can only be called with int enabled and - * no pending DMA activity. - */ - - /* - * whereas from here, parameters are set at runtime. - * resources are stored in the softc of the device, - * not in the common structure. - */ - - int unit; /* unit number of the device */ - int midiunit; /* unit number for midi devices */ - int synthunit; /* unit number for synth devices */ - int mdtype; /* MDT_MIDI or MDT_SYNTH */ - void *softc; /* softc for the device */ - device_t dev; /* device_t for the device */ - - int bd_id; /* used to hold board-id info, eg. sb version, - * mss codec type, etc. etc. - */ - - struct mtx flagqueue_mtx; /* Mutex to protect flags and queues */ - - /* Queues */ - midi_dbuf midi_dbuf_in; /* midi input event/message queue */ - midi_dbuf midi_dbuf_out; /* midi output event/message queue */ - midi_dbuf midi_dbuf_passthru; /* midi passthru event/message queue */ - - /* - * these parameters describe the operation of the board. - * Generic things like busy flag, speed, etc are here. - */ - - /* Flags */ - volatile u_long flags; /* 32 bits, used for various purposes. */ - int fflags; /* file flag */ - - /* - * we have separate flags for read and write, although in some - * cases this is probably not necessary (e.g. because we cannot - * know how many processes are using the device, we cannot - * distinguish if open, close, abort are for a write or for a - * read). - */ - - /* - * the following flag is used by open-close routines - * to mark the status of the device. - */ -#define MIDI_F_BUSY 0x0001 /* has been opened */ - /* - * the next two are used to allow only one pending operation of - * each type. - */ -#define MIDI_F_READING 0x0004 /* have a pending read */ -#define MIDI_F_WRITING 0x0008 /* have a pending write */ - - /* - * flag used to mark a pending close. - */ -#define MIDI_F_CLOSING 0x0040 /* a pending close */ - - /* - * if user has not set block size, then make it adaptive - * (0.25s, or the perhaps last read/write ?) - */ -#define MIDI_F_HAS_SIZE 0x0080 /* user set block size */ - /* - * assorted flags related to operating mode. - */ -#define MIDI_F_STEREO 0x0100 /* doing stereo */ -#define MIDI_F_NBIO 0x0200 /* do non-blocking i/o */ -#define MIDI_F_PASSTHRU 0x0400 /* pass received data to output port */ - - /* - * these flags mark a pending abort on a r/w operation. - */ -#define MIDI_F_ABORTING 0x1000 /* a pending abort */ - - /* - * this is used to mark that board initialization is needed, e.g. - * because of a change in sampling rate, format, etc. -- It will - * be done at the next convenient time. - */ -#define MIDI_F_INIT 0x4000 /* changed parameters. need init */ - - int play_blocksize, rec_blocksize; /* blocksize for io and dma ops */ - -#define mwsel midi_dbuf_out.sel -#define mrsel midi_dbuf_in.sel - u_long nterrupts; /* counter of interrupts */ - u_long magic; -#define MAGIC(unit) ( 0xa4d10de0 + unit ) - void *device_data ; /* just in case it is needed...*/ - - midi_intr_t *intr; /* interrupt handler of the upper layer (ie sequencer) */ - void *intrarg; /* argument to interrupt handler */ - - /* The following is the interface from a midi sequencer to a midi device. */ - synthdev_info synth; - - /* This is the status message to display via /dev/midistat */ - char midistat[128]; - - /* The tailq entry of the next midi device. */ - TAILQ_ENTRY(_mididev_info) md_link; - - /* The tailq entry of the next midi device opened by a sequencer. */ - TAILQ_ENTRY(_mididev_info) md_linkseq; -} ; - -/* - * then ioctls and other stuff - */ - -#define NMIDI_MAX 16 /* Number of supported devices */ - -/* - * many variables should be reduced to a range. Here define a macro - */ - -#define RANGE(var, low, high) (var) = \ -((var)<(low)?(low) : (var)>(high)?(high) : (var)) - -/* - * convert dev_t to unit and dev - */ -#define MIDIMINOR(x) (minor(x)) -#define MIDIUNIT(x) ((MIDIMINOR(x) & 0x000000f0) >> 4) -#define MIDIDEV(x) (MIDIMINOR(x) & 0x0000000f) -#define MIDIMKMINOR(u, d) (((u) & 0x0f) << 4 | ((d) & 0x0f)) -#define MIDIMKDEV(m, u, d) (makedev((m), MIDIMKMINOR((u), (d)))) - -/* - * see if the device is configured - */ -#define MIDICONFED(x) ((x)->ioctl != NULL) - -/* - * finally, all default parameters - */ -#define MIDI_BUFFSIZE (1024) /* XXX */ - -#ifdef _KERNEL - -/* This is the generic midi drvier initializer. */ - int midiinit(mididev_info *d, device_t dev); - -/* This provides an access to the mididev_info. */ - mididev_info *get_mididev_info(dev_t i_dev, int *unit); - mididev_info *get_mididev_info_unit(int unit); - mididev_info *get_mididev_midi_unit(int unit); - mididev_info *get_mididev_synth_unit(int unit); - mididev_info *create_mididev_info_unit(int type, mididev_info *mdinf, synthdev_info *syninf); - int mididev_info_number(void); - int mididev_midi_number(void); - int mididev_synth_number(void); -#define MDT_MIDI (0) -#define MDT_SYNTH (1) - -/* These are the generic methods for a midi driver. */ - d_open_t midi_open; - d_close_t midi_close; - d_ioctl_t midi_ioctl; - d_read_t midi_read; - d_write_t midi_write; - d_poll_t midi_poll; - -/* Common interrupt handler */ -void midi_intr(mididev_info *); - -/* Sync output */ -int midi_sync(mididev_info *); - -struct _midi_cmdtab { - int cmd; - char * name; -}; -typedef struct _midi_cmdtab midi_cmdtab; - -char *midi_cmdname(int cmd, midi_cmdtab *tab); - -SYSCTL_DECL(_hw_midi); - -extern int midi_debug; -#define MIDI_DEBUG(x) \ - do { \ - if (midi_debug) { \ - (x); \ - } \ - } while(0) - -extern midi_cmdtab cmdtab_midiioctl[]; - -#endif /* _KERNEL */ - -/* - * Minor numbers for the midi driver. - */ - -#define MIDI_DEV_MIDIN 2 /* Raw midi access */ -#define MIDI_DEV_STATUS 15 /* /dev/midistat */ - -#endif /* _MIDI_H_ */ +#endif ==== //depot/projects/powerpc/sys/dev/sound/midi/sequencer.h#4 (text+ko) ==== @@ -1,6 +1,6 @@ -/* +/*- * Include file for midi sequencer driver. - * + * (c) 2003 Mathew Kanner * Copyright by Seigo Tanimura 1999. * * Redistribution and use in source and binary forms, with or without @@ -24,249 +24,62 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/sound/midi/sequencer.h,v 1.5 2002/01/04 01:13:47 tanimura Exp $ - * - */ - -/* - * first, include kernel header files. + * $FreeBSD: src/sys/dev/sound/midi/sequencer.h,v 1.7 2006/05/27 16:32:05 netchild Exp $ */ #ifndef _SEQUENCER_H_ #define _SEQUENCER_H_ -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* for DATA_SET */ - -#include -#include -#include -#include -#include -#include -#include -#include /* for DELAY */ -#include +#define NSEQ_MAX 16 -#include - -#define SEQ_CDEV_MAJOR MIDI_CDEV_MAJOR - /* - * the following assumes that FreeBSD 3.X uses poll(2) instead of select(2). - * This change dates to late 1997. - */ -#include -#define d_select_t d_poll_t - -/* Return value from seq_playevent and timer event handers. */ -enum { - MORE, - TIMERARMED, - QUEUEFULL -}; - -typedef struct _seqdev_info seqdev_info; - -/* - * The order of mutex lock (from the first to the last) - * - * 1. sequencer flags, queues, timer and device list - * 2. midi synth voice and channel - * 3. midi synth status - * 4. generic midi flags and queues - * 5. midi device - */ - -/* - * descriptor of sequencer operations ... - * - */ - -struct _seqdev_info { - - /* - * the first part of the descriptor is filled up from a - * template. - */ - char name[64]; - - int type ; - - d_open_t *open; - d_close_t *close; - d_read_t *read; - d_write_t *write; - d_ioctl_t *ioctl; - d_poll_t *poll; - midi_callback_t *callback; - - /* - * combinations of the following flags are used as second argument in - * the callback from the dma module to the device-specific routines. - */ - -#define SEQ_CB_RD 0x100 /* read callback */ -#define SEQ_CB_WR 0x200 /* write callback */ -#define SEQ_CB_REASON_MASK 0xff -#define SEQ_CB_START 0x01 /* start dma op */ -#define SEQ_CB_STOP 0x03 /* stop dma op */ -#define SEQ_CB_ABORT 0x04 /* abort dma op */ -#define SEQ_CB_INIT 0x05 /* init board parameters */ - - /* - * callback extensions - */ -#define SEQ_CB_DMADONE 0x10 -#define SEQ_CB_DMAUPDATE 0x11 -#define SEQ_CB_DMASTOP 0x12 - - /* init can only be called with int enabled and - * no pending DMA activity. - */ - - /* - * whereas from here, parameters are set at runtime. - * io_base == 0 means that the board is not configured. - */ - - int unit; /* unit number of the device */ - void *softc; /* softc for a device */ - - int bd_id ; /* used to hold board-id info, eg. sb version, - * mss codec type, etc. etc. - */ - - struct mtx flagqueue_mtx; /* Mutex to protect flags and queues */ - struct cv insync_cv; /* Conditional variable for sync */ - - /* Queues */ - midi_dbuf midi_dbuf_in; /* midi input event/message queue */ - midi_dbuf midi_dbuf_out; /* midi output event/message queue */ - - - /* - * these parameters describe the operation of the board. - * Generic things like busy flag, speed, etc are here. - */ - - /* Flags */ - volatile u_long flags ; /* 32 bits, used for various purposes. */ - - /* - * we have separate flags for read and write, although in some - * cases this is probably not necessary (e.g. because we cannot - * know how many processes are using the device, we cannot - * distinguish if open, close, abort are for a write or for a - * read). - */ - - /* - * the following flag is used by open-close routines - * to mark the status of the device. - */ -#define SEQ_F_BUSY 0x0001 /* has been opened */ - /* - * the next two are used to allow only one pending operation of - * each type. - */ -#define SEQ_F_READING 0x0004 /* have a pending read */ -#define SEQ_F_WRITING 0x0008 /* have a pending write */ - - /* - * flag used to mark a pending close. - */ -#define SEQ_F_CLOSING 0x0040 /* a pending close */ - - /* - * if user has not set block size, then make it adaptive - * (0.25s, or the perhaps last read/write ?) - */ -#define SEQ_F_HAS_SIZE 0x0080 /* user set block size */ - /* - * assorted flags related to operating mode. - */ -#define SEQ_F_STEREO 0x0100 /* doing stereo */ -#define SEQ_F_NBIO 0x0200 /* do non-blocking i/o */ - - /* - * these flags mark a pending abort on a r/w operation. - */ -#define SEQ_F_ABORTING 0x1000 /* a pending abort */ - - /* - * this is used to mark that board initialization is needed, e.g. - * because of a change in sampling rate, format, etc. -- It will - * be done at the next convenient time. - */ -#define SEQ_F_INIT 0x4000 /* changed parameters. need init */ - -#define SEQ_F_INSYNC 0x8000 /* a pending sync */ - - int play_blocksize, rec_blocksize; /* blocksize for io and dma ops */ - -#define swsel midi_dbuf_out.sel -#define srsel midi_dbuf_in.sel - u_long interrupts; /* counter of interrupts */ - u_long magic; -#define MAGIC(unit) ( 0xa4d10de0 + unit ) - void *device_data ; /* just in case it is needed...*/ - - /* The tailq entry of the next sequencer device. */ - TAILQ_ENTRY(_seqdev_info) sd_link; -}; - - -/* - * then ioctls and other stuff - */ -#define NSEQ_MAX 16 /* Number of supported devices */ - -/* * many variables should be reduced to a range. Here define a macro */ #define RANGE(var, low, high) (var) = \ ((var)<(low)?(low) : (var)>(high)?(high) : (var)) -/* - * finally, all default parameters - */ -#define SEQ_BUFFSIZE (1024) /* XXX */ - -#define MIDI_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM - synthesizer and MIDI output) */ -#define MIDI_DEV_MUSIC 8 /* Sequencer output /dev/music (FM - synthesizer and MIDI output) */ - #ifdef _KERNEL -extern midi_cmdtab cmdtab_seqioctl[]; -extern midi_cmdtab cmdtab_timer[]; - void seq_timer(void *arg); -int seq_copytoinput(void *arg, u_char *event, int len); SYSCTL_DECL(_hw_midi_seq); extern int seq_debug; -#define SEQ_DEBUG(x) \ +#define SEQ_DEBUG(y, x) \ do { \ - if (seq_debug) { \ + if (seq_debug >= y) { \ (x); \ } \ } while(0) +SYSCTL_DECL(_hw_midi); + #endif /* _KERNEL */ +#define SYNTHPROP_MIDI 1 +#define SYNTHPROP_SYNTH 2 +#define SYNTHPROP_RX 4 +#define SYNTHPROP_TX 8 -#endif /* _SEQUENCER_H_ */ +struct _midi_cmdtab { + int cmd; + char * name; +}; +typedef struct _midi_cmdtab midi_cmdtab; +extern midi_cmdtab cmdtab_seqevent[]; +extern midi_cmdtab cmdtab_seqioctl[]; +extern midi_cmdtab cmdtab_timer[]; +extern midi_cmdtab cmdtab_seqcv[]; +extern midi_cmdtab cmdtab_seqccmn[]; + +char *midi_cmdname(int cmd, midi_cmdtab *tab); + +enum { + MORE, + TIMERARMED, + QUEUEFULL +}; + +#endif