00001 #ifndef FIFOCOMMON_H
00002 #define FIFOCOMMON_H
00003
00004 #include "ndstypes.h"
00005
00010 typedef enum {
00011 FIFO_PM = 0,
00012 FIFO_SOUND = 1,
00013 FIFO_SYSTEM = 2,
00014 FIFO_MAXMOD = 3,
00015 FIFO_DSWIFI = 4,
00016 FIFO_RSDV_01 = 5,
00017 FIFO_RSVD_02 = 6,
00018 FIFO_RSVD_03 = 7,
00019 FIFO_USER_01 = 8,
00020 FIFO_USER_02 = 9,
00021 FIFO_USER_03 = 10,
00022 FIFO_USER_04 = 11,
00023 FIFO_USER_05 = 12,
00024 FIFO_USER_06 = 13,
00025 FIFO_USER_07 = 14,
00026 FIFO_USER_08 = 15,
00027 } FifoChannels;
00028
00029
00030 typedef enum {
00031 SOUND_SET_PAN = 0 << 20,
00032 SOUND_SET_VOLUME = 1 << 20,
00033 SOUND_SET_FREQ = 2 << 20,
00034 SOUND_SET_WAVEDUTY = 3 << 20,
00035 SOUND_MASTER_ENABLE = 4 << 20,
00036 SOUND_MASTER_DISABLE = 5 << 20,
00037 SOUND_PAUSE = 6 << 20,
00038 SOUND_RESUME = 7 << 20,
00039 SOUND_KILL = 8 << 20,
00040 SOUND_SET_MASTER_VOL = 9 << 20,
00041 MIC_STOP = 10 << 20
00042
00043 } FifoSoundCommand;
00044
00045 typedef enum {
00046 SYS_REQ_TOUCH,
00047 SYS_REQ_KEYS,
00048 SYS_REQ_TIME,
00049
00050 } FifoSystemCommands;
00051
00052 typedef enum {
00053 PM_REQ_ON = (1<<16),
00054 PM_REQ_OFF = (2<<16),
00055 PM_REQ_LED = (3<<16),
00056 PM_REQ_SLEEP = (4<<16),
00057 PM_REQ_SLEEP_DISABLE = (5<<16),
00058 PM_REQ_SLEEP_ENABLE = (6<<16)
00059 }FifoPMCommands;
00060
00061 typedef enum {
00062 WIFI_ENABLE,
00063 WIFI_DISABLE,
00064 WIFI_SYNC,
00065 WIFI_STARTUP
00066 } FifoWifiCommands;
00067
00068
00069
00073 typedef enum {
00074 PM_LED_ON =(0<<4),
00075 PM_LED_SLEEP =(1<<4),
00076 PM_LED_BLINK =(3<<4),
00077 }PM_LedBlinkMode;
00078
00079
00080 #ifdef __cplusplus
00081 extern "C" {
00082 #endif
00083
00084 #if FIFO_RIGOROUS_ERROR_CHECKING
00085 int fifoError(char *, ...);
00086 #endif
00087
00088
00089
00090
00091
00092 typedef void (*FifoAddressHandlerFunc)(void * address, void * userdata);
00093
00094
00095 typedef void (*FifoValue32HandlerFunc)(u32 value32, void * userdata);
00096
00097
00098 typedef void (*FifoDatamsgHandlerFunc)(int num_bytes, void * userdata);
00099
00107 bool fifoInit();
00108
00116 bool fifoSendAddress(int channel, void *address);
00117
00128 bool fifoSendValue32(int channel, u32 value32);
00129
00140 bool fifoSendDatamsg(int channel, int num_bytes, u8 * data_array);
00141
00142
00143
00144
00145
00146
00156 bool fifoSetAddressHandler(int channel, FifoAddressHandlerFunc newhandler, void * userdata);
00157
00167 bool fifoSetValue32Handler(int channel, FifoValue32HandlerFunc newhandler, void * userdata);
00168
00169
00179 bool fifoSetDatamsgHandler(int channel, FifoDatamsgHandlerFunc newhandler, void * userdata);
00180
00181
00182
00183
00184 bool fifoCheckAddress(int channel);
00185 bool fifoCheckValue32(int channel);
00186 bool fifoCheckDatamsg(int channel);
00187
00188 int fifoCheckDatamsgLength(int channel);
00189
00190
00191 void * fifoGetAddress(int channel);
00192
00193 u32 fifoGetValue32(int channel);
00194
00195
00196 int fifoGetDatamsg(int channel, int buffersize, u8 * destbuffer);
00197
00198
00199
00200 #ifdef __cplusplus
00201 };
00202 #endif
00203
00204
00205 #endif