]> rtime.felk.cvut.cz Git - jailhouse.git/blob - inmates/lib/arm/include/inmate.h
2fee1bdb17b981a4069b6c24891df2c8b7cbc54a
[jailhouse.git] / inmates / lib / arm / include / inmate.h
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) ARM Limited, 2014
5  *
6  * Authors:
7  *  Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #ifndef _JAILHOUSE_INMATE_H
14 #define _JAILHOUSE_INMATE_H
15
16 #ifndef __ASSEMBLY__
17 typedef signed char s8;
18 typedef unsigned char u8;
19
20 typedef signed short s16;
21 typedef unsigned short u16;
22
23 typedef signed int s32;
24 typedef unsigned int u32;
25
26 typedef signed long long s64;
27 typedef unsigned long long u64;
28
29 static inline u32 mmio_read32(void *address)
30 {
31         return *(volatile u32 *)address;
32 }
33
34 static inline void mmio_write32(void *address, u32 value)
35 {
36         *(volatile u32 *)address = value;
37 }
38
39 static inline void *memset(void *addr, int val, unsigned int size)
40 {
41         char *s = addr;
42         unsigned int i;
43         for (i = 0; i < size; i++)
44                 *s++ = val;
45
46         return addr;
47 }
48
49 extern unsigned long printk_uart_base;
50 void printk(const char *fmt, ...);
51 void inmate_main(void);
52
53 void __attribute__((interrupt("IRQ"))) __attribute__((used)) vector_irq(void);
54
55 typedef void (*irq_handler_t)(unsigned int);
56 void gic_setup(irq_handler_t handler);
57 void gic_enable_irq(unsigned int irq);
58
59 unsigned long timer_get_frequency(void);
60 u64 timer_get_ticks(void);
61 u64 timer_ticks_to_ns(u64 ticks);
62 void timer_start(u64 timeout);
63
64 #endif /* !__ASSEMBLY__ */
65 #endif /* !_JAILHOUSE_INMATE_H */