mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
drivers/sensors: Use private CSI resolution table.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
7b4c545b47
commit
1a1cf29673
@ -145,7 +145,7 @@ static int snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int num_pixels = resolution[boson_framesize][0] * resolution[boson_framesize][1];
|
int num_pixels = csi->resolution[boson_framesize][0] * csi->resolution[boson_framesize][1];
|
||||||
|
|
||||||
if (csi->color_palette && (framebuffer_get_buffer_size(csi->fb) >= (num_pixels * sizeof(uint16_t)))) {
|
if (csi->color_palette && (framebuffer_get_buffer_size(csi->fb) >= (num_pixels * sizeof(uint16_t)))) {
|
||||||
for (int32_t i = num_pixels - 1; i >= 0; i--) {
|
for (int32_t i = num_pixels - 1; i >= 0; i--) {
|
||||||
@ -175,11 +175,11 @@ int boson_init(omv_csi_t *csi) {
|
|||||||
csi->mono_bpp = sizeof(uint8_t);
|
csi->mono_bpp = sizeof(uint8_t);
|
||||||
|
|
||||||
// Override standard resolutions
|
// Override standard resolutions
|
||||||
resolution[OMV_CSI_FRAMESIZE_VGA][0] = 640;
|
csi->resolution[OMV_CSI_FRAMESIZE_VGA][0] = 640;
|
||||||
resolution[OMV_CSI_FRAMESIZE_VGA][1] = 512;
|
csi->resolution[OMV_CSI_FRAMESIZE_VGA][1] = 512;
|
||||||
|
|
||||||
resolution[OMV_CSI_FRAMESIZE_QVGA][0] = 320;
|
csi->resolution[OMV_CSI_FRAMESIZE_QVGA][0] = 320;
|
||||||
resolution[OMV_CSI_FRAMESIZE_QVGA][1] = 256;
|
csi->resolution[OMV_CSI_FRAMESIZE_QVGA][1] = 256;
|
||||||
|
|
||||||
if (reset(csi) != 0) {
|
if (reset(csi) != 0) {
|
||||||
return OMV_CSI_ERROR_CSI_INIT_FAILED;
|
return OMV_CSI_ERROR_CSI_INIT_FAILED;
|
||||||
|
@ -842,8 +842,8 @@ static int set_window(omv_csi_t *csi, uint16_t reg, uint16_t x, uint16_t y, uint
|
|||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
|
|
||||||
// Invalid resolution.
|
// Invalid resolution.
|
||||||
if ((w > ACTIVE_SENSOR_WIDTH) || (h > ACTIVE_SENSOR_HEIGHT)) {
|
if ((w > ACTIVE_SENSOR_WIDTH) || (h > ACTIVE_SENSOR_HEIGHT)) {
|
||||||
@ -957,8 +957,12 @@ static int ioctl(omv_csi_t *csi, int request, va_list ap) {
|
|||||||
case OMV_CSI_IOCTL_SET_READOUT_WINDOW: {
|
case OMV_CSI_IOCTL_SET_READOUT_WINDOW: {
|
||||||
int tmp_readout_x = va_arg(ap, int);
|
int tmp_readout_x = va_arg(ap, int);
|
||||||
int tmp_readout_y = va_arg(ap, int);
|
int tmp_readout_y = va_arg(ap, int);
|
||||||
int tmp_readout_w = IM_CLAMP(va_arg(ap, int), resolution[csi->framesize][0], ACTIVE_SENSOR_WIDTH);
|
int tmp_readout_w = IM_CLAMP(va_arg(ap, int),
|
||||||
int tmp_readout_h = IM_CLAMP(va_arg(ap, int), resolution[csi->framesize][1], ACTIVE_SENSOR_HEIGHT);
|
csi->resolution[csi->framesize][0],
|
||||||
|
ACTIVE_SENSOR_WIDTH);
|
||||||
|
int tmp_readout_h = IM_CLAMP(va_arg(ap, int),
|
||||||
|
csi->resolution[csi->framesize][1],
|
||||||
|
ACTIVE_SENSOR_HEIGHT);
|
||||||
int readout_x_max = (ACTIVE_SENSOR_WIDTH - tmp_readout_w) / 2;
|
int readout_x_max = (ACTIVE_SENSOR_WIDTH - tmp_readout_w) / 2;
|
||||||
int readout_y_max = (ACTIVE_SENSOR_HEIGHT - tmp_readout_h) / 2;
|
int readout_y_max = (ACTIVE_SENSOR_HEIGHT - tmp_readout_h) / 2;
|
||||||
tmp_readout_x = IM_CLAMP(tmp_readout_x, -readout_x_max, readout_x_max);
|
tmp_readout_x = IM_CLAMP(tmp_readout_x, -readout_x_max, readout_x_max);
|
||||||
|
@ -97,8 +97,8 @@ static int reset(omv_csi_t *csi) {
|
|||||||
genx->contrast = CONTRAST_DEFAULT;
|
genx->contrast = CONTRAST_DEFAULT;
|
||||||
genx->brightness = BRIGHTNESS_DEFAULT;
|
genx->brightness = BRIGHTNESS_DEFAULT;
|
||||||
genx->event_time_us = 0;
|
genx->event_time_us = 0;
|
||||||
resolution[OMV_CSI_FRAMESIZE_CUSTOM][0] = ACTIVE_SENSOR_WIDTH;
|
csi->resolution[OMV_CSI_FRAMESIZE_CUSTOM][0] = ACTIVE_SENSOR_WIDTH;
|
||||||
resolution[OMV_CSI_FRAMESIZE_CUSTOM][1] = ACTIVE_SENSOR_HEIGHT;
|
csi->resolution[OMV_CSI_FRAMESIZE_CUSTOM][1] = ACTIVE_SENSOR_HEIGHT;
|
||||||
|
|
||||||
// Set histogram mode by default.
|
// Set histogram mode by default.
|
||||||
if (set_active_mode(csi, OMV_CSI_GENX320_MODE_HISTO, OMV_CSI_FRAMESIZE_CUSTOM)) {
|
if (set_active_mode(csi, OMV_CSI_GENX320_MODE_HISTO, OMV_CSI_FRAMESIZE_CUSTOM)) {
|
||||||
@ -154,8 +154,8 @@ static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
|||||||
|
|
||||||
if (genx->mode == OMV_CSI_GENX320_MODE_HISTO) {
|
if (genx->mode == OMV_CSI_GENX320_MODE_HISTO) {
|
||||||
if (framesize == OMV_CSI_FRAMESIZE_CUSTOM &&
|
if (framesize == OMV_CSI_FRAMESIZE_CUSTOM &&
|
||||||
resolution[framesize][0] == ACTIVE_SENSOR_WIDTH &&
|
csi->resolution[framesize][0] == ACTIVE_SENSOR_WIDTH &&
|
||||||
resolution[framesize][1] == ACTIVE_SENSOR_HEIGHT) {
|
csi->resolution[framesize][1] == ACTIVE_SENSOR_HEIGHT) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (framesize == OMV_CSI_FRAMESIZE_320X320) ? 0 : -1;
|
return (framesize == OMV_CSI_FRAMESIZE_320X320) ? 0 : -1;
|
||||||
@ -193,7 +193,8 @@ static int set_framerate(omv_csi_t *csi, int framerate) {
|
|||||||
omv_csi_abort(csi, true, false);
|
omv_csi_abort(csi, true, false);
|
||||||
|
|
||||||
psee_sensor_write(csi, EHC_INTEGRATION_PERIOD, us);
|
psee_sensor_write(csi, EHC_INTEGRATION_PERIOD, us);
|
||||||
psee_sensor_write(csi, CPI_PACKET_TIME_CONTROL, ACTIVE_SENSOR_WIDTH << CPI_PACKET_TIME_CONTROL_PERIOD_Pos |
|
psee_sensor_write(csi, CPI_PACKET_TIME_CONTROL,
|
||||||
|
ACTIVE_SENSOR_WIDTH << CPI_PACKET_TIME_CONTROL_PERIOD_Pos |
|
||||||
hsync_clocks << CPI_PACKET_TIME_CONTROL_BLANKING_Pos);
|
hsync_clocks << CPI_PACKET_TIME_CONTROL_BLANKING_Pos);
|
||||||
|
|
||||||
// Wait for the camera to settle
|
// Wait for the camera to settle
|
||||||
@ -427,8 +428,8 @@ static int ioctl(omv_csi_t *csi, int request, va_list ap) {
|
|||||||
int mode = va_arg(ap, int);
|
int mode = va_arg(ap, int);
|
||||||
|
|
||||||
if (mode == OMV_CSI_GENX320_MODE_HISTO) {
|
if (mode == OMV_CSI_GENX320_MODE_HISTO) {
|
||||||
resolution[OMV_CSI_FRAMESIZE_CUSTOM][0] = ACTIVE_SENSOR_WIDTH;
|
csi->resolution[OMV_CSI_FRAMESIZE_CUSTOM][0] = ACTIVE_SENSOR_WIDTH;
|
||||||
resolution[OMV_CSI_FRAMESIZE_CUSTOM][1] = ACTIVE_SENSOR_HEIGHT;
|
csi->resolution[OMV_CSI_FRAMESIZE_CUSTOM][1] = ACTIVE_SENSOR_HEIGHT;
|
||||||
|
|
||||||
if ((ret = set_active_mode(csi, OMV_CSI_GENX320_MODE_HISTO, OMV_CSI_FRAMESIZE_CUSTOM))) {
|
if ((ret = set_active_mode(csi, OMV_CSI_GENX320_MODE_HISTO, OMV_CSI_FRAMESIZE_CUSTOM))) {
|
||||||
break;
|
break;
|
||||||
@ -449,8 +450,8 @@ static int ioctl(omv_csi_t *csi, int request, va_list ap) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolution[OMV_CSI_FRAMESIZE_CUSTOM][0] = 1024;
|
csi->resolution[OMV_CSI_FRAMESIZE_CUSTOM][0] = 1024;
|
||||||
resolution[OMV_CSI_FRAMESIZE_CUSTOM][1] = ndarray_size >> 8;
|
csi->resolution[OMV_CSI_FRAMESIZE_CUSTOM][1] = ndarray_size >> 8;
|
||||||
|
|
||||||
if ((ret = set_active_mode(csi, OMV_CSI_GENX320_MODE_EVENT, OMV_CSI_FRAMESIZE_CUSTOM))) {
|
if ((ret = set_active_mode(csi, OMV_CSI_GENX320_MODE_EVENT, OMV_CSI_FRAMESIZE_CUSTOM))) {
|
||||||
break;
|
break;
|
||||||
@ -518,8 +519,8 @@ static int ioctl(omv_csi_t *csi, int request, va_list ap) {
|
|||||||
i += val;
|
i += val;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uint32_t len = resolution[csi->framesize][0] *
|
uint32_t len = csi->resolution[csi->framesize][0] *
|
||||||
(resolution[csi->framesize][1] / sizeof(uint32_t));
|
(csi->resolution[csi->framesize][1] / sizeof(uint32_t));
|
||||||
for (uint32_t j = 0; j < len; j++) {
|
for (uint32_t j = 0; j < len; j++) {
|
||||||
uint32_t val = ((uint32_t *) image.data)[j];
|
uint32_t val = ((uint32_t *) image.data)[j];
|
||||||
switch (__EVT20_TYPE(val)) {
|
switch (__EVT20_TYPE(val)) {
|
||||||
@ -656,8 +657,8 @@ static int set_active_mode(omv_csi_t *csi, genx_mode_t mode, int framesize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure Packet and Frame sizes
|
// Configure Packet and Frame sizes
|
||||||
uint32_t packet_width = resolution[framesize][0];
|
uint32_t packet_width = csi->resolution[framesize][0];
|
||||||
uint32_t packet_height = resolution[framesize][1];
|
uint32_t packet_height = csi->resolution[framesize][1];
|
||||||
uint32_t packet_hsync = (mode == OMV_CSI_GENX320_MODE_EVENT) ?
|
uint32_t packet_hsync = (mode == OMV_CSI_GENX320_MODE_EVENT) ?
|
||||||
EVENT_HSYNC_CLOCK_CYCLES : HISTO_HSYNC_CLOCK_CYCLES;
|
EVENT_HSYNC_CLOCK_CYCLES : HISTO_HSYNC_CLOCK_CYCLES;
|
||||||
|
|
||||||
|
@ -252,8 +252,8 @@ static const uint16_t QQVGA_regs[][2] = {
|
|||||||
|
|
||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
|
|
||||||
switch (framesize) {
|
switch (framesize) {
|
||||||
case OMV_CSI_FRAMESIZE_QVGA:
|
case OMV_CSI_FRAMESIZE_QVGA:
|
||||||
|
@ -401,8 +401,8 @@ static int snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
|||||||
return OMV_CSI_ERROR_INVALID_FRAMESIZE;
|
return OMV_CSI_ERROR_INVALID_FRAMESIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolution[csi->framesize][0] < lepton.h_res ||
|
if (csi->resolution[csi->framesize][0] < lepton.h_res ||
|
||||||
resolution[csi->framesize][1] < lepton.v_res) {
|
csi->resolution[csi->framesize][1] < lepton.v_res) {
|
||||||
return OMV_CSI_ERROR_INVALID_FRAMESIZE;
|
return OMV_CSI_ERROR_INVALID_FRAMESIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,8 +586,8 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
|
|
||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
|
|
||||||
if ((csi->pixformat == PIXFORMAT_BAYER) &&
|
if ((csi->pixformat == PIXFORMAT_BAYER) &&
|
||||||
((framesize != OMV_CSI_FRAMESIZE_VGA) && (framesize != OMV_CSI_FRAMESIZE_SXGAM))) {
|
((framesize != OMV_CSI_FRAMESIZE_VGA) && (framesize != OMV_CSI_FRAMESIZE_SXGAM))) {
|
||||||
@ -942,8 +942,12 @@ static int ioctl(omv_csi_t *csi, int request, va_list ap) {
|
|||||||
case OMV_CSI_IOCTL_SET_READOUT_WINDOW: {
|
case OMV_CSI_IOCTL_SET_READOUT_WINDOW: {
|
||||||
int tmp_readout_x = va_arg(ap, int);
|
int tmp_readout_x = va_arg(ap, int);
|
||||||
int tmp_readout_y = va_arg(ap, int);
|
int tmp_readout_y = va_arg(ap, int);
|
||||||
int tmp_readout_w = IM_CLAMP(va_arg(ap, int), resolution[csi->framesize][0], ACTIVE_SENSOR_WIDTH);
|
int tmp_readout_w = IM_CLAMP(va_arg(ap, int),
|
||||||
int tmp_readout_h = IM_CLAMP(va_arg(ap, int), resolution[csi->framesize][1], ACTIVE_SENSOR_HEIGHT);
|
csi->resolution[csi->framesize][0],
|
||||||
|
ACTIVE_SENSOR_WIDTH);
|
||||||
|
int tmp_readout_h = IM_CLAMP(va_arg(ap, int),
|
||||||
|
csi->resolution[csi->framesize][1],
|
||||||
|
ACTIVE_SENSOR_HEIGHT);
|
||||||
int readout_x_max = (ACTIVE_SENSOR_WIDTH - tmp_readout_w) / 2;
|
int readout_x_max = (ACTIVE_SENSOR_WIDTH - tmp_readout_w) / 2;
|
||||||
int readout_y_max = (ACTIVE_SENSOR_HEIGHT - tmp_readout_h) / 2;
|
int readout_y_max = (ACTIVE_SENSOR_HEIGHT - tmp_readout_h) / 2;
|
||||||
tmp_readout_x = IM_CLAMP(tmp_readout_x, -readout_x_max, readout_x_max);
|
tmp_readout_x = IM_CLAMP(tmp_readout_x, -readout_x_max, readout_x_max);
|
||||||
|
@ -171,8 +171,8 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
uint16_t chip_control, read_mode;
|
uint16_t chip_control, read_mode;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
|
|
||||||
if ((w > ACTIVE_SENSOR_WIDTH) || (h > ACTIVE_SENSOR_HEIGHT)) {
|
if ((w > ACTIVE_SENSOR_WIDTH) || (h > ACTIVE_SENSOR_HEIGHT)) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -443,8 +443,8 @@ static int ioctl(omv_csi_t *csi, int request, va_list ap) {
|
|||||||
|
|
||||||
// The MT9V0XX does not have a hardware scaler so the readout w/h must be equal to the
|
// The MT9V0XX does not have a hardware scaler so the readout w/h must be equal to the
|
||||||
// framesize w/h.
|
// framesize w/h.
|
||||||
int tmp_readout_w = resolution[csi->framesize][0];
|
int tmp_readout_w = csi->resolution[csi->framesize][0];
|
||||||
int tmp_readout_h = resolution[csi->framesize][1];
|
int tmp_readout_h = csi->resolution[csi->framesize][1];
|
||||||
if (csi->framesize == OMV_CSI_FRAMESIZE_INVALID) {
|
if (csi->framesize == OMV_CSI_FRAMESIZE_INVALID) {
|
||||||
tmp_readout_w = ACTIVE_SENSOR_WIDTH;
|
tmp_readout_w = ACTIVE_SENSOR_WIDTH;
|
||||||
tmp_readout_h = ACTIVE_SENSOR_HEIGHT;
|
tmp_readout_h = ACTIVE_SENSOR_HEIGHT;
|
||||||
|
@ -441,8 +441,8 @@ static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
|||||||
uint16_t sensor_w = 0;
|
uint16_t sensor_w = 0;
|
||||||
uint16_t sensor_h = 0;
|
uint16_t sensor_h = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
|
|
||||||
if ((w % 4) || (h % 4) || (w > UXGA_WIDTH) || (h > UXGA_HEIGHT)) {
|
if ((w % 4) || (h % 4) || (w > UXGA_WIDTH) || (h > UXGA_HEIGHT)) {
|
||||||
// w/h must be divisible by 4
|
// w/h must be divisible by 4
|
||||||
|
@ -775,7 +775,9 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
// Not a multiple of 8. The JPEG encoder on the OV5640 can't handle this.
|
// Not a multiple of 8. The JPEG encoder on the OV5640 can't handle this.
|
||||||
if ((pixformat == PIXFORMAT_JPEG) && ((resolution[csi->framesize][0] % 8) || (resolution[csi->framesize][1] % 8))) {
|
if ((pixformat == PIXFORMAT_JPEG) &&
|
||||||
|
((csi->resolution[csi->framesize][0] % 8) ||
|
||||||
|
(csi->resolution[csi->framesize][1] % 8))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,7 +836,7 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
(reg & 0xD7) | ((pixformat == PIXFORMAT_JPEG) ? 0x28 : 0x00));
|
(reg & 0xD7) | ((pixformat == PIXFORMAT_JPEG) ? 0x28 : 0x00));
|
||||||
|
|
||||||
if (hts_target) {
|
if (hts_target) {
|
||||||
uint16_t sensor_hts = calculate_hts(csi, resolution[csi->framesize][0]);
|
uint16_t sensor_hts = calculate_hts(csi, csi->resolution[csi->framesize][0]);
|
||||||
|
|
||||||
ret |= omv_i2c_writeb2(csi->i2c, csi->slv_addr, TIMING_HTS_H, sensor_hts >> 8);
|
ret |= omv_i2c_writeb2(csi->i2c, csi->slv_addr, TIMING_HTS_H, sensor_hts >> 8);
|
||||||
ret |= omv_i2c_writeb2(csi->i2c, csi->slv_addr, TIMING_HTS_L, sensor_hts);
|
ret |= omv_i2c_writeb2(csi->i2c, csi->slv_addr, TIMING_HTS_L, sensor_hts);
|
||||||
@ -846,8 +848,8 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
uint8_t reg;
|
uint8_t reg;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
|
|
||||||
// Not a multiple of 8. The JPEG encoder on the OV5640 can't handle this.
|
// Not a multiple of 8. The JPEG encoder on the OV5640 can't handle this.
|
||||||
if ((csi->pixformat == PIXFORMAT_JPEG) && ((w % 8) || (h % 8))) {
|
if ((csi->pixformat == PIXFORMAT_JPEG) && ((w % 8) || (h % 8))) {
|
||||||
@ -1339,8 +1341,12 @@ static int ioctl(omv_csi_t *csi, int request, va_list ap) {
|
|||||||
case OMV_CSI_IOCTL_SET_READOUT_WINDOW: {
|
case OMV_CSI_IOCTL_SET_READOUT_WINDOW: {
|
||||||
int tmp_readout_x = va_arg(ap, int);
|
int tmp_readout_x = va_arg(ap, int);
|
||||||
int tmp_readout_y = va_arg(ap, int);
|
int tmp_readout_y = va_arg(ap, int);
|
||||||
int tmp_readout_w = IM_CLAMP(va_arg(ap, int), resolution[csi->framesize][0], ACTIVE_SENSOR_WIDTH);
|
int tmp_readout_w = IM_CLAMP(va_arg(ap, int),
|
||||||
int tmp_readout_h = IM_CLAMP(va_arg(ap, int), resolution[csi->framesize][1], ACTIVE_SENSOR_HEIGHT);
|
csi->resolution[csi->framesize][0],
|
||||||
|
ACTIVE_SENSOR_WIDTH);
|
||||||
|
int tmp_readout_h = IM_CLAMP(va_arg(ap, int),
|
||||||
|
csi->resolution[csi->framesize][1],
|
||||||
|
ACTIVE_SENSOR_HEIGHT);
|
||||||
int readout_x_max = (ACTIVE_SENSOR_WIDTH - tmp_readout_w) / 2;
|
int readout_x_max = (ACTIVE_SENSOR_WIDTH - tmp_readout_w) / 2;
|
||||||
int readout_y_max = (ACTIVE_SENSOR_HEIGHT - tmp_readout_h) / 2;
|
int readout_y_max = (ACTIVE_SENSOR_HEIGHT - tmp_readout_h) / 2;
|
||||||
tmp_readout_x = IM_CLAMP(tmp_readout_x, -readout_x_max, readout_x_max);
|
tmp_readout_x = IM_CLAMP(tmp_readout_x, -readout_x_max, readout_x_max);
|
||||||
|
@ -281,8 +281,8 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
uint8_t reg;
|
uint8_t reg;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
bool vflip;
|
bool vflip;
|
||||||
|
|
||||||
if (((w > 640) || (h > 480))
|
if (((w > 640) || (h > 480))
|
||||||
|
@ -237,8 +237,8 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
uint8_t reg;
|
uint8_t reg;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
bool vflip;
|
bool vflip;
|
||||||
|
|
||||||
if ((w > 640) || (h > 480)) {
|
if ((w > 640) || (h > 480)) {
|
||||||
|
@ -727,14 +727,14 @@ int pag7936_init(omv_csi_t *csi) {
|
|||||||
csi->set_vflip = set_vflip;
|
csi->set_vflip = set_vflip;
|
||||||
|
|
||||||
// Override standard resolutions
|
// Override standard resolutions
|
||||||
resolution[OMV_CSI_FRAMESIZE_HD][0] = 1280;
|
csi->resolution[OMV_CSI_FRAMESIZE_HD][0] = 1280;
|
||||||
resolution[OMV_CSI_FRAMESIZE_HD][1] = 800;
|
csi->resolution[OMV_CSI_FRAMESIZE_HD][1] = 800;
|
||||||
|
|
||||||
resolution[OMV_CSI_FRAMESIZE_VGA][0] = 640;
|
csi->resolution[OMV_CSI_FRAMESIZE_VGA][0] = 640;
|
||||||
resolution[OMV_CSI_FRAMESIZE_VGA][1] = 400;
|
csi->resolution[OMV_CSI_FRAMESIZE_VGA][1] = 400;
|
||||||
|
|
||||||
resolution[OMV_CSI_FRAMESIZE_QVGA][0] = 320;
|
csi->resolution[OMV_CSI_FRAMESIZE_QVGA][0] = 320;
|
||||||
resolution[OMV_CSI_FRAMESIZE_QVGA][1] = 200;
|
csi->resolution[OMV_CSI_FRAMESIZE_QVGA][1] = 200;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif // (OMV_PAG7936_ENABLE == 1)
|
#endif // (OMV_PAG7936_ENABLE == 1)
|
||||||
|
@ -395,8 +395,8 @@ static int set_pixformat(omv_csi_t *csi, pixformat_t pixformat) {
|
|||||||
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
uint16_t w = resolution[framesize][0];
|
uint16_t w = csi->resolution[framesize][0];
|
||||||
uint16_t h = resolution[framesize][1];
|
uint16_t h = csi->resolution[framesize][1];
|
||||||
|
|
||||||
uint8_t aavg_VnH, abc_start_line, voffset, abc_sample_size;
|
uint8_t aavg_VnH, abc_start_line, voffset, abc_sample_size;
|
||||||
ret |= read_regs_w_bank(BANK_0, REG_CMD_AAVG_V /* REG_CMD_AAVG_H */, &aavg_VnH, 1);
|
ret |= read_regs_w_bank(BANK_0, REG_CMD_AAVG_V /* REG_CMD_AAVG_H */, &aavg_VnH, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user