Files
dragonpilot/selfdrive/camerad/cameras/camera_qcom2.h
George Hotz 8db0993663 tici: add (somewhat) broken camerad support (#1300)
* capnparm

* building in progress

* scons build works

* that script fixes opencl

* start new camera code

* includes and more camera scripts

* control c works now

* no device control yet

* phy too

* just one camera for now

* fix capnparm

* hmm, the inits are needed

* more cameras

* link stop start

* doesn't work yet

* fix ion on qcom2

* start poll ish

* 4 pictures and done

* no jpeg

* it works to picture

* destroy sync obj

* both work for now

* defined QCOM2

* fix fd leak

* run modeld

* 10 bit mode

* real frame stride

* needs digital gain

* dnew

* no color correcting on new

* that snpe doesn't work

* qcom2 gate

* cleanups

* oops, fix aarch64 detector

* update cereal

* modeld works with SNPE

* fix driver monitoring model

Co-authored-by: Tici <robbe@comma.ai>
2020-03-31 16:34:55 -07:00

87 lines
1.5 KiB
C

#ifndef CAMERA_H
#define CAMERA_H
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
#include "common/mat.h"
#include "common/visionbuf.h"
#include "common/buffering.h"
#include "camera_common.h"
#include "media/cam_req_mgr.h"
#define FRAME_BUF_COUNT 4
#define METADATA_BUF_COUNT 4
#ifdef __cplusplus
extern "C" {
#endif
typedef struct CameraState {
CameraInfo ci;
FrameMetadata camera_bufs_metadata[FRAME_BUF_COUNT];
TBuffer camera_tb;
int frame_size;
float digital_gain;
mat3 transform;
int device_iommu;
int cdm_iommu;
int video0_fd;
int video1_fd;
int isp_fd;
int sensor_fd;
int csiphy_fd;
int camera_num;
VisionBuf *bufs;
uint32_t session_handle;
uint32_t sensor_dev_handle;
uint32_t isp_dev_handle;
uint32_t csiphy_dev_handle;
int32_t link_handle;
int buf0_handle;
int buf_handle[FRAME_BUF_COUNT];
int sched_request_id;
int request_ids[FRAME_BUF_COUNT];
int sync_objs[FRAME_BUF_COUNT];
struct cam_req_mgr_session_info req_mgr_session_info;
} CameraState;
typedef struct DualCameraState {
int device;
int video0_fd;
int video1_fd;
int isp_fd;
CameraState rear;
CameraState front;
CameraState wide;
} DualCameraState;
void cameras_init(DualCameraState *s);
void cameras_open(DualCameraState *s, VisionBuf *camera_bufs_rear, VisionBuf *camera_bufs_focus, VisionBuf *camera_bufs_stats, VisionBuf *camera_bufs_front);
void cameras_run(DualCameraState *s);
void camera_autoexposure(CameraState *s, float grey_frac);
#ifdef __cplusplus
} // extern "C"
#endif
#endif