stable
penguin 3 years ago
parent 41366e7e01
commit 80bdb7b806

@ -0,0 +1,37 @@
#include "sd_mmc.h"
sd_mmc_err_t sd_mmc_init(void)
{
sd_mmc_err_t ret = SD_MMC_SUCCESS;
do
{
// power up sequence
// go idle
}while(0);
return ret;
}
sd_mmc_err_t sd_mmc_select(uint8_t slot, uint32_t clock, uint8_t bus_width, bool high_speed)
{
sd_mmc_err_t ret = SD_MMC_SUCCESS;
return ret;
}
sd_mmc_err_t sd_mmc_send_command(uint8_t command, uint32_t arg, uint8_t crc)
{
sd_mmc_err_t ret = SD_MMC_SUCCESS;
return ret;
}
sd_mmc_err_t sd_mmc_read_res1(void)
{
sd_mmc_err_t ret = SD_MMC_SUCCESS;
return ret;
}

@ -0,0 +1,32 @@
#ifndef _SD_MMC_H_
#define _SD_MMC_H_
#include "atmel_start.h"
typedef enum sd_mmc_mode_t
{
SD_MMC_MODE_SPI = 0,
SD_MMC_MODE_MCI = 1
}sd_mmc_mode_t;
typedef enum sd_mmc_err_t
{
SD_MMC_SUCCESS = 0,
SD_MMC_FAIL = 1,
SD_MMC_INIT_ONGOING = 2,
SD_MMC_ERR_NO_CARD = 3,
SD_MMC_ERR_UNUSABLE = 4,
SD_MMC_ERR_SLOT = 5,
SD_MMC_ERR_COMM = 6,
SD_MMC_ERR_PARAM = 7,
SD_MMC_ERR_WP = 8
} sd_mmc_err_t;
sd_mmc_err_t sd_mmc_init(void);
sd_mmc_err_t sd_mmc_select(uint8_t slot, uint32_t clock, uint8_t bus_width, bool high_speed);
sd_mmc_err_t sd_mmc_send_command(uint8_t command, uint32_t arg, uint8_t crc);
sd_mmc_err_t sd_mmc_read_res1(void);
#endif

@ -0,0 +1,68 @@
#ifndef _SD_MMC_INTF_
#define _SD_MMC_INTF_
// SD MMC Interface
// Define FUNCTIONS and stuff here
/**
* @brief Selects device for use with the SD MMC driver.
*
* This function selects the device for use. This can mean a number of things,
* but the only thing the implementer needs to worry about is hardware selection.
* This means setting the CS pin low for SPI or <whatever the mci version needs>
*
* @return 0 if successful, else return anything else.
* @todo implement mci support and spi support
*/
#define SD_MMC_INTF_SELECT_DEVICE()
/**
* @brief Deselects device for use with the SD MMC driver.
*
* This function deselects the device for use. This can mean a number of things,
* but the only thing the implementer needs to worry about is hardware deselection.
*
* This means setting the CS pin high for SPI or <whatever the mci version needs>
* @return 0 if successul, else return anything else.
* @todo implement mci support and mci support
*/
#define SD_MMC_INTF_DESELECT_DEVICE()
/**
* @brief Reads bytes from device in the most primitive form. *
*
* This function reads bytes from the device. It is up to the implementer to simply read the bytes
* and return the number of bytes read. Only supports synchronous transactions currently.
* This assumes the implementer writes a dummy byte for initiating
* an spi read. The slave selection is handled by the driver. There is no need to include
* selecting the device in the read function. Doing so could actually interfere with the driver.
*
* @return The number of bytes read. Failed reads can be <= 0.
* @todo --
*/
#define SD_MMC_INTF_READ(bytes, len)
/**
* @brief Writes bytes from the device in the most primitive form.
*
* This function writes bytes to the device. Only supports synchronous transactions currently.
* The slave selection is handled by the driver. There is no need to include
* selecting the device in the read function. Doing so could actually interfere with the driver.
*
* @return The number of bytes written. Failed reads can be <= 0.
* @todo --
*/
#define SD_MMC_INTF_WRITE(bytes, len)
/**
* @brief Initializes hardware for the device.
*
* This function initializes the device. This initialization can be ignored if it is done by your HAL,
* but some stub at the very least needs to be provided.
*
* @return 0 if successful, anything else signifies failure
* @todo --
*/
#define SD_MMC_INTF_INIT()
#endif
Loading…
Cancel
Save