2019-07-26 20:38:15 +01:00
|
|
|
/*
|
2020-01-24 10:10:40 +00:00
|
|
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
2019-07-26 20:38:15 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FUSEE_UTILS_H
|
|
|
|
#define FUSEE_UTILS_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define BIT(n) (1u << (n))
|
|
|
|
#define BITL(n) (1ull << (n))
|
|
|
|
#define MASK(n) (BIT(n) - 1)
|
|
|
|
#define MASKL(n) (BITL(n) - 1)
|
|
|
|
#define MASK2(a,b) (MASK(a) & ~MASK(b))
|
|
|
|
#define MASK2L(a,b) (MASKL(a) & ~MASKL(b))
|
|
|
|
|
|
|
|
#define MAKE_REG32(a) (*(volatile uint32_t *)(a))
|
|
|
|
|
|
|
|
#define ALIGN(m) __attribute__((aligned(m)))
|
|
|
|
#define PACKED __attribute__((packed))
|
|
|
|
|
|
|
|
#define ALINLINE __attribute__((always_inline))
|
|
|
|
#define NOINLINE __attribute__((noinline))
|
|
|
|
|
|
|
|
__attribute__((noreturn)) void generic_panic(void);
|
|
|
|
__attribute__((noreturn)) void fatal_error(const char *fmt, ...);
|
|
|
|
|
|
|
|
#endif
|