blob: e266a6449c52103d79d657923594a307f1bb068c [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2002
3 * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenkc6097192002-11-03 00:24:07 +00006 */
7
8#include <fpga.h>
9
10#ifndef _ALTERA_H_
11#define _ALTERA_H_
12
Marek Vasutd44ef7f2014-09-16 20:48:33 +020013enum altera_iface {
14 /* insert all new types after this */
15 min_altera_iface_type,
16 /* serial data and external clock */
17 passive_serial,
18 /* parallel data */
19 passive_parallel_synchronous,
20 /* parallel data */
21 passive_parallel_asynchronous,
22 /* serial data w/ internal clock (not used) */
23 passive_serial_asynchronous,
24 /* jtag/tap serial (not used ) */
25 altera_jtag_mode,
26 /* fast passive parallel (FPP) */
27 fast_passive_parallel,
28 /* fast passive parallel with security (FPPS) */
29 fast_passive_parallel_security,
30 /* insert all new types before this */
31 max_altera_iface_type,
32};
wdenkc6097192002-11-03 00:24:07 +000033
Marek Vasutd44ef7f2014-09-16 20:48:33 +020034enum altera_family {
35 /* insert all new types after this */
36 min_altera_type,
37 /* ACEX1K Family */
38 Altera_ACEX1K,
39 /* CYCLONII Family */
40 Altera_CYC2,
41 /* StratixII Family */
42 Altera_StratixII,
wdenkc6097192002-11-03 00:24:07 +000043
Marek Vasutd44ef7f2014-09-16 20:48:33 +020044 /* Add new models here */
45
46 /* insert all new types before this */
47 max_altera_type,
48};
49
50typedef struct {
51 /* part type */
52 enum altera_family family;
53 /* interface type */
54 enum altera_iface iface;
55 /* bytes of data part can accept */
56 size_t size;
57 /* interface function table */
58 void *iface_fns;
59 /* base interface address */
60 void *base;
61 /* implementation specific cookie */
62 int cookie;
63} Altera_desc;
wdenkc6097192002-11-03 00:24:07 +000064
wdenk5da627a2003-10-09 20:09:04 +000065/* Generic Altera Functions
66 *********************************************************************/
Wolfgang Denke6a857d2011-07-30 13:33:49 +000067extern int altera_load(Altera_desc *desc, const void *image, size_t size);
68extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
69extern int altera_info(Altera_desc *desc);
wdenkc6097192002-11-03 00:24:07 +000070
wdenk5da627a2003-10-09 20:09:04 +000071/* Board specific implementation specific function types
72 *********************************************************************/
73typedef int (*Altera_pre_fn)( int cookie );
74typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
75typedef int (*Altera_status_fn)( int cookie );
76typedef int (*Altera_done_fn)( int cookie );
77typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
78typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
Wolfgang Denke6a857d2011-07-30 13:33:49 +000079typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
wdenk5da627a2003-10-09 20:09:04 +000080typedef int (*Altera_abort_fn)( int cookie );
81typedef int (*Altera_post_fn)( int cookie );
82
eran liberty3c735e72008-03-27 00:50:49 +010083typedef struct {
84 Altera_pre_fn pre;
85 Altera_config_fn config;
86 Altera_status_fn status;
87 Altera_done_fn done;
88 Altera_clk_fn clk;
89 Altera_data_fn data;
90 Altera_abort_fn abort;
91 Altera_post_fn post;
92} altera_board_specific_func;
93
wdenk5da627a2003-10-09 20:09:04 +000094#endif /* _ALTERA_H_ */