Hardware Libraries
20.1
Stratix 10 SoC Hardware Manager
Main Page
Address Space
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
socal.h
1
/***********************************************************************************
2
* *
3
* Copyright 2013-2015 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
35
#ifndef __ALTERA_SOCAL_H__
36
#define __ALTERA_SOCAL_H__
37
38
#ifndef __ASSEMBLY__
39
#ifdef __cplusplus
40
#include <cstddef>
41
#include <cstdbool>
42
#include <cstdint>
43
#else
/* __cplusplus */
44
#include <stddef.h>
45
#include <stdbool.h>
46
#include <stdint.h>
47
#endif
/* __cplusplus */
48
#endif
/* __ASSEMBLY__ */
49
50
#ifdef __cplusplus
51
extern
"C"
52
{
53
#endif
/* __cplusplus */
54
62
#ifdef __ASSEMBLY__
63
#define ALT_CAST(type, ptr) ptr
64
#else
/* __ASSEMBLY__ */
65
73
#define ALT_CAST(type, ptr) ((type) (ptr))
74
#endif
/* __ASSEMBLY__ */
75
76
97
#ifdef __NIOS2__
98
#define alt_write_byte(dest, src) __builtin_stbio((ALT_CAST(volatile void *, (dest))), (src))
99
#else
/* __NIOS2__ */
100
#define alt_write_byte(dest, src) (*ALT_CAST(volatile uint8_t *, (dest)) = (src))
101
#endif
/* __NIOS2__ */
102
107
#ifdef __NIOS2__
108
#define alt_read_byte(src) __builtin_ldbuio(ALT_CAST(volatile void *, (src)))
109
#else
/* __NIOS2__ */
110
#define alt_read_byte(src) (*ALT_CAST(volatile uint8_t *, (src)))
111
#endif
/* __NIOS2__ */
112
117
#ifdef __NIOS2__
118
#define alt_write_hword(dest, src) __builtin_sthio((ALT_CAST(volatile void *, (dest))), (src))
119
#else
/* __NIOS2__ */
120
#define alt_write_hword(dest, src) (*ALT_CAST(volatile uint16_t *, (dest)) = (src))
121
#endif
/* __NIOS2__ */
122
127
#ifdef __NIOS2__
128
#define alt_read_hword(src) __builtin_ldhuio(ALT_CAST(volatile void *, (src)))
129
#else
/* __NIOS2__ */
130
#define alt_read_hword(src) (*ALT_CAST(volatile uint16_t *, (src)))
131
#endif
/* __NIOS2__ */
132
137
#ifdef __NIOS2__
138
#define alt_write_word(dest, src) __builtin_stwio((ALT_CAST(volatile void *, (dest))), (src))
139
#else
/* __NIOS2__ */
140
#define alt_write_word(dest, src) (*ALT_CAST(volatile uint32_t *, (dest)) = (src))
141
#endif
/* __NIOS2__ */
142
147
#ifdef __NIOS2__
148
#define alt_read_word(src) __builtin_ldwio(ALT_CAST(volatile void *, (src)))
149
#else
/* __NIOS2__ */
150
#define alt_read_word(src) (*ALT_CAST(volatile uint32_t *, (src)))
151
#endif
/* __NIOS2__ */
152
157
#ifdef __NIOS2__
158
#else
/* __NIOS2__ */
159
#define alt_write_dword(dest, src) (*ALT_CAST(volatile uint64_t *, (dest)) = (src))
160
#endif
/* __NIOS2__ */
161
166
#ifdef __NIOS2__
167
#else
/* __NIOS2__ */
168
#define alt_read_dword(src) (*ALT_CAST(volatile uint64_t *, (src)))
169
#endif
/* __NIOS2__ */
170
186
#define alt_setbits_byte(dest, bits) (alt_write_byte(dest, alt_read_byte(dest) | (bits)))
187
192
#define alt_clrbits_byte(dest, bits) (alt_write_byte(dest, alt_read_byte(dest) & ~(bits)))
193
198
#define alt_xorbits_byte(dest, bits) (alt_write_byte(dest, alt_read_byte(dest) ^ (bits)))
199
205
#define alt_replbits_byte(dest, msk, src) (alt_write_byte(dest,(alt_read_byte(dest) & ~(msk)) | ((src) & (msk))))
206
211
#define alt_setbits_hword(dest, bits) (alt_write_hword(dest, alt_read_hword(dest) | (bits)))
212
217
#define alt_clrbits_hword(dest, bits) (alt_write_hword(dest, alt_read_hword(dest) & ~(bits)))
218
223
#define alt_xorbits_hword(dest, bits) (alt_write_hword(dest, alt_read_hword(dest) ^ (bits)))
224
230
#define alt_replbits_hword(dest, msk, src) (alt_write_hword(dest,(alt_read_hword(dest) & ~(msk)) | ((src) & (msk))))
231
236
#define alt_setbits_word(dest, bits) (alt_write_word(dest, alt_read_word(dest) | (bits)))
237
242
#define alt_clrbits_word(dest, bits) (alt_write_word(dest, alt_read_word(dest) & ~(bits)))
243
248
#define alt_xorbits_word(dest, bits) (alt_write_word(dest, alt_read_word(dest) ^ (bits)))
249
255
#define alt_replbits_word(dest, msk, src) (alt_write_word(dest,(alt_read_word(dest) & ~(msk)) | ((src) & (msk))))
256
261
#define alt_setbits_dword(dest, bits) (alt_write_dword(dest, alt_read_dword(dest) | (bits)))
262
267
#define alt_clrbits_dword(dest, bits) (alt_write_dword(dest, alt_read_dword(dest) & ~(bits)))
268
273
#define alt_xorbits_dword(dest, bits) (alt_write_dword(dest, alt_read_dword(dest) ^ (bits)))
274
280
#define alt_replbits_dword(dest, msk, src) (alt_write_dword(dest,(alt_read_dword(dest) & ~(msk)) | ((src) & (msk))))
281
286
#ifdef __cplusplus
287
}
288
#endif
/* __cplusplus */
289
#endif
/* __ALTERA_SOCAL_H__ */
include
soc_s10
socal
socal.h
Generated on Tue Oct 27 2020 08:53:01 for Hardware Libraries by
1.8.2