// do we have a 'minimal' lib yet anywhere formalized? if not, we could
// attempt to include it here.
-// set clock speed
-
-// set LED on
+// for reference material, see the Pandora wiki. Specifically, some good
+// places to look:
+// http://pandorawiki.org/Kernel_interface
+
+/* overall clock speed
+ * WARN: No boundaries are checked, so try to avoid setting clock to 2GHz :)
+ * NOTE: get-clock() is not implemented yet.
+ */
+#define PND_DEVICE_PROC_CLOCK "/proc/pandora/cpu_mhz_max"
+unsigned char pnd_device_set_clock ( unsigned int c ); // returns >0 on success
+unsigned int pnd_device_get_clock ( void ); // not implemented, returns 0
+
+// set one or more LEDs on
// suspend/hibernate/etc
--- /dev/null
+
+#include <stdio.h> /* for FILE etc */
+#include <stdlib.h> /* for malloc */
+#include <string.h>
+
+#include <sys/types.h> /* for open */
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "pnd_device.h"
+
+unsigned char pnd_device_set_clock ( unsigned int c ) {
+ char buffer [ 100 ];
+ int f;
+
+ sprint ( buffer, "%u", c );
+
+ if ( ( f = open ( PND_DEVICE_PROC_CLOCK, O_RDONLY ) ) < 0 ) {
+ return ( 0 );
+ }
+
+ if ( write ( f, buffer, strlen ( buffer ) ) < strlen ( buffer ) ) {
+ return ( 0 );
+ }
+
+ close ( f );
+
+ return ( 1 );
+}
+
+unsigned int pnd_device_get_clock ( void ) {
+ return ( 0 );
+}