1
2
3
4
5
6
7
8#include <linux/types.h>
9
10#ifndef _FPGA_H_
11#define _FPGA_H_
12
13#ifndef CONFIG_MAX_FPGA_DEVICES
14#define CONFIG_MAX_FPGA_DEVICES 5
15#endif
16
17
18#define FPGA_SUCCESS 0
19#define FPGA_FAIL -1
20
21
22#define FPGA_INVALID_DEVICE -1
23
24
25typedef enum {
26 fpga_min_type,
27 fpga_xilinx,
28 fpga_altera,
29 fpga_lattice,
30 fpga_undefined
31} fpga_type;
32
33typedef struct {
34 fpga_type devtype;
35 void *devdesc;
36} fpga_desc;
37
38typedef struct {
39 unsigned int blocksize;
40 char *interface;
41 char *dev_part;
42 char *filename;
43 int fstype;
44} fpga_fs_info;
45
46typedef struct {
47 char *keyaddr_size;
48 char *ivaddr_size;
49 char sec_img_type;
50} fpga_secure_info;
51
52typedef enum {
53 BIT_FULL = 0,
54 BIT_PARTIAL,
55 BIT_NONE = 0xFF,
56} bitstream_type;
57
58
59void fpga_init(void);
60int fpga_add(fpga_type devtype, void *desc);
61int fpga_count(void);
62const fpga_desc *const fpga_get_desc(int devnum);
63int fpga_load(int devnum, const void *buf, size_t bsize,
64 bitstream_type bstype);
65int fpga_fsload(int devnum, const void *buf, size_t size,
66 fpga_fs_info *fpga_fsinfo);
67int fpga_loads(int devnum, const void *buf, size_t size,
68 fpga_secure_info *fpga_sec_info);
69int fpga_loadbitstream(int devnum, char *fpgadata, size_t size,
70 bitstream_type bstype);
71int fpga_dump(int devnum, const void *buf, size_t bsize);
72int fpga_info(int devnum);
73const fpga_desc *const fpga_validate(int devnum, const void *buf,
74 size_t bsize, char *fn);
75
76#endif
77