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 | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 30 | /* Altera Model definitions |
| 31 | *********************************************************************/ |
| 32 | #define CFG_ACEX1K CFG_FPGA_DEV( 0x1 ) |
Stefan Roese | f0ff469 | 2006-08-15 14:15:51 +0200 | [diff] [blame] | 33 | #define CFG_CYCLON2 CFG_FPGA_DEV( 0x2 ) |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame^] | 34 | #define CFG_STRATIX_II CFG_FPGA_DEV( 0x4 ) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 35 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 36 | #define CFG_ALTERA_ACEX1K (CFG_FPGA_ALTERA | CFG_ACEX1K) |
Stefan Roese | f0ff469 | 2006-08-15 14:15:51 +0200 | [diff] [blame] | 37 | #define CFG_ALTERA_CYCLON2 (CFG_FPGA_ALTERA | CFG_CYCLON2) |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame^] | 38 | #define CFG_ALTERA_STRATIX_II (CFG_FPGA_ALTERA | CFG_STRATIX_II) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 39 | /* Add new models here */ |
| 40 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 41 | /* Altera Interface definitions |
| 42 | *********************************************************************/ |
| 43 | #define CFG_ALTERA_IF_PS CFG_FPGA_IF( 0x1 ) /* passive serial */ |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame^] | 44 | #define CFG_ALTERA_IF_FPP CFG_FPGA_IF( 0x2 ) /* fast passive parallel */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 45 | /* Add new interfaces here */ |
| 46 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 47 | typedef enum { /* typedef Altera_iface */ |
| 48 | min_altera_iface_type, /* insert all new types after this */ |
| 49 | passive_serial, /* serial data and external clock */ |
| 50 | passive_parallel_synchronous, /* parallel data */ |
| 51 | passive_parallel_asynchronous, /* parallel data */ |
| 52 | passive_serial_asynchronous, /* serial data w/ internal clock (not used) */ |
| 53 | altera_jtag_mode, /* jtag/tap serial (not used ) */ |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame^] | 54 | fast_passive_parallel, /* fast passive parallel (FPP) */ |
| 55 | fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */ |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 56 | max_altera_iface_type /* insert all new types before this */ |
| 57 | } Altera_iface; /* end, typedef Altera_iface */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 59 | typedef enum { /* typedef Altera_Family */ |
| 60 | min_altera_type, /* insert all new types after this */ |
| 61 | Altera_ACEX1K, /* ACEX1K Family */ |
Stefan Roese | f0ff469 | 2006-08-15 14:15:51 +0200 | [diff] [blame] | 62 | Altera_CYC2, /* CYCLONII Family */ |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame^] | 63 | Altera_StratixII, /* StratixII Familiy */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 64 | /* Add new models here */ |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 65 | max_altera_type /* insert all new types before this */ |
| 66 | } Altera_Family; /* end, typedef Altera_Family */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 67 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 68 | typedef struct { /* typedef Altera_desc */ |
| 69 | Altera_Family family; /* part type */ |
| 70 | Altera_iface iface; /* interface type */ |
| 71 | size_t size; /* bytes of data part can accept */ |
| 72 | void * iface_fns;/* interface function table */ |
| 73 | void * base; /* base interface address */ |
| 74 | int cookie; /* implementation specific cookie */ |
| 75 | } Altera_desc; /* end, typedef Altera_desc */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 76 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 77 | /* Generic Altera Functions |
| 78 | *********************************************************************/ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 79 | extern int altera_load( Altera_desc *desc, void *image, size_t size ); |
| 80 | extern int altera_dump( Altera_desc *desc, void *buf, size_t bsize ); |
| 81 | extern int altera_info( Altera_desc *desc ); |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 82 | extern int altera_reloc( Altera_desc *desc, ulong reloc_offset ); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 83 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 84 | /* Board specific implementation specific function types |
| 85 | *********************************************************************/ |
| 86 | typedef int (*Altera_pre_fn)( int cookie ); |
| 87 | typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie ); |
| 88 | typedef int (*Altera_status_fn)( int cookie ); |
| 89 | typedef int (*Altera_done_fn)( int cookie ); |
| 90 | typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie ); |
| 91 | typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie ); |
Stefan Roese | f0ff469 | 2006-08-15 14:15:51 +0200 | [diff] [blame] | 92 | typedef int (*Altera_write_fn)(void *buf, size_t len, int flush, int cookie); |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 93 | typedef int (*Altera_abort_fn)( int cookie ); |
| 94 | typedef int (*Altera_post_fn)( int cookie ); |
| 95 | |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame^] | 96 | typedef struct { |
| 97 | Altera_pre_fn pre; |
| 98 | Altera_config_fn config; |
| 99 | Altera_status_fn status; |
| 100 | Altera_done_fn done; |
| 101 | Altera_clk_fn clk; |
| 102 | Altera_data_fn data; |
| 103 | Altera_abort_fn abort; |
| 104 | Altera_post_fn post; |
| 105 | } altera_board_specific_func; |
| 106 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 107 | #endif /* _ALTERA_H_ */ |