gint/overclock: add overclocking test
This commit is contained in:
parent
6e993ff99b
commit
7e9b26f42c
|
@ -26,9 +26,10 @@ set(SOURCES
|
|||
src/gint/dsp.s
|
||||
src/gint/dump.c
|
||||
src/gint/gray.c
|
||||
src/gint/image.c
|
||||
src/gint/keyboard.c
|
||||
src/gint/kmalloc.c
|
||||
src/gint/image.c
|
||||
src/gint/overclock.c
|
||||
src/gint/ram.c
|
||||
src/gint/rtc.c
|
||||
src/gint/spuram.c
|
||||
|
|
|
@ -26,6 +26,9 @@ void gintctl_gint_drivers(void);
|
|||
/* gintctl_gint_tlb(): TLB miss handler and TLB management */
|
||||
void gintctl_gint_tlb(void);
|
||||
|
||||
/* gintctl_gint_overclock(): Clock speed detection and setting */
|
||||
void gintctl_gint_overclock(void);
|
||||
|
||||
/* gintct_gint_keyboard: Real-time keyboard visualization */
|
||||
void gintctl_gint_keyboard(void);
|
||||
|
||||
|
|
|
@ -156,13 +156,7 @@ static void scene_2(void)
|
|||
int cx2=cx1, cy2=cy1;
|
||||
image_rotate_around_scale(train, 1.4, 1.3*65536, true, &cx2, &cy2, &map);
|
||||
|
||||
int new_format =
|
||||
IMAGE_IS_RGB16(train->format) ? IMAGE_RGB565A : IMAGE_P8_RGB565A;
|
||||
image_t *tmp = image_alloc(map.dst_w, map.dst_h, new_format);
|
||||
image_copy_palette(train, tmp, -1);
|
||||
image_clear(tmp);
|
||||
|
||||
image_linear(train, tmp, &map);
|
||||
image_t *tmp = image_linear_alloc(train, &map);
|
||||
image_copy(tmp, image_at(vram, 10, 10), true);
|
||||
|
||||
dprint(4, 116, C_BLACK, "Center: %d %d -> %d %d", cx1, cy1, cx2, cy2);
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
#include <gint/display.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include <gint/clock.h>
|
||||
#include <gint/timer.h>
|
||||
#include <gint/mpu/cpg.h>
|
||||
#include <gint/mpu/bsc.h>
|
||||
|
||||
#include <gintctl/gint.h>
|
||||
#include <gintctl/util.h>
|
||||
|
||||
#include <libprof.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef FXCG50
|
||||
|
||||
#define CPG SH7305_CPG
|
||||
#define BSC SH7305_BSC
|
||||
|
||||
char const *level_string(int level)
|
||||
{
|
||||
static char str[32];
|
||||
|
||||
if(level == CLOCK_SPEED_UNKNOWN)
|
||||
return "UNKNOWN";
|
||||
if(level == CLOCK_SPEED_F1)
|
||||
return "Ftune's F1";
|
||||
if(level == CLOCK_SPEED_F2)
|
||||
return "Ftune's F2";
|
||||
if(level == CLOCK_SPEED_F3)
|
||||
return "Ftune's F3";
|
||||
if(level == CLOCK_SPEED_F4)
|
||||
return "Ftune's F4";
|
||||
if(level == CLOCK_SPEED_F5)
|
||||
return "Ftune's F5";
|
||||
|
||||
snprintf(str, 32, "<Level %d>", level);
|
||||
return str;
|
||||
}
|
||||
|
||||
static int callback(volatile int *counter, volatile int *update)
|
||||
{
|
||||
(*counter)++;
|
||||
*update = 1;
|
||||
return TIMER_CONTINUE;
|
||||
}
|
||||
|
||||
void gintctl_gint_overclock(void)
|
||||
{
|
||||
int key = 0;
|
||||
volatile int counter = 0;
|
||||
volatile int update = 0;
|
||||
|
||||
int t = timer_configure(TIMER_TMU, 100000,
|
||||
GINT_CALL(callback, &counter, &update));
|
||||
if(t >= 0)
|
||||
timer_start(t);
|
||||
|
||||
while(key != KEY_EXIT) {
|
||||
int level = clock_get_speed();
|
||||
|
||||
uint32_t time_dclear = prof_exec({
|
||||
dclear(C_WHITE);
|
||||
});
|
||||
row_title("Clock speed detection and setting");
|
||||
|
||||
row_print( 1, 29, "FLLFRQ:");
|
||||
row_print( 2, 29, "FRQCR:");
|
||||
row_print( 3, 29, "CS0BCR:");
|
||||
row_print( 4, 29, "CS2BCR:");
|
||||
row_print( 5, 29, "CS3BCR:");
|
||||
row_print( 6, 29, "CS5aBCR:");
|
||||
row_print( 7, 29, "CS0WCR:");
|
||||
row_print( 8, 29, "CS2WCR:");
|
||||
row_print( 9, 29, "CS3WCR:");
|
||||
row_print(10, 29, "CS5aWCR:");
|
||||
|
||||
row_print( 1, 38, "0x%08x", CPG.FLLFRQ.lword);
|
||||
row_print( 2, 38, "0x%08x", CPG.FRQCR.lword);
|
||||
row_print( 3, 38, "0x%08x", BSC.CS0BCR.lword);
|
||||
row_print( 4, 38, "0x%08x", BSC.CS2BCR.lword);
|
||||
row_print( 5, 38, "0x%08x", BSC.CS3BCR.lword);
|
||||
row_print( 6, 38, "0x%08x", BSC.CS5ABCR.lword);
|
||||
row_print( 7, 38, "0x%08x", BSC.CS0WCR.lword);
|
||||
row_print( 8, 38, "0x%08x", BSC.CS2WCR.lword);
|
||||
row_print( 9, 38, "0x%08x", BSC.CS3WCR.lword);
|
||||
row_print(10, 38, "0x%08x", BSC.CS5AWCR.lword);
|
||||
|
||||
row_print(1, 1, "Detected level: %s", level_string(level));
|
||||
row_print(2, 1, "dclear(): %d us", time_dclear);
|
||||
if(t >= 0)
|
||||
row_print(3, 1, "Timer: %.1D s", counter);
|
||||
else
|
||||
row_print(3, 1, "Timer: none available");
|
||||
|
||||
fkey_button(1, "Set: F1");
|
||||
fkey_button(2, "Set: F2");
|
||||
fkey_button(3, "Set: F3");
|
||||
fkey_button(4, "Set: F4");
|
||||
fkey_button(5, "Set: F5");
|
||||
dupdate();
|
||||
|
||||
key = getkey_opt(GETKEY_DEFAULT, &update).key;
|
||||
update = 0;
|
||||
|
||||
if(key == KEY_F1) clock_set_speed(CLOCK_SPEED_F1);
|
||||
if(key == KEY_F2) clock_set_speed(CLOCK_SPEED_F2);
|
||||
if(key == KEY_F3) clock_set_speed(CLOCK_SPEED_F3);
|
||||
if(key == KEY_F4) clock_set_speed(CLOCK_SPEED_F4);
|
||||
if(key == KEY_F5) clock_set_speed(CLOCK_SPEED_F5);
|
||||
}
|
||||
|
||||
if(t >= 0)
|
||||
timer_stop(t);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -43,6 +43,9 @@ struct menu menu_gint = {
|
|||
{ "Memory dump", gintctl_gint_dump, 0 },
|
||||
{ "Drivers and worlds", gintctl_gint_drivers, 0 },
|
||||
{ "TLB management", gintctl_gint_tlb, 0 },
|
||||
#ifdef FXCG50
|
||||
{ "Overclocking", gintctl_gint_overclock, MENU_SH4_ONLY },
|
||||
#endif
|
||||
{ "Memory allocation", gintctl_gint_kmalloc, 0 },
|
||||
{ "Keyboard", gintctl_gint_keyboard, 0 },
|
||||
{ "Timers", gintctl_gint_timer, 0 },
|
||||
|
|
Loading…
Reference in New Issue