2009-06-20 18:12:34 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 by Jens Arnold
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2010-06-04 13:54:35 +00:00
|
|
|
|
|
|
|
//#define TEST_GREYLIB /* Uncomment for testing greylib instead of core gfx */
|
|
|
|
|
2009-06-20 18:12:34 +00:00
|
|
|
#include "plugin.h"
|
2010-06-04 13:54:35 +00:00
|
|
|
#ifdef TEST_GREYLIB /* otherwise, mylcd defaults to core gfx */
|
2009-06-20 18:12:34 +00:00
|
|
|
#include "lib/grey.h"
|
2010-06-04 13:54:35 +00:00
|
|
|
#endif
|
2009-06-20 18:12:34 +00:00
|
|
|
#include "lib/helper.h"
|
2010-06-04 13:22:50 +00:00
|
|
|
#include "lib/mylcd.h"
|
2009-06-20 18:12:34 +00:00
|
|
|
|
|
|
|
#ifdef TEST_GREYLIB
|
|
|
|
GREY_INFO_STRUCT
|
|
|
|
static unsigned char *gbuf;
|
|
|
|
static size_t gbuf_size = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define DURATION (HZ) /* longer duration gives more precise results */
|
|
|
|
#define RND_SEED 0x43A678C3 /* arbirary */
|
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2009-06-20 18:12:34 +00:00
|
|
|
|
|
|
|
static uint16_t rand_table[0x400];
|
|
|
|
static int log_fd;
|
|
|
|
|
|
|
|
|
|
|
|
static int log_init(void)
|
|
|
|
{
|
|
|
|
char logfilename[MAX_PATH];
|
|
|
|
int fd;
|
|
|
|
|
2011-12-25 20:11:18 +00:00
|
|
|
rb->create_numbered_filename(logfilename, HOME_DIR, "test_gfx_log_", ".txt",
|
2009-06-20 18:12:34 +00:00
|
|
|
2 IF_CNFN_NUM_(, NULL));
|
2010-05-06 17:35:13 +00:00
|
|
|
fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
2009-06-20 18:12:34 +00:00
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void init_rand_table(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
rb->srand(RND_SEED); /* make it reproducable */
|
|
|
|
for (i = 0; i < 0x400; i++)
|
|
|
|
rand_table[i] = rb->rand();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_drawpixel(void)
|
|
|
|
{
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int count1, count2, count3, count4;
|
|
|
|
|
|
|
|
/* Test 1: DRMODE_SOLID */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_SOLID);
|
2009-06-20 18:12:34 +00:00
|
|
|
count1 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count1++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Test 2: DRMODE_FG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_FG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count2 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count2++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 3: DRMODE_BG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_BG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count3 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count3++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 4: DRMODE_COMPLEMENT */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
2009-06-20 18:12:34 +00:00
|
|
|
count4 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count4++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rb->fdprintf(log_fd, "lcd_drawpixel (pixels/s): %d/%d/%d/%d\n",
|
|
|
|
count1, count2, count3, count4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_drawline(void)
|
|
|
|
{
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int count1, count2, count3, count4;
|
|
|
|
|
|
|
|
/* Test 1: DRMODE_SOLID */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_SOLID);
|
2009-06-20 18:12:34 +00:00
|
|
|
count1 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Test 2: DRMODE_FG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_FG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count2 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 3: DRMODE_BG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_BG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count3 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 4: DRMODE_COMPLEMENT */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
2009-06-20 18:12:34 +00:00
|
|
|
count4 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rb->fdprintf(log_fd, "lcd_drawline (lines/s): %d/%d/%d/%d\n",
|
|
|
|
count1, count2, count3, count4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_hline(void)
|
|
|
|
{
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int count1, count2, count3, count4;
|
|
|
|
|
|
|
|
/* Test 1: DRMODE_SOLID */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_SOLID);
|
2009-06-20 18:12:34 +00:00
|
|
|
count1 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Test 2: DRMODE_FG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_FG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count2 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 3: DRMODE_BG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_BG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count3 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 4: DRMODE_COMPLEMENT */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
2009-06-20 18:12:34 +00:00
|
|
|
count4 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rb->fdprintf(log_fd, "lcd_hline (lines/s): %d/%d/%d/%d\n",
|
|
|
|
count1, count2, count3, count4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_vline(void)
|
|
|
|
{
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int count1, count2, count3, count4;
|
|
|
|
|
|
|
|
/* Test 1: DRMODE_SOLID */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_SOLID);
|
2009-06-20 18:12:34 +00:00
|
|
|
count1 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Test 2: DRMODE_FG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_FG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count2 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 3: DRMODE_BG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_BG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count3 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 4: DRMODE_COMPLEMENT */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
2009-06-20 18:12:34 +00:00
|
|
|
count4 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rb->fdprintf(log_fd, "lcd_vline (lines/s): %d/%d/%d/%d\n",
|
|
|
|
count1, count2, count3, count4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_fillrect(void)
|
|
|
|
{
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int count1, count2, count3, count4;
|
|
|
|
|
|
|
|
/* Test 1: DRMODE_SOLID */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_SOLID);
|
2009-06-20 18:12:34 +00:00
|
|
|
count1 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Test 2: DRMODE_FG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_FG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count2 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 3: DRMODE_BG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_BG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count3 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 4: DRMODE_COMPLEMENT */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
2009-06-20 18:12:34 +00:00
|
|
|
count4 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
|
|
|
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
|
|
|
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rb->fdprintf(log_fd, "lcd_fillrect (rects/s): %d/%d/%d/%d\n",
|
|
|
|
count1, count2, count3, count4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void time_text(void) /* tests mono_bitmap performance */
|
|
|
|
{
|
|
|
|
long time_start; /* start tickcount */
|
|
|
|
long time_end; /* end tickcount */
|
|
|
|
int count1, count2, count3, count4;
|
|
|
|
|
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
/* Test 1: DRMODE_SOLID */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_SOLID);
|
2009-06-20 18:12:34 +00:00
|
|
|
count1 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count1++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Test 2: DRMODE_FG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_FG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count2 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count2++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 3: DRMODE_BG */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_BG);
|
2009-06-20 18:12:34 +00:00
|
|
|
count3 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count3++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
/* Test 4: DRMODE_COMPLEMENT */
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
2009-06-20 18:12:34 +00:00
|
|
|
count4 = 0;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count4++ & 0x3ff];
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
2009-06-20 18:12:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rb->fdprintf(log_fd, "lcd_putsxy (strings/s): %d/%d/%d/%d\n",
|
|
|
|
count1, count2, count3, count4);
|
|
|
|
}
|
|
|
|
|
2014-01-07 13:06:26 +00:00
|
|
|
static void time_put_line(void) /* tests put_line performance */
|
|
|
|
{
|
|
|
|
long time_start, time_end;
|
|
|
|
int count1, count2, count3, count4;
|
|
|
|
struct screen *display = rb->screens[SCREEN_MAIN];
|
|
|
|
const char fmt[] = "$iRockbox!";
|
|
|
|
|
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
|
|
|
count1 = count2 = count3 = count4 = 0;
|
|
|
|
|
|
|
|
struct line_desc desc = LINE_DESC_DEFINIT;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count1++ & 0x3ff];
|
|
|
|
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
|
|
|
|
}
|
|
|
|
|
|
|
|
desc.style = STYLE_INVERT;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count2++ & 0x3ff];
|
|
|
|
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
|
|
|
|
}
|
|
|
|
|
|
|
|
desc.style = STYLE_COLORBAR;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count3++ & 0x3ff];
|
|
|
|
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
|
|
|
|
}
|
|
|
|
|
|
|
|
desc.style = STYLE_GRADIENT;
|
|
|
|
rb->sleep(0); /* sync to tick */
|
|
|
|
time_start = *rb->current_tick;
|
|
|
|
while((time_end = *rb->current_tick) - time_start < DURATION)
|
|
|
|
{
|
|
|
|
unsigned rnd = rand_table[count4++ & 0x3ff];
|
|
|
|
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
|
|
|
|
}
|
|
|
|
|
|
|
|
rb->fdprintf(log_fd, "\nput_line (lines (icon+text)/s): \n"
|
|
|
|
" default: %d\n"
|
|
|
|
" inverted: %d\n"
|
|
|
|
" colorbar: %d\n"
|
|
|
|
" gradient: %d\n",
|
|
|
|
count1, count2, count3, count4);
|
|
|
|
}
|
|
|
|
|
2009-06-20 18:12:34 +00:00
|
|
|
/* plugin entry point */
|
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
|
|
|
{
|
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
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2009-06-20 18:12:34 +00:00
|
|
|
int cpu_freq;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* standard stuff */
|
|
|
|
(void)parameter;
|
|
|
|
|
|
|
|
log_fd = log_init();
|
|
|
|
if (log_fd < 0)
|
|
|
|
{
|
|
|
|
rb->splash(HZ, "Could not create logfile");
|
|
|
|
return PLUGIN_ERROR;
|
|
|
|
}
|
|
|
|
rb->fdprintf(log_fd, "%s",
|
|
|
|
#ifdef TEST_GREYLIB
|
|
|
|
"Greylib performance test.\n"
|
|
|
|
#else
|
|
|
|
"LCD driver performance test.\n"
|
|
|
|
#endif
|
|
|
|
"----------------------------\n\n"
|
|
|
|
"Results are printed in the following drawmode order:\n"
|
|
|
|
"solid/foreground/background/complement\n\n");
|
|
|
|
|
|
|
|
#ifdef TEST_GREYLIB
|
|
|
|
/* get the remainder of the plugin buffer */
|
|
|
|
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
|
|
|
|
|
|
|
|
/* initialize the greyscale buffer.*/
|
|
|
|
if (!grey_init(gbuf, gbuf_size, GREY_BUFFERED|GREY_ON_COP,
|
|
|
|
LCD_WIDTH, LCD_HEIGHT, NULL))
|
|
|
|
{
|
|
|
|
rb->close(log_fd);
|
|
|
|
rb->splash(HZ, "Couldn't init greyscale library");
|
|
|
|
return PLUGIN_ERROR;
|
|
|
|
}
|
|
|
|
#elif LCD_DEPTH > 1
|
|
|
|
rb->lcd_set_backdrop(NULL);
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
#endif
|
2020-07-24 23:42:32 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_ignore_timeout();
|
2020-07-24 23:42:32 +00:00
|
|
|
#endif
|
2009-06-20 18:12:34 +00:00
|
|
|
rb->splashf(0, "LCD driver performance test, please wait %d sec",
|
2014-01-07 13:06:26 +00:00
|
|
|
7*4*DURATION/HZ);
|
2009-06-20 18:12:34 +00:00
|
|
|
init_rand_table();
|
|
|
|
|
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
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2009-06-20 18:12:34 +00:00
|
|
|
cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
time_drawpixel();
|
|
|
|
time_drawline();
|
|
|
|
time_hline();
|
|
|
|
time_vline();
|
|
|
|
time_fillrect();
|
|
|
|
time_text();
|
2014-01-07 13:06:26 +00:00
|
|
|
time_put_line();
|
2009-06-20 18:12:34 +00:00
|
|
|
|
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
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2009-06-20 18:12:34 +00:00
|
|
|
if (*rb->cpu_frequency != cpu_freq)
|
|
|
|
rb->fdprintf(log_fd, "\nCPU: %s\n", "clock changed!");
|
|
|
|
else
|
|
|
|
rb->fdprintf(log_fd, "\nCPU: %d MHz\n",
|
|
|
|
(cpu_freq + 500000) / 1000000);
|
|
|
|
#endif
|
|
|
|
rb->close(log_fd);
|
2020-07-24 23:42:32 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2009-06-20 18:12:34 +00:00
|
|
|
backlight_use_settings();
|
2020-07-24 23:42:32 +00:00
|
|
|
#endif
|
2009-06-20 18:12:34 +00:00
|
|
|
#ifdef TEST_GREYLIB
|
|
|
|
grey_release();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|