altera.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * (C) Copyright 2002
  3. * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. *
  23. */
  24. #include <fpga.h>
  25. #ifndef _ALTERA_H_
  26. #define _ALTERA_H_
  27. typedef enum { /* typedef Altera_iface */
  28. min_altera_iface_type, /* insert all new types after this */
  29. passive_serial, /* serial data and external clock */
  30. passive_parallel_synchronous, /* parallel data */
  31. passive_parallel_asynchronous, /* parallel data */
  32. passive_serial_asynchronous, /* serial data w/ internal clock (not used) */
  33. altera_jtag_mode, /* jtag/tap serial (not used ) */
  34. fast_passive_parallel, /* fast passive parallel (FPP) */
  35. fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */
  36. max_altera_iface_type /* insert all new types before this */
  37. } Altera_iface; /* end, typedef Altera_iface */
  38. typedef enum { /* typedef Altera_Family */
  39. min_altera_type, /* insert all new types after this */
  40. Altera_ACEX1K, /* ACEX1K Family */
  41. Altera_CYC2, /* CYCLONII Family */
  42. Altera_StratixII, /* StratixII Familiy */
  43. /* Add new models here */
  44. max_altera_type /* insert all new types before this */
  45. } Altera_Family; /* end, typedef Altera_Family */
  46. typedef struct { /* typedef Altera_desc */
  47. Altera_Family family; /* part type */
  48. Altera_iface iface; /* interface type */
  49. size_t size; /* bytes of data part can accept */
  50. void * iface_fns;/* interface function table */
  51. void * base; /* base interface address */
  52. int cookie; /* implementation specific cookie */
  53. } Altera_desc; /* end, typedef Altera_desc */
  54. /* Generic Altera Functions
  55. *********************************************************************/
  56. extern int altera_load(Altera_desc *desc, const void *image, size_t size);
  57. extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
  58. extern int altera_info(Altera_desc *desc);
  59. /* Board specific implementation specific function types
  60. *********************************************************************/
  61. typedef int (*Altera_pre_fn)( int cookie );
  62. typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
  63. typedef int (*Altera_status_fn)( int cookie );
  64. typedef int (*Altera_done_fn)( int cookie );
  65. typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
  66. typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
  67. typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
  68. typedef int (*Altera_abort_fn)( int cookie );
  69. typedef int (*Altera_post_fn)( int cookie );
  70. typedef struct {
  71. Altera_pre_fn pre;
  72. Altera_config_fn config;
  73. Altera_status_fn status;
  74. Altera_done_fn done;
  75. Altera_clk_fn clk;
  76. Altera_data_fn data;
  77. Altera_abort_fn abort;
  78. Altera_post_fn post;
  79. } altera_board_specific_func;
  80. #endif /* _ALTERA_H_ */