diff --git a/build/.cache/clangd/index/ff.c.0674289B09C4AEE6.idx b/build/.cache/clangd/index/ff.c.0674289B09C4AEE6.idx new file mode 100644 index 0000000..1394a69 Binary files /dev/null and b/build/.cache/clangd/index/ff.c.0674289B09C4AEE6.idx differ diff --git a/build/.cache/clangd/index/hpl_rtc.c.DEFBB6F4E6403207.idx b/build/.cache/clangd/index/hpl_rtc.c.DEFBB6F4E6403207.idx new file mode 100644 index 0000000..806f393 Binary files /dev/null and b/build/.cache/clangd/index/hpl_rtc.c.DEFBB6F4E6403207.idx differ diff --git a/build/.cache/clangd/index/hpl_rtc_config.h.13C2AA0DFCA38096.idx b/build/.cache/clangd/index/hpl_rtc_config.h.13C2AA0DFCA38096.idx new file mode 100644 index 0000000..c899fc8 Binary files /dev/null and b/build/.cache/clangd/index/hpl_rtc_config.h.13C2AA0DFCA38096.idx differ diff --git a/build/.cache/clangd/index/sdmmc_diskio.c.A941FA96B05E41EC.idx b/build/.cache/clangd/index/sdmmc_diskio.c.A941FA96B05E41EC.idx new file mode 100644 index 0000000..20f8dfb Binary files /dev/null and b/build/.cache/clangd/index/sdmmc_diskio.c.A941FA96B05E41EC.idx differ diff --git a/shared/drivers/sd_mmc.c b/shared/drivers/sd_mmc.c new file mode 100644 index 0000000..aa2ad17 --- /dev/null +++ b/shared/drivers/sd_mmc.c @@ -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; +} diff --git a/shared/drivers/sd_mmc.h b/shared/drivers/sd_mmc.h new file mode 100644 index 0000000..cac6d6e --- /dev/null +++ b/shared/drivers/sd_mmc.h @@ -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 diff --git a/shared/drivers/sd_mmc_intf.h b/shared/drivers/sd_mmc_intf.h new file mode 100644 index 0000000..be0abf5 --- /dev/null +++ b/shared/drivers/sd_mmc_intf.h @@ -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 + * + * @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 + * @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