不同平台時間戳介紹
1.征程 3 平台
其中 u64 timestamps: 硬件時間戳,是跟 CPU 一起用的 64 bit system counter,1s 是 24M 個 clock。 FS 的時候從硬件寄存器讀取。讀取的值除以 24000 是毫秒,除以 24000000 是秒。
struct timeval tv; 系統時間, SIF FS 的時候獲取 do\_gettimeofday。
J3 時間戳和frameid相關的結構體定義如下:
驅動接口:
struct frame_id {
u32 frame_id;
u64 timestamps;
struct timeval tv;
};
HAL結構體:
typedef struct image_info_s {
uint16_t sensor_id;
uint32_t pipeline_id;
uint32_t frame_id;
uint64_t time_stamp; //HW time stamp 硬件時間
struct timeval tv; //system time of hal get buf,系統時間
int buf_index;
int img_format;
int fd[HB_VIO_BUFFER_MAX_PLANES];//ion buf fd
uint32_t size[HB_VIO_BUFFER_MAX_PLANES];
uint32_t planeCount;
uint32_t dynamic_flag;
uint32_t water_mark_line;
VIO_DATA_TYPE_E data_type;
buffer_state_e state;
} image_info_t;
2.征程 5 平台
其中的 tv 時間戳來源三種可選,通過設備樹可以設置默認來源,通過 sys 節點可以動態臨時修改來源
typedef struct _frame_info_s{
uint32_t frame_id;
uint64_t timestamps;//hw_timestamp (硬件時間戳)
struct timeval tv;// 系統時間(軟件時間戳)
uint32_t format;
uint32_t height;
uint32_t width;
uint64_t addr[7];
uint32_t pre_int;
uint32_t num_planes;
int32_t bufferindex;
uint32_t pixel_length;
uint32_t dynamic_flag;
} frame_info_t;
3.征程 6 平台
相較與 征程 5, 增加了 lpwm 信號的 trig 時間,同時 tv 時間中的 phc 由硬件自動緩存。
typedef struct image_info_s {
uint16_t sensor_id; /**< sensor id */
uint32_t pipeline_id; /**< pipeline id */
uint32_t frame_id; /**< frame id */
uint64_t time_stamp; /**< HW time stamp */
struct timeval tv; /**< system time of hal get buf */
int32_t buf_index; /**< buffer index */
int32_t img_format; /**< image format */
int32_t fd[HB_VIO_BUFFER_MAX_PLANES]; /**< ion buf fd */
uint32_t size[HB_VIO_BUFFER_MAX_PLANES]; /**< buffer size per plane */
uint32_t planeCount; /**< image plane count */
uint32_t dynamic_flag; /**< dynamic flag */
uint32_t water_mark_line; /**< water mark line value */
VIO_DATA_TYPE_E data_type; /**< buffer data type */
buffer_state_e state; /**< buffer state */
uint64_t desc; /**< temp description for isp raw feedback */
struct timeval trig_tv;/**< system time of lpwm trigger */
} image_info_t;