|
at91sam9g20 + MT9D131 + Jpeg (нет прерывания), Нет прерывания в ISI при включении Jpeg сжатия |
|
|
|
Oct 6 2011, 06:06
|
Группа: Новичок
Сообщений: 9
Регистрация: 6-10-11
Пользователь №: 67 570

|
Всем привет. Использую камеру MT9D131 и проц at91sam9g20 сумел поднять под линукс twi и как следствие настроить камеру, получилось завести драйвер atmel-isi. могу получать картинки (raw) в режиме превью получилось достичь результатов максимум 9-10 FPS. Научился переключаться в контекст Б, при выключенном Jpeg можем получать картинку(raw) заданного размера (согласно контексту Б) Но при включение Jpeg сжатия, нет прерывания в isi интерфейсе, и я так понимаю, что не приходят маркеры... Вопрос: каким образом настроит камеру, чтобы при включении контекста Б можно было получить Jpeg картинку? Что и как я делаю:Функция, которая прошивает регистры камеры:Код unsigned char mt9d313_config_capture(int fd) { unsigned char status = 0; struct twiData mode, state;
status = mt9d131_write_regs(fd, soft_reset1, 3); usleep(1000); status = mt9d131_write_regs(fd, soft_reset2, 1); usleep(500000); status = mt9d131_write_regs2(fd, settings, 177); usleep(500000); status = mt9d131_write_regs2(fd, set_Jpeg_mode,15); usleep(500000); status = mt9d131_write_regs2(fd, set_Capturing_Still_Pictures_mode, 17); usleep(500000); status = mt9d131_write_regs2(fd, refresh_seq_mode, 2); usleep(1000000); //status = mt9d131_write_regs2(fd, bt656_switch, 1);
//*
mode.Page = 1; mode.Reg = 0xC6; mode.Data = 0xA104; //mode.state
state.Page = 1; state.Reg = 0xC8; state.Data = 0;
mt9d131_write_regs(fd, Set_StepMode, 2);
//Переключаемся в контекст Б while (1) // Waiting for context B state (hex: 0x07) { status = mt9d131_write_regs(fd, set_Capture_mode, 2); if ((state.Data & 0xFF) == 0x04) mt9d131_write_regs(fd,Next_step, 2);
if ((state.Data & 0xFF) == 0x05) mt9d131_write_regs(fd,Next_step, 2);
if ((state.Data & 0xFF) == 0x06) mt9d131_write_regs(fd,Next_step, 2);
usleep(50000); write(fd, &mode, 1); usleep(50000); read(fd, &state, 1);
if ((state.Data & 0xFF) == 0x07) //0x07 break; }
usleep(3000000);//1000000 status = mt9d131_write_regs2(fd, bt656_switch, 1);
//*/ if (status) printf("TWI:Capture configuring failed \n");
return status; } Массивы настроек:Код const struct twiData soft_reset1[] = { {0, 0x65, 0xA000}, // bypassed PLL (prepare for soft reset) {1, 0xC3, 0x0501}, // MCU_BOOT_MODE (MCU reset) {0, 0x0D, 0x0021} // RESET_REG (enable soft reset) };
const struct twiData soft_reset2[] = { {0, 0x0D, 0x0000} // RESET_REG (disable soft reset) };
const struct twiData settings[] = { {0, 0x05, 0x011E}, //HBLANK (B) = 516 {0, 0x06, 0x000B}, //VBLANK (B) = 31 {0, 0x07, 0x011E}, //HBLANK (A) = 254 {0, 0x08, 0x000B}, //VBLANK (A) = 11 {0, 0x20, 0x0300}, //Read Mode (B) = 768 {0, 0x21, 0x0000}, //Read Mode (A) = 33792 {0, 0x66, 0xA00B}, //PLL Control 1 = 20235 0x400A {0, 0x67, 0x0000}, //PLL Control 2 = 1280 {0, 0x65, 0xA000}, //Clock CNTRL: PLL ON = 40960 {0, 0x65, 0x2000}, //Clock CNTRL: USE PLL = 8192
//;Sequencer States...
{1, 0xC6, 0xA122}, //Enter Preview: Auto Exposure {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA123}, //Enter Preview: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA124}, //Enter Preview: Auto White Balance {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA125}, //Enter Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA126}, //Enter Preview: Histogram {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA127}, //Enter Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA128}, //Enter Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA129}, //In Preview: Auto Exposure {1, 0xC8, 0x03}, // = 3 {1, 0xC6, 0xA12A}, //In Preview: Flicker Detection {1, 0xC8, 0x02}, // = 2 {1, 0xC6, 0xA12B}, //In Preview: Auto White Balance {1, 0xC8, 0x03}, // = 3 {1, 0xC6, 0xA12C}, //In Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA12D}, //In Preview: Histogram {1, 0xC8, 0x03}, // = 3 {1, 0xC6, 0xA12E}, //In Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA12F}, //In Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA130}, //Exit Preview: Auto Exposure {1, 0xC8, 0x04}, // = 4 {1, 0xC6, 0xA131}, //Exit Preview: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA132}, //Exit Preview: Auto White Balance {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA133}, //Exit Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA134}, //Exit Preview: Histogram {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA135}, //Exit Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA136}, //Exit Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA137}, //Capture: Auto Exposure {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA138}, //Capture: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA139}, //Capture: Auto White Balance {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13A}, //Capture: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13B}, //Capture: Histogram {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13C}, //Capture: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13D}, //Capture: Skip Control {1, 0xC8, 0x00}, // = 0
//;Setting Up Output format and ITU-R BT.601/656 {1, 0xC6, 0xA77D}, {1, 0xC8, 0x10}, {1, 0xC6, 0XA77E}, {1, 0xC8, 0x10},
//;Setting decimation to 800x600 resolution (context A) {1, 0xC6, 0x2703}, {1, 0xC8, 0x280}, // 0x280 {1, 0xC6, 0x2705}, {1, 0xC8, 0x1E0},//0x1E0
//;Setting decimation to 1600x1200 resolution (context B) {1, 0xC6, 0x2707}, {1, 0xC8, 0x320}, {1, 0xC6, 0x2709}, {1, 0xC8, 0x258},
//;Custom gamma tables... {1, 0xC6, 0xA745}, //Gamma Table 0 (A) {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA746}, //Gamma Table 1 (A) {1, 0xC8, 0x27}, // = 39 {1, 0xC6, 0xA747}, //Gamma Table 2 (A) {1, 0xC8, 0x35}, // = 53 {1, 0xC6, 0xA748}, //Gamma Table 3 (A) {1, 0xC8, 0x48}, // = 72 {1, 0xC6, 0xA749}, //Gamma Table 4 (A) {1, 0xC8, 0x63}, // = 99 {1, 0xC6, 0xA74A}, //Gamma Table 5 (A) {1, 0xC8, 0x77}, // = 119 {1, 0xC6, 0xA74B}, //Gamma Table 6 (A) {1, 0xC8, 0x88}, // = 136 {1, 0xC6, 0xA74C}, //Gamma Table 7 (A) {1, 0xC8, 0x96}, // = 150 {1, 0xC6, 0xA74D}, //Gamma Table 8 (A) {1, 0xC8, 0xA3}, // = 163 {1, 0xC6, 0xA74E}, //Gamma Table 9 (A) {1, 0xC8, 0xAF}, // = 175 {1, 0xC6, 0xA74F}, //Gamma Table 10 (A) {1, 0xC8, 0xBA}, // = 186 {1, 0xC6, 0xA750}, //Gamma Table 11 (A) {1, 0xC8, 0xC4}, // = 196 {1, 0xC6, 0xA751}, //Gamma Table 12 (A) {1, 0xC8, 0xCE}, // = 206 {1, 0xC6, 0xA752}, //Gamma Table 13 (A) {1, 0xC8, 0xD7}, // = 215 {1, 0xC6, 0xA753}, //Gamma Table 14 (A) {1, 0xC8, 0xE0}, // = 224 {1, 0xC6, 0xA754}, //Gamma Table 15 (A) {1, 0xC8, 0xE8}, // = 232 {1, 0xC6, 0xA755}, //Gamma Table 16 (A) {1, 0xC8, 0xF0}, // = 240 {1, 0xC6, 0xA756}, //Gamma Table 17 (A) {1, 0xC8, 0xF8}, // = 248 {1, 0xC6, 0xA757}, //Gamma Table 18 (A) {1, 0xC8, 0xFF}, // = 255 {1, 0xC6, 0xA758}, //Gamma Table 0 (B) {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA759}, //Gamma Table 1 (B) {1, 0xC8, 0x27}, // = 39 {1, 0xC6, 0xA75A}, //Gamma Table 2 (B) {1, 0xC8, 0x35}, // = 53 {1, 0xC6, 0xA75B}, //Gamma Table 3 (B) {1, 0xC8, 0x48}, // = 72 {1, 0xC6, 0xA75C}, //Gamma Table 4 (B) {1, 0xC8, 0x63}, // = 99 {1, 0xC6, 0xA75D}, //Gamma Table 5 (B) {1, 0xC8, 0x77}, // = 119 {1, 0xC6, 0xA75E}, //Gamma Table 6 (B) {1, 0xC8, 0x88}, // = 136 {1, 0xC6, 0xA75F}, //Gamma Table 7 (B) {1, 0xC8, 0x96}, // = 150 {1, 0xC6, 0xA760}, //Gamma Table 8 (B) {1, 0xC8, 0xA3}, // = 163 {1, 0xC6, 0xA761}, //Gamma Table 9 (B) {1, 0xC8, 0xAF}, // = 175 {1, 0xC6, 0xA762}, //Gamma Table 10 (B) {1, 0xC8, 0xBA}, // = 186 {1, 0xC6, 0xA763}, //Gamma Table 11 (B) {1, 0xC8, 0xC4}, // = 196 {1, 0xC6, 0xA764}, //Gamma Table 12 (B) {1, 0xC8, 0xCE}, // = 206 {1, 0xC6, 0xA765}, //Gamma Table 13 (B) {1, 0xC8, 0xD7}, // = 215 {1, 0xC6, 0xA766}, //Gamma Table 14 (B) {1, 0xC8, 0xE0}, // = 224 {1, 0xC6, 0xA767}, //Gamma Table 15 (B) {1, 0xC8, 0xE8}, // = 232 {1, 0xC6, 0xA768}, //Gamma Table 16 (B) {1, 0xC8, 0xF0}, // = 240 {1, 0xC6, 0xA769}, //Gamma Table 17 (B) {1, 0xC8, 0xF8}, // = 248 {1, 0xC6, 0xA76A}, //Gamma Table 18 (B) {1, 0xC8, 0xFF}, // = 255
{1, 0xC6, 0x276D}, //FIFO_Conf1 (A) {1, 0xC8, 0xE0E2}, // = 57570 {1, 0xC6, 0xA76F}, //FIFO_Conf2 (A) {1, 0xC8, 0xE1}, // = 225 {1, 0xC6, 0x2774}, //FIFO_Conf1 (B) {1, 0xC8, 0xE0E1}, // = 57569 {1, 0xC6, 0xA776}, //FIFO_Conf2 (B) {1, 0xC8, 0xE1}, // = 225 {1, 0xC6, 0x220B}, //Max R12 (B)(Shutter Delay) {1, 0xC8, 0x0192}, // = 402 {1, 0xC6, 0xA217}, //IndexTH23 {1, 0xC8, 0x08}, // = 8 {1, 0xC6, 0x2228}, //RowTime (msclk per)/4 {1, 0xC8, 0x020F}, // = 527 {1, 0xC6, 0x222F}, //R9 Step {1, 0xC8, 0x009A}, // = 154 {1, 0xC6, 0xA408}, //search_f1_50 {1, 0xC8, 0x24}, // = 36 {1, 0xC6, 0xA409}, //search_f2_50 {1, 0xC8, 0x26}, // = 38 {1, 0xC6, 0xA40A}, //search_f1_60 {1, 0xC8, 0x1D}, // = 29 {1, 0xC6, 0xA40B}, //search_f2_60 {1, 0xC8, 0x1F}, // = 31 {1, 0xC6, 0x2411}, //R9_Step_60 {1, 0xC8, 0x009A}, // = 154 {1, 0xC6, 0x2413}, //R9_Step_50 {1, 0xC8, 0x00B9} // = 185 };
const struct twiData refresh_seq_mode[] = { {1, 0xC6, 0xA103}, //Refresh Sequencer Mode {1, 0xC8, 0x06} // = 6 };
const struct twiData refresh_seq[] = { {1, 0xC6, 0xA103}, //Refresh Sequencer {1, 0xC8, 0x05}, // = 5 };
const struct twiData bt656_switch[] = { {2, 0x0D, 0x003E} //при включенном джипег //{2, 0x0D, 0x0427} //при выключенном джипег };
const struct twiData set_Capturing_Still_Pictures_mode[] = { {1, 0xC6, 0xA120}, {1, 0xC8, 0x00}, //1. First clear the capture video mode bit: seq.captureParams.mode[1] = 0
//-- Image cropping and scaling //2. Next, specify the output image size for context B by using the variables //mode.Output Width_B and mode.Output Height_B. {1, 0xC6, 0x2707}, {1, 0xC8, 0x0320},//mode.output_width_B = 800 {1, 0xC6, 0x2709}, {1, 0xC8, 0x0258},//mode.output_height_B = 600
{1, 0xC6, 0x2735}, //Crop_X0 (B) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x2737}, //Crop_X1 (B) {1, 0xC8, 0x0640}, // = 1600
{1, 0xC6, 0x2739}, //Crop_Y0 (B) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x273B}, //Crop_Y1 (B) {1, 0xC8, 0x04B0}, // = 1200
{0, 0x20, (1<<10) | (1 << 15)}, // R0x20:0[10] = 1 and R0x20:0[15] = 1
{1, 0xC6, 0xA121}, {1, 0xC8, 0x0002} // 2 for this example (ID = 1, Offset = 0x21) };
const struct twiData Set_StepMode[] = { {1, 0xC6, 0xA105}, {1, 0xC8, 0x0003} };
const struct twiData Next_step[] = { {1, 0xC6, 0xA105}, {1, 0xC8, 0x0003} };
const struct twiData set_Jpeg_mode[] = { {1, 0xC6, 0x270B}, {1, 0xC8, 0x00}, //To enable JPEG output, set mode.mode_config[5] = 0. {1, 0xC6, 0xA906}, //jpeg.format // 0 = 4:2:2, 1 = 4:2:0, 2 = monochrome (ID = 9, Offset =0x06) {1, 0xC8, 0x02}, //jpeg.format = 0x00
{1, 0xC6, 0xA907}, {1, 0xC8, 0x00}, {1, 0xC6, 0x2908}, {1, 0xC8, 0x01},
{1, 0xC6, 0xA120}, {1, 0xC8, 0x00}, //seq.captureParams_mode = 0x00[b] //capture still image
//-- JPEG config {1, 0xC6, 0xA90A}, {1, 0xC8, 0x89}, //jpeg.qscale1 = 0x89[b] {1, 0xC6, 0x2908}, {1, 0xC8, 0x0020},//jpeg.restartInt = 0x0020 {1, 0x97, 0x0010}, // {1, 0xC6, 0x270B}, // {1, 0xC8, 0x01 | (1 << 5)} //To Disable JPEG output }; Вторую неделю пытаюсь настроить, но что-то я упускаю, не могу понять что. При этом, если считывать статусный регистр Jpeg-а, то длинна данных всегда разная, я так понимаю, это говорит, что джипег всеже включился. Но прерывания так и нету.
|
|
|
|
|
 |
Ответов
|
Dec 21 2011, 05:11
|
Группа: Новичок
Сообщений: 9
Регистрация: 6-10-11
Пользователь №: 67 570

|
Цитата(Ivan Kuznetzov @ Dec 17 2011, 13:27)  bublik, как правильно завести PLL? Камера у меня работает только если тактирую её клоком 60МГц. Как вы камеру тактируете? Ну мы используем данную камеру (mt9d131) вместе с at91sam9g20. схема подключения выглядит вот так:  Используем buildroot-2011.05 для сборки линукса. Что меняли в ядре от-но изи интерфейса: /linux-2.6.33/arch/arm/mach-at91/board-sam9g20ek.c CODE static void __init isi_set_clk(void) { struct clk *pck1; struct clk *plla;
pck1 = clk_get(NULL, "pck1"); plla = clk_get(NULL, "plla");
/* Sensor MCK Clock */ at91_set_A_periph(AT91_PIN_PB31, 0); /* ISI_MCK */ clk_set_parent(pck1, plla); clk_set_rate(pck1, 24000000); //25000000 clk_enable(pck1);
printk("============ isi_set_clk working ================");
printk("AT91_PMC_PCKR(1) = 0x%X \n",at91_sys_read(AT91_PMC_PCKR(1))); printk("AT91_PMC_SCSR = 0x%X \n",at91_sys_read(AT91_PMC_SCSR)); printk("AT91_PMC_PCSR = 0x%X \n",at91_sys_read(AT91_PMC_PCSR));
} расчет PLL для камеры брал из датошита а именно вот это: The PLL output frequency is determined by three constants (M, N, and P) and the input clock frequency. These three values are set in: • R0x066:0 // [15:8] for M; [5:0] for N • R0x067:0 // [6:0] for P Their relations can be shown by the following equation: fOUT = fIN, x M / [2 x (N+1) x (P+1)] (EQ 1) However, since the following requirements must be satisfied, then not all combinations of M/N/P are valid: • M must be 16 or higher • fPFD, fVCO, fOUT ranges are satisfied Frequency Equation Min (MHz) Max (MHz) fPFD fIN/ (N+1) 2 13 fVCO fPFD x M 110 240 fOUT fVCO / [2 x (P+1)] 6 80 fIN — 6 64 After determining the proper M, N, and P values and setting them in R0x066:0/R0x067:0, the PLL can be enabled by the following sequence: 1. R0x65:0[14] = 0 // powers on PLL 2. R0x65:0[15] = 0 // disable PLL bypass (enabling PLL) Так как мы клоки берем от ISI, а он (см выше) равен 24 МГц. Можно взять вот такую настройку PLL: Для 640х480:Код {0, 0x05, 0x03E4}, //HBLANK (B) = 996 {0, 0x06, 0x0106}, //VBLANK (B) = 262 {0, 0x07, 0x00FE}, //HBLANK (A) = 254 {0, 0x08, 0x000C}, //VBLANK (A) = 12 {0, 0x20, 0x0390}, //Read Mode (B) = 912 {0, 0x21, 0x8400}, //Read Mode (A) = 33792 {0, 0x66, 0x5B0A}, //PLL Control 1 = 23306 {0, 0x67, 0x501}, //PLL Control 2 = 1281 {0, 0x65, 0xA000}, //Clock CNTRL: PLL ON = 40960 {0, 0x65, 0x2000}, //Clock CNTRL: USE PLL = 8192 //10 Для 800х600:Код {0, 0x05, 0x00FE}, //HBLANK (B) = 254 {0, 0x06, 0x01DF}, //VBLANK (B) = 479 {0, 0x07, 0x00FE}, //HBLANK (A) = 254 {0, 0x08, 0x0010}, //VBLANK (A) = 16 {0, 0x20, 0x0790}, //Read Mode (B) = 1936 {0, 0x21, 0x8400}, //Read Mode (A) = 33792 {0, 0x66, 0x490B}, //PLL Control 1 = 18699 {0, 0x67, 0x500}, //PLL Control 2 = 1280 {0, 0x65, 0xA000}, //Clock CNTRL: PLL ON = 40960 {0, 0x65, 0x2000}, //Clock CNTRL: USE PLL = 8192 //10 Все настройки которые прошиваем в камеру: Код // Camera configs
static const char CameraFileName[] = "/dev/camera";
struct twiData { unsigned char Page; unsigned char Reg; unsigned short Data; }; //sizeof(struct twiData) == 4
const struct twiData soft_reset1[] = { {0, 0x65, 0xA000}, // bypassed PLL (prepare for soft reset) {1, 0xC3, 0x0501}, // MCU_BOOT_MODE (MCU reset) {0, 0x0D, 0x0021} // RESET_REG (enable soft reset) };
const struct twiData soft_reset2[] = { {0, 0x0D, 0x0000} // RESET_REG (disable soft reset) };
const struct twiData settings640x480[] = { {0, 0x05, 0x03E4}, //HBLANK (B) = 996 {0, 0x06, 0x0106}, //VBLANK (B) = 262 {0, 0x07, 0x00FE}, //HBLANK (A) = 254 {0, 0x08, 0x000C}, //VBLANK (A) = 12 {0, 0x20, 0x0390}, //Read Mode (B) = 912 {0, 0x21, 0x8400}, //Read Mode (A) = 33792 {0, 0x66, 0x5B0A}, //PLL Control 1 = 23306 {0, 0x67, 0x501}, //PLL Control 2 = 1281 {0, 0x65, 0xA000}, //Clock CNTRL: PLL ON = 40960 {0, 0x65, 0x2000}, //Clock CNTRL: USE PLL = 8192 //10 //;Sequencer States... {1, 0xC6, 0xA122}, //Enter Preview: Auto Exposure {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA123}, //Enter Preview: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA124}, //Enter Preview: Auto White Balance {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA125}, //Enter Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA126}, //Enter Preview: Histogram {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA127}, //Enter Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA128}, //Enter Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA129}, //In Preview: Auto Exposure {1, 0xC8, 0x01}, // = 3 {1, 0xC6, 0xA12A}, //In Preview: Flicker Detection {1, 0xC8, 0x00}, // = 2 {1, 0xC6, 0xA12B}, //In Preview: Auto White Balance {1, 0xC8, 0x01}, // = 3 {1, 0xC6, 0xA12C}, //In Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA12D}, //In Preview: Histogram {1, 0xC8, 0x01}, // = 3 {1, 0xC6, 0xA12E}, //In Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA12F}, //In Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA130}, //Exit Preview: Auto Exposure {1, 0xC8, 0x04}, // = 4 {1, 0xC6, 0xA131}, //Exit Preview: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA132}, //Exit Preview: Auto White Balance {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA133}, //Exit Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA134}, //Exit Preview: Histogram {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA135}, //Exit Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA136}, //Exit Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA137}, //Capture: Auto Exposure {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA138}, //Capture: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA139}, //Capture: Auto White Balance {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13A}, //Capture: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13B}, //Capture: Histogram {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13C}, //Capture: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13D}, //Capture: Skip Control {1, 0xC8, 0x00}, // = 0 //56 {1, 0xC6, 0x2703}, //Output Width (A) {1, 0xC8, 0x0280}, // = 640 {1, 0xC6, 0x2705}, //Output Height (A) {1, 0xC8, 0x01E0}, // = 480 {1, 0xC6, 0x2707}, //Output Width (B) {1, 0xC8, 0x0320}, // = 800 {1, 0xC6, 0x2709}, //Output Height (B) {1, 0xC8, 0x0258}, // = 600 {1, 0xC6, 0x270B}, //mode_config {1, 0xC8, 0x0030}, // = 48 {1, 0xC6, 0x270F}, //Row Start (A) {1, 0xC8, 0x01C}, // = 28 {1, 0xC6, 0x2711}, //Column Start (A) {1, 0xC8, 0x03C}, // = 60 {1, 0xC6, 0x2713}, //Row Height (A) {1, 0xC8, 0x3C0}, // = 960 {1, 0xC6, 0x2715}, //Column Width (A) {1, 0xC8, 0x500}, // = 1280 {1, 0xC6, 0x2717}, //Extra Delay (A) {1, 0xC8, 0x0EF}, // = 239 {1, 0xC6, 0x2719}, //Row Speed (A) {1, 0xC8, 0x0011}, // = 17 {1, 0xC6, 0x271B}, //Row Start (B) {1, 0xC8, 0x01C}, // = 28 {1, 0xC6, 0x271D}, //Column Start (B) {1, 0xC8, 0x03C}, // = 60 {1, 0xC6, 0x271F}, //Row Height (B) {1, 0xC8, 0x4B0}, // = 1200 {1, 0xC6, 0x2721}, //Column Width (B) {1, 0xC8, 0x640}, // = 1600 {1, 0xC6, 0x2723}, //Extra Delay (B) {1, 0xC8, 0x50B}, // = 1291 {1, 0xC6, 0x2725}, //Row Speed (B) {1, 0xC8, 0x0011}, // = 17 {1, 0xC6, 0x2727}, //Crop_X0 (A) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x2729}, //Crop_X1 (A) {1, 0xC8, 0x0280}, // = 640 {1, 0xC6, 0x272B}, //Crop_Y0 (A) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x272D}, //Crop_Y1 (A) {1, 0xC8, 0x01E0}, // = 480 {1, 0xC6, 0x2735}, //Crop_X0 (B) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x2737}, //Crop_X1 (B) {1, 0xC8, 0x0320}, // = 800 {1, 0xC6, 0x2739}, //Crop_Y0 (B) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x273B}, //Crop_Y1 (B) {1, 0xC8, 0x0258}, // = 600 {1, 0xC6, 0xA743}, //Gamma and Contrast Settings (A) {1, 0xC8, 0x42}, // = 66 {1, 0xC6, 0xA744}, //Gamma and Contrast Settings (B) {1, 0xC8, 0x42}, // = 66 //54 //;Setting Up Output format and ITU-R BT.601/656 {1, 0xC6, 0xA77D}, {1, 0xC8, 0x10}, {1, 0xC6, 0XA77E}, {1, 0xC8, 0x10}, //4 //;Setting decimation to 800x600 resolution (context A) //{1, 0xC6, 0x2703}, //{1, 0xC8, 0x320}, // 0x280 //{1, 0xC6, 0x2705}, //{1, 0xC8, 0x258},//0x1E0 //;Setting decimation to 1600x1200 resolution (context B) //{1, 0xC6, 0x2707}, //{1, 0xC8, 0x320}, //{1, 0xC6, 0x2709}, //{1, 0xC8, 0x258}, //;Custom gamma tables... {1, 0xC6, 0xA745}, //Gamma Table 0 (A) {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA746}, //Gamma Table 1 (A) {1, 0xC8, 0x14}, // = 20 {1, 0xC6, 0xA747}, //Gamma Table 2 (A) {1, 0xC8, 0x23}, // = 35 {1, 0xC6, 0xA748}, //Gamma Table 3 (A) {1, 0xC8, 0x3A}, // = 58 {1, 0xC6, 0xA749}, //Gamma Table 4 (A) {1, 0xC8, 0x5E}, // = 94 {1, 0xC6, 0xA74A}, //Gamma Table 5 (A) {1, 0xC8, 0x76}, // = 118 {1, 0xC6, 0xA74B}, //Gamma Table 6 (A) {1, 0xC8, 0x88}, // = 136 {1, 0xC6, 0xA74C}, //Gamma Table 7 (A) {1, 0xC8, 0x96}, // = 150 {1, 0xC6, 0xA74D}, //Gamma Table 8 (A) {1, 0xC8, 0xA3}, // = 163 {1, 0xC6, 0xA74E}, //Gamma Table 9 (A) {1, 0xC8, 0xAF}, // = 175 {1, 0xC6, 0xA74F}, //Gamma Table 10 (A) {1, 0xC8, 0xBA}, // = 186 {1, 0xC6, 0xA750}, //Gamma Table 11 (A) {1, 0xC8, 0xC4}, // = 196 {1, 0xC6, 0xA751}, //Gamma Table 12 (A) {1, 0xC8, 0xCE}, // = 206 {1, 0xC6, 0xA752}, //Gamma Table 13 (A) {1, 0xC8, 0xD7}, // = 215 {1, 0xC6, 0xA753}, //Gamma Table 14 (A) {1, 0xC8, 0xE0}, // = 224 {1, 0xC6, 0xA754}, //Gamma Table 15 (A) {1, 0xC8, 0xE8}, // = 232 {1, 0xC6, 0xA755}, //Gamma Table 16 (A) {1, 0xC8, 0xF0}, // = 240 {1, 0xC6, 0xA756}, //Gamma Table 17 (A) {1, 0xC8, 0xF8}, // = 248 {1, 0xC6, 0xA757}, //Gamma Table 18 (A) {1, 0xC8, 0xFF}, // = 255 {1, 0xC6, 0xA758}, //Gamma Table 0 (B) {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA759}, //Gamma Table 1 (B) {1, 0xC8, 0x14}, // = 20 {1, 0xC6, 0xA75A}, //Gamma Table 2 (B) {1, 0xC8, 0x23}, // = 35 {1, 0xC6, 0xA75B}, //Gamma Table 3 (B) {1, 0xC8, 0x3A}, // = 58 {1, 0xC6, 0xA75C}, //Gamma Table 4 (B) {1, 0xC8, 0x5E}, // = 94 {1, 0xC6, 0xA75D}, //Gamma Table 5 (B) {1, 0xC8, 0x76}, // = 118 {1, 0xC6, 0xA75E}, //Gamma Table 6 (B) {1, 0xC8, 0x88}, // = 136 {1, 0xC6, 0xA75F}, //Gamma Table 7 (B) {1, 0xC8, 0x96}, // = 150 {1, 0xC6, 0xA760}, //Gamma Table 8 (B) {1, 0xC8, 0xA3}, // = 163 {1, 0xC6, 0xA761}, //Gamma Table 9 (B) {1, 0xC8, 0xAF}, // = 175 {1, 0xC6, 0xA762}, //Gamma Table 10 (B) {1, 0xC8, 0xBA}, // = 186 {1, 0xC6, 0xA763}, //Gamma Table 11 (B) {1, 0xC8, 0xC4}, // = 196 {1, 0xC6, 0xA764}, //Gamma Table 12 (B) {1, 0xC8, 0xCE}, // = 206 {1, 0xC6, 0xA765}, //Gamma Table 13 (B) {1, 0xC8, 0xD7}, // = 215 {1, 0xC6, 0xA766}, //Gamma Table 14 (B) {1, 0xC8, 0xE0}, // = 224 {1, 0xC6, 0xA767}, //Gamma Table 15 (B) {1, 0xC8, 0xE8}, // = 232 {1, 0xC6, 0xA768}, //Gamma Table 16 (B) {1, 0xC8, 0xF0}, // = 240 {1, 0xC6, 0xA769}, //Gamma Table 17 (B) {1, 0xC8, 0xF8}, // = 248 {1, 0xC6, 0xA76A}, //Gamma Table 18 (B) {1, 0xC8, 0xFF}, // = 255 //76 {1, 0xC6, 0x276D}, //FIFO_Conf1 (A) {1, 0xC8, 0xE0E2}, // = 57570 {1, 0xC6, 0xA76F}, //FIFO_Conf2 (A) {1, 0xC8, 0xE1}, // = 225 {1, 0xC6, 0x2774}, //FIFO_Conf1 (B) //делители {1, 0xC8, 0xE0E1}, // = 57569 {1, 0xC6, 0xA776}, //FIFO_Conf2 (B) //делители {1, 0xC8, 0xE1}, // = 225 {1, 0xC6, 0x220B}, //Max R12 (B)(Shutter Delay) {1, 0xC8, 0x00F2}, // = 242 {1, 0xC6, 0xA217}, //IndexTH23 {1, 0xC8, 0x08}, // = 8 {1, 0xC6, 0x2228}, //RowTime (msclk per)/4 {1, 0xC8, 0x01BF}, // = 447 {1, 0xC6, 0x222F}, //R9 Step {1, 0xC8, 0x0072}, // = 114 {1, 0xC6, 0xA408}, //search_f1_50 {1, 0xC8, 0x1A}, // = 26 {1, 0xC6, 0xA409}, //search_f2_50 {1, 0xC8, 0x1C}, // = 28 {1, 0xC6, 0xA40A}, //search_f1_60 {1, 0xC8, 0x15}, // = 21 {1, 0xC6, 0xA40B}, //search_f2_60 {1, 0xC8, 0x17}, // = 23 {1, 0xC6, 0x2411}, //R9_Step_60 {1, 0xC8, 0x0072}, // = 114 {1, 0xC6, 0x2413}, //R9_Step_50 {1, 0xC8, 0x0089} // = 137 //28 };
const struct twiData settings800x600[] = { {0, 0x05, 0x00FE}, //HBLANK (B) = 254 {0, 0x06, 0x01DF}, //VBLANK (B) = 479 {0, 0x07, 0x00FE}, //HBLANK (A) = 254 {0, 0x08, 0x0010}, //VBLANK (A) = 16 {0, 0x20, 0x0790}, //Read Mode (B) = 1936 {0, 0x21, 0x8400}, //Read Mode (A) = 33792 {0, 0x66, 0x490B}, //PLL Control 1 = 18699 {0, 0x67, 0x500}, //PLL Control 2 = 1280 {0, 0x65, 0xA000}, //Clock CNTRL: PLL ON = 40960 {0, 0x65, 0x2000}, //Clock CNTRL: USE PLL = 8192 //10 // {0, 0x05, 0x03E4}, //HBLANK (B) = 996 // {0, 0x06, 0x000B}, //VBLANK (B) = 11 // {0, 0x07, 0x00FE}, //HBLANK (A) = 254 // {0, 0x08, 0x0091}, //VBLANK (A) = 145 // {0, 0x20, 0x0390}, //Read Mode (B) = 912 // {0, 0x21, 0x8400}, //Read Mode (A) = 33792 // {0, 0x66, 0x4A08}, //PLL Control 1 = 18952 // {0, 0x67, 0x508}, //PLL Control 2 = 1288 // {0, 0x65, 0xA000}, //Clock CNTRL: PLL ON = 40960 // {0, 0x65, 0x2000}, //Clock CNTRL: USE PLL = 8192 //;Sequencer States... {1, 0xC6, 0xA122}, //Enter Preview: Auto Exposure {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA123}, //Enter Preview: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA124}, //Enter Preview: Auto White Balance {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA125}, //Enter Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA126}, //Enter Preview: Histogram {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA127}, //Enter Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA128}, //Enter Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA129}, //In Preview: Auto Exposure {1, 0xC8, 0x03}, // = 3 {1, 0xC6, 0xA12A}, //In Preview: Flicker Detection {1, 0xC8, 0x02}, // = 2 {1, 0xC6, 0xA12B}, //In Preview: Auto White Balance {1, 0xC8, 0x03}, // = 3 {1, 0xC6, 0xA12C}, //In Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA12D}, //In Preview: Histogram {1, 0xC8, 0x03}, // = 3 {1, 0xC6, 0xA12E}, //In Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA12F}, //In Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA130}, //Exit Preview: Auto Exposure {1, 0xC8, 0x04}, // = 4 {1, 0xC6, 0xA131}, //Exit Preview: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA132}, //Exit Preview: Auto White Balance {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA133}, //Exit Preview: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA134}, //Exit Preview: Histogram {1, 0xC8, 0x01}, // = 1 {1, 0xC6, 0xA135}, //Exit Preview: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA136}, //Exit Preview: Skip Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA137}, //Capture: Auto Exposure {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA138}, //Capture: Flicker Detection {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA139}, //Capture: Auto White Balance {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13A}, //Capture: Auto Focus {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13B}, //Capture: Histogram {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13C}, //Capture: Strobe Control {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA13D}, //Capture: Skip Control {1, 0xC8, 0x00}, // = 0 //56 {1, 0xC6, 0x2703}, //Output Width (A) {1, 0xC8, 0x0320}, // = 800 {1, 0xC6, 0x2705}, //Output Height (A) {1, 0xC8, 0x0258}, // = 600 {1, 0xC6, 0x2707}, //Output Width (B) {1, 0xC8, 0x0320}, // = 800 {1, 0xC6, 0x2709}, //Output Height (B) {1, 0xC8, 0x0258}, // = 600 {1, 0xC6, 0x270B}, //mode_config {1, 0xC8, 0x0030}, // = 48 {1, 0xC6, 0x270F}, //Row Start (A) {1, 0xC8, 0x01C}, // = 28 {1, 0xC6, 0x2711}, //Column Start (A) {1, 0xC8, 0x03C}, // = 60 {1, 0xC6, 0x2713}, //Row Height (A) {1, 0xC8, 0x4B0}, // = 1200 {1, 0xC6, 0x2715}, //Column Width (A) {1, 0xC8, 0x640}, // = 1600 {1, 0xC6, 0x2717}, //Extra Delay (A) {1, 0xC8, 0x3B4}, // = 948 {1, 0xC6, 0x2719}, //Row Speed (A) {1, 0xC8, 0x0011}, // = 17 {1, 0xC6, 0x271B}, //Row Start (B) {1, 0xC8, 0x01C}, // = 28 {1, 0xC6, 0x271D}, //Column Start (B) {1, 0xC8, 0x03C}, // = 60 {1, 0xC6, 0x271F}, //Row Height (B) {1, 0xC8, 0x4B0}, // = 1200 {1, 0xC6, 0x2721}, //Column Width (B) {1, 0xC8, 0x640}, // = 1600 {1, 0xC6, 0x2723}, //Extra Delay (B) {1, 0xC8, 0x29D}, // = 669 {1, 0xC6, 0x2725}, //Row Speed (B) {1, 0xC8, 0x0011}, // = 17 {1, 0xC6, 0x2727}, //Crop_X0 (A) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x2729}, //Crop_X1 (A) {1, 0xC8, 0x0320}, // = 800 {1, 0xC6, 0x272B}, //Crop_Y0 (A) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x272D}, //Crop_Y1 (A) {1, 0xC8, 0x0258}, // = 600 {1, 0xC6, 0x2735}, //Crop_X0 (B) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x2737}, //Crop_X1 (B) {1, 0xC8, 0x0320}, // = 800 {1, 0xC6, 0x2739}, //Crop_Y0 (B) {1, 0xC8, 0x0000}, // = 0 {1, 0xC6, 0x273B}, //Crop_Y1 (B) {1, 0xC8, 0x0258}, // = 600 {1, 0xC6, 0xA743}, //Gamma and Contrast Settings (A) {1, 0xC8, 0x42}, // = 66 {1, 0xC6, 0xA744}, //Gamma and Contrast Settings (B) {1, 0xC8, 0x42}, // = 66 //54 //;Setting Up Output format and ITU-R BT.601/656 {1, 0xC6, 0xA77D}, {1, 0xC8, 0x10}, {1, 0xC6, 0XA77E}, {1, 0xC8, 0x10}, //4 //;Setting decimation to 800x600 resolution (context A) //{1, 0xC6, 0x2703}, //{1, 0xC8, 0x320}, // 0x280 //{1, 0xC6, 0x2705}, //{1, 0xC8, 0x258},//0x1E0 //;Setting decimation to 1600x1200 resolution (context B) //{1, 0xC6, 0x2707}, //{1, 0xC8, 0x320}, //{1, 0xC6, 0x2709}, //{1, 0xC8, 0x258}, //;Custom gamma tables... {1, 0xC6, 0xA745}, //Gamma Table 0 (A) {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA746}, //Gamma Table 1 (A) {1, 0xC8, 0x14}, // = 20 {1, 0xC6, 0xA747}, //Gamma Table 2 (A) {1, 0xC8, 0x23}, // = 35 {1, 0xC6, 0xA748}, //Gamma Table 3 (A) {1, 0xC8, 0x3A}, // = 58 {1, 0xC6, 0xA749}, //Gamma Table 4 (A) {1, 0xC8, 0x5E}, // = 94 {1, 0xC6, 0xA74A}, //Gamma Table 5 (A) {1, 0xC8, 0x76}, // = 118 {1, 0xC6, 0xA74B}, //Gamma Table 6 (A) {1, 0xC8, 0x88}, // = 136 {1, 0xC6, 0xA74C}, //Gamma Table 7 (A) {1, 0xC8, 0x96}, // = 150 {1, 0xC6, 0xA74D}, //Gamma Table 8 (A) {1, 0xC8, 0xA3}, // = 163 {1, 0xC6, 0xA74E}, //Gamma Table 9 (A) {1, 0xC8, 0xAF}, // = 175 {1, 0xC6, 0xA74F}, //Gamma Table 10 (A) {1, 0xC8, 0xBA}, // = 186 {1, 0xC6, 0xA750}, //Gamma Table 11 (A) {1, 0xC8, 0xC4}, // = 196 {1, 0xC6, 0xA751}, //Gamma Table 12 (A) {1, 0xC8, 0xCE}, // = 206 {1, 0xC6, 0xA752}, //Gamma Table 13 (A) {1, 0xC8, 0xD7}, // = 215 {1, 0xC6, 0xA753}, //Gamma Table 14 (A) {1, 0xC8, 0xE0}, // = 224 {1, 0xC6, 0xA754}, //Gamma Table 15 (A) {1, 0xC8, 0xE8}, // = 232 {1, 0xC6, 0xA755}, //Gamma Table 16 (A) {1, 0xC8, 0xF0}, // = 240 {1, 0xC6, 0xA756}, //Gamma Table 17 (A) {1, 0xC8, 0xF8}, // = 248 {1, 0xC6, 0xA757}, //Gamma Table 18 (A) {1, 0xC8, 0xFF}, // = 255 {1, 0xC6, 0xA758}, //Gamma Table 0 (B) {1, 0xC8, 0x00}, // = 0 {1, 0xC6, 0xA759}, //Gamma Table 1 (B) {1, 0xC8, 0x14}, // = 20 {1, 0xC6, 0xA75A}, //Gamma Table 2 (B) {1, 0xC8, 0x23}, // = 35 {1, 0xC6, 0xA75B}, //Gamma Table 3 (B) {1, 0xC8, 0x3A}, // = 58 {1, 0xC6, 0xA75C}, //Gamma Table 4 (B) {1, 0xC8, 0x5E}, // = 94 {1, 0xC6, 0xA75D}, //Gamma Table 5 (B) {1, 0xC8, 0x76}, // = 118 {1, 0xC6, 0xA75E}, //Gamma Table 6 (B) {1, 0xC8, 0x88}, // = 136 {1, 0xC6, 0xA75F}, //Gamma Table 7 (B) {1, 0xC8, 0x96}, // = 150 {1, 0xC6, 0xA760}, //Gamma Table 8 (B) {1, 0xC8, 0xA3}, // = 163 {1, 0xC6, 0xA761}, //Gamma Table 9 (B) {1, 0xC8, 0xAF}, // = 175 {1, 0xC6, 0xA762}, //Gamma Table 10 (B) {1, 0xC8, 0xBA}, // = 186 {1, 0xC6, 0xA763}, //Gamma Table 11 (B) {1, 0xC8, 0xC4}, // = 196 {1, 0xC6, 0xA764}, //Gamma Table 12 (B) {1, 0xC8, 0xCE}, // = 206 {1, 0xC6, 0xA765}, //Gamma Table 13 (B) {1, 0xC8, 0xD7}, // = 215 {1, 0xC6, 0xA766}, //Gamma Table 14 (B) {1, 0xC8, 0xE0}, // = 224 {1, 0xC6, 0xA767}, //Gamma Table 15 (B) {1, 0xC8, 0xE8}, // = 232 {1, 0xC6, 0xA768}, //Gamma Table 16 (B) {1, 0xC8, 0xF0}, // = 240 {1, 0xC6, 0xA769}, //Gamma Table 17 (B) {1, 0xC8, 0xF8}, // = 248 {1, 0xC6, 0xA76A}, //Gamma Table 18 (B) {1, 0xC8, 0xFF}, // = 255 //76 {1, 0xC6, 0x276D}, //FIFO_Conf1 (A) {1, 0xC8, 0xE0E2}, // = 57570 {1, 0xC6, 0xA76F}, //FIFO_Conf2 (A) {1, 0xC8, 0xE1}, // = 225 {1, 0xC6, 0x2774}, //FIFO_Conf1 (B) //делители {1, 0xC8, 0xE0E1}, // = 57569 {1, 0xC6, 0xA776}, //FIFO_Conf2 (B) //делители {1, 0xC8, 0xE1}, // = 225 {1, 0xC6, 0x220B}, //Max R12 (B)(Shutter Delay) {1, 0xC8, 0x0192}, // = 402 {1, 0xC6, 0xA217}, //IndexTH23 {1, 0xC8, 0x08}, // = 8 {1, 0xC6, 0x2228}, //RowTime (msclk per)/4 {1, 0xC8, 0x020F}, // = 527 {1, 0xC6, 0x222F}, //R9 Step {1, 0xC8, 0x008F}, // = 143 {1, 0xC6, 0xA408}, //search_f1_50 {1, 0xC8, 0x21}, // = 33 {1, 0xC6, 0xA409}, //search_f2_50 {1, 0xC8, 0x23}, // = 35 {1, 0xC6, 0xA40A}, //search_f1_60 {1, 0xC8, 0x1B}, // = 27 {1, 0xC6, 0xA40B}, //search_f2_60 {1, 0xC8, 0x1D}, // = 29 {1, 0xC6, 0x2411}, //R9_Step_60 {1, 0xC8, 0x008F}, // = 143 {1, 0xC6, 0x2413}, //R9_Step_50 {1, 0xC8, 0x00AB} // = 171 //28 };
const struct twiData refresh_seq_mode[] = { {1, 0xC6, 0xA103}, //Refresh Sequencer Mode {1, 0xC8, 0x0006} // = 6 };
const struct twiData HardwareReset[] = { {4, 0, 0} //См драйвер камеры. };
const struct twiData refresh_seq[] = { {1, 0xC6, 0xA103}, //Refresh Sequencer {1, 0xC8, 0x0005}, // = 5 };
const struct twiData bt656_switch[] = { {2, 0x0D, 0x0427}//0x0427 };
const struct twiData Enable_StepMode[] = { {1, 0xC6, 0xA105}, {1, 0xC8, 0x0003} };
const struct twiData Disable_StepMode[] = { {1, 0xC6, 0xA105}, {1, 0xC8, 0x0002} };
const struct twiData Next_step[] = { {1, 0xC6, 0xA105}, {1, 0xC8, 0x0003} };
const struct twiData Off_Jpeg[] = { {1, 0xC6, 0x270B}, {1, 0xC8, (1 << 5)} //To Disable JPEG output }; Как мы прошиваем настройки: Код int mt9d131_config_640x480(void) { int status = 0; struct twiData mode, state; int CameraFile;
CameraFile = open(CameraFileName, O_RDWR); if(CameraFile < 0) { printf("Problems can't open file %s\n",CameraFileName); return EXIT_FAILURE; }
status += mt9d131_write_regs(CameraFile, HardwareReset, 1); usleep(1000); status += mt9d131_write_regs(CameraFile, soft_reset1, 3); usleep(1000); status += mt9d131_write_regs(CameraFile, soft_reset2, 1); usleep(500000); status += mt9d131_write_regs2(CameraFile, settings640x480,228); //177 // status += mt9d131_write_regs2(CameraFile,settings,228); //228 usleep(500000); // status += mt9d131_write_regs(CameraFile, Off_Jpeg,2); usleep(500000); status += mt9d131_write_regs2(CameraFile, refresh_seq_mode, 2); usleep(1000000); status += mt9d131_write_regs2(CameraFile, refresh_seq, 2); usleep(1000000);
mode.Page = 1; mode.Reg = 0xC6; mode.Data = 0xA104;
state.Page = 1; state.Reg = 0xC8; state.Data = 0;
while (1) // Waiting for preview camera state (hex: 0x03) { write(CameraFile, &mode, 1); usleep(50000); read(CameraFile, &state, 1);
if ((state.Data & 0xFF) == 0x03) break; }
status += mt9d131_write_regs(CameraFile, refresh_seq, 2); usleep(3000000); status += mt9d131_write_regs2(CameraFile, bt656_switch, 1);
if (status) printf("TWI:Capture configuring failed \n");
close(CameraFile); return status; }
int mt9d131_config_800x600(void) { int status = 0; struct twiData mode, state; int CameraFile;
CameraFile = open(CameraFileName, O_RDWR); if(CameraFile < 0){ printf("Problems can't open file %s\n",CameraFileName); return EXIT_FAILURE; }
status += mt9d131_write_regs(CameraFile, HardwareReset, 1); usleep(1000); status += mt9d131_write_regs(CameraFile, soft_reset1, 3); usleep(1000); status += mt9d131_write_regs(CameraFile, soft_reset2, 1); usleep(500000); status += mt9d131_write_regs2(CameraFile, settings800x600,228); //228 // status += mt9d131_write_regs2(CameraFile,settings,236); //228 usleep(500000); // status += mt9d131_write_regs(CameraFile, Off_Jpeg,2); usleep(500000); status += mt9d131_write_regs2(CameraFile, refresh_seq_mode, 2); usleep(1000000); status += mt9d131_write_regs2(CameraFile, refresh_seq, 2); usleep(1000000);
mode.Page = 1; mode.Reg = 0xC6; mode.Data = 0xA104;
state.Page = 1; state.Reg = 0xC8; state.Data = 0;
while (1) // Waiting for preview camera state (hex: 0x03) { write(CameraFile, &mode, 1); usleep(50000); read(CameraFile, &state, 1);
if ((state.Data & 0xFF) == 0x03) break; }
status += mt9d131_write_regs(CameraFile, refresh_seq, 2); usleep(3000000); status += mt9d131_write_regs2(CameraFile, bt656_switch, 1);
if (status) printf("TWI:Capture configuring failed \n");
close(CameraFile); return status; } Это позволяет получить RAW изображения с камеры по приходу прерываний (начало и конец кадра) дальше мы жмем это все дело в ARM-e в Jpeg, что дает нам примерно 2.5-3 FPS.
|
|
|
|
Сообщений в этой теме
bublik at91sam9g20 + MT9D131 + Jpeg (нет прерывания) Oct 6 2011, 06:06 bublik Написали в тех поддержку, оказалось, что данная ка... Oct 24 2011, 13:42 wmakc Я пробовал также как и вы пробовал настроить jpeg ... Nov 3 2011, 04:56 bublik Цитата(wmakc @ Nov 3 2011, 07:56) Я пробо... Nov 22 2011, 10:58 wmakc Матрица отсылает не совсем кадры, а только их част... Dec 7 2011, 07:50   bublik Цитата(Ivan Kuznetzov @ Dec 27 2011, 15:0... Jan 11 2012, 09:44 oland2000 Привет.
Ребята объясните мне пожалуйста я никак н... Jan 16 2012, 00:19 Ivan Kuznetzov bublik, чем отличаются mt9d131_write_regs и mt9d13... Nov 7 2012, 17:41
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|
|