dma.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * This file is part of FH8620 BSP for RT-Thread distribution.
  3. *
  4. * Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
  5. * All rights reserved
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. *
  21. * Visit http://www.fullhan.com to get contact with Fullhan.
  22. *
  23. * Change Logs:
  24. * Date Author Notes
  25. */
  26. #ifndef DMA_H_
  27. #define DMA_H_
  28. #include <rtthread.h>
  29. /****************************************************************************
  30. * #include section
  31. * add #include here if any
  32. ***************************************************************************/
  33. /****************************************************************************
  34. * #define section
  35. * add constant #define here if any
  36. ***************************************************************************/
  37. #define RT_DEVICE_CTRL_DMA_OPEN (1)
  38. #define RT_DEVICE_CTRL_DMA_CLOSE (2)
  39. #define RT_DEVICE_CTRL_DMA_REQUEST_CHANNEL (3)
  40. #define RT_DEVICE_CTRL_DMA_RELEASE_CHANNEL (4)
  41. #define RT_DEVICE_CTRL_DMA_SINGLE_TRANSFER (5)
  42. //cyclic add func below....
  43. #define RT_DEVICE_CTRL_DMA_CYCLIC_PREPARE (6)
  44. #define RT_DEVICE_CTRL_DMA_CYCLIC_START (7)
  45. #define RT_DEVICE_CTRL_DMA_CYCLIC_STOP (8)
  46. #define RT_DEVICE_CTRL_DMA_CYCLIC_FREE (9)
  47. //#define RT_DEVICE_CTRL_ (3) /* get the left time before reboot(in seconds) */
  48. //#define RT_DEVICE_CTRL_ (4) /* refresh watchdog */
  49. //#define RT_DEVICE_CTRL_ (5) /* start watchdog */
  50. //#define RT_DEVICE_CTRL_ (6) /* stop watchdog */
  51. /****************************************************************************
  52. * ADT section
  53. * add Abstract Data Type definition here
  54. ***************************************************************************/
  55. struct rt_dma_ops;
  56. struct rt_dma_device
  57. {
  58. // the parent must be the fitst para..
  59. struct rt_device parent;
  60. struct rt_dma_ops *ops;
  61. };
  62. struct rt_dma_ops
  63. {
  64. rt_err_t (*init)(struct rt_dma_device *dma);
  65. rt_err_t (*control)(struct rt_dma_device *dma, int cmd, void *arg);
  66. };
  67. /****************************************************************************
  68. * extern variable declaration section
  69. ***************************************************************************/
  70. /****************************************************************************
  71. * section
  72. * add function prototype here if any
  73. ***************************************************************************/
  74. rt_err_t rt_hw_dma_register(struct rt_dma_device *dma,
  75. const char *name,
  76. rt_uint32_t flag,
  77. void *data);
  78. /********************************End Of File********************************/
  79. #endif