Commit graph

490 commits

Author SHA1 Message Date
Lephe
86fad757e1
kernel: increase stack size to 12 kB on SH4 fx-9860G
BFile calls on the G-III series can overflow an 8 kB stack, overriding
the VBR which is located just before (!).
2021-12-05 21:15:41 +01:00
Lephe
b7173a5109
kernel: fix incorrect interrupt save/restore for MAC on SH3 2021-11-25 14:02:04 +01:00
Lephe
055c8f405b
r61524: fix a tight freeze window due to a CPU/DMA race 2021-11-20 16:39:46 +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
73446aae61
bfile: use non-smem syscalls for Fugue
Not sure how the design is internally, but only these ones can find
files in subfolders.
2021-09-25 15:59:47 +02:00
Lephe
192ff17303
render-cg: fix an incorrect x bound on vertical lines 2021-09-05 17:55:29 +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
2d0e18f2d8
bump version to 2.6.0 2021-08-29 11:53:40 +02:00
Lephe
97934cc18e
README: clarify install command 2021-08-26 10:49:34 +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
8d444b4f78
kernel: add crash details on illegal instructions 2021-06-17 14:33:45 +02:00
Lephe
03ef59521c
dma: add support for standard DMA access to SPU memory
* Mark SPU memory as sleep-blocking.
* Perform 4-byte accesses only in dma_memset() and dma_memcpy() (32-byte
  accesses freeze as one would expect).

This change does *NOT* implement support for SPU's integrated DMAC.
2021-06-17 14:32:27 +02:00
Lephe
5bd04a9613
cpu, dma: add interrupt-cancellable sleep (perfect async sleep) 2021-06-17 14:32:08 +02:00
Lephe
658413ba19
r61524: fix hardcoded VRAM and don't assume full-size 2021-06-16 21:12:53 +02:00
Lephe
10180d31bc
add C++ header guards 2021-06-13 18:13:09 +02:00
Lephe
9939896c6a
bump version to 2.5.3 2021-06-08 23:50:38 +02:00
Lephe
824a150dfb
cmake: set HASH to 0, not empty string, when building out-of-git 2021-06-08 23:04:41 +02:00
Lephe
086ad19d13
getkey: properly specify -1 as blocking repeats, not 0 2021-06-08 15:25:36 +02:00
Lephe
57531e63bf
bopti: fix mistake in edcebff31
Test case was flawed.
2021-06-08 14:52:56 +02:00
Lephe
73ab18e457
bump version to 2.5.2 2021-06-08 11:01:27 +02:00
Lephe
8e730c2f78
replace gint/std headers with standard ones 2021-06-08 11:01:27 +02:00
Lephe
20b7238057
std: move endian.h to fxlibc 2021-06-08 10:05:33 +02:00
Lephe
edcebff311
bopti: fix a VRAM overflow through the rightmost column
The checks for VRAM access account for image columns intersecting the
longword before the start of a VRAM line, but not the longword after the
start of a VRAM line. This is now fixed.
2021-06-08 09:38:09 +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
b25924d740
std: remove the asprintf/vasprintf implementation 2021-06-07 19:04:48 +02:00
Lephe
991b616a10
std: remove the printf implementation 2021-06-07 18:53:05 +02:00
Lephe
faf5dc711a
bump version to 2.5.1 2021-06-02 11:23:10 +02:00
Lephe
a9f6c4b622
display-cg: fix a bug in bopti r5g6b6 for very thin images 2021-06-02 11:22:29 +02:00
Lephe
7b40e1e0d0
display: fix a bad overflow for empty lines due to clipping 2021-05-30 23:46:11 +02:00
Lephe
850544349c
kernel: implement _Exit to support exit 2021-05-29 16:29:50 +02:00
Lephe
2f6f49feea
bump version to 2.5.0 2021-05-25 22:07:09 +02:00
Lephe
f2d7338658
make fxlibc a GiteaPC dependency, and update README 2021-05-25 22:07:08 +02:00
Lephe
8f7799dbd5
cmake: add interface flags for OpenLibm and the libc
Known limitation: OpenLibm can't be installed out of the compiler prefix
yet (because of that pesky openlibm/ prefix that it installs to but does
not use when including).
2021-05-25 21:28:50 +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
6c12217777
std: move memcmp, memcpy, memmove, memset to fxlibc 2021-05-25 11:18:33 +02:00
Lephe
7e0ccc3f69
kprint: do not call Grisu2b with input 0.0
It doesn't generate the expected string "0" for some reason, which
causes a freeze somewhere.
2021-05-21 22:30:51 +02:00
Lephe
bc3b8f5602
kprint: add support for L modifier in %f
This is just a parsing trick because long double and double are the same
type on this platform.
2021-05-21 22:30:30 +02:00
Lephe
21e91b30d5
keysc: set the key_event_t.mod bit as getkey() did before 2021-05-15 18:37:36 +02:00
Lephe
99403a9504
render: support C_INVERT on fx-CG 50 2021-05-12 09:17:25 +02:00
Lephe
31dcc6fd6c
usb: enable writing with DMA
Nothing particular to change, simply make sure that the DMA channels
have higher priority than the USB module, otherwise the BEMP interrupt
might be executed before the DMA frees the channel, resulting in the
transfer failing because the channel is still busy.

Also reduce BUSWAIT since it works even on high overclock levels, and
keeping it high won't help increase performance.
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
7aa86235a3
cpu: fix a data race occurring on the cpu_atomic lock
The function was designed with multi-threaded concurrency in mind,
where threads can take over while the lock is held and simply block
trying to acquire it, which allows the lock holder to proceed.

However interrupt handlers are different; they have priority, so once
they start they must complete immediately. The cannot afford to block
on the lock as the program would simply freeze. In exchange, they clean
up before they leave, so there are some guarantees on the execution
state even when interrupted.

The correct protection is therefore not a lock but a temporary block on
interrupts. There is no data race on the value of the saved IMASK
because it is preserved during interrupt handling.
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