fpga.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * (C) Copyright 2002
  3. * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <linux/types.h> /* for ulong typedef */
  8. #ifndef _FPGA_H_
  9. #define _FPGA_H_
  10. #ifndef CONFIG_MAX_FPGA_DEVICES
  11. #define CONFIG_MAX_FPGA_DEVICES 5
  12. #endif
  13. /* fpga_xxxx function return value definitions */
  14. #define FPGA_SUCCESS 0
  15. #define FPGA_FAIL -1
  16. /* device numbers must be non-negative */
  17. #define FPGA_INVALID_DEVICE -1
  18. /* root data type defintions */
  19. typedef enum { /* typedef fpga_type */
  20. fpga_min_type, /* range check value */
  21. fpga_xilinx, /* Xilinx Family) */
  22. fpga_altera, /* unimplemented */
  23. fpga_lattice, /* Lattice family */
  24. fpga_undefined /* invalid range check value */
  25. } fpga_type; /* end, typedef fpga_type */
  26. typedef struct { /* typedef fpga_desc */
  27. fpga_type devtype; /* switch value to select sub-functions */
  28. void *devdesc; /* real device descriptor */
  29. } fpga_desc; /* end, typedef fpga_desc */
  30. /* root function definitions */
  31. extern void fpga_init(void);
  32. extern int fpga_add(fpga_type devtype, void *desc);
  33. extern int fpga_count(void);
  34. extern int fpga_load(int devnum, const void *buf, size_t bsize);
  35. extern int fpga_loadbitstream(int devnum, char *fpgadata, size_t size);
  36. extern int fpga_dump(int devnum, const void *buf, size_t bsize);
  37. extern int fpga_info(int devnum);
  38. extern const fpga_desc *const fpga_validate(int devnum, const void *buf,
  39. size_t bsize, char *fn);
  40. #endif /* _FPGA_H_ */