1 /* 2 ********************************************************************************************************* 3 * MELIS 4 * the Easy Portable/Player Develop Kits 5 * WEBCAM Driver 6 * 7 * (c) Copyright 2012-2016, Kingvan.Tong China 8 * All Rights Reserved 9 * 10 * File : drv_webcam.h 11 * By : Kingvan 12 * Version : v1.0 13 * Date : 2012-9-27 14 * Descript: 15 * Update : date auther ver notes 16 * 2012-9-27 11:09:13 Kingvan.Tong 2.0 build the file. 17 ********************************************************************************************************* 18 */ 19 #ifndef __DRIVER_WEBCAM_H__ 20 #define __DRIVER_WEBCAM_H__ 21 #include "typedef.h" 22 #include "fb.h" 23 24 #define WEBCAM_BUFFER_NUM 6 25 #define WEBCAM_MODE_NUM 8 26 27 typedef struct JPEG_FRAME_INFO_ 28 { 29 void* jpegData; 30 __u32 jpegData_len; 31 32 __s32 pic_width; 33 __s32 pic_height; 34 __u32 format; 35 __u8* y_buf; 36 __u8* c_buf; 37 38 }_jpeg_frame_info; 39 40 typedef enum tag_BUF_SCRAB_MODE_WEBCAM 41 { 42 WEBCAM0_FULL = 0 , //WEBCAM0 on one buffer 43 WEBCAM1_FULL = 1 , //WEBCAM1 on one buffer 44 45 WEBCAM_01_LR = 2 , //WEBCAM0(L) and WEBCAM1(R) with same size and format parallel on one buffer 46 WEBCAM_10_LR = 3 , //WEBCAM1(L) and WEBCAM0(R) with same size and format parallel on one buffer 47 48 WEBCAM_01_UD = 4 , //WEBCAM0(L) and WEBCAM1(R) with same size and format sequential on one buffer 49 WEBCAM_10_UD = 5 , //WEBCAM1(L) and WEBCAM0(R) with same size and format sequential on one buffer 50 51 WEBCAM0_TDM_2CH_2X1 = 6 , //WEBCAM0 TDM CH0/1 with same size and format 52 WEBCAM0_TDM_4CH_2X2 = 7 , //WEBCAM0 TDM CH0/1 + CH2/3 with same size and format 53 54 WEBCAM_SC_NA = 0xff, 55 }__buf_scrab_mode_webcam_t; 56 57 typedef struct tag_WEBCAM_MODE 58 { 59 60 __pixel_yuvfmt_t color_format; //__pixel_yuvfmt_t 61 __u32 component_seq;//__yuv_seq_t + __bayer_seq_t 62 __u32 store_mode; //__yuv_mod_t + __bayer_store_mode_t 63 __rectsz_t size; 64 __u32 frame_rate; //Hz, x1000 65 __u32 frame_period; //us 66 __cs_mode_t color_space; 67 //=========add for WEBCAM0+WEBCAM1 =============== 68 __buf_scrab_mode_webcam_t webcam_buf_scrab_mode; 69 //======================== 70 71 }__webcam_mode_t; 72 73 typedef struct tag_WEBCAM_MODE_ALL 74 { 75 __u32 number; 76 __webcam_mode_t webcam_mode[WEBCAM_MODE_NUM]; 77 }__webcam_mode_all_t; 78 79 80 typedef enum __DRV_WEBCAM_CMD_SET 81 { 82 DRV_WEBCAM_CMD_NONE = 0, 83 DRV_WEBCAM_CMD_INIT, //ret = EPDK_OK/EPDK_FAIL 84 DRV_WEBCAM_CMD_EXIT, //ret = EPDK_OK/EPDK_FAIL 85 DRV_WEBCAM_CMD_SET_MODE, //pbuffer = __csi_mode_t*, ret = EPDK_OK/EPDK_FAIL 86 DRV_WEBCAM_CMD_GET_MODE, //pbuffer = __csi_mode_t*, ret = EPDK_OK/EPDK_FAIL 87 DRV_WEBCAM_CMD_GET_MODE_ALL, //pbuffer = __csi_mode_total_t * 88 DRV_WEBCAM_CMD_CAPTURE_ON, //ret = EPDK_OK/EPDK_FAIL 89 DRV_WEBCAM_CMD_CAPTURE_OFF, //ret = EPDK_OK/EPDK_FAIL 90 DRV_WEBCAM_CMD_REQUEST_FRAME, //pbuffer= (__csi_frame_t**), ret = EPDK_OK/EPDK_FAIL 91 DRV_WEBCAM_CMD_RELEASE_FRAME, //aux = frame_id, ret = EPDK_OK/EPDK_FAIL 92 DRV_WEBCAM_CMD_SET_PTS, //**absence**//aux = pts(__u32) 93 DRV_WEBCAM_CMD_GET_PTS, //**absence**//ret=pts(__u32) 94 DRV_WEBCAM_CMD_SET_PTS_MODE, //**absence**//设置PTS的获取方式,aux = 0:CSI自己算PTS; 1:通过回调函数得到PTS; 2.不需要PTS 95 DRV_WEBCAM_CMD_INSTALL_CALLBACK_GET_PTS, //**absence**//注册回调函数,得到PTS。该callback的原型为CB_GetPTS,参数*arg是__s64*的指针,表示PTS,单位us. *pbuffer = callback 96 DRV_WEBCAM_CMD_SET_FRAME_QUEUE, //设置frame queue.必须在capture_on之前设置。因为capture off会清掉. pbuffer = __csi_frame_queue_t*,主要是设置buffer和frame_id,其他的参数还是由csidrv决定. 97 DRV_WEBCAM_CMD_SET_COLOR_EFFECT, //**absence**//aux = color effet 98 DRV_WEBCAM_CMD_GET_COLOR_EFFECT, //**absence**//ret = color effet 99 DRV_WEBCAM_CMD_SET_AWB, //**absence**//aux = awb 100 DRV_WEBCAM_CMD_GET_AWB, //**absence**//ret = awb 101 DRV_WEBCAM_CMD_SET_AE, //**absence**//aux = ae 102 DRV_WEBCAM_CMD_GET_AE, //**absence**//ret = ae 103 DRV_WEBCAM_CMD_SET_BRIGHT, //**absence**//aux = bright 104 DRV_WEBCAM_CMD_GET_BRIGHT, //**absence**//ret = bright 105 DRV_WEBCAM_CMD_SET_CONTRAST, //**absence**//aux = contrast 106 DRV_WEBCAM_CMD_GET_CONTRAST, //**absence**//ret = contrast 107 DRV_WEBCAM_CMD_SET_BAND, //**absence**//aux = band 108 DRV_WEBCAM_CMD_GET_BAND, //**absence**//ret = band//add 2011-8-3 13:13:13 109 DRV_WEBCAM_CMD_GET_PROGRSSV_INFO, //**absence**//ret = b_progr 110 DRV_WEBCAM_CMD_SET_MASTER_PORT = DRV_WEBCAM_CMD_GET_PROGRSSV_INFO,//**absence** 111 DRV_WEBCAM_CMD_GET_MASTER_PORT, //**absence** 112 113 DRV_WENCAM_CMD_SET_TRANSPORT_CB, 114 DRV_WENCAM_CMD_GET_IRQ_CB, 115 DRV_WENCAM_CMD_WEBCAM_INSERT, 116 DRV_WENCAM_CMD_WEBCAM_MOVED, 117 118 DRV_WEBCAM_CMD_, 119 120 121 }__drv_WEBCAM_cmd_set_t; 122 123 124 typedef struct tag_WEBCAM_FRAME 125 { 126 __s32 frame_id; 127 128 __bool bProgressiveSrc; // Indicating the source is progressive or not 129 __bool bTopFieldFirst; // VPO should check this flag when bProgressiveSrc is FALSE 130 __u16 eAspectRatio; //the source picture aspect ratio 131 __rect_t src_rect; // source valid size, 宏块对齐的图像大小, 一般就是frame buffer了 132 __rect_t dst_rect; // source display size,真实图像的位置大小 133 __u32 addr[3]; // data buffer address 134 135 __u16 color_format; //same with __webcam_mode_t 136 __u32 component_seq;//same with __webcam_mode_t 137 __u32 store_mode; //same with __webcam_mode_t 138 __u16 frame_rate; //same with __webcam_mode_t 139 140 __s64 uPts; //us 141 __s32 bPtsValid; 142 }__webcam_frame_t; 143 144 typedef struct tag_WEBCAM_FRAME_QUEUE 145 { 146 __s32 num; //有效的帧个数,num <= WEBCAM_BUFFER_NUM 147 __webcam_frame_t webcam_frame_array[WEBCAM_BUFFER_NUM]; 148 } __webcam_frame_queue_t; 149 150 151 152 153 typedef enum __DRV_WEBCAM_STATUS 154 { 155 WEBCAM_STATUS_NONE = 0, 156 WEBCAM_STATUS_CAPTURE_ON, 157 WEBCAM_STATUS_CAPTURE_OFF 158 159 }__drv_webcam_status_t; 160 161 162 163 164 typedef __s32 (* transport_cb_t )(__u32 addr0, __u32 addr1, __u32 addr2); 165 typedef __s32 (* uvc_irq_t)(__u32* addr0, __u32* addr1, __u32* addr2 ); 166 167 168 169 170 171 172 173 174 175 #endif // __DRIVER_WEBCAM_H__ 176