Altera HWLIB  16.0
The Altera HW Manager API Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
hwlib.h
1 /******************************************************************************
2 *
3 * Copyright 2013 Altera Corporation. All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 ******************************************************************************/
32 
33 /*
34  * $Id: //depot/embedded/rel/15.0/ip/hps/altera_hps/hwlib/include/hwlib.h#2 $
35  */
36 
37 #ifndef __HWLIB_H__
38 #define __HWLIB_H__
39 
40 #ifdef __cplusplus
41 #include <cstddef>
42 #include <cstdbool>
43 #include <cstdint>
44 #else /* __cplusplus */
45 #include <stddef.h>
46 #include <stdbool.h>
47 #include <stdint.h>
48 #endif /* __cplusplus */
49 
50 #include "alt_hwlibs_ver.h"
51 
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif /* __cplusplus */
56 
57 #if !defined(soc_cv_av) && !defined(soc_a10)
58 #error You must define soc_cv_av or soc_a10 before compiling with HwLibs
59 #endif
60 
64 typedef int32_t ALT_STATUS_CODE;
65 
69 #define ALT_E_SUCCESS 0
70 
72 #define ALT_E_ERROR (-1)
73 
74 #define ALT_E_FPGA_CFG (-2)
75 
76 #define ALT_E_FPGA_CRC (-3)
77 
78 #define ALT_E_FPGA_CFG_STM (-4)
79 
80 #define ALT_E_FPGA_PWR_OFF (-5)
81 
82 #define ALT_E_FPGA_NO_SOC_CTRL (-6)
83 
84 #define ALT_E_FPGA_NOT_USER_MODE (-7)
85 
86 #define ALT_E_ARG_RANGE (-8)
87 
88 #define ALT_E_BAD_ARG (-9)
89 
90 #define ALT_E_BAD_OPERATION (-10)
91 
92 #define ALT_E_INV_OPTION (-11)
93 
94 #define ALT_E_TMO (-12)
95 
96 #define ALT_E_RESERVED (-13)
97 
98 #define ALT_E_BAD_CLK (-14)
99 
100 #define ALT_E_BAD_VERSION (-15)
101 
102 #define ALT_E_BUF_OVF (-20)
103 
107 #define ALT_E_FALSE (0)
108 
111 #define ALT_E_TRUE (1)
112 
113 /* Note, additional positive status codes may be defined to return
114  * a TRUE condition with additional information */
115 
116 
117 /* Some other useful definitions */
118 
136 #define ALT_HWLIBS_VERSION(a,b,c) (((a)*10000)+((b)*100)+(c))
137 
138 #define ALTERA_HWLIBS_VERSION_CODE ALT_HWLIBS_VERSION(ALTERA_ACDS_MAJOR_REV, \
139  ALTERA_ACDS_MINOR_REV, ALTERA_HWLIBS_REV)
140 
144 #define ALTERA_INTERNAL_ONLY_DOCS 1
145 
146 
151 #ifndef ALT_HPS_ADDR
152 #define ALT_HPS_ADDR 0
153 #endif
154 
158 #define ALT_MILLISECS_IN_A_SEC 1000
159 #define ALT_MICROSECS_IN_A_SEC 1000000
160 #define ALT_NANOSECS_IN_A_SEC 1000000000
161 
162 #define ALT_TWO_TO_POW0 (1)
163 #define ALT_TWO_TO_POW1 (1<<1)
164 #define ALT_TWO_TO_POW2 (1<<2)
165 #define ALT_TWO_TO_POW3 (1<<3)
166 #define ALT_TWO_TO_POW4 (1<<4)
167 #define ALT_TWO_TO_POW5 (1<<5)
168 #define ALT_TWO_TO_POW6 (1<<6)
169 #define ALT_TWO_TO_POW7 (1<<7)
170 #define ALT_TWO_TO_POW8 (1<<8)
171 #define ALT_TWO_TO_POW9 (1<<9)
172 #define ALT_TWO_TO_POW10 (1<<10)
173 #define ALT_TWO_TO_POW11 (1<<11)
174 #define ALT_TWO_TO_POW12 (1<<12)
175 #define ALT_TWO_TO_POW13 (1<<13)
176 #define ALT_TWO_TO_POW14 (1<<14)
177 #define ALT_TWO_TO_POW15 (1<<15)
178 #define ALT_TWO_TO_POW16 (1<<16)
179 #define ALT_TWO_TO_POW17 (1<<17)
180 #define ALT_TWO_TO_POW18 (1<<18)
181 #define ALT_TWO_TO_POW19 (1<<19)
182 #define ALT_TWO_TO_POW20 (1<<20)
183 #define ALT_TWO_TO_POW21 (1<<21)
184 #define ALT_TWO_TO_POW22 (1<<22)
185 #define ALT_TWO_TO_POW23 (1<<23)
186 #define ALT_TWO_TO_POW24 (1<<24)
187 #define ALT_TWO_TO_POW25 (1<<25)
188 #define ALT_TWO_TO_POW26 (1<<26)
189 #define ALT_TWO_TO_POW27 (1<<27)
190 #define ALT_TWO_TO_POW28 (1<<28)
191 #define ALT_TWO_TO_POW29 (1<<29)
192 #define ALT_TWO_TO_POW30 (1<<30)
193 #define ALT_TWO_TO_POW31 (1<<31)
194 
195 #ifdef __cplusplus
196 }
197 #endif /* __cplusplus */
198 #endif /* __HWLIB_H__ */
199