|
NMSIS-Core
Version 1.3.1
NMSIS-Core support for Nuclei processor-based devices
|
19 #ifndef __NMSIS_GCC_H__
20 #define __NMSIS_GCC_H__
31 #include "riscv_encoding.h"
49 #define __has_builtin(x) (0)
60 #define __INLINE inline
64 #ifndef __STATIC_INLINE
65 #define __STATIC_INLINE static inline
69 #ifndef __STATIC_FORCEINLINE
70 #define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline
75 #define __NO_RETURN __attribute__((__noreturn__))
80 #define __USED __attribute__((used))
85 #define __WEAK __attribute__((weak))
90 #define __VECTOR_SIZE(x) __attribute__((vector_size(x)))
95 #define __PACKED __attribute__((packed, aligned(1)))
99 #ifndef __PACKED_STRUCT
100 #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
104 #ifndef __PACKED_UNION
105 #define __PACKED_UNION union __attribute__((packed, aligned(1)))
108 #ifndef __UNALIGNED_UINT16_WRITE
109 #pragma GCC diagnostic push
110 #pragma GCC diagnostic ignored "-Wpacked"
111 #pragma GCC diagnostic ignored "-Wattributes"
116 #pragma GCC diagnostic pop
118 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
121 #ifndef __UNALIGNED_UINT16_READ
122 #pragma GCC diagnostic push
123 #pragma GCC diagnostic ignored "-Wpacked"
124 #pragma GCC diagnostic ignored "-Wattributes"
129 #pragma GCC diagnostic pop
131 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
134 #ifndef __UNALIGNED_UINT32_WRITE
135 #pragma GCC diagnostic push
136 #pragma GCC diagnostic ignored "-Wpacked"
137 #pragma GCC diagnostic ignored "-Wattributes"
142 #pragma GCC diagnostic pop
144 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
147 #ifndef __UNALIGNED_UINT32_READ
148 #pragma GCC diagnostic push
149 #pragma GCC diagnostic ignored "-Wpacked"
150 #pragma GCC diagnostic ignored "-Wattributes"
155 #pragma GCC diagnostic pop
157 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
162 #define __ALIGNED(x) __attribute__((aligned(x)))
167 #define __RESTRICT __restrict
171 #ifndef __COMPILER_BARRIER
172 #define __COMPILER_BARRIER() __ASM volatile("":::"memory")
177 #define __USUALLY(exp) __builtin_expect((exp), 1)
182 #define __RARELY(exp) __builtin_expect((exp), 0)
187 #define __INTERRUPT __attribute__((interrupt))
191 #ifndef __MACHINE_INTERRUPT
192 #define __MACHINE_INTERRUPT __attribute__ ((interrupt ("machine")))
196 #ifndef __SUPERVISOR_INTERRUPT
197 #define __SUPERVISOR_INTERRUPT __attribute__ ((interrupt ("supervisor")))
201 #ifndef __USER_INTERRUPT
202 #define __USER_INTERRUPT __attribute__ ((interrupt ("user")))
#define __PACKED_STRUCT
Request smallest possible alignment for a structure.
__PACKED_STRUCT T_UINT32_WRITE
Packed struct for unaligned uint32_t write access.
__PACKED_STRUCT T_UINT32_READ
Packed struct for unaligned uint32_t read access.
__PACKED_STRUCT T_UINT16_WRITE
Packed struct for unaligned uint16_t write access.
__PACKED_STRUCT T_UINT16_READ
Packed struct for unaligned uint16_t read access.