summaryrefslogtreecommitdiff
path: root/fx2load.c
diff options
context:
space:
mode:
authorCharlie Root <root@dangofactory.local>2026-10-25 10:15:31 +0900
committerCharlie Root <root@dangofactory.local>2026-10-25 10:15:31 +0900
commit7318435b737394904bb1c5ce9fe013b0eee1882f (patch)
tree41adf14909f5f8d15c8e1c5db361e6ea0ac97598 /fx2load.c
downloadmpegcap-baseline-1016.tar.gz
mpegcap-baseline-1016.zip
kare / spoon - CX23416 + FX2 USB MPEG capture toolHEADbaseline-1016
Capture tool for the I-O DATA GV-MVP/RZ2 (04bb:0514): Conexant CX23416 MPEG encoder behind an EZ-USB FX2 bridge, with a CX25837 video decoder (I2C 0x44) and a WM8739 audio ADC (I2C 0x1a). libusb-1.0, C99, built with GNU make on FreeBSD/Linux. kare capture: MPEG-2 PS or raw HM12 (y4m), MPEG audio, --pcm WAV, live parameter control through CTLFILE spoon live viewer: pipe -> ffmpeg -> SDL2, clickable control bar, resizable window, raw PCM playback on -r State at this commit: - MPEG-2 PS 720x480 ~6.5 Mbit/s, colour, mp2 48 kHz stereo 224 kbit/s - raw HM12 (NV12_16L16, 518,416-byte frames) with selective median denoise - S-Video works: luma In1 + chroma In5 (0x103=0xd0); RCA is In2+In6 (0xe1) - VBI cropped: 0x0474=24 with 0x0477=28 (they must move together, +4) - audio: never issue an I2C READ to the WM8739 (write-only part) History note: this repository was squashed to a single commit on 2026-10-25 because the earlier history carried the CX23416 firmware images and the vendor trees. Those still exist on the working copy (firmware/, ref/) and are in .gitignore; only src/, include/, Makefile, README.md and .gitignore are versioned. The pre-squash history is preserved locally as a bundle.
Diffstat (limited to 'fx2load.c')
-rw-r--r--fx2load.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/fx2load.c b/fx2load.c
new file mode 100644
index 0000000..ebda258
--- /dev/null
+++ b/fx2load.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <libusb.h>
+
+int main(int argc, char **argv)
+{
+ libusb_context *c; libusb_device_handle *h;
+ FILE *f = fopen(argv[1], "rb");
+ static unsigned char fw[0x4000];
+ size_t len = fread(fw, 1, sizeof fw, f), off;
+ unsigned char one = 1, zero = 0;
+ int r;
+
+ libusb_init(&c);
+ h = libusb_open_device_with_vid_pid(c, 0x04b4, 0x8613);
+ if (!h) { puts("device not found"); return 1; }
+
+ r = libusb_control_transfer(h, 0x40, 0xA0, 0xE600, 0, &one, 1, 1000);
+ printf("reset assert: %d\n", r);
+ for (off = 0; off < len; off += 0x800) {
+ size_t n = len - off < 0x800 ? len - off : 0x800;
+ r = libusb_control_transfer(h, 0x40, 0xA0, off, 0, fw + off, n, 1000);
+ printf("0x%04zx: %d\n", off, r);
+ if (r < 0) return 1;
+ }
+ r = libusb_control_transfer(h, 0x40, 0xA0, 0xE600, 0, &zero, 1, 1000);
+ printf("reset release: %d\n", r);
+ return 0;
+}