2022-05-27 11:57:55 +02:00
|
|
|
#include <vhex/defs/types.h>
|
|
|
|
#include <vhex/driver.h>
|
|
|
|
#include <vhex/driver/screen/r61524.h>
|
2022-06-20 16:29:28 +02:00
|
|
|
#include <vhex/display/interface.h>
|
2022-02-13 15:01:01 +01:00
|
|
|
|
2022-05-27 11:57:55 +02:00
|
|
|
//---
|
|
|
|
// R61524 driver API
|
|
|
|
//---
|
2022-02-13 15:01:01 +01:00
|
|
|
|
2022-05-27 11:57:55 +02:00
|
|
|
/* r61524_frame_start() - prepar the screen and reset surfaces */
|
VxKernel 0.6.0-13 : Add keyboard API + update timer API
@add
<> include/vhex/driver/mpu/sh/sh7305/keysc
| add internal driver primitives
<> include/vhex/driver/mpu/sh/sh7305/tmu
| add internal driver primitives
<> include/vhex/keyboard
| add getkey* (high-level) API
| add key event API
| add key status API
| add keycode information
| add keyboard driver interface
@update
<> include/vhex/driver
| add KEYBOARD driver flags
<> include/vhex/keyboard
| isolate each part of the keyboard module
| link the keycache part with the driver-provided keycache information
<> src/drivers/mpu/sh/sh7305/keysc
| use the new keycache API (high-level interrupt handler)
| update keycache API
| link the new API in the driver device
<> src/drivers/mpu/sh/sh7305/tmu
| add timer reservation (WIP)
| use a "reservation" cache to known which timer is free instead of hardware
| rename internal functions
<> src/module/display
| Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t
| use dsubimage dstack primitive in dimage()
@fix
<> board/fxcg50/fxcg50.ld
| remove the IL-memory and allow only the X-memory area. This because the
bootloader uses the IL-memory for DMA transfer and other "low-level"
routine used by Gint.
Moreover, I originally try to move each "display-driver" in this place,
but after some profiling and tests, the dclear()/dupdate() combo went from
9155us up to 33250us (for many reason). So, I keep this area free, but I
moved-back from RAM display routines.
<> board/fxcg50/initialize
| remove "section" copy. This role has been delegated to the bootload (vxBoot)
because, in the final ELF file generated by GCC, many relocalization
information for the IL/X memory has been set and the bootloader cannot
performs general relocalization.
So, all "special section/memory" displacement has been moved in the
bootloader and we don't have to worrying about the section copy.
<> src/drivers/mpu/sh/sh7305/tmu
| fix delay calculation in timer reload primitive
| disable interruption for profiling timer
<> src/module/dislay/
| fix shader index used during the dstack_render()
| fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
|
|
|
VALIGNED(4) int r61524_frame_start(dsurface_t *surface)
|
2022-05-27 11:57:55 +02:00
|
|
|
{
|
|
|
|
/* Set the windows size */
|
|
|
|
r61524_select(horizontal_ram_start);
|
|
|
|
r61524_write(0);
|
|
|
|
r61524_select(horizontal_ram_end);
|
|
|
|
r61524_write(395);
|
|
|
|
r61524_select(vertical_ram_start);
|
|
|
|
r61524_write(0);
|
|
|
|
r61524_select(vertical_ram_end);
|
|
|
|
r61524_write(223);
|
|
|
|
|
|
|
|
/* Set the RAM position */
|
|
|
|
r61524_select(ram_address_horizontal);
|
|
|
|
r61524_write(0);
|
|
|
|
r61524_select(ram_address_vertical);
|
|
|
|
r61524_write(0);
|
|
|
|
|
|
|
|
/* Bind address 0xb4000000 to the data write command */
|
|
|
|
r61524_select(write_data);
|
|
|
|
|
|
|
|
/* initialize surface information */
|
2022-06-20 16:29:28 +02:00
|
|
|
surface->vram = (void*)0xe5017000;
|
2022-05-27 11:57:55 +02:00
|
|
|
surface->width = 396;
|
|
|
|
surface->height = 10;
|
2022-06-19 20:11:52 +02:00
|
|
|
surface->x1 = 0;
|
|
|
|
surface->y1 = 0;
|
|
|
|
surface->x2 = 395;
|
|
|
|
surface->y2 = 9;
|
2022-05-27 11:57:55 +02:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
VxKernel 0.6.0-13 : Add keyboard API + update timer API
@add
<> include/vhex/driver/mpu/sh/sh7305/keysc
| add internal driver primitives
<> include/vhex/driver/mpu/sh/sh7305/tmu
| add internal driver primitives
<> include/vhex/keyboard
| add getkey* (high-level) API
| add key event API
| add key status API
| add keycode information
| add keyboard driver interface
@update
<> include/vhex/driver
| add KEYBOARD driver flags
<> include/vhex/keyboard
| isolate each part of the keyboard module
| link the keycache part with the driver-provided keycache information
<> src/drivers/mpu/sh/sh7305/keysc
| use the new keycache API (high-level interrupt handler)
| update keycache API
| link the new API in the driver device
<> src/drivers/mpu/sh/sh7305/tmu
| add timer reservation (WIP)
| use a "reservation" cache to known which timer is free instead of hardware
| rename internal functions
<> src/module/display
| Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t
| use dsubimage dstack primitive in dimage()
@fix
<> board/fxcg50/fxcg50.ld
| remove the IL-memory and allow only the X-memory area. This because the
bootloader uses the IL-memory for DMA transfer and other "low-level"
routine used by Gint.
Moreover, I originally try to move each "display-driver" in this place,
but after some profiling and tests, the dclear()/dupdate() combo went from
9155us up to 33250us (for many reason). So, I keep this area free, but I
moved-back from RAM display routines.
<> board/fxcg50/initialize
| remove "section" copy. This role has been delegated to the bootload (vxBoot)
because, in the final ELF file generated by GCC, many relocalization
information for the IL/X memory has been set and the bootloader cannot
performs general relocalization.
So, all "special section/memory" displacement has been moved in the
bootloader and we don't have to worrying about the section copy.
<> src/drivers/mpu/sh/sh7305/tmu
| fix delay calculation in timer reload primitive
| disable interruption for profiling timer
<> src/module/dislay/
| fix shader index used during the dstack_render()
| fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
|
|
|
VALIGNED(4) int r61524_frame_frag_next(dsurface_t *surface)
|
2022-05-27 11:57:55 +02:00
|
|
|
{
|
2022-06-19 20:11:52 +02:00
|
|
|
surface->y1 += 10;
|
|
|
|
if (surface->y1 >= 224) {
|
|
|
|
surface->y1 -= 10;
|
2022-05-27 11:57:55 +02:00
|
|
|
return (-1);
|
|
|
|
}
|
2022-06-19 20:11:52 +02:00
|
|
|
|
|
|
|
if (surface->y1 >= 220)
|
|
|
|
surface->height = 4;
|
|
|
|
surface->y2 += surface->height;
|
2022-05-27 11:57:55 +02:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
VxKernel 0.6.0-13 : Add keyboard API + update timer API
@add
<> include/vhex/driver/mpu/sh/sh7305/keysc
| add internal driver primitives
<> include/vhex/driver/mpu/sh/sh7305/tmu
| add internal driver primitives
<> include/vhex/keyboard
| add getkey* (high-level) API
| add key event API
| add key status API
| add keycode information
| add keyboard driver interface
@update
<> include/vhex/driver
| add KEYBOARD driver flags
<> include/vhex/keyboard
| isolate each part of the keyboard module
| link the keycache part with the driver-provided keycache information
<> src/drivers/mpu/sh/sh7305/keysc
| use the new keycache API (high-level interrupt handler)
| update keycache API
| link the new API in the driver device
<> src/drivers/mpu/sh/sh7305/tmu
| add timer reservation (WIP)
| use a "reservation" cache to known which timer is free instead of hardware
| rename internal functions
<> src/module/display
| Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t
| use dsubimage dstack primitive in dimage()
@fix
<> board/fxcg50/fxcg50.ld
| remove the IL-memory and allow only the X-memory area. This because the
bootloader uses the IL-memory for DMA transfer and other "low-level"
routine used by Gint.
Moreover, I originally try to move each "display-driver" in this place,
but after some profiling and tests, the dclear()/dupdate() combo went from
9155us up to 33250us (for many reason). So, I keep this area free, but I
moved-back from RAM display routines.
<> board/fxcg50/initialize
| remove "section" copy. This role has been delegated to the bootload (vxBoot)
because, in the final ELF file generated by GCC, many relocalization
information for the IL/X memory has been set and the bootloader cannot
performs general relocalization.
So, all "special section/memory" displacement has been moved in the
bootloader and we don't have to worrying about the section copy.
<> src/drivers/mpu/sh/sh7305/tmu
| fix delay calculation in timer reload primitive
| disable interruption for profiling timer
<> src/module/dislay/
| fix shader index used during the dstack_render()
| fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
|
|
|
VALIGNED(4) VWEAK int r61524_frame_frag_send(dsurface_t *surface)
|
2022-05-27 11:57:55 +02:00
|
|
|
{
|
2022-06-20 16:29:28 +02:00
|
|
|
uint16_t * restrict yram = surface->vram;
|
2022-06-19 20:11:52 +02:00
|
|
|
int size = (surface->y1 == 220) ? 1584 : 3960;
|
|
|
|
|
2022-06-10 21:28:51 +02:00
|
|
|
for (int i = 0; i < size; ++i) {
|
2022-06-13 21:15:36 +02:00
|
|
|
r61524_write(yram[i]);
|
2022-05-27 11:57:55 +02:00
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
VxKernel 0.6.0-13 : Add keyboard API + update timer API
@add
<> include/vhex/driver/mpu/sh/sh7305/keysc
| add internal driver primitives
<> include/vhex/driver/mpu/sh/sh7305/tmu
| add internal driver primitives
<> include/vhex/keyboard
| add getkey* (high-level) API
| add key event API
| add key status API
| add keycode information
| add keyboard driver interface
@update
<> include/vhex/driver
| add KEYBOARD driver flags
<> include/vhex/keyboard
| isolate each part of the keyboard module
| link the keycache part with the driver-provided keycache information
<> src/drivers/mpu/sh/sh7305/keysc
| use the new keycache API (high-level interrupt handler)
| update keycache API
| link the new API in the driver device
<> src/drivers/mpu/sh/sh7305/tmu
| add timer reservation (WIP)
| use a "reservation" cache to known which timer is free instead of hardware
| rename internal functions
<> src/module/display
| Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t
| use dsubimage dstack primitive in dimage()
@fix
<> board/fxcg50/fxcg50.ld
| remove the IL-memory and allow only the X-memory area. This because the
bootloader uses the IL-memory for DMA transfer and other "low-level"
routine used by Gint.
Moreover, I originally try to move each "display-driver" in this place,
but after some profiling and tests, the dclear()/dupdate() combo went from
9155us up to 33250us (for many reason). So, I keep this area free, but I
moved-back from RAM display routines.
<> board/fxcg50/initialize
| remove "section" copy. This role has been delegated to the bootload (vxBoot)
because, in the final ELF file generated by GCC, many relocalization
information for the IL/X memory has been set and the bootloader cannot
performs general relocalization.
So, all "special section/memory" displacement has been moved in the
bootloader and we don't have to worrying about the section copy.
<> src/drivers/mpu/sh/sh7305/tmu
| fix delay calculation in timer reload primitive
| disable interruption for profiling timer
<> src/module/dislay/
| fix shader index used during the dstack_render()
| fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
|
|
|
VALIGNED(4) int r61524_frame_end(dsurface_t *surface)
|
2022-05-27 11:57:55 +02:00
|
|
|
{
|
|
|
|
(void)surface;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Driver definition
|
|
|
|
//---
|
|
|
|
|
|
|
|
/* R61524 display (graphics RAM range) */
|
|
|
|
struct r61524_ctx {
|
|
|
|
uint16_t HSA;
|
|
|
|
uint16_t HEA;
|
|
|
|
uint16_t VSA;
|
|
|
|
uint16_t VEA;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __r61524_configure(struct r61524_ctx *s)
|
|
|
|
{
|
|
|
|
s->HSA = 0;
|
|
|
|
s->HEA = 395;
|
|
|
|
s->VSA = 0;
|
|
|
|
s->VEA = 223;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __r61524_hsave(struct r61524_ctx *s)
|
|
|
|
{
|
|
|
|
r61524_select(horizontal_ram_start);
|
|
|
|
s->HSA = r61524_read();
|
|
|
|
r61524_select(horizontal_ram_end);
|
|
|
|
s->HEA = r61524_read();
|
|
|
|
|
|
|
|
r61524_select(vertical_ram_start);
|
|
|
|
s->VSA = r61524_read();
|
|
|
|
r61524_select(vertical_ram_end);
|
|
|
|
s->VEA = r61524_read();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __r61524_hrestore(struct r61524_ctx const *s)
|
|
|
|
{
|
|
|
|
r61524_select(horizontal_ram_start);
|
|
|
|
r61524_write(s->HSA);
|
|
|
|
r61524_select(horizontal_ram_end);
|
|
|
|
r61524_write(s->HEA);
|
|
|
|
|
|
|
|
r61524_select(vertical_ram_start);
|
|
|
|
r61524_write(s->VSA);
|
|
|
|
r61524_select(vertical_ram_end);
|
|
|
|
r61524_write(s->VEA);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-13 15:01:01 +01:00
|
|
|
struct vhex_driver drv_r61524 = {
|
|
|
|
.name = "R61524",
|
|
|
|
.hsave = (void*)&__r61524_hsave,
|
|
|
|
.hrestore = (void*)&__r61524_hrestore,
|
|
|
|
.configure = (void*)&__r61524_configure,
|
2022-05-27 11:57:55 +02:00
|
|
|
.state_size = sizeof(struct r61524_ctx),
|
|
|
|
.flags = {
|
|
|
|
.DISPLAY = 1,
|
|
|
|
.SHARED = 0,
|
|
|
|
.UNUSED = 0,
|
|
|
|
},
|
2022-06-13 21:15:36 +02:00
|
|
|
.module_data = &(struct dstack_drv_interface){
|
|
|
|
.frame_start = &r61524_frame_start,
|
|
|
|
.frame_frag_next = &r61524_frame_frag_next,
|
|
|
|
.frame_frag_send = &r61524_frame_frag_send,
|
|
|
|
.frame_end = &r61524_frame_end,
|
|
|
|
.display_width = 396,
|
|
|
|
.display_height = 224
|
|
|
|
}
|
2022-02-13 15:01:01 +01:00
|
|
|
};
|
|
|
|
VHEX_DECLARE_DRIVER(16, drv_r61524);
|