diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-07-09 12:52:59 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-07-09 12:52:59 +0300 |
commit | 256bd9813469756cbd010899a40ab0647a501169 (patch) | |
tree | 2f820e769e6a83764c568698fd6d00c36bbb58dd /src/Libraries | |
parent | 98f2729af3fbe6b11781d49dc7bc4315836259ad (diff) |
Refactored SHDC code to remove useless layers and function parameters
Diffstat (limited to 'src/Libraries')
-rw-r--r-- | src/Libraries/sd_mmc/sd_mmc.c | 97 |
1 files changed, 5 insertions, 92 deletions
diff --git a/src/Libraries/sd_mmc/sd_mmc.c b/src/Libraries/sd_mmc/sd_mmc.c index c5c0d097..79863b26 100644 --- a/src/Libraries/sd_mmc/sd_mmc.c +++ b/src/Libraries/sd_mmc/sd_mmc.c @@ -106,91 +106,7 @@ struct DriverInterface # ifdef __SAME54P20A__ -# include <hal_mci_sync.h> - -// Translations of hsmci function calls to mci_sync functions - -struct mci_sync_desc mci = { { SDHC1, 0, 0, 0 } }; - -uint8_t hsmci_get_bus_width(uint8_t slot) noexcept -{ - return mci_sync_get_bus_width(&mci, slot); -} - -bool hsmci_is_high_speed_capable(void) noexcept -{ - return mci_sync_is_high_speed_capable(&mci); -} - -void hsmci_select_device(uint8_t slot, uint32_t clock, uint8_t bus_width, bool high_speed) noexcept -{ - (void)mci_sync_select_device(&mci, slot, clock, bus_width, high_speed); -} - -void hsmci_deselect_device(uint8_t slot) noexcept -{ - (void)mci_sync_deselect_device(&mci, slot); -} - -void hsmci_send_clock(void) noexcept -{ - mci_sync_send_clock(&mci); -} - -bool hsmci_send_cmd(sdmmc_cmd_def_t cmd, uint32_t arg) noexcept -{ - return mci_sync_send_cmd(&mci, cmd, arg); -} - -uint32_t hsmci_get_response(void) noexcept -{ - return mci_sync_get_response(&mci); -} - -void hsmci_get_response_128(uint8_t* response) noexcept -{ - mci_sync_get_response_128(&mci, response); -} - -bool hsmci_adtc_start_glue(sdmmc_cmd_def_t cmd, uint32_t arg, uint16_t block_size, uint16_t nb_block, const void *dmaAddr) noexcept -{ - return mci_sync_adtc_start(&mci, cmd, arg, block_size, nb_block, dmaAddr); -} - -bool hsmci_read_word(uint32_t* value) noexcept -{ - return mci_sync_read_word(&mci, value); -} - -bool hsmci_write_word(uint32_t value) noexcept -{ - return mci_sync_write_word(&mci, value); -} - -bool hsmci_start_read_blocks(void *dest, uint16_t nb_block) noexcept -{ - return mci_sync_start_read_blocks(&mci, dest, nb_block); -} - -bool hsmci_wait_end_of_read_blocks(void) noexcept -{ - return mci_sync_wait_end_of_read_blocks(&mci); -} - -bool hsmci_start_write_blocks(const void *src, uint16_t nb_block) noexcept -{ - return mci_sync_start_write_blocks(&mci, src, nb_block); -} - -bool hsmci_wait_end_of_write_blocks(void) noexcept -{ - return mci_sync_wait_end_of_write_blocks(&mci); -} - -uint32_t hsmci_get_speed(void) noexcept -{ - return mci_sync_get_speed(&mci); -} +# include <Sdhc.h> driverIdleFunc_t hsmci_set_idle_func(driverIdleFunc_t func) noexcept { @@ -218,7 +134,11 @@ static const struct DriverInterface hsmciInterface = { .send_cmd = hsmci_send_cmd, .get_response = hsmci_get_response, .get_response_128 = hsmci_get_response_128, +#if SAME5x + .adtc_start = hsmci_adtc_start, +#else .adtc_start = hsmci_adtc_start_glue, +#endif .adtc_stop = hsmci_send_cmd, // adtc_stop aliased to send_cmd as in the ASF original .read_word = hsmci_read_word, .write_word = hsmci_write_word, @@ -226,9 +146,7 @@ static const struct DriverInterface hsmciInterface = { .wait_end_of_read_blocks = hsmci_wait_end_of_read_blocks, .start_write_blocks = hsmci_start_write_blocks, .wait_end_of_write_blocks = hsmci_wait_end_of_write_blocks, -#if 1 //dc42 .getInterfaceSpeed = hsmci_get_speed, -#endif .set_idle_func = hsmci_set_idle_func, .is_spi = false }; @@ -1809,12 +1727,7 @@ void sd_mmc_init(const Pin wpPins[], const Pin spiCsPins[]) sd_mmc_slot_sel = 0xFF; // No slot selected #if SD_MMC_HSMCI_MEM_CNT != 0 - -# ifdef __SAME54P20A__ - mci_sync_init(&mci, SDHC1); -# else hsmci_init(); -# endif #endif #if SD_MMC_SPI_MEM_CNT != 0 |