1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

semi-automatic style(9)

This commit is contained in:
Alexander Leidinger 2007-02-25 13:51:52 +00:00
parent 8cf5ee2e2a
commit 8f981688dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166971
10 changed files with 1376 additions and 1327 deletions

File diff suppressed because it is too large Load Diff

View File

@ -43,15 +43,15 @@ MALLOC_DECLARE(M_MIDI);
struct snd_midi;
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 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);
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);
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);
#endif

View File

@ -35,7 +35,7 @@
struct name { \
int h, t, s; \
type * b; \
}
}
#define MIDIQ_INIT(head, buf, size) do { \
(head).h=(head).t=0; \

View File

@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/kobj.h>
#include <sys/malloc.h>
#include <sys/bus.h> /* to get driver_intr_t */
#include <sys/bus.h> /* to get driver_intr_t */
#include <dev/sound/midi/mpu401.h>
#include <dev/sound/midi/midi.h>
@ -66,13 +66,13 @@ __FBSDID("$FreeBSD$");
struct mpu401 {
KOBJ_FIELDS;
struct snd_midi *mid;
int flags;
int flags;
driver_intr_t *si;
void *cookie;
void *cookie;
struct callout timer;
};
static void mpu401_timeout(void *m) ;
static void mpu401_timeout(void *m);
static mpu401_intr_t mpu401_intr;
static int mpu401_minit(kobj_t obj, struct mpu401 *m);
@ -85,22 +85,23 @@ static const char *mpu401_mdescr(kobj_t obj, struct mpu401 *m, int verbosity);
static const char *mpu401_mprovider(kobj_t obj, struct mpu401 *m);
static kobj_method_t mpu401_methods[] = {
KOBJMETHOD(mpu_init,mpu401_minit),
KOBJMETHOD(mpu_uninit,mpu401_muninit),
KOBJMETHOD(mpu_inqsize,mpu401_minqsize),
KOBJMETHOD(mpu_outqsize,mpu401_moutqsize),
KOBJMETHOD(mpu_callback,mpu401_mcallback),
KOBJMETHOD(mpu_callbackp,mpu401_mcallbackp),
KOBJMETHOD(mpu_descr,mpu401_mdescr),
KOBJMETHOD(mpu_provider,mpu401_mprovider),
{ 0, 0 }
KOBJMETHOD(mpu_init, mpu401_minit),
KOBJMETHOD(mpu_uninit, mpu401_muninit),
KOBJMETHOD(mpu_inqsize, mpu401_minqsize),
KOBJMETHOD(mpu_outqsize, mpu401_moutqsize),
KOBJMETHOD(mpu_callback, mpu401_mcallback),
KOBJMETHOD(mpu_callbackp, mpu401_mcallbackp),
KOBJMETHOD(mpu_descr, mpu401_mdescr),
KOBJMETHOD(mpu_provider, mpu401_mprovider),
{0, 0}
};
DEFINE_CLASS(mpu401, mpu401_methods, 0);
void
mpu401_timeout(void *a)
{ struct mpu401 *m=(struct mpu401 *)a;
mpu401_timeout(void *a)
{
struct mpu401 *m = (struct mpu401 *)a;
if (m->si)
(m->si)(m->cookie);
@ -113,6 +114,7 @@ mpu401_intr(struct mpu401 *m)
MIDI_TYPE b[MPU_INTR_BUF];
int i;
int s;
/*
printf("mpu401_intr\n");
*/
@ -123,54 +125,54 @@ mpu401_intr(struct mpu401 *m)
#else
#define D(x,l)
#endif
i=0;
i = 0;
s = STATUS(m);
D(s,1);
while ( (s&MPU_INPUTBUSY) == 0 && i<MPU_INTR_BUF) {
b[i]=READ(m);
D(s, 1);
while ((s & MPU_INPUTBUSY) == 0 && i < MPU_INTR_BUF) {
b[i] = READ(m);
/*
printf("mpu401_intr in i %d d %d\n", i, b[i]);
*/
i++;
s = STATUS(m);
s = STATUS(m);
}
if (i) midi_in(m->mid, b, i);
i=0;
while ( !(s&MPU_OUTPUTBUSY) && i<MPU_INTR_BUF) {
if(midi_out(m->mid, b, 1)) {
if (i)
midi_in(m->mid, b, i);
i = 0;
while (!(s & MPU_OUTPUTBUSY) && i < MPU_INTR_BUF) {
if (midi_out(m->mid, b, 1)) {
/*
printf("mpu401_intr out i %d d %d\n", i, b[0]);
*/
WRITE(m, *b);
}
else {
} else {
/*
printf("mpu401_intr write: no output\n");
*/
return 0;
}
i++;
/* DELAY(100); */
s = STATUS(m);
/* DELAY(100); */
s = STATUS(m);
}
if ((m->flags & M_TXEN) && (m->si) ) {
callout_reset(&m->timer, 1, mpu401_timeout, m);
if ((m->flags & M_TXEN) && (m->si)) {
callout_reset(&m->timer, 1, mpu401_timeout, m);
}
return (m->flags & M_TXEN) == M_TXEN;
}
struct mpu401 *
mpu401_init(kobj_class_t cls, void *cookie,driver_intr_t softintr, mpu401_intr_t **cb)
mpu401_init(kobj_class_t cls, void *cookie, driver_intr_t softintr,
mpu401_intr_t ** cb)
{
struct mpu401 *m;
*cb = NULL;
m = malloc(sizeof(*m), M_MIDI, M_NOWAIT | M_ZERO);
if(!m)
if (!m)
return NULL;
kobj_init((kobj_t)m, cls);
@ -181,7 +183,7 @@ mpu401_init(kobj_class_t cls, void *cookie,driver_intr_t softintr, mpu401_intr_t
m->cookie = cookie;
m->flags = 0;
m->mid = midi_init(&mpu401_class,0,0,m);
m->mid = midi_init(&mpu401_class, 0, 0, m);
if (!m->mid)
goto err;
*cb = mpu401_intr;
@ -213,14 +215,14 @@ mpu401_minit(kobj_t obj, struct mpu401 *m)
CMD(m, MPU_RESET);
CMD(m, MPU_UART);
return 0;
i=0;
while(++i<2000) {
if(RXRDY(m))
if(READ(m) == MPU_ACK)
i = 0;
while (++i < 2000) {
if (RXRDY(m))
if (READ(m) == MPU_ACK)
break;
}
if( i < 2000 ) {
if (i < 2000) {
CMD(m, MPU_UART);
return 0;
}
@ -252,16 +254,15 @@ static void
mpu401_mcallback(kobj_t obj, struct mpu401 *m, int flags)
{
#if 0
printf("mpu401_callback %s %s %s %s\n",
flags & M_RX ? "M_RX" : "",
flags & M_TX ? "M_TX" : "",
flags & M_RXEN ? "M_RXEN" : "",
flags & M_TXEN ? "M_TXEN" : "" );
printf("mpu401_callback %s %s %s %s\n",
flags & M_RX ? "M_RX" : "",
flags & M_TX ? "M_TX" : "",
flags & M_RXEN ? "M_RXEN" : "",
flags & M_TXEN ? "M_TXEN" : "");
#endif
if (flags & M_TXEN && m->si) {
callout_reset(&m->timer, 1, mpu401_timeout, m);
}
m->flags = flags;
}

View File

@ -31,9 +31,11 @@
struct mpu401;
typedef int mpu401_intr_t(struct mpu401 * _obj);
typedef int mpu401_intr_t(struct mpu401 *_obj);
extern struct mpu401 *
mpu401_init(kobj_class_t _cls, void *cookie, driver_intr_t *_softintr,
mpu401_intr_t ** _cb);
extern int mpu401_uninit(struct mpu401 *_obj);
extern struct mpu401 *mpu401_init(kobj_class_t _cls, void *cookie,
driver_intr_t *_softintr,mpu401_intr_t **_cb);
extern int mpu401_uninit(struct mpu401 * _obj);
#endif

View File

@ -30,45 +30,45 @@
INTERFACE mpu;
METHOD int inqsize{
struct snd_midi * _kobj;
void *_cookie;
METHOD int inqsize {
struct snd_midi *_kobj;
void *_cookie;
};
METHOD int outqsize {
struct snd_midi * _kobj;
void *_cookie;
struct snd_midi *_kobj;
void *_cookie;
};
METHOD int init {
struct snd_midi * _kobj;
void *_cookie;
struct snd_midi *_kobj;
void *_cookie;
};
METHOD void callbackp {
struct snd_midi * _kobj;
void *_cookie;
int _flags;
struct snd_midi *_kobj;
void *_cookie;
int _flags;
};
METHOD void callback {
struct snd_midi * _kobj;
void *_cookie;
int _flags;
METHOD void callback {
struct snd_midi *_kobj;
void *_cookie;
int _flags;
};
METHOD const char * provider{
struct snd_midi * _kobj;
void *_cookie;
METHOD const char * provider {
struct snd_midi *_kobj;
void *_cookie;
};
METHOD const char * descr {
struct snd_midi * _kobj;
void *_cookie;
int _verbosity;
METHOD const char * descr {
struct snd_midi *_kobj;
void *_cookie;
int _verbosity;
};
METHOD int uninit {
struct snd_midi * _kobj;
void *_cookie;
METHOD int uninit {
struct snd_midi *_kobj;
void *_cookie;
};

View File

@ -33,18 +33,18 @@ INTERFACE mpufoi;
METHOD unsigned char read {
struct mpu401 *_kobj;
void *_cookie;
int _reg;
void *_cookie;
int _reg;
};
METHOD void write {
struct mpu401 *_kobj;
void *_cookie;
int _reg;
void *_cookie;
int _reg;
unsigned char _d;
};
METHOD int uninit {
struct mpu401 *_kobj;
void *_cookie;
void *_cookie;
};

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,8 @@ void seq_timer(void *arg);
SYSCTL_DECL(_hw_midi_seq);
extern int seq_debug;
extern int seq_debug;
#define SEQ_DEBUG(y, x) \
do { \
if (seq_debug >= y) { \
@ -60,7 +61,7 @@ extern int seq_debug;
SYSCTL_DECL(_hw_midi);
#endif /* _KERNEL */
#endif /* _KERNEL */
#define SYNTHPROP_MIDI 1
#define SYNTHPROP_SYNTH 2
@ -68,17 +69,17 @@ SYSCTL_DECL(_hw_midi);
#define SYNTHPROP_TX 8
struct _midi_cmdtab {
int cmd;
char * name;
int cmd;
char *name;
};
typedef struct _midi_cmdtab midi_cmdtab;
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);
char *midi_cmdname(int cmd, midi_cmdtab * tab);
enum {
MORE,

View File

@ -201,113 +201,113 @@ synth_alloc_t noalloc;
}
METHOD int killnote {
void /* X */ * _kobj;
uint8_t _chan;
uint8_t _note;
uint8_t _vel;
void /* X */ *_kobj;
uint8_t _chan;
uint8_t _note;
uint8_t _vel;
} DEFAULT nokillnote;
METHOD int startnote {
void /* X */ * _kobj;
uint8_t _voice;
uint8_t _note;
uint8_t _parm;
void /* X */ *_kobj;
uint8_t _voice;
uint8_t _note;
uint8_t _parm;
} DEFAULT nostartnote;
METHOD int setinstr {
void /* X */ * _kobj;
uint8_t _chn;
uint16_t _patchno;
void /* X */ *_kobj;
uint8_t _chn;
uint16_t _patchno;
} DEFAULT nosetinstr;
METHOD int hwcontrol {
void /* X */ * _kobj;
uint8_t *_event;
void /* X */ *_kobj;
uint8_t *_event;
} DEFAULT nohwcontrol;
METHOD int aftertouch {
void /* X */ * _kobj;
uint8_t _x1;
uint8_t _x2;
void /* X */ *_kobj;
uint8_t _x1;
uint8_t _x2;
} DEFAULT noaftertouch;
METHOD int panning {
void /* X */ * _kobj;
uint8_t _x1;
uint8_t _x2;
void /* X */ *_kobj;
uint8_t _x1;
uint8_t _x2;
} DEFAULT nopanning;
METHOD int controller {
void /* X */ * _kobj;
uint8_t _x1;
uint8_t _x2;
uint16_t _x3;
void /* X */ *_kobj;
uint8_t _x1;
uint8_t _x2;
uint16_t _x3;
} DEFAULT nocontroller;
METHOD int volumemethod {
void /* X */ * _kobj;
uint8_t _x1;
void /* X */ *_kobj;
uint8_t _x1;
} DEFAULT novolumemethod;
METHOD int bender {
void /* X */ * _kobj;
uint8_t _voice;
uint16_t _bend;
void /* X */ *_kobj;
uint8_t _voice;
uint16_t _bend;
} DEFAULT nobender;
METHOD int setupvoice {
void /* X */ * _kobj;
uint8_t _voice;
uint8_t _chn;
void /* X */ *_kobj;
uint8_t _voice;
uint8_t _chn;
} DEFAULT nosetupvoice;
METHOD int sendsysex {
void /* X */ * _kobj;
void * _buf;
size_t _len;
void /* X */ *_kobj;
void *_buf;
size_t _len;
} DEFAULT nosendsysex;
METHOD int allocvoice {
void /* X */ * _kobj;
uint8_t _chn;
uint8_t _note;
void *_x;
void /* X */ *_kobj;
uint8_t _chn;
uint8_t _note;
void *_x;
} DEFAULT noallocvoice;
METHOD int writeraw {
void /* X */ * _kobjt;
uint8_t * _buf;
size_t _len;
void /* X */ *_kobjt;
uint8_t *_buf;
size_t _len;
} DEFAULT nowriteraw;
METHOD int reset {
void /* X */ * _kobjt;
void /* X */ *_kobjt;
} DEFAULT noreset;
METHOD char * shortname {
void /* X */ * _kobjt;
void /* X */ *_kobjt;
} DEFAULT noshortname;
METHOD int open {
void /* X */ * _kobjt;
void * _sythn;
int _mode;
void /* X */ *_kobjt;
void *_sythn;
int _mode;
} DEFAULT noopen;
METHOD int close {
void /* X */ * _kobjt;
void /* X */ *_kobjt;
} DEFAULT noclose;
METHOD int query {
void /* X */ * _kobjt;
void /* X */ *_kobjt;
} DEFAULT noquery;
METHOD int insync {
void /* X */ * _kobjt;
void /* X */ *_kobjt;
} DEFAULT noinsync;
METHOD int alloc {
void /* x */ * _kbojt;
uint8_t _chn;
uint8_t _note;
void /* x */ *_kbojt;
uint8_t _chn;
uint8_t _note;
} DEFAULT noalloc;