TODO update and miscellaneous style

This commit is contained in:
lephe 2019-07-16 18:34:10 -04:00
parent 8dbdd32adb
commit ff2db385a8
11 changed files with 35 additions and 68 deletions

28
TODO
View file

@ -1,30 +1,30 @@
On the bootlog.
* Better review of .pretext to make sure everything fits in 4k
* Move topti to .pretext to use it in the bootlog, also update() and dclear()
* Use topti in the error message for the missing mappings (hurray o/)
* Use a serious formatted printing function
Crucial, missing things. Crucial, missing things.
! core: the four basic memory functions ! core: the four basic memory functions
! core: build an exception handler and a TLB miss handler ! core: build an exception handler and a TLB miss handler
! core: gint_switch() (driver contexts on stack; arbitrary code?) ! core: gint_switch() (driver contexts on stack; arbitrary code?)
! bopti: fxcg50 version
! syscalls: fxcg50 BFile calls
! gray: the gray engine on fx9860g
Tests to run. Tests to run.
* core: run the alignment/size automated tests * core: run the alignment/size automated tests for memory functions
* bopti: more sizes, gray * bopti: more sizes, gray
* topti: all charsets, colors * topti: all charsets, colors
Completeness elements on existing code. Completeness elements on existing code.
* keyboard: finish the interface * core: use topti in the error message for missing mappings
* clock: spread spectrum on fxcg50 * core: find the #ifdef FX9860G|FXCG50 that have a cross-platform def
* topti: support Unicode fonts
* hardware: fill in the HWMEM_FITTLB flag
* keyboard: think of extended functions
* cpg: spread spectrum on fxcg50
* bopti: blending modes for monochrome bitmaps (use topti assembler) * bopti: blending modes for monochrome bitmaps (use topti assembler)
* display: use more of topti's assembler in drect() * display: use more of topti's assembler in drect()
* core: use cmp/str for memchr() * core: use cmp/str for memchr()
* stdio: serious formatted printing function * timer: try putting addresses in <gint/mpu/tmu.h>
* timer: try putting the definitions in <gint/mpu/tmu.h> * r61524: brightness control and clean the file
Keep in mind. Keep in mind.
* keyboard: make keysc.c@state static and review globals in the project
* prizm: don't hardcode stack address in fxcg50.ld * prizm: don't hardcode stack address in fxcg50.ld
* prizm: detect P1 static RAM (stack) in TLB * prizm: detect P1 static RAM (stack) in TLB
* core: prove and use qdiv10() instead of __sdivsi3 * core: prove and use qdiv10() instead of __sdivsi3
@ -35,10 +35,8 @@ Keep in mind.
* core: document the SH7305 PFC in <gint/mpu/pfc.h> * core: document the SH7305 PFC in <gint/mpu/pfc.h>
Future directions. Future directions.
* File management * A complete file system abstraction
* Gray engine
* Integrate overclock management * Integrate overclock management
* A library for profiling with manual calls
* Audio playback using Martin Poupe's method * Audio playback using Martin Poupe's method
* Serial communication [SCIF] [SCIFA] * Serial communication [SCIF] [SCIFA]
* USB communication [USB] * USB communication [USB]

View file

@ -18,7 +18,7 @@
/* Expose the VRAM variable if GINT_NEED_VRAM is defined. It must always point /* Expose the VRAM variable if GINT_NEED_VRAM is defined. It must always point
to a 32-aligned buffer of size 177408. Any function can use it freely to to a 32-aligned buffer of size 177408. Any function can use it freely to
perform rendering or store data when not drawing. Triple buffering is perform rendering or store data when not drawing. Triple buffering is
already implemened in gint, see the dvram() function below. already implemented in gint, see the dvram() function below.
In this module, colors are in the 16-bit R5G6B5 format, as it is the format In this module, colors are in the 16-bit R5G6B5 format, as it is the format
used by the display controller. */ used by the display controller. */

View file

