SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0+ */
2
3#ifndef __COMMON_H__
4#define __COMMON_H__
5
6#include <stdbool.h>
7#include <stddef.h>
8#include <stdint.h>
9#include <types.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif// __cplusplus
14
15#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
16
17#define ALIGN(size, align) (((size) + (align) -1) & (~((align) -1)))
18#define OF_ALIGN(size) ALIGN(size, 4)
19
20#ifndef NULL
21#define NULL 0
22#endif
23
24#define FALSE 0
25#define TRUE 1
26
27static inline uint32_t swap_uint32(uint32_t data) {
28 volatile uint32_t a, b, c, d;
29
30 a = ((data) &0xff000000) >> 24;
31 b = ((data) &0x00ff0000) >> 8;
32 c = ((data) &0x0000ff00) << 8;
33 d = ((data) &0x000000ff) << 24;
34
35 return a | b | c | d;
36}
37
38void abort(void);
39
40int raise(int signum);
41
42void show_banner(void);
43
44#ifdef __cplusplus
45}
46#endif// __cplusplus
47
48#endif// __COMMON_H__
u32_t uint32_t
Definition stdint.h:13
int raise(int signum)
Definition eabi_compat.c:8
void abort(void)
Definition eabi_compat.c:3
static uint32_t swap_uint32(uint32_t data)
Definition common.h:27
void show_banner(void)
Definition common.c:10