libnds
Loading...
Searching...
No Matches
Functions
tmio.h File Reference

TMIO ARM7 module. More...

#include <assert.h>
#include <stddef.h>

Functions

bool TMIO_cardDetected (void)
 Checks if a MMC/SD card is inserted.
 
bool TMIO_cardWritable (void)
 Checks if the write protect slider is set to locked.
 
void TMIO_deinit (void)
 Deinitializes the tmio driver.
 
void TMIO_init (void)
 Initializes the tmio driver.
 
void TMIO_initPort (TmioPort *const port, const u8 portNum)
 Initializes a tmio port to defaults.
 
void TMIO_powerupSequence (TmioPort *const port)
 Handles the device specific powerup sequence including the 74 clocks.
 
u32 TMIO_sendCommand (TmioPort *const port, const u16 cmd, const u32 arg)
 Sends a command.
 
static void TMIO_setBlockLen (TmioPort *const port, u16 blockLen)
 Sets the transfer block length for a tmio port.
 
static void TMIO_setBuffer (TmioPort *const port, void *buf, const u16 blocks)
 Sets a transfer buffer for a tmio port.
 
static void TMIO_setBusWidth (TmioPort *const port, const u8 width)
 Sets the bus width for a tmio port.
 
static void TMIO_setClock (TmioPort *const port, const u32 clk)
 Sets the clock for a tmio port.
 

Detailed Description

TMIO ARM7 module.

Function Documentation

◆ TMIO_cardDetected()

bool TMIO_cardDetected ( void  )

Checks if a MMC/SD card is inserted.

Returns
Returns true if a card is inserted.

◆ TMIO_cardWritable()

bool TMIO_cardWritable ( void  )

Checks if the write protect slider is set to locked.

Returns
Returns true if the card is unlocked.

◆ TMIO_initPort()

void TMIO_initPort ( TmioPort *const  port,
const u8  portNum 
)

Initializes a tmio port to defaults.

Parameters
portA pointer to the port struct.
[in]portNumThe port number.

◆ TMIO_powerupSequence()

void TMIO_powerupSequence ( TmioPort *const  port)

Handles the device specific powerup sequence including the 74 clocks.

Parameters
portA pointer to the port struct.

◆ TMIO_sendCommand()

u32 TMIO_sendCommand ( TmioPort *const  port,
const u16  cmd,
const u32  arg 
)

Sends a command.

Parameters
portA pointer to the port struct.
[in]cmdThe command.
[in]argThe argument for the command.
Returns
Returns 0 on success otherwise see REG_SD_STATUS1/2 bits.

◆ TMIO_setBlockLen()

static void TMIO_setBlockLen ( TmioPort *const  port,
u16  blockLen 
)
inlinestatic

Sets the transfer block length for a tmio port.

Parameters
portA pointer to the port struct.
[in]blockLenThe block length. Caution: Provide a buffer with multiple of 4 size regardless of block length.

◆ TMIO_setBuffer()

static void TMIO_setBuffer ( TmioPort *const  port,
void *  buf,
const u16  blocks 
)
inlinestatic

Sets a transfer buffer for a tmio port.

Parameters
portA pointer to the port struct.
bufThe buffer pointer.
[in]blocksThe number of blocks to transfer.

◆ TMIO_setBusWidth()

static void TMIO_setBusWidth ( TmioPort *const  port,
const u8  width 
)
inlinestatic

Sets the bus width for a tmio port.

Parameters
portA pointer to the port struct.
[in]widthThe bus width.

◆ TMIO_setClock()

static void TMIO_setClock ( TmioPort *const  port,
const u32  clk 
)
inlinestatic

Sets the clock for a tmio port.

Parameters
portA pointer to the port struct.
[in]clkThe target clock in Hz.