5 #define SWIG_FILE_WITH_INIT
11 raise ValueError('Error %s' % fdt_strerror(errnum))
13 def Name(fdt, offset):
14 name, len = fdt_get_name(fdt, offset)
17 def String(fdt, offset):
18 offset = fdt32_to_cpu(offset)
19 name = fdt_string(fdt, offset)
23 return (((x << 24) & 0xFF000000) |
24 ((x << 8) & 0x00FF0000) |
25 ((x >> 8) & 0x0000FF00) |
26 ((x >> 24) & 0x000000FF))
33 return get_prop_data()
39 %typemap(in) void* = char*;
51 * This is a work-around since I'm not sure of a better way to copy out the
52 * contents of a string. This is used in dtoc/GetProps(). The intent is to
53 * pass in a pointer to a property and access the data field at the end of
54 * it. Ideally the Data() function above would be able to do this directly,
55 * but I'm not sure how to do that.
57 #pragma SWIG nowarn=454
59 static struct fdt_property *cur_prop;
61 void set_prop(struct fdt_property *prop) {
66 %cstring_output_allocate_size(char **s, int *sz, free(*$1));
68 void get_prop_data(char **s, int *sz) {
69 *sz = fdt32_to_cpu(cur_prop->len);
70 *s = (char *)malloc(*sz);
74 memcpy(*s, cur_prop + 1, *sz);
78 const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
79 int fdt_path_offset(const void *fdt, const char *path);
80 int fdt_first_property_offset(const void *fdt, int nodeoffset);
81 int fdt_next_property_offset(const void *fdt, int offset);
82 const char *fdt_strerror(int errval);
83 const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
86 const char *fdt_get_name(const void *fdt, int nodeoffset, int *OUTPUT);
87 const char *fdt_string(const void *fdt, int stroffset);
88 int fdt_first_subnode(const void *fdt, int offset);
89 int fdt_next_subnode(const void *fdt, int offset);