05ada300d8a108db97d1c5a709851848bcacd796
[rpi-open-firmware.git] / arm_chainloader / chainloader.h
1 #pragma once
2
3 #include <stdint.h>
4 #include <stddef.h>
5 #include <lib/panic.h>
6 #include <lib/xprintf.h>
7 #include <lib/tlsf/tlsf.h>
8 #include <memory_map.h>
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 extern void udelay(uint32_t time);
15
16 static inline void __attribute__((noreturn)) hang_cpu() {
17 __asm__ __volatile__ (
18 "wfi\n"
19 );
20
21 /* in case the above fails */
22 for (;;) {
23 __asm__ __volatile__ ("nop\nnop\nnop\nnop\nnop\nnop");
24 }
25 }
26
27 #define STATIC_INIT_PRIORITY(x) __attribute__((init_priority(x)))
28
29 #define STATIC_CPRMAN_DRIVER STATIC_INIT_PRIORITY(101)
30 #define STATIC_DRIVER STATIC_INIT_PRIORITY(200)
31 #define STATIC_FILESYSTEM STATIC_INIT_PRIORITY(300)
32 #define STATIC_APP STATIC_INIT_PRIORITY(600)
33
34 #define mfence() __sync_synchronize()
35
36 #define NBBY 8
37
38 #define __BIT(__n) \
39 (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : \
40 ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1))))
41
42 #ifdef __cplusplus
43 }
44 #endif
45
This page took 0.05988 seconds and 3 git commands to generate.