|
|
|
@ -2,13 +2,14 @@ |
|
|
|
|
|
|
|
|
|
#include "cdm.h" |
|
|
|
|
|
|
|
|
|
#include "system/camerad/cameras/tici.h" |
|
|
|
|
#include "system/camerad/cameras/hw.h" |
|
|
|
|
#include "system/camerad/sensors/sensor.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int build_update(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t> &patches, int camera_num) { |
|
|
|
|
int build_update(uint8_t *dst, const CameraConfig cam, const SensorInfo *s, std::vector<uint32_t> &patches) { |
|
|
|
|
uint8_t *start = dst; |
|
|
|
|
|
|
|
|
|
// init sequence
|
|
|
|
|
dst += write_random(dst, { |
|
|
|
|
0x2c, 0xffffffff, |
|
|
|
|
0x30, 0xffffffff, |
|
|
|
@ -17,6 +18,7 @@ int build_update(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t> &patch |
|
|
|
|
0x3c, 0xffffffff, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// demux cfg
|
|
|
|
|
dst += write_cont(dst, 0x560, { |
|
|
|
|
0x00000001, |
|
|
|
|
0x04440444, |
|
|
|
@ -35,38 +37,31 @@ int build_update(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t> &patch |
|
|
|
|
0x00000000, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// module config/enables (e.g. enable debayer, white balance, etc.)
|
|
|
|
|
dst += write_cont(dst, 0x40, { |
|
|
|
|
0x00000c06 | ((uint32_t)(camera_num == 1) << 8), |
|
|
|
|
0x00000c06 | ((uint32_t)(cam.vignetting_correction) << 8), |
|
|
|
|
}); |
|
|
|
|
dst += write_cont(dst, 0x44, { |
|
|
|
|
0x00000000, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
dst += write_cont(dst, 0x48, { |
|
|
|
|
(1 << 3) | (1 << 1), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
dst += write_cont(dst, 0x4c, { |
|
|
|
|
0x00000019, |
|
|
|
|
}); |
|
|
|
|
dst += write_cont(dst, 0xf00, { |
|
|
|
|
0x00000000, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// cropping
|
|
|
|
|
dst += write_cont(dst, 0xe0c, { |
|
|
|
|
0x00000e00, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
dst += write_cont(dst, 0xe2c, { |
|
|
|
|
0x00000e00, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
dst += write_cont(dst, 0x44, { |
|
|
|
|
0x00000000, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
dst += write_cont(dst, 0xaac, { |
|
|
|
|
0x00000000, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
dst += write_cont(dst, 0xf00, { |
|
|
|
|
0x00000000, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// black level scale + offset
|
|
|
|
|
dst += write_cont(dst, 0x6b0, { |
|
|
|
|
((uint32_t)(1 << 11) << 0xf) | (s->black_level << (14 - s->bits_per_pixel)), |
|
|
|
@ -78,11 +73,11 @@ int build_update(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t> &patch |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int build_initial_config(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t> &patches, int camera_num) { |
|
|
|
|
int build_initial_config(uint8_t *dst, const CameraConfig cam, const SensorInfo *s, std::vector<uint32_t> &patches) { |
|
|
|
|
uint8_t *start = dst; |
|
|
|
|
|
|
|
|
|
// start with the every frame config
|
|
|
|
|
dst += build_update(dst, s, patches, camera_num); |
|
|
|
|
dst += build_update(dst, cam, s, patches); |
|
|
|
|
|
|
|
|
|
uint64_t addr; |
|
|
|
|
|
|
|
|
@ -115,15 +110,6 @@ int build_initial_config(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t |
|
|
|
|
// TODO: this is DMI64 in the dump, does that matter?
|
|
|
|
|
dst += write_dmi(dst, &addr, s->linearization_lut.size()*sizeof(uint32_t), 0xc24, 9); |
|
|
|
|
patches.push_back(addr - (uint64_t)start); |
|
|
|
|
/* TODO
|
|
|
|
|
cdm_dmi_cmd_t 248 |
|
|
|
|
.length = 287 |
|
|
|
|
.reserved = 33 |
|
|
|
|
.cmd = 11 |
|
|
|
|
.addr = 0 |
|
|
|
|
.DMIAddr = 3108 |
|
|
|
|
.DMISel = 9 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
// vignetting correction
|
|
|
|
|
dst += write_cont(dst, 0x6bc, { |
|
|
|
@ -180,7 +166,7 @@ int build_initial_config(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t |
|
|
|
|
0x03ff0000, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// TODO: remove this
|
|
|
|
|
// output size/scaling
|
|
|
|
|
dst += write_cont(dst, 0xa3c, { |
|
|
|
|
0x00000003, |
|
|
|
|
((s->frame_width - 1) << 16) | (s->frame_width - 1), |
|
|
|
|