1 /*
2  * Copyright (c) 2020-2020, BLUETRUM Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef PROUGENGX_H__
8 #define PROUGENGX_H__
9 
10 #include "ab32vg1.h"
11 
12 #ifndef UINT_MAX
13 #define UINT_MAX                0xffffffff
14 #endif // UINT_MAX
15 
16 #define BIT(n)                  (1UL << (n))
17 
18 #define AT(x)                   __attribute__((section(#x)))
19 #define ALIGNED(n)              __attribute__((aligned(n)))
20 #define DMA_ADR(x)              ((uint32_t)x)
21 #define ALWAYS_INLINE           __attribute__((always_inline)) inline
22 #define NO_INLINE               __attribute__((noinline))
23 #define WEAK                    __attribute__((weak))
24 #define PACKED                  __attribute__((packed))
25 
26 #define BYTE0(n)                ((unsigned char)(n))
27 #define BYTE1(n)                ((unsigned char)((n)>>8))
28 #define BYTE2(n)                ((unsigned char)((n)>>16))
29 #define BYTE3(n)                ((unsigned char)((n)>>24))
30 
31 #define GET_LE16(ptr)           (uint16_t)(*(uint16_t*)(uint8_t*)(ptr))
32 #define GET_LE32(ptr)           (uint32_t)(*(uint32_t*)(uint8_t*)(ptr))
33 #define PUT_LE16(ptr, val)      *(uint16_t*)(uint8_t*)(ptr) = (uint16_t)(val)
34 #define PUT_LE32(ptr, val)      *(uint32_t*)(uint8_t*)(ptr) = (uint32_t)(val)
35 
36 #define GET_BE16(ptr)           get_be16(ptr)
37 #define GET_BE32(ptr)           get_be32(ptr)
38 #define PUT_BE16(ptr, val)      put_be16(ptr, val)
39 #define PUT_BE32(ptr, val)      put_be32(ptr, val)
40 
41 #include "ab32vg1_hal.h"
42 
43 #endif
44