文件名称:
r40_tinav2.1_最终验证通过_使用CB-S来验证OV5640有横条纹fpscamera+SPI2.0成功_20171114_1443没有外层目录.7z
开发工具:
文件大小: 198kb
下载次数: 0
上传时间: 2017-11-14
详细说明: r40_tinav2.1_最终验证通过_使用CB-S来验证OV5640有横条纹fpscamera+SPI2.0成功_20171114_1443没有外层目录.7z 开发板:CB-S 1、(可选修改/调试技巧:) 除了ov5640.c之外,其它的驱动都不编译,节省编译时间! W:\ov5640_spi20_r40t\lichee\linux-3.10\drivers\media\platform\sunxi-vfe\device\Makefile obj-m += ov5640.o #obj-m += ov 2640.o #obj-m += ov7736.o #obj-m += s5k4ec.o #obj-m += s5k4ec_mipi.o #obj-m += gc2035.o #obj-m += gt2005.o #obj-m += gc0307.o #obj-m += gc0308.o #obj-m += gc0328.o #obj-m += gc0328c.o #obj-m += gc2145.o #obj-m += gc0329.o #obj-m += gc0311.o #obj-m += hi253.o #obj-m += sp2518.o #obj-m += sp2519.o #obj-m += sp0718.o #obj-m += sp0838.o #obj-m += ov16825.o #obj-m += ov5650.o #obj-m += ov5647.o #obj-m += ov5647_mipi.o #obj-m += t8et5.o #obj-m += s5k4e1.o #obj-m += s5k4e1_mipi.o #obj-m += sp2518.o #obj-m += sp0718.o #obj-m += gc5004.o #obj-m += gc5004_mipi.o #obj-m += ov5648.o #obj-m += ar0330.o #obj-m += ov5648.o #obj-m += sp5408.o #obj-m += ov12830.o #obj-m += ov8825.o #obj-m += ov8850.o #obj-m += gc2155.o #obj-m += ov8858.o #obj-m += ov13850.o #obj-m += imx214.o #obj-m += ov8858_4lane.o #obj-m += sp5409.o #obj-m += s5k5e2yx.o #obj-m += ov2710_mipi.o #obj-m += ov2686.o (这里是看ov5640的驱动的probe执行是否正确?设备ID是否读取成功!) W:\ov5640_spi20_r40t\lichee\linux-3.10\drivers\media\platform\sunxi-vfe\device\ov5640.c static int sensor_detect(struct v4l2_subdev *sd) { data_type rdval; printk("****wyb %s:%d/%s()! \n", __FILE__, __LINE__, __func__); LOG_ERR_RET(sensor_read(sd, 0x300a, &rdval;)) printk("****wyb %s:%d/%s()! 0x300a rdval=0xx\n", __FILE__, __LINE__, __func__, rdval); if(rdval != 0x56) return -ENODEV; LOG_ERR_RET(sensor_read(sd, 0x300b, &rdval;)) printk("****wyb %s:%d/%s()! 0x300b rdval=0xx\n", __FILE__, __LINE__, __func__, rdval); if(rdval != 0x40) return -ENODEV; return 0; } (在全志R16平台改过这个文件,让摄像头不要休眠,但是全志R40平台的tina v2.1系统下不需要修改!) W:\ov5640_spi20_r40t\lichee\linux-3.10\drivers\media\platform\sunxi-vfe\vfe.c 2、(可选修改/根据和全志R16平台的tina v1.0的系统下的SDK对照发现的问题。全志R16的最新的tina v2.1大幅度修改cameratest的源代码了!) W:\ov5640_spi20_r40t\package\allwinner\cameratest\src\common\hawkview.c int fetch_sub_cmd(const char* buf,int buf_len,char** cmd,int* cmd_num,int lenght) { int i = 0,j = 0,n = 0; while(buf[i] != '#'){ //the sub cmd end by '#' while(buf[i] != 'x' && buf[i] != ':' && buf[i] != '#') { if(i++ > buf_len) return 0; *((char*)cmd + n*lenght + j++) = buf[i]; if(j > lenght) { hv_err("sub cmd over long\n"); *cmd_num = n + 1; return -1; } } *((char*)cmd + n*lenght + j++) = '\0'; n++; j = 0; if(buf[i] != '#'){ i++; } if(n > *cmd_num){ hv_err("the max cmd num is %d\n",*cmd_num); return -1; } } *cmd_num = n; return 0; } 修改为: int fetch_sub_cmd(const char* buf,int buf_len,char** cmd,int* cmd_num,int lenght) { int i = 0,j = 0,n = 0; while(buf[i] != '#'){ //the sub cmd end by '#' while(buf[i] != 'x' && buf[i] != ':' && buf[i] != '#') { if((i+1) > buf_len) return 0; *((char*)cmd + n*lenght + j++) = buf[i++]; if(j > lenght) { hv_err("sub cmd over long\n"); *cmd_num = n + 1; return -1; } } *((char*)cmd + n*lenght + j++) = '\0'; n++; j = 0; if(buf[i] != '#'){ i++; } if(n > *cmd_num){ hv_err("the max cmd num is %d\n",*cmd_num); return -1; } } *cmd_num = n; return 0; } W:\ov5640_spi20_r40t\package\allwinner\cameratest\src\common\video.c static int capture_frame(void* capture,int (*set_disp_addr)(int,int,unsigned int*),pthread_mutex_t* mutex) { capture_handle* cap = (capture_handle*)capture; int ret; int i; struct v4l2_buffer buf; enum v4l2_buf_type type; fd_set fds; struct timeval tv; pthread_mutex_lock(mutex); //used for cammand and status debug if (old_vi_cmd != cap->cmd){ hv_dbg("capture frame command %d --> %d\n",old_vi_cmd,cap->cmd); old_vi_cmd = (int)cap->cmd; } if(old_status != cap->status){ hv_dbg("capture frame status %d --> %d\n",old_status,cap->status); old_status = cap->status; } if(cap->status == OFF && cap->cmd == START_STREAMMING){ hv_dbg("capture start streaming\n"); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(videofh, VIDIOC_STREAMON, &type;) == -1) { hv_err("VIDIOC_STREAMON error! %s\n",strerror(errno)); goto quit; } cap->status = ON; cap->cmd = COMMAND_UNUSED; pthread_mutex_unlock(mutex); return 0; } if(cap->status == ON && cap->cmd == STOP_STREAMMING){ hv_dbg("capture stop streaming\n"); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if(-1 == ioctl(videofh, VIDIOC_STREAMOFF, &type;)){ hv_err("VIDIOC_STREAMOFF error! %s\n",strerror(errno)); goto quit; } cap->status = OFF; cap->cmd = COMMAND_UNUSED; capture_quit(capture); pthread_mutex_unlock(mutex); return 2; } if(cap->status == OFF) { pthread_mutex_unlock(mutex); return 0; } FD_ZERO(&fds;); FD_SET(videofh, &fds;); tv.tv_sec = 2; tv.tv_usec = 0; pthread_mutex_unlock(mutex); ret = select(videofh + 1, &fds;, NULL, NULL, &tv;); pthread_mutex_lock(mutex); //hv_dbg("select video ret: %d\n",ret); if (ret == -1) { if (errno == EINTR) { return 0; } hv_err("select error\n"); goto stream_off; } else if (ret == 0) { hv_err("select timeout\n"); pthread_mutex_unlock(mutex); return 0; } memset(&buf;, 0, sizeof(struct v4l2_buffer)); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; ret = ioctl(videofh, VIDIOC_DQBUF, &buf;); if (ret == -1) { hv_err("VIDIOC_DQBUF failed!\n"); goto stream_off; } float framerate; framerate = get_framerate((long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec)); if(framerate > 1.0){ cap->cap_fps = framerate; //hv_dbg("framerate: %0.2ffps\n",cap->cap_fps); } //sync capture info perp x second #define M_SECOND 200 if(is_x_msec(M_SECOND,(long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec))){ getExifInfo(&(cap->frame.exif)); // set_cap_info((void*)cap); } if(cap->cmd == STOP_SAVE_FRAME && cap->save_status == ON) cap->save_status = OFF; //save frame , the frame will be get by PC Tool to preview on PC screen //frame format: /dev/frame_x (x:0~21) if(cap->cmd == SAVE_FRAME || cap->save_status == ON ) { if(cap->cmd == SAVE_FRAME){ cap->save_status = ON; cap->cmd = COMMAND_UNUSED; } ret = do_save_frame(capture,buf.index); } //take yuv image,it will save the target frame exif info in the same time //image name: xxxx (set by usered through command) //exif info name: xxxx.exif if(cap->cmd == SAVE_IMAGE ) { ret = 0;//getExifInfo(&(cap->picture.exif)); //get target frame exif info successfully then save the target image //if get the exif info fail,it will try next frame if(ret == 0){ buffers[buf.index].phy_addr = buf.m.offset - 0x20000000; hv_dbg("index: %d buffers[buf.index].start = %p\n",buf.index,buffers[buf.index].start); //do_save_image(capture,buf.index); do_save_sub_image(capture,buf.index); cap->cmd = COMMAND_UNUSED; } } //get display addr int w,h; unsigned int addr; get_disp_addr(capture, buf.m.offset,&addr;,&w,&h); // set disp buffer if (set_disp_addr){ set_disp_addr(w,h,&addr;); } ret = ioctl(videofh, VIDIOC_QBUF, &buf;); if (ret == -1) { hv_err("VIDIOC_DQBUF failed!\n"); goto stream_off; } pthread_mutex_unlock(mutex); return 0; stream_off: hv_err("err stream off\n"); ioctl(videofh, VIDIOC_STREAMOFF, &type;); quit: capture_quit(capture); pthread_mutex_unlock(mutex); return -1; } W:\ov5640_spi20_r40t\package\allwinner\cameratest\src\common\video_helper.c int set_cap_info(void* capture) { char info[500]; char exif[500]; char file_path[20]; capture_handle* cap = (capture_handle*)capture; memset(info,0,sizeof(info)); //strcpy(file_path, "dev/info"); sprintf(file_path, "%s/%s.info", PATH, cap->picture.path_name); //sync string: sensor_type:save_status:framrate:capture_w:capture_h,sub_w,sub_h# sprintf(info, \ "sensor_type = %s\n" \ "status = %d\n" \ "framerate = %0.2f\n" \ "subchanel_width = %d\n" \ "subchanel_height = %d\n" \ "rotation = %d\n\n", \ (cap->sensor_type == 1)?"raw":"yuv", \ cap->save_status, \ cap->cap_fps, \ cap->sub_w, \ cap->sub_h, \ cap->sub_rot); make_exif_info(exif,"none",&(cap->frame.exif),cap->cap_w,cap->cap_h); strcat(info,exif); //hv_dbg("info str:\n%s\n",info); return write_file(file_path,info,sizeof(info)); } int do_save_sub_image(void* capture,int buf_index) { int ret; char image_name[30]; capture_handle* cap = (capture_handle*)capture; memset(image_name,0,sizeof(image_name)); sprintf(image_name,"%s/%s", PATH,cap->picture.path_name); hv_dbg("image_name: %s\n",image_name); set_cap_info(capture); set_exif_info(capture); hv_dbg("--------set_exif_info end\n"); void* vir_sub_start = NULL; unsigned int phy_sub_start = 0; int w,h; if(cap->sensor_type == V4L2_SENSOR_TYPE_RAW){ vir_sub_start = (unsigned int)(buffers[buf_index].start) + ALIGN_4K(ALIGN_16B(cap->cap_w) * cap->cap_h * 3 >> 1); phy_sub_start = buffers[buf_index].phy_addr + ALIGN_4K(ALIGN_16B(cap->cap_w) * cap->cap_h * 3 >> 1); w = cap->sub_w; h = cap->sub_h; } else { vir_sub_start = buffers[buf_index].start; phy_sub_start = buffers[buf_index].phy_addr; w = cap->cap_w; h = cap->cap_h; } #ifdef ANDROID_ENV ret = save_jpeg_frame(image_name,phy_sub_start,w,h); //sprintf(image_name,"/data/camera/yuv%s", cap->picture.path_name); //ret = save_jpeg_frame_by_viraddr(image_name,(void*)vir_sub_start,cap->sub_w,cap->sub_h); #else sprintf(image_name,"%s/yuv%s", PATH,cap->picture.path_name); ret = save_frame_to_file(image_name, \ (void*)(vir_sub_start), \ w,h,cap->cap_fmt, \ 1); #endif if(ret == -1) hv_err("save image failed!\n"); return 0; } 3、修改ov5640的供电(强制供电),但是这样(简单粗暴的)修改肯定会影响其它模块(以太网卡找不到了^_)! W:\ov5640_spi20_r40t\target\allwinner\azalea-m2ultra\configs\sys_config.fex ;---------------------------------------------------------------------------------- ; ; 各路电压输出语法说明: ; ; 电压名称 = 100XXXX : 表示把该路电压设置为XXXX指定的电压值,同时打开输出开关 ; 电压名称 = 000XXXX : 表示把该路电压设置为XXXX指定的电压值,同时关闭输出开关,当有需要时由内核驱动打开 ; 电压名称 = 0 : 表示关闭该路电压输出开关,不修改原有的值 ; ;---------------------------------------------------------------------------------- [power_sply] dcdc1_vol = 1003300 dcdc2_vol = 1001160 dcdc3_vol = 1001100 dcdc4_vol = 1100 aldo1_vol = 2800 aldo2_vol = 2500 aldo3_vol = 1003000 dc1sw_vol = 3300 dc5ldo_vol = 1100 dldo1_vol = 3300 dldo2_vol = 3300 dldo3_vol = 3300 dldo4_vol = 2500 ;eldo1_vol = 2800 eldo1_vol = 1002800 ;eldo2_vol = 1500 eldo2_vol = 1001500 ;eldo3_vol = 1200 eldo3_vol = 1002800 gpio0_vol = 3300 gpio1_vol = 1800 [twi4] twi4_used = 1 twi4_scl = port:PI02<3> twi4_sda = port:PI03<3> ;-------------------------------------------------------------------------------- ;csi (COMS Sensor Interface) configuration ;csi(x)_dev(x)_used: 0:disable 1:enable ;csi(x)_dev(x)_isp_used 0:not use isp 1:use isp ;csi(x)_dev(x)_fmt: 0:yuv 1:bayer raw rgb ;csi(x)_dev(x)_stby_mode: 0:not shut down power at standby 1:shut down power at standby ;csi(x)_dev(x)_vflip: flip in vertical direction 0:disable 1:enable ;csi(x)_dev(x)_hflip: flip in horizontal direction 0:disable 1:enable ;csi(x)_dev(x)_iovdd: camera module io power handle string, pmu power supply ;csi(x)_dev(x)_iovdd_vol: camera module io power voltage, pmu power supply ;csi(x)_dev(x)_avdd: camera module analog power handle string, pmu power supply ;csi(x)_dev(x)_avdd_vol: camera module analog power voltage, pmu power supply ;csi(x)_dev(x)_dvdd: camera module core power handle string, pmu power supply ;csi(x)_dev(x)_dvdd_vol: camera module core power voltage, pmu power supply ;csi(x)_dev(x)_afvdd: camera module vcm power handle string, pmu power supply ;csi(x)_dev(x)_afvdd_vol: camera module vcm power voltage, pmu power supply ;fill voltage in uV, e.g. iovdd = 2.8V, csix_iovdd_vol = 2800000 ;fill handle string as below: ;axp22_eldo3 ;axp22_dldo4 ;axp22_eldo2 ;fill handle string "" when not using any pmu power supply ;-------------------------------------------------------------------------------- [csi0] csi0_used = 1 csi0_sensor_list = 0 csi0_pck = port:PE00<3> csi0_mck = port:PE01<1><0><1><0> csi0_hsync = port:PE02<3> csi0_vsync = port:PE03<3> csi0_d0 = port:PE04<3> csi0_d1 = port:PE05<3> csi0_d2 = port:PE06<3> csi0_d3 = port:PE07<3> csi0_d4 = port:PE08<3> csi0_d5 = port:PE09<3> csi0_d6 = port:PE10<3> csi0_d7 = port:PE11<3> [csi0/csi0_dev0] csi0_dev0_used = 1 csi0_dev0_mname = "ov5640" csi0_dev0_twi_addr = 0x78 csi0_dev0_twi_id = 4 csi0_dev0_pos = "rear" csi0_dev0_isp_used = 0 csi0_dev0_fmt = 0 csi0_dev0_stby_mode = 0 csi0_dev0_vflip = 0 csi0_dev0_hflip = 0 ;csi0_dev0_iovdd = "csi-iovcc" csi0_dev0_iovdd = "" csi0_dev0_iovdd_vol = 2800000 ;csi0_dev0_avdd = "csi-avdd" csi0_dev0_avdd = "" csi0_dev0_avdd_vol = 2800000 ;csi0_dev0_dvdd = "csi-dvdd" csi0_dev0_dvdd = "" csi0_dev0_dvdd_vol = 1500000 ;csi0_dev0_afvdd = "csi-afvcc" csi0_dev0_afvdd = "" csi0_dev0_afvdd_vol = 2800000 csi0_dev0_power_en = csi0_dev0_reset = port:PI07<1><0><1><0> csi0_dev0_pwdn = port:PI06<1><0><1><0> csi0_dev0_flash_used = 0 csi0_dev0_flash_type = 2 csi0_dev0_flash_en = csi0_dev0_flash_mode = csi0_dev0_flvdd = "" csi0_dev0_flvdd_vol = csi0_dev0_af_pwdn = csi0_dev0_act_used = 0 csi0_dev0_act_name = "ad5820_act" csi0_dev0_act_slave = 0x18 [csi1] csi1_used = 0 csi1_sensor_list = 0 csi1_pck = port:PG00<3> csi1_mck = port:PG01<1><0><1><0> csi1_hsync = port:PG02<3> csi1_vsync = port:PG03<3> csi1_d0 = port:PG04<3> csi1_d1 = port:PG05<3> csi1_d2 = port:PG06<3> csi1_d3 = port:PG07<3> csi1_d4 = port:PG08<3> csi1_d5 = port:PG09<3> csi1_d6 = port:PG10<3> csi1_d7 = port:PG11<3> [csi1/csi1_dev0] csi1_dev0_used = 0 csi1_dev0_mname = "ov5640" csi1_dev0_twi_addr = 0x78 csi1_dev0_twi_id = 1 csi1_dev0_pos = "rear" csi1_dev0_isp_used = 0 csi1_dev0_fmt = 0 csi1_dev0_stby_mode = 0 csi1_dev0_vflip = 0 csi1_dev0_hflip = 0 csi1_dev0_iovdd = "" csi1_dev0_iovdd_vol = 2800000 csi1_dev0_avdd = "" csi1_dev0_avdd_vol = 2800000 csi1_dev0_dvdd = "" csi1_dev0_dvdd_vol = 1500000 csi1_dev0_afvdd = "" csi1_dev0_afvdd_vol = 2800000 csi1_dev0_power_en = csi1_dev0_reset = port:PH14<1><0><1><0> csi1_dev0_pwdn = port:PH17<1><0><1><0> csi1_dev0_flash_used = 0 csi1_dev0_flash_type = 2 csi1_dev0_flash_en = csi1_dev0_flash_mode = csi1_dev0_flvdd = "" csi1_dev0_flvdd_vol = csi1_dev0_af_pwdn = csi1_dev0_act_used = 0 csi1_dev0_act_name = "ad5820_act" csi1_dev0_act_slave = 0x18 ;-------------------------------------------------------------------------------------------------------- ;compatible ---regulator0 name, support:axp221s-regulator ;regulator_count ---pmu ldo count, changed with different pmu ;regulator(1~regulator_count) ---ldo details ;-------------------------------------------------------------------------------------------------------- [regulator0] compatible = "axp221s-regulator" regulator_count = 20 regulator1 = "axp221s_dcdc1 none vcc-hdmi vcc-io vcc-dsi vcc-usb vdd-efuse vcc-hp vcc-audio vcc-emmc vcc-card vcc-pc vcc-pd vcc-3v vcc-tvout vcc-tvin vcc-emmcv vcc-sdcv vcc-sdcvq33 vcc-sdcvd vcc-nand vcc-sdcv-p3 vcc-sdcvq33-p3 vcc-sdcvd-p3" regulator2 = "axp221s_dcdc2 none vdd-cpua" regulator3 = "axp221s_dcdc3 none vdd-sys vdd-gpu" regulator4 = "axp221s_dcdc4 none" regulator5 = "axp221s_dcdc5 none vcc-dram" regulator6 = "axp221s_rtc none vcc-rtc" regulator7 = "axp221s_aldo1 none vcc-25 csi-avdd" regulator8 = "axp221s_aldo2 none vcc-ephy0" regulator9 = "axp221s_aldo3 none avcc vcc-pll" regulator10 = "axp221s_dldo1 none vcc-io-wifi vcc-pg " regulator11 = "axp221s_dldo2 none vcc-wifi1" regulator12 = "axp221s_dldo3 none vcc-wifi2" regulator13 = "axp221s_dldo4 none vdd-sata-25 vcc-pf" regulator14 = "axp221s_eldo1 none vcc-pe csi-iovcc csi-afvcc" regulator15 = "axp221s_eldo2 none csi-dvdd" regulator16 = "axp221s_eldo3 none vdd-sata-12" regulator17 = "axp221s_ldoio0 none vcc-ctp" regulator18 = "axp221s_ldoio1 none vcc-i2s-18" regulator19 = "axp221s_dc1sw none ephy0-dvdd" regulator20 = "axp221s_dc5ldo none" (电源设备树的修改) ;-------------------------------------------------------------------------------------------------------- ;compatible ---regulator0 name, support:axp221s-regulator ;regulator_count ---pmu ldo count, changed with different pmu ;regulator(1~regulator_count) ---ldo details ;-------------------------------------------------------------------------------------------------------- [regulator0] compatible = "axp221s-regulator" regulator_count = 20 regulator1 = "axp221s_dcdc1 none vcc-hdmi vcc-io vcc-dsi vcc-usb vdd-efuse vcc-hp vcc-audio vcc-emmc vcc-card vcc-pc vcc-pd vcc-3v vcc-tvout vcc-tvin vcc-emmcv vcc-sdcv vcc-sdcvq33 vcc-sdcvd vcc-nand vcc-sdcv-p3 vcc-sdcvq33-p3 vcc-sdcvd-p3" regulator2 = "axp221s_dcdc2 none vdd-cpua" regulator3 = "axp221s_dcdc3 none vdd-sys vdd-gpu" regulator4 = "axp221s_dcdc4 none" regulator5 = "axp221s_dcdc5 none vcc-dram" regulator6 = "axp221s_rtc none vcc-rtc" regulator7 = "axp221s_aldo1 none" regulator8 = "axp221s_aldo2 none vcc-ephy0" regulator9 = "axp221s_aldo3 none avcc vcc-pll" regulator10 = "axp221s_dldo1 none vcc-io-wifi vcc-pg " regulator11 = "axp221s_dldo2 none vcc-wifi1" regulator12 = "axp221s_dldo3 none vcc-wifi2" regulator13 = "axp221s_dldo4 none vdd-sata-25 vcc-pf" regulator14 = "axp221s_eldo1 none" regulator15 = "axp221s_eldo2 none" regulator16 = "axp221s_eldo3 none" regulator17 = "axp221s_ldoio0 none vcc-ctp" regulator18 = "axp221s_ldoio1 none vcc-i2s-18" regulator19 = "axp221s_dc1sw none ephy0-dvdd" regulator20 = "axp221s_dc5ldo none" 4、(为了调试方便,可选修改:) W:\ov5640_spi20_r40t\target\allwinner\generic\configs\env-3.10.cfg #kernel command arguments enforcing=1 earlyprintk=sunxi-uart,0x01c28000 initcall_debug=0 console=ttyS0,115200 nor_root=/dev/mtdblock4 nand_root=/dev/nandd mmc_root=/dev/mmcblk0p7 init=/sbin/init loglevel=8 cma=256M #set kernel cmdline if boot.img or recovery.img has no cmdline we will use this setargs_nor=setenv bootargs enforcing=${enforcing} earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} root=${nor_root} rootwait init=${init} partitions=${partitions} cma=${cma} setargs_nand=setenv bootargs enforcing=${enforcing} earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} root=${nand_root} rootwait init=${init} partitions=${partitions} cma=${cma} setargs_mmc=setenv bootargs enforcing=${enforcing} earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} root=${mmc_root} rootwait init=${init} partitions=${partitions} cma=${cma} boot_normal=fatload sunxi_flash boot 43800000 uImage;bootm 43800000 boot_recovery=fatload sunxi_flash recovery 43800000 uImage;bootm 43800000 boot_fastboot=fastboot #recovery key recovery_key_value_max=0x13 recovery_key_value_min=0x10 #fastboot key fastboot_key_value_max=0x8 fastboot_key_value_min=0x2 #uboot system env config bootdelay=3 #default bootcmd, will change at runtime according to key press bootcmd=run setargs_nand boot_normal#default nand boot 5、打开摄像头的抓图程序cameratest: rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ ll 总用量 96 drwxrwxr-x 4 rootroot rootroot 4096 1月 12 2017 build drwxrwxr-x 3 rootroot rootroot 4096 1月 12 2017 config -r--r--r-- 1 rootroot rootroot 609 1月 12 2017 Config.in drwxrwxr-x 3 rootroot rootroot 24576 1月 12 2017 dl drwxrwxr-x 3 rootroot rootroot 4096 1月 12 2017 docs drwxrwxr-x 4 rootroot rootroot 4096 11月 13 20:57 lichee -r--r--r-- 1 rootroot rootroot 82 1月 12 2017 Makefile drwxrwxr-x 4 rootroot rootroot 4096 11月 14 10:02 out drwxrwxr-x 19 rootroot rootroot 4096 10月 20 20:47 package drwxrwxr-x 4 rootroot rootroot 4096 1月 12 2017 prebuilt -r--r--r-- 1 rootroot rootroot 13360 1月 12 2017 rules.mk drwxrwxr-x 6 rootroot rootroot 4096 1月 12 2017 scripts drwxrwxr-x 7 rootroot rootroot 4096 10月 18 15:53 target drwxrwxr-x 3 rootroot rootroot 4096 11月 14 15:00 tmp drwxrwxr-x 12 rootroot rootroot 4096 1月 12 2017 toolchain drwxrwxr-x 60 rootroot rootroot 4096 1月 12 2017 tools rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ source build/envsetup.sh including target/allwinner/azalea-m2ultra/vendorsetup.sh including target/allwinner/azalea-perf1/vendorsetup.sh including target/allwinner/octopus-dev/vendorsetup.sh including target/allwinner/azalea-evb/vendorsetup.sh including target/allwinner/azalea-perf3/vendorsetup.sh including target/allwinner/octopus-sch/vendorsetup.sh including target/allwinner/nuclear-dev/vendorsetup.sh including target/allwinner/astar-spk/vendorsetup.sh including target/allwinner/tulip-d1/vendorsetup.sh including target/allwinner/azalea-m2ultraservers/vendorsetup.sh including target/allwinner/generic/vendorsetup.sh including target/allwinner/astar-evb/vendorsetup.sh including target/allwinner/astar-parrot/vendorsetup.sh including target/allwinner/azalea-perf2/vendorsetup.sh rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ lunch You're building on Linux Lunch menu... pick a combo: 1. azalea_m2ultra-tina 2. azalea_m2ultra-dragonboard 3. azalea_perf1-tina 4. azalea_perf1-dragonboard 5. octopus_dev-tina 6. octopus_dev-dragonboard 7. azalea_evb-tina 8. azalea_evb-dragonboard 9. azalea_perf3-tina 10. azalea_perf3-dragonboard 11. octopus_sch-tina 12. octopus_sch-dragonboard 13. nuclear_dev-tina 14. nuclear_dev-dragonboard 15. astar_spk-tina 16. astar_spk-dragonboard 17. tulip_d1-tina 18. tulip_d1-dragonboard 19. azalea_m2ultraservers-tina 20. azalea_m2ultraservers-dragonboard 21. astar_evb-tina 22. astar_parrot-tina 23. astar_parrot-dragonboard 24. azalea_perf2-tina 25. azalea_perf2-dragonboard Which would you like?1 ============================================ PLATFORM_VERSION_CODENAME=Neptune PLATFORM_VERSION=2.1.1 PRODUCT_VERSION=v1.0 TARGET_PRODUCT=azalea_m2ultra TARGET_BUILD_VARIANT=tina TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a7 TARGET_2ND_ARCH= TARGET_2ND_ARCH_VARIANT= TARGET_2ND_CPU_VARIANT= HOST_ARCH=x86_64 HOST_OS=linux HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty HOST_BUILD_TYPE=release BUILD_ID=5861D22E TARGET_OUT_DIR=out/azalea-m2ultra ============================================ rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ make menuconfig Allwinner ---> < > cameratest.............................. camerateset just test the camera 修改为: <*> cameratest.............................. camerateset just test the camera 6、通过cameratest获取NV12格式的YUV图片: rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ make -j12 rootroot@cm-System-Product-Name:/home/rediron/r40_tinav2.1/spi20_r40_tinav2.1$ pack 打包刷机之后: [ 43.941698] sunxi-mmc sdc1: smc 2 p1 err, cmd 55, RTO !! [ 43.942520] sunxi-mmc sdc1: smc 2 p1 err, cmd 55, RTO !! [ 43.942537] sunxi-mmc sdc1: sdc set ios: clk 400000Hz bm OD pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B [ 43.943388] sunxi-mmc sdc1: smc 2 p1 err, cmd 1, RTO !! [ 43.943405] sunxi-mmc sdc1: sdc set ios: clk 0Hz bm OD pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B [ 44.046319] dhd_module_init: Failed to load driver max retry reached** [ 44.053573] dhd_module_init: Exit err=-19 BusyBox v1.24.1 () built-in shell (ash) _____ _ __ _ |_ _||_| ___ _ _ | | |_| ___ _ _ _ _ | | _ | || | | |__ | || || | ||_'_| | | | || | || _ | |_____||_||_|_||___||_,_| |_| |_||_|_||_|_| Tina is Based on OpenWrt! ---------------------------------------------- Tina Linux (Neptune, 5861D22E) ---------------------------------------------- root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# lsmod crc_ccitt 1003 1 ppp_async disp 1024221 1 mali ft5x_ts 56095 0 fuse 59395 0 mali 146657 0 ov5640 23837 0 ppp_async 6125 0 snd_mixer_oss 11447 1 snd_pcm_oss snd_pcm_oss 32590 0 snd_rawmidi 15038 0 snd_seq_device 4206 1 snd_rawmidi uvcvideo 55997 0 vfe_io 24990 3 vfe_v4l2 vfe_v4l2 170636 0 videobuf2_core 20745 2 uvcvideo videobuf2_dma_contig 7462 1 vfe_v4l2 videobuf2_memops 1167 2 videobuf2_vmalloc videobuf2_vmalloc 2260 1 uvcvideo root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# cd /dev root@TinaLinux:/dev# root@TinaLinux:/dev# ll v* crw-r--r-- 1 root root 7, 0 Jan 1 18:38 vcs crw-r--r-- 1 root root 7, 1 Jan 1 18:38 vcs1 crw-r--r-- 1 root root 7, 128 Jan 1 18:38 vcsa crw-r--r-- 1 root root 7, 129 Jan 1 18:38 vcsa1 crw-r--r-- 1 root root 10, 60 Jan 1 18:38 vhci crw-r--r-- 1 root root 81, 0 Jan 1 18:38 video0 root@TinaLinux:/dev# root@TinaLinux:/dev# root@TinaLinux:/dev# cd /bin root@TinaLinux:/bin# root@TinaLinux:/bin# ll c* -rwxr-xr-x 1 root root 16415 Nov 14 2017 cameratest lrwxrwxrwx 1 root root 7 Nov 14 2017 cat -> busybox lrwxrwxrwx 1 root root 7 Nov 14 2017 chgrp -> busybox lrwxrwxrwx 1 root root 7 Nov 14 2017 chmod -> busybox lrwxrwxrwx 1 root root 7 Nov 14 2017 chown -> busybox -rwxrwxr-x 1 root root 7486 Nov 14 2017 config_generate lrwxrwxrwx 1 root root 7 Nov 14 2017 cp -> busybox root@TinaLinux:/bin# root@TinaLinux:/bin# root@TinaLinux:/bin# root@TinaLinux:/bin# cameratest [hawkview_dbg]hawkview_init set_w 1280 [hawkview_msg]----sunxi9iw1p1 capture register sucessfully! [hawkview_dbg]hawkview_init 2 [hawkview_dbg]video pthread_create ret:0 [hawkview_dbg]command pthread_create ret:0 [hawkview_dbg]video thread status 0 --> 101 (在WIN7下通过ADB执行:echo "146:0:1:640x480#" > command) [hawkview_dbg]read cmd [ 367.874915] [VFE]vfe_open 146:0:1:640x480# [hawkview_db[ 367.879364] [VFE]vfe_runtime_resume g]cmd 0: 146 [hawkview_dbg]cmd 1: 0 [hawkview_dbg]cmd 2: 1 [hawkview_dbg]cmd 3: 640 [hawkview_dbg]cmd 4: 480 [hawkview_dbg]send command 146 [hawkview_dbg]video thread cmd: 0 --> 146 [ha[ 367.901274] [VFE]..........................vfe clk open!....................... wkview_dbg]reset video capture [ 367.911823] [VFE]vfe_open ok [hawkview_msg]----open /dev/video0 [hawkview_err]xxxxquery sensor type ctrl failed[hawkview_msg]----get sensor type: 0 [ 368.919222] [VFE_ERR]set input i(1)>dev_qty(1)-1 error! [hawkview_err]xxxxVIDIOC_S_INPUT[ 368.925295] [VFE]Set csi core clk = 324000000, after Set csi core clk = 300000000 failed! s_input: 1 [ 368.949874] [VFE]mclk on [ 369.020884] ****wyb drivers/media/platform/sunxi-vfe/device/ov5640.c:3803/sensor_detect()! [ 369.032713] ****wyb drivers/media/platform/sunxi-vfe/device/ov5640.c:3806/sensor_detect()! 0x300a rdval=0x56 [ 369.045569] ****wyb drivers/media/platform/sunxi-vfe/device/ov5640.c:3812/sensor_detect()! 0x300b rdval=0x40 [ 369.460120] [OV5640]s_fmt set width = 640, height = 480 [ 369.466695] csi->frame_info.frm_byte_size = 460800 [hawkview_msg]----the tried size[ 369.477629] [VFE]queue_setup, buffer count=10, size=460800 is 640x480,the supported size is 640x480! [ 369.487826] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.496813] ion_alloc carveout failed!! [ 369.509617] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.518294] ion_alloc carveout failed!! [ 369.523098] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.531666] ion_alloc carveout failed!! [ 369.544202] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.552807] ion_alloc carveout failed!! [ 369.558855] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.567497] ion_alloc carveout failed!! [ 369.579848] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.588538] ion_alloc carveout failed!! [ 369.594150] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.602709] ion_alloc carveout failed!! [ 369.613211] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.621806] ion_alloc carveout failed!! [ 369.627830] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.636467] ion_alloc carveout failed!! [ 369.645614] cameratest-4367 ion_alloc:522 buffer alloc fail ! heap id 4, len 462848 [ 369.654229] ion_alloc carveout failed!! [hawkview_dbg]map buffer index: 0, mem: b6e2a000, len: 70800, offset: 0 [hawkview_dbg]map buffer index: 1, mem: b6db9000, len: 70800, offset: 71000 [hawkview_dbg]map buffer index: 2, mem: b6d48000, len: 70800, offset: e2000 [hawkview_dbg]map buffer index: 3, mem: b6cd7000, len: 70800, offset: 153000 [hawkview_dbg]map buffer index: 4, mem: b6c66000, len: 70800, offset: 1c4000 [hawkview_dbg]map buffer index: 5, mem: b6bf5000, len: 70800, offset: 235000 [hawkview_dbg]map buffer index: 6, mem: b6b84000, len: 70800, offset: 2a6000 [hawkview_dbg]map buffer index: 7, me[ 369.707805] [VFE]capture video mode! m: b6b13000, len: 70800, offset: 317000 [hawkview_dbg]map buffer index: 8, mem: b6aa2000, len: 70800, offset: 388000 [hawkview_dbg]map buffer index: 9, mem: b6a31000, len: 70800, offset: 3f9000 [hawkview_dbg]video thread status 101 --> 102 [hawkview_dbg]capture frame command -1 --> 161 [hawkview_dbg]capture frame [ 369.741120] [VFE]capture video first frame done! status -1 --> 0 [hawkview_dbg]capture start streaming [hawkview_dbg]capture frame command 161 --> 0 [hawkview_dbg]capture frame status 0 --> 1 (在WIN7下通过ADB执行:echo "149:test1013.yuv#" > command) [hawkview_dbg]read cmd 149:test1013.yuv# [hawkview_dbg]cmd 0: 149 [hawkview_dbg]cmd 1: test1013.yuv [hawkview_dbg]send command 149 [hawkview_dbg]index: 9 buffers[buf.index].start = 0xb6a31000 [hawkview_dbg]image_name: /tmp/test1013.yuv [hawkview_err]xxxxOpen sync file error[hawkview_dbg]image exif info: image_name = test1013.yuv width = 640 height = 480 exp_time_num = 0 exp_time_den = 0 sht_speed_num = 0 sht_speed_den = 0 fnumber = 0 exp_bias = 0 foc_length = 0 iso_speed = 0 flash_fire = 0 brightness = 0 # [hawkview_dbg]--------set_exif_info end (由于cameratest不能自行退出,只能按ctrl+C强制退出!) ^C[ 418.120438] [VFE]vfe_close [ 418.123429] [VFE]mclk off [ 418.162612] [VFE]vfe_runtime_suspend [ 418.166546] [VFE]..........................vfe clk close!....................... [ 418.183428] [VFE]vfe_close end root@TinaLinux:/bin# root@TinaLinux:/bin# 现在在WIN7在通过命令行的ADB连接全志R40平台: Microsoft Windows [版本 6.1.7600] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 C:\Users\Administrator>adb shell BusyBox v1.24.1 () built-in shell (ash) _____ _ __ _ |_ _||_| ___ _ _ | | |_| ___ _ _ _ _ | | _ | || | | |__ | || || | ||_'_| | | | || | || _ | |_____||_||_|_||___||_,_| |_| |_||_|_||_|_| Tina is Based on OpenWrt! ---------------------------------------------- Tina Linux (Neptune, 5861D22E) ---------------------------------------------- root@TinaLinux:/# root@TinaLinux:/# cd /tmp cd /tmp root@TinaLinux:/tmp# root@TinaLinux:/tmp# ll ll drwxrwxrwt 10 root root 280 Jan 1 18:38 . drwxr-xr-x 1 root root 1024 Jan 1 18:38 .. drwx------ 2 root root 40 Jan 1 18:38 .uci -rw-r--r-- 1 root root 6 Jan 1 18:38 TZ -rw-r--r-- 1 root root 5 Jan 1 18:38 booting_state drwxr-xr-x 3 root root 60 Jan 1 18:38 lib drwxrwxrwx 2 root root 40 Jan 1 18:38 lock drwxr-xr-x 2 root root 80 Jan 1 18:38 log lrwxrwxrwx 1 root root 21 Jan 1 18:38 resolv.conf -> /tmp/resolv.conf.auto -rw-r--r-- 1 root root 0 Jan 1 18:38 resolv.conf.auto drwxrwxrwx 3 root root 160 Jan 1 18:38 run drwxrwxrwt 2 root root 40 Jan 1 18:38 shm drwxrwxrwx 2 root root 60 Jan 1 18:38 state drwxr-xr-x 2 root root 40 Jan 1 18:38 tmp root@TinaLinux:/tmp# root@TinaLinux:/tmp# (这里告诉cameratest分辨率是:640x480) root@TinaLinux:/tmp# echo "146:0:1:640x480#" > command echo "146:0:1:640x480#" > command root@TinaLinux:/tmp# root@TinaLinux:/tmp# root@TinaLinux:/tmp# cat command cat command 146:0:1:640x480# root@TinaLinux:/tmp# root@TinaLinux:/tmp# (告诉cameratest抓图,文件名为:test1013.yuv) root@TinaLinux:/tmp# echo "149:test1013.yuv#" > command echo "149:test1013.yuv#" > command root@TinaLinux:/tmp# root@TinaLinux:/tmp# ll ll drwxrwxrwt 10 root root 340 Jan 1 18:45 . drwxr-xr-x 1 root root 1024 Jan 1 18:38 .. drwx------ 2 root root 40 Jan 1 18:38 .uci -rw-r--r-- 1 root root 6 Jan 1 18:38 TZ -rw-r--r-- 1 root root 5 Jan 1 18:38 booting_state -rw-rw-rw- 1 root root 18 Jan 1 18:45 command drwxr-xr-x 3 root root 60 Jan 1 18:38 lib drwxrwxrwx 2 root root 40 Jan 1 18:38 lock drwxr-xr-x 2 root root 80 Jan 1 18:38 log lrwxrwxrwx 1 root root 21 Jan 1 18:38 resolv.conf -> /tmp/resolv.conf.auto -rw-r--r-- 1 root root 0 Jan 1 18:38 resolv.conf.auto drwxrwxrwx 3 root root 160 Jan 1 18:38 run drwxrwxrwt 2 root root 40 Jan 1 18:38 shm drwxrwxrwx 2 root root 60 Jan 1 18:38 state -rw-r--r-- 1 root root 1000 Jan 1 18:45 test1013.yuv.exif drwxr-xr-x 2 root root 40 Jan 1 18:38 tmp -rw-r--r-- 1 root root 460800 Jan 1 18:45 yuvtest1013.yuv root@TinaLinux:/tmp# root@TinaLinux:/tmp# cat command cat command 149:test1013.yuv# root@TinaLinux:/tmp# root@TinaLinux:/tmp# 7、通过ADB获取NV12格式的YUV图片到WIN7上: root@TinaLinux:/tmp# exit exit C:\Users\Administrator> C:\Users\Administrator>cd c:\tmp (简单粗暴,直接将/tmp目录下的所有文件通过ADB全部拉到WIN7上!) c:\tmp>adb pull /tmp/ . pull: building file list... skipping special file 'resolv.conf' skipping special file 'ubus.sock' skipping special file 'system_bus_socket' pull: /tmp/log/wtmp -> ./log/wtmp pull: /tmp/log/lastlog -> ./log/lastlog pull: /tmp/lib/dbus/machine-id -> ./lib/dbus/machine-id pull: /tmp/state/network -> ./state/network pull: /tmp/run/ntpd.pid -> ./run/ntpd.pid pull: /tmp/run/dbus.pid -> ./run/dbus.pid pull: /tmp/run/config.md5 -> ./run/config.md5 pull: /tmp/run/logread.1.pid -> ./run/logread.1.pid pull: /tmp/booting_state -> ./booting_state pull: /tmp/resolv.conf.auto -> ./resolv.conf.auto pull: /tmp/TZ -> ./TZ pull: /tmp/command -> ./command pull: /tmp/test1013.yuv.exif -> ./test1013.yuv.exif pull: /tmp/yuvtest1013.yuv -> ./yuvtest1013.yuv 14 files pulled. 0 files skipped. 2042 KB/s (462316 bytes in 0.221s) c:\tmp> 8、使用yuvplayer.exe查看NV12格式的YUV图片: 设置如下: Size:VGA(640x480) Color:NV12 9、已知问题:使用fpscamera连续抓100张图片,可以发现细微的横条纹! 使用全志R16平台tina v2.1系统下的解决方法无效! ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.