RetroArch
exi.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------
2 
3 exi.h -- EXI subsystem
4 
5 Copyright (C) 2004
6 Michael Wiedenbauer (shagkur)
7 Dave Murphy (WinterMute)
8 
9 This software is provided 'as-is', without any express or implied
10 warranty. In no event will the authors be held liable for any
11 damages arising from the use of this software.
12 
13 Permission is granted to anyone to use this software for any
14 purpose, including commercial applications, and to alter it and
15 redistribute it freely, subject to the following restrictions:
16 
17 1. The origin of this software must not be misrepresented; you
18 must not claim that you wrote the original software. If you use
19 this software in a product, an acknowledgment in the product
20 documentation would be appreciated but is not required.
21 
22 2. Altered source versions must be plainly marked as such, and
23 must not be misrepresented as being the original software.
24 
25 3. This notice may not be removed or altered from any source
26 distribution.
27 
28 -------------------------------------------------------------*/
29 
30 
31 #ifndef __EXI_H__
32 #define __EXI_H__
33 
41 #include "gctypes.h"
42 
48 #define EXI_READ 0
49 #define EXI_WRITE 1
50 #define EXI_READWRITE 2
62 #define EXI_CHANNEL_0 0
63 #define EXI_CHANNEL_1 1
64 #define EXI_CHANNEL_2 2
65 #define EXI_CHANNEL_MAX 3
77 #define EXI_DEVICE_0 0
78 #define EXI_DEVICE_1 1
79 #define EXI_DEVICE_2 2
80 #define EXI_DEVICE_MAX 3
92 #define EXI_SPEED1MHZ 0
93 #define EXI_SPEED2MHZ 1
94 #define EXI_SPEED4MHZ 2
95 #define EXI_SPEED8MHZ 3
96 #define EXI_SPEED16MHZ 4
97 #define EXI_SPEED32MHZ 5
109 #define EXI_FLAG_DMA 0x0001
110 #define EXI_FLAG_IMM 0x0002
111 #define EXI_FLAG_SELECT 0x0004
112 #define EXI_FLAG_ATTACH 0x0008
113 #define EXI_FLAG_LOCKED 0x0010
125 #define EXI_MEMCARD59 0x00000004
126 #define EXI_MEMCARD123 0x00000008
127 #define EXI_MEMCARD251 0x00000010
128 #define EXI_MEMCARD507 0x00000020
129 #define EXI_MEMCARD1019 0x00000040
130 #define EXI_MEMCARD2043 0x00000080
137 #ifdef __cplusplus
138  extern "C" {
139 #endif /* __cplusplus */
140 
146 typedef s32 (*EXICallback)(s32 chn,s32 dev);
147 
148 
155 s32 EXI_ProbeEx(s32 nChn);
156 
157 
164 s32 EXI_Probe(s32 nChn);
165 
166 
175 s32 EXI_Lock(s32 nChn,s32 nDev,EXICallback unlockCB);
176 
177 
184 s32 EXI_Unlock(s32 nChn);
185 
186 
195 s32 EXI_Select(s32 nChn,s32 nDev,s32 nFrq);
196 
197 
206 s32 EXI_SelectSD(s32 nChn,s32 nDev,s32 nFrq);
207 
208 
215 s32 EXI_Deselect(s32 nChn);
216 
217 
224 s32 EXI_Sync(s32 nChn);
225 
226 
237 s32 EXI_Imm(s32 nChn,void *pData,u32 nLen,u32 nMode,EXICallback tc_cb);
238 
239 
249 s32 EXI_ImmEx(s32 nChn,void *pData,u32 nLen,u32 nMode);
250 
251 
262 s32 EXI_Dma(s32 nChn,void *pData,u32 nLen,u32 nMode,EXICallback tc_cb);
263 
264 
271 s32 EXI_GetState(s32 nChn);
272 
273 
282 s32 EXI_GetID(s32 nChn,s32 nDev,u32 *nId);
283 
284 
292 s32 EXI_Attach(s32 nChn,EXICallback ext_cb);
293 
294 
301 s32 EXI_Detach(s32 nChn);
302 
303 
309 void EXI_ProbeReset();
310 
311 
320 
321 #ifdef __cplusplus
322  }
323 #endif /* __cplusplus */
324 
325 #endif
int32_t s32
32bit signed integer
Definition: gctypes.h:24
Data type definitions.
s32 EXI_GetState(s32 nChn)
Get the EXI state.
Definition: exi.c:498
s32 EXI_Lock(s32 nChn, s32 nDev, EXICallback unlockCB)
Try to lock the desired EXI channel on the given device.
Definition: exi.c:215
s32 EXI_Imm(s32 nChn, void *pData, u32 nLen, u32 nMode, EXICallback tc_cb)
Initializes an immediate mode EXI transfer.
Definition: exi.c:417
s32 EXI_Select(s32 nChn, s32 nDev, s32 nFrq)
Selects the spedified EXI channel on the given device with the given frequency.
Definition: exi.c:277
s32 EXI_Unlock(s32 nChn)
Unlock the desired EXI channel.
Definition: exi.c:244
s32 EXI_ImmEx(s32 nChn, void *pData, u32 nLen, u32 nMode)
Initializes an extended immediate mode EXI transfer.
Definition: exi.c:450
s32 EXI_Dma(s32 nChn, void *pData, u32 nLen, u32 nMode, EXICallback tc_cb)
Initializes a DMA mode EXI transfer.
Definition: exi.c:470
s32 EXI_ProbeEx(s32 nChn)
Performs an extended probe of the EXI channel.
Definition: exi.c:620
s32 EXI_GetID(s32 nChn, s32 nDev, u32 *nId)
Get the ID of the connected EXI device on the given channel.
Definition: exi.c:511
void EXI_ProbeReset()
Resets certain internal flags and counters and performs a probe on all 3 channels.
Definition: exi.c:627
s32 EXI_Attach(s32 nChn, EXICallback ext_cb)
Attach the device on the given channel.
Definition: exi.c:560
s32 EXI_Detach(s32 nChn)
Detach the device on the given channel.
Definition: exi.c:576
EXICallback EXI_RegisterEXICallback(s32 nChn, EXICallback exi_cb)
Register a callback function in the EXI driver for the EXI interrupt.
Definition: exi.c:593
s32 EXI_SelectSD(s32 nChn, s32 nDev, s32 nFrq)
Performs a special select, for SD cards or adapters respectively, on the given device with the given ...
Definition: exi.c:316
s32 EXI_Probe(s32 nChn)
Probes the EXI channel.
Definition: exi.c:607
s32 EXI_Deselect(s32 nChn)
Deselects the EXI channel.
Definition: exi.c:359
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19
s32(* EXICallback)(s32 chn, s32 dev)
function pointer typedef for the user's EXI callback
Definition: exi.h:146
s32 EXI_Sync(s32 nChn)
Synchronize or finish respectively the last EXI transfer.
Definition: exi.c:390