Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

Macros

#define SD_MMC_INSERTED   1
 
#define SD_MMC_REMOVED   0
 
#define SD_MMC_REMOVING   2
 

Functions

Ctrl_status sd_mmc_spi_mem_2_ram (uint32_t addr, void *ram)
 This function reads 1 sector from SD/MMC to internal ram buffer. More...
 
void sd_mmc_spi_mem_init (void)
 This function initializes the hw/sw resources required to drive the SD_MMC_SPI. More...
 
Ctrl_status sd_mmc_spi_ram_2_mem (uint32_t addr, const void *ram)
 This function initializes the memory for a write operation from ram buffer to SD/MMC (1 sector) More...
 
Ctrl_status sd_mmc_spi_read_capacity (uint32_t *nb_sector)
 This function gives the address of the last valid sector. More...
 
bool sd_mmc_spi_removal (void)
 This function tells if the memory has been removed or not. More...
 
Ctrl_status sd_mmc_spi_test_unit_ready (void)
 This function tests the state of the SD_MMC memory and sends it to the Host. More...
 
Ctrl_status sd_mmc_spi_usb_read_10 (uint32_t addr, uint16_t nb_sector)
 This function performs a read operation of n sectors from a given address on. More...
 
Ctrl_status sd_mmc_spi_usb_write_10 (uint32_t addr, uint16_t nb_sector)
 This function initializes the SD/MMC memory for a write operation. More...
 
bool sd_mmc_spi_wr_protect (void)
 This function returns the write protected status of the memory. More...
 

#define SD_MMC_INSERTED   1
#define SD_MMC_REMOVED   0
#define SD_MMC_REMOVING   2

Ctrl_status sd_mmc_spi_mem_2_ram ( uint32_t  addr,
void *  ram 
)

This function reads 1 sector from SD/MMC to internal ram buffer.

    DATA FLOW is: SD/MMC => RAM

(sector = 512B)

Parameters
addrSector address to read
ramRam buffer pointer
Returns
Ctrl_status It is ready -> CTRL_GOOD An error occurs -> CTRL_FAIL

References CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, Sd_mmc_spi_access_signal_off, Sd_mmc_spi_access_signal_on, sd_mmc_spi_check_presence(), sd_mmc_spi_init_done, sd_mmc_spi_mem_init(), sd_mmc_spi_read_close(), sd_mmc_spi_read_open(), and sd_mmc_spi_read_sector_to_ram().

void sd_mmc_spi_mem_init ( void  )

This function initializes the hw/sw resources required to drive the SD_MMC_SPI.

/

References sd_mmc_spi_internal_init().

Referenced by sd_mmc_spi_mem_2_ram(), sd_mmc_spi_ram_2_mem(), sd_mmc_spi_read_capacity(), sd_mmc_spi_usb_read_10(), and sd_mmc_spi_usb_write_10().

Ctrl_status sd_mmc_spi_ram_2_mem ( uint32_t  addr,
const void *  ram 
)

This function initializes the memory for a write operation from ram buffer to SD/MMC (1 sector)

    DATA FLOW is: RAM => SD/MMC

(sector = 512B)

Parameters
addrSector address to write
ramRam buffer pointer
Returns
Ctrl_status It is ready -> CTRL_GOOD An error occurs -> CTRL_FAIL

References CTRL_GOOD, CTRL_NO_PRESENT, Sd_mmc_spi_access_signal_off, Sd_mmc_spi_access_signal_on, sd_mmc_spi_check_presence(), sd_mmc_spi_init_done, sd_mmc_spi_mem_init(), sd_mmc_spi_write_close(), sd_mmc_spi_write_open(), and sd_mmc_spi_write_sector_from_ram().

Ctrl_status sd_mmc_spi_read_capacity ( uint32_t *  nb_sector)

This function gives the address of the last valid sector.

Parameters
*nb_sectornumber of sector (sector = 512B). OUT
Returns
Ctrl_status Media ready -> CTRL_GOOD Media not present -> CTRL_NO_PRESENT /

References CTRL_GOOD, CTRL_NO_PRESENT, Sd_mmc_spi_access_signal_off, Sd_mmc_spi_access_signal_on, sd_mmc_spi_init_done, sd_mmc_spi_last_block_address, and sd_mmc_spi_mem_init().

bool sd_mmc_spi_removal ( void  )

This function tells if the memory has been removed or not.

Returns
false -> The memory isn't removed
false -> The memory isn't removed /
Ctrl_status sd_mmc_spi_test_unit_ready ( void  )

This function tests the state of the SD_MMC memory and sends it to the Host.

    For a PC, this device is seen as a removable media
    Before indicating any modification of the status of the media (GOOD->NO_PRESENT or vice-versa),
     the function must return the BUSY data to make the PC accepting the change
Returns
Ctrl_status Media is ready -> CTRL_GOOD Media not present -> CTRL_NO_PRESENT Media has changed -> CTRL_BUSY /

References CTRL_BUSY, CTRL_GOOD, CTRL_NO_PRESENT, SD_MMC_INSERTED, SD_MMC_REMOVED, SD_MMC_REMOVING, Sd_mmc_spi_access_signal_off, Sd_mmc_spi_access_signal_on, sd_mmc_spi_init_done, sd_mmc_spi_mem_check(), and sd_mmc_spi_presence_status.

Ctrl_status sd_mmc_spi_usb_read_10 ( uint32_t  addr,
uint16_t  nb_sector 
)

This function performs a read operation of n sectors from a given address on.

(sector = 512B)

    DATA FLOW is: SD_MMC => USB
Parameters
addrSector address to start the read from
nb_sectorNumber of sectors to transfer
Returns
Ctrl_status It is ready -> CTRL_GOOD A error occur -> CTRL_FAIL

References CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, Sd_mmc_spi_access_signal_off, Sd_mmc_spi_access_signal_on, sd_mmc_spi_init_done, sd_mmc_spi_mem_init(), sd_mmc_spi_read_close(), sd_mmc_spi_read_multiple_sector(), and sd_mmc_spi_read_open().

Ctrl_status sd_mmc_spi_usb_write_10 ( uint32_t  addr,
uint16_t  nb_sector 
)

This function initializes the SD/MMC memory for a write operation.

    DATA FLOW is: USB => SD_MMC

(sector = 512B)

Parameters
addrSector address to start write
nb_sectorNumber of sectors to transfer
Returns
Ctrl_status It is ready -> CTRL_GOOD An error occurs -> CTRL_FAIL

References CTRL_GOOD, CTRL_NO_PRESENT, Sd_mmc_spi_access_signal_off, Sd_mmc_spi_access_signal_on, sd_mmc_spi_init_done, sd_mmc_spi_mem_init(), sd_mmc_spi_write_close(), sd_mmc_spi_write_multiple_sector(), sd_mmc_spi_write_open(), and status.

bool sd_mmc_spi_wr_protect ( void  )

This function returns the write protected status of the memory.

Only used by memory removal with a HARDWARE SPECIFIC write protected detection ! The user must unplug the memory to change this write protected status, which cannot be for a SD_MMC.

Returns
false -> the memory is not write-protected (always) /