altera.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. /* Altera Model definitions
  28. *********************************************************************/
  29. #define CFG_ACEX1K CFG_FPGA_DEV( 0x1 )
  30. #define CFG_CYCLON2 CFG_FPGA_DEV( 0x2 )
  31. #define CFG_STRATIX_II CFG_FPGA_DEV( 0x4 )
  32. #define CFG_ALTERA_ACEX1K (CFG_FPGA_ALTERA | CFG_ACEX1K)
  33. #define CFG_ALTERA_CYCLON2 (CFG_FPGA_ALTERA | CFG_CYCLON2)
  34. #define CFG_ALTERA_STRATIX_II (CFG_FPGA_ALTERA | CFG_STRATIX_II)
  35. /* Add new models here */
  36. /* Altera Interface definitions
  37. *********************************************************************/
  38. #define CFG_ALTERA_IF_PS CFG_FPGA_IF( 0x1 ) /* passive serial */
  39. #define CFG_ALTERA_IF_FPP CFG_FPGA_IF( 0x2 ) /* fast passive parallel */
  40. /* Add new interfaces here */
  41. typedef enum { /* typedef Altera_iface */
  42. min_altera_iface_type, /* insert all new types after this */
  43. passive_serial, /* serial data and external clock */
  44. passive_parallel_synchronous, /* parallel data */
  45. passive_parallel_asynchronous, /* parallel data */
  46. passive_serial_asynchronous, /* serial data w/ internal clock (not used) */
  47. altera_jtag_mode, /* jtag/tap serial (not used ) */
  48. fast_passive_parallel, /* fast passive parallel (FPP) */
  49. fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */
  50. max_altera_iface_type /* insert all new types before this */
  51. } Altera_iface; /* end, typedef Altera_iface */
  52. typedef enum { /* typedef Altera_Family */
  53. min_altera_type, /* insert all new types after this */
  54. Altera_ACEX1K, /* ACEX1K Family */
  55. Altera_CYC2, /* CYCLONII Family */
  56. Altera_StratixII, /* StratixII Familiy */
  57. /* Add new models here */
  58. max_altera_type /* insert all new types before this */
  59. } Altera_Family; /* end, typedef Altera_Family */
  60. typedef struct { /* typedef Altera_desc */
  61. Altera_Family family; /* part type */
  62. Altera_iface iface; /* interface type */
  63. size_t size; /* bytes of data part can accept */
  64. void * iface_fns;/* interface function table */
  65. void * base; /* base interface address */
  66. int cookie; /* implementation specific cookie */
  67. } Altera_desc; /* end, typedef Altera_desc */
  68. /* Generic Altera Functions
  69. *********************************************************************/
  70. extern int altera_load( Altera_desc *desc, void *image, size_t size );
  71. extern int altera_dump( Altera_desc *desc, void *buf, size_t bsize );
  72. extern int altera_info( Altera_desc *desc );
  73. extern int altera_reloc( Altera_desc *desc, ulong reloc_offset );
  74. /* Board specific implementation specific function types
  75. *********************************************************************/
  76. typedef int (*Altera_pre_fn)( int cookie );
  77. typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
  78. typedef int (*Altera_status_fn)( int cookie );
  79. typedef int (*Altera_done_fn)( int cookie );
  80. typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
  81. typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
  82. typedef int (*Altera_write_fn)(void *buf, size_t len, int flush, int cookie);
  83. typedef int (*Altera_abort_fn)( int cookie );
  84. typedef int (*Altera_post_fn)( int cookie );
  85. typedef struct {
  86. Altera_pre_fn pre;
  87. Altera_config_fn config;
  88. Altera_status_fn status;
  89. Altera_done_fn done;
  90. Altera_clk_fn clk;
  91. Altera_data_fn data;
  92. Altera_abort_fn abort;
  93. Altera_post_fn post;
  94. } altera_board_specific_func;
  95. #endif /* _ALTERA_H_ */