|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Initialization of MT9V117 chip and options to change settings. More...
#include "std.h"#include "mt9v117.h"#include "mt9v117_regs.h"#include "peripherals/video_device.h"#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/ioctl.h>#include <linux/i2c-dev.h>#include <linux/videodev2.h>#include <linux/v4l2-mediabus.h>#include "boards/bebop.h"Go to the source code of this file.
Data Structures | |
| struct | mt9v117_patch_t |
Macros | |
| #define | MT9V117_I2C_TRIES 3 |
| #define | MS9v117_CROP_WIDTH 240 |
| #define | MS9v117_CROP_HEIGHT 240 |
| #define | MT9V117_PATCH_LINE_NUM 13 |
Functions | |
| static bool | i2c_checked (struct i2c_periph *p, struct i2c_transaction *t, uint8_t slave, uint16_t reg, uint8_t len_w, uint16_t len_r, float timeout, const char *tag) |
| Blocking I2C transaction with result check and retry. | |
| static void | write_reg (struct mt9v117_t *mt, uint16_t addr, uint32_t val, uint16_t len) |
| Write multiple bytes to a single register. | |
| static uint32_t | read_reg (struct mt9v117_t *mt, uint16_t addr, uint16_t len) |
| Read multiple bytes from a register. | |
| static void | write_var (struct mt9v117_t *mt, uint16_t var, uint16_t offset, uint32_t val, uint16_t len) |
| static uint32_t | read_var (struct mt9v117_t *mt, uint16_t var, uint16_t offset, uint16_t len) |
| static void | mt9v117_write_patch (struct mt9v117_t *mt) |
| static void | mt9v117_config (struct mt9v117_t *mt) |
| void | mt9v117_init (struct mt9v117_t *mt) |
| Initialisation of the Aptina MT9V117 CMOS sensor (1/6 inch VGA, bottom camera). | |
Variables | |
| struct video_config_t | bottom_camera |
| struct mt9v117_t | mt9v117 |
| static uint8_t | patch_line1 [] |
| static uint8_t | patch_line2 [] |
| static uint8_t | patch_line3 [] |
| static uint8_t | patch_line4 [] |
| static uint8_t | patch_line5 [] |
| static uint8_t | patch_line6 [] |
| static uint8_t | patch_line7 [] |
| static uint8_t | patch_line8 [] |
| static uint8_t | patch_line9 [] |
| static uint8_t | patch_line10 [] |
| static uint8_t | patch_line11 [] |
| static uint8_t | patch_line12 [] |
| static uint8_t | patch_line13 [] |
| static const struct mt9v117_patch_t | mt9v117_patch_lines [MT9V117_PATCH_LINE_NUM] |
Initialization of MT9V117 chip and options to change settings.
Runs onboard AND in NPS (included by mt9v117_nps.c). NPS has no sensor: no I2C is done and every register reads as 0. So never configure from values read from the sensor (e.g. ask it for its resolution and store that in the struct): it would work onboard and break NPS.
Definition in file mt9v117.c.
| struct mt9v117_patch_t |
| #define MT9V117_I2C_TRIES 3 |
Definition at line 40 of file mt9v117.c.
Referenced by i2c_checked().
| #define MT9V117_PATCH_LINE_NUM 13 |
Definition at line 144 of file mt9v117.c.
Referenced by mt9v117_write_patch().
|
static |
Blocking I2C transaction with result check and retry.
Never resubmits while the previous transaction is still queued, and sets the register address again before each read (a failed read can overwrite it).
Definition at line 49 of file mt9v117.c.
References i2c_transaction::buf, i2c_blocking_transceive(), i2c_blocking_transmit(), I2CTransPending, I2CTransRunning, I2CTransSuccess, MT9V117_I2C_TRIES, p, s, i2c_transaction::status, and timeout.
Referenced by mt9v117_write_patch(), read_reg(), and write_reg().
|
inlinestatic |
Definition at line 391 of file mt9v117.c.
References MT9V117_AE_TRACK_JUMP_DIVISOR, MT9V117_CAM_AET_SKIP_FRAMES, MT9V117_CAM_CROP_MODE_OFFSET, MT9V117_CAM_CROP_WINDOW_HEIGHT_OFFSET, MT9V117_CAM_CROP_WINDOW_WIDTH_OFFSET, MT9V117_CAM_CROP_WINDOW_XOFFSET_OFFSET, MT9V117_CAM_CROP_WINDOW_YOFFSET_OFFSET, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_LL_START_GAIN_METRIC_OFFSET, MT9V117_CAM_LL_STOP_GAIN_METRIC_OFFSET, MT9V117_CAM_OUTPUT_HEIGHT_OFFSET, MT9V117_CAM_OUTPUT_WIDTH_OFFSET, MT9V117_CAM_SENSOR_CFG_CPIPE_LAST_ROW_OFFSET, MT9V117_CAM_SENSOR_CFG_FRAME_LENGTH_LINES_OFFSET, MT9V117_CAM_SENSOR_CFG_MAX_FDZONE_60_OFFSET, MT9V117_CAM_SENSOR_CFG_TARGET_FDZONE_60_OFFSET, MT9V117_CAM_SENSOR_CFG_X_ADDR_END_OFFSET, MT9V117_CAM_SENSOR_CFG_X_ADDR_START_OFFSET, MT9V117_CAM_SENSOR_CFG_Y_ADDR_END_OFFSET, MT9V117_CAM_SENSOR_CFG_Y_ADDR_START_OFFSET, MT9V117_CAM_SENSOR_CONTROL_READ_MODE_OFFSET, MT9V117_CAM_SENSOR_CONTROL_Y_SKIP_EN, MT9V117_CAM_STAT_AE_INITIAL_WINDOW_XEND_OFFSET, MT9V117_CAM_STAT_AE_INITIAL_WINDOW_XSTART_OFFSET, MT9V117_CAM_STAT_AE_INITIAL_WINDOW_YEND_OFFSET, MT9V117_CAM_STAT_AE_INITIAL_WINDOW_YSTART_OFFSET, MT9V117_CAM_STAT_AWB_HG_WINDOW_XEND_OFFSET, MT9V117_CAM_STAT_AWB_HG_WINDOW_XSTART_OFFSET, MT9V117_CAM_STAT_AWB_HG_WINDOW_YEND_OFFSET, MT9V117_CAM_STAT_AWB_HG_WINDOW_YSTART_OFFSET, write_reg(), and write_var().
Referenced by mt9v117_init().
| void mt9v117_init | ( | struct mt9v117_t * | mt | ) |
Initialisation of the Aptina MT9V117 CMOS sensor (1/6 inch VGA, bottom camera).
Definition at line 438 of file mt9v117.c.
References mt9v117_t::i2c_trans, I2CTransDone, MT9V117_AE_LUMA, MT9V117_AE_RULE_ALGO_AVERAGE, MT9V117_AE_RULE_ALGO_OFFSET, MT9V117_AE_RULE_VAR, MT9V117_AWB_PIXEL_THRESHOLD_COUNT_OFFSET, MT9V117_AWB_VAR, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_OUTPUT_FORMAT_BT656_ENABLE, MT9V117_CAM_OUTPUT_FORMAT_OFFSET, MT9V117_CHIP_ID, MT9V117_CHIP_ID_RESP, MT9V117_COMMAND, MT9V117_COMMAND_OK, MT9V117_COMMAND_SET_STATE, mt9v117_config(), MT9V117_PAD_SLEW, MT9V117_RESET_MISC_CTRL, MT9V117_RESET_SOC_I2C, MT9V117_SYS_STATE_ENTER_CONFIG_CHANGE, MT9V117_SYSMGR_NEXT_STATE_OFFSET, MT9V117_SYSMGR_VAR, MT9V117_TARGET_LUMA, mt9v117_write_patch(), read_reg(), read_var(), i2c_transaction::status, write_reg(), and write_var().
|
inlinestatic |
Definition at line 328 of file mt9v117.c.
References i2c_transaction::buf, i2c_checked(), mt9v117_t::i2c_periph, mt9v117_t::i2c_trans, MT9V117_ACCESS_CTL_STAT, MT9V117_AE_TRACK_VAR, MT9V117_CAM_CTRL_VAR, MT9V117_COMMAND, MT9V117_COMMAND_APPLY_PATCH, MT9V117_COMMAND_OK, MT9V117_LOGICAL_ADDRESS_ACCESS, MT9V117_LOW_LIGHT_VAR, MT9V117_PATCH_LINE_NUM, mt9v117_patch_lines, MT9V117_PATCHLDR_FIRMWARE_ID_OFFSET, MT9V117_PATCHLDR_LOADER_ADDRESS_OFFSET, MT9V117_PATCHLDR_PATCH_ID_OFFSET, MT9V117_PATCHLDR_VAR, MT9V117_PHYSICAL_ADDRESS_ACCESS, read_reg(), i2c_transaction::slave_addr, write_reg(), and write_var().
Referenced by mt9v117_init().
Read multiple bytes from a register.
Definition at line 298 of file mt9v117.c.
References i2c_transaction::buf, i2c_checked(), mt9v117_t::i2c_periph, mt9v117_t::i2c_trans, mt9v117_patch_t::len, and MT9V117_ADDRESS.
Referenced by mt9v117_init(), mt9v117_write_patch(), and read_var().
Definition at line 322 of file mt9v117.c.
References mt9v117_patch_t::len, offset, and read_reg().
Referenced by mt9v117_init().
Write multiple bytes to a single register.
Definition at line 271 of file mt9v117.c.
References i2c_transaction::buf, i2c_checked(), mt9v117_t::i2c_periph, mt9v117_t::i2c_trans, mt9v117_patch_t::len, MT9V117_ADDRESS, and val.
Referenced by mt9v117_config(), mt9v117_init(), mt9v117_write_patch(), and write_var().
|
static |
Definition at line 315 of file mt9v117.c.
References mt9v117_patch_t::len, offset, val, and write_reg().
Referenced by mt9v117_config(), mt9v117_init(), and mt9v117_write_patch().
| struct video_config_t bottom_camera |
| struct mt9v117_t mt9v117 |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |