r61524: add low-level get/set and start_frame functions

This commit is contained in:
Lephe 2021-06-22 17:52:26 +02:00
parent 02c1b551cd
commit 545db2f9ce
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 41 additions and 1 deletions

View File

@ -35,6 +35,17 @@ enum {
@method Transfer method, see above */
void r61524_display(uint16_t *vram, int start, int height, int method);
/* r61524_start_frame(): Prepare the display for a region update
This function sets up the display driver to receive graphics data to update
liens [start] to [start+height-1] (both included) of the current window.
This is the initial step of r61524_display(), which is normally followed by
writing all the data to 0xb4000000.
This function can be used to implement additional display driver update
methods or alternate rendering pipelines. */
void r61524_start_frame(int start, int height);
/* r162524_win_get() and r61524_win_set(): Manipulate the display window
These functions change the screen rectangle where data is shown. Normally
@ -47,6 +58,18 @@ void r61524_display(uint16_t *vram, int start, int height, int method);
void r61524_win_get(uint16_t *HSA, uint16_t *HEA, uint16_t *VSA,uint16_t *VEA);
void r61524_win_set(uint16_t HSA, uint16_t HEA, uint16_t VSA, uint16_t VEA);
//---
// Low-level functions
//---
/* r61524_get(): Read the value of an R61524 register
This is provided for testing and if you know what you're doing. */
uint16_t r61524_get(int ID);
/* r61524_set(): Write the value of an R61524 register
This is provided for testing and if you know what you're doing. */
void r61524_set(int ID, uint16_t value);
#ifdef __cplusplus
}
#endif

View File

@ -86,6 +86,18 @@ GINLINE static void write(uint16_t data)
*intf = data;
}
uint16_t r61524_get(int ID)
{
select(ID);
return read();
}
void r61524_set(int ID, uint16_t value)
{
select(ID);
write(value);
}
//---
// Window management
//---
@ -122,7 +134,7 @@ void r61524_win_set(uint16_t HSA, uint16_t HEA, uint16_t VSA, uint16_t VEA)
/* TODO: r61524: update, backlight, brightness, gamma */
void r61524_display(uint16_t *vram, int start, int height, int method)
void r61524_start_frame(int start, int height)
{
/* Move the window to the desired region, then select address 0 */
r61524_win_set(0, 395, start, start + height - 1);
@ -133,6 +145,11 @@ void r61524_display(uint16_t *vram, int start, int height, int method)
/* Bind address 0xb4000000 to the data write command */
select(write_data);
}
void r61524_display(uint16_t *vram, int start, int height, int method)
{
r61524_start_frame(start, height);
if(method == R61524_CPU)
{