lib/card_spi_driver.h File Reference

A driver for the DS Card SPI bus. More...


Enumerations

enum  card_spi_return_code { CARD_SPI_OK, CARD_SPI_BUSY }
 The driver function return codes. More...
enum  card_spi_clock_freq { CARD_SPI_4_MHZ_CLOCK = 0, CARD_SPI_2_MHZ_CLOCK = 1, CARD_SPI_1_MHZ_CLOCK = 2, CARD_SPI_524_KHZ_CLOCK = 3 }
 The SPI bus clock frequencies. More...

Functions

void init_cardSPI (void)
 Initialise the SPI driver.
void disable_cardSPI (void)
 Disable the Card SPI bus.
void config_cardSPI (enum card_spi_clock_freq freq, int use_interrupts)
 Set the configuration of the Card SPI bus.
void setupConsecutive_cardSPI (uint32_t num_bytes)
 Set up a transfer of a number of consecutive bytes.
enum card_spi_return_code read_cardSPI (uint8_t *read_byte)
 Read from the card SPI.
enum card_spi_return_code readBlocking_cardSPI (uint8_t *read_byte)
 Read from the card SPI blocking if it is busy.
enum card_spi_return_code write_cardSPI (uint8_t byte)
 Write a byte out on the SPI bus (initiates a transfer).
enum card_spi_return_code writeBlocking_cardSPI (uint8_t byte)
 Write a byte out on the SPI bus (initiates a transfer) blocking until the write can be performed.


Detailed Description

A driver for the DS Card SPI bus.


Enumeration Type Documentation

enum card_spi_clock_freq

The SPI bus clock frequencies.

Enumerator:
CARD_SPI_4_MHZ_CLOCK  4 MHz
CARD_SPI_2_MHZ_CLOCK  2 MHz
CARD_SPI_1_MHZ_CLOCK  1 MHz
CARD_SPI_524_KHZ_CLOCK  524 KHz

enum card_spi_return_code

The driver function return codes.

Enumerator:
CARD_SPI_OK  All was well
CARD_SPI_BUSY  The SPI bus is busy


Function Documentation

void disable_cardSPI ( void   ) 

Disable the Card SPI bus.

Disables the Card SPI bus. A write call will enable the bus again.

void init_cardSPI ( void   ) 

Initialise the SPI driver.

Initialise the Card SPI driver.

enum card_spi_return_code read_cardSPI ( uint8_t *  read_byte  ) 

Read from the card SPI.

If the SPI bus is busy then the read will fail. Otherwise the last received byte is returned.

Parameters:
read_byte Pointer to the location to store the received byte.
Returns:
CARD_SPI_OK if the read was successful or CARD_SPI_BUSY if a transfer is in progress.

enum card_spi_return_code readBlocking_cardSPI ( uint8_t *  read_byte  ) 

Read from the card SPI blocking if it is busy.

Block until any outstanding transfer has completed and then return the byte receive over the SPI bus. The call is always successful, the function parameters and return type is kept in the same format as the non blocking function.

Parameters:
read_byte Pointer to the location to store the received byte.
Returns:
CARD_SPI_OK if the read was successful.

void setupConsecutive_cardSPI ( uint32_t  num_bytes  ) 

Set up a transfer of a number of consecutive bytes.

The chip select will remain low (active) until the supplied number of bytes have been sent out.

enum card_spi_return_code write_cardSPI ( uint8_t  byte  ) 

Write a byte out on the SPI bus (initiates a transfer).

Writes the supplied byte out on the SPI bus. The write initiates a transfer which once completed will mean the next received byte is available.

Parameters:
byte The byte value to be sent out.
Returns:
CARD_SPI_OK if the write was successful or CARD_SPI_BUSY if the SPI bus is busy.

enum card_spi_return_code writeBlocking_cardSPI ( uint8_t  byte  ) 

Write a byte out on the SPI bus (initiates a transfer) blocking until the write can be performed.

Block until any outstanding transfer has completed and then send the byte over the SPI bus. The call is always successful, the function parameters and return type is kept in the same format as the non blocking function.

Parameters:
byte The byte value to be sent
Returns:
CARD_SPI_OK if the read was successful.


Generated on Sat Aug 12 18:40:55 2006 for Nintendo DS SPI UART Bridge Driver by  doxygen 1.4.7