1 /******************************************************************************
\r
3 * Copyright 2013 Altera Corporation. All Rights Reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions are met:
\r
8 * 1. Redistributions of source code must retain the above copyright notice,
\r
9 * this list of conditions and the following disclaimer.
\r
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
12 * this list of conditions and the following disclaimer in the documentation
\r
13 * and/or other materials provided with the distribution.
\r
15 * 3. The name of the author may not be used to endorse or promote products
\r
16 * derived from this software without specific prior written permission.
\r
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
\r
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
\r
21 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
\r
23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\r
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
\r
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
\r
29 ******************************************************************************/
\r
38 #else /* __cplusplus */
\r
40 #include <stdbool.h>
\r
42 #endif /* __cplusplus */
\r
44 #include "alt_hwlibs_ver.h"
\r
49 #endif /* __cplusplus */
\r
52 * The type definition for status codes returned by the HWLIB.
\r
54 typedef int32_t ALT_STATUS_CODE;
\r
56 /*! Definitions of status codes returned by the HWLIB. */
\r
58 /*! The operation was successful. */
\r
59 #define ALT_E_SUCCESS 0
\r
61 /*! The operation failed. */
\r
62 #define ALT_E_ERROR (-1)
\r
63 /*! FPGA configuration error detected.*/
\r
64 #define ALT_E_FPGA_CFG (-2)
\r
65 /*! FPGA CRC error detected. */
\r
66 #define ALT_E_FPGA_CRC (-3)
\r
67 /*! An error occurred on the FPGA configuration bitstream input source. */
\r
68 #define ALT_E_FPGA_CFG_STM (-4)
\r
69 /*! The FPGA is powered off. */
\r
70 #define ALT_E_FPGA_PWR_OFF (-5)
\r
71 /*! The SoC does not currently control the FPGA. */
\r
72 #define ALT_E_FPGA_NO_SOC_CTRL (-6)
\r
73 /*! The FPGA is not in USER mode. */
\r
74 #define ALT_E_FPGA_NOT_USER_MODE (-7)
\r
75 /*! An argument violates a range constraint. */
\r
76 #define ALT_E_ARG_RANGE (-8)
\r
77 /*! A bad argument value was passed. */
\r
78 #define ALT_E_BAD_ARG (-9)
\r
79 /*! The operation is invalid or illegal. */
\r
80 #define ALT_E_BAD_OPERATION (-10)
\r
81 /*! An invalid option was selected. */
\r
82 #define ALT_E_INV_OPTION (-11)
\r
83 /*! An operation or response timeout period expired. */
\r
84 #define ALT_E_TMO (-12)
\r
85 /*! The argument value is reserved or unavailable. */
\r
86 #define ALT_E_RESERVED (-13)
\r
87 /*! A clock is not enabled or violates an operational constraint. */
\r
88 #define ALT_E_BAD_CLK (-14)
\r
89 /*! The version ID is invalid. */
\r
90 #define ALT_E_BAD_VERSION (-15)
\r
91 /*! The buffer does not contain enough free space for the operation. */
\r
92 #define ALT_E_BUF_OVF (-20)
\r
95 * Indicates a FALSE condition.
\r
97 #define ALT_E_FALSE (0)
\r
99 * Indicates a TRUE condition.
\r
101 #define ALT_E_TRUE (1)
\r
103 /* Note, additional positive status codes may be defined to return
\r
104 * a TRUE condition with additional information */
\r
107 /* Some other useful definitions */
\r
110 * Specifies the current major and minor revision of the HWLibs. The
\r
111 * MS four decimal digits specify the Altera ACDS release number, the
\r
112 * LS two decimal digits specify minor revisions of the HWLibs, if any.
\r
114 * A typical use is:
\r
116 * #if ALTERA_HWLIBS_VERSION_CODE >= ALT_HWLIBS_VERSION(13, 1, 0)
\r
118 * for a dependency on the major or minor ACDS revision
\r
121 * #if ALTERA_HWLIBS_VERSION_CODE == ALT_HWLIBS_VERSION(13, 0, 12)
\r
123 * for a dependency on the hwlibs revision
\r
126 #define ALT_HWLIBS_VERSION(a,b,c) (((a)*10000)+((b)*100)+(c))
\r
128 #define ALTERA_HWLIBS_VERSION_CODE ALT_HWLIBS_VERSION(ALTERA_ACDS_MAJOR_REV, \
\r
129 ALTERA_ACDS_MINOR_REV, ALTERA_HWLIBS_REV)
\r
132 * Allow some parts of the documentation to be hidden by setting to zero
\r
134 #define ALTERA_INTERNAL_ONLY_DOCS 1
\r
138 * Provide base address of MPU address space
\r
141 #ifndef ALT_HPS_ADDR
\r
142 #define ALT_HPS_ADDR 0
\r
146 * These constants are sometimes useful:
\r
148 #define ALT_MILLISECS_IN_A_SEC 1000
\r
149 #define ALT_MICROSECS_IN_A_SEC 1000000
\r
150 #define ALT_NANOSECS_IN_A_SEC 1000000000
\r
152 #define ALT_TWO_TO_POW0 (1)
\r
153 #define ALT_TWO_TO_POW1 (1<<1)
\r
154 #define ALT_TWO_TO_POW2 (1<<2)
\r
155 #define ALT_TWO_TO_POW3 (1<<3)
\r
156 #define ALT_TWO_TO_POW4 (1<<4)
\r
157 #define ALT_TWO_TO_POW5 (1<<5)
\r
158 #define ALT_TWO_TO_POW6 (1<<6)
\r
159 #define ALT_TWO_TO_POW7 (1<<7)
\r
160 #define ALT_TWO_TO_POW8 (1<<8)
\r
161 #define ALT_TWO_TO_POW9 (1<<9)
\r
162 #define ALT_TWO_TO_POW10 (1<<10)
\r
163 #define ALT_TWO_TO_POW11 (1<<11)
\r
164 #define ALT_TWO_TO_POW12 (1<<12)
\r
165 #define ALT_TWO_TO_POW13 (1<<13)
\r
166 #define ALT_TWO_TO_POW14 (1<<14)
\r
167 #define ALT_TWO_TO_POW15 (1<<15)
\r
168 #define ALT_TWO_TO_POW16 (1<<16)
\r
169 #define ALT_TWO_TO_POW17 (1<<17)
\r
170 #define ALT_TWO_TO_POW18 (1<<18)
\r
171 #define ALT_TWO_TO_POW19 (1<<19)
\r
172 #define ALT_TWO_TO_POW20 (1<<20)
\r
173 #define ALT_TWO_TO_POW21 (1<<21)
\r
174 #define ALT_TWO_TO_POW22 (1<<22)
\r
175 #define ALT_TWO_TO_POW23 (1<<23)
\r
176 #define ALT_TWO_TO_POW24 (1<<24)
\r
177 #define ALT_TWO_TO_POW25 (1<<25)
\r
178 #define ALT_TWO_TO_POW26 (1<<26)
\r
179 #define ALT_TWO_TO_POW27 (1<<27)
\r
180 #define ALT_TWO_TO_POW28 (1<<28)
\r
181 #define ALT_TWO_TO_POW29 (1<<29)
\r
182 #define ALT_TWO_TO_POW30 (1<<30)
\r
183 #define ALT_TWO_TO_POW31 (1<<31)
\r
187 #endif /* __cplusplus */
\r
188 #endif /* __HWLIB_H__ */
\r