RTEMS  5.1
hwlib.h
Go to the documentation of this file.
1 
7 /******************************************************************************
8 *
9 * Copyright 2013 Altera Corporation. All Rights Reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
27 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
29 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
33 * OF SUCH DAMAGE.
34 *
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 
60 typedef int32_t ALT_STATUS_CODE;
61 
65 #define ALT_E_SUCCESS 0
66 
68 #define ALT_E_ERROR (-1)
69 
70 #define ALT_E_FPGA_CFG (-2)
71 
72 #define ALT_E_FPGA_CRC (-3)
73 
74 #define ALT_E_FPGA_CFG_STM (-4)
75 
76 #define ALT_E_FPGA_PWR_OFF (-5)
77 
78 #define ALT_E_FPGA_NO_SOC_CTRL (-6)
79 
80 #define ALT_E_FPGA_NOT_USER_MODE (-7)
81 
82 #define ALT_E_ARG_RANGE (-8)
83 
84 #define ALT_E_BAD_ARG (-9)
85 
86 #define ALT_E_BAD_OPERATION (-10)
87 
88 #define ALT_E_INV_OPTION (-11)
89 
90 #define ALT_E_TMO (-12)
91 
92 #define ALT_E_RESERVED (-13)
93 
94 #define ALT_E_BAD_CLK (-14)
95 
96 #define ALT_E_BAD_VERSION (-15)
97 
98 #define ALT_E_BUF_OVF (-20)
99 
103 #define ALT_E_FALSE (0)
104 
107 #define ALT_E_TRUE (1)
108 
109 /* Note, additional positive status codes may be defined to return
110  * a TRUE condition with additional information */
111 
112 
113 /* Some other useful definitions */
114 
132 #define ALT_HWLIBS_VERSION(a,b,c) (((a)*10000)+((b)*100)+(c))
133 
134 #define ALTERA_HWLIBS_VERSION_CODE ALT_HWLIBS_VERSION(ALTERA_ACDS_MAJOR_REV, \
135  ALTERA_ACDS_MINOR_REV, ALTERA_HWLIBS_REV)
136 
140 #define ALTERA_INTERNAL_ONLY_DOCS 1
141 
142 
147 #ifndef ALT_HPS_ADDR
148 #define ALT_HPS_ADDR 0
149 #endif
150 
154 #define ALT_MILLISECS_IN_A_SEC 1000
155 #define ALT_MICROSECS_IN_A_SEC 1000000
156 #define ALT_NANOSECS_IN_A_SEC 1000000000
157 
158 #define ALT_TWO_TO_POW0 (1)
159 #define ALT_TWO_TO_POW1 (1<<1)
160 #define ALT_TWO_TO_POW2 (1<<2)
161 #define ALT_TWO_TO_POW3 (1<<3)
162 #define ALT_TWO_TO_POW4 (1<<4)
163 #define ALT_TWO_TO_POW5 (1<<5)
164 #define ALT_TWO_TO_POW6 (1<<6)
165 #define ALT_TWO_TO_POW7 (1<<7)
166 #define ALT_TWO_TO_POW8 (1<<8)
167 #define ALT_TWO_TO_POW9 (1<<9)
168 #define ALT_TWO_TO_POW10 (1<<10)
169 #define ALT_TWO_TO_POW11 (1<<11)
170 #define ALT_TWO_TO_POW12 (1<<12)
171 #define ALT_TWO_TO_POW13 (1<<13)
172 #define ALT_TWO_TO_POW14 (1<<14)
173 #define ALT_TWO_TO_POW15 (1<<15)
174 #define ALT_TWO_TO_POW16 (1<<16)
175 #define ALT_TWO_TO_POW17 (1<<17)
176 #define ALT_TWO_TO_POW18 (1<<18)
177 #define ALT_TWO_TO_POW19 (1<<19)
178 #define ALT_TWO_TO_POW20 (1<<20)
179 #define ALT_TWO_TO_POW21 (1<<21)
180 #define ALT_TWO_TO_POW22 (1<<22)
181 #define ALT_TWO_TO_POW23 (1<<23)
182 #define ALT_TWO_TO_POW24 (1<<24)
183 #define ALT_TWO_TO_POW25 (1<<25)
184 #define ALT_TWO_TO_POW26 (1<<26)
185 #define ALT_TWO_TO_POW27 (1<<27)
186 #define ALT_TWO_TO_POW28 (1<<28)
187 #define ALT_TWO_TO_POW29 (1<<29)
188 #define ALT_TWO_TO_POW30 (1<<30)
189 #define ALT_TWO_TO_POW31 (1<<31)
190 
191 #ifdef __cplusplus
192 }
193 #endif /* __cplusplus */
194 #endif /* __HWLIB_H__ */
195 
int32_t ALT_STATUS_CODE
Definition: hwlib.h:60