1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef _HAL_SDMMC_H_
5 #define _HAL_SDMMC_H_
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #include "plat_types.h"
12 #include "hal_sdio.h"
13 
14 enum HAL_SDMMC_ID_T {
15     HAL_SDMMC_ID_0 = 0,
16     HAL_SDMMC_ID_NUM,
17 };
18 
19 typedef void (*HAL_SDMMC_DELAY_FUNC)(uint32_t ms);
20 
21 /* hal api */
22 HAL_SDMMC_DELAY_FUNC hal_sdmmc_set_delay_func(HAL_SDMMC_DELAY_FUNC new_func);
23 int32_t hal_sdmmc_open(enum HAL_SDMMC_ID_T id);
24 void hal_sdmmc_info(enum HAL_SDMMC_ID_T id, uint32_t *sector_count, uint32_t *sector_size);
25 uint32_t hal_sdmmc_read_blocks(enum HAL_SDMMC_ID_T id, uint32_t start_block, uint32_t block_count, uint8_t* dest);
26 uint32_t hal_sdmmc_write_blocks(enum HAL_SDMMC_ID_T id, uint32_t start_block, uint32_t block_count, uint8_t* src);
27 void hal_sdmmc_close(enum HAL_SDMMC_ID_T id);
28 void hal_sdmmc_dump(enum HAL_SDMMC_ID_T id);
29 int hal_sdmmc_enable_detecter(enum HAL_SDMMC_ID_T id,void (* cb)(uint8_t));
30 void hal_sdmmc_init_vars();
31 uint32_t hal_sdmmc_get_bus_width(enum HAL_SDMMC_ID_T id);
32 uint32_t hal_sdmmc_get_clock(enum HAL_SDMMC_ID_T id);
33 
34 #ifdef __cplusplus
35 }
36 #endif
37 
38 #endif /* _HAL_SDMMC_H_ */
39