blob: ae5f7eec463db4f2c6269413ae303760065b7899 [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
wdenk5da627a2003-10-09 20:09:04 +000013typedef 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 Jonesf9a78b82011-07-14 22:09:28 +000020 fast_passive_parallel, /* fast passive parallel (FPP) */
eran liberty3c735e72008-03-27 00:50:49 +010021 fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */
wdenk5da627a2003-10-09 20:09:04 +000022 max_altera_iface_type /* insert all new types before this */
23} Altera_iface; /* end, typedef Altera_iface */
wdenkc6097192002-11-03 00:24:07 +000024
wdenk5da627a2003-10-09 20:09:04 +000025typedef enum { /* typedef Altera_Family */
Michael Jonesf9a78b82011-07-14 22:09:28 +000026 min_altera_type, /* insert all new types after this */
27 Altera_ACEX1K, /* ACEX1K Family */
28 Altera_CYC2, /* CYCLONII Family */
Pavel Machek3f9eb6e2014-07-19 23:50:44 +020029 Altera_StratixII, /* StratixII Family */
wdenkc6097192002-11-03 00:24:07 +000030/* Add new models here */
Michael Jonesf9a78b82011-07-14 22:09:28 +000031 max_altera_type /* insert all new types before this */
wdenk5da627a2003-10-09 20:09:04 +000032} Altera_Family; /* end, typedef Altera_Family */
wdenkc6097192002-11-03 00:24:07 +000033
wdenk5da627a2003-10-09 20:09:04 +000034typedef 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 */
wdenkc6097192002-11-03 00:24:07 +000042
wdenk5da627a2003-10-09 20:09:04 +000043/* Generic Altera Functions
44 *********************************************************************/
Wolfgang Denke6a857d2011-07-30 13:33:49 +000045extern int altera_load(Altera_desc *desc, const void *image, size_t size);
46extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
47extern int altera_info(Altera_desc *desc);
wdenkc6097192002-11-03 00:24:07 +000048
wdenk5da627a2003-10-09 20:09:04 +000049/* Board specific implementation specific function types
50 *********************************************************************/
51typedef int (*Altera_pre_fn)( int cookie );
52typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
53typedef int (*Altera_status_fn)( int cookie );
54typedef int (*Altera_done_fn)( int cookie );
55typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
56typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
Wolfgang Denke6a857d2011-07-30 13:33:49 +000057typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
wdenk5da627a2003-10-09 20:09:04 +000058typedef int (*Altera_abort_fn)( int cookie );
59typedef int (*Altera_post_fn)( int cookie );
60
eran liberty3c735e72008-03-27 00:50:49 +010061typedef 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
wdenk5da627a2003-10-09 20:09:04 +000072#endif /* _ALTERA_H_ */