From 77f9f9c6cfc0834492b6e2afd428e87cdff35349 Mon Sep 17 00:00:00 2001 From: John Willis Date: Wed, 25 Oct 2006 19:51:47 +0000 Subject: Update GP2X port to support Fingolfin's ongoing implementation of the Modular Backends ideas :). Also add a few updates from my local tree (Batt level checking and STDOUT/STDERR file mapping code stolen from the Symbian backend (thanks)). svn-id: r24507 --- backends/platform/gp2x/gp2x-hw.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'backends/platform/gp2x/gp2x-hw.cpp') diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp index e967b6df62..9f573c86e0 100644 --- a/backends/platform/gp2x/gp2x-hw.cpp +++ b/backends/platform/gp2x/gp2x-hw.cpp @@ -37,6 +37,9 @@ #include #include #include +#include +#include +#include static unsigned long gp2x_dev[8]={0,0,0,0,0,0,0,0};//, gp2x_ticks_per_second; static volatile unsigned short *gp2x_memregs; @@ -138,6 +141,15 @@ void GP2X_setCpuspeed(unsigned int mhz) set_920_Div(0); } +int GP2X_getBattLevel() { + int devbatt; + unsigned short currentval=0; + devbatt = open("/dev/batt", O_RDONLY); + read (devbatt, ¤tval, 2); + close (devbatt); + return (currentval); +} + void set_display_clock_div(unsigned div) { div=((div & 63) | 64)<<8; -- cgit v1.2.3