Hardware Libraries  20.1
Arria 10 SoC Hardware Manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros 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: //acds/rel/20.1/embedded/ip/hps/altera_hps/hwlib/include/hwlib.h#1 $
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 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif /* __cplusplus */
54 
55 #if !defined(soc_cv_av) && !defined(soc_a10)
56 #error You must define soc_cv_av or soc_a10 before compiling with HwLibs
57 #endif
58 
59 #define ALT_MIN(a, b) ((a) > (b) ? (b) : (a))
60 #define ALT_MAX(a, b) ((a) > (b) ? (a) : (b))
61 
65 typedef int32_t ALT_STATUS_CODE;
66 
70 #define ALT_E_SUCCESS 0
71 
73 #define ALT_E_ERROR (-1)
74 
75 #define ALT_E_FPGA_CFG (-2)
76 
77 #define ALT_E_FPGA_CRC (-3)
78 
79 #define ALT_E_FPGA_CFG_STM (-4)
80 
81 #define ALT_E_FPGA_PWR_OFF (-5)
82 
83 #define ALT_E_FPGA_NO_SOC_CTRL (-6)
84 
85 #define ALT_E_FPGA_NOT_USER_MODE (-7)
86 
87 #define ALT_E_ARG_RANGE (-8)
88 
89 #define ALT_E_BAD_ARG (-9)
90 
91 #define ALT_E_BAD_OPERATION (-10)
92 
93 #define ALT_E_INV_OPTION (-11)
94 
95 #define ALT_E_TMO (-12)
96 
97 #define ALT_E_RESERVED (-13)
98 
99 #define ALT_E_BAD_CLK (-14)
100 
101 #define ALT_E_BAD_VERSION (-15)
102 
103 #define ALT_E_BUF_OVF (-20)
104 
108 #define ALT_E_FALSE (0)
109 
112 #define ALT_E_TRUE (1)
113 
114 /* Note, additional positive status codes may be defined to return
115  * a TRUE condition with additional information */
116 
117 
118 /* Some other useful definitions */
119 
123 #define ALTERA_INTERNAL_ONLY_DOCS 1
124 
125 
130 #ifndef ALT_HPS_ADDR
131 #define ALT_HPS_ADDR 0
132 #endif
133 
137 #define ALT_MILLISECS_IN_A_SEC 1000
138 #define ALT_MICROSECS_IN_A_SEC 1000000
139 #define ALT_NANOSECS_IN_A_SEC 1000000000
140 
141 #define ALT_TWO_TO_POW0 (1)
142 #define ALT_TWO_TO_POW1 (1<<1)
143 #define ALT_TWO_TO_POW2 (1<<2)
144 #define ALT_TWO_TO_POW3 (1<<3)
145 #define ALT_TWO_TO_POW4 (1<<4)
146 #define ALT_TWO_TO_POW5 (1<<5)
147 #define ALT_TWO_TO_POW6 (1<<6)
148 #define ALT_TWO_TO_POW7 (1<<7)
149 #define ALT_TWO_TO_POW8 (1<<8)
150 #define ALT_TWO_TO_POW9 (1<<9)
151 #define ALT_TWO_TO_POW10 (1<<10)
152 #define ALT_TWO_TO_POW11 (1<<11)
153 #define ALT_TWO_TO_POW12 (1<<12)
154 #define ALT_TWO_TO_POW13 (1<<13)
155 #define ALT_TWO_TO_POW14 (1<<14)
156 #define ALT_TWO_TO_POW15 (1<<15)
157 #define ALT_TWO_TO_POW16 (1<<16)
158 #define ALT_TWO_TO_POW17 (1<<17)
159 #define ALT_TWO_TO_POW18 (1<<18)
160 #define ALT_TWO_TO_POW19 (1<<19)
161 #define ALT_TWO_TO_POW20 (1<<20)
162 #define ALT_TWO_TO_POW21 (1<<21)
163 #define ALT_TWO_TO_POW22 (1<<22)
164 #define ALT_TWO_TO_POW23 (1<<23)
165 #define ALT_TWO_TO_POW24 (1<<24)
166 #define ALT_TWO_TO_POW25 (1<<25)
167 #define ALT_TWO_TO_POW26 (1<<26)
168 #define ALT_TWO_TO_POW27 (1<<27)
169 #define ALT_TWO_TO_POW28 (1<<28)
170 #define ALT_TWO_TO_POW29 (1<<29)
171 #define ALT_TWO_TO_POW30 (1<<30)
172 #define ALT_TWO_TO_POW31 (1<<31)
173 
174 #ifdef __cplusplus
175 }
176 #endif /* __cplusplus */
177 #endif /* __HWLIB_H__ */
178