blob: 7b8cb4a55d6b478fbe53d1bb45a042c10bad0b3d [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
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
30/*
wdenk9b7f3842003-10-09 20:09:04 +000031 * See include/xilinx.h for another working example.
wdenkc6097192002-11-03 00:24:07 +000032 */
33
wdenk9b7f3842003-10-09 20:09:04 +000034/* Altera Model definitions
35 *********************************************************************/
36#define CFG_ACEX1K CFG_FPGA_DEV( 0x1 )
Stefan Roese5f1cf2d2006-08-15 14:15:51 +020037#define CFG_CYCLON2 CFG_FPGA_DEV( 0x2 )
wdenkc6097192002-11-03 00:24:07 +000038
wdenk9b7f3842003-10-09 20:09:04 +000039#define CFG_ALTERA_ACEX1K (CFG_FPGA_ALTERA | CFG_ACEX1K)
Stefan Roese5f1cf2d2006-08-15 14:15:51 +020040#define CFG_ALTERA_CYCLON2 (CFG_FPGA_ALTERA | CFG_CYCLON2)
wdenkc6097192002-11-03 00:24:07 +000041/* Add new models here */
42
wdenk9b7f3842003-10-09 20:09:04 +000043/* Altera Interface definitions
44 *********************************************************************/
45#define CFG_ALTERA_IF_PS CFG_FPGA_IF( 0x1 ) /* passive serial */
wdenkc6097192002-11-03 00:24:07 +000046/* Add new interfaces here */
47
wdenk9b7f3842003-10-09 20:09:04 +000048typedef enum { /* typedef Altera_iface */
49 min_altera_iface_type, /* insert all new types after this */
50 passive_serial, /* serial data and external clock */
51 passive_parallel_synchronous, /* parallel data */
52 passive_parallel_asynchronous, /* parallel data */
53 passive_serial_asynchronous, /* serial data w/ internal clock (not used) */
54 altera_jtag_mode, /* jtag/tap serial (not used ) */
55 max_altera_iface_type /* insert all new types before this */
56} Altera_iface; /* end, typedef Altera_iface */
wdenkc6097192002-11-03 00:24:07 +000057
wdenk9b7f3842003-10-09 20:09:04 +000058typedef enum { /* typedef Altera_Family */
59 min_altera_type, /* insert all new types after this */
60 Altera_ACEX1K, /* ACEX1K Family */
Stefan Roese5f1cf2d2006-08-15 14:15:51 +020061 Altera_CYC2, /* CYCLONII Family */
wdenkc6097192002-11-03 00:24:07 +000062/* Add new models here */
wdenk9b7f3842003-10-09 20:09:04 +000063 max_altera_type /* insert all new types before this */
64} Altera_Family; /* end, typedef Altera_Family */
wdenkc6097192002-11-03 00:24:07 +000065
wdenk9b7f3842003-10-09 20:09:04 +000066typedef struct { /* typedef Altera_desc */
67 Altera_Family family; /* part type */
68 Altera_iface iface; /* interface type */
69 size_t size; /* bytes of data part can accept */
70 void * iface_fns;/* interface function table */
71 void * base; /* base interface address */
72 int cookie; /* implementation specific cookie */
73} Altera_desc; /* end, typedef Altera_desc */
wdenkc6097192002-11-03 00:24:07 +000074
wdenk9b7f3842003-10-09 20:09:04 +000075/* Generic Altera Functions
76 *********************************************************************/
wdenkc6097192002-11-03 00:24:07 +000077extern int altera_load( Altera_desc *desc, void *image, size_t size );
78extern int altera_dump( Altera_desc *desc, void *buf, size_t bsize );
79extern int altera_info( Altera_desc *desc );
wdenk9b7f3842003-10-09 20:09:04 +000080extern int altera_reloc( Altera_desc *desc, ulong reloc_offset );
81
82/* Board specific implementation specific function types
83 *********************************************************************/
84typedef int (*Altera_pre_fn)( int cookie );
85typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
86typedef int (*Altera_status_fn)( int cookie );
87typedef int (*Altera_done_fn)( int cookie );
88typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
89typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
Stefan Roese5f1cf2d2006-08-15 14:15:51 +020090typedef int (*Altera_write_fn)(void *buf, size_t len, int flush, int cookie);
wdenk9b7f3842003-10-09 20:09:04 +000091typedef int (*Altera_abort_fn)( int cookie );
92typedef int (*Altera_post_fn)( int cookie );
wdenkc6097192002-11-03 00:24:07 +000093
wdenk9b7f3842003-10-09 20:09:04 +000094#endif /* _ALTERA_H_ */