You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

125 lines
5.5 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2011 by Martin Schmoelzer *
  3. * <martin.schmoelzer@student.tuwien.ac.at> *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  19. ***************************************************************************/
  20. #ifndef __IO_H
  21. #define __IO_H
  22. #include "reg_ezusb.h"
  23. /***************************************************************************
  24. * JTAG Signals: *
  25. ***************************************************************************
  26. * TMS ....... Test Mode Select *
  27. * TCK ....... Test Clock *
  28. * TDI ....... Test Data Input (from device point of view, not JTAG *
  29. * adapter point of view!) *
  30. * TDO ....... Test Data Output (from device point of view, not JTAG *
  31. * adapter point of view!) *
  32. * TRST ...... Test Reset: Used to reset the TAP Finite State Machine *
  33. * into the Test Logic Reset state *
  34. * RTCK ...... Return Test Clock *
  35. * OCDSE ..... Enable/Disable OCDS interface (Infineon specific) - shared *
  36. * with /JEN *
  37. * TRAP ...... Trap Condition (Infineon specific) - shared with TSTAT *
  38. * BRKIN ..... Hardware Break-In (Infineon specific) *
  39. * BRKOUT .... Hardware Break-Out (Infineon specific) *
  40. * /JEN ...... JTAG-Enable (STMicroelectronics specific) - shared *
  41. * with OCDSE *
  42. * TSTAT ..... JTAG ISP Status (STMicroelectronics specific) - shared *
  43. * with TRAP *
  44. * RESET ..... Chip Reset (STMicroelectronics specific) *
  45. * /TERR ..... JTAG ISP Error (STMicroelectronics specific) - shared *
  46. * with BRKOUT *
  47. ***************************************************************************/
  48. /* PORT A */
  49. #define PIN_U_OE OUTA0
  50. /* PA1 Not Connected */
  51. #define PIN_OE OUTA2
  52. /* PA3 Not Connected */
  53. #define PIN_RUN_LED OUTA4
  54. #define PIN_TDO PINA5
  55. #define PIN_BRKOUT PINA6
  56. #define PIN_COM_LED OUTA7
  57. /* PORT B */
  58. #define PIN_TDI OUTB0
  59. #define PIN_TMS OUTB1
  60. #define PIN_TCK OUTB2
  61. #define PIN_TRST OUTB3
  62. #define PIN_BRKIN OUTB4
  63. #define PIN_RESET OUTB5
  64. #define PIN_OCDSE OUTB6
  65. #define PIN_TRAP PINB7
  66. /* JTAG Signals with direction 'OUT' on port B */
  67. #define MASK_PORTB_DIRECTION_OUT (PIN_TDI | PIN_TMS | PIN_TCK | PIN_TRST | PIN_BRKIN | PIN_RESET | PIN_OCDSE)
  68. /* PORT C */
  69. #define PIN_RXD0 PINC0
  70. #define PIN_TXD0 OUTC1
  71. #define PIN_RESET_2 PINC2
  72. /* PC3 Not Connecte */
  73. /* PC4 Not Connected */
  74. #define PIN_RTCK PINC5
  75. #define PIN_WR OUTC6
  76. /* PC7 Not Connected */
  77. /* LED Macros */
  78. #define SET_RUN_LED() (OUTA &= ~PIN_RUN_LED)
  79. #define CLEAR_RUN_LED() (OUTA |= PIN_RUN_LED)
  80. #define SET_COM_LED() (OUTA &= ~PIN_COM_LED)
  81. #define CLEAR_COM_LED() (OUTA |= PIN_COM_LED)
  82. /* JTAG Pin Macros */
  83. #define GET_TMS() (PINSB & PIN_TMS)
  84. #define GET_TCK() (PINSB & PIN_TCK)
  85. #define GET_TDO() (PINSA & PIN_TDO)
  86. #define GET_BRKOUT() (PINSA & PIN_BRKOUT)
  87. #define GET_TRAP() (PINSB & PIN_TRAP)
  88. #define GET_RTCK() (PINSC & PIN_RTCK)
  89. #define SET_TMS_HIGH() (OUTB |= PIN_TMS)
  90. #define SET_TMS_LOW() (OUTB &= ~PIN_TMS)
  91. #define SET_TCK_HIGH() (OUTB |= PIN_TCK)
  92. #define SET_TCK_LOW() (OUTB &= ~PIN_TCK)
  93. #define SET_TDI_HIGH() (OUTB |= PIN_TDI)
  94. #define SET_TDI_LOW() (OUTB &= ~PIN_TDI)
  95. /* TRST and RESET are low-active and inverted by hardware. SET_HIGH de-asserts
  96. * the signal (enabling reset), SET_LOW asserts the signal (disabling reset) */
  97. #define SET_TRST_HIGH() (OUTB |= PIN_TRST)
  98. #define SET_TRST_LOW() (OUTB &= ~PIN_TRST)
  99. #define SET_RESET_HIGH() (OUTB |= PIN_RESET)
  100. #define SET_RESET_LOW() (OUTB &= ~PIN_RESET)
  101. #define SET_OCDSE_HIGH() (OUTB |= PIN_OCDSE)
  102. #define SET_OCDSE_LOW() (OUTB &= ~PIN_OCDSE)
  103. #define SET_BRKIN_HIGH() (OUTB |= PIN_BRKIN)
  104. #define SET_BRKIN_LOW() (OUTB &= ~PIN_BRKIN)
  105. #endif