MMC/SD card raw access


Detailed Description

This module implements read and write access to MMC and SD cards.

It serves as a low-level driver for the higher level modules such as partition and file system access.


Files

file  sd_raw.c
 MMC/SD raw access implementation.
file  sd_raw.h
 MMC/SD raw access header.
file  sd_raw_config.h
 MMC/SD support configuration.

Modules

 MMC/SD configuration
 Preprocessor defines to configure the MMC/SD support.

Functions

uint8_t sd_raw_init ()
 Initializes memory card communication.
uint8_t sd_raw_available ()
 Checks wether a memory card is located in the slot.
uint8_t sd_raw_locked ()
 Checks wether the memory card is locked for write access.
uint8_t sd_raw_read (uint32_t offset, uint8_t *buffer, uint16_t length)
 Reads raw data from the card.
uint8_t sd_raw_read_interval (uint32_t offset, uint8_t *buffer, uint16_t interval, uint16_t length, sd_raw_interval_handler callback, void *p)
 Continuously reads units of interval bytes and calls a callback function.
uint8_t sd_raw_write (uint32_t offset, const uint8_t *buffer, uint16_t length)
 Writes raw data to the card.


Function Documentation

uint8_t sd_raw_available  ) 
 

Checks wether a memory card is located in the slot.

Returns:
1 if the card is available, 0 if it is not.

uint8_t sd_raw_init  ) 
 

Initializes memory card communication.

Returns:
0 on failure, 1 on success.

uint8_t sd_raw_locked  ) 
 

Checks wether the memory card is locked for write access.

Returns:
1 if the card is locked, 0 if it is not.

uint8_t sd_raw_read uint32_t  offset,
uint8_t *  buffer,
uint16_t  length
 

Reads raw data from the card.

Parameters:
[in] offset The offset from which to read.
[out] buffer The buffer into which to write the data.
[in] length The number of bytes to read.
Returns:
0 on failure, 1 on success.
See also:
sd_raw_read_interval, sd_raw_write

uint8_t sd_raw_read_interval uint32_t  offset,
uint8_t *  buffer,
uint16_t  interval,
uint16_t  length,
sd_raw_interval_handler  callback,
void *  p
 

Continuously reads units of interval bytes and calls a callback function.

This function starts reading at the specified offset. Every interval bytes, it calls the callback function with the associated data buffer.

By returning zero, the callback may stop reading.

Note:
Within the callback function, you can not start another read or write operation.

This function only works if the following conditions are met:

  • (offset - (offset % 512)) % interval == 0
  • length % interval == 0
Parameters:
[in] offset Offset from which to start reading.
[in] buffer Pointer to a buffer which is at least interval bytes in size.
[in] interval Number of bytes to read before calling the callback function.
[in] length Number of bytes to read altogether.
[in] callback The function to call every interval bytes.
[in] p An opaque pointer directly passed to the callback function.
Returns:
0 on failure, 1 on success
See also:
sd_raw_read, sd_raw_write

uint8_t sd_raw_write uint32_t  offset,
const uint8_t *  buffer,
uint16_t  length
 

Writes raw data to the card.

Parameters:
[in] offset The offset where to start writing.
[in] buffer The buffer containing the data to be written.
[in] length The number of bytes to write.
Returns:
0 on failure, 1 on success.
See also:
sd_raw_read


Generated on Thu Mar 16 13:43:58 2006 for sd-reader by  doxygen 1.4.6