@ -186,7 +186,7 @@ void dsize(const char *str, font_t const * font, int *w, int *h);
able to render several characters at once. able to render several characters at once.
This is not a printf()-family function so [str] cannot contain formats like This is not a printf()-family function so [str] cannot contain formats like
"%d" and you cannot pass aditional arguments. "%d" and you cannot pass additional arguments.
@x @y Coordinates of top-left corner of the rendered string @x @y Coordinates of top-left corner of the rendered string
@str String to display @str String to display

View file

@ -41,7 +41,7 @@ static void print(int x, int y, const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vsprintf(str + 2, format, args); vsnprintf(str + 2, 43, format, args);
#ifdef FX9860G #ifdef FX9860G
dtext(6 * (x-1) + 1, 8 * (y-1), str + 2, C_BLACK, C_WHITE); dtext(6 * (x-1) + 1, 8 * (y-1), str + 2, C_BLACK, C_WHITE);

View file

@ -40,11 +40,7 @@
/* OS version */ /* OS version */
___os_version: ___os_version:
mov.l syscall_table, r2 syscall(0x02ee)
mov.l 1f, r0
jmp @r2
nop
1: .long 0x02ee
/* Dynamic allocation */ /* Dynamic allocation */
@ -61,51 +57,27 @@ _realloc:
# int BFile_Remove(const uint16_t *file) # int BFile_Remove(const uint16_t *file)
_BFile_Remove: _BFile_Remove:
mov.l 1f, r0 syscall(0x0439)
mov.l syscall_table, r1
jmp @r1
mov #0, r5
1: .long 0x0439
# int BFile_Create(uint16_t *file, enum { file = 1, folder = 5 }, int *size) # int BFile_Create(uint16_t *file, enum { file = 1, folder = 5 }, int *size)
_BFile_Create: _BFile_Create:
mov.l 1f, r0 syscall(0x0434)
mov.l syscall_table, r1
jmp @r1
nop
1: .long 0x0434
# int BFile_Open(const uint16_t *file, int mode) # int BFile_Open(const uint16_t *file, int mode)
_BFile_Open: _BFile_Open:
mov.l 1f, r0 syscall(0x042c)
mov.l syscall_table, r1
jmp @r1
mov #0, r6
1: .long 0x042c
# int BFile_Close(int handle) # int BFile_Close(int handle)
_BFile_Close: _BFile_Close:
mov.l 1f, r0 syscall(0x042d)
mov.l syscall_table, r1
jmp @r1
nop
1: .long 0x042d
# int BFile_Write(int handle, const void *ram_buffer, int even_size) # int BFile_Write(int handle, const void *ram_buffer, int even_size)
_BFile_Write: _BFile_Write:
mov.l 1f, r0 syscall(0x0435)
mov.l syscall_table, r1
jmp @r1
nop
1: .long 0x0435
# int BFile_Read(int handle, void *ram_buffer, int size, int whence) # int BFile_Read(int handle, void *ram_buffer, int size, int whence)
_BFile_Read: _BFile_Read:
mov.l 1f, r0 syscall(0x0432)
mov.l syscall_table, r1
jmp @r1
nop
1: .long 0x0432
syscall_table: syscall_table:
.long 0x80010070 .long 0x80010070
@ -117,11 +89,7 @@ syscall_table:
/* OS version */ /* OS version */
___os_version: ___os_version:
mov.l syscall_table, r2 syscall(0x1406)
mov.l 1f, r0
jmp @r2
nop
1: .long 0x1406
/* Dynamic allocation */ /* Dynamic allocation */

View file

@ -127,7 +127,7 @@ static void sh7305_probe(void)
static const char *cpg_status(void) static const char *cpg_status(void)
{ {
static char status[18]; static char status[18];
sprintf(status, "I%3d B%3d P%3d C%c", sprintf(status, "I%03d B%03d P%03d C%c",
freq.Iphi_f / 1000000, freq.Iphi_f / 1000000,
freq.Bphi_f / 1000000, freq.Bphi_f / 1000000,
freq.Pphi_f / 1000000, freq.Pphi_f / 1000000,

View file

@ -24,7 +24,7 @@
get a correct result. As a consequence, if an event cannot be generated get a correct result. As a consequence, if an event cannot be generated
(whatever the reason), the driver's internal copy of the keyboard state must (whatever the reason), the driver's internal copy of the keyboard state must
not be updated (probably the event will be re-emitted at the next scan). */ not be updated (probably the event will be re-emitted at the next scan). */
GDATA volatile uint8_t state[12] = { 0 }; GDATA static volatile uint8_t state[12] = { 0 };
/* A driver event, which is a change in a full row instead of a single key. */ /* A driver event, which is a change in a full row instead of a single key. */
typedef struct typedef struct
@ -45,7 +45,7 @@ GDATA static int buffer_start = 0;
GDATA static int buffer_end = 0; GDATA static int buffer_end = 0;
/* Current time, in keyboard-scanning ticks */ /* Current time, in keyboard-scanning ticks */
GDATA int time = 0; GDATA static int time = 0;
/* buffer_push() - add an event in the keyboard buffer /* buffer_push() - add an event in the keyboard buffer
Returns non-zero if the event cannot be pushed. */ Returns non-zero if the event cannot be pushed. */
@ -71,7 +71,7 @@ static int buffer_poll(driver_event_t *ev)
} }
/* keysc_frame() - generate a round of events for the current frame */ /* keysc_frame() - generate a round of events for the current frame */
void keysc_frame(void) static void keysc_frame(void)
{ {
GALIGNED(2) uint8_t scan[12] = { 0 }; GALIGNED(2) uint8_t scan[12] = { 0 };

View file

@ -288,7 +288,7 @@ static const char *r61524_status(void)
uint16_t dev = read(); uint16_t dev = read();
static char str[8]; static char str[8];
sprintf(str, "%4xF-b", dev); sprintf(str, "%04xF-b", dev);
return str; return str;
} }

View file

@ -27,8 +27,8 @@ font_t const * topti_font = &gint_font8x9;
@dataw Glyph width @dataw Glyph width
@fg @bg Foreground and background colors */ @fg @bg Foreground and background colors */
GSECTION(".pretext") GSECTION(".pretext")
void topti_glyph(uint16_t *vram, uint32_t const * data, int left, int top, static void topti_glyph(uint16_t *vram, uint32_t const * data, int left,
int width, int height, int dataw, int fg, int bg) int top, int width, int height, int dataw, int fg, int bg)
{ {
int index = top * dataw + left; int index = top * dataw + left;

View file

@ -1,5 +1,6 @@
.global _topti_asm_text .global _topti_asm_text
.section .pretext
# REGISTER ALLOCATION: # REGISTER ALLOCATION:
# r0: x or ~x # r0: x or ~x

View file

@ -11,7 +11,7 @@ font_t const * gint_default_font = &gint_font5x7;
font_t const * topti_font = &gint_font5x7; font_t const * topti_font = &gint_font5x7;
/* topti_split(): Split glyph data into lines /* topti_split(): Split glyph data into lines
This function splits the data from [glyph] inyo lines and writes a bit of This function splits the data from [glyph] into lines and writes a bit of
each line in [operators]. This operation is meant to be used multiple times each line in [operators]. This operation is meant to be used multiple times
in a row, so [free] represents the number of free low bits in [operators]. in a row, so [free] represents the number of free low bits in [operators].
@ -22,11 +22,11 @@ font_t const * topti_font = &gint_font5x7;
@operators VRAM operands @operators VRAM operands
Returns the number of free bits in [operators] after the operation. If it's Returns the number of free bits in [operators] after the operation. If it's
0, call topti_draw() and reset the operators. If it's neative, call 0, call topti_draw() and reset the operators. If it's negative, call
topti_draw() then do another pass of topti_split() to recover the missing topti_draw() then do another pass of topti_split() to recover the missing
information. */ information. */
GSECTION(".pretext") GSECTION(".pretext")
int topti_split(uint32_t const * glyph, int width, int height, int free, static int topti_split(uint32_t const * glyph, int width, int height, int free,
uint32_t *operators) uint32_t *operators)
{ {
/* Extracts [width] bits on the left of [*glyph] */ /* Extracts [width] bits on the left of [*glyph] */