spca508.c
来自「trident tm5600的linux驱动」· C语言 代码 · 共 1,720 行 · 第 1/4 页
C
1,720 行
/* 50832 2067 */ {0x005b, 0x8651}, /* R gain for white balance ... */ /* 50857 2068 */ {0x0040, 0x8652}, /* 50882 2069 */ {0x0060, 0x8653}, /* 50907 2070 */ {0x0040, 0x8654}, /* 50932 2071 */ {0x0000, 0x8655}, /* 50957 2072 */ {0x0001, 0x863f}, /* Fixed gamma correction enable, USB control, * lum filter disable, lum noise clip disable */ /* 50982 2073 */ {0x00a1, 0x8656}, /* Window1 size 256x256, Windows2 size 64x64, * gamma look-up disable, new edge enhancement enable */ /* 51007 2074 */ {0x0018, 0x8657}, /* Edge gain high thresh */ /* 51032 2075 */ {0x0020, 0x8658}, /* Edge gain low thresh */ /* 51057 2076 */ {0x000a, 0x8659}, /* Edge bandwidth high threshold */ /* 51082 2077 */ {0x0005, 0x865a}, /* Edge bandwidth low threshold */ /* -------------------------------- */ /* 51107 2078 */ {0x0030, 0x8112}, /* Video drop enable, ISO streaming enable */ /* 51130 2079 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 51154 2080 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */ /* 51180 2081 */ {0xa908, 0x8802}, /* 51205 2082 */ {0x0034, 0x8801}, /* SSI reg addr */ /* 51230 2083 */ {0x00ca, 0x8800}, /* SSI data to write */ /* 51253 2084 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 51277 2085 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 51301 2086 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */ /* 51327 2087 */ {0x1f08, 0x8802}, /* 51352 2088 */ {0x0006, 0x8801}, /* 51377 2089 */ {0x0080, 0x8800}, /* 51400 2090 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 *//* ----- Read back coefs we wrote earlier. */ /* 51424 2091 */ /* READ { 0, 0x0000, 0x8608 } -> 0000: 15 */ /* 51448 2092 */ /* READ { 0, 0x0000, 0x8609 } -> 0000: 30 */ /* 51472 2093 */ /* READ { 0, 0x0000, 0x860a } -> 0000: fb */ /* 51496 2094 */ /* READ { 0, 0x0000, 0x860b } -> 0000: 3e */ /* 51520 2095 */ /* READ { 0, 0x0000, 0x860c } -> 0000: ce */ /* 51544 2096 */ /* READ { 0, 0x0000, 0x860d } -> 0000: f4 */ /* 51568 2097 */ /* READ { 0, 0x0000, 0x860e } -> 0000: eb */ /* 51592 2098 */ /* READ { 0, 0x0000, 0x860f } -> 0000: dc */ /* 51616 2099 */ /* READ { 0, 0x0000, 0x8610 } -> 0000: 39 */ /* 51640 2100 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 51664 2101 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */ /* 51690 2102 */ {0xb008, 0x8802}, /* 51715 2103 */ {0x0006, 0x8801}, /* 51740 2104 */ {0x007d, 0x8800}, /* 51763 2105 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */#if 0 /* experimental. dark version. */ {0xba, 0x8705}, /* total pixel clocks per hsync cycle (L) */ {0x00, 0x8706}, /* total pixel clocks per hsync cycle (H in 2:0) */ {0x5a, 0x8707}, /* total pixel clocks per hsync blank period (L) */#elif 0 /* experimental. factory default. */ {0x8e, 0x8705}, /* total pixel clocks per hsync cycle (L) */ {0x03, 0x8706}, /* total pixel clocks per hsync cycle (H in 2:0) */ {0x5a, 0x8707}, /* total pixel clocks per hsync blank period (L) */#elif 0 /* experimental. light. */ {0xba, 0x8705}, /* total pixel clocks per hsync cycle (L) */ {0x01, 0x8706}, /* total pixel clocks per hsync cycle (H in 2:0) */ {0x10, 0x8707}, /* total pixel clocks per hsync blank period (L) */#endif#if 1 /* This chunk is seemingly redundant with */ /* earlier commands (A11 Coef...), but if I disable it, */ /* the image appears too dark. Maybe there was some kind of */ /* reset since the earlier commands, so this is necessary again. */ /* 51789 2106 */ {0x0015, 0x8608}, /* 51814 2107 */ {0x0030, 0x8609}, /* 51839 2108 */ {0xfffb, 0x860a}, /* 51864 2109 */ {0x003e, 0x860b}, /* 51889 2110 */ {0xffce, 0x860c}, /* 51914 2111 */ {0xfff4, 0x860d}, /* 51939 2112 */ {0xffeb, 0x860e}, /* 51964 2113 */ {0xffdc, 0x860f}, /* 51989 2114 */ {0x0039, 0x8610}, /* 52014 2115 */ {0x0018, 0x8657},#endif /* 52039 2116 */ {0x0000, 0x8508}, /* Disable compression. */ /* Previous line was: * 52039 2116 * { 0, 0x0021, 0x8508 }, * Enable compression. */ /* 52064 2117 */ {0x0032, 0x850b}, /* compression stuff */ /* 52089 2118 */ {0x0003, 0x8509}, /* compression stuff */ /* 52114 2119 */ {0x0011, 0x850a}, /* compression stuff */ /* 52139 2120 */ {0x0021, 0x850d}, /* compression stuff */ /* 52164 2121 */ {0x0010, 0x850c}, /* compression stuff */ /* 52189 2122 */ {0x0003, 0x8500}, /* *** Video mode: 160x120 */ /* 52214 2123 */ {0x0001, 0x8501}, /* Hardware-dominated snap control */ /* 52239 2124 */ {0x0061, 0x8656}, /* Window1 size 128x128, Windows2 size 128x128, * gamma look-up disable, new edge enhancement enable */ /* 52264 2125 */ {0x0018, 0x8617}, /* Window1 start X (*2) */ /* 52289 2126 */ {0x0008, 0x8618}, /* Window1 start Y (*2) */ /* 52314 2127 */ {0x0061, 0x8656}, /* Window1 size 128x128, Windows2 size 128x128, * gamma look-up disable, new edge enhancement enable */ /* 52339 2128 */ {0x0058, 0x8619}, /* Window2 start X (*2) */ /* 52364 2129 */ {0x0008, 0x861a}, /* Window2 start Y (*2) */ /* 52389 2130 */ {0x00ff, 0x8615}, /* High lum thresh for white balance */ /* 52414 2131 */ {0x0000, 0x8616}, /* Low lum thresh for white balance */ /* 52439 2132 */ {0x0012, 0x8700}, /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */ /* 52464 2133 */ {0x0012, 0x8700}, /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */ /* 52487 2134 */ /* READ { 0, 0x0000, 0x8656 } -> 0000: 61 */ /* 52513 2135 */ {0x0028, 0x8802}, /* 375 Khz SSI clock, SSI r/w sync with VSYNC */ /* 52536 2136 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 52560 2137 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */ /* 52586 2138 */ {0x1f28, 0x8802}, /* 375 Khz SSI clock, SSI r/w sync with VSYNC */ /* 52611 2139 */ {0x0010, 0x8801}, /* SSI reg addr */ /* 52636 2140 */ {0x003e, 0x8800}, /* SSI data to write */ /* 52659 2141 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 52685 2142 */ {0x0028, 0x8802}, /* 52708 2143 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 52732 2144 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */ /* 52758 2145 */ {0x1f28, 0x8802}, /* 52783 2146 */ {0x0000, 0x8801}, /* 52808 2147 */ {0x001f, 0x8800}, /* 52831 2148 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 52857 2149 */ {0x0001, 0x8602}, /* optical black level for user settning = 1 */#if 0 /* NOTE: Code like this case lets this driver (often) work */ /* in 352x288 resolution, apparently by slowing down the */ /* clock. */ /* 52464 2133 */ {0x002F, 0x8700}, /* Clock speed */#else /* Original: */ /* 52882 2150 */ {0x0023, 0x8700}, /* Clock speed 48Mhz/(3+2)/4= 2.4 Mhz */#endif /* 52907 2151 */ {0x000f, 0x8602}, /* optical black level for user settning = 15 */ /* 52932 2152 */ {0x0028, 0x8802}, /* 52955 2153 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 52979 2154 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */ /* 53005 2155 */ {0x1f28, 0x8802}, /* 53030 2156 */ {0x0010, 0x8801}, /* 53055 2157 */ {0x007b, 0x8800}, /* 53078 2158 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */ /* 53104 2159 */ {0x002f, 0x8651}, /* R gain for white balance ... */ /* 53129 2160 */ {0x0080, 0x8653}, /* 53152 2161 */ /* READ { 0, 0x0000, 0x8655 } -> 0000: 00 */ /* 53178 2162 */ {0x0000, 0x8655}, /* 53203 2163 */ {0x0030, 0x8112}, /* Video drop enable, ISO streaming enable */ /* 53228 2164 */ {0x0020, 0x8112}, /* Video drop enable, ISO streaming disable */ /* 53252 2165 */ /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE: (ALT=0) ) */ {}};#if 0/* * Data to initialize the camera using the internal CCD */static const __u16 spca508_open_data[][3] = { /* line bmRequest,value,index */ {}};#endif/* * Initialization data for Intel EasyPC Camera CS110 */static const __u16 spca508cs110_init_data[][3] = { {0x0000, 0x870b}, /* Reset CTL3 */ {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */ {0x0000, 0x8111}, /* Normal operation on reset */ {0x0090, 0x8110}, /* External Clock 2x & Synchronous Serial Interface Output */ {0x0020, 0x8112}, /* Video Drop packet enable */ {0x0000, 0x8114}, /* Software GPIO output data */ {0x0001, 0x8114}, {0x0001, 0x8114}, {0x0001, 0x8114}, {0x0003, 0x8114}, /* Initial sequence Synchronous Serial Interface */ {0x000f, 0x8402}, /* Memory bank Address */ {0x0000, 0x8403}, /* Memory bank Address */ {0x00ba, 0x8804}, /* SSI Slave address */ {0x0010, 0x8802}, /* 93.75kHz SSI Clock Two DataByte */ {0x0010, 0x8802}, /* 93.75kHz SSI Clock two DataByte */ {0x0001, 0x8801}, {0x000a, 0x8805},/* a - NWG: Dunno what this is about */ {0x0000, 0x8800}, {0x0010, 0x8802}, {0x0002, 0x8801}, {0x0000, 0x8805}, {0x0000, 0x8800}, {0x0010, 0x8802}, {0x0003, 0x8801}, {0x0027, 0x8805}, {0x0001, 0x8800}, {0x0010, 0x8802}, {0x0004, 0x8801}, {0x0065, 0x8805}, {0x0001, 0x8800}, {0x0010, 0x8802}, {0x0005, 0x8801}, {0x0003, 0x8805}, {0x0000, 0x8800}, {0x0010, 0x8802}, {0x0006, 0x8801}, {0x001c, 0x8805}, {0x0000, 0x8800}, {0x0010, 0x8802}, {0x0007, 0x8801}, {0x002a, 0x8805}, {0x0000, 0x8800}, {0x0010, 0x8802}, {0x0002, 0x8704}, /* External input CKIx1 */ {0x0001, 0x8606}, /* 1 Line memory Read Counter (H) Result: (d)410 */ {0x009a, 0x8600}, /* Line memory Read Counter (L) */ {0x0001, 0x865b}, /* 1 Horizontal Offset for Valid Pixel(L) */ {0x0003, 0x865c}, /* 3 Vertical Offset for Valid Lines(L) */ {0x0058, 0x865d}, /* 58 Horizontal Valid Pixel Window(L) */ {0x0006, 0x8660}, /* Nibble data + input order */ {0x000a, 0x8602}, /* Optical black level set to 0x0a *//* 1945 */ {0x0000, 0x8603}, /* Optical black level Offset *//* 1962 * {0, 0x0000, 0x8611}, * 0 R Offset for white Balance *//* 1963 * {0, 0x0000, 0x8612}, * 1 Gr Offset for white Balance *//* 1964 * {0, 0x0000, 0x8613}, * 1f B Offset for white Balance *//* 1965 * {0, 0x0000, 0x8614}, * f0 Gb Offset for white Balance */ {0x0040, 0x8651}, /* 2b BLUE gain for white balance good at all 60 */ {0x0030, 0x8652}, /* 41 Gr Gain for white Balance (L) */ {0x0035, 0x8653}, /* 26 RED gain for white balance */ {0x0035, 0x8654}, /* 40Gb Gain for white Balance (L) */ {0x0041, 0x863f}, /* Fixed Gamma correction enabled (makes colours look better) *//* 2422 */ {0x0000, 0x8655}, /* High bits for white balance*****brightness control*** */ {}};static const __u16 spca508_sightcam_init_data[][3] = {/* This line seems to setup the frame/canvas */ /*368 */ {0x000f, 0x8402},/* Theese 6 lines are needed to startup the webcam */ /*398 */ {0x0090, 0x8110}, /*399 */ {0x0001, 0x8114}, /*400 */ {0x0001, 0x8114}, /*401 */ {0x0001, 0x8114}, /*402 */ {0x0003, 0x8114}, /*403 */ {0x0080, 0x8804},/* This part seems to make the pictures darker? (autobrightness?) */ /*436 */ {0x0001, 0x8801}, /*437 */ {0x0004, 0x8800}, /*439 */ {0x0003, 0x8801}, /*440 */ {0x00e0, 0x8800}, /*442 */ {0x0004, 0x8801}, /*443 */ {0x00b4, 0x8800}, /*445 */ {0x0005, 0x8801}, /*446 */ {0x0000, 0x8800}, /*448 */ {0x0006, 0x8801}, /*449 */ {0x00e0, 0x8800}, /*451 */ {0x0007, 0x8801}, /*452 */ {0x000c, 0x8800},/* This section is just needed, it probably * does something like the previous section, * but the cam won't start if it's not included. */ /*484 */ {0x0014, 0x8801}, /*485 */ {0x0008, 0x8800}, /*487 */ {0x0015, 0x8801}, /*488 */ {0x0067, 0x8800}, /*490 */ {0x0016, 0x8801}, /*491 */ {0x0000, 0x8800}, /*493 */ {0x0017, 0x8801}, /*494 */ {0x0020, 0x8800}, /*496 */ {0x0018, 0x8801}, /*497 */ {0x0044, 0x8800},/* Makes the picture darker - and the * cam won't start if not included */ /*505 */ {0x001e, 0x8801}, /*506 */ {0x00ea, 0x8800}, /*508 */ {0x001f, 0x8801}, /*509 */ {0x0001, 0x8800}, /*511 */ {0x0003, 0x8801}, /*512 */ {0x00e0, 0x8800},/* seems to place the colors ontop of each other #1 */ /*517 */ {0x0006, 0x8704}, /*518 */ {0x0001, 0x870c}, /*519 */ {0x0016, 0x8600}, /*520 */ {0x0002, 0x8606},/* if not included the pictures becomes _very_ dark */ /*521 */ {0x0064, 0x8607}, /*522 */ {0x003a, 0x8601}, /*523 */ {0x0000, 0x8602},/* seems to place the colors ontop of each other #2 */ /*524 */ {0x0016, 0x8600}, /*525 */ {0x0018, 0x8617}, /*526 */ {0x0008, 0x8618}, /*527 */ {0x00a1, 0x8656},/* webcam won't start if not included */ /*528 */ {0x0007, 0x865b}, /*529 */ {0x0001, 0x865c}, /*530 */ {0x0058, 0x865d}, /*531 */ {0x0048, 0x865e},/* adjusts the colors */ /*541 */ {0x0049, 0x8651}, /*542 */ {0x0040, 0x8652}, /*543 */ {0x004c, 0x8653}, /*544 */ {0x0040, 0x8654}, {}};static const __u16 spca508_sightcam2_init_data[][3] = {#if 1/* 35 */ {0x0020, 0x8112},/* 36 */ {0x000f, 0x8402},/* 37 */ {0x0000, 0x8403},/* 38 */ {0x0008, 0x8201},/* 39 */ {0x0008, 0x8200},/* 40 */ {0x0001, 0x8200},/* 43 */ {0x0009, 0x8201},/* 44 */ {0x0008, 0x8200},/* 45 */ {0x0001, 0x8200},/* 48 */ {0x000a, 0x8201},/* 49 */ {0x0008, 0x8200},/* 50 */ {0x0001, 0x8200},/* 53 */ {0x000b, 0x8201},/* 54 */ {0x0008, 0x8200},/* 55 */ {0x0001, 0x8200},/* 58 */ {0x000c, 0x8201},/* 59 */ {0x0008, 0x8200},/* 60 */ {0x0001, 0x8200},/* 63 */ {0x000d, 0x8201},/* 64 */ {0x0008, 0x8200},/* 65 */ {0x0001, 0x8200},/* 68 */ {0x000e, 0x8201},/* 69 */ {0x0008, 0x8200},/* 70 */ {0x0001, 0x8200},/* 73 */ {0x0007, 0x8201},/* 74 */ {0x0008, 0x8200},/* 75 */ {0x0001, 0x8200},/* 78 */ {0x000f, 0x8201},/* 79 */ {0x0008, 0x8200},/* 80 */ {0x0001, 0x8200},/* 84 */ {0x0018, 0x8660},/* 85 */ {0x0010, 0x8201},/* 86 */ {0x0008, 0x8200},/* 87 */ {0x0001, 0x8200},/* 90 */ {0x0011, 0x8201},/* 91 */ {0x0008, 0x8200},/* 92 */ {0x0001, 0x8200},/* 95 */ {0x0000, 0x86b0},/* 96 */ {0x0034, 0x86b1},/* 97 */ {0x0000, 0x86b2},/* 98 */ {0x0049, 0x86b3},/* 99 */ {0x0000, 0x86b4},/* 100 */ {0x0000, 0x86b4},/* 101 */ {0x0012, 0x8201},/* 102 */ {0x0008, 0x8200},/* 103 */ {0x0001, 0x8200},/* 106 */ {0x0013, 0x8201},/* 107 */ {0x0008, 0x8200},/* 108 */ {0x0001, 0x8200},/* 111 */ {0x0001, 0x86b0},/* 112 */ {0x00aa, 0x86b1},/* 113 */ {0x0000, 0x86b2},/* 114 */ {0x00e4, 0x86b3},
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?