1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) 2009-2013 Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 #ifndef __MIDI_H__
13 #define __MIDI_H__
14 
15 #include <cafe.h>
16 #include <cafe/os.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 
23 typedef void (*MIDICallback)(s32 chan, u8* buf, void* context, s32 ret);
24 
25 #define MIDI_JSTAT_MASK           0x3a
26 #define MIDI_JSTAT_FLAGS_SHIFT       4
27 #define MIDI_JSTAT_FLAGS_MASK     0x30
28 #define MIDI_JSTAT_SEND           0x08
29 #define MIDI_JSTAT_RECV           0x02
30 
31 #define MIDI_READY                   0
32 #define MIDI_NOT_READY               1
33 #define MIDI_BUSY                    2
34 
35 void MIDIInit(void);
36 s32  MIDIGetStatus(s32 chan);
37 s32  MIDIRead(s32 chan, u8* dst, u8* status);
38 s32  MIDIReadAsync(s32 chan, u8* dst, u8* status, void* context, MIDICallback callback);
39 
40 #ifdef __cplusplus
41 }
42 #endif
43 
44 
45 #endif  // __MIDI_H__
46