drv_sdio.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2022-2024, Xiaohua Semiconductor Co., Ltd.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-02-14 CDT first version
  9. */
  10. #ifndef __DRV_SDIO_H__
  11. #define __DRV_SDIO_H__
  12. /*******************************************************************************
  13. * Include files
  14. ******************************************************************************/
  15. #include <rtthread.h>
  16. #include "rtdevice.h"
  17. #include "drv_dma.h"
  18. #include "drv_irq.h"
  19. /* C binding of definitions if building with C++ compiler */
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /*******************************************************************************
  24. * Global type definitions ('typedef')
  25. ******************************************************************************/
  26. /* sdio package */
  27. struct sdio_pkg
  28. {
  29. struct rt_mmcsd_cmd *cmd;
  30. void *buf;
  31. rt_uint32_t flag;
  32. };
  33. typedef rt_err_t (*sdio_txconfig)(CM_DMA_TypeDef *dma_instance, rt_uint8_t channel, struct sdio_pkg *pkg);
  34. typedef rt_err_t (*sdio_rxconfig)(CM_DMA_TypeDef *dma_instance, rt_uint8_t channel, struct sdio_pkg *pkg);
  35. typedef rt_uint32_t (*sdio_clk_get)(CM_SDIOC_TypeDef *sdio_instance);
  36. /* hc32 sdio des */
  37. struct hc32_sdio_des
  38. {
  39. sdio_clk_get clk_get;
  40. sdio_txconfig txconfig;
  41. sdio_rxconfig rxconfig;
  42. };
  43. /* hc32 sdio configure */
  44. struct hc32_sdio_config
  45. {
  46. const char *name;
  47. CM_SDIOC_TypeDef *instance;
  48. rt_uint32_t clock;
  49. struct hc32_irq_config irq_config;
  50. struct dma_config dma_rx;
  51. struct dma_config dma_tx;
  52. };
  53. /*******************************************************************************
  54. * Global pre-processor symbols/macros ('#define')
  55. ******************************************************************************/
  56. /*******************************************************************************
  57. * Global variable definitions ('extern')
  58. ******************************************************************************/
  59. /*******************************************************************************
  60. * Global function prototypes (definition in C source)
  61. ******************************************************************************/
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* __DRV_SDIO_H__ */