Commit Graph

179 Commits

Author SHA1 Message Date
Lephe 291c3cef17
cpg: restore overclock settings when leaving 2022-05-16 20:13:13 +01:00
Lephe b942bc5d19
clock: add overclock support on fx-CG 10/20/50 2022-05-15 19:20:14 +01:00
Lephe 09c13676d3
image: arbitrary linear transforms 2022-05-15 12:59:28 +01:00
Lephe 780acb3fc9
image: arbitrary linear transforms [WIP] 2022-05-14 22:32:59 +01:00
Lephe 818f950fff
image: flips, including in-place 2022-05-14 20:27:16 +01:00
Lephe 9468a8d725
image: clean up palette semantics, and conversion 2022-05-14 15:36:07 +01:00
Lephe fc6f7d3051
image: remove alpha field of images 2022-05-14 12:54:59 +01:00
Lephe 5a69e44078
image: new image format and base for the image library 2022-05-13 23:31:03 +01:00
Lephe 667f43b45c
render-cg: remove now-unused section of .effects field of image command 2022-05-06 16:52:05 +01:00
Lephe ede19fc878
render-cg: restore bopti method on P4 and defined p4_clearbg_alt 2022-05-06 16:26:44 +01:00
Lephe 7a3604ccbb
render-cg: allocate VRAM in the heap; default to double buffering
* Create a heap arena over the OS stack, large enough to hold two VRAMs
  as was previously done, unless GINT_NO_OS_STACK is set at compile
  time. (This replaces GINT_USER_VRAM.)

* Allocate a single VRAM in the heap at startup.

* Use double buffering by default as triple buffering is almost entirely
  useless. dudpate() waits if both VRAMs are identical to prevent
  corruption, but this can be bypassed with R61524 functions as usual.
  This adds about 180 kB of heap data to any add-in using default
  settings.
2022-05-04 20:08:52 +01:00
Lephe f219e5c882
render-cg: add new image rendering functions with dynamic effects 2022-05-04 19:08:54 +01:00
Lephe 904ab74984
(minor) 2022-05-04 19:08:54 +01:00
Lephe 8210524152
ld: merge XRAM and YRAM into a single 16-kiB section 2022-05-04 19:08:54 +01:00
Lephe e57efb5e37
keysc: simpler keyboard device with more consistent repeats
* Stop trying to be smart and generate repeats on the fly; this breaks
  time consistency. Also if repeats are not handled in time this causes
  infinite loops.
* Move rarely-used functions to external files, simplify stuff, get rid
  of internal driver events; saves ~1 kB per add-in overall.
2022-04-23 13:34:41 +01:00
Lephe 0c2935055e
cpg: provide a function to recompute clock frequency 2022-04-15 21:08:37 +01:00
Lephe fdadb0dd71
mpu: rename FRQCRA into FRQCR 2022-04-12 16:23:18 +01:00
Lephe b10c065abe
mpu: update CPG definition
We should also rename FRQCRA to FRQCR.
2022-04-12 16:22:14 +01:00
Lephe a3ce29b7b8
mpu: add BSC register definitions 2022-04-12 14:57:07 +01:00
Lephe 227c06631b
fs: buffer Fugue writes through RAM
Writing from ROM causes occasional crashes, which are fairly hard to
produce when the buffers are small.
2022-01-10 14:47:14 +01:00
Lephe 3aa1471ac5
fs: track offset of Fugue files manually
This helped locate some bugs:
* read() could read past EOF due to BFile_Read() allowing you to read up
  until the end of the last sector, beyond the file size
* pread() did not restore the file offset because the negative seek at
  the end is not relative (that was the CASIOWIN fs API), so pread()
  could not actually be written without knowing the current position
* lseek() would clamp you to EOF but still return its out-of-bounds
  arguments, as a direct result of BFile_Seek() doing that

