SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Functions | Variables
sys-sdcard.h File Reference
#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include "sys-mmc.h"
#include "sys-sdhci.h"
Include dependency graph for sys-sdcard.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sdmmc_pdata_t
 

Functions

int sdmmc_init (sdmmc_pdata_t *data, sunxi_sdhci_t *hci)
 Initialize the SD/MMC interface.
 
uint32_t sdmmc_blk_read (sdmmc_pdata_t *data, uint8_t *buf, uint32_t blkno, uint32_t blkcnt)
 Read blocks from the SD/MMC device.
 
uint32_t sdmmc_blk_write (sdmmc_pdata_t *data, uint8_t *buf, uint32_t blkno, uint32_t blkcnt)
 Writes blocks of data to the SD/MMC device using the specified SDHCI instance.
 

Variables

sdmmc_pdata_t card0
 External declaration of the 'card0' SDMMC platform data structure.
 
sdmmc_pdata_t card2
 

Function Documentation

◆ sdmmc_blk_read()

uint32_t sdmmc_blk_read ( sdmmc_pdata_t data,
uint8_t buf,
uint32_t  blkno,
uint32_t  blkcnt 
)

Read blocks from the SD/MMC device.

Reads a specified number of blocks from the SD/MMC device using the provided platform data structure, destination buffer, block number, and block count. It calls the underlying function for reading blocks from the Sunxi MMC block device and returns the result.

Parameters
dataPointer to the SD/MMC platform data structure
bufPointer to the destination buffer where the read data will be stored
blknoThe starting block number to read from
blkcntThe number of blocks to read
Returns
Returns 0 on success, or an error code if the operation fails

◆ sdmmc_blk_write()

uint32_t sdmmc_blk_write ( sdmmc_pdata_t data,
uint8_t buf,
uint32_t  blkno,
uint32_t  blkcnt 
)

Writes blocks of data to the SD/MMC device using the specified SDHCI instance.

This function writes a specified number of blocks to the SD/MMC (Secure Digital/MultiMediaCard) device associated with the given SDHCI (SD Host Controller Interface) instance. It serves as a wrapper around the sunxi_mmc_blk_write function, providing a simplified interface for block data write operations.

Parameters
[in]dataA pointer to the SD/MMC platform data structure.
[in]bufA pointer to the source buffer from which data will be written to the SD/MMC device.
[in]blknoThe starting block number where the data writing begins.
[in]blkcntThe number of blocks to write.
Returns
The number of blocks successfully written, or 0 if writing failed.

◆ sdmmc_init()

int sdmmc_init ( sdmmc_pdata_t data,
sunxi_sdhci_t hci 
)

Initialize the SD/MMC interface.

Initializes the SD/MMC interface using the provided data structure and SD Host Controller instance. It sets the SD Host Controller instance and the online status in the data structure, and then initializes the MMC device. If the initialization is successful, it prints a message indicating the type of card detected and returns 0; otherwise, it returns -1.

Parameters
dataPointer to the SD/MMC platform data structure
hciPointer to the Sunxi SD Host Controller instance
Returns
Returns 0 on success, or -1 if the initialization fails

Variable Documentation

◆ card0

sdmmc_pdata_t card0
extern

External declaration of the 'card0' SDMMC platform data structure.

◆ card2

sdmmc_pdata_t card2
extern