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 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <fpga.h> |
| 9 | |
| 10 | #ifndef _ALTERA_H_ |
| 11 | #define _ALTERA_H_ |
| 12 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 13 | typedef enum { /* typedef Altera_iface */ |
| 14 | min_altera_iface_type, /* insert all new types after this */ |
| 15 | passive_serial, /* serial data and external clock */ |
| 16 | passive_parallel_synchronous, /* parallel data */ |
| 17 | passive_parallel_asynchronous, /* parallel data */ |
| 18 | passive_serial_asynchronous, /* serial data w/ internal clock (not used) */ |
| 19 | altera_jtag_mode, /* jtag/tap serial (not used ) */ |
Michael Jones | f9a78b8 | 2011-07-14 22:09:28 +0000 | [diff] [blame] | 20 | fast_passive_parallel, /* fast passive parallel (FPP) */ |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame] | 21 | fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */ |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 22 | max_altera_iface_type /* insert all new types before this */ |
| 23 | } Altera_iface; /* end, typedef Altera_iface */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 24 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 25 | typedef enum { /* typedef Altera_Family */ |
Michael Jones | f9a78b8 | 2011-07-14 22:09:28 +0000 | [diff] [blame] | 26 | min_altera_type, /* insert all new types after this */ |
| 27 | Altera_ACEX1K, /* ACEX1K Family */ |
| 28 | Altera_CYC2, /* CYCLONII Family */ |
Pavel Machek | 3f9eb6e | 2014-07-19 23:50:44 +0200 | [diff] [blame] | 29 | Altera_StratixII, /* StratixII Family */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 30 | /* Add new models here */ |
Michael Jones | f9a78b8 | 2011-07-14 22:09:28 +0000 | [diff] [blame] | 31 | max_altera_type /* insert all new types before this */ |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 32 | } Altera_Family; /* end, typedef Altera_Family */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 33 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 34 | typedef struct { /* typedef Altera_desc */ |
| 35 | Altera_Family family; /* part type */ |
| 36 | Altera_iface iface; /* interface type */ |
| 37 | size_t size; /* bytes of data part can accept */ |
| 38 | void * iface_fns;/* interface function table */ |
| 39 | void * base; /* base interface address */ |
| 40 | int cookie; /* implementation specific cookie */ |
| 41 | } Altera_desc; /* end, typedef Altera_desc */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 42 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 43 | /* Generic Altera Functions |
| 44 | *********************************************************************/ |
Wolfgang Denk | e6a857d | 2011-07-30 13:33:49 +0000 | [diff] [blame] | 45 | extern int altera_load(Altera_desc *desc, const void *image, size_t size); |
| 46 | extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize); |
| 47 | extern int altera_info(Altera_desc *desc); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 48 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 49 | /* Board specific implementation specific function types |
| 50 | *********************************************************************/ |
| 51 | typedef int (*Altera_pre_fn)( int cookie ); |
| 52 | typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie ); |
| 53 | typedef int (*Altera_status_fn)( int cookie ); |
| 54 | typedef int (*Altera_done_fn)( int cookie ); |
| 55 | typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie ); |
| 56 | typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie ); |
Wolfgang Denk | e6a857d | 2011-07-30 13:33:49 +0000 | [diff] [blame] | 57 | typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie); |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 58 | typedef int (*Altera_abort_fn)( int cookie ); |
| 59 | typedef int (*Altera_post_fn)( int cookie ); |
| 60 | |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame] | 61 | typedef struct { |
| 62 | Altera_pre_fn pre; |
| 63 | Altera_config_fn config; |
| 64 | Altera_status_fn status; |
| 65 | Altera_done_fn done; |
| 66 | Altera_clk_fn clk; |
| 67 | Altera_data_fn data; |
| 68 | Altera_abort_fn abort; |
| 69 | Altera_post_fn post; |
| 70 | } altera_board_specific_func; |
| 71 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 72 | #endif /* _ALTERA_H_ */ |