Commit Graph

251 Commits

Author SHA1 Message Date
Lephe 5c3dc3220a
intc: add definition for SCIF interrupt 2024-04-14 18:21:14 +02:00
Lephe 7ac2ae25f2
gdb: stdout/err redirect + support swbreak + optional bridge logs 2024-04-13 09:20:01 +02:00
Lephe 0afd05848a
gdb, video, r61524: gdb visual feedback + start video intf on CG
- Define a draft of the video interface
- Implement that dragt for CG for a single mode
  * Includes stub of brightness setting from disassembling 3.60
- Use the video interface to show visual feedback on GDB on CG

Using the video interface avoids directly linking into a driver, which
will serve modularity in gint 3.
2024-04-09 08:57:46 +02:00
Lephe d9414bb6f2
gdb: allow gdb stub to automatically start when a crash occurs
The user can still gdb_start() + gdb_main(NULL) manually, which allows
e.g. early setup of breakpoints. The start_on_except mechanism is the
lazier method where we just run the add-in normally and start fxsdk gdb
on the PC *after* a crash occurs.
2024-03-30 21:41:35 +01:00
Lephe 4623d790cc
ubc: slight cleanup
It is guaranteed by the driver model that drivers are powered on when
gint is active. Sharing the driver isn't too useful because we can't
remote debug in the OS world anyway, there's no USB driver there.
2024-03-30 21:41:08 +01:00
Lephe faead4bc1d
Merge remote-tracking branch 'redoste/gdb' into dev (#27) 2024-03-25 08:05:48 +01:00
Lephe 946d4d9a6f
gray, r61524: gray engine for r61524
gray/engine.c looks terrible by now and it will have to be cleaned up in
the future, with the whole video modes abstraction.
2024-03-24 08:53:12 +01:00
Lephe 3a42b5d386
gint: switch away from FX9860G/FXCG50 macros
Not changing much for now, just distilling them into hardware/OS/render
macros. Later on the rendering stuff will become more dynamic and down
the line I want to unify the APIs more.
2024-03-24 08:28:22 +01:00
Lephe 5548bf68ab
render: add R61524 backend to render-fx for build-fxg3a target 2024-03-23 12:09:53 +01:00
Lephe 28bea2e1ce
gint: switch from file filters to config macros + basic fxg3a target
Nothing interesting in this commit, just moving files around, making
sure every target compiles every file, and controlling with macros
instead.

Basic support for fxg3a target in CMakeLists.txt, cmake/FindGint.cmake,
giteapc.make and include/gint/config.h.in. The rest is forgettable.
2024-03-23 10:02:51 +01:00
Lephe b2b1f00d04
fs: take const descriptor in open_generic() 2024-03-19 19:03:33 +01:00
Lephe 5ff6a518f6
gint: memory micro-optimizations 2024-03-19 19:03:17 +01:00
Lephe bc74586a2c
render: parametrize existence of dmode in config.h
This is the first of many steps designed to reduce gint's reliance on
the FX9860G and FXCG50 macros by describing the compile target more
symbolically. The goal is to allow both for g3a compilation of fx-API
code and for a potential CP port.
2024-03-19 18:37:13 +01:00
Lephenixnoir e0ac25fbb0
render: improve implementation of dpoly()
* Honor dwindow settings immediately (avoids useless dline() calls)
* Bound to ymin/ymax instead of doing many useless cut computations
* Remove the need for floating-point operations and division
2024-03-02 23:16:22 +00:00
Lephe e50769c824
kmalloc: add kmalloc_remove_arena() function 2024-02-04 22:10:01 +01:00
Lephe caa68b08bf
render-fx: add image formats in public API 2024-01-31 15:51:39 +01:00
Lephe 833025f5dd
render-fx: turn bopti_image_t's data array into a pointer
It used to be a flexible array member because in the old days fxconv
could only output a fixed set of bytes, so any referencing was out the
question. Nowadays fxconv can output pretty much anything. Separating
the data pointer will be useful for PythonExtra to expose it as a Python
bytes() or bytearray() object while using the gint API.
2024-01-29 09:49:34 +01:00
Lephe fd5a70e21b
gint: add power-off feature and shortcut in getkey() 2024-01-16 11:42:49 +01:00
Lephe 5655699cd8
gint: reload on-chip sections after world, with option to backup (#26)
Solves the power off crash, at least for programs that don't store
long-term data in on-chip memory.
2024-01-16 11:07:41 +01:00
Lephe 18a7b9ae5b
display: add dcircle() and dellipse() rendering functions
For PythonExtra#2.
2024-01-04 12:00:58 +01:00
Lephe 2bb5294578
gint: avoid annoying banner on return from menu on fx-CG
Instead of using GetKeyWait(), we directly call into an internal OS
function, which avoids the need to press a key before we can redraw over
the OS banner and VRAM when coming back. The disassembly to locate the
function was developed by Dr-Carlos.

We still have to redraw when coming back; getkey() will do it by
dupdate() by default, and it that's not a possibility for the
application an option to receive a special event and handle it manually
is provided.
2023-08-19 22:52:53 +02:00
Lephe 6d86c54507
keyboard: add keypressed() and keyreleased() functions 2023-07-24 14:08:23 +02:00
Lephe 16259deb20
render: expose some internal text rendering utilities 2023-06-04 23:24:34 +02:00
redoste 0b7d8d6800
ubc: ignore breaks when no debug handler is set 2023-06-04 23:20:42 +02:00
redoste 33dae5d218
ubc: add a global lock to inform if a UBC break is being handled 2023-05-27 18:59:24 +02:00
redoste 21ff5c1d53
usb: expose the context of the interrupted function on USB interrupt 2023-05-27 18:52:05 +02:00
redoste 76c82beec6
intc: allow user-space handlers to access the interrupted context
This workaround using a gint_call_t with an odd address is not realy the
cleanest idea but it helps keep the existing intc_generic_handler in
the 32 bytes size limit of the VBR space.
2023-05-27 18:36:15 +02:00
redoste 238bccddbe
gdb: add hw-breakpoint and single step support using the UBC 2023-05-24 22:21:01 +02:00
redoste aa0ff7b10b
ubc: basic User Break Controller driver 2023-05-24 22:21:01 +02:00
redoste 0bea485f4b
gdb: first implementation with basic memory and register read support 2023-05-21 19:49:23 +02:00
Lephe eb49f0258d
usb: show prototypes of debug functions in non-debug mode 2023-04-01 23:24:21 +02:00
Lephe 1423f40a96
usb: disable USB_LOG_TR() when no log is configured
For some reason this has a *massive* impact on read performance, like
78 ms -> 20 ms on a full-screen read (177 kB) on the CG-50.
2023-03-26 20:40:08 +02:00
Lephe 4983849510
usb: consolidate reading logic again, now beta-worthy
This looks like it could work in the long term. The only issue that
really hasn't been addressed is how to use packet counters to cut
transactions when there's no ZLP, but we can leave that for later.
2023-03-18 19:51:57 +01:00
Lephe fc1f510288
usb: consolidate reading mode (basic multi-segment reads now working) 2023-03-12 17:53:44 +01:00
Lephe c59b2f90fb
usb: prototype reading mode
Currently only tested with short messages using the fxlink interface.
There is much to be expanded upon, but this is a worthy start.
2023-03-04 18:06:38 +01:00
Lephe eb1f9a35a1
usb: use negative values for error codes
This will allow usb_read_sync() to return a combined error code / size
read integer.
2023-03-04 18:06:38 +01:00
Lephe aee67a76f3
usb: clear pipes/FIFOs during world switches, delay configuration
* Clear pipes and FIFOs during world switches to avoid interference
  with the OS. LINK uses pipes 3 and 4, and attempts to add a second
  pipe to the fxlink interface (thus using pipe 4) would interfere with
  LINK and somehow prevent the pipe from being used (Wireshark captures
  showed no responses on that pipe). Forcing a blank state is a valid
  move because that state occurs naturally after a RESET, thus LINK and
  other add-ins must support it as well.

* Delay the application of configuration to the USB configuration stage
  (specifically, the DVST configured interrupt, even though technically
  we should do that in SET_CONFIGURATION 0). This is because we
  previously relied on world switches preserving pipe settings (by not
  changing them) to reconnect the gint driver after a world switch.
  This is no longer possible as the world switch now clears the pipes.
  The new timing makes the driver automatically re-configure as the
  connection restarts.
2023-02-18 17:15:28 +01:00
Lephe c0671649df
usb: prevent double opening
This could happen in gintctl's USB tracer and obviously cause all sorts
of problems.
2023-02-18 16:48:28 +01:00
Lephe 6910714c2c
asyncio: remove unused field asyncio_op_t.flying_w 2023-02-16 16:09:53 +01:00
Lephe af5c16a3d3
usb: massively improve writing logic
* Move logic around tracking transfers to asyncio.c.

* Add a "short buffer" holding 0-3 bytes between writes, so that the
  driver performs only 4-byte writes in the FIFO and a short write in
  the commit, if needed.
  - This is partially due to me thinking at some point that degrading
    writing size was impossible, but it might actually be possible by
    writing to FIFO/FIFO+2 or FIFO/FIFO+1/FIFO+2/FIFO+3.
  - In any case I think this new approach wins on performance.

* Get rid of unit_size since we now always use 4 bytes.

* Add a waiting function which is used in usb_close() (and once tested
  should be used in world switches too).

* Eliminate some of the special cases for the DCP, though not all (in
  particular I can't get the commit to rely on the BEMP interrupt yet,
  nor can I properly clear PID to NAK when unbinding).
2023-02-09 23:00:44 +01:00
Lephe 1a61e97ef0
mmu: provide read-only access to ITLB 2023-02-02 14:23:03 +01:00
Lephe 6f758cd36c
defs: allow NULL callbacks in gint_call() 2023-01-31 16:04:35 +01:00
Lephe 18e0db3886
usb: improve driver with updated knowledge and prepare reading
* Finish updating the register list
* Use RTC-based timeouts to not involve more interrupts
* Be a lot more conservative about PID=BUF
* Start setting up parameters and checking invariants for future
  bidirectional communications
2023-01-31 16:04:35 +01:00
Lephe cf2b86deaa
usb: update module details with register analysis experiments
Unknown writable bits and host-only registers were found.
2023-01-28 13:10:03 +01:00
Lephe 42853103aa
usb: remove incorrectly-ordered bits in USB registers 2023-01-25 16:28:20 +01:00
Lephe 7e859169fe
cpg: add overclock save/restore functions 2023-01-05 20:25:44 +01:00
Lephe b3416dcc25
cpg: add overclock for SH3/SH4 fx-9860G and G-III (#23)
Co-authored-by: Slyvtt <pillot.sylvain@gmail.com>
2023-01-05 20:02:41 +01:00
Lephe 736b58f205
reduce static user RAM footprint for mono targets
* Make INTC data const (it should've always been)
* Introduce GRODATA3/.gint.rodata.sh3 for that purpose
* Dynamically allocate file descriptor table
2023-01-01 19:22:41 +01:00
Lephe d3b29c50e6
defs: use C++ min/max when compiling in C++ mode 2023-01-01 18:49:13 +01:00
Lephe 1272a6a71a
scif: fix incorrect base module address 2022-12-20 22:27:35 +01:00