1 /*---------------------------------------------------------------------------*
2   Project:     MIDI to SI library
3   File:        midi.h
4   Programmer:  HIRATSU Daisuke
5 
6   Copyright 2005 Nintendo.  All rights reserved.
7 
8   These coded instructions, statements, and computer programs contain
9   proprietary information of Nintendo of America Inc. and/or Nintendo
10   Company Ltd., and are protected by Federal copyright law.  They may
11   not be disclosed to third parties or copied or duplicated in any form,
12   in whole or in part, without the prior written consent of Nintendo.
13  *---------------------------------------------------------------------------*/
14 
15 #include <revolution/types.h>
16 #include <revolution/os.h>
17 
18 #ifndef MIDI_H__
19 #define MIDI_H__
20 
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 
27 typedef void (*MIDICallback)(s32 chan, s32 ret);
28 
29 #define MIDI_CHAN0                   0
30 #define MIDI_CHAN1                   1
31 #define MIDI_CHAN2                   2
32 #define MIDI_CHAN3                   3
33 #define MIDI_MAX_CHAN                4
34 
35 #define MIDI_JSTAT_MASK           0x3a
36 #define MIDI_JSTAT_FLAGS_SHIFT       4
37 #define MIDI_JSTAT_FLAGS_MASK     0x30
38 #define MIDI_JSTAT_SEND           0x08
39 #define MIDI_JSTAT_RECV           0x02
40 
41 #define MIDI_READY                   0
42 #define MIDI_NOT_READY               1
43 #define MIDI_BUSY                    2
44 
45 void MIDIInit(void);
46 s32  MIDIGetStatus(s32 chan, u8* status);
47 s32  MIDIGetStatusAsync(s32 chan, u8* status, MIDICallback callback);
48 s32  MIDIRead(s32 chan, u8* dst, u8* status);
49 s32  MIDIReadAsync(s32 chan, u8* dst, u8* status, MIDICallback callback);
50 
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 
57 #endif  // MIDI_H__
58