xilinx.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * (C) Copyright 2002
  3. * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. *
  23. */
  24. #include <fpga.h>
  25. #ifndef _XILINX_H_
  26. #define _XILINX_H_
  27. /* Xilinx Model definitions
  28. *********************************************************************/
  29. #define CONFIG_SYS_SPARTAN2 CONFIG_SYS_FPGA_DEV( 0x1 )
  30. #define CONFIG_SYS_VIRTEX_E CONFIG_SYS_FPGA_DEV( 0x2 )
  31. #define CONFIG_SYS_VIRTEX2 CONFIG_SYS_FPGA_DEV( 0x4 )
  32. #define CONFIG_SYS_SPARTAN3 CONFIG_SYS_FPGA_DEV( 0x8 )
  33. #define CONFIG_SYS_ZYNQ CONFIG_SYS_FPGA_DEV(0x10)
  34. #define CONFIG_SYS_XILINX_SPARTAN2 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN2)
  35. #define CONFIG_SYS_XILINX_VIRTEX_E (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX_E)
  36. #define CONFIG_SYS_XILINX_VIRTEX2 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX2)
  37. #define CONFIG_SYS_XILINX_SPARTAN3 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN3)
  38. #define CONFIG_SYS_XILINX_ZYNQ (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_ZYNQ)
  39. /* XXX - Add new models here */
  40. /* Xilinx Interface definitions
  41. *********************************************************************/
  42. #define CONFIG_SYS_XILINX_IF_SS CONFIG_SYS_FPGA_IF( 0x1 ) /* slave serial */
  43. #define CONFIG_SYS_XILINX_IF_MS CONFIG_SYS_FPGA_IF( 0x2 ) /* master serial */
  44. #define CONFIG_SYS_XILINX_IF_SP CONFIG_SYS_FPGA_IF( 0x4 ) /* slave parallel */
  45. #define CONFIG_SYS_XILINX_IF_JTAG CONFIG_SYS_FPGA_IF( 0x8 ) /* jtag */
  46. #define CONFIG_SYS_XILINX_IF_MSM CONFIG_SYS_FPGA_IF( 0x10 ) /* master selectmap */
  47. #define CONFIG_SYS_XILINX_IF_SSM CONFIG_SYS_FPGA_IF( 0x20 ) /* slave selectmap */
  48. /* Xilinx types
  49. *********************************************************************/
  50. typedef enum { /* typedef Xilinx_iface */
  51. min_xilinx_iface_type, /* low range check value */
  52. slave_serial, /* serial data and external clock */
  53. master_serial, /* serial data w/ internal clock (not used) */
  54. slave_parallel, /* parallel data w/ external latch */
  55. jtag_mode, /* jtag/tap serial (not used ) */
  56. master_selectmap, /* master SelectMap (virtex2) */
  57. slave_selectmap, /* slave SelectMap (virtex2) */
  58. devcfg, /* devcfg interface (zynq) */
  59. max_xilinx_iface_type /* insert all new types before this */
  60. } Xilinx_iface; /* end, typedef Xilinx_iface */
  61. typedef enum { /* typedef Xilinx_Family */
  62. min_xilinx_type, /* low range check value */
  63. Xilinx_Spartan2, /* Spartan-II Family */
  64. Xilinx_VirtexE, /* Virtex-E Family */
  65. Xilinx_Virtex2, /* Virtex2 Family */
  66. Xilinx_Spartan3, /* Spartan-III Family */
  67. xilinx_zynq, /* Zynq Family */
  68. max_xilinx_type /* insert all new types before this */
  69. } Xilinx_Family; /* end, typedef Xilinx_Family */
  70. typedef struct { /* typedef Xilinx_desc */
  71. Xilinx_Family family; /* part type */
  72. Xilinx_iface iface; /* interface type */
  73. size_t size; /* bytes of data part can accept */
  74. void *iface_fns; /* interface function table */
  75. int cookie; /* implementation specific cookie */
  76. } Xilinx_desc; /* end, typedef Xilinx_desc */
  77. /* Generic Xilinx Functions
  78. *********************************************************************/
  79. extern int xilinx_load(Xilinx_desc *desc, const void *image, size_t size);
  80. extern int xilinx_dump(Xilinx_desc *desc, const void *buf, size_t bsize);
  81. extern int xilinx_info(Xilinx_desc *desc);
  82. /* Board specific implementation specific function types
  83. *********************************************************************/
  84. typedef int (*Xilinx_pgm_fn)( int assert_pgm, int flush, int cookie );
  85. typedef int (*Xilinx_init_fn)( int cookie );
  86. typedef int (*Xilinx_err_fn)( int cookie );
  87. typedef int (*Xilinx_done_fn)( int cookie );
  88. typedef int (*Xilinx_clk_fn)( int assert_clk, int flush, int cookie );
  89. typedef int (*Xilinx_cs_fn)( int assert_cs, int flush, int cookie );
  90. typedef int (*Xilinx_wr_fn)( int assert_write, int flush, int cookie );
  91. typedef int (*Xilinx_rdata_fn)( unsigned char *data, int cookie );
  92. typedef int (*Xilinx_wdata_fn)( unsigned char data, int flush, int cookie );
  93. typedef int (*Xilinx_busy_fn)( int cookie );
  94. typedef int (*Xilinx_abort_fn)( int cookie );
  95. typedef int (*Xilinx_pre_fn)( int cookie );
  96. typedef int (*Xilinx_post_fn)( int cookie );
  97. typedef int (*Xilinx_bwr_fn)( void *buf, size_t len, int flush, int cookie );
  98. #endif /* _XILINX_H_ */