gpio.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * File : gpio.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, 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. * 2011-01-13 weety first version
  23. */
  24. #ifndef __DM365_GPIO_H
  25. #define __DM365_GPIO_H
  26. #include <dm36x.h>
  27. #define GPIO(X) (X)
  28. #define get_io(r) *((volatile u_int *)(TI81XX_L4_SLOW_IO_ADDRESS(r)))
  29. #define set_io(r,v) *((volatile u_int *)(TI81XX_L4_SLOW_IO_ADDRESS(r))) = (v)
  30. #define and_io(r,v) *((volatile u_int *)(TI81XX_L4_SLOW_IO_ADDRESS(r))) &= (v)
  31. #define or_io(r,v) *((volatile u_int *)(TI81XX_L4_SLOW_IO_ADDRESS(r))) |= (v)
  32. #define v_get_io(r) *((volatile u_int *)(r))
  33. #define v_set_io(r,v) *((volatile u_int *)(r)) = (v)
  34. #define v_and_io(r,v) *((volatile u_int *)(r)) &= (v)
  35. #define v_or_io(r,v) *((volatile u_int *)(r)) |= (v)
  36. enum gpio_intr_mode
  37. {
  38. LEVELDETECT_LOW = 0,
  39. LEVELDETECT_HIGH,
  40. RISINGDETECT,
  41. FALLINGDETECT,
  42. EDGEDETECT //both rising-edge and falling-edge detect
  43. };
  44. enum gpio_intr_req
  45. {
  46. INTR_REQ_A = 0,
  47. INTR_REQ_B
  48. };
  49. enum gpio_intr_num
  50. {
  51. GPIOINT0A = 96,
  52. GPIOINT0B,
  53. GPIOINT1A,
  54. GPIOINT1B,
  55. };
  56. enum pin_func_mod
  57. {
  58. GPIO_MOD = 0x80,
  59. SPI_MOD =0x01,
  60. VP_MOD=0x04,
  61. IIC_MOD=0x20
  62. };
  63. #endif /* __TI814X_GPIO_H */