1 | /*␊ |
2 | * Copyright (c) 2005 Apple Computer, Inc. All Rights Reserved.␊ |
3 | */␊ |
4 | ␊ |
5 | #ifndef __DEVICE_TREE_H␊ |
6 | #define __DEVICE_TREE_H␊ |
7 | ␊ |
8 | #include <stdbool.h>␊ |
9 | #include <stdint.h>␊ |
10 | ␊ |
11 | typedef struct _Property {␊ |
12 | char * name;␊ |
13 | uint32_t length;␊ |
14 | void * value;␊ |
15 | ␊ |
16 | struct _Property * next;␊ |
17 | } Property;␊ |
18 | ␊ |
19 | typedef struct _Node {␊ |
20 | struct _Property * properties;␊ |
21 | struct _Property * last_prop;␊ |
22 | ␊ |
23 | struct _Node * children;␊ |
24 | ␊ |
25 | struct _Node * next;␊ |
26 | } Node;␊ |
27 | ␊ |
28 | extern Property *␊ |
29 | DT__AddProperty(Node *node, const char *name, uint32_t length, void *value);␊ |
30 | ␊ |
31 | extern Node *␊ |
32 | DT__AddChild(Node *parent, const char *name);␊ |
33 | ␊ |
34 | Node *␊ |
35 | DT__FindNode(const char *path, bool createIfMissing);␊ |
36 | ␊ |
37 | extern void␊ |
38 | DT__FreeProperty(Property *prop);␊ |
39 | ␊ |
40 | extern void␊ |
41 | DT__FreeNode(Node *node);␊ |
42 | ␊ |
43 | extern char *␊ |
44 | DT__GetName(Node *node);␊ |
45 | ␊ |
46 | void␊ |
47 | DT__Initialize(void);␊ |
48 | ␊ |
49 | /*␊ |
50 | * Free up memory used by in-memory representation␊ |
51 | * of device tree.␊ |
52 | */␊ |
53 | extern void␊ |
54 | DT__Finalize(void);␊ |
55 | ␊ |
56 | void␊ |
57 | DT__FlattenDeviceTree(void **result, uint32_t *length);␊ |
58 | ␊ |
59 | #endif /* __DEVICE_TREE_H */␊ |
60 | |