diff --git a/include/gint/drivers/r61524.h b/include/gint/drivers/r61524.h index c1b0ec9..5988e44 100644 --- a/include/gint/drivers/r61524.h +++ b/include/gint/drivers/r61524.h @@ -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 diff --git a/src/r61524/r61524.c b/src/r61524/r61524.c index 8f976b5..5e72f6f 100644 --- a/src/r61524/r61524.c +++ b/src/r61524/r61524.c @@ -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) {