Hardware Libraries  20.1
Stratix 10 SoC Hardware Manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
hwlib.h
1 /******************************************************************************
2 *
3 * Copyright 2013-2017 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/main/embedded/ip/hps/armv8/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_s10)
56 #error You must define soc_s10 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 
62 #define ALT_SIZEOF_ARRAY(a) (sizeof(a)/sizeof(a[0]))
63 
67 typedef int32_t ALT_STATUS_CODE;
68 
72 #define ALT_E_SUCCESS 0
73 
75 #define ALT_E_ERROR (-1)
76 
77 #define ALT_E_FPGA_CFG (-2)
78 
79 #define ALT_E_FPGA_CRC (-3)
80 
81 #define ALT_E_FPGA_CFG_STM (-4)
82 
83 #define ALT_E_FPGA_PWR_OFF (-5)
84 
85 #define ALT_E_FPGA_NO_SOC_CTRL (-6)
86 
87 #define ALT_E_FPGA_NOT_USER_MODE (-7)
88 
89 #define ALT_E_ARG_RANGE (-8)
90 
91 #define ALT_E_BAD_ARG (-9)
92 
93 #define ALT_E_BAD_OPERATION (-10)
94 
95 #define ALT_E_INV_OPTION (-11)
96 
97 #define ALT_E_TMO (-12)
98 
99 #define ALT_E_RESERVED (-13)
100 
101 #define ALT_E_BAD_CLK (-14)
102 
103 #define ALT_E_BAD_VERSION (-15)
104 
105 #define ALT_E_BUF_OVF (-20)
106 
110 #define ALT_E_FALSE (0)
111 
114 #define ALT_E_TRUE (1)
115 
116 /* Note, additional positive status codes may be defined to return
117  * a TRUE condition with additional information */
118 
119 
120 /* Some other useful definitions */
121 
125 #define ALTERA_INTERNAL_ONLY_DOCS 1
126 
127 
132 #ifndef ALT_HPS_ADDR
133 #define ALT_HPS_ADDR 0
134 #endif
135 
139 #define ALT_MILLISECS_IN_A_SEC 1000
140 #define ALT_MICROSECS_IN_A_SEC 1000000
141 #define ALT_NANOSECS_IN_A_SEC 1000000000
142 
143 #define ALT_TWO_TO_POW(x) (1UL<<(x))
144 
145 
146 #ifdef __cplusplus
147 }
148 #endif /* __cplusplus */
149 #endif /* __HWLIB_H__ */
150