Commit Graph

46 Commits

Author SHA1 Message Date
Lephe 86cd9b98d4
small improvements
* Update TOTO list
* Change the type of gint_vbr to comply with a new warning in GCC 9
* Add strcmp()
2019-09-19 15:59:38 +02:00
Lephe a05d3416f0
std: support integer size formats (hh, h, l, ll) 2019-09-19 15:58:35 +02:00
Lephe fc7aab6eba
dma: finalize dma_memset() and dma_memcpy()
Adds support for dma_memcpy(), and uses a proper ILRAM allocation scheme
(static linking here) for the temporary buffer in dma_memset().
2019-09-15 19:30:57 +02:00
Lephe 15558c8fb3
support data loading in ILRAM, XRAM and YRAM
This change adds support for three sections .ilram, .xram and .yram,
along with three macros GILRAM, GXRAM and GYRAM, that can be used to
statically load data to on-chip memory.
2019-09-15 19:29:47 +02:00
Lephe bb77e4588d
dma: fix freezes when transferring to/from IL memory
The IL memory is unavailable when the processor goes to sleep, causing
any involved DMA transfer to stall. The dma_transfer_wait() normally
sleeps to save battery power, but this causes the whole system to freeze
and never wake up.

This change lets dma_transfer_wait() decide dynamically whether to sleep
or spinlock. There is no concrete improvement over dma_transfer_noint()
when using IL memory, but it makes dma_transfer() fully generic.

Obviously the same goes for X and Y memory.
2019-09-15 15:20:23 +02:00
Lephe 552b9b9a43
dma: only expose API on fxcg50
Currently there seems to be no DMA at all on fx9860g. Further
investigation would be required, because this would be the first major
difference between the SH7305's found in fx9860g and fxcg50 models.

An automated peripheral register discovery strategy might help, but
identifying discovered registers would be non trivial.

Also use the pruning ability of the Makefile to avoid troublesome
ifdef's in the code.
2019-09-15 10:20:37 +02:00
Lephe 5630814897
core: allow custom panics and exception catching
This change introduces two new mechanismes for executing user code when
an exception occurs.

* This first is the custom panic message, which usually displays "System
  ERROR". The function that performs this task can now be user-defined.
  It is also run in user mode because the exception handler rte's into
  it, allowing it to execute any kind of interrupt-inducing task. The
  behavior is undefined if this function raises an exception.

* The second is an exception-catching function, which (when set) is
  called every time an exception occurs, and is granted the chance of
  handling the exception to continue execution normally. It can be used
  in various ways, the most primitive of which is recording the
  exception and going back. It runs in interrupt mode and must not raise
  any kind of exception.
2019-09-13 08:10:30 +02:00
Lephe 9a4ae4c80a
minor new definitions 2019-09-13 08:08:22 +02:00
Lephe ef0e5e32f8
render: add one-parameter dvline() and dhline()
Behave like Basic's Horizontal and Vertical commands. Internal dline()
optimizations are renamed gint_dhline() and gint_dvline().

Also supports ghline() and gvline() in the gray engine.

Optimization cases here are amost negligible due to limiting RAM access
frequencies and the very limited amount of work accomplished in the
functions. Code maintainability is prioritized by using dline().
2019-09-07 11:26:11 +02:00
Lephe 61e68d01bb
expose more platform-agnostic code
May be useful later on for libraries such as libprof.
2019-09-06 12:16:31 +02:00
lephe b9cba1d00a
style, formatting, font 2019-09-03 22:29:04 +02:00
lephe e1aca8d89b
exc: add exception handlers, use them in the DMA
This change introduces exception handlers that default to a fatal error
with an on-screen description of the exception and some debugging
information.

It also adds the dprint() function as a definitely-needed helper and
removes bootlog_unmapped() by using the exception handler for the fatal
error display. (Also printf() is now required in all gint add-ins; this
is sad, but space is not as much of a constraint as debugging.)

