uart-sun8iw20.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (c) 2019-2025 Allwinner Technology Co., Ltd. ALL rights reserved.
  3. *
  4. * Allwinner is a trademark of Allwinner Technology Co.,Ltd., registered in
  5. * the the People's Republic of China and other countries.
  6. * All Allwinner Technology Co.,Ltd. trademarks are used with permission.
  7. *
  8. * DISCLAIMER
  9. * THIRD PARTY LICENCES MAY BE REQUIRED TO IMPLEMENT THE SOLUTION/PRODUCT.
  10. * IF YOU NEED TO INTEGRATE THIRD PARTY'S TECHNOLOGY (SONY, DTS, DOLBY, AVS OR MPEGLA, ETC.)
  11. * IN ALLWINNERS'SDK OR PRODUCTS, YOU SHALL BE SOLELY RESPONSIBLE TO OBTAIN
  12. * ALL APPROPRIATELY REQUIRED THIRD PARTY LICENCES.
  13. * ALLWINNER SHALL HAVE NO WARRANTY, INDEMNITY OR OTHER OBLIGATIONS WITH RESPECT TO MATTERS
  14. * COVERED UNDER ANY REQUIRED THIRD PARTY LICENSE.
  15. * YOU ARE SOLELY RESPONSIBLE FOR YOUR USAGE OF THIRD PARTY'S TECHNOLOGY.
  16. *
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY ALLWINNER"AS IS" AND TO THE MAXIMUM EXTENT
  19. * PERMITTED BY LAW, ALLWINNER EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY KIND,
  20. * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION REGARDING
  21. * THE TITLE, NON-INFRINGEMENT, ACCURACY, CONDITION, COMPLETENESS, PERFORMANCE
  22. * OR MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  23. * IN NO EVENT SHALL ALLWINNER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  26. * LOSS OF USE, DATA, OR PROFITS, OR BUSINESS INTERRUPTION)
  27. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  28. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  30. * OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. #ifndef __UART_SUN8IW20_H__
  33. #define __UART_SUN8IW20_H__
  34. #include <rtthread.h>
  35. /* config for DSP */
  36. #if defined(CONFIG_CORE_DSP0)
  37. #include <interrupt.h>
  38. #define SUNXI_CLK_UART0 CLK_BUS_UART0
  39. #define SUNXI_RST_UART0 RST_BUS_UART0
  40. #define SUNXI_CLK_UART1 CLK_BUS_UART1
  41. #define SUNXI_RST_UART1 RST_BUS_UART1
  42. #define SUNXI_CLK_UART2 CLK_BUS_UART2
  43. #define SUNXI_RST_UART2 RST_BUS_UART2
  44. #define SUNXI_CLK_UART3 CLK_BUS_UART3
  45. #define SUNXI_RST_UART3 RST_BUS_UART3
  46. #define SUNXI_IRQ_UART0 (RINTC_IRQ_MASK | 1)
  47. #define SUNXI_IRQ_UART1 (RINTC_IRQ_MASK | 2)
  48. #define SUNXI_IRQ_UART2 (RINTC_IRQ_MASK | 3)
  49. #define SUNXI_IRQ_UART3 (RINTC_IRQ_MASK | 4)
  50. #define SUNXI_UART0_BASE (0x02500000)
  51. #define SUNXI_UART1_BASE (0x02500400)
  52. #define SUNXI_UART2_BASE (0x02500800)
  53. #define SUNXI_UART3_BASE (0x02500C00)
  54. #define UART_FIFO_SIZE (64)
  55. #define UART0_GPIO_FUNCTION (3)
  56. #define UART1_GPIO_FUNCTION (7)
  57. #define UART2_GPIO_FUNCTION (2)
  58. #define UART3_GPIO_FUNCTION (5)
  59. #define UART0_TX GPIOF(2)
  60. #define UART0_RX GPIOF(4)
  61. #define UART1_TX GPIOB(8)
  62. #define UART1_RX GPIOB(9)
  63. #define UART2_TX GPIOC(8)
  64. #define UART2_RX GPIOC(9)
  65. #define UART3_TX GPIOD(10)
  66. #define UART3_RX GPIOD(11)
  67. #else
  68. #define SUNXI_CLK_UART0 CLK_BUS_UART0;
  69. #define SUNXI_RST_UART0 RST_BUS_UART0;
  70. #define SUNXI_CLK_UART1 CLK_BUS_UART1;
  71. #define SUNXI_RST_UART1 RST_BUS_UART1;
  72. #define SUNXI_CLK_UART2 CLK_BUS_UART2;
  73. #define SUNXI_RST_UART2 RST_BUS_UART2;
  74. #define SUNXI_CLK_UART3 CLK_BUS_UART3;
  75. #define SUNXI_RST_UART3 RST_BUS_UART3;
  76. #define SUNXI_IRQ_UART0 (18)
  77. #define SUNXI_IRQ_UART1 (19)
  78. #define SUNXI_IRQ_UART2 (20)
  79. #define SUNXI_IRQ_UART3 (21)
  80. #define SUNXI_IRQ_UART4 (22)
  81. #define SUNXI_IRQ_UART5 (23)
  82. #define SUNXI_UART0_BASE (0x02500000)
  83. #define SUNXI_UART1_BASE (0x02500400)
  84. #define SUNXI_UART2_BASE (0x02500800)
  85. #define SUNXI_UART3_BASE (0x02500c00)
  86. #define SUNXI_UART4_BASE (0x02501000)
  87. #define SUNXI_UART5_BASE (0x02501400)
  88. //TODO:UART1~5 FIFO:256
  89. #define UART_FIFO_SIZE (64)
  90. #define UART0_GPIO_FUNCTION (6)
  91. #define UART1_GPIO_FUNCTION (6)
  92. #define UART2_GPIO_FUNCTION (6)
  93. #define UART3_GPIO_FUNCTION (6)
  94. #ifdef BOARD_allwinnerd1
  95. #define UART0_TX GPIOB(8)
  96. #define UART0_RX GPIOB(9)
  97. #elif defined(BOARD_allwinnerd1s)
  98. #define UART0_TX GPIOE(2)
  99. #define UART0_RX GPIOE(3)
  100. #endif
  101. #define UART1_TX GPIOB(10)
  102. #define UART1_RX GPIOB(11)
  103. #define UART2_TX GPIOL(8)
  104. #define UART2_RX GPIOL(9)
  105. #define UART3_TX GPIOL(8)
  106. #define UART3_RX GPIOL(9)
  107. #endif /* CONFIG_CORE_DSP0 */
  108. #endif /*__UART_SUN8IW20_H__ */