drv_sdmmc_8850.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_SDMMC_H_
  13. #define _DRV_SDMMC_H_
  14. #include "osi_compiler.h"
  15. #include "drv_names.h"
  16. OSI_EXTERN_C_BEGIN
  17. /**
  18. * \brief opaque data struct of sdmmc driver
  19. */
  20. typedef struct drvSdmmc drvSdmmc_t;
  21. /**
  22. * \brief create sdmmc driver instance
  23. *
  24. * \param name device name
  25. * \return
  26. * - created driver instance
  27. * - NULL on error, invalid parameter or out of memory
  28. */
  29. drvSdmmc_t *drvSdmmcCreate(uint32_t name);
  30. /**
  31. * \brief delete sdmmc driver instance
  32. *
  33. * \param context of the function call
  34. */
  35. void drvSdmmcDestroy(void *ctx);
  36. /**
  37. * \brief open sdmmc driver instance
  38. *
  39. * Open the sdmmc driver, done it can read/write data via the sdmmc.
  40. *
  41. * \param context of the function call
  42. * \return
  43. * - true success
  44. * - false fail
  45. */
  46. bool drvSdmmcOpen(void *ctx);
  47. /**
  48. * \brief close sdmmc driver
  49. *
  50. * Close the sdmmc driver, stop all data transfer.
  51. * release resource.
  52. *
  53. * \param context of the function call
  54. */
  55. void drvSdmmcClose(void *ctx);
  56. /**
  57. * \brief get sdmmc block number
  58. *
  59. * \param context of the function call
  60. * \return block number
  61. */
  62. uint32_t drvSdmmcGetBlockNum(void *ctx);
  63. /**
  64. * \brief Write blocks of data to sdmmc
  65. *
  66. * This function is used to write blocks of data on the sdmmc.
  67. *
  68. * \p buffer should be 32 bits (4 bytes) aligned. \p size should be sector
  69. * size aligned.
  70. *
  71. * \p buffer should be SRAM or external RAM. Otherwise, it will return
  72. * false. Though hardware may support DMA from other addresses, it is
  73. * unreasonable to rely on this feature.
  74. *
  75. * \param block_number Start address of the SD memory block for writing
  76. * \param buffer Pointer to the block of data to write.
  77. * \param size Number of bytes to write.
  78. * \return
  79. * - true on sucess.
  80. * - false on fail.
  81. */
  82. bool drvSdmmcWrite(void *ctx, uint32_t block_number, const void *buffer, uint32_t size);
  83. /**
  84. * \brief Read blocks of data from sdmmc
  85. *
  86. * This function is used to Read blocks of data on the MMC.
  87. *
  88. * \p buffer should be 32 bits (4 bytes) aligned. \p size should be sector
  89. * size aligned.
  90. *
  91. * \p buffer should be SRAM or external RAM. Otherwise, it will return
  92. * false.
  93. *
  94. * D-cache invalidate will be performed on \p buffer. Caller should take care
  95. * the effects of D-cache invalidate.
  96. *
  97. * \param block_number Start address of the SD memory block for reading
  98. * \param buffer Pointer to the block of data to read
  99. * \param size Number of bytes to read
  100. * \return
  101. * - true on success.
  102. * - false on fail.
  103. */
  104. bool drvSdmmcRead(void *ctx, uint32_t block_number, void *buffer, uint32_t size);
  105. /**
  106. * get hardware type
  107. */
  108. uint32_t drvSdmmcGetType(void *ctx);
  109. OSI_EXTERN_C_END
  110. #endif