1
0
Fork 0
forked from len0rd/rockbox

Onda VX747:

* Rework battery reading
 * Get power off back working
 * Add time to debug view
 * Convert TABs to spaces in firmware/export/mips*.h


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20024 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2009-02-16 22:49:58 +00:00
parent 67a5c56103
commit 360d3d720b
7 changed files with 2165 additions and 2163 deletions

View file

@ -85,9 +85,14 @@
/* Define this for LCD backlight available */ /* Define this for LCD backlight available */
#define HAVE_BACKLIGHT #define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS #define HAVE_BACKLIGHT_BRIGHTNESS
/* define this if the backlight can be set to a brightness */
#define __BACKLIGHT_INIT
/* Which backlight fading type? */
//#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
/* Main LCD backlight brightness range and defaults */ /* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 100 #define MIN_BRIGHTNESS_SETTING 100
#define MAX_BRIGHTNESS_SETTING 300 #define MAX_BRIGHTNESS_SETTING 300
@ -95,7 +100,7 @@
#define DEFAULT_DIMNESS_SETTING 100 /* "most dim" */ #define DEFAULT_DIMNESS_SETTING 100 /* "most dim" */
/* Define this if you have a software controlled poweroff */ /* Define this if you have a software controlled poweroff */
//#define HAVE_SW_POWEROFF #define HAVE_SW_POWEROFF
/* The number of bytes reserved for loadable codecs */ /* The number of bytes reserved for loadable codecs */
#define CODEC_SIZE 0x100000 #define CODEC_SIZE 0x100000
@ -108,7 +113,7 @@
#define CONFIG_I2C I2C_JZ47XX #define CONFIG_I2C I2C_JZ47XX
/* TLV320 has no tone controls, so we use the software ones */ /* has no tone controls, so we use the software ones */
//#define HAVE_SW_TONE_CONTROLS //#define HAVE_SW_TONE_CONTROLS
/*#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | \ /*#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | \
@ -141,9 +146,6 @@
/* Virtual LED (icon) */ /* Virtual LED (icon) */
#define CONFIG_LED LED_VIRTUAL #define CONFIG_LED LED_VIRTUAL
/* define this if the backlight can be set to a brightness */
#define __BACKLIGHT_INIT
/* Offset ( in the firmware file's header ) to the file CRC */ /* Offset ( in the firmware file's header ) to the file CRC */
#define FIRMWARE_OFFSET_FILE_CRC 0 #define FIRMWARE_OFFSET_FILE_CRC 0

View file

@ -28,6 +28,7 @@
#include "kernel.h" #include "kernel.h"
#include "font.h" #include "font.h"
#include "button.h" #include "button.h"
#include "timefuncs.h"
static int line = 0; static int line = 0;
static void printf(const char *format, ...) static void printf(const char *format, ...)
@ -150,6 +151,7 @@ bool __dbg_ports(void)
bool __dbg_hw_info(void) bool __dbg_hw_info(void)
{ {
int btn = 0, touch; int btn = 0, touch;
struct tm *cur_time;
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
while(btn ^ BUTTON_POWER) while(btn ^ BUTTON_POWER)
@ -159,7 +161,11 @@ bool __dbg_hw_info(void)
display_clocks(); display_clocks();
display_enabled_clocks(); display_enabled_clocks();
btn = button_read_device(&touch); btn = button_read_device(&touch);
cur_time = get_time();
printf("X: %d Y: %d BTN: 0x%X", touch>>16, touch&0xFFFF, btn); printf("X: %d Y: %d BTN: 0x%X", touch>>16, touch&0xFFFF, btn);
printf("%02d/%02d/%04d %02d:%02d:%02d", cur_time->tm_mday,
cur_time->tm_mon, cur_time->tm_year, cur_time->tm_hour,
cur_time->tm_min, cur_time->tm_sec);
lcd_update(); lcd_update();
sleep(HZ/16); sleep(HZ/16);
} }

View file

@ -108,34 +108,25 @@ const unsigned short percent_to_volt_charge[11] =
/* Returns battery voltage from ADC [millivolts] */ /* Returns battery voltage from ADC [millivolts] */
unsigned int battery_adc_voltage(void) unsigned int battery_adc_voltage(void)
{ {
unsigned int val, i; unsigned int dummy, timeout=1000;
mutex_lock(&battery_mtx); mutex_lock(&battery_mtx);
val = REG_SADC_BATDAT; dummy = REG_SADC_BATDAT;
val = REG_SADC_BATDAT; dummy = REG_SADC_BATDAT;
REG_SADC_ENA |= SADC_ENA_PBATEN; REG_SADC_ENA |= SADC_ENA_PBATEN;
for(i=0; i<4; i++)
{
bat_val = 0; bat_val = 0;
/* primitive wakeup event */ /* primitive wakeup event */
while(bat_val == 0) while(bat_val == 0 && timeout--)
sleep(0); sleep(0);
val += bat_val; logf("%d %d", bat_val, (bat_val*BATTERY_SCALE_FACTOR)>>12);
}
REG_SADC_ENA &= ~SADC_ENA_PBATEN;
val /= 4;
logf("%d %d %d", val, (val*BATTERY_SCALE_FACTOR)>>12,
(val*0xAAAAAAAB >> 32) >> 1);
mutex_unlock(&battery_mtx); mutex_unlock(&battery_mtx);
return (val*BATTERY_SCALE_FACTOR)>>12; return (bat_val*BATTERY_SCALE_FACTOR)>>12;
} }
void button_init_device(void) void button_init_device(void)

View file

@ -509,6 +509,9 @@ void system_exception_wait(void)
void power_off(void) void power_off(void)
{ {
/* Enable RTC clock */
__cpm_start_rtc();
/* Put system into hibernate mode */ /* Put system into hibernate mode */
__rtc_clear_alarm_flag(); __rtc_clear_alarm_flag();
__rtc_clear_hib_stat_all(); __rtc_clear_hib_stat_all();