12 #define SI_CHAN0_BIT 0x80000000
13 #define SI_CHAN1_BIT 0x40000000
14 #define SI_CHAN2_BIT 0x20000000
15 #define SI_CHAN3_BIT 0x10000000
16 #define SI_CHAN_BIT(chn) (SI_CHAN0_BIT>>(chn))
18 #define SI_ERROR_UNDER_RUN 0x0001
19 #define SI_ERROR_OVER_RUN 0x0002
20 #define SI_ERROR_COLLISION 0x0004
21 #define SI_ERROR_NO_RESPONSE 0x0008
22 #define SI_ERROR_WRST 0x0010
23 #define SI_ERROR_RDST 0x0020
24 #define SI_ERR_UNKNOWN 0x0040
25 #define SI_ERR_BUSY 0x0080
28 // CMD_TYPE_AND_STATUS response data
30 #define SI_TYPE_MASK 0x18000000u
31 #define SI_TYPE_N64 0x00000000u
32 #define SI_TYPE_DOLPHIN 0x08000000u
33 #define SI_TYPE_GC SI_TYPE_DOLPHIN
36 #define SI_GC_WIRELESS 0x80000000u
37 #define SI_GC_NOMOTOR 0x20000000u // no rumble motor
38 #define SI_GC_STANDARD 0x01000000u // dolphin standard controller
41 #define SI_WIRELESS_RECEIVED 0x40000000u // 0: no wireless unit
42 #define SI_WIRELESS_IR 0x04000000u // 0: IR 1: RF
43 #define SI_WIRELESS_STATE 0x02000000u // 0: variable 1: fixed
44 #define SI_WIRELESS_ORIGIN 0x00200000u // 0: invalid 1: valid
45 #define SI_WIRELESS_FIX_ID 0x00100000u // 0: not fixed 1: fixed
46 #define SI_WIRELESS_TYPE 0x000f0000u
47 #define SI_WIRELESS_LITE_MASK 0x000c0000u // 0: normal 1: lite controller
48 #define SI_WIRELESS_LITE 0x00040000u // 0: normal 1: lite controller
49 #define SI_WIRELESS_CONT_MASK 0x00080000u // 0: non-controller 1: non-controller
50 #define SI_WIRELESS_CONT 0x00000000u
51 #define SI_WIRELESS_ID 0x00c0ff00u
52 #define SI_WIRELESS_TYPE_ID (SI_WIRELESS_TYPE | SI_WIRELESS_ID)
54 #define SI_N64_CONTROLLER (SI_TYPE_N64 | 0x05000000)
55 #define SI_N64_MIC (SI_TYPE_N64 | 0x00010000)
56 #define SI_N64_KEYBOARD (SI_TYPE_N64 | 0x00020000)
57 #define SI_N64_MOUSE (SI_TYPE_N64 | 0x02000000)
58 #define SI_GBA (SI_TYPE_N64 | 0x00040000)
59 #define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
60 #define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
61 #define SI_GC_WAVEBIRD (SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
62 #define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
63 #define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
67 #endif /* __cplusplus */
69 typedef void (*SICallback
)(s32
,u32
);
70 typedef void (*RDSTHandler
)(u32
,void*);
74 u32
SI_IsChanBusy(s32 chan
);
75 void SI_EnablePolling(u32 poll
);
76 void SI_DisablePolling(u32 poll
);
77 void SI_SetCommand(s32 chan
,u32 cmd
);
78 u32
SI_GetStatus(s32 chan
);
79 u32
SI_GetResponse(s32 chan
,void *buf
);
80 u32
SI_GetResponseRaw(s32 chan
);
81 void SI_RefreshSamplingRate();
82 u32
SI_Transfer(s32 chan
,void *out
,u32 out_len
,void *in
,u32 in_len
,SICallback cb
,u32 us_delay
);
83 u32
SI_GetTypeAsync(s32 chan
,SICallback cb
);
84 u32
SI_GetType(s32 chan
);
85 u32
SI_GetCommand(s32 chan
);
86 void SI_TransferCommands();
87 u32
SI_RegisterPollingHandler(RDSTHandler handler
);
88 u32
SI_UnregisterPollingHandler(RDSTHandler handler
);
89 u32
SI_EnablePollingInterrupt(s32 enable
);
93 #endif /* __cplusplus */