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 25 #include <fpga.h> 26 27 #ifndef _XILINX_H_ 28 #define _XILINX_H_ 29 30 /* Xilinx types 31 *********************************************************************/ 32 typedef enum { /* typedef Xilinx_iface */ 33 min_xilinx_iface_type, /* low range check value */ 34 slave_serial, /* serial data and external clock */ 35 master_serial, /* serial data w/ internal clock (not used) */ 36 slave_parallel, /* parallel data w/ external latch */ 37 jtag_mode, /* jtag/tap serial (not used ) */ 38 master_selectmap, /* master SelectMap (virtex2) */ 39 slave_selectmap, /* slave SelectMap (virtex2) */ 40 devcfg, /* devcfg interface (zynq) */ 41 max_xilinx_iface_type /* insert all new types before this */ 42 } Xilinx_iface; /* end, typedef Xilinx_iface */ 43 44 typedef enum { /* typedef Xilinx_Family */ 45 min_xilinx_type, /* low range check value */ 46 Xilinx_Spartan2, /* Spartan-II Family */ 47 Xilinx_VirtexE, /* Virtex-E Family */ 48 Xilinx_Virtex2, /* Virtex2 Family */ 49 Xilinx_Spartan3, /* Spartan-III Family */ 50 xilinx_zynq, /* Zynq Family */ 51 max_xilinx_type /* insert all new types before this */ 52 } Xilinx_Family; /* end, typedef Xilinx_Family */ 53 54 typedef struct { /* typedef Xilinx_desc */ 55 Xilinx_Family family; /* part type */ 56 Xilinx_iface iface; /* interface type */ 57 size_t size; /* bytes of data part can accept */ 58 void *iface_fns; /* interface function table */ 59 int cookie; /* implementation specific cookie */ 60 char *name; /* device name in bitstream */ 61 } Xilinx_desc; /* end, typedef Xilinx_desc */ 62 63 /* Generic Xilinx Functions 64 *********************************************************************/ 65 extern int xilinx_load(Xilinx_desc *desc, const void *image, size_t size); 66 extern int xilinx_dump(Xilinx_desc *desc, const void *buf, size_t bsize); 67 extern int xilinx_info(Xilinx_desc *desc); 68 69 /* Board specific implementation specific function types 70 *********************************************************************/ 71 typedef int (*Xilinx_pgm_fn)( int assert_pgm, int flush, int cookie ); 72 typedef int (*Xilinx_init_fn)( int cookie ); 73 typedef int (*Xilinx_err_fn)( int cookie ); 74 typedef int (*Xilinx_done_fn)( int cookie ); 75 typedef int (*Xilinx_clk_fn)( int assert_clk, int flush, int cookie ); 76 typedef int (*Xilinx_cs_fn)( int assert_cs, int flush, int cookie ); 77 typedef int (*Xilinx_wr_fn)( int assert_write, int flush, int cookie ); 78 typedef int (*Xilinx_rdata_fn)( unsigned char *data, int cookie ); 79 typedef int (*Xilinx_wdata_fn)( unsigned char data, int flush, int cookie ); 80 typedef int (*Xilinx_busy_fn)( int cookie ); 81 typedef int (*Xilinx_abort_fn)( int cookie ); 82 typedef int (*Xilinx_pre_fn)( int cookie ); 83 typedef int (*Xilinx_post_fn)( int cookie ); 84 typedef int (*Xilinx_bwr_fn)( void *buf, size_t len, int flush, int cookie ); 85 86 #endif /* _XILINX_H_ */ 87