fusee: implement partition support; needs some tweeks

This commit is contained in:
Kate J. Temkin
2018-04-30 16:27:34 -06:00
parent 01e3761d4c
commit 608d59c229
2 changed files with 443 additions and 115 deletions

View File

@@ -27,7 +27,6 @@ struct mmc {
/* Controller properties */
char *name;
unsigned int timeout;
enum mmc_card_type card_type;
bool use_dma;
@@ -35,6 +34,12 @@ struct mmc {
uint8_t cid[15];
uint32_t relative_address;
uint8_t partition_support;
uint8_t partition_config;
uint8_t partition_setting;
uint8_t partition_attribute;
uint32_t partition_switch_time;
uint8_t read_block_order;
bool uses_block_addressing;
@@ -52,6 +57,15 @@ enum sdmmc_controller {
};
/**
* Parititions supported by the Switch eMMC.
*/
enum sdmmc_partition {
MMC_PARTITION_USER = 0,
MMC_PARTITION_BOOT1 = 1,
MMC_PARITTION_BOOT2 = 2,
};
/**
* Initiailzes an SDMMC controller for use with an eMMC or SD card device.
@@ -62,6 +76,18 @@ enum sdmmc_controller {
int sdmmc_init(struct mmc *mmc, enum sdmmc_controller controller);
/**
* Selects the active MMC partition. Can be used to select
* boot partitions for access. Affects all operations going forward.
*
* @param mmc The MMC controller whose card is to be used.
* @param partition The partition number to be selected.
*
* @return 0 on success, or an error code on failure.
*/
int sdmmc_select_partition(struct mmc *mmc, enum sdmmc_partition partition);
/**
* Reads a sector or sectors from a given SD card.
*