drv_sdio.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_SDIO_H_
  13. #define _DRV_SDIO_H_
  14. #include "osi_compiler.h"
  15. #include <stddef.h>
  16. #include <sys/stat.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include "quec_proj_config.h"
  20. OSI_EXTERN_C_BEGIN
  21. /**
  22. * \brief opaque data struct of sdSdio driver
  23. */
  24. typedef struct drvSdio drvSdio_t;
  25. /**
  26. * \brief create sdSdio driver instance
  27. *
  28. * \param name device name
  29. * \return
  30. * - created driver instance
  31. * - NULL on error, invalid parameter or out of memory
  32. */
  33. drvSdio_t *drvSdioCreate(uint32_t name);
  34. typedef struct
  35. {
  36. bool (*open)(void *priv);
  37. bool (*write)(void *priv, uint32_t nr, const void *buffer, uint32_t size);
  38. bool (*read)(void *priv, uint32_t nr, void *buffer, uint32_t size);
  39. void (*close)(void *priv);
  40. void (*destroy)(void *priv);
  41. uint32_t (*block)(void *priv);
  42. uint32_t (*type)(void *priv);
  43. #ifdef CONFIG_QUEC_PROJECT_FEATURE
  44. bool (*setclk)(void *priv,uint32_t freq);
  45. #endif
  46. } drvSdioOps_t;
  47. //
  48. struct drvSdio
  49. {
  50. unsigned name;
  51. drvSdioOps_t ops;
  52. void *priv;
  53. };
  54. bool drvSdioOpen(drvSdio_t *d);
  55. bool drvSdioWrite(drvSdio_t *d, uint32_t nr, const void *buffer, uint32_t size);
  56. bool drvSdioRead(drvSdio_t *d, uint32_t nr, void *buffer, uint32_t size);
  57. void drvSdioClose(drvSdio_t *d);
  58. void drvSdioDestroy(drvSdio_t *d);
  59. uint32_t drvSdioGetBlockNum(drvSdio_t *d);
  60. uint32_t drvSdioGetType(drvSdio_t *d);
  61. #ifdef CONFIG_QUEC_PROJECT_FEATURE
  62. bool drvSdioSetClk(drvSdio_t *d,uint32_t freq);
  63. #endif
  64. OSI_EXTERN_C_END
  65. #endif