libogc  v2.9.0
Macros | Typedefs | Functions
exi.h File Reference

EXI subsystem. More...

#include "gctypes.h"

Macros

#define EXI_CHANNEL_0   0
 
#define EXI_CHANNEL_1   1
 
#define EXI_CHANNEL_2   2
 
#define EXI_CHANNEL_MAX   3
 
#define EXI_DEVICE_0   0
 
#define EXI_DEVICE_1   1
 
#define EXI_DEVICE_2   2
 
#define EXI_DEVICE_MAX   3
 
#define EXI_FLAG_ATTACH   0x0008
 
#define EXI_FLAG_DMA   0x0001
 
#define EXI_FLAG_IMM   0x0002
 
#define EXI_FLAG_LOCKED   0x0010
 
#define EXI_FLAG_SELECT   0x0004
 
#define EXI_MEMCARD1019   0x00000040
 
#define EXI_MEMCARD123   0x00000008
 
#define EXI_MEMCARD2043   0x00000080
 
#define EXI_MEMCARD251   0x00000010
 
#define EXI_MEMCARD507   0x00000020
 
#define EXI_MEMCARD59   0x00000004
 
#define EXI_READ   0
 
#define EXI_READWRITE   2
 
#define EXI_SPEED16MHZ   4
 
#define EXI_SPEED1MHZ   0
 
#define EXI_SPEED2MHZ   1
 
#define EXI_SPEED32MHZ   5
 
#define EXI_SPEED4MHZ   2
 
#define EXI_SPEED8MHZ   3
 
#define EXI_WRITE   1
 

Typedefs

typedef s32(* EXICallback) (s32 chn, s32 dev)
 function pointer typedef for the user's EXI callback More...
 

Functions

s32 EXI_Attach (s32 nChn, EXICallback ext_cb)
 Attach the device on the given channel. More...
 
s32 EXI_Deselect (s32 nChn)
 Deselects the EXI channel. More...
 
s32 EXI_Detach (s32 nChn)
 Detach the device on the given channel. More...
 
s32 EXI_Dma (s32 nChn, void *pData, u32 nLen, u32 nMode, EXICallback tc_cb)
 Initializes a DMA mode EXI transfer. More...
 
s32 EXI_GetID (s32 nChn, s32 nDev, u32 *nId)
 Get the ID of the connected EXI device on the given channel. More...
 
s32 EXI_GetState (s32 nChn)
 Get the EXI state. More...
 
s32 EXI_Imm (s32 nChn, void *pData, u32 nLen, u32 nMode, EXICallback tc_cb)
 Initializes an immediate mode EXI transfer. More...
 
s32 EXI_ImmEx (s32 nChn, void *pData, u32 nLen, u32 nMode)
 Initializes an extended immediate mode EXI transfer. More...
 
s32 EXI_Lock (s32 nChn, s32 nDev, EXICallback unlockCB)
 Try to lock the desired EXI channel on the given device. More...
 
s32 EXI_Probe (s32 nChn)
 Probes the EXI channel. More...
 
s32 EXI_ProbeEx (s32 nChn)
 Performs an extended probe of the EXI channel. More...
 
void EXI_ProbeReset (void)
 Resets certain internal flags and counters and performs a probe on all 3 channels. More...
 
EXICallback EXI_RegisterEXICallback (s32 nChn, EXICallback exi_cb)
 Register a callback function in the EXI driver for the EXI interrupt. More...
 
s32 EXI_Select (s32 nChn, s32 nDev, s32 nFrq)
 Selects the spedified EXI channel on the given device with the given frequency. More...
 
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 frequence. More...
 
s32 EXI_Sync (s32 nChn)
 Synchronize or finish respectively the last EXI transfer. More...
 
s32 EXI_Unlock (s32 nChn)
 Unlock the desired EXI channel. More...
 

Detailed Description

EXI subsystem.

Typedef Documentation

◆ EXICallback

s32(* EXICallback)(s32 chn, s32 dev)

function pointer typedef for the user's EXI callback

Parameters
chnEXI channel
devEXI device

Function Documentation

◆ EXI_Attach()

s32 EXI_Attach ( s32  nChn,
EXICallback  ext_cb 
)

Attach the device on the given channel.

Parameters
[in]nChnEXI channel to select
[in]ext_cbpointer to callback to call when device is physically removed.
Returns
1 on success, <=0 on error

◆ EXI_Deselect()

s32 EXI_Deselect ( s32  nChn)

Deselects the EXI channel.

Parameters
[in]nChnEXI channel to deselect
Returns
1 on success, <=0 on error

◆ EXI_Detach()

s32 EXI_Detach ( s32  nChn)

Detach the device on the given channel.

