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 _ALTERA_H_ |
| 28 | #define _ALTERA_H_ |
| 29 | |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 30 | typedef enum { /* typedef Altera_iface */ |
| 31 | min_altera_iface_type, /* insert all new types after this */ |
| 32 | passive_serial, /* serial data and external clock */ |
| 33 | passive_parallel_synchronous, /* parallel data */ |
| 34 | passive_parallel_asynchronous, /* parallel data */ |
| 35 | passive_serial_asynchronous, /* serial data w/ internal clock (not used) */ |
| 36 | altera_jtag_mode, /* jtag/tap serial (not used ) */ |
Michael Jones | 9c5ef8d | 2011-07-14 22:09:28 +0000 | [diff] [blame] | 37 | fast_passive_parallel, /* fast passive parallel (FPP) */ |
eran liberty | 4c373a9 | 2008-03-27 00:50:49 +0100 | [diff] [blame] | 38 | fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 39 | max_altera_iface_type /* insert all new types before this */ |
| 40 | } Altera_iface; /* end, typedef Altera_iface */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 41 | |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 42 | typedef enum { /* typedef Altera_Family */ |
Michael Jones | 9c5ef8d | 2011-07-14 22:09:28 +0000 | [diff] [blame] | 43 | min_altera_type, /* insert all new types after this */ |
| 44 | Altera_ACEX1K, /* ACEX1K Family */ |
| 45 | Altera_CYC2, /* CYCLONII Family */ |
eran liberty | 4c373a9 | 2008-03-27 00:50:49 +0100 | [diff] [blame] | 46 | Altera_StratixII, /* StratixII Familiy */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 47 | /* Add new models here */ |
Michael Jones | 9c5ef8d | 2011-07-14 22:09:28 +0000 | [diff] [blame] | 48 | max_altera_type /* insert all new types before this */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 49 | } Altera_Family; /* end, typedef Altera_Family */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 50 | |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 51 | typedef struct { /* typedef Altera_desc */ |
| 52 | Altera_Family family; /* part type */ |
| 53 | Altera_iface iface; /* interface type */ |
| 54 | size_t size; /* bytes of data part can accept */ |
| 55 | void * iface_fns;/* interface function table */ |
| 56 | void * base; /* base interface address */ |
| 57 | int cookie; /* implementation specific cookie */ |
| 58 | } Altera_desc; /* end, typedef Altera_desc */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 59 | |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 60 | /* Generic Altera Functions |
| 61 | *********************************************************************/ |
Wolfgang Denk | 74f9b38 | 2011-07-30 13:33:49 +0000 | [diff] [blame] | 62 | extern int altera_load(Altera_desc *desc, const void *image, size_t size); |
| 63 | extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize); |
| 64 | extern int altera_info(Altera_desc *desc); |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 65 | |
| 66 | /* Board specific implementation specific function types |
| 67 | *********************************************************************/ |
| 68 | typedef int (*Altera_pre_fn)( int cookie ); |
| 69 | typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie ); |
| 70 | typedef int (*Altera_status_fn)( int cookie ); |
| 71 | typedef int (*Altera_done_fn)( int cookie ); |
| 72 | typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie ); |
| 73 | typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie ); |
Wolfgang Denk | 74f9b38 | 2011-07-30 13:33:49 +0000 | [diff] [blame] | 74 | typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie); |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 75 | typedef int (*Altera_abort_fn)( int cookie ); |
| 76 | typedef int (*Altera_post_fn)( int cookie ); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 77 | |
eran liberty | 4c373a9 | 2008-03-27 00:50:49 +0100 | [diff] [blame] | 78 | typedef struct { |
| 79 | Altera_pre_fn pre; |
| 80 | Altera_config_fn config; |
| 81 | Altera_status_fn status; |
| 82 | Altera_done_fn done; |
| 83 | Altera_clk_fn clk; |
| 84 | Altera_data_fn data; |
| 85 | Altera_abort_fn abort; |
| 86 | Altera_post_fn post; |
| 87 | } altera_board_specific_func; |
| 88 | |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 89 | #endif /* _ALTERA_H_ */ |