altera.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * (C) Copyright 2002
  3. * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <fpga.h>
  8. #ifndef _ALTERA_H_
  9. #define _ALTERA_H_
  10. typedef enum { /* typedef Altera_iface */
  11. min_altera_iface_type, /* insert all new types after this */
  12. passive_serial, /* serial data and external clock */
  13. passive_parallel_synchronous, /* parallel data */
  14. passive_parallel_asynchronous, /* parallel data */
  15. passive_serial_asynchronous, /* serial data w/ internal clock (not used) */
  16. altera_jtag_mode, /* jtag/tap serial (not used ) */
  17. fast_passive_parallel, /* fast passive parallel (FPP) */
  18. fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */
  19. max_altera_iface_type /* insert all new types before this */
  20. } Altera_iface; /* end, typedef Altera_iface */
  21. typedef enum { /* typedef Altera_Family */
  22. min_altera_type, /* insert all new types after this */
  23. Altera_ACEX1K, /* ACEX1K Family */
  24. Altera_CYC2, /* CYCLONII Family */
  25. Altera_StratixII, /* StratixII Familiy */
  26. /* Add new models here */
  27. max_altera_type /* insert all new types before this */
  28. } Altera_Family; /* end, typedef Altera_Family */
  29. typedef struct { /* typedef Altera_desc */
  30. Altera_Family family; /* part type */
  31. Altera_iface iface; /* interface type */
  32. size_t size; /* bytes of data part can accept */
  33. void * iface_fns;/* interface function table */
  34. void * base; /* base interface address */
  35. int cookie; /* implementation specific cookie */
  36. } Altera_desc; /* end, typedef Altera_desc */
  37. /* Generic Altera Functions
  38. *********************************************************************/
  39. extern int altera_load(Altera_desc *desc, const void *image, size_t size);
  40. extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
  41. extern int altera_info(Altera_desc *desc);
  42. /* Board specific implementation specific function types
  43. *********************************************************************/
  44. typedef int (*Altera_pre_fn)( int cookie );
  45. typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
  46. typedef int (*Altera_status_fn)( int cookie );
  47. typedef int (*Altera_done_fn)( int cookie );
  48. typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
  49. typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
  50. typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
  51. typedef int (*Altera_abort_fn)( int cookie );
  52. typedef int (*Altera_post_fn)( int cookie );
  53. typedef struct {
  54. Altera_pre_fn pre;
  55. Altera_config_fn config;
  56. Altera_status_fn status;
  57. Altera_done_fn done;
  58. Altera_clk_fn clk;
  59. Altera_data_fn data;
  60. Altera_abort_fn abort;
  61. Altera_post_fn post;
  62. } altera_board_specific_func;
  63. #endif /* _ALTERA_H_ */