drv_emmc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* Copyright (C) 2019 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _DRV_EMMC_H_
  13. #define _DRV_EMMC_H_
  14. #include "osi_compiler.h"
  15. #include "drv_names.h"
  16. #include "quec_proj_config.h"
  17. OSI_EXTERN_C_BEGIN
  18. #ifdef CONFIG_QUEC_PROJECT_FEATURE
  19. typedef enum
  20. {
  21. QUEC_SDMMC1_EMMC_INIT = 0,
  22. QUEC_SDMMC1_SD_INIT = 1,
  23. QUEC_SDMMC1_SDIO_INIT = 2,
  24. } emmcCardTypeInit_t;
  25. #endif
  26. /**
  27. * \brief opaque data struct of emmc driver
  28. */
  29. typedef struct drvEmmc drvEmmc_t;
  30. /**
  31. * \brief create emmc driver instance
  32. *
  33. * \param name device name
  34. * \IP1 (emmc) IP2(sdmmc)
  35. * \return
  36. * - created driver instance
  37. * - NULL on error, invalid parameter or out of memory
  38. */
  39. drvEmmc_t *drvEmmcCreate(uint32_t name);
  40. /**
  41. * delete emmc driver instance
  42. */
  43. void drvEmmcDestroy(void *ctx);
  44. /**
  45. * open emmc driver instance
  46. */
  47. bool drvEmmcOpen(void *ctx);
  48. /**
  49. * close emmc driver
  50. */
  51. void drvEmmcClose(void *ctx);
  52. /**
  53. * get emmc/sdcard physical hardware block number
  54. */
  55. uint32_t drvEmmcGetBlockNum(void *ctx);
  56. /**
  57. * Write blocks of data to hardware equioment(emmc/sd/sdio)
  58. */
  59. bool drvEmmcWrite(void *ctx, uint32_t block_number, const void *buffer, uint32_t size);
  60. /**
  61. * Read blocks of data from hardware equioment(emmc/sd/sdio)
  62. */
  63. bool drvEmmcRead(void *ctx, uint32_t block_number, void *buffer, uint32_t size);
  64. /**
  65. * get hardware type
  66. */
  67. uint32_t drvEmmcGetType(void *ctx);
  68. #ifdef CONFIG_QUEC_PROJECT_FEATURE_SDMMC
  69. bool quec_drvEmmcSetClk(void *ctx, uint32_t freq);
  70. #endif
  71. OSI_EXTERN_C_END
  72. #endif