blob: fe4deefee0d61e8bc3ad39934a80c01cb86a5c23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#ifndef __OPENBMC_H__
#define __OPENBMC_H__
#include <stdint.h>
#include <stdio.h>
//select which dbus
#define DBUS_TYPE G_BUS_TYPE_SYSTEM
// Macros
#define GET_VARIANT(v) g_variant_get_variant(v)
#define GET_VARIANT_D(v) g_variant_get_double(g_variant_get_variant(v))
#define GET_VARIANT_U(v) g_variant_get_uint32(g_variant_get_variant(v))
#define GET_VARIANT_B(v) g_variant_get_byte(g_variant_get_variant(v))
#define NEW_VARIANT_D(v) g_variant_new_variant(g_variant_new_double(v))
#define NEW_VARIANT_U(v) g_variant_new_variant(g_variant_new_uint32(v))
#define NEW_VARIANT_B(v) g_variant_new_variant(g_variant_new_byte(v))
#define VARIANT_COMPARE(x,y) g_variant_compare(GET_VARIANT(x),GET_VARIANT(y))
#ifdef __arm__
static inline void devmem(void* addr, uint32_t val)
{
printf("devmem %p = 0x%08x\n",addr,val);
asm volatile("" : : : "memory");
*(volatile uint32_t *)addr = val;
}
static inline uint32_t devmem_read(void* addr)
{
asm volatile("" : : : "memory");
return *(volatile uint32_t *)addr;
}
//static inline devmem(uint32_t reg, uint32_t val)
//{
// printf("devmem 0x%08x = 0x%08x\n",reg,val);
// //void* r = (void*)reg;
// write_reg(reg,val);
//}
#else
static inline uint32_t devmem(uint32_t val, uint32_t reg)
{
}
static inline uint32_t devmem_read(void* addr)
{
return 0;
}
#endif
typedef struct {
gint argc;
gchar **argv;
GMainLoop *loop;
gpointer user_data;
} cmdline;
#endif
|