drv_pin.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * File : drv_pin.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2017-01-01 Urey first version
  23. */
  24. #include <rthw.h>
  25. #include <rtdevice.h>
  26. #include <board.h>
  27. #include "drv_gpio.h"
  28. #define CORE_BOARD_PIN_NUMBERS 94 //Halley2
  29. #define __X1000_PIN(index, port, pin) { 0, GPIO_PORT_##port, GPIO_Pin_##pin}
  30. #define __X1000_PIN_DEFAULT {-1, 0, 0}
  31. struct pin_index
  32. {
  33. int index;
  34. uint32_t port;
  35. uint32_t pin;
  36. };
  37. static const struct pin_index pins[] =
  38. {
  39. __X1000_PIN_DEFAULT, //0 NULL
  40. __X1000_PIN_DEFAULT, //1 RST
  41. __X1000_PIN(2,B,26),
  42. __X1000_PIN(3,B,25),
  43. __X1000_PIN_DEFAULT,
  44. __X1000_PIN_DEFAULT,
  45. __X1000_PIN_DEFAULT,
  46. __X1000_PIN_DEFAULT,
  47. __X1000_PIN_DEFAULT,
  48. __X1000_PIN_DEFAULT,
  49. __X1000_PIN_DEFAULT,
  50. __X1000_PIN_DEFAULT,
  51. __X1000_PIN_DEFAULT,
  52. __X1000_PIN_DEFAULT,
  53. __X1000_PIN_DEFAULT,
  54. __X1000_PIN_DEFAULT,
  55. __X1000_PIN_DEFAULT,
  56. __X1000_PIN(17,B,7),
  57. __X1000_PIN(18,B,6),
  58. __X1000_PIN(19,B,10),
  59. __X1000_PIN(20,B,9),
  60. __X1000_PIN(21,B,8),
  61. __X1000_PIN(22,B,13),
  62. __X1000_PIN(23,B,11),
  63. __X1000_PIN(24,B,12),
  64. __X1000_PIN(25,B,15),
  65. __X1000_PIN(26,B,14),
  66. __X1000_PIN(27,B,16),
  67. __X1000_PIN(28,A,1),
  68. __X1000_PIN(29,A,0),
  69. __X1000_PIN(30,B,18),
  70. __X1000_PIN(31,A,3),
  71. __X1000_PIN(32,A,2),
  72. __X1000_PIN_DEFAULT,
  73. __X1000_PIN_DEFAULT,
  74. __X1000_PIN_DEFAULT,
  75. __X1000_PIN_DEFAULT,
  76. __X1000_PIN(37,A,4),
  77. __X1000_PIN(38,A,6),
  78. __X1000_PIN(39,B,17),
  79. __X1000_PIN(40,B,20),
  80. __X1000_PIN(41,A,5),
  81. __X1000_PIN(42,A,7),
  82. __X1000_PIN(43,A,8),
  83. __X1000_PIN(44,A,9),
  84. __X1000_PIN(45,A,11),
  85. __X1000_PIN(46,B,19),
  86. __X1000_PIN(47,A,10),
  87. };