Test_OV9650.h
上传用户:dzdeming
上传日期:2022-08-03
资源大小:381k
文件大小:8k
源码类别:

Windows CE

开发平台:

Visual C++

  1. #ifndef _SMDK2440_OV7620_H_
  2. #define _SMDK2440_OV7620_H_
  3. #define CHIP_DELAY 0xFF
  4. #define BUSHI_DEF 0
  5. static struct ov7620_t {
  6. int subaddr;
  7. int value;
  8. } ov7620_reg[] = {
  9. {0x12, 0x80}, // Camera Soft reset. Self cleared after reset.
  10. {CHIP_DELAY, 10},
  11. {0x00, 0x00}, // 
  12. {0x01, 0x80}, // set blue gain
  13. {0x02, 0x80}, // set red gain
  14. #ifdef BUSHI_DEF
  15. {0x03, 0x80}, // saturation control
  16. #else
  17. {0x03, 0xb0}, // saturation control
  18. #endif
  19. // {0x06, 0x60}, // set brightness - CJH
  20. {0x06, 0x80}, // set brightness - SW.LEE
  21. // {0x0c, 0x24}, // set white balance blue background
  22. {0x0c, 0x20}, // set white balance blue background - SW.LEE
  23. // {0x0d, 0x24}, // set white balance red background
  24. {0x0d, 0x20}, // set white balance red background  - SW.LEE
  25. {0x10, 0xff}, // set auto exposure time, brightness control - CJH
  26. {0x11, (1<<7)+(0<<6)+(0x0)}, // HSYNC positive, CHSYNC negative, VSYNC posigive, 16 Bit : PCLK = CLK_in/((1+x)*2), 8 Bit : PCLK = CLK_in/(1+x)
  27. {0x12, 0x34}, // mirror image, enable AGC/AWB, precise A/D black level compensation
  28. {0x13, (0x1<<5)+(0x0<<4)+(0x1)},  // 8bit Data, CCIR601 Format
  29. {0x15, 0x01}, // Use PCLK rising edge to latch data, UV data output: 16 Bit - UVUV..., 8 Bit - UYVY...
  30. {0x16, 0x03}, // Field mode : 00-OFF mode, 01-ODD mode, 10-EVEN mode, 11-FRAME mode 
  31. {0x17, 0x2f}, //47
  32. {0x18, 0xcf}, // (207-47)*4=640
  33. {0x19, 0x06}, // 6
  34. {0x1a, 0xf5}, // (245-6+1)*2=480
  35. {0x1b, 0x00}, // Pixel Shift
  36. {0x20, 0x00}, // limit vertical size to 480, second stage aperture correction enable
  37. {0x21, 0x80}, // Y Channel Offset Adjustment - 0 , direction - Subtract
  38. {0x22, 0x80}, // U Channel Offset Adjustment - 0
  39. {0x23, 0x00}, // Crystal Current control : maximum current
  40. #ifdef BUSHI_DEF
  41. {0x24, 0x10}, // white pixel ratio,
  42. {0x25, 0x8a}, // black pixel ratio,
  43. #endif
  44. {0x26, 0xa2}, // Digital sharpness threshold, magnitude.
  45. #ifndef BUSHI_DEF
  46. {0x27, 0xea}, // Disable CCIR rang clip
  47. #else
  48. {0x27, 0xe2}, // Disable CCIR rang clip
  49. #endif
  50. {0x29, 0x00}, // 
  51. {0x2a, 0x00}, // frame rate high, 60Hz, 50Hz:0x80, UV delay 2 pixel. - CJH
  52. {0x2b, 0x00}, // frame rate low, 60Hz, 50Hz:0xac
  53. {0x2c, 0x88}, // 
  54. #ifdef BUSHI_DEF
  55. {0x2d, 0x91}, // 
  56. #endif
  57. {0x2e, 0x80}, // 
  58. #ifndef BUSHI_DEF
  59. {0x2f, 0x44}, // 
  60. #endif
  61. {0x60, 0x27}, // 
  62. {0x61, 0x82}, // 02?x.........................................
  63. #ifndef BUSHI_DEF
  64. {0x62, 0x5f}, // 
  65. #else
  66. {0x62, 0x5e}, // 
  67. #endif
  68. #ifndef BUSHI_DEF
  69. {0x63, 0xd5}, // 
  70. #endif
  71. {0x64, 0x57}, // Enable Y Gamma
  72. #ifndef BUSHI_DEF
  73. {0x65, 0x83}, // 
  74. #else
  75. {0x65, 0x43}, // 
  76. #endif
  77. {0x66, 0x55}, // 
  78. #ifdef BUSHI_DEF
  79. {0x67, 0x9a}, // 
  80. #endif
  81. #ifndef BUSHI_DEF
  82. {0x68, 0xcf}, // 
  83. #else
  84. {0x68, 0xcc}, // 
  85. #endif
  86. {0x69, 0x76}, // 
  87. {0x6a, 0x22}, // 
  88. #ifndef BUSHI_DEF
  89. {0x6b, 0x00}, // 
  90. {0x6c, 0x08}, // 
  91. {0x6d, 0x48}, // 
  92. {0x6e, 0x80}, // 
  93. #endif
  94. #ifndef BUSHI_DEF
  95. {0x6f, 0x0c}, // -CJH
  96. #else
  97. {0x6f, 0x3c}, // -CJH
  98. #endif
  99. {0x70, 0x89}, // -CJH
  100. {0x71, 0x00}, //  freerun PCLK
  101. {0x72, 0x14}, // 
  102. {0x73, 0x54}, // 
  103. {0x75, 0x0e}, // -CJH
  104. {0x76, 0x00}, // 
  105. #ifndef BUSHI_DEF
  106. {0x77, 0xff}, // 
  107. {0x78, 0x80}, // 
  108. {0x79, 0x80}, // 
  109. {0x7a, 0x80}, // 
  110. {0x7b, 0xe6}, // -CJH
  111. #endif
  112. {0x7c, 0x00}, // 
  113. #ifndef BUSHI_DEF
  114. {0x14, 0x94}, // turn off GAMMA - CJH
  115. #else
  116. {0x14, 0x14}, // turn off GAMMA - CJH
  117. #endif
  118. {0x24, 0x10}, // -CJH
  119. {0x25, 0x8a}, // -CJH
  120. {0x28, 0x20}, // Progressive mode.
  121. {0x2d, 0x95}, //
  122. {0x67, 0x92}, // 
  123. {0x74, 0x00}, // -CJH
  124. };
  125. #define OV7620_REGS (sizeof(ov7620_reg)/sizeof(ov7620_reg[0]))
  126. static struct ov7620_t ov9650_reg[] = 
  127. {
  128. {0x12, 0x80}, // Camera Soft reset. Self cleared after reset.
  129. {CHIP_DELAY, 10},
  130. /* {0x00, 0x00}, // 
  131. {0x01, 0x80}, // set blue gain
  132. {0x02, 0x80}, // set red gain
  133. {0x03, 0x00}, // saturation control ???
  134. //--- hzh
  135. //{0x04, 0x43}, // CCIR656 format, AEC low 2 LSB = 3
  136. {0x04, 0x03}, // CCIR601 format, AEC low 2 LSB = 3
  137. // {0x09, 0x03}, // output drive = 4x, default is 2x
  138. {0x10, 0xff}, // AEC[9:2] = 0xff
  139. {0x11, 0x40}, // PCLK use input clock directly
  140. //{0x11, 0x00}, // PCLK = input clock/2
  141. {0x12, 0x40}, // VGA
  142. {0x17, 0x10}, // hstart, 128, 128>>3 = 16
  143. {0x18, 0x60}, // hstop, 768, 768>>3 = 96
  144. {0x19, 0x20}, // vstart, 256, 256/8 = 32
  145. {0x1a, 0x5c}, // vstop, , 736/8 = 92
  146. //{0x1a, 0x3e}, // vstop, , 736/8 = 92
  147. {0x32, 0x00},
  148. // {0x0c, 0x40},
  149. // {0x3a, 0x18},
  150. // {0x67, 0x00},
  151. // {0x68, 0xff},
  152. // {0x40, 0xd0},
  153. {0x15, 0x10}, // PCLK reverse
  154. //---
  155. */
  156. #if 0
  157. //{0x12, 0x80}, 
  158. {0x39, 0x43}, {0x38, 0x12}, {0x37, 0x00}, {0x0e, 0x20},
  159. {0x1e, 0x0c}, {0x01, 0x80}, {0x02, 0x80}, {0x00, 0x00}, {0x10, 0xf0},
  160. {0x04, 0x00}, {0x0c, 0x00}, {0x0d, 0x00}, {0x11, 0x80}, {0x12, 0x00},
  161. {0x14, 0x2e}, {0x15, 0x00}, {0x18, 0x60}, {0x17, 0x10}, {0x32, 0xbf}, 
  162. {0x03, 0x12}, {0x1a, 0x5c}, {0x19, 0x20}, {0x3f, 0xa6}, {0x41, 0x02},
  163. {0x42, 0x08}, {0x1b, 0x00}, {0x16, 0x06}, {0x33, 0xc0}, {0x34, 0xbf},
  164. //{0xa8, 0x80}, //???
  165. {0x96, 0x04}, 
  166. {0x3a, 0x00}, 
  167. {0x8e, 0x00}, 
  168. {0x3c, 0x77}, 
  169. {0x8b, 0x06}, {0x35, 0x91}, {0x94, 0x88}, {0x95, 0x88}, {0x40, 0xc1}, 
  170. {0x29, 0x3f}, {0x0f, 0x42}, {0x13, 0xe5}, {0x3d, 0x92}, {0x69, 0x80}, 
  171. {0x5c, 0x96}, {0x5d, 0x96}, {0x5e, 0x10}, {0x59, 0xeb}, {0x5a, 0x9c},
  172. {0x5b, 0x55}, {0x43, 0xf0}, {0x44, 0x10}, {0x45, 0x55}, {0x46, 0x86},
  173. {0x47, 0x64}, {0x48, 0x86}, {0x5f, 0xe0}, {0x60, 0x8c}, {0x61, 0x20},
  174. {0xa5, 0xd9}, {0xa4, 0x74}, {0x8d, 0x02}, {0x13, 0xe7}, {0x4f, 0x3a}, 
  175. {0x50, 0x3d}, {0x51, 0x03}, {0x52, 0x12}, {0x53, 0x26}, {0x54, 0x38},
  176. {0x55, 0x40}, {0x56, 0x40}, {0x57, 0x40}, {0x58, 0x0d}, {0x8c, 0x23},
  177. {0x3e, 0x02}, {0xa9, 0xb8}, {0xaa, 0x92}, {0xab, 0x0a}, {0x8f, 0xdf},
  178. {0x90, 0x00}, {0x91, 0x00}, {0x9f, 0x00}, {0x3a, 0x0c}, {0x24, 0x70},
  179. {0x25, 0x64}, {0x26, 0xc3}, {0x2a, 0x12}, {0x2b, 0x46}, {0x3b, 0x19},
  180. {0x6c, 0x40}, {0x6d, 0x30}, {0x6e, 0x4b}, {0x6f, 0x60},  
  181. {0x70, 0x70}, {0x71, 0x70}, {0x72, 0x70}, {0x73, 0x70},
  182. {0x74, 0x60}, {0x75, 0x60}, {0x76, 0x50}, {0x77, 0x48},
  183. {0x78, 0x3a}, {0x79, 0x2e}, {0x7a, 0x28}, {0x7b, 0x22},
  184. {0x7c, 0x04}, {0x7d, 0x07}, {0x7e, 0x10}, {0x7f, 0x28},
  185. {0x80, 0x36}, {0x81, 0x44}, {0x82, 0x52}, {0x83, 0x60},
  186. {0x84, 0x6c}, {0x85, 0x78}, {0x86, 0x8c}, {0x87, 0x9e},
  187. {0x88, 0xbb}, {0x89, 0xd2}, {0x8a, 0xe6},
  188. {0x6a, 0x41}, {0x66, 0x00},
  189. {0x3e, 0x00}, {0x3f, 0xa4},
  190. {0x3a, 0x00}, //UYVY is suitable!
  191. {0x67, 0x55},  //0x67->U(RGB 1st lower),
  192. {0x68, 0xaa}, //0x68->V(RGB 2nd lower),
  193. //{0x0c, 0x40}, //MSB and LSB swap
  194. //{0x12, 0x40}, //VGA
  195.         {0x12, 0x44}, //VGA and RGB format
  196. {0x40, 0xd1}, //RGB565
  197. {0x11, 0x80}, //set PCLK as high as input clock
  198. //{0x11, 0x00}, //set PCLK as high as half of input clock
  199. {0x15, 0x10}, //PCLK reverse
  200. //{0x8d, 0x12},
  201. #else
  202. //change 0x11[0x81->0x80], 0x15[0x02->0x10], hzh
  203. //{0x12,0x80},
  204. {0x11,0x80},{0x6a,0x3e},{0x3b,0x09},{0x13,0xe0},{0x01,0x80},{0x02,0x80},{0x00,0x00},{0x10,0x00},
  205. {0x13,0xe5},{0x39,0x43},{0x38,0x12},{0x37,0x00},{0x35,0x91},{0x0e,0xa0},{0x1e,0x04},{0xA8,0x80},
  206. {0x12,0x40},{0x04,0x00},{0x0c,0x04},{0x0d,0x80},{0x18,0xc6},{0x17,0x26},{0x32,0xad},{0x03,0x00},
  207. {0x1a,0x3d},{0x19,0x01},{0x3f,0xa6},{0x14,0x2e},{0x15,0x10},{0x41,0x02},{0x42,0x08},{0x1b,0x00},
  208. {0x16,0x06},{0x33,0xe2},{0x34,0xbf},{0x96,0x04},{0x3a,0x00},{0x8e,0x00},{0x3c,0x77},{0x8B,0x06},
  209. {0x94,0x88},{0x95,0x88},{0x40,0xc1},{0x29,0x3f},{0x0f,0x42},{0x3d,0x92},{0x69,0x40},{0x5C,0xb9},
  210. {0x5D,0x96},{0x5E,0x10},{0x59,0xc0},{0x5A,0xaf},{0x5B,0x55},{0x43,0xf0},{0x44,0x10},{0x45,0x68},
  211. {0x46,0x96},{0x47,0x60},{0x48,0x80},{0x5F,0xe0},{0x60,0x8c},{0x61,0x20},{0xa5,0xd9},{0xa4,0x74},
  212. {0x8d,0x02},{0x13,0xe7},{0x4f,0x3a},{0x50,0x3d},{0x51,0x03},{0x52,0x12},{0x53,0x26},{0x54,0x38},
  213. {0x55,0x40},{0x56,0x40},{0x57,0x40},{0x58,0x0d},{0x8C,0x23},{0x3E,0x02},{0xa9,0xb8},{0xaa,0x92},
  214. {0xab,0x0a},{0x8f,0xdf},{0x90,0x00},{0x91,0x00},{0x9f,0x00},{0xa0,0x00},{0x3A,0x01},{0x24,0x70},
  215. {0x25,0x64},{0x26,0xc3},{0x2a,0x00},{0x2b,0x00},{0x6c,0x40},{0x6d,0x30},{0x6e,0x4b},{0x6f,0x60},
  216. {0x70,0x70},{0x71,0x70},{0x72,0x70},{0x73,0x70},{0x74,0x60},{0x75,0x60},{0x76,0x50},{0x77,0x48},
  217. {0x78,0x3a},{0x79,0x2e},{0x7a,0x28},{0x7b,0x22},{0x7c,0x04},{0x7d,0x07},{0x7e,0x10},{0x7f,0x28},
  218. {0x80,0x36},{0x81,0x44},{0x82,0x52},{0x83,0x60},{0x84,0x6c},{0x85,0x78},{0x86,0x8c},{0x87,0x9e},
  219. {0x88,0xbb},{0x89,0xd2},{0x8a,0xe6},
  220. //{0x15, 0x12}, // PCLK reverse
  221. #endif
  222. };
  223. #define OV9650_REGS (sizeof(ov9650_reg)/sizeof(ov9650_reg[0]))
  224. #endif /* _SMDK2440_OV7620_H_ */