From bba37b1ff7249ee6ec867a0d70b9a85933cd1907 Mon Sep 17 00:00:00 2001 From: Florin9doi Date: Tue, 12 Jan 2021 22:51:56 +0200 Subject: [PATCH] USB: EyeToy's default registers --- pcsx2/USB/usb-eyetoy/usb-eyetoy-webcam.cpp | 91 ++++++++++------------ 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/pcsx2/USB/usb-eyetoy/usb-eyetoy-webcam.cpp b/pcsx2/USB/usb-eyetoy/usb-eyetoy-webcam.cpp index 032f96fa64..cdd25f3267 100644 --- a/pcsx2/USB/usb-eyetoy/usb-eyetoy-webcam.cpp +++ b/pcsx2/USB/usb-eyetoy/usb-eyetoy-webcam.cpp @@ -266,59 +266,55 @@ namespace usb_eyetoy 0x00, 0x00, // wLockDelay 0 }; + static void reset_ov519(EYETOYState* s) + { + static const uint8_t ov519_defaults[] = { + 0xc0, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x98, 0xff, 0x00, 0x03, 0x00, 0x00, 0x1e, 0x01, 0xf1, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x00, 0x21, 0x00, 0x02, 0x6d, 0x0e, 0x00, 0x02, 0x00, 0x11, + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb4, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x03, 0x03, 0xfc, 0x00, 0xff, 0x00, 0x00, 0xff, + 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x04, 0x40, 0x40, 0x0c, 0x3f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0a, 0x0f, 0x1e, 0x2d, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x03, 0x00, 0x05, 0x02, 0x07, 0x00, 0x09, 0x02, 0x0b, 0x00, 0x0d, 0x02, 0x0f, + 0x00, 0x11, 0x02, 0x13, 0x00, 0x15, 0x02, 0x17, 0x00, 0x19, 0x02, 0x1b, 0x00, 0x1d, 0x02, 0x1f, + 0x50, 0x64, 0x82, 0x96, 0x82, 0x81, 0x00, 0x01, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x40, 0x60, 0x80, 0xa0, 0xc0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + memcpy(s->regs, ov519_defaults, sizeof(s->regs)); + } + static void reset_i2c(EYETOYState* s) { - /* OV7648 defaults */ - s->i2c_regs[0x00] = 0x00; //gain - s->i2c_regs[0x01] = 0x80; //blue - s->i2c_regs[0x02] = 0x80; //red - s->i2c_regs[0x03] = 0x84; //saturation - s->i2c_regs[0x04] = 0x34; //hue - s->i2c_regs[0x05] = 0x3E; //AWB - s->i2c_regs[0x06] = 0x80; //ABC brightness - s->i2c_regs[0x0A] = 0x76; //Product ID r/o - s->i2c_regs[0x0B] = 0x48; //Product version r/o - s->i2c_regs[0x10] = 0x41; //exposure - s->i2c_regs[0x11] = 0x00; //clk - s->i2c_regs[0x12] = 0x14; //Common A - s->i2c_regs[0x13] = 0xA3; //Common B - s->i2c_regs[0x14] = 0x04; //Common C - s->i2c_regs[0x15] = 0x00; //Common D - s->i2c_regs[0x17] = 0x1A; //hstart - s->i2c_regs[0x18] = 0xBA; //hstop - s->i2c_regs[0x19] = 0x03; //vstart - s->i2c_regs[0x1A] = 0xF3; //vstop - s->i2c_regs[0x1B] = 0x00; //pshift - s->i2c_regs[0x1C] = 0x7F; //Manufacture ID High read-only - s->i2c_regs[0x1D] = 0xA2; //Manufacture ID Low read-only - s->i2c_regs[0x1F] = 0x01; //output format - s->i2c_regs[0x20] = 0xC0; //Common E - s->i2c_regs[0x24] = 0x10; //AEW - s->i2c_regs[0x25] = 0x8A; //AEB - s->i2c_regs[0x26] = 0xA2; //Common F - s->i2c_regs[0x27] = 0xE2; //Common G - s->i2c_regs[0x28] = 0x20; //Common H - s->i2c_regs[0x29] = 0x00; //Common I - s->i2c_regs[0x2A] = 0x00; //Frame rate adj HI - s->i2c_regs[0x2B] = 0x00; //Frame rate adj LO - s->i2c_regs[0x2D] = 0x81; //Common J - s->i2c_regs[0x60] = 0x06; //Signal process B - s->i2c_regs[0x6C] = 0x11; //Color matrix R - s->i2c_regs[0x6D] = 0x01; //Color matrix G - s->i2c_regs[0x6E] = 0x06; //Color matrix B - s->i2c_regs[0x71] = 0x00; //Common L - s->i2c_regs[0x72] = 0x10; //HSYNC rising - s->i2c_regs[0x73] = 0x50; //HSYNC falling - s->i2c_regs[0x74] = 0x20; //Common M - s->i2c_regs[0x75] = 0x02; //Common N - s->i2c_regs[0x76] = 0x00; //Common O - s->i2c_regs[0x7E] = 0x00; //AVGY - s->i2c_regs[0x7F] = 0x00; //AVGR - s->i2c_regs[0x80] = 0x00; //AVGB + static const uint8_t ov7648_defaults[] = { + 0x00, 0x84, 0x84, 0x84, 0x34, 0x3e, 0x80, 0x8c, 0x00, 0x00, 0x76, 0x48, 0x7b, 0x5b, 0x00, 0x98, + 0x57, 0x00, 0x14, 0xa3, 0x04, 0x00, 0x00, 0x1a, 0xba, 0x03, 0xf3, 0x00, 0x7f, 0xa2, 0x00, 0x01, + 0xc0, 0x80, 0x80, 0xde, 0x10, 0x8a, 0xa2, 0xe2, 0x20, 0x00, 0x00, 0x00, 0x88, 0x81, 0x00, 0x94, + 0x40, 0xa0, 0xc0, 0x16, 0x16, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x00, + 0x06, 0xe0, 0x88, 0x11, 0x89, 0x02, 0x55, 0x01, 0x7a, 0x04, 0x00, 0x00, 0x11, 0x01, 0x06, 0x00, + 0x01, 0x00, 0x10, 0x50, 0x20, 0x02, 0x00, 0xf3, 0x80, 0x80, 0x80, 0x00, 0x00, 0x47, 0x27, 0x8a, + 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x75, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + memcpy(s->i2c_regs, ov7648_defaults, sizeof(s->regs)); } static void eyetoy_handle_reset(USBDevice* dev) { + reset_ov519((EYETOYState*)dev); reset_i2c((EYETOYState*)dev); } @@ -556,7 +552,6 @@ namespace usb_eyetoy usb_ep_init(&s->dev); eyetoy_handle_reset((USBDevice*)s); - reset_i2c(s); s->frame_step = 0; s->mpeg_frame_data = (unsigned char*)calloc(1, 320 * 240 * 4); // TODO: 640x480 ? s->mpeg_frame_offset = 0;