征程 6 VIO Frame 時間戳介紹
1. 時間類型
征程 6 內部的時間類型如下
Linux 系統時間是基于 arm system counter 抽象的,Linux 的基于 arm system counter 抽象了很多種時間,圖中畫了兩種。CLOCK_MONOTONIC_RAW 是不會被時間同步調整的。
2. Frame 時間戳
從 VIO 側獲取的圖像數據,帶有時間戳信息,相關信息如下:
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;
time_stamp:代表收到第一行到達時刻,獲取的是 system count;
struct timeval tv: 代表收到第一行到達時刻,時間戳來源有 3 個地方, 分別代表 RTC 時戳,wall time,PHC 時戳,可通過/sys/devices/platform/soc/soc:globaltime/globaltime 配置;
struct timeval trig_tv: 同 tv,代表 LPWM trigger 時刻;
GLOBAL_TIME_RTC | 2 | 硬件寄存器鎖存 | Y |
GLOBAL_TIME_PHC | 1 | 依賴 FS ISR 軟件獲取 | Y |
GLOBAL_TIME_SYSTIME | 0 | 依賴 FS ISR 軟件獲取 | N |
RTC、PHC 是可以被時間同步調整的,直接調整的是硬件 counter。
○ RTC 時間獲取:CIM 可以通過讀寄存器直接拿到 RTC 時間,不建議調用接口獲取 RTC 時間
■ RTC 精確到秒的時間:應用層可以獲取
■ RTC 精確到納秒的時間:
□ 如果時間同步在同步 RTC,不允許其他應用獲取 RTC 時間,因為獲取 RTC 時間可能 導致 RTC 時間異常改變,這個是硬件限制。
□ 如果不做 RTC 的時間同步,應用層可以獲取 RTC 時間
*博客內容為網友個人發布,僅代表博主個人觀點,如有侵權請聯系工作人員刪除。