rename image_t to bopti_image_t through the code

This commit is contained in:
Lephe 2020-06-01 12:12:21 +02:00
parent dab3edfb9e
commit 09542e14a7
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
13 changed files with 25 additions and 224 deletions

199
main.c
View File

@ -258,205 +258,6 @@ void test_timer_freq(void)
}
}
void display_keys(volatile uint8_t *keys)
{
for(int r = 0; r < 8; r++) print_bin(1, r + 1, keys[r ^ 1], 8);
for(int r = 0; r < 4; r++) print_bin(10, r + 1, keys[(r + 8) ^ 1], 8);
}
void keysc_userland(void)
{
volatile uint16_t *KEYSC = (void *)0xa44b0000;
uint16_t buffer[6];
for(int counter = 0; counter < 4000; counter++)
{
for(int i = 0; i < 6; i++) buffer[i] = KEYSC[i];
if(buffer[3] & 0x0800) break;
dclear(color_white);
display_keys((volatile uint8_t *)buffer);
dupdate();
}
}
int keysc_callback(volatile void *arg)
{
volatile uint16_t *buf = arg;
volatile uint16_t *KEYSC = (void *)0xa44b0000;
for(int i = 0; i < 6; i++) buf[i] = KEYSC[i];
return 0;
}
void keysc_timer(void)
{
volatile uint16_t buffer[6] = { 0 };
int tid = 3;
/* 32 gives 1024 Hz */
/* 2048 gives 16 Hz */
#define DELAY 256
timer_setup(tid, DELAY, 0, keysc_callback, &buffer);
timer_start(tid);
dclear(color_white);
#ifdef FX9860G
# define LIMIT 4000
#else
# define LIMIT 500
#endif
for(int counter = 0; counter < LIMIT; counter++)
{
display_keys((volatile uint8_t *)buffer);
print(18, 8, "%4d", counter);
dupdate();
}
timer_stop(tid);
}
void test_kbd(void)
{
key_event_t ev;
key_event_t last = { .type = KEYEV_NONE };
const char *names[4] = { "NONE", "DOWN", "UP ", "HOLD" };
extern int time;
int pressed[12][8];
for(int i = 0; i < 12; i++) for(int j = 0; j < 8; j++) pressed[i][j]=0;
dclear(color_white);
while(1)
{
while((ev = pollevent()).type != KEYEV_NONE)
{
last = ev;
if(ev.type == KEYEV_DOWN && ev.key == KEY_EXIT) return;
int row = ev.key >> 4;
int col = ev.key & 0xf;
if(ev.type == KEYEV_DOWN) pressed[row][col] = 1;
if(ev.type == KEYEV_UP) pressed[row][col] = 0;
}
print(1, 4, "[%4d]", time);
print(1, 5, "%2x %s", last.key, names[last.type]);
for(int i = 0; i < 8; i++)
{
int x = (i < 8) ? 13 : 2;
int y = (i < 8) ? 8 - i : 12 - i;
for(int j = 0; j < 8; j++)
// Bdisp_SetPoint_VRAM(80 + 2 * j, 2 + 2 * i,
// pressed[i][j]);
print(x + j, y, pressed[i][j] ? "#" : "-");
}
extern volatile uint8_t state[12];
print(1,1,"%x %x %x %x",state[0],state[1],state[2],state[3]);
print(1,2,"%x %x %x %x",state[4],state[5],state[6],state[7]);
print(1,3,"%x %x %x %x",state[8],state[9],state[10],state[11]);
dupdate();
}
}
/* tmu_t - a single timer from a standard timer unit */
typedef volatile struct
{
uint32_t TCOR; /* Constant register */
uint32_t TCNT; /* Counter register, counts down */
word_union(TCR,
uint16_t :7;
uint16_t UNF :1; /* Underflow flag */
uint16_t :2;
uint16_t UNIE :1; /* Underflow interrupt enable */
uint16_t CKEG :2; /* Input clock edge */
uint16_t TPSC :3; /* Timer prescaler (input clock) */
);
} GPACKED(4) tmu_t;
/* tmu_extra_t - extra timers on sh7337, sh7355 and sh7305 */
typedef volatile struct
{
uint8_t TSTR; /* Only bit 0 is used */
pad(3);
uint32_t TCOR; /* Constant register */
uint32_t TCNT; /* Counter register */
byte_union(TCR,
uint8_t :6;
uint8_t UNF :1; /* Underflow flag */
uint8_t UNIE :1; /* Underflow interrupt enable */
);
} GPACKED(4) tmu_extra_t;
/* This is the description of the structure on SH4. SH3-based fx9860g models,
which are already very rare, will adapt the values in init functions */
tmu_t *std[3] = {
(void *)0xa4490008,
(void *)0xa4490014,
(void *)0xa4490020,
};
tmu_extra_t *ext[6] = {
(void *)0xa44d0030,
(void *)0xa44d0050,
(void *)0xa44d0070,
(void *)0xa44d0090,
(void *)0xa44d00b0,
(void *)0xa44d00d0,
};
tmu_t *std3[3] = {
(void *)0xfffffe94,
(void *)0xfffffea0,
(void *)0xfffffeac,
};
tmu_extra_t *ext3[1] = {
(void *)0xa44c0030,
};
void initial_timer_status(void)
{
dclear(color_white);
print(1, 1, "STR");
print(1, 2, "TCR");
print(1, 3, "COR");
print(1, 4, "CNT");
print(1, 5, "TCR");
print(1, 6, "COR");
print(1, 7, "CNT");
for(int i = 0; i < 3; i++)
{
tmu_t *t = (isSH3() ? std3[i] : std[i]);
print(5 + 5*i, 5, "%4x", t->TCR.word);
print(5 + 5*i, 6, (t->TCOR == 0xffffffff) ? "ffff" : "????");
print(5 + 5*i, 7, (t->TCNT == 0xffffffff) ? "ffff" : "????");
}
for(int i = 0; i < (isSH3() ? 1 : 6); i++)
{
tmu_extra_t *t = (isSH3() ? ext3[i] : ext[i]);
print(5 + 3*i, 1, "%2x", t->TSTR);
print(5 + 3*i, 2, "%2x", t->TCR.byte);
print(5 + 3*i, 3, (t->TCOR == 0xffffffff) ? "ff" : "??");
print(5 + 3*i, 4, (t->TCNT == 0xffffffff) ? "ff" : "??");
}
dupdate();
}
#ifdef FX9860G
void fx_frame1(void)
{

View File

@ -9,10 +9,10 @@
void gintctl_gint_bopti(void)
{
#ifdef FXCG50
extern image_t img_swift;
extern image_t img_swords;
extern image_t img_potion_17x22, img_potion_18x22, img_potion_21x22;
extern image_t img_applejack_31x27, img_applejack_36x25;
extern bopti_image_t img_swift;
extern bopti_image_t img_swords;
extern bopti_image_t img_potion_17x22, img_potion_18x22, img_potion_21x22;
extern bopti_image_t img_applejack_31x27, img_applejack_36x25;
int key = 0, x, y;
while(key != KEY_EXIT)

View File

@ -70,7 +70,7 @@ void gintctl_gint_dma(void)
dprint(1, 48, "Source %s", source ? "IL" : "RAM");
dprint(103, 40, "%d", successes);
extern image_t img_opt_gint_dma;
extern bopti_image_t img_opt_gint_dma;
dimage(0, 56, &img_opt_gint_dma);
#endif

View File

@ -105,7 +105,7 @@ void gintctl_gint_dump(void)
regs[region].segment_count);
row_print(5, 1, "File: %s", filename);
extern image_t img_opt_dump;
extern bopti_image_t img_opt_dump;
dimage(0, 56, &img_opt_dump);
if(retcode == 1) dprint(77, 56, C_BLACK,C_NONE, "Done!");

View File

@ -35,7 +35,7 @@ void gintctl_gint_gray(void)
grect(96, 16, 127, 31, C_LIGHT);
grect(96, 32, 127, 47, C_DARK);
extern image_t img_opt_gint_gray;
extern bopti_image_t img_opt_gint_gray;
gimage(0, 56, &img_opt_gint_gray);
gupdate();
@ -101,10 +101,10 @@ void gintctl_gint_grayrender(void)
gtext(x + 8, y + 9, "Darken", C_DARKEN, C_NONE);
gtext(x + 8, y + 17, "Invert", C_INVERT, C_NONE);
extern image_t img_profile_mono;
extern image_t img_profile_mono_alpha;
extern image_t img_profile_gray;
extern image_t img_profile_gray_alpha;
extern bopti_image_t img_profile_mono;
extern bopti_image_t img_profile_mono_alpha;
extern bopti_image_t img_profile_gray;
extern bopti_image_t img_profile_gray_alpha;
x = 8, y = 32;
for(int c = 0; c < 8; c++)

View File

@ -30,8 +30,8 @@ void render_keyboard(void)
GUNUSED int x, y, w, h;
#ifdef FXCG50
extern image_t img_kbd_pressed;
extern image_t img_kbd_released;
extern bopti_image_t img_kbd_pressed;
extern bopti_image_t img_kbd_released;
dimage(15, 21, &img_kbd_released);
#endif
@ -53,8 +53,8 @@ void render_keyboard(void)
#endif
#ifdef FX9860G
extern image_t img_keypress;
extern image_t img_keyrelease;
extern bopti_image_t img_keypress;
extern bopti_image_t img_keyrelease;
position(row, col, &x, &y, &w, &h);
if(keydown(code)) dimage(x, y, &img_keypress);
else dimage(x, y, &img_keyrelease);

View File

@ -91,7 +91,7 @@ void gintctl_gint_ram(void)
row_print(5, 2, "YRAM: %d bytes", Y);
row_print(6, 2, "MERAM: %d bytes", ME);
extern image_t img_opt_gint_ram;
extern bopti_image_t img_opt_gint_ram;
dimage(0, 56, &img_opt_gint_ram);
#endif

View File

@ -154,8 +154,8 @@ static void system_contexts(void)
dclear(C_WHITE);
#ifdef FX9860G
extern image_t img_opt_switch_ctx_sh3;
extern image_t img_opt_switch_ctx;
extern bopti_image_t img_opt_switch_ctx_sh3;
extern bopti_image_t img_opt_switch_ctx;
if(isSH3())
dimage(0, 56, &img_opt_switch_ctx_sh3);
@ -208,7 +208,7 @@ void render(void)
dclear(C_WHITE);
#ifdef FX9860G
extern image_t img_opt_switch;
extern bopti_image_t img_opt_switch;
row_print(1, 1, "Switch to OS");
row_print(3, 1, "Switches done: %d", switches);
row_print(4, 1, "Fast done: %d", fast);

View File

@ -112,7 +112,7 @@ void gintctl_gint_timer(void)
if(tab == 2) show_etmu_1();
if(tab == 3) show_etmu_2();
extern image_t img_opt_gint_timers;
extern bopti_image_t img_opt_gint_timers;
dimage(0, 56, &img_opt_gint_timers);
if(tid < 3) dprint(23, 56, C_BLACK, C_NONE, "TMU%d", tid);

View File

@ -136,7 +136,7 @@ int main(GUNUSED int isappli, GUNUSED int optnum)
else gintctl_main();
#ifdef FX9860G
extern image_t img_opt_main;
extern bopti_image_t img_opt_main;
dimage(0, 56, &img_opt_main);
#endif

View File

@ -118,7 +118,7 @@ void gintctl_mem(void)
}
#ifdef FX9860G
extern image_t img_opt_mem;
extern bopti_image_t img_opt_mem;
dsubimage(0, 56, &img_opt_mem, 0, 0, 128, 8, DIMAGE_NONE);
if(view_ascii) dsubimage(23, 56, &img_opt_mem, 23, 9, 21, 8,

View File

@ -55,7 +55,7 @@ void gintctl_perf_libprof(void)
row_print(6, 1, "Empty: %d us", empty);
}
extern image_t img_opt_perf_libprof;
extern bopti_image_t img_opt_perf_libprof;
dimage(0, 56, &img_opt_perf_libprof);
#endif /* FX9860G */

View File

@ -39,7 +39,7 @@ static void run_test(struct elapsed *time)
);
#ifdef FXCG50
extern image_t img_swift;
extern bopti_image_t img_swift;
test(time->fs_r5g6b5,
dimage(0, 0, &img_swift)
);
@ -78,7 +78,7 @@ void gintctl_perf_render(void)
row_print(6, 1, "rect3: %s", printtime(time.rect3));
}
extern image_t img_opt_perf_render;
extern bopti_image_t img_opt_perf_render;
dimage(0, 56, &img_opt_perf_render);
#endif