Lephe
af5c16a3d3
* 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).
43 lines
1 KiB
C
43 lines
1 KiB
C
#ifdef FX9860G
|
|
|
|
#include <gint/usb.h>
|
|
#include <gint/usb-ff-bulk.h>
|
|
#include <gint/display.h>
|
|
#include <gint/gray.h>
|
|
|
|
static void capture_vram_gray(GUNUSED bool onscreen, char const *type)
|
|
{
|
|
uint32_t *light, *dark;
|
|
if(onscreen) dgray_getscreen(&light, &dark);
|
|
else dgray_getvram(&light, &dark);
|
|
|
|
usb_fxlink_header_t header;
|
|
usb_fxlink_image_t subheader;
|
|
|
|
usb_fxlink_fill_header(&header, "fxlink", type,
|
|
2048 + sizeof subheader);
|
|
|
|
subheader.width = htole32(DWIDTH);
|
|
subheader.height = htole32(DHEIGHT);
|
|
subheader.pixel_format = htole32(USB_FXLINK_IMAGE_GRAY);
|
|
|
|
int pipe = usb_ff_bulk_output();
|
|
usb_write_sync(pipe, &header, sizeof header, false);
|
|
usb_write_sync(pipe, &subheader, sizeof subheader, false);
|
|
usb_write_sync(pipe, light, 1024, false);
|
|
usb_write_sync(pipe, dark, 1024, false);
|
|
usb_commit_sync(pipe);
|
|
}
|
|
|
|
void usb_fxlink_screenshot_gray(bool onscreen)
|
|
{
|
|
capture_vram_gray(onscreen, "image");
|
|
}
|
|
|
|
void usb_fxlink_videocapture_gray(bool onscreen)
|
|
{
|
|
capture_vram_gray(onscreen, "video");
|
|
}
|
|
|
|
#endif /* FX9860G */
|