2006-04-08 10:27:34 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Peter D'Hoye
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-04-08 10:27:34 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include "plugin.h"
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/helper.h"
|
|
|
|
#include "lib/grey.h"
|
2012-01-26 23:15:15 +00:00
|
|
|
#include "lib/pluginlib_touchscreen.h"
|
|
|
|
#include "lib/pluginlib_exit.h"
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2007-07-27 09:57:27 +00:00
|
|
|
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2006-04-08 10:27:34 +00:00
|
|
|
#define FPS_QUIT BUTTON_MENU
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define FPS_QUIT BUTTON_RC_REC
|
2009-08-04 03:08:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
|
|
|
|
#define FPS_QUIT BUTTON_PLAY
|
2009-05-13 08:27:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZE_PAD
|
|
|
|
#define FPS_QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
|
|
|
#define FPS_QUIT (BUTTON_REC|BUTTON_PLAY)
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
|
|
|
#define FPS_QUIT (BUTTON_REC|BUTTON_REPEAT)
|
2011-09-06 12:39:49 +00:00
|
|
|
#elif CONFIG_KEYPAD == RK27XX_GENERIC_PAD
|
|
|
|
#define FPS_QUIT (BUTTON_M|BUTTON_REPEAT)
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
|
|
|
|
#define FPS_QUIT BUTTON_BACK
|
2012-01-26 23:15:15 +00:00
|
|
|
#elif defined(HAVE_TOUCHSCREEN)
|
|
|
|
#define FPS_QUIT (BUTTON_BOTTOMMIDDLE|BUTTON_REL)
|
2006-04-11 19:29:01 +00:00
|
|
|
#elif defined(BUTTON_OFF)
|
2006-04-08 10:27:34 +00:00
|
|
|
#define FPS_QUIT BUTTON_OFF
|
2006-04-11 08:03:45 +00:00
|
|
|
#else
|
|
|
|
#define FPS_QUIT BUTTON_POWER
|
|
|
|
#endif
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
#define DURATION (2*HZ) /* longer duration gives more precise results */
|
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
/* Screen logging */
|
|
|
|
static int line;
|
|
|
|
static int max_line;
|
2006-04-11 19:29:01 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2007-10-13 22:32:35 +00:00
|
|
|
static int remote_line;
|
|
|
|
static int remote_max_line;
|
2006-04-11 19:29:01 +00:00
|
|
|
#endif
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
static void log_init(void)
|
|
|
|
{
|
|
|
|
int h;
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->lcd_getstringsize("A", NULL, &h);
|
|
|
|
max_line = LCD_HEIGHT / h;
|
|
|
|
line = 0;
|
2006-04-08 10:27:34 +00:00
|
|
|
rb->lcd_clear_display();
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->lcd_update();
|
2006-04-11 19:29:01 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->lcd_remote_getstringsize("A", NULL, &h);
|
|
|
|
remote_max_line = LCD_REMOTE_HEIGHT / h;
|
|
|
|
remote_line = 0;
|
|
|
|
rb->lcd_remote_clear_display();
|
2006-04-11 19:29:01 +00:00
|
|
|
rb->lcd_remote_update();
|
|
|
|
#endif
|
2007-10-13 22:32:35 +00:00
|
|
|
}
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
static void log_text(char *text)
|
|
|
|
{
|
|
|
|
rb->lcd_puts(0, line, text);
|
|
|
|
if (++line >= max_line)
|
|
|
|
line = 0;
|
|
|
|
rb->lcd_update();
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
rb->lcd_remote_puts(0, remote_line, text);
|
|
|
|
if (++remote_line >= remote_max_line)
|
|
|
|
remote_line = 0;
|
|
|
|
rb->lcd_remote_update();
|
2007-08-05 20:41:49 +00:00
|
|
|
#endif
|
2007-10-13 22:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int calc_tenth_fps(int framecount, long ticks)
|
|
|
|
{
|
|
|
|
return (10*HZ) * framecount / ticks;
|
|
|
|
}
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
static void time_main_update(void)
|
|
|
|
{
|
|
|
|
char str[32]; /* text buffer */
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int frame_count;
|
|
|
|
int fps;
|
|
|
|
|
|
|
|
const int part14_x = LCD_WIDTH/4; /* x-offset for 1/4 update test */
|
|
|
|
const int part14_w = LCD_WIDTH/2; /* x-size for 1/4 update test */
|
|
|
|
const int part14_y = LCD_HEIGHT/4; /* y-offset for 1/4 update test */
|
|
|
|
const int part14_h = LCD_HEIGHT/2; /* y-size for 1/4 update test */
|
|
|
|
|
2010-10-03 11:57:47 +00:00
|
|
|
log_text("Main LCD Update");
|
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
/* Test 1: full LCD update */
|
2006-04-08 10:27:34 +00:00
|
|
|
frame_count = 0;
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->sleep(0); /* sync to tick */
|
2006-04-08 10:27:34 +00:00
|
|
|
time_start = *rb->current_tick;
|
2007-10-13 22:32:35 +00:00
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
2006-04-08 10:27:34 +00:00
|
|
|
{
|
|
|
|
rb->lcd_update();
|
|
|
|
frame_count++;
|
|
|
|
}
|
2007-10-13 22:32:35 +00:00
|
|
|
fps = calc_tenth_fps(frame_count, time_end - time_start);
|
|
|
|
rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10);
|
|
|
|
log_text(str);
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
/* Test 2: quarter LCD update */
|
2006-04-08 10:27:34 +00:00
|
|
|
frame_count = 0;
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->sleep(0); /* sync to tick */
|
2006-04-08 10:27:34 +00:00
|
|
|
time_start = *rb->current_tick;
|
2007-10-13 22:32:35 +00:00
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
2006-04-08 10:27:34 +00:00
|
|
|
{
|
|
|
|
rb->lcd_update_rect(part14_x, part14_y, part14_w, part14_h);
|
|
|
|
frame_count++;
|
|
|
|
}
|
2007-10-13 22:32:35 +00:00
|
|
|
fps = calc_tenth_fps(frame_count, time_end - time_start);
|
|
|
|
rb->snprintf(str, sizeof(str), "1/4: %d.%d fps", fps / 10, fps % 10);
|
|
|
|
log_text(str);
|
|
|
|
}
|
2006-04-08 10:27:34 +00:00
|
|
|
|
2009-06-21 14:09:48 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2)
|
2007-10-13 22:32:35 +00:00
|
|
|
|
|
|
|
#if LCD_WIDTH >= LCD_HEIGHT
|
|
|
|
#define YUV_WIDTH LCD_WIDTH
|
|
|
|
#define YUV_HEIGHT LCD_HEIGHT
|
|
|
|
#else /* Assume the screen is rotated on portrait LCDs */
|
|
|
|
#define YUV_WIDTH LCD_HEIGHT
|
|
|
|
#define YUV_HEIGHT LCD_WIDTH
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static unsigned char ydata[YUV_HEIGHT][YUV_WIDTH];
|
|
|
|
static unsigned char udata[YUV_HEIGHT/2][YUV_WIDTH/2];
|
|
|
|
static unsigned char vdata[YUV_HEIGHT/2][YUV_WIDTH/2];
|
|
|
|
|
|
|
|
static unsigned char * const yuvbuf[3] = {
|
|
|
|
(void*)ydata,
|
|
|
|
(void*)udata,
|
|
|
|
(void*)vdata
|
|
|
|
};
|
|
|
|
|
2007-10-15 23:07:25 +00:00
|
|
|
static void make_gradient_rect(int width, int height)
|
2007-10-13 22:32:35 +00:00
|
|
|
{
|
|
|
|
unsigned char vline[YUV_WIDTH/2];
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
width /= 2;
|
|
|
|
height /= 2;
|
|
|
|
|
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
vline[x] = (x << 8) / width;
|
|
|
|
for (y = 0; y < height; y++)
|
|
|
|
{
|
|
|
|
rb->memset(udata[y], (y << 8) / height, width);
|
|
|
|
rb->memcpy(vdata[y], vline, width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_main_yuv(void)
|
|
|
|
{
|
|
|
|
char str[32]; /* text buffer */
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int frame_count;
|
|
|
|
int fps;
|
|
|
|
|
|
|
|
const int part14_x = YUV_WIDTH/4; /* x-offset for 1/4 update test */
|
|
|
|
const int part14_w = YUV_WIDTH/2; /* x-size for 1/4 update test */
|
|
|
|
const int part14_y = YUV_HEIGHT/4; /* y-offset for 1/4 update test */
|
|
|
|
const int part14_h = YUV_HEIGHT/2; /* y-size for 1/4 update test */
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2010-10-03 11:57:47 +00:00
|
|
|
log_text("Main LCD YUV");
|
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->memset(ydata, 128, sizeof(ydata)); /* medium grey */
|
|
|
|
|
|
|
|
/* Test 1: full LCD update */
|
|
|
|
make_gradient_rect(YUV_WIDTH, YUV_HEIGHT);
|
|
|
|
|
|
|
|
frame_count = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
2008-03-24 00:35:53 +00:00
|
|
|
rb->lcd_blit_yuv(yuvbuf, 0, 0, YUV_WIDTH,
|
2007-10-13 22:32:35 +00:00
|
|
|
0, 0, YUV_WIDTH, YUV_HEIGHT);
|
|
|
|
frame_count++;
|
|
|
|
}
|
|
|
|
fps = calc_tenth_fps(frame_count, time_end - time_start);
|
|
|
|
rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10);
|
|
|
|
log_text(str);
|
|
|
|
|
|
|
|
/* Test 2: quarter LCD update */
|
|
|
|
make_gradient_rect(YUV_WIDTH/2, YUV_HEIGHT/2);
|
|
|
|
|
|
|
|
frame_count = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
2008-03-24 00:35:53 +00:00
|
|
|
rb->lcd_blit_yuv(yuvbuf, 0, 0, YUV_WIDTH,
|
2007-10-13 22:32:35 +00:00
|
|
|
part14_x, part14_y, part14_w, part14_h);
|
|
|
|
frame_count++;
|
|
|
|
}
|
|
|
|
fps = calc_tenth_fps(frame_count, time_end - time_start);
|
|
|
|
rb->snprintf(str, sizeof(str), "1/4: %d.%d fps", fps / 10, fps % 10);
|
|
|
|
log_text(str);
|
|
|
|
}
|
2007-08-05 20:41:49 +00:00
|
|
|
#endif
|
2006-04-11 19:29:01 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2007-10-13 22:32:35 +00:00
|
|
|
static void time_remote_update(void)
|
|
|
|
{
|
|
|
|
char str[32]; /* text buffer */
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int frame_count;
|
|
|
|
int fps;
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
const int part14_x = LCD_REMOTE_WIDTH/4; /* x-offset for 1/4 update test */
|
|
|
|
const int part14_w = LCD_REMOTE_WIDTH/2; /* x-size for 1/4 update test */
|
|
|
|
const int part14_y = LCD_REMOTE_HEIGHT/4; /* y-offset for 1/4 update test */
|
|
|
|
const int part14_h = LCD_REMOTE_HEIGHT/2; /* y-size for 1/4 update test */
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2010-10-03 11:57:47 +00:00
|
|
|
log_text("Remote LCD Update");
|
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
/* Test 1: full LCD update */
|
2006-04-11 19:29:01 +00:00
|
|
|
frame_count = 0;
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->sleep(0); /* sync to tick */
|
2006-04-11 19:29:01 +00:00
|
|
|
time_start = *rb->current_tick;
|
2007-10-13 22:32:35 +00:00
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
2006-04-11 19:29:01 +00:00
|
|
|
{
|
|
|
|
rb->lcd_remote_update();
|
|
|
|
frame_count++;
|
|
|
|
}
|
2007-10-13 22:32:35 +00:00
|
|
|
fps = calc_tenth_fps(frame_count, time_end - time_start);
|
|
|
|
rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10);
|
|
|
|
log_text(str);
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
/* Test 2: quarter LCD update */
|
2006-04-11 19:29:01 +00:00
|
|
|
frame_count = 0;
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->sleep(0); /* sync to tick */
|
2006-04-11 19:29:01 +00:00
|
|
|
time_start = *rb->current_tick;
|
2007-10-13 22:32:35 +00:00
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
2006-04-11 19:29:01 +00:00
|
|
|
{
|
2007-10-13 22:32:35 +00:00
|
|
|
rb->lcd_remote_update_rect(part14_x, part14_y, part14_w, part14_h);
|
2006-04-11 19:29:01 +00:00
|
|
|
frame_count++;
|
|
|
|
}
|
2007-10-13 22:32:35 +00:00
|
|
|
fps = calc_tenth_fps(frame_count, time_end - time_start);
|
|
|
|
rb->snprintf(str, sizeof(str), "1/4: %d.%d fps", fps / 10, fps % 10);
|
|
|
|
log_text(str);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-03-25 23:21:36 +00:00
|
|
|
#if LCD_DEPTH < 4
|
2008-01-13 00:11:43 +00:00
|
|
|
|
2008-03-02 16:57:14 +00:00
|
|
|
GREY_INFO_STRUCT_IRAM
|
2008-01-08 00:06:54 +00:00
|
|
|
static unsigned char greydata[LCD_HEIGHT][LCD_WIDTH];
|
|
|
|
|
|
|
|
static void make_grey_rect(int width, int height)
|
|
|
|
{
|
|
|
|
unsigned char vline[LCD_WIDTH];
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
vline[x] = (x << 8) / width;
|
|
|
|
for (y = 0; y < height; y++)
|
|
|
|
rb->memcpy(greydata[y], vline, width);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_greyscale(void)
|
|
|
|
{
|
|
|
|
char str[32]; /* text buffer */
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
long time_1, time_2;
|
|
|
|
int frames_1, frames_2;
|
|
|
|
int fps, load;
|
2010-10-03 11:57:47 +00:00
|
|
|
size_t gbuf_size;
|
|
|
|
unsigned char *gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
|
2008-01-08 00:06:54 +00:00
|
|
|
|
2010-10-03 11:57:47 +00:00
|
|
|
#if NUM_CORES > 1
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < NUM_CORES; i++)
|
2008-01-08 00:06:54 +00:00
|
|
|
{
|
2010-10-03 11:57:47 +00:00
|
|
|
rb->snprintf(str, sizeof(str), "Greyscale (%s)",
|
|
|
|
(i > 0) ? "COP" : "CPU");
|
|
|
|
log_text(str);
|
|
|
|
#else
|
|
|
|
const int i = 0;
|
|
|
|
log_text("Greyscale library");
|
2008-01-08 00:06:54 +00:00
|
|
|
{
|
2010-10-03 11:57:47 +00:00
|
|
|
#endif
|
2008-01-08 00:06:54 +00:00
|
|
|
|
2010-10-03 11:57:47 +00:00
|
|
|
if (!grey_init(gbuf, gbuf_size, (i > 0) ? GREY_ON_COP : 0,
|
|
|
|
LCD_WIDTH, LCD_HEIGHT, NULL))
|
|
|
|
{
|
|
|
|
log_text("greylib: out of memory.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
make_grey_rect(LCD_WIDTH, LCD_HEIGHT);
|
|
|
|
|
|
|
|
/* Test 1 - greyscale overlay not yet enabled */
|
|
|
|
frames_1 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT);
|
|
|
|
frames_1++;
|
|
|
|
}
|
|
|
|
time_1 = time_end - time_start;
|
|
|
|
|
|
|
|
/* Test 2 - greyscale overlay enabled */
|
|
|
|
grey_show(true);
|
|
|
|
frames_2 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT);
|
|
|
|
frames_2++;
|
|
|
|
}
|
|
|
|
time_2 = time_end - time_start;
|
|
|
|
|
|
|
|
grey_release();
|
|
|
|
fps = calc_tenth_fps(frames_2, time_2);
|
|
|
|
load = 100 - (100 * frames_2 * time_1) / (frames_1 * time_2);
|
|
|
|
rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10);
|
2008-01-08 00:06:54 +00:00
|
|
|
log_text(str);
|
2010-10-03 11:57:47 +00:00
|
|
|
|
|
|
|
if (load > 0 && load < 100)
|
|
|
|
{
|
|
|
|
rb->snprintf(str, sizeof(str), "CPU load: %d%%", load);
|
|
|
|
log_text(str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
log_text("CPU load err (boost?)");
|
2008-01-08 00:06:54 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-29 20:47:56 +00:00
|
|
|
#endif
|
2008-01-08 00:06:54 +00:00
|
|
|
|
2012-01-26 23:15:15 +00:00
|
|
|
void plugin_quit(void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2012-01-29 20:51:26 +00:00
|
|
|
static struct touchbutton button[] = {{
|
|
|
|
.action = ACTION_STD_OK,
|
|
|
|
.title = "OK",
|
|
|
|
/* .vp runtime initialized, rest false/NULL */
|
|
|
|
}};
|
2012-01-26 23:15:15 +00:00
|
|
|
struct viewport *vp = &button[0].vp;
|
|
|
|
struct screen *lcd = rb->screens[SCREEN_MAIN];
|
|
|
|
rb->viewport_set_defaults(vp, SCREEN_MAIN);
|
|
|
|
const int border = 10;
|
|
|
|
const int height = 50;
|
|
|
|
|
|
|
|
lcd->set_viewport(vp);
|
|
|
|
/* button matches the bottom center in the grid */
|
|
|
|
vp->x = lcd->lcdwidth/3;
|
|
|
|
vp->width = lcd->lcdwidth/3;
|
|
|
|
vp->height = height;
|
|
|
|
vp->y = lcd->lcdheight - height - border;
|
|
|
|
|
|
|
|
touchbutton_draw(button, ARRAYLEN(button));
|
|
|
|
lcd->update_viewport();
|
|
|
|
if (rb->touchscreen_get_mode() == TOUCHSCREEN_POINT)
|
|
|
|
{
|
|
|
|
while(touchbutton_get(button, ARRAYLEN(button)) != ACTION_STD_OK);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
int btn = rb->button_get(true);
|
|
|
|
exit_on_usb(btn);
|
|
|
|
if (btn == FPS_QUIT)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
/* plugin entry point */
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2007-10-13 22:32:35 +00:00
|
|
|
{
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2007-10-13 22:32:35 +00:00
|
|
|
char str[32];
|
|
|
|
int cpu_freq;
|
|
|
|
#endif
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
/* standard stuff */
|
|
|
|
(void)parameter;
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2012-01-26 23:15:15 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
rb->touchscreen_set_mode(rb->global_settings->touch_mode);
|
|
|
|
#endif
|
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
log_init();
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2007-10-13 22:32:35 +00:00
|
|
|
cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
|
|
|
|
#endif
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_ignore_timeout();
|
2006-04-11 19:29:01 +00:00
|
|
|
|
2007-10-13 22:32:35 +00:00
|
|
|
time_main_update();
|
2010-12-27 22:08:34 +00:00
|
|
|
rb->sleep(HZ);
|
2009-06-21 14:09:48 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2)
|
2007-10-13 22:32:35 +00:00
|
|
|
time_main_yuv();
|
2007-08-05 20:41:49 +00:00
|
|
|
#endif
|
2008-03-25 23:21:36 +00:00
|
|
|
#if LCD_DEPTH < 4
|
2008-01-08 00:06:54 +00:00
|
|
|
time_greyscale();
|
|
|
|
#endif
|
2007-10-13 22:32:35 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
time_remote_update();
|
|
|
|
#endif
|
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2007-10-13 22:32:35 +00:00
|
|
|
if (*rb->cpu_frequency != cpu_freq)
|
|
|
|
rb->snprintf(str, sizeof(str), "CPU clock changed!");
|
|
|
|
else
|
|
|
|
rb->snprintf(str, sizeof(str), "CPU: %d MHz",
|
|
|
|
(cpu_freq + 500000) / 1000000);
|
|
|
|
log_text(str);
|
2006-04-11 19:29:01 +00:00
|
|
|
#endif
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_use_settings();
|
2006-04-08 10:27:34 +00:00
|
|
|
|
|
|
|
/* wait until user closes plugin */
|
2012-01-26 23:15:15 +00:00
|
|
|
plugin_quit();
|
2006-04-08 10:27:34 +00:00
|
|
|
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|