ql_sdmmc.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /** @file
  2. ql_sdmmc.h
  3. @brief
  4. quectel sdmmc info interface definition.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. =================================================================*/
  17. #ifndef QL_SDMMC_H
  18. #define QL_SDMMC_H
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #include "ql_api_common.h"
  23. /*===========================================================================
  24. * Macro Definition
  25. ===========================================================================*/
  26. #define QL_SDMMC_ERRCODE_BASE (QL_COMPONENT_STORAGE_SDEMMC<<16)
  27. /*========================================================================
  28. * Enumeration Definition
  29. *========================================================================*/
  30. /**************************** error code about SDMMC ***************************/
  31. typedef enum
  32. {
  33. QL_SDMMC_SUCCESS = QL_SUCCESS,
  34. QL_SDMMC_INVALID_PARAM_ERR = 1|QL_SDMMC_ERRCODE_BASE,
  35. QL_SDMMC_ADDR_NULL_ERR = 3|QL_SDMMC_ERRCODE_BASE,
  36. QL_SDMMC_INIT_ERR = 4|QL_SDMMC_ERRCODE_BASE,
  37. QL_SDMMC_MOUNT_ERR = 5|QL_SDMMC_ERRCODE_BASE,
  38. QL_SDMMC_MKFS_ERR = 10|QL_SDMMC_ERRCODE_BASE,
  39. QL_SDMMC_SET_CLK_ERR = 11|QL_SDMMC_ERRCODE_BASE,
  40. QL_SDMMC_WRITE_ERR = 12|QL_SDMMC_ERRCODE_BASE,
  41. QL_SDMMC_READ_ERR = 13|QL_SDMMC_ERRCODE_BASE,
  42. QL_SDMMC_DET_ERR = 14|QL_SDMMC_ERRCODE_BASE,
  43. QL_SDMMC_MEM_ILLEGAL_ERR = 20|QL_SDMMC_ERRCODE_BASE, //the *buffer of writer or read isn't from SRAM/RAM.
  44. QL_SDMMC_ADDR_ALIGNED_ERR = 21|QL_SDMMC_ERRCODE_BASE,
  45. QL_SDMMC_SIZE_ALIGNED_ERR = 22|QL_SDMMC_ERRCODE_BASE,
  46. QL_SDMMC_BLOCK_NUM_OVER_ERR = 23|QL_SDMMC_ERRCODE_BASE,
  47. QL_SDMMC_LOCK_ERR = 24|QL_SDMMC_ERRCODE_BASE,
  48. QL_SDMMC_CREATE_ERR = 30|QL_SDMMC_ERRCODE_BASE,
  49. QL_SDMMC_OPEN_ERR = 31|QL_SDMMC_ERRCODE_BASE,
  50. QL_SDMMC_CLOSE_ERR = 32|QL_SDMMC_ERRCODE_BASE,
  51. QL_SDMMC_OPERATION_NOT_ALLOWED = 33|QL_SDMMC_ERRCODE_BASE,//if sdmmc is opened through mount,sdmmc write/read is not allowed
  52. //errcode for multi partition
  53. QL_SDMMC_MULTI_PARTITON_NUM_ERR = 40|QL_SDMMC_ERRCODE_BASE,
  54. QL_SDMMC_MULTI_PARTITON_FDISK_ERR = 41|QL_SDMMC_ERRCODE_BASE,
  55. QL_SDMMC_UMOUNT_ERR = 42|QL_SDMMC_ERRCODE_BASE,
  56. QL_SDMMC_MOUNT_ALL_ERR = 43|QL_SDMMC_ERRCODE_BASE,
  57. QL_SDMMC_UMOUNT_ALL_ERR = 44|QL_SDMMC_ERRCODE_BASE,
  58. QL_SDMMC_MKFS_ALL_ERR = 45|QL_SDMMC_ERRCODE_BASE,
  59. QL_SDMMC_MULTI_PARTITON_OTHER_ERR = 46|QL_SDMMC_ERRCODE_BASE,
  60. } ql_errcode_sdmmc_e;
  61. typedef enum
  62. {
  63. QL_SDMMC_EMMC = 0, //先以emmc流程进行初始化,如果失败再以SD卡流程进行初始化
  64. QL_SDMMC_SD_CARD, //先以SD卡流程进行初始化,如果失败再以emmc流程进行初始化
  65. QL_SDMMC_EMMC_ONLY, //只以emmc流程进行初始化
  66. QL_SDMMC_SD_CARD_ONLY, //只以sd卡流程进行初始化
  67. } ql_sdmmc_dev_detect_e;
  68. /*===========================================================================
  69. * Struct
  70. ===========================================================================*/
  71. typedef struct
  72. {
  73. uint8_t mid; //Manufacturer ID
  74. uint8_t pnm[6]; //Product name
  75. uint8_t psn[4]; //Product serial number
  76. uint32_t blknum; //block count
  77. uint32_t blksize; //block size
  78. } ql_sdmmc_hw_info_t;
  79. typedef void (*ql_sdmmc_pin_drv_init)(void); //SDMMC PIN脚驱动能力初始化函数
  80. typedef struct
  81. {
  82. uint8_t pin_clk; //clk pin驱动能力
  83. uint8_t pin_other; //其他pin驱动能力
  84. ql_sdmmc_pin_drv_init drv_init; //应用层注册的pin脚驱动初始化函数,主要用于pin脚初始化驱动能力都不一样的情况(预留)
  85. } ql_sdmmc_pin_drv_t;
  86. /*
  87. 1.平台支持两路sdmmc,具体看模组相应的pin脚是否被引出来.
  88. 2.SDMMC1支持配置PIN脚电压域(1700MV~3200MV);SDMMC2不支持配置PIN脚电压域,只能1800MV(所以如果想驱动SD卡需要加电平转换芯片).
  89. 3.SDMMC1在时钟为25Mhz/50Mhz时默认的驱动能力:SD卡和EMMC都是:pin_clk=0x5,pin_other=0x3;
  90. 如果为时钟为200Mhz时的驱动能力:SD卡时pin_clk=0x7,pin_other=0x5;EMMC时pin_clk=0x7,pin_other=0x7(目前不支持这种200Mhz的模式(SDR_104,HS_200))
  91. SDMMC2最高支持的时钟是50Mhz,所以它的驱动能力只有一种情况:SD卡和EMMC都是:pin_clk=0x3,pin_other=0x3;
  92. */
  93. typedef struct
  94. {
  95. ql_sdmmc_dev_detect_e dev; //设备检测配置,默认为QL_SDMMC_EMMC(0)
  96. //*****SDMMC1可以配置电压(1700MV-3200MV),SDMMC2不支持配置电压(只能1800MV)*****//
  97. uint32_t sd_mv; //SD卡工作的电压域(可以使用powerLevel_t枚举值),默认3.2v(POWER_LEVEL_3200MV)
  98. //POWER_LEVEL_UNUSED或者0或者小于POWER_LEVEL_1700MV表示使用默认值
  99. uint32_t emmc_mv; //emmc工作的电压域(可以使用powerLevel_t枚举值),默认1.8v(POWER_LEVEL_1800MV)
  100. //POWER_LEVEL_UNUSED或者0或者小于POWER_LEVEL_1700MV表示使用默认值
  101. /* 0: Driven strength 3mA 1: Driven strength 6mA 2: Driven strength 9mA 3: Driven strength 12mA
  102. 4: Driven strength 15mA 5: Driven strength 18mA 6: Driven strength 21mA 7: Driven strength 24mA
  103. 8: Driven strength 27mA 9: Driven strength 30mA 10: Driven strength 33mA 11: Driven strength 36mA
  104. 12: Driven strength 39mA 13: Driven strength 42mA 14: Driven strength 45mA 15: Driven strength 48mA
  105. */
  106. uint8_t sd_drv; //SD卡所有pin脚的驱动能力,主要用于各pin脚驱动能力都一样的情况,平台兼容
  107. uint8_t emmc_drv; //emmc所有pin脚的驱动能力,主要用于各pin脚驱动能力都一样的情况,平台兼容
  108. //如果pin脚驱动能力不都一样的时使用
  109. ql_sdmmc_pin_drv_t sd_pin_drv[2]; //0--时钟为25Mhz/50Mhz时的驱动能力;1--时钟为200Mhz时的驱动能力(SDR_104,HS_200)
  110. ql_sdmmc_pin_drv_t emmc_pin_drv[2];//0--时钟为25Mhz/50Mhz时的驱动能力;1--时钟为200Mhz时的驱动能力(SDR_104,HS_200)
  111. uint8_t spd_mode;//预留
  112. uint8_t dma_sel; //预留
  113. } ql_sdmmc_cfg_t;
  114. /*===========================================================================
  115. * Functions declaration
  116. ===========================================================================*/
  117. /*****************************************************************
  118. *
  119. * Description: sdmmc power reset opt callback
  120. *
  121. * Parameters: void
  122. *
  123. *****************************************************************/
  124. typedef void (*ql_sdmmc_pw_rst_cb)(void);
  125. /*****************************************************************
  126. * Function: ql_sdmmc_register_power_reset_cb
  127. *
  128. * Description: register sdmmc power reset opt callback
  129. * 1.不管retry_enable是否使能,如果注册了此函数,SDMMC在初始化之前都会调用此函数给SD卡/EMMC上下电让设备恢复初始化状态.
  130. * 2.在retry_enable使能时,如果SDMMC异常时给SD卡/EMMC断电然后启动重新初始化流程,尝试自动恢复.
  131. * 如果SDMMC是通过GPIO控制给SD卡/EMMC上下电的,需要注册下电再上电的流程.
  132. * 如果是通过sdmmc电压域来控制上下电的则可以不需要注册,特别地,SDMMC2电压域是默认开启的,最好注册下电再上电的流程.
  133. *
  134. * Parameters:
  135. * cb [in] sdmmc power reset opt
  136. * retry_enable [in] TRUE enable sdmmc retry function
  137. * FALSE diable sdmmc retry function
  138. *
  139. * Return:
  140. * QL_SDMMC_SUCCESS succeed
  141. * OTHER ERRCODE failure
  142. *
  143. *****************************************************************/
  144. ql_errcode_sdmmc_e ql_sdmmc_register_power_reset_cb(ql_sdmmc_pw_rst_cb cb,bool retry_enable);
  145. /*****************************************************************
  146. * Function: ql_sdmmc_set_dev_cfg
  147. *
  148. * Description: Configure device identification parameters
  149. *
  150. * Parameters:
  151. * dev [in] sdmmc device type
  152. *
  153. * Return:
  154. * QL_SDMMC_SUCCESS succeed
  155. * OTHER ERRCODE failure
  156. *****************************************************************/
  157. ql_errcode_sdmmc_e ql_sdmmc_set_dev_cfg(ql_sdmmc_cfg_t cfg);
  158. /*****************************************************************
  159. * Function: ql_sdmmc_mkfs
  160. *
  161. * Description: format sd card in FM_FAT32
  162. *
  163. * Parameters:
  164. * opt [in] input FM_FAT32(0x02)
  165. *
  166. * Return:
  167. * QL_SDMMC_SUCCESS succeed
  168. * OTHER ERRCODE failure
  169. *
  170. *****************************************************************/
  171. ql_errcode_sdmmc_e ql_sdmmc_mkfs(uint8_t opt);
  172. /*****************************************************************
  173. * Function: ql_sdmmc_umount
  174. *
  175. * Description: Uninitialize the sdmmc driver,umount sdcard/emmc
  176. *
  177. * Parameters: void
  178. *
  179. * Return:
  180. * QL_SDMMC_SUCCESS succeed
  181. *
  182. *****************************************************************/
  183. ql_errcode_sdmmc_e ql_sdmmc_umount(void);
  184. /*****************************************************************
  185. * Function: ql_sdmmc_mount
  186. *
  187. * Description: Initialize the sdmmc driver,and mount sdcard/emmc
  188. *
  189. * Parameters: void
  190. *
  191. * Return:
  192. * QL_SDMMC_SUCCESS succeed
  193. * QL_SDMMC_MOUNT_ERR failure
  194. *
  195. *****************************************************************/
  196. ql_errcode_sdmmc_e ql_sdmmc_mount(void);
  197. /*****************************************************************
  198. * Function: ql_sdmmc_is_format
  199. *
  200. * Description: Whether the SD card/emmc is formatted
  201. * This function will be mounted once if it has not been mounted before,
  202. * so it is recommended to call it during a mount failure.
  203. * 如果前面没有mount过,这函数将会先mount一次,所以建议在mount失败里调用
  204. *
  205. * Parameters: void
  206. *
  207. * Return:
  208. * true is formatted
  209. * false is not formatted
  210. *
  211. *****************************************************************/
  212. bool ql_sdmmc_is_format(void);
  213. /*****************************************************************
  214. * Function: ql_sdmmc_is_mount
  215. *
  216. * Description: Whether the SD card/emmc is mounted
  217. *
  218. * Parameters: void
  219. *
  220. * Return:
  221. * true is mounted
  222. * false is not mounted
  223. *
  224. *****************************************************************/
  225. bool ql_sdmmc_is_mount(void);
  226. /*****************************************************************
  227. * Function: ql_sdmmc_set_clk
  228. *
  229. * Description: set sdmmc clk freq,can use either the mount file system or not
  230. *
  231. * Parameters:
  232. * freq [in] The sdmmc clk freq for setting
  233. * 400000 <= freq <= 50000000
  234. * Return:
  235. * QL_SDMMC_SUCCESS succeed
  236. * OTHER ERRCODE failure
  237. *****************************************************************/
  238. ql_errcode_sdmmc_e ql_sdmmc_set_clk(uint32_t freq);
  239. /*****************************************************************
  240. * Function: ql_sdmmc_write
  241. *
  242. * Description: Write blocks of data to sdmmc,only be used when there is no mount file system
  243. *
  244. * Parameters:
  245. * block_number [in] block_number Start address of the SD memory block for writing
  246. * buffer [in] buffer Pointer to the block of data to write
  247. * Must be 32 bytes (not 32 bits) aligned.
  248. * size [in] size Number of bytes to write
  249. * Must be sector size aligned
  250. * Return:
  251. * QL_SDMMC_SUCCESS succeed
  252. * OTHER ERRCODE failure
  253. *****************************************************************/
  254. ql_errcode_sdmmc_e ql_sdmmc_write(uint32_t block_number, const void *buffer, uint32_t size);
  255. /*****************************************************************
  256. * Function: ql_sdmmc_read
  257. *
  258. * Description: Read blocks of data from sdmmc,only be used when there is no mount file system
  259. *
  260. * Parameters:
  261. * block_number [in] block_number Start address of the SD memory block for reading
  262. * buffer [out] Pointer to the block of data to read
  263. * Must be 32 bytes (not 32 bits) aligned.
  264. * size [in] Number of bytes to read
  265. * Must be sector size aligned
  266. * Return:
  267. * QL_SDMMC_SUCCESS succeed
  268. * OTHER ERRCODE failure
  269. *****************************************************************/
  270. ql_errcode_sdmmc_e ql_sdmmc_read(uint32_t block_number, void *buffer, uint32_t size);
  271. /*****************************************************************
  272. * Function: ql_sdmmc_get_block_number
  273. *
  274. * Description: get sdmmc block number,can use either the mount file system or not
  275. *
  276. * Parameters:
  277. * Return: block number
  278. *
  279. *****************************************************************/
  280. uint32_t ql_sdmmc_get_block_number(void);
  281. /*****************************************************************
  282. * Function: ql_sdmmc_open
  283. *
  284. * Description: only open sdmmc driver,not mount fatfs file system.
  285. * If the file system has been mounted, it will be umount
  286. *
  287. * Parameters:
  288. * Return:
  289. * QL_SDMMC_SUCCESS succeed
  290. * OTHER ERRCODE failure
  291. *****************************************************************/
  292. ql_errcode_sdmmc_e ql_sdmmc_open(void);
  293. /*****************************************************************
  294. * Function: ql_sdmmc_close
  295. *
  296. * Description: close sdmmc driver,while umount the file system
  297. * if the file system has been mounted.
  298. *
  299. * Parameters:
  300. * Return:
  301. * QL_SDMMC_SUCCESS succeed
  302. * OTHER ERRCODE failure
  303. *****************************************************************/
  304. ql_errcode_sdmmc_e ql_sdmmc_close(void);
  305. /*****************************************************************
  306. * Function: ql_sdmmc_get_hw_info
  307. *
  308. * Description: get information about sdmmc,can use either the mount file system or not
  309. *
  310. * Parameters:
  311. * info [out] Pointer to info data to read
  312. *
  313. * Return:
  314. * QL_SDMMC_SUCCESS succeed
  315. * OTHER ERRCODE failure
  316. *****************************************************************/
  317. ql_errcode_sdmmc_e ql_sdmmc_get_hw_info(ql_sdmmc_hw_info_t *info);
  318. /*****************************************************************
  319. * Function: ql_sdmmc_sdio1_vdd_off
  320. *
  321. * Description: close sdio1 vdd,Use this function with caution.
  322. *
  323. * 此函数一般不要调用,如果一定需要使用请注意以下使用注意事项。
  324. * 使用注意事项:
  325. * 1、此函数只针对SD卡的VCC3.3V是由SDIO_VDD控制的用户,如果是由GPIO控制的,请先通过GPIO关闭SD
  326. * 卡的供电再调用此函数。
  327. * 2、调用此函数之前,一定要先反初始化SD卡(如果是调用ql_sdmmc_mount初始化SD卡并挂载文件系统的,
  328. * 要调用ql_sdmmc_umount反初始化SD卡和文件系统;如果是调用ql_sdmmc_open初始化SD卡的,要调用
  329. * ql_sdmmc_close反初始化SD卡)。否则下次调用ql_sdmmc_mount/ql_sdmmc_open时,会返回成功,
  330. * 但是SD卡不能使用。
  331. * 3、调用此函数后SD卡断电,所以下次使用时需要重新调用ql_sdmmc_mount/ql_sdmmc_open初始化
  332. * SD卡。
  333. * 4、调用此函数之前,如果不关闭以新建方式打开的文件,文件会丢失;如果是只打开已创建的文件,不关
  334. * 闭,新写进去的内容会丢失,原来的内容不变。但是之前打开文件返回的fd文件句柄,不可再使用。
  335. * 5、如果在休眠中使用此函数,要注意使用方式:
  336. * >>以下方案是不可取的:
  337. * ql_enter_sleep_cb进入休眠回调函数中ql_fclose(fd);ql_sdmmc_umount();ql_sdmmc_sdio1_vdd_off();
  338. * ql_exit_sleep_cb退出休眠回调函数中,ql_sdmmc_mount;ql_fopen
  339. * 这样的逻辑会大大的损耗sd卡的使用寿命,因为调用ql_fclose就会把缓存和文件系统信息写到sd卡中。
  340. * >>建议:
  341. * 在使用sd卡的时候才ql_sdmmc_mount,ql_fopen,读写,ql_fclose,并加休眠锁。因为ql_sdmmc_mount
  342. * 需要一定的时间,所以在调用mount和读写sd卡的线程要添加休眠锁ql_lpm_wakelock_create,
  343. * 但是有可能会影响休眠。如果不加休眠锁,会在mount过程中再次进入休眠,导致mount失败。
  344. *
  345. * Parameters:
  346. *
  347. * Return:
  348. *
  349. *****************************************************************/
  350. void ql_sdmmc_sdio1_vdd_off(void);
  351. /*****************************************************************
  352. SD卡多分区 API
  353. *****************************************************************/
  354. typedef enum
  355. {
  356. QL_SDMMC_PARTITION_NUM_1 = 1, //1--分区1
  357. QL_SDMMC_PARTITION_NUM_2 = 2, //2--分区2
  358. QL_SDMMC_PARTITION_NUM_MAX ,
  359. QL_SDMMC_PARTITION_NUM_ALL = 0xff //所有分区
  360. }ql_sdmmc_partition_num_e;
  361. typedef struct
  362. {
  363. ql_sdmmc_partition_num_e partnum; //分区号
  364. int64 partsize; //分区大小,单位:Mbyte
  365. }ql_sdmmc_part_info_t;
  366. /*****************************************************************
  367. * Function: ql_sdmmc_fdisk_ex
  368. *
  369. * Description: sdcard/EMMC partition, format and mount all partitions
  370. *
  371. * Parameters:
  372. *
  373. * part_info[] [in] Partition information,
  374. * 分区信息,最后一个分区大小会自动调整为剩余容量
  375. * 注意:实际容量会比卡上标识的容量小一点点,所以最后一个分区可以填小一点,会自动调整为剩余容量
  376. * 文件系统是有最小扇区数量要求的,最小为1024个扇区,所以分区容量不能太小
  377. * ex:part_info[] = {
  378. * {QL_SDMMC_PARTITION_NUM_1,1000},
  379. * {QL_SDMMC_PARTITION_NUM_2,1000}
  380. * }
  381. *
  382. * Return:
  383. * QL_SDMMC_SUCCESS succeed
  384. * OTHER ERRCODE failure
  385. *
  386. *****************************************************************/
  387. ql_errcode_sdmmc_e ql_sdmmc_fdisk_ex(ql_sdmmc_part_info_t part_info[]);
  388. /*****************************************************************
  389. * Function: ql_sdmmc_mkfs_ex
  390. *
  391. * Description: format sd card partition.
  392. * This function automatically adjusts the formatting type
  393. * based on the number of partition sectors.
  394. * 此函数将会根据分区扇区数量自动调整格式化类型,
  395. * 如果总扇区数小于66130格式化为FM_FAT,大于格式化为FM_FAT32
  396. *
  397. * Parameters:
  398. *
  399. * part [in] partition number,Currently only two partitions are supported
  400. * if QL_SDMMC_PARTITION_NUM_ALL,umount all partitions
  401. * opt [in] FM_FAT(0x01)(FAT12/FAT16) FM_FAT32(0x02)
  402. * 根据扇区的数量判断格式化为哪种格式:1024-8220:FM_FAT(FAT12)
  403. * 8229-4190430:FM_FAT(FAT16) 66130-67048580:FM_FAT32(0x02)
  404. *
  405. * Return:
  406. * QL_SDMMC_SUCCESS succeed
  407. * OTHER ERRCODE failure
  408. *
  409. *****************************************************************/
  410. ql_errcode_sdmmc_e ql_sdmmc_mkfs_ex(ql_sdmmc_partition_num_e part,uint8_t opt);
  411. /*****************************************************************
  412. * Function: ql_sdmmc_mount_ex
  413. *
  414. * Description: Initialize the sdmmc driver,and mount partition
  415. *
  416. * Parameters:
  417. *
  418. * part [in] partition number,Currently only two partitions are supported
  419. * if QL_SDMMC_PARTITION_NUM_ALL,mount all partitions
  420. *
  421. * Return:
  422. * QL_SDMMC_SUCCESS succeed
  423. * OTHER ERRCODE failure
  424. *
  425. *****************************************************************/
  426. ql_errcode_sdmmc_e ql_sdmmc_mount_ex(ql_sdmmc_partition_num_e part);
  427. /*****************************************************************
  428. * Function: ql_sdmmc_umount_ex
  429. *
  430. * Description: umount partition,if all partitions are in umount state,Uninitialize the sdmmc driver
  431. *
  432. * Parameters:
  433. *
  434. * part [in] partition number,Currently only two partitions are supported
  435. * if QL_SDMMC_PARTITION_NUM_ALL,umount all partitions
  436. *
  437. * Return:
  438. * QL_SDMMC_SUCCESS succeed
  439. * OTHER ERRCODE failure
  440. *
  441. *****************************************************************/
  442. ql_errcode_sdmmc_e ql_sdmmc_umount_ex(ql_sdmmc_partition_num_e part);
  443. /*****************************************************************
  444. * Function: ql_sdmmc_is_fdisk_ex
  445. *
  446. * Description: Whether the SD card/emmc is partitioned
  447. *
  448. * Parameters: void
  449. *
  450. * Return:
  451. * true is partitioned
  452. * false is not partitioned
  453. *
  454. *****************************************************************/
  455. bool ql_sdmmc_is_fdisk_ex(void);
  456. /*****************************************************************
  457. * Function: ql_sdmmc_is_format_ex
  458. *
  459. * Description: Whether the SD card/emmc is formatted.
  460. * This function will be mounted once if it has not been mounted before,
  461. * so it is recommended to call it during a mount failure.
  462. * 如果前面没有mount过,这函数将会先mount一次,所以建议在mount失败里调用
  463. *
  464. * Parameters:
  465. *
  466. * part [in] partition number,Currently only two partitions are supported
  467. * QL_SDMMC_PARTITION_NUM_ALL cannot be used in this function.
  468. *
  469. * Return:
  470. * true is formatted
  471. * false is not formatted
  472. *
  473. *****************************************************************/
  474. bool ql_sdmmc_is_format_ex(ql_sdmmc_partition_num_e part);
  475. /*****************************************************************
  476. * Function: ql_sdmmc_is_mount_ex
  477. *
  478. * Description: Whether the SD card/emmc is mounted
  479. *
  480. * Parameters:
  481. *
  482. * part [in] partition number,Currently only two partitions are supported
  483. * QL_SDMMC_PARTITION_NUM_ALL cannot be used in this function.
  484. *
  485. * Return:
  486. * true is mounted
  487. * false is not mounted
  488. *
  489. *****************************************************************/
  490. bool ql_sdmmc_is_mount_ex(ql_sdmmc_partition_num_e part);
  491. #ifdef __cplusplus
  492. } /*"C" */
  493. #endif
  494. #endif /* QL_SDMMC_H */