2 * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef OPEN_FIRMWARE_H
6 #define OPEN_FIRMWARE_H
9 #include <SupportDefs.h>
12 #define OF_FAILED (-1)
15 /* global device tree/properties access */
19 template<typename AddressType
>
32 int &Argument(int index
) { return data
[index
]; }
33 int &ReturnValue(int index
) { return data
[num_args
+ index
]; }
42 extern status_t
of_init(int (*openFirmwareEntry
)(void *));
44 /* device tree functions */
45 extern int of_finddevice(const char *device
);
46 extern int of_child(int node
);
47 extern int of_peer(int node
);
48 extern int of_parent(int node
);
49 extern int of_instance_to_path(int instance
, char *pathBuffer
, int bufferSize
);
50 extern int of_instance_to_package(int instance
);
51 extern int of_getprop(int package
, const char *property
, void *buffer
,
53 extern int of_setprop(int package
, const char *property
, const void *buffer
,
55 extern int of_nextprop(int package
, const char *previousProperty
,
57 extern int of_getproplen(int package
, const char *property
);
58 extern int of_package_to_path(int package
, char *pathBuffer
, int bufferSize
);
61 extern int of_open(const char *nodeName
);
62 extern void of_close(int handle
);
63 extern int of_read(int handle
, void *buffer
, int bufferSize
);
64 extern int of_write(int handle
, const void *buffer
, int bufferSize
);
65 extern int of_seek(int handle
, off_t pos
);
67 /* memory functions */
68 extern int of_release(void *virtualAddress
, int size
);
69 extern void *of_claim(void *virtualAddress
, int size
, int align
);
72 extern int of_call_client_function(const char *method
, int numArgs
,
74 extern int of_interpret(const char *command
, int numArgs
, int numReturns
, ...);
75 extern int of_call_method(int handle
, const char *method
, int numArgs
,
77 extern int of_test(const char *service
);
78 extern int of_milliseconds(void);
79 extern void of_exit(void);
85 #endif /* OPEN_FIRMWARE_H */