]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/HardwareLibrary/include/hwlib.h
Added project for Altera Cyclone V SoC, currently running from internal RAM.
[freertos] / FreeRTOS / Demo / CORTEX_A9_Cyclone_V_SoC_DK / Altera_Code / HardwareLibrary / include / hwlib.h
1 /******************************************************************************\r
2 *\r
3 * Copyright 2013 Altera Corporation. All Rights Reserved.\r
4\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
7\r
8 * 1. Redistributions of source code must retain the above copyright notice,\r
9 * this list of conditions and the following disclaimer.\r
10\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
14\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
17\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
27 * OF SUCH DAMAGE.\r
28\r
29 ******************************************************************************/\r
30 \r
31 #ifndef __HWLIB_H__\r
32 #define __HWLIB_H__\r
33 \r
34 #ifdef __cplusplus\r
35 #include <cstddef>\r
36 #include <cstdbool>\r
37 #include <cstdint>\r
38 #else   /* __cplusplus */\r
39 #include <stddef.h>\r
40 #include <stdbool.h>\r
41 #include <stdint.h>\r
42 #endif  /* __cplusplus */\r
43 \r
44 #include "alt_hwlibs_ver.h"\r
45 \r
46 #ifdef __cplusplus\r
47 extern "C"\r
48 {\r
49 #endif  /* __cplusplus */\r
50 \r
51 /*!\r
52  * The type definition for status codes returned by the HWLIB.\r
53  */\r
54 typedef int32_t             ALT_STATUS_CODE;\r
55 \r
56 /*! Definitions of status codes returned by the HWLIB. */\r
57 \r
58 /*! The operation was successful. */\r
59 #define ALT_E_SUCCESS               0\r
60 \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
93 \r
94 /*!\r
95  * Indicates a FALSE condition.\r
96  */\r
97 #define ALT_E_FALSE                 (0)\r
98 /*!\r
99  * Indicates a TRUE condition.\r
100  */\r
101 #define ALT_E_TRUE                  (1)\r
102 \r
103 /* Note, additional positive status codes may be defined to return\r
104  * a TRUE condition with additional information */\r
105 \r
106 \r
107 /* Some other useful definitions */\r
108 \r
109 /*!\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
113  *\r
114  * A typical use is:\r
115  * \code\r
116  * #if  ALTERA_HWLIBS_VERSION_CODE >= ALT_HWLIBS_VERSION(13, 1, 0)\r
117  * \endcode\r
118  *     for a dependency on the major or minor ACDS revision\r
119  *   or\r
120  * \code\r
121  * #if  ALTERA_HWLIBS_VERSION_CODE == ALT_HWLIBS_VERSION(13, 0, 12)\r
122  * \endcode\r
123  *     for a dependency on the hwlibs revision\r
124  *\r
125  */\r
126 #define ALT_HWLIBS_VERSION(a,b,c)   (((a)*10000)+((b)*100)+(c))\r
127 \r
128 #define ALTERA_HWLIBS_VERSION_CODE   ALT_HWLIBS_VERSION(ALTERA_ACDS_MAJOR_REV, \\r
129                                     ALTERA_ACDS_MINOR_REV, ALTERA_HWLIBS_REV)\r
130 \r
131 /*!\r
132  * Allow some parts of the documentation to be hidden by setting to zero\r
133  */\r
134 #define ALTERA_INTERNAL_ONLY_DOCS   1\r
135 \r
136 \r
137 /*!\r
138  * Provide base address of MPU address space\r
139  */\r
140 \r
141 #ifndef ALT_HPS_ADDR\r
142 #define ALT_HPS_ADDR            0\r
143 #endif\r
144 \r
145 /*!\r
146  * These constants are sometimes useful:\r
147  */\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
151 \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
184 \r
185 #ifdef __cplusplus\r
186 }\r
187 #endif  /* __cplusplus */\r
188 #endif  /* __HWLIB_H__ */\r
189 \r