1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#include <fpga.h>
26
27#ifndef _ALTERA_H_
28#define _ALTERA_H_
29
30
31
32#define CONFIG_SYS_ACEX1K CONFIG_SYS_FPGA_DEV( 0x1 )
33#define CONFIG_SYS_CYCLON2 CONFIG_SYS_FPGA_DEV( 0x2 )
34#define CONFIG_SYS_STRATIX_II CONFIG_SYS_FPGA_DEV( 0x4 )
35
36#define CONFIG_SYS_ALTERA_ACEX1K (CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_ACEX1K)
37#define CONFIG_SYS_ALTERA_CYCLON2 (CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_CYCLON2)
38#define CONFIG_SYS_ALTERA_STRATIX_II (CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_STRATIX_II)
39
40
41
42
43#define CONFIG_SYS_ALTERA_IF_PS CONFIG_SYS_FPGA_IF( 0x1 )
44#define CONFIG_SYS_ALTERA_IF_FPP CONFIG_SYS_FPGA_IF( 0x2 )
45
46
47typedef enum {
48 min_altera_iface_type,
49 passive_serial,
50 passive_parallel_synchronous,
51 passive_parallel_asynchronous,
52 passive_serial_asynchronous,
53 altera_jtag_mode,
54 fast_passive_parallel,
55 fast_passive_parallel_security,
56 max_altera_iface_type
57} Altera_iface;
58
59typedef enum {
60 min_altera_type,
61 Altera_ACEX1K,
62 Altera_CYC2,
63 Altera_StratixII,
64
65 max_altera_type
66} Altera_Family;
67
68typedef struct {
69 Altera_Family family;
70 Altera_iface iface;
71 size_t size;
72 void * iface_fns;
73 void * base;
74 int cookie;
75} Altera_desc;
76
77
78
79extern int altera_load(Altera_desc *desc, const void *image, size_t size);
80extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
81extern int altera_info(Altera_desc *desc);
82
83
84
85typedef int (*Altera_pre_fn)( int cookie );
86typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
87typedef int (*Altera_status_fn)( int cookie );
88typedef int (*Altera_done_fn)( int cookie );
89typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
90typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
91typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
92typedef int (*Altera_abort_fn)( int cookie );
93typedef int (*Altera_post_fn)( int cookie );
94
95typedef struct {
96 Altera_pre_fn pre;
97 Altera_config_fn config;
98 Altera_status_fn status;
99 Altera_done_fn done;
100 Altera_clk_fn clk;
101 Altera_data_fn data;
102 Altera_abort_fn abort;
103 Altera_post_fn post;
104} altera_board_specific_func;
105
106#endif
107