OpenCores
URL https://opencores.org/ocsvn/gecko3/gecko3/trunk

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-fw/] [firmware/] [include/] [fpga_load.h] - Blame information for rev 28

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 nussgipfel
/* GECKO3COM
2
 *
3
 * Copyright (C) 2008 by
4
 *   ___    ____  _   _
5
 *  (  _`\ (  __)( ) ( )
6
 *  | (_) )| (_  | |_| |   Bern University of Applied Sciences
7
 *  |  _ <'|  _) |  _  |   School of Engineering and
8
 *  | (_) )| |   | | | |   Information Technology
9
 *  (____/'(_)   (_) (_)
10
 *
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation, either version 3 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 */
24
 
25
/*********************************************************************/
26
/** \file     fpga_load.h
27
 *********************************************************************
28
 * \brief     functions to configure an FPGA
29
 *
30
 *            use a define to select the handled FPGA \n
31
 *            currently following vendors are suported:
32
 *            \li XILINX
33
 *            \li ALTERA, as stub. needs work
34
 *
35
 * \author    GNUradio team, Christoph Zimmermann bfh.ch
36
 * \date      2009-1-19
37
 *
38
*/
39
 
40
#ifndef INCLUDED_FPGA_LOAD_H
41
#define INCLUDED_FPGA_LOAD_H
42
 
43
/** \brief initialize the ports and pins used for fpga configuration */
44
void init_fpga_interface(void);
45
 
46
/** \brief prepares the fpga to accept configuration data */
47
uint8_t fpga_load_begin(void);
48
 
49
/** \brief transfer configuration data to the fpga
50
 *
51
 * \param[in] *p pointer to the buffer to read from.
52
 *            normally this is a endpoint buffer.
53
 * \param[in] *offset pointer to the offset, buffer[offset] is
54
 *            the current position, anything before this is already consumed.
55
 * \param[in] *bytecount pointer to the length of the whole
56
 *            buffer.
57
 * \return    returns non-zero if successful, else 0
58
 */
59
uint8_t fpga_load_xfer(xdata unsigned char *p, idata uint16_t *offset,\
60
                        idata uint16_t *bytecount);
61
 
62
/** \brief finalize the fpga configuration process */
63
uint8_t fpga_load_end(void);
64
 
65
/* ------------------------------------------------------------------------- */
66
/* Xilinx stuff. We use slave parallel mode to configure the FPGA
67
 */
68
#ifdef XILINX
69
 
70
#define FPGA_INFO_LEN 19
71
#define FPGA_INFO_COMPLETE 1
72
#define FPGA_INFO_NOT_COMPLETE -1
73
 
74
typedef enum  {
75
  FILENAME = 'a',
76
  FPGA_TYPE = 'b',
77
  COMPILE_DATE = 'c',
78
  COMPILE_TIME = 'd',
79
  FILE_LENGTH = 'e',
80
} Fpga_Info_Type;
81
 
82
typedef struct {
83
  uint16_t position;  /**< current position inside the input buffer */
84
  Fpga_Info_Type type; /**< type of desired information, like filename, fpga type etc. */
85
  char info[FPGA_INFO_LEN]; /**< char array that contains the desired information */
86
} Fpga_Info; /**< struct used to hold neccesary information to parse the bit file header */
87
 
88
 
89
/** \brief function to scan the bit file header
90
 *
91
 * this function scans the provided buffer for the desired information type
92
 * (selected in the Fpga_Info struct) and copies the data to the output array.
93
 * When no data or not the complete data is found, the function returns a
94
 * "FPGA_INFO_NOT_COMPLETE", when exectued the next time, it will continue
95
 * searching or copying the information. \n
96
 * This makes it possible to detect information split over serveral usb packets.
97
 *
98
 * \param[in] *p pointer to the buffer to read from.
99
 *            normally this is a endpoint buffer.
100
 * \param[in] *offset pointer to the offset, buffer[offset] is
101
 *            the current position, anything before this is already consumed.
102
 * \param[in] *length pointer to the length of the whole buffer.
103
 * \param[in] *info pointer to a Fpga_Info struct which
104
 *            contains the desired information and the pointe to the output
105
 *            buffer.
106
 * \return FPGA_INFO_NOT_COMPLETE or FPGA_INFO_COMPLETE
107
 */
108
int8_t fpga_scan_file(const xdata unsigned char *p,  idata uint16_t *offset, \
109
                      idata uint16_t *length, xdata Fpga_Info* info);
110
 
111
 
112
#define fpga_done()   ((XILINX_DONE & bmXILINX_DONE) == bmXILINX_DONE) /**< check if DONE is set */
113
#endif
114
 
115
 
116
/* ------------------------------------------------------------------------- */
117
/* Altera stuff. only copied from USRP source code. does not work. only a
118
 * guide to give you a start to port GECKO3COM to other boards using Altera
119
 * devices
120
 */
121
#ifdef ALTERA
122
#define fpga_done()   ((status & bmALTERA_CONF_DONE) == bmALTERA_CONF_DONE)  /**< check if DONE is set */
123
#endif
124
 
125
#endif /* INCLUDED_FPGA_LOAD_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.