706d153c471b08e71313e3056db03bef77a5872e
[rpi-open-firmware.git] / vc4_include / common.h
1 #pragma once
2
3 #include "../lib/stdarg.h"
4
5 typedef unsigned long long u64;
6 typedef unsigned long long uint64_t;
7 typedef long long int64_t;
8
9 typedef unsigned int u32;
10 typedef unsigned int uint32_t;
11 typedef int int32_t;
12
13 typedef unsigned short u16;
14 typedef unsigned short uint16_t;
15 typedef short int16_t;
16
17 typedef unsigned char u8;
18 typedef unsigned char uint8_t;
19
20 typedef int bool;
21
22 #define true 1
23 #define false 0
24
25 #define NULL ((void*)0)
26
27 typedef uint32_t size_t;
28
29 # define ALWAYS_INLINE __attribute__((always_inline)) inline
30
31 extern void panic(const char* fmt, ...)
32 __attribute__((noreturn))
33 __attribute__ ((format (printf, 1, 2)));
34
35 #define panic_plain(ex, ...) \
36 (panic)(ex, ## __VA_ARGS__)
37 #define __STRINGIFY(x) #x
38 #define LINE_NUMBER(x) __STRINGIFY(x)
39 #define PANIC_LOCATION __FILE__ ":" LINE_NUMBER(__LINE__)
40 #define panic(ex, ...) \
41 (panic)(# ex "@" PANIC_LOCATION, ## __VA_ARGS__)
42
43 #define _OPEN_SOURCE
44
45 extern void udelay(uint32_t time);
46 extern uint32_t __div64_32(uint64_t *n, uint32_t base);
47
48 #define do_div __div64_32
49
50 /*
51 * this is done like that because clang likes using __builtin_memcpy
52 * which makes LLC choke in a fabulous way.
53 */
54 extern void *__memcpy(void *_dst, const void *_src, unsigned len);
55 #define bcopy(s,d,l) __memcpy(d,s,l)
56 #define memcpy(d,s,l) __memcpy(d,s,l)
57
58 extern int putchar(int c);
59 extern int vprintf(const char* fmt, va_list arp);
60 extern int printf(const char *fmt, ...);
61 extern int puts(const char* str);
This page took 0.066078 seconds and 3 git commands to generate.