PicoCamera 0.2.0
Camera library for RP2040 with an esp32-camera compatible API
GitHub
载入中...
搜索中...
未找到
ov3660_regs.h
浏览该文件的文档.
1/*
2 * This file is part of the PicoCamera project.
3 * https://github.com/umeiko/PicoCamera
4 *
5 * Author: umeko <umeko@stu.xmu.edu.cn>
6 * License: MIT
7 */
8
15#ifndef __OV3660_REGS_H__
16#define __OV3660_REGS_H__
17
18/* product ID registers */
19#define REG_PIDH 0x300A // Product ID high byte (0x36)
20#define REG_PIDL 0x300B // Product ID low byte (0x60)
21
22/* system control registers */
23#define SYSTEM_CTROL0 0x3008 // Bit[7]: Software reset
24 // Bit[6]: Software power down
25 // Bit[5]: Reserved
26 // Bit[4]: SRB clock SYNC enable
27 // Bit[3]: Isolation suspend select
28 // Bit[2:0]: Not used
29
30/* output format control registers */
31#define FORMAT_CTRL 0x501F // Format select
32 // Bit[2:0]:
33 // 000: YUV422
34 // 001: RGB
35 // 010: Dither
36 // 011: RAW after DPC
37 // 101: RAW after CIP
38
39/* format control registers */
40#define FORMAT_CTRL00 0x4300
41
42/* frame control registers */
43#define FRAME_CTRL01 0x4201 // Control Passed Frame Number When both ON and OFF number set to 0x00,frame control is in bypass mode
44 // Bit[7:4]: Not used
45 // Bit[3:0]: Frame ON number
46#define FRAME_CTRL02 0x4202 // Control Masked Frame Number When both ON and OFF number set to 0x00,frame control is in bypass mode
47 // Bit[7:4]: Not used
48 // BIT[3:0]: Frame OFF number
49
50/* ISP top control registers */
51#define PRE_ISP_TEST_SETTING_1 0x503D // Bit[7]: Test enable
52 // 0: Test disable
53 // 1: Color bar enable
54 // Bit[6]: Rolling
55 // Bit[5]: Transparent
56 // Bit[4]: Square black and white
57 // Bit[3:2]: Color bar style
58 // 00: Standard 8 color bar
59 // 01: Gradual change at vertical mode 1
60 // 10: Gradual change at horizontal
61 // 11: Gradual change at vertical mode 2
62 // Bit[1:0]: Test select
63 // 00: Color bar
64 // 01: Random data
65 // 10: Square data
66 // 11: Black image
67
68//exposure = {0x3500[3:0], 0x3501[7:0], 0x3502[7:0]} / 16 × tROW
69
70/* AEC/AGC control functions */
71#define AEC_PK_MANUAL 0x3503 // AEC Manual Mode Control
72 // Bit[7:6]: Reserved
73 // Bit[5]: Gain delay option
74 // Valid when 0x3503[4]=1’b0
75 // 0: Delay one frame latch
76 // 1: One frame latch
77 // Bit[4:2]: Reserved
78 // Bit[1]: AGC manual
79 // 0: Auto enable
80 // 1: Manual enable
81 // Bit[0]: AEC manual
82 // 0: Auto enable
83 // 1: Manual enable
84
85//gain = {0x350A[1:0], 0x350B[7:0]} / 16
86
87/* mirror and flip registers */
88#define TIMING_TC_REG20 0x3820 // Timing Control Register
89 // Bit[2:1]: Vertical flip enable
90 // 00: Normal
91 // 11: Vertical flip
92 // Bit[0]: Vertical binning enable
93#define TIMING_TC_REG21 0x3821 // Timing Control Register
94 // Bit[5]: Compression Enable
95 // Bit[2:1]: Horizontal mirror enable
96 // 00: Normal
97 // 11: Horizontal mirror
98 // Bit[0]: Horizontal binning enable
99
100#define CLOCK_POL_CONTROL 0x4740// Bit[5]: PCLK polarity 0: active low
101 // 1: active high
102 // Bit[3]: Gate PCLK under VSYNC
103 // Bit[2]: Gate PCLK under HREF
104 // Bit[1]: HREF polarity
105 // 0: active low
106 // 1: active high
107 // Bit[0] VSYNC polarity
108 // 0: active low
109 // 1: active high
110#define DRIVE_CAPABILITY 0x302c // Bit[7:6]:
111 // 00: 1x
112 // 01: 2x
113 // 10: 3x
114 // 11: 4x
115
116
117#define X_ADDR_ST_H 0x3800 //Bit[3:0]: X address start[11:8]
118#define X_ADDR_ST_L 0x3801 //Bit[7:0]: X address start[7:0]
119#define Y_ADDR_ST_H 0x3802 //Bit[2:0]: Y address start[10:8]
120#define Y_ADDR_ST_L 0x3803 //Bit[7:0]: Y address start[7:0]
121#define X_ADDR_END_H 0x3804 //Bit[3:0]: X address end[11:8]
122#define X_ADDR_END_L 0x3805 //Bit[7:0]:
123#define Y_ADDR_END_H 0x3806 //Bit[2:0]: Y address end[10:8]
124#define Y_ADDR_END_L 0x3807 //Bit[7:0]:
125// Size after scaling
126#define X_OUTPUT_SIZE_H 0x3808 //Bit[3:0]: DVP output horizontal width[11:8]
127#define X_OUTPUT_SIZE_L 0x3809 //Bit[7:0]:
128#define Y_OUTPUT_SIZE_H 0x380a //Bit[2:0]: DVP output vertical height[10:8]
129#define Y_OUTPUT_SIZE_L 0x380b //Bit[7:0]:
130#define X_TOTAL_SIZE_H 0x380c //Bit[3:0]: Total horizontal size[11:8]
131#define X_TOTAL_SIZE_L 0x380d //Bit[7:0]:
132#define Y_TOTAL_SIZE_H 0x380e //Bit[7:0]: Total vertical size[15:8]
133#define Y_TOTAL_SIZE_L 0x380f //Bit[7:0]:
134#define X_OFFSET_H 0x3810 //Bit[3:0]: ISP horizontal offset[11:8]
135#define X_OFFSET_L 0x3811 //Bit[7:0]:
136#define Y_OFFSET_H 0x3812 //Bit[2:0]: ISP vertical offset[10:8]
137#define Y_OFFSET_L 0x3813 //Bit[7:0]:
138#define X_INCREMENT 0x3814 //Bit[7:4]: Horizontal odd subsample increment
139 //Bit[3:0]: Horizontal even subsample increment
140#define Y_INCREMENT 0x3815 //Bit[7:4]: Vertical odd subsample increment
141 //Bit[3:0]: Vertical even subsample increment
142// Size before scaling
143//#define X_INPUT_SIZE (X_ADDR_END - X_ADDR_ST + 1 - (2 * X_OFFSET))
144//#define Y_INPUT_SIZE (Y_ADDR_END - Y_ADDR_ST + 1 - (2 * Y_OFFSET))
145
146#define ISP_CONTROL_01 0x5001 // Bit[5]: Scale enable
147 // 0: Disable
148 // 1: Enable
149
150#define SCALE_CTRL_1 0x5601 // Bit[6:4]: HDIV RW
151 // DCW scale times
152 // 000: DCW 1 time
153 // 001: DCW 2 times
154 // 010: DCW 4 times
155 // 100: DCW 8 times
156 // 101: DCW 16 times
157 // Others: DCW 16 times
158 // Bit[2:0]: VDIV RW
159 // DCW scale times
160 // 000: DCW 1 time
161 // 001: DCW 2 times
162 // 010: DCW 4 times
163 // 100: DCW 8 times
164 // 101: DCW 16 times
165 // Others: DCW 16 times
166
167#define SCALE_CTRL_2 0x5602 // X_SCALE High Bits
168#define SCALE_CTRL_3 0x5603 // X_SCALE Low Bits
169#define SCALE_CTRL_4 0x5604 // Y_SCALE High Bits
170#define SCALE_CTRL_5 0x5605 // Y_SCALE Low Bits
171#define SCALE_CTRL_6 0x5606 // Bit[3:0]: V Offset
172
173#define PCLK_RATIO 0x3824 // Bit[4:0]: PCLK ratio manual
174#define VFIFO_CTRL0C 0x460C // Bit[1]: PCLK manual enable
175 // 0: Auto
176 // 1: Manual by PCLK_RATIO
177
178#define VFIFO_X_SIZE_H 0x4602
179#define VFIFO_X_SIZE_L 0x4603
180#define VFIFO_Y_SIZE_H 0x4604
181#define VFIFO_Y_SIZE_L 0x4605
182
183#define SC_PLLS_CTRL0 0x303a // Bit[7]: PLLS bypass
184#define SC_PLLS_CTRL1 0x303b // Bit[4:0]: PLLS multiplier
185#define SC_PLLS_CTRL2 0x303c // Bit[6:4]: PLLS charge pump control
186 // Bit[3:0]: PLLS system divider
187#define SC_PLLS_CTRL3 0x303d // Bit[5:4]: PLLS pre-divider
188 // 00: 1
189 // 01: 1.5
190 // 10: 2
191 // 11: 3
192 // Bit[2]: PLLS root-divider - 1
193 // Bit[1:0]: PLLS seld5
194 // 00: 1
195 // 01: 1
196 // 10: 2
197 // 11: 2.5
198
199#define COMPRESSION_CTRL00 0x4400 //
200#define COMPRESSION_CTRL01 0x4401 //
201#define COMPRESSION_CTRL02 0x4402 //
202#define COMPRESSION_CTRL03 0x4403 //
203#define COMPRESSION_CTRL04 0x4404 //
204#define COMPRESSION_CTRL05 0x4405 //
205#define COMPRESSION_CTRL06 0x4406 //
206#define COMPRESSION_CTRL07 0x4407 // Bit[5:0]: QS
207#define COMPRESSION_ISI_CTRL 0x4408 //
208#define COMPRESSION_CTRL09 0x4409 //
209#define COMPRESSION_CTRL0a 0x440a //
210#define COMPRESSION_CTRL0b 0x440b //
211#define COMPRESSION_CTRL0c 0x440c //
212#define COMPRESSION_CTRL0d 0x440d //
213#define COMPRESSION_CTRL0E 0x440e //
214
218#define TEST_COLOR_BAR 0xC0 /* Enable Color Bar roling Test */
219
220#define AEC_PK_MANUAL_AGC_MANUALEN 0x02 /* Enable AGC Manual enable */
221#define AEC_PK_MANUAL_AEC_MANUALEN 0x01 /* Enable AEC Manual enable */
222
223#define TIMING_TC_REG20_VFLIP 0x06 /* Vertical flip enable */
224#define TIMING_TC_REG21_HMIRROR 0x06 /* Horizontal mirror enable */
225
226#endif // __OV3660_REGS_H__
English version