Finally, the exception handler is used to handle an interrupt which is
an exception in practice, the DMA address error. On fx-CG 50, additional
DMA-related information is displayed on the screen. This is left out on
fx-9860G as there is not enough space.
2019-09-03 22:15:00 +02:00
lephe 6d54a5fe0a dma: add exception handler and dma_memset() 2019-08-27 21:18:44 +02:00
lephe 652637d475 bopti: add support for r5g6b5 and r5g6b5a on fxcg50
This commit introduces bopti for fxcg50 with the first basic 16-bit
formats. The performance is rather slow, especially for large images,
and will need refinements and/or overclock to be really efficient in
full-screen real-time applications.
2019-08-27 21:04:07 +02:00
lephe b3cbb0a43f dma: add support for all six channels (merges #1) 2019-08-08 11:21:10 +02:00
lephe 2e17b77e56 bopti: first fxcg50 version with r5g6b5 and r5g6b5a
This commit introduces bopti for fx-CG 50. Currently the only
interfaces are the bopti_render_{clip,noclip} functions, and the
only supported formats are r5g6b5 and r5g6b5a.

The algorithm for r5g6b5 is optimized to perform longword accesses
using movua.l, whereas the algorithm for r5g6b5a uses plain word
accesses because transparency checks feel more difficult than one
more loop iteration.

These algorithms are still slow for large surfaces and struggle to
keep up 25 FPS in full-screen, so possible improvements with the
DMA should definitely be tested before restorting to overclock.
2019-08-04 13:59:35 +02:00
lephe 64dbe6021d some formatting and comment updates 2019-08-04 13:59:17 +02:00
Antoine 8cbd5be038 Ajout de la fonction srtcat et modification du 0 de la police de la Graph 90+E 2019-07-31 04:24:42 -04:00
lephe 62ae7e19d4 gray: considerably improve gray visuals 2019-07-29 12:17:25 -04:00
lephe 1cf5bf514a bopti: add gray support for all four profiles
This change finally introduces gray image rendering with bopti. This
is the final iteration of bopti v2 and certainly the fastest so far.
All four profiles are supported, without change to the format.
2019-07-27 19:51:53 -04:00
lephe d7c33b12a5 topti: return previously-configured font in dfont() 2019-07-27 19:47:04 -04:00
lephe ae4f7af172 gray: add engine, basic drawing and text
This revision includes the base gray engine with sensible starting
defaults, gclear() and grect(), as well as gtext().
2019-07-20 12:31:46 -04:00
lephe ff2db385a8 TODO update and miscellaneous style 2019-07-16 18:34:10 -04:00
lephe 8dbdd32adb keyboard: finalize getkey() 2019-07-16 18:23:21 -04:00
lephe 31ade70c42 tmu: export definitions, clean stop, expose address
This commit introduces three timer driver changes:

* Export the definitions of the timer structures to a detailed header at
  <gint/mpu/tmu.h>, and re-use them in the driver.
  This integration is still limited as the driver keeps its own address
  definitions and event codes.

* Clean the timer stop routine that is used in the interrupt handler. Up
  until now the interrupt handler would only stop TSTR, which is not
  enough to cleanly leave the timer (need TCOR=TCNT=-1) and is not even
  sound with respect to gint's semantics as UNIE stays enabled so the
  timer is not made available again.

  The interrupt handler now calls into C code when the timer stop
  condition is met (callback returns non-zero) to keep this clean. This
  unsurprisingly solves problems that occurred in certain situations
  when a timer was used repeatedly.

* Expose timer addresses using a timer_address() function, compensating
  for the lack of address definitions in <gint/mpu/tmu.h>. This
  interface is likely to evolve in the future to better integrate the
  address in the MPU headers and move them out of the driver.
2019-07-16 15:39:38 -04:00
lephe 24fbeab55b core: provide MPU type on unknown platforms
This makes it possible to write application code without specifying the
target machine, which is especially useful for libraries. The first user
of this system is libprof.
2019-07-16 15:39:33 -04:00
lephe d9c32b2b05 libc: split standard headers properly
Since Memallox's newlib port is currently unstable, gint has to
provide some standard functions on its own. Instead of a single
<gint/std.h> header, this commit makes a gint/std directory containing
headers under standard names.
2019-07-16 15:38:18 -04:00
lephe 3c7a8891d0 render: rename dimage_opt() into dsubimage() 2019-07-06 16:49:59 -04:00
lephe eece35566e core: add BFile syscalls 2019-07-04 12:15:13 -04:00
lephe 3d362bb0bf defs: remove useless definitions 2019-07-04 12:15:00 -04:00
lephe 5a575a278f render: use shorter color names 2019-07-04 12:14:31 -04:00
lephe 3324d58afa core: add a hardware detection interface 2019-07-04 12:11:43 -04:00
lephe f8d69dd56a display: add a dupdate_noint() for exceptions handlers 2019-07-04 11:46:26 -04:00
lephe 11b40b445c render-cg: 8x9 font and proportional font rendering 2019-06-23 17:27:44 -04:00
lephe 0055199359 render: refactor to share functions, and basic text on fxcg50 2019-06-15 01:05:31 -04:00
lephe 81baa4c26a bopti: expose bopti functions and implement dimage() and dimage_opt() 2019-05-04 21:00:40 +02:00
lephe 19cdae4953 core: expose the syscall header
Will be used in time for BFile.
2019-05-04 14:59:13 +02:00
lephe 05f2e01b50 bootlog: make a copy for use in gintctl 2019-05-04 12:07:14 +02:00
lephe f3c8964b84 render-cg: decently implement basic functions 2019-05-03 17:11:43 +02:00
lephe 04231ea5d6 dma: add a new driver to support r61524
Also add a power interface (without driving code) and switch toolchain
because the previous sh4eb-nofpu-elf toolchain was not completely
FPU-free.
2019-03-10 15:45:34 +01:00
lephe f33cb3cf80 core: better bootlog API and implementation
* Now uses topti instead of fxlib for text (including MMU failure)
* Fit .pretext into 4k for everything before MMU succeeds
* A short version of sprintf() for dynamic messages
* Support a driver function, status(), to allow early driver debug
* Expose more useful platform information in <gint/mpu.h>
* Expose the first of a few CASIOWIN syscalls
2019-03-06 14:32:51 +01:00
lephe 417340ce91 topti: implement background color and text size
Also transition the bootlog from fxlib to topti.
2019-02-22 15:08:51 +01:00
lephe 3f7c0a04ad way too much, including bopti/topti, timers, and more. 2019-02-21 21:00:26 +01:00
lephe 298338f633 More timers, RTC, basic overclock-resistant keyboard, CPG, PFC, driver levels. 2018-08-19 17:11:37 +02:00
lephe 2f0e049c33 More interrupt system, exceptions, timers. 2018-08-01 20:41:36 +02:00
lephe 3b90b40dd7 Hybrid build system and runtime (no interrupts). t6k11 driver. Basic r61524 driver. 2018-04-19 13:24:26 +02:00