xsvf.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. #ifndef XSVFEXEC_XSVF_H_
  2. #define XSVFEXEC_XSVF_H_
  3. /*
  4. * Copyright (C) 2004-2007 by egnite Software GmbH
  5. * Copyright (C) 2008 by egnite GmbH
  6. *
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the copyright holders nor the names of
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  26. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  32. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33. * SUCH DAMAGE.
  34. *
  35. * For additional information see http://www.ethernut.de/
  36. * and Xilinx Application Note XAPP058.
  37. */
  38. /*
  39. * $Log$
  40. * Revision 1.1 2008/10/20 13:10:05 haraldkipp
  41. * Checked in.
  42. *
  43. */
  44. /*!
  45. * \file xsvf.h
  46. * \brief TAP state header file.
  47. */
  48. /*!
  49. * \addtogroup xgXEDefs
  50. */
  51. /*@{*/
  52. /*!
  53. * \brief Maximum number of bytes required to store bit strings.
  54. *
  55. * A value of five is sufficient for up to six devices in a chain.
  56. */
  57. #ifdef ETHERNUT3
  58. #define MAX_BITVEC_BYTES 12
  59. #else
  60. #define MAX_BITVEC_BYTES 5
  61. #endif
  62. /*!
  63. * \brief Default repeat.
  64. *
  65. * Number of times that TDO is tested against the expected value before
  66. * the operation is considered a failure.
  67. */
  68. #define DEFAULT_REPEAT 32
  69. /*@}*/
  70. /*!
  71. * \addtogroup xgXsvfExec
  72. */
  73. /*@{*/
  74. /*
  75. * XSVF error codes.
  76. */
  77. /*! Error code. Unknown error. */
  78. #define XE_UNKNOWN 1
  79. /*! Error code. Captured TDO value differs from expected TDO value. */
  80. #define XE_TDOMISMATCH 2
  81. /*! Error code. XSVF buffer contains illegal command. */
  82. #define XE_ILLEGALCMD 4
  83. /*! Error code. XSVF buffer contains illegal TAP state. */
  84. #define XE_ILLEGALSTATE 5
  85. /*! Error code. Bit string overflow. */
  86. #define XE_DATAOVERFLOW 6
  87. /*! Error code. End of XSVF data reached without XCOMPLETE. */
  88. #define XE_DATAUNDERFLOW 7
  89. /*
  90. * XSVF instruction codes.
  91. */
  92. /*! XSVF command code. End of XSVF buffer. */
  93. #define XCOMPLETE 0x00
  94. /*! XSVF command code. Set the TDO mask. Length has been specified by the last XSDRSIZE command. */
  95. #define XTDOMASK 0x01
  96. /*! XSVF command code. Go to the Shift-IR state and shift in the TDI value. XSIR uses
  97. a single byte for the TDI size. */
  98. #define XSIR 0x02
  99. /*!
  100. * XSVF command code. Go to the Shift-DR state and shift in the TDI value; compare the expected
  101. * value from the last XSDRTDO command against the TDO value that was
  102. * shifted out. Use the TDO mask which was generated by the last XTDOMASK
  103. * instruction.
  104. */
  105. #define XSDR 0x03
  106. /*!
  107. * XSVF command code. Set the number of microseconds the device should stay in the Run-Test-Idle
  108. * state after each visit to the SDR state.
  109. */
  110. #define XRUNTEST 0x04
  111. /*!
  112. * XSVF command code. Set the number of times that TDO is tested against the expected value before
  113. * the programming operation is considered a failure.
  114. */
  115. #define XREPEAT 0x07
  116. /*! XSVF command code. Set the length of the next XSDR/XSDRTDO records that follow. */
  117. #define XSDRSIZE 0x08
  118. /*!
  119. * XSVF command code. Go to the Shift-DR state and shift in the TDI value; compare the expected
  120. * value against the TDO value that was shifted out. Use the TDO mask which
  121. * was generated by the last XTDOMASK command.
  122. *
  123. * The expected TDO value is re-used in successive XSDR commands.
  124. */
  125. #define XSDRTDO 0x09
  126. /*! XSVF command code. Set SDR address and data masks for interatin XSDR commands. */
  127. #define XSETSDRMASKS 0x0A
  128. /*! Do iterating XSDR commands. */
  129. #define XSDRINC 0x0B
  130. /*!
  131. * XSVF command code. Go to the Shift-DR state and shift in the TDI value. No comparison of TDO
  132. * value with the last specified expected value is performed.
  133. */
  134. #define XSDRB 0x0C
  135. /*!
  136. * XSVF command code. Continue to stay in Shift-DR state and shift in the TDI value. No comparison
  137. * of TDO value with the last specified expected value is performed.
  138. */
  139. #define XSDRC 0x0D
  140. /*!
  141. * XSVF command code. Continue to stay in Shift-DR state and shift in the TDI value. At the end
  142. * of the operation, go to the state specified in the last XENDDR command. No
  143. * comparison of TDO value with the last specified expected value is performed.
  144. */
  145. #define XSDRE 0x0E
  146. /*!
  147. * XSVF command code. Go to the Shift-DR state and shift in the TDI value. Compare all bits of the
  148. * expected value against the TDO value that is shifted out. No retries are
  149. * performed.
  150. */
  151. #define XSDRTDOB 0x0F
  152. /*!
  153. * XSVF command code. Continue to stay in Shift-DR state and shift in the TDI value. Compare all
  154. * bits of the expected value against the TDO value that is shifted out.
  155. */
  156. #define XSDRTDOC 0x10
  157. /*!
  158. * XSVF command code. Continue to stay in Shift-DR state and shift in the TDI value. Compare all
  159. * bits of the expected value against the TDO value that is shifted out. At the
  160. * end of the operation, go to the state specified in the last XENDDR command.
  161. * No retries are performed.
  162. */
  163. #define XSDRTDOE 0x11
  164. /*! XSVF command code. Immediately set the TAP controller to Test-Logic-Reset (0) or Run-Test_idle (1). */
  165. #define XSTATE 0x12
  166. /*! XSVF command code. Set the XSIR end state to Run-Test-Idle (0) or Pause-IR (1). */
  167. #define XENDIR 0x13
  168. /*! XSVF command code. Set the XSDR/XSDRTDO end state to Run-Test-Idle (0) or Pause-DR (1). */
  169. #define XENDDR 0x14
  170. /*! XSVF command code. Go to the Shift-IR state and shift in the TDI value. XSIR2 uses two bytes for the TDI size. */
  171. #define XSIR2 0x15
  172. /*! XSVF command code. Embedded comment string follows. */
  173. #define XCOMMENT 0x16
  174. /*! XSVF command code. Not implemented. */
  175. #define XWAIT 0x17
  176. /*! Unknown XSVF command code, indicates an error. */
  177. #define XUNKNOWN 0x18
  178. /*@}*/
  179. #endif