123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #include <fpga.h>
- #ifndef _ALTERA_H_
- #define _ALTERA_H_
- #define FPGA_COOKIE(bus, dev, config, done) \
- (((bus) << 24) | ((dev) << 16) | ((config) << 8) | (done))
- #define COOKIE2SPI_BUS(c) (((c) >> 24) & 0xff)
- #define COOKIE2SPI_DEV(c) (((c) >> 16) & 0xff)
- #define COOKIE2CONFIG(c) (((c) >> 8) & 0xff)
- #define COOKIE2DONE(c) ((c) & 0xff)
- enum altera_iface {
-
- min_altera_iface_type,
-
- passive_serial,
-
- passive_parallel_synchronous,
-
- passive_parallel_asynchronous,
-
- passive_serial_asynchronous,
-
- altera_jtag_mode,
-
- fast_passive_parallel,
-
- fast_passive_parallel_security,
-
- max_altera_iface_type,
- };
- enum altera_family {
-
- min_altera_type,
-
- Altera_ACEX1K,
-
- Altera_CYC2,
-
- Altera_StratixII,
-
- Altera_StratixV,
-
- Altera_SoCFPGA,
-
-
- max_altera_type,
- };
- typedef struct {
-
- enum altera_family family;
-
- enum altera_iface iface;
-
- size_t size;
-
- void *iface_fns;
-
- void *base;
-
- int cookie;
- } Altera_desc;
- extern int altera_load(Altera_desc *desc, const void *image, size_t size);
- extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
- extern int altera_info(Altera_desc *desc);
- typedef int (*Altera_pre_fn)( int cookie );
- typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
- typedef int (*Altera_status_fn)( int cookie );
- typedef int (*Altera_done_fn)( int cookie );
- typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
- typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
- typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
- typedef int (*Altera_abort_fn)( int cookie );
- typedef int (*Altera_post_fn)( int cookie );
- typedef struct {
- Altera_pre_fn pre;
- Altera_config_fn config;
- Altera_status_fn status;
- Altera_done_fn done;
- Altera_clk_fn clk;
- Altera_data_fn data;
- Altera_write_fn write;
- Altera_abort_fn abort;
- Altera_post_fn post;
- } altera_board_specific_func;
- #ifdef CONFIG_FPGA_SOCFPGA
- int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size);
- #endif
- #ifdef CONFIG_FPGA_STRATIX_V
- int stratixv_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size);
- #endif
- #endif
|