wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 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 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 30 | /* Xilinx types |
| 31 | *********************************************************************/ |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 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) */ |
Michal Simek | d5dae85 | 2013-04-22 15:43:02 +0200 | [diff] [blame] | 40 | devcfg, /* devcfg interface (zynq) */ |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 41 | max_xilinx_iface_type /* insert all new types before this */ |
| 42 | } Xilinx_iface; /* end, typedef Xilinx_iface */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 43 | |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 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 */ |
Michal Simek | d5dae85 | 2013-04-22 15:43:02 +0200 | [diff] [blame] | 50 | xilinx_zynq, /* Zynq Family */ |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 51 | max_xilinx_type /* insert all new types before this */ |
| 52 | } Xilinx_Family; /* end, typedef Xilinx_Family */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 53 | |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 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 */ |
Michal Simek | 6631db4 | 2013-04-26 15:04:48 +0200 | [diff] [blame] | 60 | char *name; /* device name in bitstream */ |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 61 | } Xilinx_desc; /* end, typedef Xilinx_desc */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 62 | |
| 63 | /* Generic Xilinx Functions |
| 64 | *********************************************************************/ |
Wolfgang Denk | e6a857d | 2011-07-30 13:33:49 +0000 | [diff] [blame] | 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); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 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 ); |
Wolfgang Wegner | 8908334 | 2009-10-30 16:55:02 +0100 | [diff] [blame] | 84 | typedef int (*Xilinx_bwr_fn)( void *buf, size_t len, int flush, int cookie ); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 85 | |
| 86 | #endif /* _XILINX_H_ */ |