NMSIS-Core  Version 1.2.0
NMSIS-Core support for Nuclei processor-based devices
nmsis_compiler.h
1 /*
2  * Copyright (c) 2019 Nuclei Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the License); you may
7  * not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __NMSIS_COMPILER_H
20 #define __NMSIS_COMPILER_H
21 
22 #include <stdint.h>
23 
28 #if defined ( __GNUC__ )
29  /* GNU GCC Compiler */
30  #include "nmsis_gcc.h"
31 #elif defined ( __ICCRISCV__ )
32  /* IAR Compiler */
33  #include "nmsis_iar.h"
34 #else
35  #error Unknown compiler.
36 #endif
37 
38 /* IO definitions (access restrictions to peripheral registers) */
53 #ifdef __cplusplus
54  #define __I volatile
55 #else
56  #define __I volatile const
57 #endif
58 
59 #define __O volatile
60 
61 #define __IO volatile
62 
63 /* following defines should be used for structure members */
65 #define __IM volatile const
66 
67 #define __OM volatile
68 
69 #define __IOM volatile
70 
84 #define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
85 
99 #define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
100  /* end of group NMSIS_Core_PeriphAccess */
102 
103 
104 #endif /* __NMSIS_COMPILER_H */
105