Benefits:
* Made pread() a generic function
2022-01-06 14:05:52 +01:00
Lephe 472f1245c7
fix bad indent 2021-12-31 10:37:59 +01:00
Lephe aed90d9b3c
fs: folder support, part 2 (path normalization and root) 2021-12-23 01:19:45 +01:00
Lephe 9cae0040b5
fs: folder support, part 1 (mkdir/rmdir and the opendir(3) family) 2021-12-21 19:01:00 +01:00
Lephe 6903bd58d5
fs: cast BFile support into generic file descriptors
This paves the way for standard streams, USB streams, and some more.
2021-12-13 18:38:47 +01:00
Lephe 71de4dcb95
bfile: clean up header, add BFile_Seek and BFile_GetPos 2021-12-10 07:24:12 +01:00
Lephe 2e5e56f82e
hardware: expose filesystem type in the hardware info
Filesystem type is detected with a trivial heuristic:
* fx-9860G: CASIOWIN, unless Fugue in the G-III series (OS >= 3.00)
* fx-CG 50: Always Fugue
2021-12-06 21:31:00 +01:00
Lephe caf585b0a1
tmu: fix freeze when using sleep_us_spin() with interrupts on
Because of timing the interrupt handler could run before the flag is
checked.
2021-11-15 06:43:00 +01:00
Lephe 1384c54b5f
render-cg: update to bopti formats for Azur 2021-09-28 09:55:26 +02:00
Lephe 7adcdea5f1
keyboard: add a note about the use of transforms in getkey_opt() 2021-09-01 16:21:53 +02:00
Lephe d3a2cf07a0
usb: add video capture through the fxlink protocol 2021-08-11 01:43:26 +02:00
Lephe 8713d2644f
defs: take ssize_t and off_t in the standard library 2021-07-02 09:52:17 +02:00
Lephe 545db2f9ce
r61524: add low-level get/set and start_frame functions 2021-06-22 17:52:26 +02:00
Lephe 02c1b551cd
mpu/cpg.h: specify DDCLKCR 2021-06-22 17:51:54 +02:00
Lephe 89d540ee91
kernel: add basic C++ support for GINT_CALL() 2021-06-22 17:51:27 +02:00
Lephe 5bd04a9613
cpu, dma: add interrupt-cancellable sleep (perfect async sleep) 2021-06-17 14:32:08 +02:00
Lephe 10180d31bc
add C++ header guards 2021-06-13 18:13:09 +02:00
Lephe 086ad19d13
getkey: properly specify -1 as blocking repeats, not 0 2021-06-08 15:25:36 +02:00
Lephe 20b7238057
std: move endian.h to fxlibc 2021-06-08 10:05:33 +02:00
Lephe fc6fb9dc09
std: remove the malloc impl and string header 2021-06-07 21:52:52 +02:00
Lephe 3a6165f026
std: remove the TinyMT-based rand implementation 2021-06-07 19:16:58 +02:00
Lephe 991b616a10
std: remove the printf implementation 2021-06-07 18:53:05 +02:00
Lephe 242c41d1f2
display-cg: fix C_LIGHT and C_DARK (#16) 2021-05-25 11:18:36 +02:00
Lephe 9e43dcb27a
std: remove string functions now in the fxlibc 2021-05-25 11:18:36 +02:00
Lephe 99403a9504
render: support C_INVERT on fx-CG 50 2021-05-12 09:17:25 +02:00
Lephe a547235f8f
usb: FIFO controllers and fxlink API
This changes fixes the way gint uses the FIFO controllers D0F and D1F
to access the FIFO. It previously used D0F in the main thread and D1F
during interrupt handling, but this is incorrect for several reasons,
mainly the possible change of controllers between a write and a commit,
and numerous instances of two FIFOs managing the same pipe caused by
the constant switching.

gint now treats FIFO controllers as resources allocated to pipes for
the duration of a commit-terminated sequence of writes. The same
controller is used for a single pipe in both normal and interrupt
modes, and released when the pipe is committed. If no controller is
available, asynchronous writes fail and synchronous ones wait.

The fxlink API is also added with a small amount of functions, namely
to transfer screenshots and raw text. Currently these are synchronous
and do not use the DMA, this will be improved later.

Finally:
* Removed pipe logic from src/usb/setup.c, instead letting pipes.c
  handle the special case of the DCP (which might be regularized later)
* Removed the usb_pipe_mode_{read,write} functions as they're actually
  about FIFo controllers and it's not clear yet how a pipe with both
  read and write should be handled. This is left for the future.
* Clarified end-of-sequence semantics after a successful commit.
2021-05-12 09:17:25 +02:00
Lephe 95dbec17ab
cpu: allow functions to block the sleep() function
This change introduces new sleep_block() and sleep_unblock() functions
that control whether the sleep() function actually sleeps. This type of
behavior was already implemented in the DMA driver, since DMA access to
on-chip memory is paused when sleeping (on-chip memory being paused
itself), which would make waiting for a DMA transfer a freeze.

Because DMA transfers are now asynchronous, and USB transfers that may
involve on-chip memory are coming, this API change allows the DMA and
USB drivers to block the sleep() function so that user code can sleep()
for interrupts without having to worry about asynchronous tasks
requiring on-chip memory to complete.
2021-05-12 09:17:25 +02:00
Lephe 4c3fcf66a7
getkey: add a "feature function" to create application-wide shortcuts
This change introduces the global "feature function" that can be
enabled in getkey() to receive events, and use them for
application-wide features. This would be useful, for instance, to
toggle screen backlight with a different key combination that the
default, to capture screenshots, or to implement a catalog.

When enabled, the feature function is present with all new events and
can perform actions, then decide whether or not to return them from
getkey().
2021-05-12 09:17:24 +02:00
Lephe dbba1d7b1d
defs: use auto instead of __auto_type in C++ 2021-05-12 09:17:24 +02:00
Lephe 78bf9dac7d
gray: expose pointers to the screen buffers 2021-05-12 09:17:24 +02:00