sdmmc_host: add helper to get bus frequency from enum
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit b621a519e2a732cae75e2c76c5d045865da53f2d Author: Aidan MacDonald <[email protected]> Date: Tue Aug 18 16:19:07 2026 +0100 sdmmc_host: add helper to get bus frequency from enum Change-Id: I5796d19a4c28986bbb3674a39cc93f3fa473ae3c diff --git a/firmware/drivers/sdmmc_host.c b/firmware/drivers/sdmmc_host.c index eae852bcbf..06d1509573 100644 --- a/firmware/drivers/sdmmc_host.c +++ b/firmware/drivers/sdmmc_host.c @@ -144,6 +144,17 @@ void sdmmc_host_set_medium_present(struct sdmmc_host *host, bool present) } #endif +size_t sdmmc_host_get_bus_freq(uint32_t clock) +{ + switch (clock) + { + case SDMMC_BUS_CLOCK_400KHZ: return 400000; + case SDMMC_BUS_CLOCK_25MHZ: return 25000000; + case SDMMC_BUS_CLOCK_50MHZ: return 50000000; + default: return 0; + } +} + #ifdef CONFIG_STORAGE_MULTI static int sdmmc_host_count_drives(struct sdmmc_host **array, size_t array_size) diff --git a/firmware/export/sdmmc_host.h b/firmware/export/sdmmc_host.h index 30419faa0a..411d73299a 100644 --- a/firmware/export/sdmmc_host.h +++ b/firmware/export/sdmmc_host.h @@ -291,4 +291,10 @@ void sdmmc_host_init_medium_present(struct sdmmc_host *host, bool present) INIT_ */ void sdmmc_host_set_medium_present(struct sdmmc_host *host, bool present); +/** + * Returns clock frequency in Hz for an `SDMMC_BUS_CLOCK_*` constant. + * Returns zero if fed an invalid constant. + */ +size_t sdmmc_host_get_bus_freq(uint32_t clock); + #endif /* __SDMMC_HOST_H__ */ -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs