|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Minimal self-contained macOS window for the board emulator. More...
#include <stddef.h>#include <stdint.h>#include <sys/types.h>#include "emu_presentation.h"#include "ra8_attributes.h"Go to the source code of this file.
Data Structures | |
| struct | board_view_storage_t |
| Caller-owned pointer-aligned storage for one platform view handle. More... | |
Typedefs | |
| typedef struct board_view | board_view_t |
| Opaque desktop-window handle (defined in board_view.m). | |
Functions | |
| board_view_t * | board_view_open (board_view_storage_t *storage, uint16_t width_px, uint16_t height_px, const char *title) |
| Open a desktop window of the given pixel size. | |
| void | board_view_present (board_view_t *view, emu_presentation_workspace_t *presentation) |
| Snapshot an RGB565 fd surface and request a redraw. | |
| size_t | board_view_read_rgb888_fd (int fd, off_t position, void *buffer, size_t count) |
| Expand an arbitrary byte range from a sealed RGB565 descriptor. | |
| bool | board_view_pump (board_view_t *view) |
| Drain pending UI events; report whether the window was closed. | |
| bool | board_view_poll_click (board_view_t *view, uint16_t *x, uint16_t *y) |
| Report the most recent unprocessed left mouse-down, once. | |
| bool | board_view_poll_drag (board_view_t *view, uint16_t *x, uint16_t *y) |
| Report the current position of a held-button drag, once. | |
| bool | board_view_poll_release (board_view_t *view) |
| Report whether the primary mouse button was released since the last poll. | |
| int32_t | board_view_poll_scroll (board_view_t *view) |
| Drain the accumulated console scroll-wheel notches since the last poll. | |
| void | board_view_close (board_view_t *view) |
| Close the window and release its resources. | |
Minimal self-contained macOS window for the board emulator.
A tiny C-ABI over Cocoa so ra8_emulator can SHOW what the emulated GLCDC is driving – present an immutable fd-backed RGB565 surface in a desktop window and report when the user closes it. Deliberately standalone (no firmware display-PAL dependency) to keep ra8_emulator a self-contained tool. The real Objective-C lives in board_view.m; this header is plain C so main.c needs no AppKit.
Definition in file board_view.h.
| typedef struct board_view board_view_t |
Opaque desktop-window handle (defined in board_view.m).
Definition at line 31 of file board_view.h.
| void board_view_close | ( | board_view_t * | view | ) |
Close the window and release its resources.
| [in] | view | Handle from board_view_open (nullptr is a no-op). |
Close the window and release its resources; this step is contained within the board view model and uses bounded caller or module-owned storage.
Close the window and release its resources.
| [in] | view | Always nullptr from board_view_open (unused). |
Definition at line 140 of file board_view_stub.c.
Referenced by priv_run_hold_view().
| board_view_t * board_view_open | ( | board_view_storage_t * | storage, |
| uint16_t | width_px, | ||
| uint16_t | height_px, | ||
| const char * | title ) |
Open a desktop window of the given pixel size.
| [in,out] | storage | Caller-owned zeroed handle storage. |
| [in] | width_px | Content width in pixels (>= 1). |
| [in] | height_px | Content height in pixels (>= 1). |
| [in] | title | NUL-terminated window title (ASCII). |
Open a desktop window of the given pixel size.
| [in,out] | storage | Caller-owned handle storage (unused, headless). |
| [in] | width_px | Content width in pixels (unused, headless). |
| [in] | height_px | Content height in pixels (unused, headless). |
| [in] | title | Window title (unused, headless). |
Definition at line 35 of file board_view_stub.c.
Referenced by internal_run_open_view().
| bool board_view_poll_click | ( | board_view_t * | view, |
| uint16_t * | x, | ||
| uint16_t * | y ) |
Report the most recent unprocessed left mouse-down, once.
Latches the framebuffer-pixel coordinate of the last left-button press on the content view (recorded by the view's mouseDown handler) and returns it to the caller exactly once – the latch is cleared on read, so a held button or repeated polls do not re-report the same press. Coordinates use the framebuffer's top-left origin (row 0 at the top), matching how board_view_present uploads pixels; the view's flipped-Y window space is converted here so the caller never sees AppKit's bottom-left origin. Pump the window (board_view_pump) first so AppKit has delivered the click.
| [in] | view | Handle from board_view_open (nullptr reports no click). |
| [out] | x | Click column in framebuffer pixels (top-left origin). |
| [out] | y | Click row in framebuffer pixels (top-left origin). |
| true | The board view poll click condition holds or completed successfully; false otherwise. |
Report the most recent unprocessed left mouse-down, once.
| [in] | view | Always nullptr from board_view_open (unused). |
| [out] | x | Click column (unused, never written). |
| [out] | y | Click row (unused, never written). |
Definition at line 83 of file board_view_stub.c.
Referenced by internal_run_loop_view().
| bool board_view_poll_drag | ( | board_view_t * | view, |
| uint16_t * | x, | ||
| uint16_t * | y ) |
Report the current position of a held-button drag, once.
Latches the framebuffer-pixel coordinate published by the view's mouseDragged handler while the primary button is held and moved, returning it to the caller once (the latch clears on read). This is independent of board_view_poll_click: the initial press is still reported once via that latch (so a click is routed once), while continued motion updates only the drag latch – letting the run loop follow the cursor for a grabbed control (the battery slider) without re-firing the one-shot press. Coordinates use the framebuffer's top-left origin, matching board_view_poll_click. Pump the window first.
| [in] | view | Handle from board_view_open (nullptr reports no drag). |
| [out] | x | Drag column in framebuffer pixels (top-left origin). |
| [out] | y | Drag row in framebuffer pixels (top-left origin). |
| true | The board view poll drag condition holds or completed successfully; false otherwise. |
Report the current position of a held-button drag, once.
| [in] | view | Always nullptr from board_view_open (unused). |
| [out] | x | Drag column (unused, never written). |
| [out] | y | Drag row (unused, never written). |
Definition at line 103 of file board_view_stub.c.
Referenced by internal_run_loop_view().
| bool board_view_poll_release | ( | board_view_t * | view | ) |
Report whether the primary mouse button was released since the last poll.
Latches the view's mouseUp event (left button released anywhere over the content view) and returns it to the caller exactly once – the latch clears on read. The run loop uses this to release a momentary on-screen push-button (SW1/SW2) that a prior board_view_poll_click pressed, so the buttons behave as real push-buttons (held only while the mouse is down) rather than latching switches, and to drop a battery-slider grab when the drag ends. Unlike board_view_poll_click/_drag this carries no coordinate – a release is a pure edge. Pump the window (board_view_pump) first so AppKit has delivered the up event.
| [in] | view | Handle from board_view_open (nullptr reports no release). |
| true | The board view poll release condition holds or completed successfully; false otherwise. |
Report whether the primary mouse button was released since the last poll.
| [in] | view | Always nullptr from board_view_open (unused). |
Definition at line 117 of file board_view_stub.c.
Referenced by internal_run_loop_view().
| int32_t board_view_poll_scroll | ( | board_view_t * | view | ) |
Drain the accumulated console scroll-wheel notches since the last poll.
The content view's scrollWheel handler accumulates one notch per wheel / two-finger scroll step (positive scrolling up into older console history, negative scrolling back down toward the newest line). This returns the net accumulated notches and clears the accumulator, so the run loop can advance a console scrollback offset. Independent of board_view_poll_click and of the keyDown path (which feeds the firmware UART RX), so scrolling the console never collides with clicking buttons or typing into the running app.
| [in] | view | Handle from board_view_open (nullptr returns 0). |
| value | The operation-specific board view poll scroll value. |
Drain the accumulated console scroll-wheel notches since the last poll.
| [in] | view | Always nullptr from board_view_open (unused). |
Definition at line 129 of file board_view_stub.c.
Referenced by internal_run_loop_view().
| void board_view_present | ( | board_view_t * | view, |
| emu_presentation_workspace_t * | presentation ) |
Snapshot an RGB565 fd surface and request a redraw.
The provider owns a separate immutable descriptor snapshot until CoreGraphics releases it, so callbacks cannot race the next emulated frame.
| [in] | view | Handle from board_view_open (nullptr is a no-op). |
| [in,out] | presentation | Complete fd surface and snapshot scratch. |
Snapshot an RGB565 fd surface and request a redraw.
| [in] | view | Always nullptr from board_view_open (unused). |
| [in,out] | presentation | Fd-backed surface (unused, headless). |
Definition at line 53 of file board_view_stub.c.
Referenced by internal_run_view_maybe_present(), and priv_run_hold_view().
| bool board_view_pump | ( | board_view_t * | view | ) |
Drain pending UI events; report whether the window was closed.
| [in] | view | Handle from board_view_open (nullptr returns true). |
Drain pending ui events; report whether the window was closed; this step is contained within the board view model and uses bounded caller or module-owned storage.
| true | The board view pump condition holds or completed successfully; false otherwise. |
Drain pending UI events; report whether the window was closed.
| [in] | view | Always nullptr from board_view_open (unused). |
Definition at line 65 of file board_view_stub.c.
Referenced by internal_run_loop_view(), and priv_run_hold_view().
| size_t board_view_read_rgb888_fd | ( | int | fd, |
| off_t | position, | ||
| void * | buffer, | ||
| size_t | count ) |
Expand an arbitrary byte range from a sealed RGB565 descriptor.
| [in] | fd | Immutable RGB565 surface descriptor. |
| [in] | position | Byte position in the virtual 0x00RRGGBB stream. |
| [out] | buffer | CoreGraphics-supplied destination bytes. |
| [in] | count | Requested destination byte count. |
fd remains open and immutable for the call. Expand an arbitrary byte range from a sealed rgb565 descriptor; this step is contained within the board view model and uses bounded caller or module-owned storage.
| value | The operation-specific board view read rgb888 descriptor value. |
Definition at line 87 of file board_view_pixels.c.
References internal_available_bytes(), internal_expand_chunk(), k_emu_io_ok, k_view_pixel_chunk, memcpy(), and priv_emu_io_pread_exact().