Parameters
[in]nChnEXI channel to select
Returns
1 on success, <=0 on error

◆ EXI_Dma()

s32 EXI_Dma ( s32  nChn,
void *  pData,
u32  nLen,
u32  nMode,
EXICallback  tc_cb 
)

Initializes a DMA mode EXI transfer.

Parameters
[in]nChnEXI channel to select
[in,out]pDatapointer to a buffer to read/copy from/to data.
[in]nLenlenght of data to transfer.
[in]nModedirection of transferoperation(EXI_READ,EXI_WRITE,EXI_READWRITE)
[in]tc_cbpointer to a callback to call when transfer has completed. May be NULL.
Returns
1 on success, <=0 on error

◆ EXI_GetID()

s32 EXI_GetID ( s32  nChn,
s32  nDev,
u32 nId 
)

Get the ID of the connected EXI device on the given channel.

Parameters
[in]nChnEXI channel to select
[in]nDevEXI device to select
[out]nIdEXI device ID to return.
Returns
1 on success, <=0 on error

◆ EXI_GetState()

s32 EXI_GetState ( s32  nChn)

Get the EXI state.

Parameters
[in]nChnEXI channel to select
Returns
EXI channels state flag.

◆ EXI_Imm()

s32 EXI_Imm ( s32  nChn,
void *  pData,
u32  nLen,
u32  nMode,
EXICallback  tc_cb 
)

Initializes an immediate mode EXI transfer.

Parameters
[in]nChnEXI channel to select
[in,out]pDatapointer to a buffer to read/copy from/to data.
[in]nLenlenght of data to transfer <=4.
[in]nModedirection of transferoperation(EXI_READ,EXI_WRITE,EXI_READWRITE)
[in]tc_cbpointer to a callback to call when transfer has completed. May be NULL.
Returns
1 on success, <=0 on error

◆ EXI_ImmEx()

s32 EXI_ImmEx ( s32  nChn,
void *  pData,
u32  nLen,
u32  nMode 
)

Initializes an extended immediate mode EXI transfer.

Parameters
[in]nChnEXI channel to select
[in,out]pDatapointer to a buffer to read/copy from/to data.
[in]nLenlenght of data to transfer.
[in]nModedirection of transferoperation(EXI_READ,EXI_WRITE,EXI_READWRITE)
Returns
1 on success, <=0 on error

◆ EXI_Lock()

s32 EXI_Lock ( s32  nChn,
s32  nDev,
EXICallback  unlockCB 
)

Try to lock the desired EXI channel on the given device.

Parameters
[in]nChnEXI channel to lock
[in]nDevEXI device to lock
[in]unlockCBpointer to callback to call when EXI_Unlock() is called. Thus allowing us a small way of mutual exclusion.
Returns
1 on success, <=0 on error

◆ EXI_Probe()

s32 EXI_Probe ( s32  nChn)

Probes the EXI channel.

Parameters
[in]nChnEXI channel to probe
Returns
1 on success, <=0 on error

◆ EXI_ProbeEx()

s32 EXI_ProbeEx ( s32  nChn)

Performs an extended probe of the EXI channel.

Parameters
[in]nChnEXI channel to probe
Returns
1 on success, <=0 on error

◆ EXI_ProbeReset()

void EXI_ProbeReset ( void  )

Resets certain internal flags and counters and performs a probe on all 3 channels.

Returns
nothing

◆ EXI_RegisterEXICallback()

EXICallback EXI_RegisterEXICallback ( s32  nChn,
EXICallback  exi_cb 
)

Register a callback function in the EXI driver for the EXI interrupt.

Parameters
[in]nChnEXI channel to select
[in]exi_cbpointer to the function which to call when EXI interrupt has triggered.
Returns
old callback function pointer or NULL

◆ EXI_Select()

s32 EXI_Select ( s32  nChn,
s32  nDev,
s32  nFrq 
)

Selects the spedified EXI channel on the given device with the given frequency.

Parameters
[in]nChnEXI channel to select
[in]nDevEXI device to select
[in]nFrqEXI frequency to select
Returns
1 on success, <=0 on error

◆ EXI_SelectSD()

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 frequence.

Parameters
[in]nChnEXI channel to select
[in]nDevEXI device to select
[in]nFrqEXI frequency to select
Returns
1 on success, <=0 on error

◆ EXI_Sync()

s32 EXI_Sync ( s32  nChn)

Synchronize or finish respectively the last EXI transfer.

Parameters
[in]nChnEXI channel to select
Returns
1 on success, <=0 on error

◆ EXI_Unlock()

s32 EXI_Unlock ( s32  nChn)

Unlock the desired EXI channel.

Parameters
[in]nChnEXI channel to unlock
Returns
1 on success, <=0 on error