7z文件

memory_map.7z 评分:

进程用户空间布局 参考之前对vmalloc函数实现的分析,vmalloc时是从内核页表的pgd开始逐层生成并建立页表,vmalloc_to_page就是对应的逆过程,先找到虚拟地址对应的页表项pte,就能通过pte_pfn计算出页号,再通过pfn_to_page就可以得到对应的页描述符 即pte --> pfn --> page 此处注意pte_offset_map和pte_unmap的配对使用
2020-10-22 上传 大小:1648B
立即下载
docx文件
elasticsearch的详细安装和简单使用

elasticsearch的详细安装,es-sql插件安装、kibana安装和简单使用,以及与关系型数据库的对比等。

立即下载
7z文件
r40_tinav2.1_最终验证通过_使用CB-S来验证OV5640有横条纹fpscamera+SPI2.0成功_20171114_1443没有外层目录.7z

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 += ov2640.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系统下的解决方法无效!

立即下载
7z文件
boost_interprocess.7z

来自boost库的进程间通信的源代码,支持多种方式

立即下载
7z文件
基于yolov5的车牌检测和识别.7z

基于yolov5的车牌检测和识别.7z

立即下载
7z文件
libstdc++-6.7z

libstdc++-6.7z

立即下载
pdf文件
Elasticsearch 8.14.0 搭建自己的全文搜索引擎

Elasticsearch 是一个基于 Lucene 的开源、分布式、RESTful 搜索和分析引擎,它允许你快速地进行全文搜索、实时分析大量数据。Elasticsearch 广泛应用于各种场景,如维基百科、Stack Overflow、Github 等网站的搜索功能。一、环境准备 安装Java环境:Elasticsearch需要Java环境来运行。确保您的机器上安装了Java,并且JAVA_HOME环境变量已正确设置。Elasticsearch 8.14.0 推荐使用的Java版本可以在Elasticsearch的官方文档中找到。 下载Elasticsearch安装包:从Elasticsearch的官方网站下载最新版本的安装包(Elasticsearch 8.14.0)。下载链接通常位于Elasticsearch的下载页面。 二、安装Elasticsearch 解压安装包:将下载的安装包解压到指定目录。 配置Elasticsearch(可选):根据您的需求修改Elasticsearch的配置文件(elasticsearch.yml),例如设置集群名称、节点名称、网络绑定地址等。如果您

立即下载
rar文件
kgb档案压缩console版+源码

KGB Archiver console version ?005-2006 Tomasz Pawlak, tomekp17@gmail.com, mod by Slawek (poczta-sn@gazeta.pl) based on PAQ6 by Matt Mahoney PAQ6v2 - File archiver and compressor. (C) 2004, Matt Mahoney, mmahoney@cs.fit.edu This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation at http://www.gnu.org/licenses/gpl.txt or (at your option) any later version. This program is distributed without any warranty. USAGE To compress: PAQ6 -3 archive file file... (1 or more file names), or or (MSDOS): dir/b | PAQ6 -3 archive (read file names from input) or (UNIX): ls | PAQ6 -3 archive To decompress: PAQ6 archive (no option) To list contents: more < archive Compression: The files listed are compressed and stored in the archive, which is created. The archive must not already exist. File names may specify a path, which is stored. If there are no file names on the command line, then PAQ6 prompts for them, reading until the first blank line or end of file. The -3 is optional, and is used to trade off compression vs. speed and memory. Valid options are -0 to -9. Higher numbers compress better but run slower and use more memory. -3 is the default, and gives a reasonable tradeoff. Recommended options are: -0 to -2 for fast (2X over -3) but poor compression, uses 2-6 MB memory -3 for reasonably fast and good compression, uses 18 MB (default) -4 better compression but 3.5X slower, uses 64 MB -5 slightly better compression, 6X slower than -3, uses 154 MB -6 about like -5, uses 202 MB memory -7 to -9 use 404 MB, 808 MB, 1616 MB, about the same speed as -5 Decompression: No file names are specified. The archive must exist. If a path is stored, the file is extracted to the appropriate directory, which must exist. PAQ6 does not create directories. If the file to be extracted already exists, it is not replaced; rather it is compared with the archived file, and the offset of the first difference is reported. The decompressor requires as much memory as was used to compress. There is no option. It is not possible to add, remove, or update files in an existing archive. If you want to do this, extract the files, delete the archive, and create a new archive with just the files you want. TO COMPILE gxx -O PAQ6.cpp DJGPP 2.95.2 bcc32 -O2 PAQ6.cpp Borland 5.5.1 sc -o PAQ6.cpp Digital Mars 8.35n g++ -O produces the fastest executable among free compilers, followed by Borland and Mars. However Intel 8 will produce the fastest and smallest Windows executable overall, followed by Microsoft VC++ .net 7.1 /O2 /G7 PAQ6 DESCRIPTION 1. OVERVIEW A PAQ6 archive has a header, listing the names and lengths of the files it contains in human-readable format, followed by the compressed data. The first line of the header is "PAQ6 -m" where -m is the memory option. The data is compressed as if all the files were concatenated into one long string. PAQ6 uses predictive arithmetic coding. The string, y, is compressed by representing it as a base 256 number, x, such that: P(s < y) <= x < P(s <= y) (1) where s is chosen randomly from the probability distribution P, and x has the minimum number of digits (bytes) needed to satisfy (1). Such coding is within 1 byte of the Shannon limit, log 1/P(y), so compression depends almost entirely on the goodness of the model, P, i.e. how well it estimates the probability distribution of strings that might be input to the compressor. Coding and decoding are illustrated in Fig. 1. An encoder, given P and y, outputs x. A decoder, given P and x, outputs y. Note that given P in equation (1), that you can find either x from y or y from x. Note also that both computations can be done incrementally. As the leading characters of y are known, the range of possible x narrows, so the leading digits can be output as they become known. For decompression, as the digits of x are read, the set of possible y satisfying (1) is restricted to an increasingly narrow lexicographical range containing y. All of the strings in this range will share a growing prefix. Each time the prefix grows, we can output a character. y +--------------------------+ Uncomp- | V ressed | +---------+ p +----------+ x Compressed Data --+--->| Model |----->| Encoder |----+ Data +---------+ +----------+ | | +----------+ V y +---------+ p +----------+ y Uncompressed +--->| Model |----->| Decoder |----+---> Data | +---------+ +----------+ | | | +-------------------------------------+ Fig. 1. Predictive arithmetic compression and decompression Note that the model, which estimates P, is identical for compression and decompression. Modeling can be expressed incrementally by the chain rule: P(y) = P(y_1) P(y_2|y_1) P(y_3|y_1 y_2) ... P(y_n|y_1 y_2 ... y_n-1) (2) where y_i means the i'th character of the string y. The output of the model is a distribution over the next character, y_i, given the context of characters seen so far, y_1 ... y_i-1. To simplify coding, PAQ6 uses a binary string alphabet. Thus, the output of a model is an estimate of P(y_i = 1 | context) (henceforth p), where y_i is the i'th bit, and the context is the previous i - 1 bits of uncompressed data. 2. PAQ6 MODEL The PAQ6 model consists of a weighted mix of independent submodels which make predictions based on different contexts. The submodels are weighted adaptively to favor those making the best predictions. The output of two independent mixers (which use sets of weights selected by different contexts) are averaged. This estimate is then adjusted by secondary symbol estimation (SSE), which maps the probability to a new probability based on previous experience and the current context. This final estimate is then fed to the encoder as illustrated in Fig. 2. Uncompressed input -----+--------------------+-------------+-------------+ | | | | V V | | +---------+ n0, n1 +----------+ | | | Model 1 |--------->| Mixer 1 |\ p | | +---------+ \ / | | \ V V \ / +----------+ \ +-----+ +------------+ +---------+ \ / \| | p | | Comp- | Model 2 | \/ + | SSE |--->| Arithmetic |--> ressed +---------+ /\ | | | Encoder | output ... / \ /| | | | / \ +----------+ / +-----+ +------------+ +---------+ / \ | Mixer 2 | / | Model N |--------->| |/ p +---------+ +----------+ Fig. 2. PAQ6 Model details for compression. The model is identical for decompression, but the encoder is replaced with a decoder. In Sections 2-6, the description applies to the default memory option (-5, or MEM = 5). For smaller values of MEM, some components are omitted and the number of contexts is less. 3. MIXER The mixers compute a probability by a weighted summation of the N models. Each model outputs two numbers, n0 and n1 represeting the relative probability of a 0 or 1, respectively. These are combined using weighted summations to estimate the probability p that the next bit will be a 1: SUM_i=1..N w_i n1_i (3) p = -------------------, n_i = n0_i + n1_i SUM_i=1..N w_i n_i The weights w_i are adjusted after each bit of uncompressed data becomes known in order to reduce the cost (code length) of that bit. The cost of a 1 bit is -log(p), and the cost of a 0 is -log(1-p). We find the gradient of the weight space by taking the partial derivatives of the cost with respect to w_i, then adjusting w_i in the direction of the gradient to reduce the cost. This adjustment is: w_i := w_i + e[ny_i/(SUM_j (w_j+wo) ny_j) - n_i/(SUM_j (w_j+wo) n_j)] where e and wo are small constants, and ny_i means n0_i if the actual bit is a 0, or n1_i if the bit is a 1. The weight offset wo prevents the gradient from going to infinity as the weights go to 0. e is set to around .004, trading off between faster adaptation (larger e) and less noise for better compression of stationary data (smaller e). There are two mixers, whose outputs are averaged together before being input to the SSE stage. Each mixer maintains a set of weights which is selected by a context. Mixer 1 maintains 16 weight vectors, selected by the 3 high order bits of the previous byte and on whether the data is text or binary. Mixer 2 maintains 16 weight vectors, selected by the 2 high order bits of each of the previous 2 bytes. To distinguish text from binary data, we use the heuristic that space characters are more common in text than NUL bytes, while NULs are more common in binary data. We compare the position of the 4th from last space with the position of the 4th from last 0 byte. 4. CONTEXT MODELS Individual submodels output a prediction in the form of two numbers, n0 and n1, representing relative probabilities of 0 and 1. Generally this is done by storing a pair of counters (c0,c1) in a hash table indexed by context. When a 0 or 1 is encountered in a context, the appropriate count is increased by 1. Also, in order to favor newer data over old, the opposite count is decreased by the following heuristic: If the count > 25 then replace with sqrt(count) + 6 (rounding down) Else if the count > 1 then replace with count / 2 (rounding down) The outputs are derived from the counts in a way that favors highly predictive contexts, i.e. those where one count is large and the other is small. For the case of c1 >= c0 the following heuristic is used. If c0 = 0 then n0 = 0, n1 = 4 c0 Else n0 = 1, n1 = c1 / c0 For the case of c1 < c0 we use the same heuristic swapping 0 and 1. In the following example, we encounter a long string of zeros followed by a string of ones and show the model output. Note how n0 and n1 predict the relative outcome of 0 and 1 respectively, favoring the most recent data, with weight n = n0 + n1 Input c0 c1 n0 n1 ----- -- -- -- -- 0000000000 10 0 40 0 00000000001 5 1 5 1 000000000011 2 2 1 1 0000000000111 1 3 1 3 00000000001111 1 4 1 4 Table 1. Example of counter state (c0,c1) and outputs (n0,n1) In order to represent (c0,c1) as an 8-bit state, counts are restricted to the values 0-40, 44, 48, 56, 64, 96, 128, 160, 192, 224, or 255. Large counts are incremented probabilistically. For example, if c0 = 40 and a 0 is encountered, then c0 is set to 44 with probability 1/4. Decreases in counter values are deterministic, and are rounded down to the nearest representable state. Counters are stored in a hash table indexed by contexts starting on byte boundaries and ending on nibble (4-bit) boundaries. Each hash element contains 15 counter states, representing the 15 possible values for the 0-3 remaining bits of the context after the last nibble boundary. Hash collisions are detected by storing an 8-bit checksum of the context. Each bucket contains 4 elements in a move-to-front queue. When a new element is to be inserted, the priority of the two least recently accessed elements are compared by using n (n0+n1) of the initial counter as the priority, and the lower priority element is discarded. Hash buckets are aligned on 64 byte addresses to minimize cache misses. 5. RUN LENGTH MODELS A second type of model is used to efficiently represent runs of up to 255 identical bytes within a context. For example, given the sequence "abc...abc...abc..." then a run length model would map "ab" -> ("c", 3) using a hash table indexed by "ab". If a new value is seen, e.g. "abd", then the state is updated to the new character and a count of 1, i.e. "ab" -> ("d", 1). A run length context is accessed 8 times, once for each bit. If the bits seen so far are consistent with the modeled character, then the output of a run length model is (n0,n1) = (0,n) if the next bit is a 1, or (n,0) if the next bit is a 0, where n is the count (1 to 255). If the bits seen so far are not consistent with the predicted byte, then the output is (0,0). These counts are added to the counter state counts to produce the model output. Run lengths are stored in a hash table without collision detection, so an element occupies 2 bytes. Generally, most models store one run length for every 8 counter pairs, so 20% of the memory is allocated to them. Run lengths are used only for memory option (-MEM) of 5 or higher. 6. SUBMODEL DETAILS Submodels differ mainly in their contexts. These are as follows: a. DefaultModel. (n0,n1) = (1,1) regardless of context. b. CharModel (N-gram model). A context consists of the last 0 to N whole bytes, plus the 0 to 7 bits of the partially read current byte. The maximum N depends on the -MEM option as shown in the table below. The order 0 and 1 contexts use a counter state lookup table rather than a hash table. Order Counters Run lengths ----- -------- ----------- 0 2^8 1 2^16 2 2^(MEM+15) 2^(MEM+12), MEM >= 5 3 2^(MEM+17) 2^(MEM+14), MEM >= 5 4 2^(MEM+18) 2^(MEM+15), MEM >= 5 5 2^(MEM+18), MEM >= 1 2^(MEM+15), MEM >= 5 6 2^(MEM+18), MEM >= 3 2^(MEM+15), MEM >= 5 7 2^(MEM+18), MEM >= 3 2^(MEM+15), MEM >= 5 8 2^20, MEM = 5 2^17, MEM = 5 2^(MEM+14), MEM >= 6 2^(MEM+14), MEM >= 6 9 2^20, MEM = 5 2^17, MEM = 5 2^(MEM+14), MEM >= 6 2^(MEM+14), MEM >= 6 Table 2. Number of modeled contexts of length 0-9 c. MatchModel (long context). A context is the last n whole bytes (plus extra bits) where n >=8. Up to 4 matching contexts are found by indexing into a rotating input buffer whose size depends on MEM. The index is a hash table of 32-bit pointers with 1/4 as many elements as the buffer (and therefore occupying an equal amount of memory). The table is indexed by a hashes of 8 byte contexts. No collision detection is used. In order to detect very long matches at a long distance (for example, versions of a file compressed together), 1/16 of the pointers (chosen randomly) are indexed by a hash of a 32 byte context. For each match found, the output is (n0,n1) = (w,0) or (0,w) (depending on the next bit) with a weight of w = length^2 / 4 (maximum 511), depending on the length of the context in bytes. The four outputs are added together. d. RecordModel. This models data with fixed length records, such as tables. The model attempts to find the record length by searching for characters that repeat in the pattern x..x..x..x where the interval between 4 successive occurrences is identical and at least 2. Because of uncertainty in this method, the two most recent values (which must be different) are used. The following 5 contexts are modeled; 1. The two bytes above the current bit for each repeat length. 2. The byte above and the previous byte (to the left) for each repeat length. 3. The byte above and the current position modulo the repeat length, for the longer of the two lengths only. e. SparseModel. This models contexts with gaps. It considers the following contexts, where x denotes the bytes considered and ? denotes the bit being predicted (plus preceding bits, which are included in the context). x.x? (first and third byte back) x..x? x...x? x....x? xx.? x.x.? xx..? c ... c?, gap length c ... xc?, gap length Table 3. Sparse model contexts The last two examples model variable gap lengths between the last byte and its previous occurrence. The length of the gap (up to 255) is part of the context. e. AnalogModel. This is intended to model 16-bit audio (mono or stereo), 24-bit color images, 8-bit data (such as grayscale images). Contexts drop the low order bits, and include the position within the file modulo 2, 3, or 4. There are 8 models, combined into 4 by addition before mixing. An x represents those bits which are part of the context. 16 bit audio: xxxxxx.. ........ xxxxxx.. ........ ? (position mod 2) xxxx.... ........ xxxxxx.. ........ ? (position mod 2) xxxxxx.. ........ ........ ........ xxxxxx.. ........ xxxxxx.. ........ ? (position mod 4 for stereo audio) 24 bit color: xxxx.... ........ ........ xxxxxxxx ........ ........ ? (position mod 3) xxxxxx.. xxxx.... xxxx.... ? (position mod 3) 8 bit data: xxx..... xxxxx... xxxxxxx. ? CCITT images (1 bit per pixel, 216 bytes wide, e.g. calgary/pic) xxxxxxxx (skip 215 bytes...) xxxxxxxx (skip 215 bytes...) ? Table 4. Analog models. f. WordModel. This is intended to model text files. There are 3 contexts: 1. The current word 2. The previous and current words 3. The second to last and current words (skipping a word) A word is defined in two different ways, resulting in a total of 6 different contexts: 1. Any sequence of characters with ASCII code > 32 (not white space). Upper case characters are converted to lower case. 2. Any sequence of A-Z and a-z (case sensitive). g. ExeModel. This models 32-bit Intel .exe and .dll files by changing relative 32-bit CALL addresses to absolute. These instructions have the form (in hex) "E8 xx yy zz 00" or "E8 xx yy zz FF" where the 32-bit operand is stored least significant byte first. These are converted to absolute addresses by adding the position of the E8 byte, and then stored in a 256 element table indexed by the low order byte (xx) along with an 8-bit count. If another E8 xx ... 00/FF with the same value of xx is encountered, then the old value is replaced and the count set back to 1. During modeling, when "E8 xx" is encountered, the bytes yy, zz, and 00/FF are predicted by adjusting xx to absolute address, then looking up the address in the table indexed by xx. If the context matches the table entry up to the current bit, then the next bit from the table is predicted with weight n for yy, 4n for zz, and 16n for 00/FF, where n is the count. 7. SSE The purpose of the SSE stage is to further adjust the probability output from the mixers to agree with actual experience. Ideally this should not be necessary, but in reality this can improve compression. For example, when "compressing" random data, the output probability should be 0.5 regardless of what the models say. SSE will learn this by mapping all input probabilities to 0.5. | Output __ | p / | / | __/ | / | / | | | / |/ Input p +------------- Fig. 3. Example of an SSE mapping. SSE maps the probability p back to p using a piecewise linear function with 32 segments. Each vertex is represented by a pair of 8-bit counters (n0, n1) except that now the counters use a stationary model. When the input is p and a 0 or 1 is observed, then the corresponding count (n0 or n1) of the two vertices on either side of p are incremented. When a count exceeds the maximum of 255, both counts are halved. The output probability is a linear interpolation of n1/n between the vertices on either side. The vertices are scaled to be longer in the middle of the graph and short near the ends. The intial counts are set so that p maps to itself. SSE is context sensitive. There are 2048 separately maintained SSE functions, selected by the 0-7 bits of the current (partial) byte and the 2 high order bits of the previous byte, and on whether the data is text or binary, using the same heuristic as for selecting the mixer context. The final output to the encoder is a weighted average of the SSE input and output, with the output receiving 3/4 of the weight: p := (3 SSE(p) + p) / 4. (4) 8. MEMORY USAGE The -m option (MEM = 0 through 9) controls model and memory usage. Smaller numbers compress faster and use less memory, while higher numbers compress better. For MEM < 5, only one mixer is used. For MEM < 4, bit counts are stored in nonstationary counters, but no run length is stored (decreasing memory by 20%). For MEM < 1, SSE is not used. For MEM < 5, the record, sparse, and analog models are not used. For MEM < 4, the word model is not used. The order of the char model ranges from 4 to 9 depending on MEM for MEM as shown in Table 6. Run Memory used by........................ Total MEM Mixers Len Order Char Match Record Sparse Analog Word SSE Memory (MB) --- ------ --- ----- ---- ----- ------ ------ ------ ---- --- ----------- 0 1 no 4 .5 1 1.5 1 1 no 5 1 2 .12 3 2 1 no 5 2 4 .12 6 3 1 no 7 10 8 .12 18 4 1 no 7 20 16 6 6 1 15 .12 64 5 2 yes 9 66 32 13 11 2 30 .12 154 6 2 yes 9 112 32 13 11 4 30 .12 202 7 2 yes 9 224 64 25 22 9 60 .12 404 8 2 yes 9 448 128 50 45 18 120 .12 808 9 2 yes 9 992 256 100 90 36 240 .12 1616 Table 5. Memory usage depending on MEM (-0 to -9 option). 9. EXPERIMENTAL RESULTS Results on the Calgary corpos are shown below for some top data compressors as of Dec. 30, 2003. Options are set for maximum compression. When possible, the files are all compressed into a single archive. Run times are on a 705 MHz Duron with 256 MB memory, and include 3 seconds to run WRT when applicable. PAQ6 was compiled with DJGPP (g++) 2.95.2 -O. Original size Options 3,141,622 Time Author ------------- ------- --------- ---- ------ gzip 1.2.4 -9 1,017,624 2 Jean Loup Gailly epm r9 c 668,115 49 Serge Osnach rkc a -M80m -td+ 661,102 91 Malcolm Taylor slim 20 a 659,213 159 Serge Voskoboynikov compressia 1.0 beta 650,398 66 Yaakov Gringeler durilca v.03a (as in README) 647,028 30 Dmitry Shkarin PAQ5 661,811 361 Matt Mahoney WRT11 + PAQ5 638,635 258 Przemyslaw Skibinski + PAQ6 -0 858,954 52 -1 750,031 66 -2 725,798 76 -3 709,806 97 -4 655,694 354 -5 648,951 625 -6 648,892 636 WRT11 + PAQ6 -6 626,395 446 WRT20 + PAQ6 -6 617,734 439 Table 6. Compressed size of the Calgary corpus. WRT11 is a word reducing transform written by Przemyslaw Skibinski. It uses an external English dictionary to replace words with 1-3 byte symbols to improve compression. rkc, compressia, and durilca use a similar approach. WRT20 is a newer version of WRT11. 10. ACKNOWLEDGMENTS Thanks to Serge Osnach for introducing me to SSE (in PAQ1SSE/PAQ2) and the sparse models (PAQ3N). Also, credit to Eugene Shelwein, Dmitry Shkarin for suggestions on using multiple character SSE contexts. Credit to Eugene, Serge, and Jason Schmidt for developing faster and smaller executables of previous versions. Credit to Werner Bergmans and Berto Destasio for testing and evaluating them, including modifications that improve compression at the cost of more memory. Credit to Alexander Ratushnyak who found a bug in PAQ4 decompression, and also in PAQ6 decompression for very small files (both fixed). Thanks to Berto for writing PAQ5-EMILCONT-DEUTERIUM from which this program is derived (which he derived from PAQ5). His improvements to PAQ5 include a new Counter state table and additional contexts for CharModel and SparseModel. I refined the state table by adding more representable states and modified the return counts to give greater weight when there is a large difference between the two counts. I expect there will be better versions in the future. If you make any changes, please change the name of the program (e.g. PAQ7), including the string in the archive header by redefining PROGNAME below. This will prevent any confusion about versions or archive compatibility. Also, give yourself credit in the help message.

立即下载
doc文件
VS MAP 文件使用

通过VS MAP 文件查找系统崩溃原因。WORD文档

立即下载
7z文件
grub4dos-V0.4.6a-2017-02-04更新

更新说明: 2017-02-04(yaya) Ls command: Empty Folder returns false. 2016-12-08(yaya) 修正lz4、vhd不显示解压缩进度指示。增加lzma解压缩进度指示。 2016-11-09(不点) 0x8205 bit 5 = 1: 使checkkey闲置循环停止指令。 2016-04-13(yaya) 支持动画菜单 setmenu --graphic-entry=类型=菜单行数=菜单列数=图形宽(像素)=图形高(像素)=菜单行间距(像素) 菜单项0的路径文件名 类型: 位0:高亮指定颜色 位1:高亮颜色翻转 位2:高亮显示线框 位7:背景透明(最好使用黑色背景) 文件名: *n.??? 格式 n=00-99 高亮颜色由 color HIGHLIGHT=0xrrggbb 指定。 字符可以使用任意字型、字高、颜色,可以辅以图标。 2016-03-25(yaya) 菜单字符可以使用不同字型。 例如:"七" 使用不同字型,将 .hex 文件中的 unicode 码 “4e03” 修改为 “0080”, 将菜单中的 "七" 修改为 “\X0080”。 2016-03-23(yaya) 增强 echo 函数功能。 例如:echo -e \x18 显示 UTF-8 字符 0x18。 echo -e \X2191 显示 unicode 字符 0x2191。 2016-03-15(yaya) 1.增加动画控制热键 F2:播放/停止。 2.增加动画控制位 0x835b,位0:0/1=停止/播放。 3.增加精简字库模式:--simp=起始0,终止0,...,起始3,终止3 中文可以使用 --simp= ,内置字库应当包含 DotSize=[font_h],['simp'] 例如:font --font-high=24 --simp= /24_24.hex DotSize=24,simp 不使用热键: 可以加载 32*32 unifont 全字库 使用热键: 可以加载 24*24 unifont 全字库 使用精简字库: 可以加载 46*46 汉字全字库 使用精简字库及热键:可以加载 40*40 汉字全字库 4.不再支持 bin 格式字库。 2016-03-03(yaya) 1.增加图像背景色设置方法。 splashimage --fill-color=[0xrrggbb] 作用之一,作为小图像的背景。 作用之二,直接作为菜单的背景(即不加载图像背景)。此时只设置字体的前景色即可。 2.增加动画菜单。 splashimage --animated=[type]=[delay]=[last_num]=[x]=[y] START_FILE 类型[type]:bit 0-3: 播放次数 bit 4: 永远重复 bit 7: 透明背景 type=00:禁止播放 播放n次:序列图像各显示n次,时间独占。可作为启动前导、序幕。 永远重复:序列图像无限循环,时间与菜单共享。可作为菜单里的动画。 背景透明:即抠像。要求4角像素为背景色。 背景色最好为白色或黑色,这样可以去除一些灰色杂波。若是彩色背景,则应当非常干净。 提醒:请以16进制方式输入。否则易错。 延迟[delay]:序列图像之间的延迟。单位是滴答,即1/18.2秒。 序列数[last_num]:序列图像总数(2位数,从1开始计数)。 偏移[x]、[y]:图像偏移,单位像素。 起始图像文件 START_FILE 命名规则:*n.??? n: 1-9 或 01-99 或 001-999。 3.增加固定图像的背景色可以透明。 splashimage [--offset=[type]=[x]=[y]] FILE 类型[type]:bit 7: 透明背景 2016-02-14(yaya) setmenu 函数增加菜单项目背景短/满参数(默认短) 2016-01-19(yaya) splashimage 函数增加图像起始偏移(默认0) 2015-08-20(yaya) 1.支持非 16*16 字体。 在 font 函数增加参数: --hex* --bin 字库输出类型; --horiz-scan* --verti-scan 点阵字符扫描模式; --h-to-l* --l-to-h 点阵字符在字节的存储方式; --font-high=[font_h] 点阵字符的高与宽(应当相等)。 注:* 是默认项。 例子:font /my.hex font --bin --verti-scan --l-to-h --font-high=20 /2_20.dzk font --bin --font-high=20 /1_20.dzk 内置字库,如果不是 16*16 字体,头部需声明:DotSize=[font_h]。 受内存限制,当前大字库可支持到 32*32,中文小字库可支持到 40*40. 2.不再支持 vga 图形模式。 2015-07-07(yaya) 1.支持每像素16位彩色模式(64K 5:6:5)。 2.支持 jpg(jpeg,jpe)图像格式。 3.在 vbe 模式,使用 echo -rrggbb 可以显示 216 种彩色样本。 4.使用 echo -v 可以显示版本、内存信息。 5.增加 setmenu 函数,增强图形菜单编辑功能。参数: --ver-on --ver-off 版本信息打开/关闭。默认打开; --lang=en --lang=zh 按键帮助信息中英文切换。默认英文; --auto-num-off --auto-num-on 关闭/打开菜单自动编号。默认关闭; --font-spacing=[font]:[line] 设置字符间距/行间距。单位:像素。默认0。应当位于下面的参数之前; --string=[x]=[y]=[color]=["string“] 字符串位置、颜色与内容,可用于标题,说明,帮助等。单位:列,行,24位色彩。 注:如果省略颜色,位于菜单框以上按标题颜色,位于菜单框以下按帮助文本颜色; 字符串头尾要加英文双引号; 列数=图像水平像素/(字符宽+字符间距) 字符宽=8; 行数=图像垂直像素/(字符高+行间距) 字符高=10; --box x=[x] y=[y] w=[w] h=[h] l=[l] 项目标题起始列,起始行,每行最大字符数,最大菜单项数,菜单框线条宽度(像素); 注:w=0 表示水平居中。此时 w 应当在 x 之后; l=0 表示不显示菜单框; --help=[x]=[w]=[y] 项目帮助位置。单位:列,行。默认1行; 注:x=0 由边框确定(默认);w=0 水平居中; --keyhelp=[y_offset]=[color] 按键帮助位置,颜色。单位:列,行,24位色彩。 注:y_offset=0,项目与按键帮助位于同一区域,项目帮助可以覆盖按键帮助(默认); y_offset !=0,是按键帮助到项目帮助的行偏移,两者共存; y_offset<=4,是项目帮助的显示行数; color 默认 “color helptext"; --u 恢复菜单原始状态。 --timeout=[x]=[y]=[color] 倒计时位置、颜色。单位:列,行,24位色彩。 2015-05-14(yaya) 改进 NTFS 文件系统: 对于驻留属性文件(小文件),可以写,也可用 blocklist 显示信息。 对于非驻留属性列表,取消长度限制。 2015-03-23(yaya) 内置 usb2.0 可以驱动原生4k扇区磁盘 2014-10-29 1.(tinybit) Workaround for BIOS of BENQ notebook that only supports 1. 2014-10-15 1.workaround for issue 204(chenall) 2014-10-12 1.skip_to()函数修改,对于引号里面的”\”使用以前的方法处理,保持兼容性。(chenall) 2.add variable @boot,add debug info。(chenall) 3.two variables boot_drive and install_partition can be preset to a value before transferring control to grub4dos. (tinybit) 4.修正屏蔽 map 信息。(yaya) 2014-10-09(yaya) 1.屏蔽 map 信息。 2014-09-23(yaya) 1.使用 bootlace.com 安装 grldr.mbr 到 gpt 分区类型的设备。 2014-09-02(yaya) 1.ext4 分区支持 64 位功能,支持元块组。 2.grldr头部、grldr.mbr 支持搜索 gpt 分区的 grldr。 3.修正了 bootlace。 2014-08-17 1.修正GPT unhide/hide的BUG,现在可以正常对gpt分区进行隐藏. 2.优化GPT分区查找代码. 3.允许直接访问GPT保留区,但不在列表中显示. 2014-08-01(不点) 1.解决了 reboot.pro 报告的分区 ID 为 00 的分区不可被识别出来、无法访问的问题。 2.解决了 chainloader --raw 不能加载硬盘 BPB hidden sectors=0 的引导扇区的问题。也是英文论坛报告的。 3.清除 ud 启动后残留信息使后续启动不再被重复识别为 ud 启动(因为后续启动本来就不再是从 ud 启动)。 (yaya) 1.使 builtins.c 中的 default_func、geometry_func 代码与 0.4.5c 保持一致。 2.使 common.c、stage2.c 中的代码与 0.4.5c 保持一致(除 0.4.6a 有意改动的)。 2014-07-9(yaya) 修正软盘搜索。 支持 16 插槽映射。 2014-06-23(yaya) 1.完善了有碎片的文件仿真。最多 32 段碎片。若全部采用新版,则可传递碎片信息。 2.ntfs 文件系统支持 8Kb 以内的非常驻属性列表。 3.修正了 udf 格式光盘驱动 bug。 4.修正了 iso9600_Joliet 文件格式转义符显示问题。 2014-01-16(yaya) 1.当 FDD 模式的 u 盘(有 BPB,没有分区表)被 BIOS 分配驱动器号 0x80 时,映射为 0x00, 同时屏蔽驱动器号 0x80(避免通过 BIOS 读 u 盘,有可能死机)。 这一更改也避免了 Issue 162 读 64 位逻辑扇区的问题。 FDD 模式的 u 盘被识别为硬盘,问题多多。已经发现的问题是执行 find,不返回 (hd0);精简 PE 加载映像文件死机。 2.解决了FDD 模式的 u 盘,执行 find 时返回 (fd0,n) 的问题。 3.修正了 menu.lst 中 0PE.ISO 的默认位置。 4.usb2.0 驱动通过菜单或命令行,使用 usb --init 加载。 5.usb2.0 驱动增加了对集线器(HUB)的支持。若加载失败,可重启试一试。 6.读多扇区失败时,会给出提示:拔出 u 盘然后再插入,按任意键继续。此时会重新初始化 u 盘, 并采用每次读 1 扇区方式从失败处继续。 7.增强文件名识别,便于重命名。 7.1 文件名可以任意大小写,但是在 grldr.mbr 及 grldr.pbr 中必须大写。 7.2 在 grldr.pbr 中: FAT16、FAT32 分区使用 8.3 格式; ext2、exFAT、NTFS 分区使用 12 字符。 7.3 在 grldr.mbr 中:使用 12 字符。 7.4 为了兼容各类分区,建议文件名不要大于 8 字符,后缀不要大于 3 字符。若有分隔符“.”,不可省略。 2014-04-01(yaya) 1.更该了 usb2.0 驱动设备枚举。完善了驱动器号识别。直接从当前位置运行,缓存移到 0x80000。驻留内存精简到 4 Kb。 2.支持有碎片的文件仿真,最多 8 个片段。占用 11Kb - 13Kb 内存(由是否加载光驱确定)。 3.支持 WinXP 系统的短文件名小写。根据短文件名偏移 0x0c 处:位 3=1 表示文件名小写,位 4=1 表示文件扩展名小写。 4.可以正确识别 mkisofs 2.00/2.01 生成有 bug 的 Joliet 格式光盘。 2013-10-18 1.新增功能类似CMD的PATHEXT,可以设置默认的扩展名。 使用command --set-ext设置,每个扩展名使用";"分隔 例子: command --set-ext=.g4b;.g4e 执行时可以不用输入扩展名,比如输入test如果当前路径下有一个test.g4b就会自动使用。 2013-10-17 1.修改代码支持新版HOTKEY。 2013-07-10 1.insmod现在支持长文件名(以前最多11个字符,现在没有限制). 2.修改一些代码解决,消除编译过程中的"Warning"信息. 2013-06-30 1.解决当命令行长度过长或批处理的参数过多时导致的内存冲突问题. 2013-03-19 1.新增连续命令分隔符";;",无阻碍顺序执行. 例子: set a=abcd ;; echo %a% ;; set a= 2013-03-02 1.解决 Issue 117: menu border has arrow symbol (bottom right) 2.让其它显示模式也可以指定菜单框颜色。color border=xx 2012-05-16 1.取消针对ISO9660文件系统忽略大小写的控制.新的版本强制不区分大小写 2012-03-19 1.修正批处理CALL嵌套超过13层时会死机的问题。 2012-02-22 1.stage2/cmdline.c 修正使用管道"|"可能产生的内存冲突的问题。 2.stage2/char_io.c Fixed `more'-like feature issue. 2012-02-10 1.stage2/builtins.c 修正cat --locate=\x22时产生的错误。 http://bbs.wuyou.com/viewthread.php?tid=180142&page=240#pid2382770 2.cmdline.c Do not limit pipe "|" buffer. 取消管道"|"缓冲区限制。 2012-02-01 1./build Fixed build script. 2./stage2/builtins.c cat --replace changed (issue 71). Supported savedefault +n/-n (issue 70). 3./stage2/stage2.c Memory address 0x8276 for variable current_entryno (issue 70). 4./stage2/disk_io.c enable parttype 00 (http://reboot.pro/16004/page__st__25). 5./stage2/cmdline.c fixed skip_to issue. e.g. cat --locate="abc \"def" (md)0x300+1. 2012-01-17 1.修复一个由于map --rehook导致的问题。http://bbs.wuyou.com/viewthread.php?tid=180142&page=231#pid2373207 2.一些小调整。 3.版本号改为0.4.5c 2011-12-30 1.添加菜单热键功能接口,可以通过外部命令来增加热键功能 Add menu hotkey function interface。 2011-12-26 1.改善菜单自动编号。improve autonumber. 2011-12-13 1.修正grub_sprintf函数%d不能正确显示负数的bug. 2011-12-12 command 'if' added '>=' and '<=', and able to perform numeric comparison. 1.if命令新增>=和<=比较符。 新的if命令支持三种比较>=,==,<= 如果两边都是数字,则自动转换成数值型来比较,否则按字符串的ASCII大小比较. 2011-12-11 1.可以使用map --status=n来获取已经映射磁盘的状态。 use map --status=n to get status of hooked drive n. 返回以下两个变量信息(return) %?%=Start_Sector %@retval%=Sector_Count 如果该磁盘不存在返回0. 2011-12-08 1.支持菜单自动编号(使用动态菜单时比较有用)。 Support menu AutoNumber.this is useful when used iftitle. usage: write 0x8274 0x2001 or write 0x8274 0x2D01 0x20(space) or 0x2d ('-') is the delimiter char in ascii code. 更多的用法介绍: http://bbs.wuyou.com/viewthread.php?tid=180142&page=193#pid2351695 2011-12-06 1.bug修正。 2.使用调试模式启动时可以显示条件菜单执行的命令。 2011-12-05 1.添加条件菜单功能 added iftitle. 语法: iftitle [] Actual Title displayed\nOptional help line 只要条件不成立该菜单项目无效。 eg.如果(hd0,0)上有bootmgr文件才会显示第一个菜单,如果有NTLDR文件才会显示第二个菜单 iftitle [if exist (hd0,0)/bootmgr] Boot to NT6.X from (hd0,0) chainloader (hd0,0)/bootmgr iftitle [if exist (hd0,0)/ntldr] Boot to NT5.X from (hd0,0) chainloader (hd0,0)/ntldr 2011-12-01 1.BUG修正。 BUG fixed. 2.添加使用INT18启动功能。 Supported boot via INT 18. 用法(usage): boot -1 or boot --int18 3.一些代码精简 2011-11-29 1.BUG修正。 2.新的color命令语法。 color color_state=color [..] 其中color_state字符串可以如下。 normal 未选中菜单 highlight 选中菜单 helptext 菜单帮助信息 heading 菜单头(GRUB4DOS信息) standard 默认色(控制台) border 菜单边框VBE模式下有效果 3.新的setcolor/setcolorstate函数 2011-11-27 1.修正fontfile命令在splashimage后面时导至背景图颜色错误的问题. 2.VGA模式(0x12/0x6a)没有使用splashimage命令时可以指定字体颜色和console模式一样. 2011-11-22 1.新的COLOR命令允许设置控制台默认字体颜色和背景色(只限于文本模式或VBE模式) 方法: 直接使用只带一个参数的color命令即可. 注: 在命令行或批处理脚本中执行有效. 2011-11-19 1.cursor_state bit 0=1 show cursor,bit 1=1 show splashimage. use setcursor(n) to change if need,can change from commandline e.g. call Fn.70 0 disable cursor and splashimage. 2.清理部份无用代码. 2011-11-18 1.支持BMP背景图片,只限于VBE模式 supported splashimage with BMP format(VBE mode only). 2.使用BMP图片时,如果非处于VBE模式,则尝试自动匹配图片分辨率. 2011-11-03 1.修正一个map的bug. bug fixed in map_func. 相关贴子: http://bbs.wuyou.com/viewthread.php?tid=201887 http://bbs.wuyou.com/viewthread.php?tid=201647 2.忽略ISO9660文件系统上文件名的大小写. Make name comparisoncase-insensitive on iso9660. 可以使用以下命令禁用该功能. You can use below command to disable this feature. write 0x4CA24 0 3.cat命令添加--locatei参数, added --locatei option for cat. 查找时忽略大小写 ignore case locate. eg. cat --locatei=Test (md)0x300+1 2011-10-07 1.新增?_BOOT变量,访问启动GRUB4DOS的Boot_drive add new Variable ?_BOOT to access grub4dos Boot_drive. 2.为了节省代码GRUB4DOS内部不再处理外部命令WENV的兼容性(WENV tuxw版) 解决办法如下: 如果需要使用该版本WENV则自己在菜单或批处理中添加以下命令 write --offset=0x1f8 (md)0x228+1 ?_WENV\0 3.uuid 命令对于uuid字符的判断不区分大小写。 2011-10-02 1.取消对fb启动盘的修正,恢复原样. 2.其它批处理相关代码微调. 2011-09-28 1.修正访问磁盘分区的BUG(disk_io.c),感谢Yonsm的报告和测试. fixed a bug in disk_io.c http://bbs.wuyou.com/viewthread.php?tid=200520&extra=page%3D1 2011-09-13 1.修正insmod的一个bug(不能直接insmod默认路径下的文件) fixed a bug in insmod_func. 2011-09-05 1.insmod支持指定名字,比如insmod fat.gz fat. Support specified name when insmod a module. 2011-09-02 1.fixed a bug in setloca/endlocal. 2011-08-25 1.修正cat命令的一个BUG,使用cat --locate-align参数时会出错. fixed a bug in cat_func. 2011-08-23 1.添加echo/cat命令的帮助信息.(issue: 38,40) add help text for command echo/cat. 2.修复help --all显示的问题(issue: 39) fixed "help --all" issue. 2011-08-09 1.批处理call/gotoBUG修复. 2.新的call可以直接call一个命令. 2011-08-08 1.一些代码微调. 2.修正Ctrl+C强制中止批处理脚本,有时会失败的问题(call和&&,||连用时可能会失败) 3.使用管道符"|"时超过0xC00长度的之符将被丢弃. 2011-08-01 1.外部命令调用修改,优先使用当前目录下的命令(如果存在的话). 2.修复在批处理中使用exit命令退出批处理,导致批处理返回值为0的问题. 2011-07-30 1.批处理执行时允许使用Ctrl+C强制中断运行. 2011-07-19 1.内置变量?_WENV=?_UUID=? 注:1.将来会取消?_UUID,为了保持兼容性,暂时先放一段时间. 请使用%?%或%?_WENV%代替%?_UUID%来获取UUID. 2.%?%变量可以获取命令返回的字符串信息. 目前可用的信息有两个.uuid dev(返回指定设备的UUID字符串),cat --locate= (返回最后一个找到的位置) 2.@random算法修改. 2011-07-13 1.在执行cmain之前初始化变量内存空间。 2011-07-12 1.执行clear命令时同时设置count_lines为0。 2.内置变量增加@retval,其实就是之前的0x4cb00 3.增加setlocal @和endlocal @用法。 setlocal @可以在批处理中使用,把当前的环境保存起来 除非使用endlocal @否则setlocal @之后的设置会一直保留(批处理退出也不影响). 注:1.在批处理中出现setlocal @则在批处理中setlocal @之前的setlocal命令会全部失效。 所以setlocal @有必要的使用的话一般要放在批处理最前面。 2.setlocal @后面如果还有出现setlocal,则setlocal之后的设置不会保留. 2011-07-11 1.添加SETLOCAL和ENDLOCAL命令,和WINDOWS下的批处理用法一样。 2011-07-05 1.尝试解决%~d0,%~f0路径提取的问题,现在%~f0应该可以提取到正确的路径。 2.解决if命令输出转向失败的问题。 3.其它代码调整。 2011-05-27 1.优化PXE_DIR代码。 2.其它微调。 2011-05-25@176 1.调整cat命令的查找字符串代码。 2.修改批处理的调试模式开启方法(改为debug 3才会进入调试模式) 3.消除一些编译时的警告信息。 2011-05-23@174 1.修正一个TFTP相对路径的问题,感谢2011exuejiao@wuyou. 2.在批处理中可以使用debug 3临时开启debug模式。 2011-04-30@159 1.取消前面版本对批处理参数的调整.恢复到04-16版. 2.修正一个BUG.(函数print_root_device). 3.批处理参数新增%~f 文件全路径,%~z文件大小. 4.现在批处理脚本可以使用使用errorcheck命令控制是否检测错误(默认错误就退出). 2011-04-29@157 1.find 命令不再查找(hdx)设备. 2.删除@root变量的前导空格. 3.ls命令新增dev参数,用于显示设备列表. 4.批处理代码调整,对于(bd)设备%~d0会使用实际的设备. 2011-04-25@156 1.新增两个内置变量@root,@path. @root 当前的root. @path 当前默认外部命令查找路径. 2.修正一个可能导致程序出错的问题.(使用到了临时变量的内存). 3.批处理代码功能增强. 2011-04-16@153 1.md5crypt 支持参数。后面直接跟一个字符串会直接计算这个字符串的md5。 2.菜单支持以变量开头的命令。 2011-03-30@151 1.LZMA格式解压时暂时禁止显示进度(因为显示进度时解压大文件会失败)。 2.添加内置变量?_UUID(使用uuid命令可以把获取到的磁盘uuid保存到变量中). 2011-03-29@150 1.insmod *.mod添加了检测模块文件头是否为GRUBEXEC签名. 注:目前还是兼容旧版本的MOD模块,一段时间后会取消,请使用新的MAKEMOD重新制作模块。 2.对批处理路径和文件名的空格进行自动处理。空格前面自动加转义符"\" 注:使用p,n,x参数时有效。即%~1时不会处理,但%~p1时会处理。 2011-03-26@150 1.使用kernel (rd)+1启动时,默认的启动设备改为当前root. 2011-03-25@149 1.修改cat命令替换时显示的信息 cat --locate=S -replace=R 除非debug on否则不显示信息. 2.批处理参数新增%*代表所有参数%1 %2 %3 .... 2011-03-24 1.set /p功能增强(可能会和之前的版本不兼容),新增参数set /p:N 主要变动: 1).如果未输入不会清除原来的变量.(之前的版本会清除). 2).新增支持默认时间没有输入自动退出. set /p:N variable=prompt 如果在N秒之内没有任何输入,则返回,并且不改变variable的值. 2011-03-23 1.为了方便使用,修改shift命令为内部命令.并且shift支持参数 shift n 或 shift /n 具体用法,可以参考CMD/linux下的shift命令帮助. 2011-02-19 1.修复kernel加载grub2 loader的问题. fixed a bug when load multiboot-image(boot.c). 2.现在可以运行16位程序,和wee的机制一样(直接移植了wee里面的代码) 2011-02-15 1.添加realmode_run函数 2.修改GPT分区检测代码,更加严格的检测。 2011-02-12 1.增加GPT分区检测,检测不通过就使用MBR分区。 2.一些代码微调。 2011-02-10 1.清理UTF8转换UNICODE的代码,不再需要(请同时更新UNIFONT). 2.修复变量字符串截取BUG.Fixed Bug in envi_cmd func.(thanks sratlf@wuyou report). http://bbs.wuyou.com/viewthread.php?tid=180142&page=52#pid2154655 注意:从2011-02-10开始,必须使用最新版的UNIFONT才可以正常显示UNICODE字符. Note: You must also update unifont to the latest version.new unifont can show unicode char anywhere. Download the latest version of unifont: http://code.google.com/p/grubutils/downloads/list 2011-01-28 1.支持读取GPT分区表。 为了区别MBR分区表和方便编程,所有的GPT分区类型全部使用0xEE表示。 2.修正一个bug,现在可以访问大于1T的硬盘.但还不能访问超过2T的内容。 2011-01-26 1.修复run_line的一个BUG,会导致返回值为假。 2.添加IF/SET命令的帮助信息。 3.IF命令增加以下语法,判读一个变量或文件是否存在。 if exist variable|filename command. 4.控制pause的输出,debug小于0时不显示倒计时。debug小于1时不显示按键码. 2011-01-22 1.set /A 参数使用16进制数保存变量,set /a 十进制数保存变量。 2.修复goto的一个bug. 3.修复重定向操作符的bug. 2011-01-19 1.set命令不再接受回车换行符。 2.修复获取批处理参数bug. 3.修复fb文件系统bug(可能会导致访问文件出错)。 2011-01-14 1.set命令增强.添加了/l,/u参数 set /l a=Abcd 把Abcd转为小写./u是转换大写。 2011-01-13 1.修复utf8菜单编码自动检测的BUG。 2011-01-10 1.修复SET命令的bug,添加/p参数 2.修复启动linux时内存冲突的bug. 2011-01-09 1.菜单支持变量。 2.支持变量截取(和CMD的方法一样),不支持替换。 2011-01-08 1.重写grub_sprintf函数,支持简易的宽度和精度控制符(m.n或*.*)。 2011-01-07 1.SET命令添加一个参数/a可以把=后面的计算结果赋值给变量. 2.新的safe_parse_maxint函数支持一元运算符。"~!-" 2011-01-06 1.修改CAT命令的显示。现在的cat /filen.ext碰到字符结束符'\0'就停止。 2.批处理内部添加一个命令shift(只能在批处理中使用). 3.skip_to函数现在会可以跳过(‘\r’和‘\n’)。 4.set *将清除所有变量。 2011-01-05 1.修正run_line的一个逻辑错误。 2.外部命令command默认的目录改为(bd)/BOOT/GRUB/ 2011-01-03 1.pager命令即实生效。 2.添加简易的if判断命令类似的MSDOS.目前支持的判断如下: added a new command if. if [/I] [NOT] STRING1==STRING2 [COMMAND] 注:判断符号==前后不允许有空格或制表符否则比较会失败。 2.添加SET命令可以设置、修改、删除变量。 added a new command set to modify the variable. 3.从现在开始支持变量。用法和MS-DOS一样。 From now supports variable. 注:使用了和WENV同样的方案。所以这个功能可以看成是简化版的WENV 2011-01-02 1.pause命令添加一个参数--test-key,可以显示按键扫描码。 added --test-key option for pause to display the key scan code. 2.grub_sprintf函数支持字符串精度控制符。 2011-01-01 1.修复find命令的bug。当然使用条件查询时可能会出错。 2.批处理参数修改,为了方便使用,%9改成剩余的所有参数。 比如参数: 1 2 3 4 5 6 7 8 9 0 a b c 那%9就是9 0 a b c. 2010-12-31 1.pause命令增强,增加了显示按键扫描码的功能。需要debug 为-1. 例子:显示一个按键扫描码 debug -1 && pause && debug 1 注:此功能已为被参数--test-key代替。 2.hiddenmenu命令增强。增加一个--chkpass参数 功能: 在隐藏菜单的时候按Esc键要输入正确的密码才可以显示菜单。 注意: 1.该功能启用之后,如果按了其它按键则直接启动默认菜单。 默认的Esc按键可以自由设置。使用--chkpass=KEY 2.菜单初始化有password命令时才需要输入密码。 3.按键代码如果不清楚可以使用上面的功能来获取。 例子: hiddenmenu --chkpass=0x8500 按F11键才可以显示菜单。 hiddenmenu --chkpass 按Esc键才可以显示菜单。 hiddenmenu --chkpass=0x2200 按Alt+G显示菜单。 2010-12-28 1.一些BUG修复. 2.PAUSE命令增加倒计时显示. 3.fsys_fb.sys代码微调. 2010-12-25 1.现在delmod也是一个内部命令. 2.重写insmod/delmod相关的代码.把加载的模块固定在内存18MB开始的位置. 2010-12-21 1.从command_func中分离出insmod作为一个内部命令存在. 现在允许insmod加载一个命令合集.(扩展名.mod) 例子: insmod grub4dos.mod 这个命令合集使用MAKEMOD程序生成. 2010-12-18 1.代码调整. cat添加一个参数--number=N 在查找替换的时候指定查找次数. 2010-12-17 1.fixed a bug in checkrange_func. 2010-12-16 1.修正使用批处理运行时可能会出现ERROR 25的错误. 2.重写批处理运行函数. 2010-12-15 1.还原2010-12-10对0000:82A4的改变. 2.为了方便使用当使用fbinst启动时有如下调整 boot_drive (bd) 为FB_DRIVE(ud) 默认root(saved_drive) 为可见分区. 3.为了减小压缩包的大小,改成用7z压缩发布. 2010-12-14 1.完善对ud(fbinst创建的分区)支持.现在不需要从fbinst启动也可以随意访问fbinst创建的分区. 2.允许在批处理中执行的外部命令调用goto/call标签. 2010-12-12 1.批处理添加exit命令.直接退出批处理.如果后面有数值则设置为errnum. 如exit 1,退出,并返回一个错误的值. 2.一些代码优化调整. 3.修改pause命令,现在的pause直接返回按键的ascii码值. 2010-12-11 1.完善批处理脚本参数的支持(同CMD下的批处理用法一样). 2.可以在菜单中使用goto命令(即跳到某个菜单项目). 3.delmod 添加参数-l用于显示已经加载的模块.如果-l后面还有参数则是判断该模块是否加载. 2010-12-10 1.改变了以下内存地址的定义(和之前的版本相反) 0000:82A4 4 (DWORD) no_decompression (no auto gunzip) 改成了 0000:82A4 4 (DWORD) do_decompression (do auto gunzip) 2.0x8284的值的bit2如果为1则显示解压进度,否则不显示,默认不显示. 3.完善了goto/call的功能 2010-12-09 1.批处理脚本支持标签(类拟BAT批处理). support goto/call and :label in batch script. CALL :label arguments goto label 2010-12-07 1.添加两个命令用于加载外部命令到内存中,加快运行速度. insmod path-to-program delmod program 2010-12-06 1.批处理脚本支持参数%0 - %9同cmd批处理用法一样。%~n 可以去掉前后的引号 2010-11-24 1.修正一个skip_to函数的bug。 fixed a bug in skip_to func,thanks tuxw. 2010-11-21 1.解决在(ud)上使用自动补全功能问题. http://bbs.znpc.net/viewthread.php?tid=5976 2010-11-19 supported pxe_dir list. 1.添加PXE(pd)文件列表的支持.TFTP ROOT 上的每个目录下都需要有dir.txt才支持. 可以使用以下命令生成dir.txt文件 for /r %i in (.) do (dir /a/b %i >%i\dir.txt) 2010-11-18 1.Fixed a bug in batch file,thanks Mr.zhaohj. http://bbs.wuyou.com/viewthread.php?tid=180142&page=9#pid2087407 2.Add a new variable at 0000:8278 for grub4dos version by date. e.g. read 0x8278 return 0x132B7FE (20101118) 3.Fixed a bug in find_func,thanks Mr.pseudo. 2010-11-17 1.重写command_func函数大部份代码。 为了方便外命命令的编写,修改主函数调用为以下格式。 int main (char *arg, int flags) 新的版本可以直接使用arg和flags参数,不需要再进行计算了。 2010-11-16 1.改进malloc/free函数。 2.允许执行多个外部命令(之前只允许一个),现在可以在外部命令里面调用其它外部命令。 外部命令调用方法使用builtin_cmd函数:builtin_cmd(char *cmd,char *arg,chat *flags); builtin_cmd(NULL,Command and parameters,flags); 2010-11-15 1.内置echo命令自动回车符改为"\r\n" 2.添加malloc/free函数. 2010-11-04 1.重写run_line(执行一行命令函数)。 支持操作符连用。例:  echo a | echo b | echo c | echo echo abcd > (md)0x300+1 && echo def 2.支持新的操作符">>"和">"一样,但这个会附加(附加在输出文件中的第一个字符串结束符'\0'后面)  注:目前这个操作符不会改变文件大小。 2.内置ECHO函数添加两个参数(默认回车不转义) -n 不自动添加回车符      -e 允许转义符 2010-10-28 1.some bug fixed. 2.find支持查找使用cdrom --init生成的光驱(只找第一个) 2010-10-27 1.修改printf函数,支持显示"%",和C语言的语法一样,使用"%%"来显示一个"%" 2.重写find的查询代码. 3.find新增参数--devices=[DEVICES],指定要查找的设备. 说明:DEVICES可以是以下字符的组合: u,p,n,h,c,f -->分别对应 ud,pd,nd,hd,cd,fd, 例子:--devices=hcf //只查找hd,cd,fd,从hd开始. 注:优先current root.然后再按上面的顺序.(current root必须在列表中,否则跳过) 可以使用这个参数来重新设定查找顺序,默认(find order):ud->pd->nd->hd->cd->fd 4.保留--ignore-cd和--ignore-floppies参数(会自动转换). 2010-10-26 1.find支持(fdx,y)的格式. 2.优先查找当前root. 2010-10-03 1.使用操作符"|"时默认自动添加空格,并解决使用"|"时可能导致死机或重启的问题。 2010-09-30 1.修正操作符号!失效的问题。 2.恢复内置菜单的大写MENU.LST为小写(保持兼容性)。 3.内置echo命令。 用法: echo [-P:[-]XX[-]YY] MESSAGE XX: Line number. YY: Column number. XXYY指定后面MESSAGE要显示的位置。 XX指定行号,YY指定列号。前导“-”,即倒数. 2010-09-25 1.修正calc计算的一个逻辑错误。 2.使用fbinst启动默认root设为ud set boot_drive to fb_drive(ud) if boot from fbinst. 3.添加一个新的命令initscript,只能用于菜单中。 initscript用于初始化菜单,每次返回菜单时在显示完菜单后执行。 有时候会需要这样的功能,比如执行某个菜单失败后返回菜单时重新执行一次初始化。 initscript /initscript.g4d 2010-09-25 1.简易计算器调整.如果没有"="则不保存计算结果,但++和--除外. 例子: calc *0x60000 + 4 不保存计算结果,所以内存指向*0x60000的值不会被改变. calc *0x60000++ 会保存计算结果到*0x60000中. calc *0x60000 = 1+2 同上. 2.如果当前已经是图形模式允许graphicsmode直接切换,而不用经过terminal console中转. 2010-09-16 1.修正一个产生Error 27的错误。 2010-09-06 1.添加操作符号"|" ">",输出重定向(有点类似DOS) Implemented two syntactic operators "|" and ">".Like Dos Output redirection. note: 1.use with "&&" and "||" ,the "|" and ">" must be at last. 2."|" and ">" can not use at same time. 例子: 1. pause abcd | pause efg output: efgabcd 2. pause 0x60000 | read #There is a space after the read. run read 0x60000 3.help > (hd0,0)/help.txt or help > (md)0x3000+2 help.txt must already exist,grub4dos cann't create file or change file size. 2010-09-05 1.修改TAB的显示方式,现在使用8个字节对齐显示。 2010-08-10 1.fixed a bug in disk_io.c,it may return error 25 when set root to a cd drive. 修正一个BUG,当设置root为cd设备时可能会提示Error 25的错误. 2.加快colinux下源码在cofs设备时编译的速度. 2010-06-21 1.打上支持新版FB的补丁 来源:http://www.burgloader.com/bbs/index.php?topic=37.30 2010-05-02 1.PXE启动时首先尝试加载root目录下的menu.lst。 2010-04-17 1.命令行自动完成调整.现在可以直接输入/+TAB显示当前目录下的文件或(hd0,0)/+TAB显示(hd0,0)/下面的文件列表 以前的版本必需要像以下命令才可以。 root /+TAB 2.get_cmdline函数调整,以方便外部命令直接调用。 2010-03-29 1.外部命令执行过程调整。 例子:默认path (bd)/grub/ echo abcd ## 优先使用(bd)/grub/echo 文件,如果没有再找 /echo 文件 /echo abcd ## 只查找/echo 文件。 (fd0)/echo abcd ## 只找 (fd0)/echo abcd 文件。 2.find 命令添加一个 --ignore-oem 参数。 http://code.google.com/p/grub4dos-ireneuszp/ 2010-03-10 1.边框位置自动调整。 2010-03-09 1.注释掉karyonix 4G GZIP MAP的部份代码。 2.添加UNIFONT外部命令,可以加载UNIFONT字库。当菜单文件是UTF8格式时可以显示多国语言。 Support multi-language menu with UNIFONT. 2010-03-01 1.打上了karyonix的4G map 补丁 http://bbs.znpc.net/viewthread.php?tid=5844 http://www.boot-land.net/forums/index.php?s=&showtopic=10096&view=findpost&p=91378 2.添加fontfile外部命令. 3.添加menuset外部命令. 2010-02-09 1.重写cmp部份代码(注:比较时可能会比较慢,因为只使用了1MB的缓存,之前的版本是完全缓存). 顺便添加了新参数 --skip= 可以指定在比较时跳过几个字节,用于cmp --hex时方便查看差异. 2010-02-05 1.添加calc简单计算器功能. calc [*INTEGER=] [*]INTEGER OPERATOR [[*]INTEGER] 具体使用方法参考这里的外部命令calc的用法,是一样的,只是内置了. http://www.chenall.com/blog/2010/02/grub4dos_calc.html 2010-01-13 修改设置默认可执行文件搜索路径参数为 --set-path=PATH 例子 command --set-path=(bd)/grub/ 2010-01-09 1.为command参数添加一个参数--set-root用于设置默认可执行文件的搜索路径。 add option --set-root for command sets a search PATH for executable files,default is (bd)/grub 2009-12-03 g@chenall.cn 1.修改了cat --hex代码,现在cat --hex会显示ascii>127的字符。 2.修改了cmp --hex代码,现在cmp --hex后面显示的字符同样可以显示中文。 并且添加了颜色控制,不同的地方使用了菜单的高亮色显示。 2009-12-01 g@chenall.cn 1.同步源码到2009-12-01版(修正了NTFS上DD或WRITE的问题) 2.修改调整了cat --replace,当使用--replace=*addr时允许使用--hex来指定读取长度。具体 http://bbs.znpc.net/viewthread.php?tid=5784&page=10&fromuid=29#pid42939 2009-11-29 g@chenall.cn 1.调整了chainloader功能,如果chainloader (rd)+1,并且没有指定edx设备,那将把当前设备设为EDX。 Changed chainloader_func,if use chainloader (rd)+1 then will set current_root to EDX 从光盘上的BOOTMGR启动硬盘上的VISTA/WIN7系统。 Boot VISTA/WIN7 from cdrom or any other device chainloader (cd)/BOOTMGR rootnoverify (hd0,0) dd if=(hd0,0)+1 of=(md)0x3E+1 现在可以直接使用以下方法来启动; You can now use the following commands.. map --mem=0xF000 /BOOTMGR find --set-root --ignore-cd --ignore-floppies /BOOT/BCD chainloader (rd)+1 http://bbs.znpc.net/viewthread.php?tid=5784&page=7&fromuid=29#pid42684 Tips:about EDX,please read README_GRUB4DOS.txt 2.源码同步到官方2009-11-29版。 2009-11-28 g@chenall.cn 1.修正了当内存>2G时访问可能会出错的问题. fixed a bug when access memory>2G problems. eg. cat --hex (md)0x40002F+1 map --mem (md)0x600000+0x19020 2009-11-26 g@chenall.cn 1.修改cmp_func代码,使用之使用十六进制显示差异偏移(为了方便对比使用)。 change cmp_func to show Differ at the offset with HEX 2.为cmp添加了一个参数--hex(直接显示十六进制) add --hex option for cmp 2009-11-24 g@chenall.cn 1.添加(bd)设备,即启动设备,注:使用configfile命令会改变启动设备。 added (bd) support.(bd):the boot drive. note:use configfile to change boot drive eg. boot from (hd0,0) now boot drive is (hd0,0) configfile (hd0,1)/menu.lst now boot drive is (hd0,1)

立即下载
7z文件
rtl8189es_r16m验证通过20170818_1659没有外层目录.7z

全志R16平台的Android6系统下调通rtl8189es 2017/8/28 9:41 版本:V1.1 1、干掉BT选项: Q:\r16m\rtl8189es_r16m\Android\device\softwinner\astar-evb30\overlay\frameworks\base\core\res\res\values\config.xml "bt-pan" 2、 Q:\r16m\rtl8189es_r16m\android\device\softwinner\astar-evb30\astar_evb30.mk $(call inherit-product, build/target/product/full_base.mk) $(call inherit-product, device/softwinner/astar-common/astar-common.mk) $(call inherit-product-if-exists, device/softwinner/astar-evb30/modules/modules.mk) DEVICE_PACKAGE_OVERLAYS := device/softwinner/astar-evb30/overlay \ $(DEVICE_PACKAGE_OVERLAYS) PRODUCT_PACKAGES += Launcher3 PRODUCT_PACKAGES += \ ESFileExplorer \ VideoPlayer #Bluetooth # PartnerChromeCustomizationsProvider PRODUCT_COPY_FILES += \ device/softwinner/astar-evb30/kernel:kernel \ device/softwinner/astar-evb30/fstab.sun8i:root/fstab.sun8i \ device/softwinner/astar-evb30/init.sun8i.rc:root/init.sun8i.rc \ device/softwinner/astar-evb30/init.recovery.sun8i.rc:root/init.recovery.sun8i.rc \ device/softwinner/astar-evb30/ueventd.sun8i.rc:root/ueventd.sun8i.rc \ device/softwinner/astar-evb30/recovery.fstab:recovery.fstab \ device/softwinner/astar-evb30/modules/modules/nand.ko:root/nand.ko \ device/softwinner/astar-evb30/modules/modules/disp.ko:root/disp.ko \ device/softwinner/astar-evb30/modules/modules/lcd.ko:root/lcd.ko \ device/softwinner/astar-evb30/modules/modules/gslX680new.ko:root/gslX680new.ko \ device/softwinner/astar-evb30/modules/modules/sunxi-keyboard.ko:root/sunxi-keyboard.ko \ device/softwinner/astar-evb30/modules/modules/sw-device.ko:root/sw-device.ko \ device/softwinner/astar-evb30/modules/modules/sunxi-keyboard.ko:obj/sunxi-keyboard.ko \ device/softwinner/astar-evb30/modules/modules/sw-device.ko:obj/sw-device.ko \ device/softwinner/astar-evb30/modules/modules/gslX680new.ko:obj/gslX680new.ko PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \ frameworks/native/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \ frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml #frameworks/native/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml # Low mem(memory <= 512M) device should not copy android.software.managed_users.xml #PRODUCT_COPY_FILES += \ # frameworks/native/data/etc/android.software.managed_users.xml:system/etc/permissions/android.software.managed_users.xml PRODUCT_COPY_FILES += \ device/softwinner/astar-evb30/configs/camera.cfg:system/etc/camera.cfg \ device/softwinner/astar-evb30/configs/gsensor.cfg:system/usr/gsensor.cfg \ device/softwinner/astar-evb30/configs/media_profiles.xml:system/etc/media_profiles.xml \ device/softwinner/astar-evb30/configs/sunxi-keyboard.kl:system/usr/keylayout/sunxi-keyboard.kl \ device/softwinner/astar-evb30/configs/tp.idc:system/usr/idc/tp.idc #PRODUCT_COPY_FILES += \ # device/softwinner/astar-evb30/bluetooth/bt_vendor.conf:system/etc/bluetooth/bt_vendor.conf # bootanimation PRODUCT_COPY_FILES += \ device/softwinner/astar-evb30/media/bootanimation.zip:system/media/bootanimation.zip # camera config for camera detector #PRODUCT_COPY_FILES += \ # device/softwinner/astar-evb30/hawkview/sensor_list_cfg.ini:system/etc/hawkview/sensor_list_cfg.ini # Radio Packages and Configuration Flie $(call inherit-product, device/softwinner/common/rild/radio_common.mk) #$(call inherit-product, device/softwinner/common/ril_modem/huawei/mu509/huawei_mu509.mk) #$(call inherit-product, device/softwinner/common/ril_modem/Oviphone/em55/oviphone_em55.mk) #PRODUCT_PROPERTY_OVERRIDES += \ # limit dex2oat threads to improve thermals PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.boot-dex2oat-threads=4 \ dalvik.vm.dex2oat-threads=3 \ dalvik.vm.image-dex2oat-threads=4 # Realtek wifi efuse map #PRODUCT_COPY_FILES += \ # device/softwinner/astar-d7/wifi_efuse_8723bs-vq0.map:system/etc/wifi/wifi_efuse_8723bs-vq0.map PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.dex2oat-flags=--no-watch-dog \ dalvik.vm.jit.codecachesize=0 \ ro.am.reschedule_service=true PRODUCT_PROPERTY_OVERRIDES += \ ro.frp.pst=/dev/block/by-name/frp PRODUCT_PROPERTY_OVERRIDES += \ persist.sys.usb.config=mass_storage,adb \ ro.adb.secure=0 \ ro.sys.mutedrm=true \ rw.logger=0 # A33 Media PRODUCT_PROPERTY_OVERRIDES += \ ro.config.media=1 PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapsize=384m \ dalvik.vm.heapstartsize=8m \ dalvik.vm.heapgrowthlimit=80m \ dalvik.vm.heaptargetutilization=0.75 \ dalvik.vm.heapminfree=512k \ dalvik.vm.heapmaxfree=8m \ ro.zygote.disable_gl_preload=false #PRODUCT_PROPERTY_OVERRIDES += \ # ro.config.low_ram=true PRODUCT_PROPERTY_OVERRIDES += \ ro.sf.lcd_density=213 PRODUCT_PROPERTY_OVERRIDES += \ persist.sys.timezone=Asia/Shanghai \ persist.sys.country=CN \ persist.sys.language=zh # stoarge PRODUCT_PROPERTY_OVERRIDES += \ persist.fw.force_adoptable=true PRODUCT_CHARACTERISTICS := tablet PRODUCT_AAPT_CONFIG := mdpi PRODUCT_AAPT_PREF_CONFIG := mdpi #$(call inherit-product-if-exists, vendor/google/products/gms_base.mk) #for 8723bs-vq0,should setmacaddr #PRODUCT_PACKAGES += setmacaddr PRODUCT_BRAND := Allwinner PRODUCT_NAME := astar_evb30 PRODUCT_DEVICE := astar-evb30 PRODUCT_MODEL := QUAD-CORE R16 evb30 PRODUCT_MANUFACTURER := Allwinner 3、在这里配置你所使用的WIFI+BT: Q:\r16m\rtl8189es_r16m\android\device\softwinner\astar-evb30\BoardConfig.mk # wifi and bt configuration # 1. Wifi Configuration # 1.1 realtek wifi support # 1.1 realtek wifi configuration # BOARD_USR_WIFI: rtl8188eu/rtl8723bs/rtl8723bs_vq0/rtl8723cs BOARD_WIFI_VENDOR := realtek ifeq ($(BOARD_WIFI_VENDOR), realtek) WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_DRIVER := NL80211 BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_rtl BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_rtl #BOARD_USR_WIFI := rtl8723bs_vq0 #BOARD_USR_WIFI := rtl8188eu BOARD_USR_WIFI := rtl8189es include hardware/realtek/wlan/config/config.mk endif # 1.2 broadcom wifi support #BOARD_WIFI_VENDOR := broadcom ifeq ($(BOARD_WIFI_VENDOR), broadcom) BOARD_WPA_SUPPLICANT_DRIVER := NL80211 WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_WLAN_DEVICE := bcmdhd WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/bcmdhd/parameters/firmware_path" BOARD_USR_WIFI := ap6212 include hardware/broadcom/wlan/bcmdhd/firmware/$(BOARD_USR_WIFI)/device-bcm.mk endif ## 2. Bluetooth Configuration ## make sure BOARD_HAVE_BLUETOOTH is true for every bt vendor #BOARD_HAVE_BLUETOOTH := true #BOARD_HAVE_BLUETOOTH_BCM := true #BOARD_HAVE_BLUETOOTH_NAME := ap6212 #BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/softwinner/astar-evb30/bluetooth TARGET_USE_BOOSTUP_OPZ := true 4、 Q:\r16m\rtl8189es_r16m\android\device\softwinner\astar-evb30\init.sun8i.rc ## bluetooth # # UART device # chmod 0660 /dev/ttyS1 # chown bluetooth net_bt_stack /dev/ttyS1 # # # power up/down interface # chmod 0660 /sys/class/rfkill/rfkill0/state # chmod 0660 /sys/class/rfkill/rfkill0/type # chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state # chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type # # # bluetooth MAC address programming # chown bluetooth net_bt_stack ro.bt.bdaddr_path # chown bluetooth net_bt_stack /system/etc/bluetooth # chown bluetooth net_bt_stack /data/misc/bluetooth # setprop ro.bt.bdaddr_path "/data/misc/bluetooth/bdaddr" # # # bluetooth LPM # chmod 0220 /proc/bluetooth/sleep/lpm # chmod 0220 /proc/bluetooth/sleep/btwrite # chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm # chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite ## broadcom wifi service ## 1 broadcom wifi sta service #service wpa_supplicant /system/bin/wpa_supplicant \ # -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ # -I/system/etc/wifi/wpa_supplicant_overlay.conf \ # -O/data/misc/wifi/sockets \ # -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 # # we will start as root and wpa_supplicant will switch to user wifi # # after setting up the capabilities required for WEXT # # user wifi # # group wifi inet keystore # class main # socket wpa_wlan0 dgram 660 wifi wifi # disabled # oneshot # ## 2 broadcom wifi sta p2p concurrent service #service p2p_supplicant /system/bin/wpa_supplicant \ # -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ # -I/system/etc/wifi/wpa_supplicant_overlay.conf \ # -O/data/misc/wifi/sockets -N \ # -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ # -I/system/etc/wifi/p2p_supplicant_overlay.conf \ # -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \ # -g@android:wpa_wlan0 # # we will start as root and wpa_supplicant will switch to user wifi # # after setting up the capabilities required for WEXT # # user wifi # # group wifi inet keystore # class main # socket wpa_wlan0 dgram 660 wifi wifi # disabled # oneshot # realtek wifi service service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -O/data/misc/wifi/sockets \ -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot # 1.2 realtek wifi sta p2p concurrent service service p2p_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \ -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ -e/data/misc/wifi/entropy.bin -N \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -O/data/misc/wifi/sockets \ -g@android:wpa_wlan0 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot 5、可选:为了调试方便 Q:\r16m\rtl8189es_r16m\android\frameworks\base\packages\SettingsProvider\res\values\defaults.xml 60000 false 修改为: 1800000 true 6、解决编译不过的问题。rtl8189es没有BT: Q:\r16m\rtl8189es_r16m\android\hardware\realtek\bluetooth\firmware\rtlbtfw_cfg.mk PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/rtl8723a_fw:system/etc/firmware/rtl8723as_fw \ $(LOCAL_PATH)/rtl8723a_config:system/etc/firmware/rtl8723as_config \ $(LOCAL_PATH)/rtl8723b_fw:system/etc/firmware/rtl8723bs_fw \ $(LOCAL_PATH)/rtl8723b_config:system/etc/firmware/rtl8723bs_config \ $(LOCAL_PATH)/rtl8723b_VQ0_fw:system/etc/firmware/rtl8723bs_VQ0_fw \ $(LOCAL_PATH)/rtl8723b_VQ0_config:system/etc/firmware/rtl8723bs_VQ0_config \ $(LOCAL_PATH)/rtl8723cs_xx_fw:system/etc/firmware/rtl8723cs_xx_fw \ $(LOCAL_PATH)/rtl8723cs_xx_config:system/etc/firmware/rtl8723cs_xx_config \ $(LOCAL_PATH)/rtl8723cs_cg_fw:system/etc/firmware/rtl8723cs_cg_fw \ $(LOCAL_PATH)/rtl8723cs_cg_config:system/etc/firmware/rtl8723cs_cg_config \ $(LOCAL_PATH)/rtl8723cs_vf_fw:system/etc/firmware/rtl8723cs_vf_fw \ $(LOCAL_PATH)/rtl8723cs_vf_config:system/etc/firmware/rtl8723cs_vf_config \ $(LOCAL_PATH)/rtl8703b_fw:system/etc/firmware/rtl8703bs_fw \ $(LOCAL_PATH)/rtl8703b_config:system/etc/firmware/rtl8703bs_config #$(TOP_DIR)device/softwinner/$(basename $(TARGET_DEVICE))/bluetooth/rtkbt.conf:system/etc/bluetooth/rtkbt.conf \ 7、默认的BSP没有加载rtl8189es Q:\r16m\rtl8189es_r16m\android\hardware\libhardware_legacy\wifi\Android.mk # realtek sdio wifi module ifeq ($(BOARD_USR_WIFI), rtl8189fs) LOCAL_CFLAGS += -DRTL_8189FS_WIFI_USED LOCAL_CFLAGS += -DRTL_WIFI_VENDOR endif # realtek sdio wifi module ifeq ($(BOARD_USR_WIFI), rtl8189es) LOCAL_CFLAGS += -DRTL_8189ES_WIFI_USED LOCAL_CFLAGS += -DRTL_WIFI_VENDOR endif Q:\r16m\rtl8189es_r16m\android\hardware\libhardware_legacy\wifi\wifi.c #elif defined RTL_8189FS_WIFI_USED /* rtl8189FS sdio wifi */ #ifndef WIFI_DRIVER_MODULE_PATH #define WIFI_DRIVER_MODULE_PATH "/system/vendor/modules/8189fs.ko" #endif #ifndef WIFI_DRIVER_MODULE_NAME #define WIFI_DRIVER_MODULE_NAME "8189fs" #endif #ifndef WIFI_DRIVER_MODULE_ARG #define WIFI_DRIVER_MODULE_ARG "ifname=wlan0 if2name=p2p0" #endif #elif defined RTL_8189ES_WIFI_USED /* rtl8189ES sdio wifi */ #ifndef WIFI_DRIVER_MODULE_PATH #define WIFI_DRIVER_MODULE_PATH "/system/vendor/modules/8189es.ko" #endif #ifndef WIFI_DRIVER_MODULE_NAME #define WIFI_DRIVER_MODULE_NAME "8189es" #endif #ifndef WIFI_DRIVER_MODULE_ARG #define WIFI_DRIVER_MODULE_ARG "ifname=wlan0 if2name=p2p0" #endif #elif defined ESPRESSIF_ESP8089_WIFI_USED /* esp8089 sdio wifi */ #ifndef WIFI_DRIVER_MODULE_PATH #define WIFI_DRIVER_MODULE_PATH "/system/vendor/modules/esp8089.ko" #endif #ifndef WIFI_DRIVER_MODULE_NAME #define WIFI_DRIVER_MODULE_NAME "esp8089" #endif #ifndef WIFI_DRIVER_MODULE_ARG #define WIFI_DRIVER_MODULE_ARG "" #endif #endif 8、WIFI+BT的驱动识别: Q:\r16m\rtl8189es_r16m\lichee\Linux-3.4\drivers\misc\rf_pm\bt_pm.c static int rfkill_set_power(void *data, bool blocked) { unsigned int mod_sel = get_rf_mod_type(); RF_MSG("rfkill set power %d\n", !blocked); switch (mod_sel){ case 2: /* ap6210 */ case 5: /* rtl8723bs */ case 7: /* ap6476 */ case 8: /* ap6330 */ case 9: /* gb9663 */ case 10: /* ap6212 */ if (!blocked) { if(bt_rst_n != -1) gpio_set_value(bt_rst_n, 1); } else { if(bt_rst_n != -1) gpio_set_value(bt_rst_n, 0); } break; default: RF_MSG("no bt module matched !!\n"); } bt_state = !blocked; msleep(10); return 0; } Q:\r16m\rtl8189es_r16m\lichee\linux-3.4\drivers\misc\rf_pm\rf_pm.c char *module_list[] = { " ", "ap6181", "ap6210", "rtl8188eu", "rtl8723au", "rtl8723bs", "esp8089", "ap6476", "ap6330", "gb9663", "ap6212", "rtl8189es" }; static int rf_pm_probe(struct platform_device *pdev) { get_module_res(); if (mod_info.num <= 0) return -1; //moduls power init switch(mod_info.num){ case 1: /* ap6181 */ case 2: /* ap6210 */ case 5: /* rtl8723bs */ case 6: /* esp8089 */ case 7: /* ap6476 */ case 8: /* ap6330 */ case 9: /* gb9663 */ case 10: /* ap6212 */ case 11: /* rtl8189es */ rf_module_power(1); break; case 3: /* rtl8188eu */ case 4: /* rtl8723au */ rf_module_power(0); break; default: rf_pm_msg("wrong module select %d !\n", mod_info.num); } //opt ap 32k if(mod_info.lpo_use_apclk && strcmp(mod_info.lpo_use_apclk, "")){ ap_32k = clk_get(NULL, mod_info.lpo_use_apclk); if (!ap_32k || IS_ERR(ap_32k)){ rf_pm_msg("get clk %s failed!\n", mod_info.lpo_use_apclk); return -1; } rf_pm_msg("set %s 32k out\n", mod_info.lpo_use_apclk); enable_ap_32k(1); } scene_lock_init(&gpio_hold_standby, SCENE_GPIO_HOLD_STANDBY, "rf_pm"); return 0; } Q:\r16m\rtl8189es_r16m\lichee\linux-3.4\drivers\misc\rf_pm\wifi_pm.c void wifi_pm_power(int on) { int mod_num = get_rf_mod_type(); int on_off = 0; if (on > 0){ on_off = 1; } else { on_off = 0; } wifi_pm_msg("wifi power %s\n", on?"on":"off"); switch(mod_num){ case 1: /* ap6181 */ case 2: /* ap6210 */ case 5: /* rtl8723bs */ case 6: /* esp8089 */ case 7: /* ap6476 */ case 8: /* ap6330 */ case 9: /* gb9663*/ case 10: /* ap6212 */ case 11: /* rtl8189es */ if (wl_info.wl_reg_on != -1) gpio_set_value(wl_info.wl_reg_on, on_off); break; case 3: /* rtl8188eu */ rf_module_power(on_off); break; case 4: /* rtl8723au */ break; default: wifi_pm_msg("wrong module select %d !\n", mod_num); } wl_info.wl_power_state = on_off; wifi_state = on_off; } EXPORT_SYMBOL(wifi_pm_power); 9、直接使用全志R16平台的parrot v1.1系统下的rtl8189es驱动代替。Android6.0.1自带的驱动貌似有问题! Q:\r16m\rtl8189es_r16m\lichee\linux-3.4\drivers\net\wireless\rtl8189es\ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m$ 7za x rtl8189es_r16m验证通过20170818_1659没有外层目录.7z -r -o./ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m$ cd lichee/linux-3.4/drivers/net/wireless/ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m/lichee/linux-3.4/drivers/net/wireless$ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m/lichee/linux-3.4/drivers/net/wireless$ rm rtl8189es -rf rootroot@rootroot-E400:~/wyb/rtl8189es_r16m/lichee/linux-3.4/drivers/net/wireless$ tar zxvf rtl8189es4.tar.gz 10、可选操作:为了调试方便 Q:\r16m\rtl8189es_r16m\lichee\tools\pack\chips\sun8iw5p1\configs\default\env.cfg #kernel command arguments console=ttyS0,115200 nand_root=/dev/nandd mmc_root=/dev/mmcblk0p7 init=/init loglevel=8 #set kernel cmdline if boot.img or recovery.img has no cmdline we will use this setargs_nand=setenv bootargs console=${console} root=${nand_root} init=${init} ion_cma_list="120m,256m" loglevel=${loglevel} partitions=${partitions} setargs_mmc=setenv bootargs console=${console} root=${mmc_root} init=${init} ion_cma_list="120m,256m" loglevel=${loglevel} partitions=${partitions} #nand command syntax: sunxi_flash read address partition_name read_bytes #0x40007800 = 0x40008000(kernel entry) - 0x800(boot.img header 2k) boot_normal=sunxi_flash read 40007800 boot;boota 40007800 boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800 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 11、 Q:\r16m\rtl8189es_r16m\lichee\tools\pack\chips\sun8iw5p1\configs\evb-30\sys_config.fex ;--------------------------------------------------------------------------------------------------------- ; wakeup_src_para: ; sometimes, u would like to add more wakeup src in standby mode, these para will be ; help; ; u need to make sure the standby mode support the wakeup src. Also, some hw ; condition must be guaranteed. ; including: ; cpu_en: power on or off. ; 1: mean power on ; 0: mean power off ; cpu_freq: indicating lowest freq. unit is Mhz; ; dram selfresh_en: selfresh or not. ; 1: enable enter selfresh ; 0: disable enter selfresh ; dram_pll: if not enter selfresh, indicating lowest freq. unit is Mhz; ; wakeup_src: to make the scenario work, the wakeup src is needed. ;--------------------------------------------------------------------------------------------------------- [wakeup_src_para] cpu_en = 0 cpu_freq = 48 ; (cpu:apb:ahb) pll_ratio = 0x111 dram_selfresh_en= 1 dram_freq = 36 wakeup_src_wl = port:PL07<4><0> ;wakeup_src_bt = port:PL09<4><0> bb_wake_ap = port:PL02<4><0> ;-------------------------------------------------------------------------------- ;wifi/bt/fm/gps/nfc modules configuration ;module_num: ; 0- none ; 1- ap6181(wifi) ; 2- ap6210/ap6212(wifi+bt) ; 3- rtl8188eu(wifi) ; 4- rtl8723au(wifi+bt) ; 5- rtl8723bs/rtl8723bs-vq0(wifi+bt) ; 6- esp8089(wifi) ; 7- ap6476(wifi+bt+fm+gps) ; 8- ap6330(wifi+bt+fm) ; 9- gb9663(wifi+bt+fm) ; 10- ap6212(wifi+bt) ; 11- rtl8189es(wifi) ;module_power1: ""- bat, "axp_dldo1"- axp dldo1 ;module_power1_vol: power1 voltage, mv; not used for module_power1 is "" ;module_power2: ""- bat, "axp_dldo2"- axp dldo2 ;module_power2_vol: power2 voltage, mv; not used for module_power2 is "" ;module_power3: ""- bat, "axp_dldo2"- axp dldo2 ;module_power3_vol: power3 voltage, mv; not used for module_power3 is "" ;power_switch: module power switch io when bat supply ;chip_en: enable chip io ;lpo_use_apclk: ""- not use, "losc_out"- a23/33, "ac10032k1"?"ac10032k2"?"ac10032k3"- a80/a83 ;-------------------------------------------------------------------------------- [rf_para] module_num = 11 module_power1 = "axp22_dldo1" module_power1_vol = 3300000 module_power2 = "axp22_dldo2" module_power2_vol = 3300000 module_power3 = "axp22_aldo1" module_power3_vol = 3300000 power_switch = chip_en = lpo_use_apclk = "losc_out" ;-------------------------------------------------------------------------------- ;wifi configuration ;wifi_used: 0-not use, 1- use ;wifi_sdc_id: 0- SDC0, 1- SDC1, 2- SDC2, 3- SDC3 ;wifi_usbc_id: 0- USB0, 1- USB1, 2- USB2 ;wifi_usbc_type: 1- EHCI(speed 2.0), 2- OHCI(speed 1.0) ;wl_reg_on: wifi function enable io ;wl_host_wake: wifi device wake-up host ;wl_host_wake_invert: whether wl_host_wake use inverter between ap and module ; 0: not used, 1: used ;-------------------------------------------------------------------------------- [wifi_para] wifi_used = 1 wifi_sdc_id = 1 wifi_usbc_id = 1 wifi_usbc_type = 1 wl_reg_on = port:PL06<1><0> wl_host_wake = port:PL07<4><0> rtl8189es_host_wake = port:PL07<4><0> wl_host_wake_invert = 0 ;-------------------------------------------------------------------------------- ;bluetooth configuration ;bt_used: 0- no used, 1- used ;bt_uard_id: 0- uart0, 1- uart1, 2- uart2 ;bt_rst_n: bt function enable io ;bt_wake: host wake-up bluetooth device ;bt_wak_host: bt device wake-up host ;bt_host_wake_invert: whether bt_host_wake use inverter between ap and module ; 0: not used, 1: used ;-------------------------------------------------------------------------------- [bt_para] bt_used = 0 ;bt_uart_id = 1 ;bt_rst_n = port:PL08<1><0> ;bt_wake = port:PL10<1><0> ;bt_host_wake = port:PL09<4><0> ;bt_host_wake_invert = 0 power_start = 3 pmu_temp_enable = 0

立即下载
zip文件
!!!!rtl8189es_r16m验证通过20170818_1659没有外层目录.zip

全志R16平台的Android6系统下调通rtl8189es 2017/8/28 9:41 版本:V1.1 1、干掉BT选项: Q:\r16m\rtl8189es_r16m\Android\device\softwinner\astar-evb30\overlay\frameworks\base\core\res\res\values\config.xml "bt-pan" 2、 Q:\r16m\rtl8189es_r16m\android\device\softwinner\astar-evb30\astar_evb30.mk $(call inherit-product, build/target/product/full_base.mk) $(call inherit-product, device/softwinner/astar-common/astar-common.mk) $(call inherit-product-if-exists, device/softwinner/astar-evb30/modules/modules.mk) DEVICE_PACKAGE_OVERLAYS := device/softwinner/astar-evb30/overlay \ $(DEVICE_PACKAGE_OVERLAYS) PRODUCT_PACKAGES += Launcher3 PRODUCT_PACKAGES += \ ESFileExplorer \ VideoPlayer #Bluetooth # PartnerChromeCustomizationsProvider PRODUCT_COPY_FILES += \ device/softwinner/astar-evb30/kernel:kernel \ device/softwinner/astar-evb30/fstab.sun8i:root/fstab.sun8i \ device/softwinner/astar-evb30/init.sun8i.rc:root/init.sun8i.rc \ device/softwinner/astar-evb30/init.recovery.sun8i.rc:root/init.recovery.sun8i.rc \ device/softwinner/astar-evb30/ueventd.sun8i.rc:root/ueventd.sun8i.rc \ device/softwinner/astar-evb30/recovery.fstab:recovery.fstab \ device/softwinner/astar-evb30/modules/modules/nand.ko:root/nand.ko \ device/softwinner/astar-evb30/modules/modules/disp.ko:root/disp.ko \ device/softwinner/astar-evb30/modules/modules/lcd.ko:root/lcd.ko \ device/softwinner/astar-evb30/modules/modules/gslX680new.ko:root/gslX680new.ko \ device/softwinner/astar-evb30/modules/modules/sunxi-keyboard.ko:root/sunxi-keyboard.ko \ device/softwinner/astar-evb30/modules/modules/sw-device.ko:root/sw-device.ko \ device/softwinner/astar-evb30/modules/modules/sunxi-keyboard.ko:obj/sunxi-keyboard.ko \ device/softwinner/astar-evb30/modules/modules/sw-device.ko:obj/sw-device.ko \ device/softwinner/astar-evb30/modules/modules/gslX680new.ko:obj/gslX680new.ko PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \ frameworks/native/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \ frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml #frameworks/native/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml # Low mem(memory <= 512M) device should not copy android.software.managed_users.xml #PRODUCT_COPY_FILES += \ # frameworks/native/data/etc/android.software.managed_users.xml:system/etc/permissions/android.software.managed_users.xml PRODUCT_COPY_FILES += \ device/softwinner/astar-evb30/configs/camera.cfg:system/etc/camera.cfg \ device/softwinner/astar-evb30/configs/gsensor.cfg:system/usr/gsensor.cfg \ device/softwinner/astar-evb30/configs/media_profiles.xml:system/etc/media_profiles.xml \ device/softwinner/astar-evb30/configs/sunxi-keyboard.kl:system/usr/keylayout/sunxi-keyboard.kl \ device/softwinner/astar-evb30/configs/tp.idc:system/usr/idc/tp.idc #PRODUCT_COPY_FILES += \ # device/softwinner/astar-evb30/bluetooth/bt_vendor.conf:system/etc/bluetooth/bt_vendor.conf # bootanimation PRODUCT_COPY_FILES += \ device/softwinner/astar-evb30/media/bootanimation.zip:system/media/bootanimation.zip # camera config for camera detector #PRODUCT_COPY_FILES += \ # device/softwinner/astar-evb30/hawkview/sensor_list_cfg.ini:system/etc/hawkview/sensor_list_cfg.ini # Radio Packages and Configuration Flie $(call inherit-product, device/softwinner/common/rild/radio_common.mk) #$(call inherit-product, device/softwinner/common/ril_modem/huawei/mu509/huawei_mu509.mk) #$(call inherit-product, device/softwinner/common/ril_modem/Oviphone/em55/oviphone_em55.mk) #PRODUCT_PROPERTY_OVERRIDES += \ # limit dex2oat threads to improve thermals PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.boot-dex2oat-threads=4 \ dalvik.vm.dex2oat-threads=3 \ dalvik.vm.image-dex2oat-threads=4 # Realtek wifi efuse map #PRODUCT_COPY_FILES += \ # device/softwinner/astar-d7/wifi_efuse_8723bs-vq0.map:system/etc/wifi/wifi_efuse_8723bs-vq0.map PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.dex2oat-flags=--no-watch-dog \ dalvik.vm.jit.codecachesize=0 \ ro.am.reschedule_service=true PRODUCT_PROPERTY_OVERRIDES += \ ro.frp.pst=/dev/block/by-name/frp PRODUCT_PROPERTY_OVERRIDES += \ persist.sys.usb.config=mass_storage,adb \ ro.adb.secure=0 \ ro.sys.mutedrm=true \ rw.logger=0 # A33 Media PRODUCT_PROPERTY_OVERRIDES += \ ro.config.media=1 PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapsize=384m \ dalvik.vm.heapstartsize=8m \ dalvik.vm.heapgrowthlimit=80m \ dalvik.vm.heaptargetutilization=0.75 \ dalvik.vm.heapminfree=512k \ dalvik.vm.heapmaxfree=8m \ ro.zygote.disable_gl_preload=false #PRODUCT_PROPERTY_OVERRIDES += \ # ro.config.low_ram=true PRODUCT_PROPERTY_OVERRIDES += \ ro.sf.lcd_density=213 PRODUCT_PROPERTY_OVERRIDES += \ persist.sys.timezone=Asia/Shanghai \ persist.sys.country=CN \ persist.sys.language=zh # stoarge PRODUCT_PROPERTY_OVERRIDES += \ persist.fw.force_adoptable=true PRODUCT_CHARACTERISTICS := tablet PRODUCT_AAPT_CONFIG := mdpi PRODUCT_AAPT_PREF_CONFIG := mdpi #$(call inherit-product-if-exists, vendor/google/products/gms_base.mk) #for 8723bs-vq0,should setmacaddr #PRODUCT_PACKAGES += setmacaddr PRODUCT_BRAND := Allwinner PRODUCT_NAME := astar_evb30 PRODUCT_DEVICE := astar-evb30 PRODUCT_MODEL := QUAD-CORE R16 evb30 PRODUCT_MANUFACTURER := Allwinner 3、在这里配置你所使用的WIFI+BT: Q:\r16m\rtl8189es_r16m\android\device\softwinner\astar-evb30\BoardConfig.mk # wifi and bt configuration # 1. Wifi Configuration # 1.1 realtek wifi support # 1.1 realtek wifi configuration # BOARD_USR_WIFI: rtl8188eu/rtl8723bs/rtl8723bs_vq0/rtl8723cs BOARD_WIFI_VENDOR := realtek ifeq ($(BOARD_WIFI_VENDOR), realtek) WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_DRIVER := NL80211 BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_rtl BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_rtl #BOARD_USR_WIFI := rtl8723bs_vq0 #BOARD_USR_WIFI := rtl8188eu BOARD_USR_WIFI := rtl8189es include hardware/realtek/wlan/config/config.mk endif # 1.2 broadcom wifi support #BOARD_WIFI_VENDOR := broadcom ifeq ($(BOARD_WIFI_VENDOR), broadcom) BOARD_WPA_SUPPLICANT_DRIVER := NL80211 WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_WLAN_DEVICE := bcmdhd WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/bcmdhd/parameters/firmware_path" BOARD_USR_WIFI := ap6212 include hardware/broadcom/wlan/bcmdhd/firmware/$(BOARD_USR_WIFI)/device-bcm.mk endif ## 2. Bluetooth Configuration ## make sure BOARD_HAVE_BLUETOOTH is true for every bt vendor #BOARD_HAVE_BLUETOOTH := true #BOARD_HAVE_BLUETOOTH_BCM := true #BOARD_HAVE_BLUETOOTH_NAME := ap6212 #BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/softwinner/astar-evb30/bluetooth TARGET_USE_BOOSTUP_OPZ := true 4、 Q:\r16m\rtl8189es_r16m\android\device\softwinner\astar-evb30\init.sun8i.rc ## bluetooth # # UART device # chmod 0660 /dev/ttyS1 # chown bluetooth net_bt_stack /dev/ttyS1 # # # power up/down interface # chmod 0660 /sys/class/rfkill/rfkill0/state # chmod 0660 /sys/class/rfkill/rfkill0/type # chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state # chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type # # # bluetooth MAC address programming # chown bluetooth net_bt_stack ro.bt.bdaddr_path # chown bluetooth net_bt_stack /system/etc/bluetooth # chown bluetooth net_bt_stack /data/misc/bluetooth # setprop ro.bt.bdaddr_path "/data/misc/bluetooth/bdaddr" # # # bluetooth LPM # chmod 0220 /proc/bluetooth/sleep/lpm # chmod 0220 /proc/bluetooth/sleep/btwrite # chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm # chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite ## broadcom wifi service ## 1 broadcom wifi sta service #service wpa_supplicant /system/bin/wpa_supplicant \ # -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ # -I/system/etc/wifi/wpa_supplicant_overlay.conf \ # -O/data/misc/wifi/sockets \ # -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 # # we will start as root and wpa_supplicant will switch to user wifi # # after setting up the capabilities required for WEXT # # user wifi # # group wifi inet keystore # class main # socket wpa_wlan0 dgram 660 wifi wifi # disabled # oneshot # ## 2 broadcom wifi sta p2p concurrent service #service p2p_supplicant /system/bin/wpa_supplicant \ # -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ # -I/system/etc/wifi/wpa_supplicant_overlay.conf \ # -O/data/misc/wifi/sockets -N \ # -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ # -I/system/etc/wifi/p2p_supplicant_overlay.conf \ # -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \ # -g@android:wpa_wlan0 # # we will start as root and wpa_supplicant will switch to user wifi # # after setting up the capabilities required for WEXT # # user wifi # # group wifi inet keystore # class main # socket wpa_wlan0 dgram 660 wifi wifi # disabled # oneshot # realtek wifi service service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -O/data/misc/wifi/sockets \ -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot # 1.2 realtek wifi sta p2p concurrent service service p2p_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \ -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ -e/data/misc/wifi/entropy.bin -N \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -O/data/misc/wifi/sockets \ -g@android:wpa_wlan0 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot 5、可选:为了调试方便 Q:\r16m\rtl8189es_r16m\android\frameworks\base\packages\SettingsProvider\res\values\defaults.xml 60000 false 修改为: 1800000 true 6、解决编译不过的问题。rtl8189es没有BT: Q:\r16m\rtl8189es_r16m\android\hardware\realtek\bluetooth\firmware\rtlbtfw_cfg.mk PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/rtl8723a_fw:system/etc/firmware/rtl8723as_fw \ $(LOCAL_PATH)/rtl8723a_config:system/etc/firmware/rtl8723as_config \ $(LOCAL_PATH)/rtl8723b_fw:system/etc/firmware/rtl8723bs_fw \ $(LOCAL_PATH)/rtl8723b_config:system/etc/firmware/rtl8723bs_config \ $(LOCAL_PATH)/rtl8723b_VQ0_fw:system/etc/firmware/rtl8723bs_VQ0_fw \ $(LOCAL_PATH)/rtl8723b_VQ0_config:system/etc/firmware/rtl8723bs_VQ0_config \ $(LOCAL_PATH)/rtl8723cs_xx_fw:system/etc/firmware/rtl8723cs_xx_fw \ $(LOCAL_PATH)/rtl8723cs_xx_config:system/etc/firmware/rtl8723cs_xx_config \ $(LOCAL_PATH)/rtl8723cs_cg_fw:system/etc/firmware/rtl8723cs_cg_fw \ $(LOCAL_PATH)/rtl8723cs_cg_config:system/etc/firmware/rtl8723cs_cg_config \ $(LOCAL_PATH)/rtl8723cs_vf_fw:system/etc/firmware/rtl8723cs_vf_fw \ $(LOCAL_PATH)/rtl8723cs_vf_config:system/etc/firmware/rtl8723cs_vf_config \ $(LOCAL_PATH)/rtl8703b_fw:system/etc/firmware/rtl8703bs_fw \ $(LOCAL_PATH)/rtl8703b_config:system/etc/firmware/rtl8703bs_config #$(TOP_DIR)device/softwinner/$(basename $(TARGET_DEVICE))/bluetooth/rtkbt.conf:system/etc/bluetooth/rtkbt.conf \ 7、默认的BSP没有加载rtl8189es Q:\r16m\rtl8189es_r16m\android\hardware\libhardware_legacy\wifi\Android.mk # realtek sdio wifi module ifeq ($(BOARD_USR_WIFI), rtl8189fs) LOCAL_CFLAGS += -DRTL_8189FS_WIFI_USED LOCAL_CFLAGS += -DRTL_WIFI_VENDOR endif # realtek sdio wifi module ifeq ($(BOARD_USR_WIFI), rtl8189es) LOCAL_CFLAGS += -DRTL_8189ES_WIFI_USED LOCAL_CFLAGS += -DRTL_WIFI_VENDOR endif Q:\r16m\rtl8189es_r16m\android\hardware\libhardware_legacy\wifi\wifi.c #elif defined RTL_8189FS_WIFI_USED /* rtl8189FS sdio wifi */ #ifndef WIFI_DRIVER_MODULE_PATH #define WIFI_DRIVER_MODULE_PATH "/system/vendor/modules/8189fs.ko" #endif #ifndef WIFI_DRIVER_MODULE_NAME #define WIFI_DRIVER_MODULE_NAME "8189fs" #endif #ifndef WIFI_DRIVER_MODULE_ARG #define WIFI_DRIVER_MODULE_ARG "ifname=wlan0 if2name=p2p0" #endif #elif defined RTL_8189ES_WIFI_USED /* rtl8189ES sdio wifi */ #ifndef WIFI_DRIVER_MODULE_PATH #define WIFI_DRIVER_MODULE_PATH "/system/vendor/modules/8189es.ko" #endif #ifndef WIFI_DRIVER_MODULE_NAME #define WIFI_DRIVER_MODULE_NAME "8189es" #endif #ifndef WIFI_DRIVER_MODULE_ARG #define WIFI_DRIVER_MODULE_ARG "ifname=wlan0 if2name=p2p0" #endif #elif defined ESPRESSIF_ESP8089_WIFI_USED /* esp8089 sdio wifi */ #ifndef WIFI_DRIVER_MODULE_PATH #define WIFI_DRIVER_MODULE_PATH "/system/vendor/modules/esp8089.ko" #endif #ifndef WIFI_DRIVER_MODULE_NAME #define WIFI_DRIVER_MODULE_NAME "esp8089" #endif #ifndef WIFI_DRIVER_MODULE_ARG #define WIFI_DRIVER_MODULE_ARG "" #endif #endif 8、WIFI+BT的驱动识别: Q:\r16m\rtl8189es_r16m\lichee\Linux-3.4\drivers\misc\rf_pm\bt_pm.c static int rfkill_set_power(void *data, bool blocked) { unsigned int mod_sel = get_rf_mod_type(); RF_MSG("rfkill set power %d\n", !blocked); switch (mod_sel){ case 2: /* ap6210 */ case 5: /* rtl8723bs */ case 7: /* ap6476 */ case 8: /* ap6330 */ case 9: /* gb9663 */ case 10: /* ap6212 */ if (!blocked) { if(bt_rst_n != -1) gpio_set_value(bt_rst_n, 1); } else { if(bt_rst_n != -1) gpio_set_value(bt_rst_n, 0); } break; default: RF_MSG("no bt module matched !!\n"); } bt_state = !blocked; msleep(10); return 0; } Q:\r16m\rtl8189es_r16m\lichee\linux-3.4\drivers\misc\rf_pm\rf_pm.c char *module_list[] = { " ", "ap6181", "ap6210", "rtl8188eu", "rtl8723au", "rtl8723bs", "esp8089", "ap6476", "ap6330", "gb9663", "ap6212", "rtl8189es" }; static int rf_pm_probe(struct platform_device *pdev) { get_module_res(); if (mod_info.num <= 0) return -1; //moduls power init switch(mod_info.num){ case 1: /* ap6181 */ case 2: /* ap6210 */ case 5: /* rtl8723bs */ case 6: /* esp8089 */ case 7: /* ap6476 */ case 8: /* ap6330 */ case 9: /* gb9663 */ case 10: /* ap6212 */ case 11: /* rtl8189es */ rf_module_power(1); break; case 3: /* rtl8188eu */ case 4: /* rtl8723au */ rf_module_power(0); break; default: rf_pm_msg("wrong module select %d !\n", mod_info.num); } //opt ap 32k if(mod_info.lpo_use_apclk && strcmp(mod_info.lpo_use_apclk, "")){ ap_32k = clk_get(NULL, mod_info.lpo_use_apclk); if (!ap_32k || IS_ERR(ap_32k)){ rf_pm_msg("get clk %s failed!\n", mod_info.lpo_use_apclk); return -1; } rf_pm_msg("set %s 32k out\n", mod_info.lpo_use_apclk); enable_ap_32k(1); } scene_lock_init(&gpio_hold_standby, SCENE_GPIO_HOLD_STANDBY, "rf_pm"); return 0; } Q:\r16m\rtl8189es_r16m\lichee\linux-3.4\drivers\misc\rf_pm\wifi_pm.c void wifi_pm_power(int on) { int mod_num = get_rf_mod_type(); int on_off = 0; if (on > 0){ on_off = 1; } else { on_off = 0; } wifi_pm_msg("wifi power %s\n", on?"on":"off"); switch(mod_num){ case 1: /* ap6181 */ case 2: /* ap6210 */ case 5: /* rtl8723bs */ case 6: /* esp8089 */ case 7: /* ap6476 */ case 8: /* ap6330 */ case 9: /* gb9663*/ case 10: /* ap6212 */ case 11: /* rtl8189es */ if (wl_info.wl_reg_on != -1) gpio_set_value(wl_info.wl_reg_on, on_off); break; case 3: /* rtl8188eu */ rf_module_power(on_off); break; case 4: /* rtl8723au */ break; default: wifi_pm_msg("wrong module select %d !\n", mod_num); } wl_info.wl_power_state = on_off; wifi_state = on_off; } EXPORT_SYMBOL(wifi_pm_power); 9、直接使用全志R16平台的parrot v1.1系统下的rtl8189es驱动代替。Android6.0.1自带的驱动貌似有问题! Q:\r16m\rtl8189es_r16m\lichee\linux-3.4\drivers\net\wireless\rtl8189es\ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m$ 7za x rtl8189es_r16m验证通过20170818_1659没有外层目录.7z -r -o./ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m$ cd lichee/linux-3.4/drivers/net/wireless/ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m/lichee/linux-3.4/drivers/net/wireless$ rootroot@rootroot-E400:~/wyb/rtl8189es_r16m/lichee/linux-3.4/drivers/net/wireless$ rm rtl8189es -rf rootroot@rootroot-E400:~/wyb/rtl8189es_r16m/lichee/linux-3.4/drivers/net/wireless$ tar zxvf rtl8189es4.tar.gz 10、可选操作:为了调试方便 Q:\r16m\rtl8189es_r16m\lichee\tools\pack\chips\sun8iw5p1\configs\default\env.cfg #kernel command arguments console=ttyS0,115200 nand_root=/dev/nandd mmc_root=/dev/mmcblk0p7 init=/init loglevel=8 #set kernel cmdline if boot.img or recovery.img has no cmdline we will use this setargs_nand=setenv bootargs console=${console} root=${nand_root} init=${init} ion_cma_list="120m,256m" loglevel=${loglevel} partitions=${partitions} setargs_mmc=setenv bootargs console=${console} root=${mmc_root} init=${init} ion_cma_list="120m,256m" loglevel=${loglevel} partitions=${partitions} #nand command syntax: sunxi_flash read address partition_name read_bytes #0x40007800 = 0x40008000(kernel entry) - 0x800(boot.img header 2k) boot_normal=sunxi_flash read 40007800 boot;boota 40007800 boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800 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 11、 Q:\r16m\rtl8189es_r16m\lichee\tools\pack\chips\sun8iw5p1\configs\evb-30\sys_config.fex ;--------------------------------------------------------------------------------------------------------- ; wakeup_src_para: ; sometimes, u would like to add more wakeup src in standby mode, these para will be ; help; ; u need to make sure the standby mode support the wakeup src. Also, some hw ; condition must be guaranteed. ; including: ; cpu_en: power on or off. ; 1: mean power on ; 0: mean power off ; cpu_freq: indicating lowest freq. unit is Mhz; ; dram selfresh_en: selfresh or not. ; 1: enable enter selfresh ; 0: disable enter selfresh ; dram_pll: if not enter selfresh, indicating lowest freq. unit is Mhz; ; wakeup_src: to make the scenario work, the wakeup src is needed. ;--------------------------------------------------------------------------------------------------------- [wakeup_src_para] cpu_en = 0 cpu_freq = 48 ; (cpu:apb:ahb) pll_ratio = 0x111 dram_selfresh_en= 1 dram_freq = 36 wakeup_src_wl = port:PL07<4><0> ;wakeup_src_bt = port:PL09<4><0> bb_wake_ap = port:PL02<4><0> ;-------------------------------------------------------------------------------- ;wifi/bt/fm/gps/nfc modules configuration ;module_num: ; 0- none ; 1- ap6181(wifi) ; 2- ap6210/ap6212(wifi+bt) ; 3- rtl8188eu(wifi) ; 4- rtl8723au(wifi+bt) ; 5- rtl8723bs/rtl8723bs-vq0(wifi+bt) ; 6- esp8089(wifi) ; 7- ap6476(wifi+bt+fm+gps) ; 8- ap6330(wifi+bt+fm) ; 9- gb9663(wifi+bt+fm) ; 10- ap6212(wifi+bt) ; 11- rtl8189es(wifi) ;module_power1: ""- bat, "axp_dldo1"- axp dldo1 ;module_power1_vol: power1 voltage, mv; not used for module_power1 is "" ;module_power2: ""- bat, "axp_dldo2"- axp dldo2 ;module_power2_vol: power2 voltage, mv; not used for module_power2 is "" ;module_power3: ""- bat, "axp_dldo2"- axp dldo2 ;module_power3_vol: power3 voltage, mv; not used for module_power3 is "" ;power_switch: module power switch io when bat supply ;chip_en: enable chip io ;lpo_use_apclk: ""- not use, "losc_out"- a23/33, "ac10032k1"?"ac10032k2"?"ac10032k3"- a80/a83 ;-------------------------------------------------------------------------------- [rf_para] module_num = 11 module_power1 = "axp22_dldo1" module_power1_vol = 3300000 module_power2 = "axp22_dldo2" module_power2_vol = 3300000 module_power3 = "axp22_aldo1" module_power3_vol = 3300000 power_switch = chip_en = lpo_use_apclk = "losc_out" ;-------------------------------------------------------------------------------- ;wifi configuration ;wifi_used: 0-not use, 1- use ;wifi_sdc_id: 0- SDC0, 1- SDC1, 2- SDC2, 3- SDC3 ;wifi_usbc_id: 0- USB0, 1- USB1, 2- USB2 ;wifi_usbc_type: 1- EHCI(speed 2.0), 2- OHCI(speed 1.0) ;wl_reg_on: wifi function enable io ;wl_host_wake: wifi device wake-up host ;wl_host_wake_invert: whether wl_host_wake use inverter between ap and module ; 0: not used, 1: used ;-------------------------------------------------------------------------------- [wifi_para] wifi_used = 1 wifi_sdc_id = 1 wifi_usbc_id = 1 wifi_usbc_type = 1 wl_reg_on = port:PL06<1><0> wl_host_wake = port:PL07<4><0> rtl8189es_host_wake = port:PL07<4><0> wl_host_wake_invert = 0 ;-------------------------------------------------------------------------------- ;bluetooth configuration ;bt_used: 0- no used, 1- used ;bt_uard_id: 0- uart0, 1- uart1, 2- uart2 ;bt_rst_n: bt function enable io ;bt_wake: host wake-up bluetooth device ;bt_wak_host: bt device wake-up host ;bt_host_wake_invert: whether bt_host_wake use inverter between ap and module ; 0: not used, 1: used ;-------------------------------------------------------------------------------- [bt_para] bt_used = 0 ;bt_uart_id = 1 ;bt_rst_n = port:PL08<1><0> ;bt_wake = port:PL10<1><0> ;bt_host_wake = port:PL09<4><0> ;bt_host_wake_invert = 0 power_start = 3 pmu_temp_enable = 0

立即下载
pdf文件
各类速查表汇总-PySpark Cheat Sheet -Spark in Python

各类速查表汇总-PySpark Cheat Sheet -Spark in Python

立即下载
txt文件
迅雷2009年9月20日校园招聘笔试题

迅雷:www.xunlei.com 针对的是软件开发工程师 题型 10道判断题 15道单选题 10道多选题 1道填空题(补充某库函数程序) 题的部分内容参见:http://blog.csdn.net/yulin1416/archive/2010/03/06/5351443.aspx

立即下载
pdf文件
cc2530_user_guide

Preface....................................................................................................................................... 14 1 Introduction ....................................................................................................................... 17 1.1 Overview..................................................................................................................... 18 1.1.1 CPU and Memory ................................................................................................. 21 1.1.2 Clocks and Power Management ................................................................................ 21 1.1.3 Peripherals ......................................................................................................... 21 1.1.4 Radio................................................................................................................ 23 1.2 Applications ................................................................................................................. 23 2 8051 CPU........................................................................................................................... 24 2.1 8051 CPU Introduction .................................................................................................... 25 2.2 Memory ...................................................................................................................... 25 2.2.1 Memory Map ....................................................................................................... 25 2.2.2 CPU Memory Space .............................................................................................. 27 2.2.3 Physical Memory .................................................................................................. 28 2.2.4 XDATA Memory Access.......................................................................................... 33 2.2.5 Memory Arbiter .................................................................................................... 33 2.3 CPU Registers .............................................................................................................. 34 2.3.1 Data Pointers ...................................................................................................... 34 2.3.2 Registers R0–R7 .................................................................................................. 35 2.3.3 Program Status Word............................................................................................. 35 2.3.4 Accumulator........................................................................................................ 36 2.3.5 B Register .......................................................................................................... 36 2.3.6 Stack Pointer....................................................................................................... 36 2.4 Instruction Set Summary .................................................................................................. 36 2.5 Interrupts .................................................................................................................... 40 2.5.1 Interrupt Masking .................................................................................................. 41 2.5.2 Interrupt Processing............................................................................................... 45 2.5.3 Interrupt Priority.................................................................................................... 47 3 Debug Interface.................................................................................................................. 50 3.1 Debug Mode ................................................................................................................ 51 3.2 Debug Communication .................................................................................................... 51 3.3 Debug Commands ......................................................................................................... 53 3.3.1 Debug Configuration .............................................................................................. 55 3.3.2 Debug Status ...................................................................................................... 55 3.3.3 Hardware Breakpoints ............................................................................................ 56 3.4 Flash Programming ........................................................................................................ 57 3.4.1 Lock Bits............................................................................................................ 57 3.5 Debug Interface and Power Modes...................................................................................... 57 3.6 Registers .................................................................................................................... 59 4 Power Management and Clocks ........................................................................................... 60 4.1 Power Management Introduction......................................................................................... 61 4.1.1 Active and Idle Modes ............................................................................................ 62 4.1.2 PM1 ................................................................................................................. 62 4.1.3 PM2 ................................................................................................................. 62 4.1.4 PM3 ................................................................................................................. 62 4.2 Power-Management Control .............................................................................................. 62 4.3 Power-Management Registers ........................................................................................... 63 4.4 Oscillators and Clocks ..................................................................................................... 66 4.4.1 Oscillators .......................................................................................................... 66 4.4.2 System Clock ...................................................................................................... 66 4.4.3 32-kHz Oscillators ................................................................................................. 67 4.4.4 Oscillator and Clock Registers .................................................................................. 67 4.5 Timer Tick Generation ..................................................................................................... 69 4.6 Data Retention.............................................................................................................. 69 5 Reset ................................................................................................................................ 70 5.1 Power-On Reset and Brownout Detector ............................................................................... 71 5.2 Clock-Loss Detector ....................................................................................................... 71 6 Flash Controller ................................................................................................................. 72 6.1 Flash Memory Organization............................................................................................... 73 6.2 Flash Write .................................................................................................................. 73 6.2.1 Flash-Write Procedure............................................................................................ 73 6.2.2 Writing Multiple Times to a Word ............................................................................... 74 6.2.3 DMA Flash Write .................................................................................................. 74 6.2.4 CPU Flash Write................................................................................................... 75 6.3 Flash Page Erase .......................................................................................................... 75 6.3.1 Performing Flash Erase From Flash Memory ................................................................. 76 6.3.2 Different Flash Page Size on CC2533 ......................................................................... 76 6.4 Flash DMA Trigger ......................................................................................................... 76 6.5 Flash Controller Registers ................................................................................................ 76 7 I/O Ports............................................................................................................................ 78 7.1 Unused I/O Pins ............................................................................................................ 79 7.2 Low I/O Supply Voltage ................................................................................................... 79 7.3 General-Purpose I/O ....................................................................................................... 79 7.4 General-Purpose I/O Interrupts........................................................................................... 79 7.5 General-Purpose I/O DMA ................................................................................................ 80 7.6 Peripheral I/O ............................................................................................................... 80 7.6.1 Timer 1.............................................................................................................. 81 7.6.2 Timer 3.............................................................................................................. 81 7.6.3 Timer 4.............................................................................................................. 82 7.6.4 USART 0 ........................................................................................................... 82 7.6.5 USART 1 ........................................................................................................... 82 7.6.6 ADC ................................................................................................................. 83 7.6.7 Operational Amplifier and Analog Comparator ................................................................ 83 7.7 Debug Interface............................................................................................................. 83 7.8 32-kHz XOSC Input ........................................................................................................ 83 7.9 Radio Test Output Signals ................................................................................................ 84 7.10 Power-Down Signal MUX (PMUX)....................................................................................... 84 7.11 I/O Registers ................................................................................................................ 84 8 DMA Controller .................................................................................................................. 92 8.1 DMA Operation ............................................................................................................. 93 8.2 DMA Configuration Parameters .......................................................................................... 95 8.2.1 Source Address.................................................................................................... 95 8.2.2 Destination Address............................................................................................... 95 8.2.3 Transfer Count..................................................................................................... 95 8.2.4 VLEN Setting....................................................................................................... 96 8.2.5 Trigger Event....................................................................................................... 96 8.2.6 Source and Destination Increment.............................................................................. 96 8.2.7 DMA Transfer Mode .............................................................................................. 97 8.2.8 DMA Priority........................................................................................................ 97 8.2.9 Byte or Word Transfers........................................................................................... 97 8.2.10 Interrupt Mask .................................................................................................... 97 8.2.11 Mode 8 Setting ................................................................................................... 97 8.3 DMA Configuration Setup ................................................................................................. 97 8.4 Stopping DMA Transfers .................................................................................................. 98 8.5 DMA Interrupts.............................................................................................................. 98 8.6 DMA Configuration-Data Structure....................................................................................... 98 8.7 DMA Memory Access...................................................................................................... 98 8.8 DMA Registers ............................................................................................................ 101 9 Timer 1 (16-Bit Timer)........................................................................................................ 103 9.1 16-Bit Counter............................................................................................................. 104 9.2 Timer 1 Operation ........................................................................................................ 104 9.3 Free-Running Mode ...................................................................................................... 104 9.4 Modulo Mode.............................................................................................................. 105 9.5 Up-and-Down Mode ...................................................................................................... 105 9.6 Channel-Mode Control ................................................................................................... 105 9.7 Input Capture Mode ...................................................................................................... 106 9.8 Output Compare Mode................................................................................................... 106 9.9 IR Signal Generation and Learning .................................................................................... 111 9.9.1 Introduction ....................................................................................................... 111 9.9.2 Modulated Codes ................................................................................................ 111 9.9.3 Non-Modulated Codes .......................................................................................... 112 9.9.4 Learning........................................................................................................... 113 9.9.5 Other Considerations............................................................................................ 113 9.10 Timer 1 Interrupts ......................................................................................................... 113 9.11 Timer 1 DMA Triggers.................................................................................................... 113 9.12 Timer 1 Registers ......................................................................................................... 114 9.13 Accessing Timer 1 Registers as Array ................................................................................ 119 10 Timer 3 and Timer 4 (8-Bit Timers)...................................................................................... 120 10.1 8-Bit Timer Counter....................................................................................................... 121 10.2 Timer 3 and Timer 4 Mode Control..................................................................................... 121 10.2.1 Free-Running Mode ............................................................................................ 121 10.2.2 Down Mode...................................................................................................... 121 10.2.3 Modulo Mode.................................................................................................... 121 10.2.4 Up-and-Down Mode ............................................................................................ 121 10.3 Channel Mode Control ................................................................................................... 121 10.4 Input Capture Mode ...................................................................................................... 122 10.5 Output Compare Mode................................................................................................... 122 10.6 Timer 3 and Timer 4 Interrupts.......................................................................................... 122 10.7 Timer 3 and Timer 4 DMA Triggers .................................................................................... 123 10.8 Timer 3 and Timer 4 Registers.......................................................................................... 123 11 Sleep Timer...................................................................................................................... 128 11.1 General..................................................................................................................... 129 11.2 Timer Compare ........................................................................................................... 129 11.3 Timer Capture ............................................................................................................. 129 11.4 Sleep Timer Registers ................................................................................................... 130 12 ADC ................................................................................................................................ 132 12.1 ADC Introduction.......................................................................................................... 133 12.2 ADC Operation ............................................................................................................ 133 12.2.1 ADC Inputs ...................................................................................................... 133 12.2.2 ADC Conversion Sequences.................................................................................. 134 12.2.3 Single ADC Conversion........................................................................................ 134 12.2.4 ADC Operating Modes ......................................................................................... 134 12.2.5 ADC Conversion Results ...................................................................................... 135 12.2.6 ADC Reference Voltage ....................................................................................... 135 12.2.7 ADC Conversion Timing ....................................................................................... 135 12.2.8 ADC Interrupts .................................................................................................. 135 12.2.9 ADC DMA Triggers ............................................................................................. 135 12.2.10 ADC Registers................................................................................................. 136 13 Battery Monitor ................................................................................................................ 139 13.1 Functionality and Usage of the Battery Monitor ...................................................................... 140 13.2 Using the Battery Monitor for Temperature Monitoring .............................................................. 140 13.3 Battery Monitor Registers ............................................................................................... 141 14 Random-Number Generator ............................................................................................... 143 14.1 Introduction ................................................................................................................ 144 14.2 Random-Number-Generator Operation ................................................................................ 144 14.2.1 Pseudorandom Sequence Generation....................................................................... 144 14.2.2 Seeding .......................................................................................................... 144 14.2.3 CRC16 ........................................................................................................... 144 14.3 Random-Number-Generator Registers ................................................................................ 145 15 AES Coprocessor ............................................................................................................. 146 15.1 AES Operation ............................................................................................................ 147 15.2 Key and IV ................................................................................................................. 147 15.3 Padding of Input Data .................................................................................................... 147 15.4 Interface to CPU .......................................................................................................... 147 15.5 Modes of Operation ...................................................................................................... 147 15.6 CBC-MAC.................................................................................................................. 147 15.7 CCM Mode................................................................................................................. 148 15.8 AES Interrupts............................................................................................................. 150 15.9 AES DMA Triggers ....................................................................................................... 150 15.10 AES Registers ............................................................................................................ 150 16 Watchdog Timer ............................................................................................................... 152 16.1 Watchdog Mode........................................................................................................... 153 16.2 Timer Mode................................................................................................................ 153 16.3 Watchdog Timer Register................................................................................................ 153 17 USART ............................................................................................................................ 155 17.1 UART Mode ............................................................................................................... 156 17.1.1 UART Transmit.................................................................................................. 156 17.1.2 UART Receive .................................................................................................. 156 17.1.3 UART Hardware Flow Control ................................................................................ 156 17.1.4 UART Character Format....................................................................................... 157 17.2 SPI Mode .................................................................................................................. 157 17.2.1 SPI Master Operation .......................................................................................... 157 17.2.2 SPI Slave Operation............................................................................................ 158 17.3 SSN Slave-Select Pin .................................................................................................... 158 17.4 Baud-Rate Generation ................................................................................................... 158 17.5 USART Flushing .......................................................................................................... 159 17.6 USART Interrupts ......................................................................................................... 159 17.7 USART DMA Triggers.................................................................................................... 159 17.8 USART Registers ......................................................................................................... 159 18 Operational Amplifier ........................................................................................................ 164 18.1 Description................................................................................................................. 165 18.2 Calibration ................................................................................................................. 165 18.3 Clock Source .............................................................................................................. 165 18.4 Registers ................................................................................................................... 165 19 Analog Comparator........................................................................................................... 166 19.1 Description................................................................................................................. 167 19.2 Register .................................................................................................................... 167 20 I2C................................................................................................................................... 168 20.1 Operation .................................................................................................................. 169 20.1.1 I2C Initialization and Reset..................................................................................... 170 20.1.2 I2C Serial Data .................................................................................................. 170 20.1.3 I2C Addressing Modes ......................................................................................... 171 20.1.4 I2C Module Operating Modes ................................................................................. 171 20.1.5 I2C Clock Generation and Synchronization.................................................................. 177 20.1.6 Bus Error......................................................................................................... 178 20.1.7 I2C Interrupt ...................................................................................................... 178 20.1.8 I2C Pins........................................................................................................... 178 20.2 I2C Registers............................................................................................................... 178 21 USB Controller ................................................................................................................. 181 21.1 USB Introduction .......................................................................................................... 182 21.2 USB Enable................................................................................................................ 182 21.3 48-MHz USB PLL......................................................................................................... 182 21.4 USB Interrupts............................................................................................................. 183 21.5 Endpoint 0 ................................................................................................................. 183 21.6 Endpoint-0 Interrupts ..................................................................................................... 183 21.6.1 Error Conditions................................................................................................. 184 21.6.2 SETUP Transactions (IDLE State) ........................................................................... 184 21.6.3 IN Transactions (TX State) .................................................................................... 184 21.6.4 OUT Transactions (RX State)................................................................................. 185 21.7 Endpoints 1–5 ............................................................................................................. 185 21.7.1 FIFO Management ............................................................................................. 185 21.7.2 Double Buffering ................................................................................................ 186 21.7.3 FIFO Access..................................................................................................... 187 21.7.4 Endpoint 1–5 Interrupts ........................................................................................ 187 21.7.5 Bulk or Interrupt IN Endpoint .................................................................................. 188 21.7.6 Isochronous IN Endpoint....................................................................................... 188 21.7.7 Bulk or Interrupt OUT Endpoint ............................................................................... 188 21.7.8 Isochronous OUT Endpoint.................................................................................... 188 21.8 DMA ........................................................................................................................ 189 21.9 USB Reset ................................................................................................................. 189 21.10 Suspend and Resume ................................................................................................... 189 21.11 Remote Wake-Up ........................................................................................................ 189 21.12 USB Registers ............................................................................................................ 190 22 Timer 2 (MAC Timer) ......................................................................................................... 197 22.1 Timer Operation........................................................................................................... 198 22.1.1 General........................................................................................................... 198 22.1.2 Up Counter ...................................................................................................... 198 22.1.3 Timer Overflow.................................................................................................. 198 22.1.4 Timer Delta Increment ......................................................................................... 198 22.1.5 Timer Compare ................................................................................................. 198 22.1.6 Overflow Count.................................................................................................. 198 22.1.7 Overflow-Count Update ........................................................................................ 199 22.1.8 Overflow-Count Overflow ...................................................................................... 199 22.1.9 Overflow-Count Compare...................................................................................... 199 22.1.10 Capture Input .................................................................................................. 199 22.1.11 Long Compare (CC2541 Only) .............................................................................. 199 22.2 Interrupts ................................................................................................................... 199 22.3 Event Outputs (DMA Trigger and Radio Events) ..................................................................... 200 22.4 Timer Start-and-Stop Synchronization ................................................................................. 200 22.4.1 General........................................................................................................... 200 22.4.2 Timer Synchronous Stop ...................................................................................... 200 22.4.3 Timer Synchronous Start ...................................................................................... 201 22.5 Timer 2 Registers ......................................................................................................... 202 23 CC253x Radio................................................................................................................... 208 23.1 RF Core .................................................................................................................... 209 23.1.1 Interrupts......................................................................................................... 209 23.1.2 Interrupt Registers .............................................................................................. 209 23.2 FIFO Access............................................................................................................... 213 23.3 DMA ........................................................................................................................ 213 23.4 Memory Map .............................................................................................................. 213 23.4.1 RXFIFO .......................................................................................................... 214 23.4.2 TXFIFO........................................................................................................... 214 23.4.3 Frame-Filtering and Source-Matching Memory Map....................................................... 214 23.5 Frequency and Channel Programming ................................................................................ 215 23.6 IEEE 802.15.4-2006 Modulation Format............................................................................... 215 23.7 IEEE 802.15.4-2006 Frame Format .................................................................................... 217 23.7.1 PHY Layer ....................................................................................................... 217 23.7.2 MAC Layer....................................................................................................... 217 23.8 Transmit Mode ............................................................................................................ 218 23.8.1 TX Control ....................................................................................................... 218 23.8.2 TX State Timing................................................................................................. 218 23.8.3 TXFIFO Access ................................................................................................. 218 23.8.4 Retransmission.................................................................................................. 219 23.8.5 Error Conditions................................................................................................. 219 23.8.6 TX Flow Diagram ............................................................................................... 219 23.8.7 Transmitted Frame Processing ............................................................................... 221 23.8.8 Synchronization Header ....................................................................................... 221 23.8.9 Frame-Length Field............................................................................................. 221 23.8.10 Frame Check Sequence ..................................................................................... 221 23.8.11 Interrupts ....................................................................................................... 222 23.8.12 Clear-Channel Assessment.................................................................................. 222 23.8.13 Output Power Programming ................................................................................. 222 23.8.14 Tips and Tricks ................................................................................................ 222 23.9 Receive Mode ............................................................................................................ 222 23.9.1 RX Control ....................................................................................................... 222 23.9.2 RX State Timing ................................................................................................ 223 23.9.3 Received-Frame Processing .................................................................................. 223 23.9.4 Synchronization Header and Frame-Length Fields ........................................................ 224 23.9.5 Frame Filtering .................................................................................................. 224 23.9.6 Source Address Matching ..................................................................................... 227 23.9.7 Frame-Check Sequence ....................................................................................... 230 23.9.8 Acknowledgement Transmission ............................................................................. 230 23.10 RXFIFO Access........................................................................................................... 232 23.10.1 Using the FIFO and FIFOP .................................................................................. 232 23.10.2 Error Conditions ............................................................................................... 233 23.10.3 RSSI ............................................................................................................ 233 23.10.4 Link Quality Indication ........................................................................................ 234 23.11 Radio-Control State Machine ........................................................................................... 234 23.12 Random-Number Generation ........................................................................................... 236 23.13 Packet Sniffing and Radio Test Output Signals ...................................................................... 237 23.14 Command Strobe Processor............................................................................................ 238 23.14.1 Instruction Memory............................................................................................ 238 23.14.2 Data Registers................................................................................................. 239 23.14.3 Program Execution............................................................................................ 239 23.14.4 Interrupt Requests ............................................................................................ 239 23.14.5 Random Number Instruction ................................................................................. 239 23.14.6 Running CSP Programs...................................................................................... 239 23.14.7 Registers ....................................................................................................... 240 23.14.8 Instruction Set Summary ..................................................................................... 241 23.14.9 Instruction Set Definition ..................................................................................... 243 23.15 Registers................................................................................................................... 255 23.15.1 Register Settings Update..................................................................................... 256 23.15.2 Register Access Modes ...................................................................................... 256 23.15.3 Register Descriptions ......................................................................................... 257 24 CC2540 and CC2541 Bluetooth low energy Radio .................................................................. 275 24.1 Registers ................................................................................................................... 276 25 CC2541 Proprietary Mode Radio......................................................................................... 278 25.1 RF Core .................................................................................................................... 279 25.2 Interrupts ................................................................................................................... 279 25.2.1 Interrupt Registers .............................................................................................. 279 25.3 RF Core Data Memory ................................................................................................... 280 25.3.1 FIFOs............................................................................................................. 281 25.3.2 DMA .............................................................................................................. 284 25.3.3 RAM-Based Registers ......................................................................................... 285 25.3.4 Variables in RAM Page 5...................................................................................... 291 25.4 Bit-Stream Processor..................................................................................................... 291 25.4.1 Whitening ........................................................................................................ 291 25.4.2 CC2500-Compatible PN9 Whitening ......................................................................... 292 25.4.3 CRC .............................................................................................................. 293 25.4.4 Coprocessor Mode ............................................................................................. 295 25.5 Frequency and Channel Programming ................................................................................ 296 25.6 Modulation Formats ...................................................................................................... 296 25.7 Receiver.................................................................................................................... 296 25.8 Packet Format............................................................................................................. 297 25.8.1 RX FIFO Packet Organization ................................................................................ 299 25.8.2 TX FIFO Packet Organization................................................................................. 300 25.8.3 TX Buffers for ACK Payload................................................................................... 300 25.9 Link Layer Engine......................................................................................................... 301 25.9.1 Command Register ............................................................................................. 302 25.9.2 Radio Tasks ..................................................................................................... 302 25.9.3 RF Test Commands............................................................................................ 317 25.10 Random Number Generation ........................................................................................... 318 25.11 Packet Sniffing ............................................................................................................ 319 25.12 Registers................................................................................................................... 320 25.12.1 Register Overview............................................................................................. 320 25.12.2 Register Settings Update..................................................................................... 321 25.12.3 SFR Register Descriptions................................................................................... 322 26 Voltage Regulator ............................................................................................................. 342 27 Available Software ............................................................................................................ 343 27.1 SmartRF™ Software for Evaluation (www.ti.com/smartrfstudio) ................................................... 344 27.2 RemoTI™ Network Protocol (www.ti.com/remoti) .................................................................... 344 27.3 SimpliciTI™ Network Protocol (www.ti.com/simpliciti) ............................................................... 345 27.4 TIMAC Software (www.ti.com/timac)................................................................................... 345 27.5 Z-Stack™ Software (www.ti.com/z-stack) ............................................................................. 346 27.6 BLE Stack Software ...................................................................................................... 346 A Abbreviations................................................................................................................... 347 B Additional Information....................................................................................................... 350 B.1 Texas Instruments Low-Power RF Web Site ......................................................................... 351 B.2 Low-Power RF Online Community ..................................................................................... 351 B.3 Texas Instruments Low-Power RF Developer Network.............................................................. 351 B.4 Low-Power RF eNewsletter ............................................................................................. 351 C References....................................................................................................................... 352 Revision History ........................................................................................................................ 353

立即下载
docx文件
Google C++ Style Guide(Google C++编程规范)高清PDF

Table of Contents Header Files The #define Guard Header File Dependencies Inline Functions The -inl.h Files Function Parameter Ordering Names and Order of Includes Scoping Namespaces Nested Classes Nonmember, Static Member, and Global Functions Local Variables Static and Global Variables Classes Doing Work in Constructors Default Constructors Explicit Constructors Copy Constructors Structs vs. Classes Inheritance Multiple Inheritance Interfaces Operator Overloading Access Control Declaration Order Write Short Functions Google-Specific Magic Smart Pointers cpplint Other C++ Features Reference Arguments Function Overloading Default Arguments Variable-Length Arrays and alloca() Friends Exceptions Run-Time Type Information (RTTI) Casting Streams Preincrement and Predecrement Use of const Integer Types 64-bit Portability Preprocessor Macros 0 and NULL sizeof Boost C++0x Naming General Naming Rules File Names Type Names Variable Names Constant Names Function Names Namespace Names Enumerator Names Macro Names Exceptions to Naming Rules Comments Comment Style File Comments Class Comments Function Comments Variable Comments Implementation Comments Punctuation, Spelling and Grammar TODO Comments Deprecation Comments Formatting Line Length Non-ASCII Characters Spaces vs. Tabs Function Declarations and Definitions Function Calls Conditionals Loops and Switch Statements Pointer and Reference Expressions Boolean Expressions Return Values Variable and Array Initialization Preprocessor Directives Class Format Constructor Initializer Lists Namespace Formatting Horizontal Whitespace Vertical Whitespace Exceptions to the Rules Existing Non-conformant Code Windows Code Important Note Displaying Hidden Details in this Guide link ▶This style guide contains many details that are initially hidden from view. They are marked by the triangle icon, which you see here on your left. Click it now. You should see "Hooray" appear below. Hooray! Now you know you can expand points to get more details. Alternatively, there's an "expand all" at the top of this document. Background C++ is the main development language used by many of Google's open-source projects. As every C++ programmer knows, the language has many powerful features, but this power brings with it complexity, which in turn can make code more bug-prone and harder to read and maintain. The goal of this guide is to manage this complexity by describing in detail the dos and don'ts of writing C++ code. These rules exist to keep the code base manageable while still allowing coders to use C++ language features productively. Style, also known as readability, is what we call the conventions that govern our C++ code. The term Style is a bit of a misnomer, since these conventions cover far more than just source file formatting. One way in which we keep the code base manageable is by enforcing consistency. It is very important that any programmer be able to look at another's code and quickly understand it. Maintaining a uniform style and following conventions means that we can more easily use "pattern-matching" to infer what various symbols are and what invariants are true about them. Creating common, required idioms and patterns makes code much easier to understand. In some cases there might be good arguments for changing certain style rules, but we nonetheless keep things as they are in order to preserve consistency. Another issue this guide addresses is that of C++ feature bloat. C++ is a huge language with many advanced features. In some cases we constrain, or even ban, use of certain features. We do this to keep code simple and to avoid the various common errors and problems that these features can cause. This guide lists these features and explains why their use is restricted. Open-source projects developed by Google conform to the requirements in this guide. Note that this guide is not a C++ tutorial: we assume that the reader is familiar with the language. Header Files In general, every .cc file should have an associated .h file. There are some common exceptions, such as unittests and small .cc files containing just a main() function. Correct use of header files can make a huge difference to the readability, size and performance of your code. The following rules will guide you through the various pitfalls of using header files. The #define Guard link ▶All header files should have #define guards to prevent multiple inclusion. The format of the symbol name should be ___H_. To guarantee uniqueness, they should be based on the full path in a project's source tree. For example, the file foo/src/bar/baz.h in project foo should have the following guard: #ifndef FOO_BAR_BAZ_H_ #define FOO_BAR_BAZ_H_ ... #endif // FOO_BAR_BAZ_H_ Header File Dependencies link ▶Don't use an #include when a forward declaration would suffice. When you include a header file you introduce a dependency that will cause your code to be recompiled whenever the header file changes. If your header file includes other header files, any change to those files will cause any code that includes your header to be recompiled. Therefore, we prefer to minimize includes, particularly includes of header files in other header files. You can significantly minimize the number of header files you need to include in your own header files by using forward declarations. For example, if your header file uses the File class in ways that do not require access to the declaration of the File class, your header file can just forward declare class File; instead of having to #include "file/base/file.h". How can we use a class Foo in a header file without access to its definition? We can declare data members of type Foo* or Foo&. We can declare (but not define) functions with arguments, and/or return values, of type Foo. (One exception is if an argument Foo or const Foo& has a non-explicit, one-argument constructor, in which case we need the full definition to support automatic type conversion.) We can declare static data members of type Foo. This is because static data members are defined outside the class definition. On the other hand, you must include the header file for Foo if your class subclasses Foo or has a data member of type Foo. Sometimes it makes sense to have pointer (or better, scoped_ptr) members instead of object members. However, this complicates code readability and imposes a performance penalty, so avoid doing this transformation if the only purpose is to minimize includes in header files. Of course, .cc files typically do require the definitions of the classes they use, and usually have to include several header files. Note: If you use a symbol Foo in your source file, you should bring in a definition for Foo yourself, either via an #include or via a forward declaration. Do not depend on the symbol being brought in transitively via headers not directly included. One exception is if Foo is used in myfile.cc, it's ok to #include (or forward-declare) Foo in myfile.h, instead of myfile.cc. Inline Functions link ▶Define functions inline only when they are small, say, 10 lines or less. Definition: You can declare functions in a way that allows the compiler to expand them inline rather than calling them through the usual function call mechanism. Pros: Inlining a function can generate more efficient object code, as long as the inlined function is small. Feel free to inline accessors and mutators, and other short, performance-critical functions. Cons: Overuse of inlining can actually make programs slower. Depending on a function's size, inlining it can cause the code size to increase or decrease. Inlining a very small accessor function will usually decrease code size while inlining a very large function can dramatically increase code size. On modern processors smaller code usually runs faster due to better use of the instruction cache. Decision: A decent rule of thumb is to not inline a function if it is more than 10 lines long. Beware of destructors, which are often longer than they appear because of implicit member- and base-destructor calls! Another useful rule of thumb: it's typically not cost effective to inline functions with loops or switch statements (unless, in the common case, the loop or switch statement is never executed). It is important to know that functions are not always inlined even if they are declared as such; for example, virtual and recursive functions are not normally inlined. Usually recursive functions should not be inline. The main reason for making a virtual function inline is to place its definition in the class, either for convenience or to document its behavior, e.g., for accessors and mutators. The -inl.h Files link ▶You may use file names with a -inl.h suffix to define complex inline functions when needed. The definition of an inline function needs to be in a header file, so that the compiler has the definition available for inlining at the call sites. However, implementation code properly belongs in .cc files, and we do not like to have much actual code in .h files unless there is a readability or performance advantage. If an inline function definition is short, with very little, if any, logic in it, you should put the code in your .h file. For example, accessors and mutators should certainly be inside a class definition. More complex inline functions may also be put in a .h file for the convenience of the implementer and callers, though if this makes the .h file too unwieldy you can instead put that code in a separate -inl.h file. This separates the implementation from the class definition, while still allowing the implementation to be included where necessary. Another use of -inl.h files is for definitions of function templates. This can be used to keep your template definitions easy to read. Do not forget that a -inl.h file requires a #define guard just like any other header file. Function Parameter Ordering link ▶When defining a function, parameter order is: inputs, then outputs. Parameters to C/C++ functions are either input to the function, output from the function, or both. Input parameters are usually values or const references, while output and input/output parameters will be non-const pointers. When ordering function parameters, put all input-only parameters before any output parameters. In particular, do not add new parameters to the end of the function just because they are new; place new input-only parameters before the output parameters. This is not a hard-and-fast rule. Parameters that are both input and output (often classes/structs) muddy the waters, and, as always, consistency with related functions may require you to bend the rule. Names and Order of Includes link ▶Use standard order for readability and to avoid hidden dependencies: C library, C++ library, other libraries' .h, your project's .h. All of a project's header files should be listed as descentants of the project's source directory without use of UNIX directory shortcuts . (the current directory) or .. (the parent directory). For example, google-awesome-project/src/base/logging.h should be included as #include "base/logging.h" In dir/foo.cc, whose main purpose is to implement or test the stuff in dir2/foo2.h, order your includes as follows: dir2/foo2.h (preferred location — see details below). C system files. C++ system files. Other libraries' .h files. Your project's .h files. The preferred ordering reduces hidden dependencies. We want every header file to be compilable on its own. The easiest way to achieve this is to make sure that every one of them is the first .h file #included in some .cc. dir/foo.cc and dir2/foo2.h are often in the same directory (e.g. base/basictypes_test.cc and base/basictypes.h), but can be in different directories too. Within each section it is nice to order the includes alphabetically. For example, the includes in google-awesome-project/src/foo/internal/fooserver.cc might look like this: #include "foo/public/fooserver.h" // Preferred location. #include #include #include #include #include "base/basictypes.h" #include "base/commandlineflags.h" #include "foo/public/bar.h" Scoping Namespaces link ▶Unnamed namespaces in .cc files are encouraged. With named namespaces, choose the name based on the project, and possibly its path. Do not use a using-directive. Definition: Namespaces subdivide the global scope into distinct, named scopes, and so are useful for preventing name collisions in the global scope. Pros: Namespaces provide a (hierarchical) axis of naming, in addition to the (also hierarchical) name axis provided by classes. For example, if two different projects have a class Foo in the global scope, these symbols may collide at compile time or at runtime. If each project places their code in a namespace, project1::Foo and project2::Foo are now distinct symbols that do not collide. Cons: Namespaces can be confusing, because they provide an additional (hierarchical) axis of naming, in addition to the (also hierarchical) name axis provided by classes. Use of unnamed spaces in header files can easily cause violations of the C++ One Definition Rule (ODR). Decision: Use namespaces according to the policy described below. Unnamed Namespaces Unnamed namespaces are allowed and even encouraged in .cc files, to avoid runtime naming conflicts: namespace { // This is in a .cc file. // The content of a namespace is not indented enum { kUnused, kEOF, kError }; // Commonly used tokens. bool AtEof() { return pos_ == kEOF; } // Uses our namespace's EOF. } // namespace However, file-scope declarations that are associated with a particular class may be declared in that class as types, static data members or static member functions rather than as members of an unnamed namespace. Terminate the unnamed namespace as shown, with a comment // namespace. Do not use unnamed namespaces in .h files. Named Namespaces Named namespaces should be used as follows: Namespaces wrap the entire source file after includes, gflags definitions/declarations, and forward declarations of classes from other namespaces: // In the .h file namespace mynamespace { // All declarations are within the namespace scope. // Notice the lack of indentation. class MyClass { public: ... void Foo(); }; } // namespace mynamespace // In the .cc file namespace mynamespace { // Definition of functions is within scope of the namespace. void MyClass::Foo() { ... } } // namespace mynamespace The typical .cc file might have more complex detail, including the need to reference classes in other namespaces. #include "a.h" DEFINE_bool(someflag, false, "dummy flag"); class C; // Forward declaration of class C in the global namespace. namespace a { class A; } // Forward declaration of a::A. namespace b { ...code for b... // Code goes against the left margin. } // namespace b Do not declare anything in namespace std, not even forward declarations of standard library classes. Declaring entities in namespace std is undefined behavior, i.e., not portable. To declare entities from the standard library, include the appropriate header file. You may not use a using-directive to make all names from a namespace available. // Forbidden -- This pollutes the namespace. using namespace foo; You may use a using-declaration anywhere in a .cc file, and in functions, methods or classes in .h files. // OK in .cc files. // Must be in a function, method or class in .h files. using ::foo::bar; Namespace aliases are allowed anywhere in a .cc file, anywhere inside the named namespace that wraps an entire .h file, and in functions and methods. // Shorten access to some commonly used names in .cc files. namespace fbz = ::foo::bar::baz; // Shorten access to some commonly used names (in a .h file). namespace librarian { // The following alias is available to all files including // this header (in namespace librarian): // alias names should therefore be chosen consistently // within a project. namespace pd_s = ::pipeline_diagnostics::sidetable; inline void my_inline_function() { // namespace alias local to a function (or method). namespace fbz = ::foo::bar::baz; ... } } // namespace librarian Note that an alias in a .h file is visible to everyone #including that file, so public headers (those available outside a project) and headers transitively #included by them, should avoid defining aliases, as part of the general goal of keeping public APIs as small as possible. Nested Classes link ▶Although you may use public nested classes when they are part of an interface, consider a namespace to keep declarations out of the global scope. Definition: A class can define another class within it; this is also called a member class. class Foo { private: // Bar is a member class, nested within Foo. class Bar { ... }; }; Pros: This is useful when the nested (or member) class is only used by the enclosing class; making it a member puts it in the enclosing class scope rather than polluting the outer scope with the class name. Nested classes can be forward declared within the enclosing class and then defined in the .cc file to avoid including the nested class definition in the enclosing class declaration, since the nested class definition is usually only relevant to the implementation. Cons: Nested classes can be forward-declared only within the definition of the enclosing class. Thus, any header file manipulating a Foo::Bar* pointer will have to include the full class declaration for Foo. Decision: Do not make nested classes public unless they are actually part of the interface, e.g., a class that holds a set of options for some method. Nonmember, Static Member, and Global Functions link ▶Prefer nonmember functions within a namespace or static member functions to global functions; use completely global functions rarely. Pros: Nonmember and static member functions can be useful in some situations. Putting nonmember functions in a namespace avoids polluting the global namespace. Cons: Nonmember and static member functions may make more sense as members of a new class, especially if they access external resources or have significant dependencies. Decision: Sometimes it is useful, or even necessary, to define a function not bound to a class instance. Such a function can be either a static member or a nonmember function. Nonmember functions should not depend on external variables, and should nearly always exist in a namespace. Rather than creating classes only to group static member functions which do not share static data, use namespaces instead. Functions defined in the same compilation unit as production classes may introduce unnecessary coupling and link-time dependencies when directly called from other compilation units; static member functions are particularly susceptible to this. Consider extracting a new class, or placing the functions in a namespace possibly in a separate library. If you must define a nonmember function and it is only needed in its .cc file, use an unnamed namespace or static linkage (eg static int Foo() {...}) to limit its scope. Local Variables link ▶Place a function's variables in the narrowest scope possible, and initialize variables in the declaration. C++ allows you to declare variables anywhere in a function. We encourage you to declare them in as local a scope as possible, and as close to the first use as possible. This makes it easier for the reader to find the declaration and see what type the variable is and what it was initialized to. In particular, initialization should be used instead of declaration and assignment, e.g. int i; i = f(); // Bad -- initialization separate from declaration. int j = g(); // Good -- declaration has initialization. Note that gcc implements for (int i = 0; i < 10; ++i) correctly (the scope of i is only the scope of the for loop), so you can then reuse i in another for loop in the same scope. It also correctly scopes declarations in if and while statements, e.g. while (const char* p = strchr(str, '/')) str = p + 1; There is one caveat: if the variable is an object, its constructor is invoked every time it enters scope and is created, and its destructor is invoked every time it goes out of scope. // Inefficient implementation: for (int i = 0; i < 1000000; ++i) { Foo f; // My ctor and dtor get called 1000000 times each. f.DoSomething(i); } It may be more efficient to declare such a variable used in a loop outside that loop: Foo f; // My ctor and dtor get called once each. for (int i = 0; i < 1000000; ++i) { f.DoSomething(i); } Static and Global Variables link ▶Static or global variables of class type are forbidden: they cause hard-to-find bugs due to indeterminate order of construction and destruction. Objects with static storage duration, including global variables, static variables, static class member variables, and function static variables, must be Plain Old Data (POD): only ints, chars, floats, or pointers, or arrays/structs of POD. The order in which class constructors and initializers for static variables are called is only partially specified in C++ and can even change from build to build, which can cause bugs that are difficult to find. Therefore in addition to banning globals of class type, we do not allow static POD variables to be initialized with the result of a function, unless that function (such as getenv(), or getpid()) does not itself depend on any other globals. Likewise, the order in which destructors are called is defined to be the reverse of the order in which the constructors were called. Since constructor order is indeterminate, so is destructor order. For example, at program-end time a static variable might have been destroyed, but code still running -- perhaps in another thread -- tries to access it and fails. Or the destructor for a static 'string' variable might be run prior to the destructor for another variable that contains a reference to that string. As a result we only allow static variables to contain POD data. This rule completely disallows vector (use C arrays instead), or string (use const char []). If you need a static or global variable of a class type, consider initializing a pointer (which will never be freed), from either your main() function or from pthread_once(). Note that this must be a raw pointer, not a "smart" pointer, since the smart pointer's destructor will have the order-of-destructor issue that we are trying to avoid. Classes Classes are the fundamental unit of code in C++. Naturally, we use them extensively. This section lists the main dos and don'ts you should follow when writing a class. Doing Work in Constructors link ▶In general, constructors should merely set member variables to their initial values. Any complex initialization should go in an explicit Init() method. Definition: It is possible to perform initialization in the body of the constructor. Pros: Convenience in typing. No need to worry about whether the class has been initialized or not. Cons: The problems with doing work in constructors are: There is no easy way for constructors to signal errors, short of using exceptions (which are forbidden). If the work fails, we now have an object whose initialization code failed, so it may be an indeterminate state. If the work calls virtual functions, these calls will not get dispatched to the subclass implementations. Future modification to your class can quietly introduce this problem even if your class is not currently subclassed, causing much confusion. If someone creates a global variable of this type (which is against the rules, but still), the constructor code will be called before main(), possibly breaking some implicit assumptions in the constructor code. For instance, gflags will not yet have been initialized. Decision: If your object requires non-trivial initialization, consider having an explicit Init() method. In particular, constructors should not call virtual functions, attempt to raise errors, access potentially uninitialized global variables, etc. Default Constructors link ▶You must define a default constructor if your class defines member variables and has no other constructors. Otherwise the compiler will do it for you, badly. Definition: The default constructor is called when we new a class object with no arguments. It is always called when calling new[] (for arrays). Pros: Initializing structures by default, to hold "impossible" values, makes debugging much easier. Cons: Extra work for you, the code writer. Decision: If your class defines member variables and has no other constructors you must define a default constructor (one that takes no arguments). It should preferably initialize the object in such a way that its internal state is consistent and valid. The reason for this is that if you have no other constructors and do not define a default constructor, the compiler will generate one for you. This compiler generated constructor may not initialize your object sensibly. If your class inherits from an existing class but you add no new member variables, you are not required to have a default constructor. Explicit Constructors link ▶Use the C++ keyword explicit for constructors with one argument. Definition: Normally, if a constructor takes one argument, it can be used as a conversion. For instance, if you define Foo::Foo(string name) and then pass a string to a function that expects a Foo, the constructor will be called to convert the string into a Foo and will pass the Foo to your function for you. This can be convenient but is also a source of trouble when things get converted and new objects created without you meaning them to. Declaring a constructor explicit prevents it from being invoked implicitly as a conversion. Pros: Avoids undesirable conversions. Cons: None. Decision: We require all single argument constructors to be explicit. Always put explicit in front of one-argument constructors in the class definition: explicit Foo(string name); The exception is copy constructors, which, in the rare cases when we allow them, should probably not be explicit. Classes that are intended to be transparent wrappers around other classes are also exceptions. Such exceptions should be clearly marked with comments. Copy Constructors link ▶Provide a copy constructor and assignment operator only when necessary. Otherwise, disable them with DISALLOW_COPY_AND_ASSIGN. Definition: The copy constructor and assignment operator are used to create copies of objects. The copy constructor is implicitly invoked by the compiler in some situations, e.g. passing objects by value. Pros: Copy constructors make it easy to copy objects. STL containers require that all contents be copyable and assignable. Copy constructors can be more efficient than CopyFrom()-style workarounds because they combine construction with copying, the compiler can elide them in some contexts, and they make it easier to avoid heap allocation. Cons: Implicit copying of objects in C++ is a rich source of bugs and of performance problems. It also reduces readability, as it becomes hard to track which objects are being passed around by value as opposed to by reference, and therefore where changes to an object are reflected. Decision: Few classes need to be copyable. Most should have neither a copy constructor nor an assignment operator. In many situations, a pointer or reference will work just as well as a copied value, with better performance. For example, you can pass function parameters by reference or pointer instead of by value, and you can store pointers rather than objects in an STL container. If your class needs to be copyable, prefer providing a copy method, such as CopyFrom() or Clone(), rather than a copy constructor, because such methods cannot be invoked implicitly. If a copy method is insufficient in your situation (e.g. for performance reasons, or because your class needs to be stored by value in an STL container), provide both a copy constructor and assignment operator. If your class does not need a copy constructor or assignment operator, you must explicitly disable them. To do so, add dummy declarations for the copy constructor and assignment operator in the private: section of your class, but do not provide any corresponding definition (so that any attempt to use them results in a link error). For convenience, a DISALLOW_COPY_AND_ASSIGN macro can be used: // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) Then, in class Foo: class Foo { public: Foo(int f); ~Foo(); private: DISALLOW_COPY_AND_ASSIGN(Foo); }; Structs vs. Classes link ▶Use a struct only for passive objects that carry data; everything else is a class. The struct and class keywords behave almost identically in C++. We add our own semantic meanings to each keyword, so you should use the appropriate keyword for the data-type you're defining. structs should be used for passive objects that carry data, and may have associated constants, but lack any functionality other than access/setting the data members. The accessing/setting of fields is done by directly accessing the fields rather than through method invocations. Methods should not provide behavior but should only be used to set up the data members, e.g., constructor, destructor, Initialize(), Reset(), Validate(). If more functionality is required, a class is more appropriate. If in doubt, make it a class. For consistency with STL, you can use struct instead of class for functors and traits. Note that member variables in structs and classes have different naming rules. Inheritance link ▶Composition is often more appropriate than inheritance. When using inheritance, make it public. Definition: When a sub-class inherits from a base class, it includes the definitions of all the data and operations that the parent base class defines. In practice, inheritance is used in two major ways in C++: implementation inheritance, in which actual code is inherited by the child, and interface inheritance, in which only method names are inherited. Pros: Implementation inheritance reduces code size by re-using the base class code as it specializes an existing type. Because inheritance is a compile-time declaration, you and the compiler can understand the operation and detect errors. Interface inheritance can be used to programmatically enforce that a class expose a particular API. Again, the compiler can detect errors, in this case, when a class does not define a necessary method of the API. Cons: For implementation inheritance, because the code implementing a sub-class is spread between the base and the sub-class, it can be more difficult to understand an implementation. The sub-class cannot override functions that are not virtual, so the sub-class cannot change implementation. The base class may also define some data members, so that specifies physical layout of the base class. Decision: All inheritance should be public. If you want to do private inheritance, you should be including an instance of the base class as a member instead. Do not overuse implementation inheritance. Composition is often more appropriate. Try to restrict use of inheritance to the "is-a" case: Bar subclasses Foo if it can reasonably be said that Bar "is a kind of" Foo. Make your destructor virtual if necessary. If your class has virtual methods, its destructor should be virtual. Limit the use of protected to those member functions that might need to be accessed from subclasses. Note that data members should be private. When redefining an inherited virtual function, explicitly declare it virtual in the declaration of the derived class. Rationale: If virtual is omitted, the reader has to check all ancestors of the class in question to determine if the function is virtual or not. Multiple Inheritance link ▶Only very rarely is multiple implementation inheritance actually useful. We allow multiple inheritance only when at most one of the base classes has an implementation; all other base classes must be pure interface classes tagged with the Interface suffix. Definition: Multiple inheritance allows a sub-class to have more than one base class. We distinguish between base classes that are pure interfaces and those that have an implementation. Pros: Multiple implementation inheritance may let you re-use even more code than single inheritance (see Inheritance). Cons: Only very rarely is multiple implementation inheritance actually useful. When multiple implementation inheritance seems like the solution, you can usually find a different, more explicit, and cleaner solution. Decision: Multiple inheritance is allowed only when all superclasses, with the possible exception of the first one, are pure interfaces. In order to ensure that they remain pure interfaces, they must end with the Interface suffix. Note: There is an exception to this rule on Windows. Interfaces link ▶Classes that satisfy certain conditions are allowed, but not required, to end with an Interface suffix. Definition: A class is a pure interface if it meets the following requirements: It has only public pure virtual ("= 0") methods and static methods (but see below for destructor). It may not have non-static data members. It need not have any constructors defined. If a constructor is provided, it must take no arguments and it must be protected. If it is a subclass, it may only be derived from classes that satisfy these conditions and are tagged with the Interface suffix. An interface class can never be directly instantiated because of the pure virtual method(s) it declares. To make sure all implementations of the interface can be destroyed correctly, they must also declare a virtual destructor (in an exception to the first rule, this should not be pure). See Stroustrup, The C++ Programming Language, 3rd edition, section 12.4 for details. Pros: Tagging a class with the Interface suffix lets others know that they must not add implemented methods or non static data members. This is particularly important in the case of multiple inheritance. Additionally, the interface concept is already well-understood by Java programmers. Cons: The Interface suffix lengthens the class name, which can make it harder to read and understand. Also, the interface property may be considered an implementation detail that shouldn't be exposed to clients. Decision: A class may end with Interface only if it meets the above requirements. We do not require the converse, however: classes that meet the above requirements are not required to end with Interface. Operator Overloading link ▶Do not overload operators except in rare, special circumstances. Definition: A class can define that operators such as + and / operate on the class as if it were a built-in type. Pros: Can make code appear more intuitive because a class will behave in the same way as built-in types (such as int). Overloaded operators are more playful names for functions that are less-colorfully named, such as Equals() or Add(). For some template functions to work correctly, you may need to define operators. Cons: While operator overloading can make code more intuitive, it has several drawbacks: It can fool our intuition into thinking that expensive operations are cheap, built-in operations. It is much harder to find the call sites for overloaded operators. Searching for Equals() is much easier than searching for relevant invocations of ==. Some operators work on pointers too, making it easy to introduce bugs. Foo + 4 may do one thing, while &Foo + 4 does something totally different. The compiler does not complain for either of these, making this very hard to debug. Overloading also has surprising ramifications. For instance, if a class overloads unary operator&, it cannot safely be forward-declared. Decision: In general, do not overload operators. The assignment operator (operator=), in particular, is insidious and should be avoided. You can define functions like Equals() and CopyFrom() if you need them. Likewise, avoid the dangerous unary operator& at all costs, if there's any possibility the class might be forward-declared. However, there may be rare cases where you need to overload an operator to interoperate with templates or "standard" C++ classes (such as operator<<(ostream&, const T&) for logging). These are acceptable if fully justified, but you should try to avoid these whenever possible. In particular, do not overload operator== or operator< just so that your class can be used as a key in an STL container; instead, you should create equality and comparison functor types when declaring the container. Some of the STL algorithms do require you to overload operator==, and you may do so in these cases, provided you document why. See also Copy Constructors and Function Overloading. Access Control link ▶Make data members private, and provide access to them through accessor functions as needed (for technical reasons, we allow data members of a test fixture class to be protected when using Google Test). Typically a variable would be called foo_ and the accessor function foo(). You may also want a mutator function set_foo(). Exception: static const data members (typically called kFoo) need not be private. The definitions of accessors are usually inlined in the header file. See also Inheritance and Function Names. Declaration Order link ▶Use the specified order of declarations within a class: public: before private:, methods before data members (variables), etc. Your class definition should start with its public: section, followed by its protected: section and then its private: section. If any of these sections are empty, omit them. Within each section, the declarations generally should be in the following order: Typedefs and Enums Constants (static const data members) Constructors Destructor Methods, including static methods Data Members (except static const data members) Friend declarations should always be in the private section, and the DISALLOW_COPY_AND_ASSIGN macro invocation should be at the end of the private: section. It should be the last thing in the class. See Copy Constructors. Method definitions in the corresponding .cc file should be the same as the declaration order, as much as possible. Do not put large method definitions inline in the class definition. Usually, only trivial or performance-critical, and very short, methods may be defined inline. See Inline Functions for more details. Write Short Functions link ▶Prefer small and focused functions. We recognize that long functions are sometimes appropriate, so no hard limit is placed on functions length. If a function exceeds about 40 lines, think about whether it can be broken up without harming the structure of the program. Even if your long function works perfectly now, someone modifying it in a few months may add new behavior. This could result in bugs that are hard to find. Keeping your functions short and simple makes it easier for other people to read and modify your code. You could find long and complicated functions when working with some code. Do not be intimidated by modifying existing code: if working with such a function proves to be difficult, you find that errors are hard to debug, or you want to use a piece of it in several different contexts, consider breaking up the function into smaller and more manageable pieces. Google-Specific Magic There are various tricks and utilities that we use to make C++ code more robust, and various ways we use C++ that may differ from what you see elsewhere. Smart Pointers link ▶If you actually need pointer semantics, scoped_ptr is great. You should only use std::tr1::shared_ptr under very specific conditions, such as when objects need to be held by STL containers. You should never use auto_ptr. "Smart" pointers are objects that act like pointers but have added semantics. When a scoped_ptr is destroyed, for instance, it deletes the object it's pointing to. shared_ptr is the same way, but implements reference-counting so only the last pointer to an object deletes it. Generally speaking, we prefer that we design code with clear object ownership. The clearest object ownership is obtained by using an object directly as a field or local variable, without using pointers at all. On the other extreme, by their very definition, reference counted pointers are owned by nobody. The problem with this design is that it is easy to create circular references or other strange conditions that cause an object to never be deleted. It is also slow to perform atomic operations every time a value is copied or assigned. Although they are not recommended, reference counted pointers are sometimes the simplest and most elegant way to solve a problem. cpplint link ▶Use cpplint.py to detect style errors. cpplint.py is a tool that reads a source file and identifies many style errors. It is not perfect, and has both false positives and false negatives, but it is still a valuable tool. False positives can be ignored by putting // NOLINT at the end of the line. Some projects have instructions on how to run cpplint.py from their project tools. If the project you are contributing to does not, you can download cpplint.py separately. Other C++ Features Reference Arguments link ▶All parameters passed by reference must be labeled const. Definition: In C, if a function needs to modify a variable, the parameter must use a pointer, eg int foo(int *pval). In C++, the function can alternatively declare a reference parameter: int foo(int &val). Pros: Defining a parameter as reference avoids ugly code like (*pval)++. Necessary for some applications like copy constructors. Makes it clear, unlike with pointers, that NULL is not a possible value. Cons: References can be confusing, as they have value syntax but pointer semantics. Decision: Within function parameter lists all references must be const: void Foo(const string &in, string *out); In fact it is a very strong convention in Google code that input arguments are values or const references while output arguments are pointers. Input parameters may be const pointers, but we never allow non-const reference parameters. One case when you might want an input parameter to be a const pointer is if you want to emphasize that the argument is not copied, so it must exist for the lifetime of the object; it is usually best to document this in comments as well. STL adapters such as bind2nd and mem_fun do not permit reference parameters, so you must declare functions with pointer parameters in these cases, too. Function Overloading link ▶Use overloaded functions (including constructors) only if a reader looking at a call site can get a good idea of what is happening without having to first figure out exactly which overload is being called. Definition: You may write a function that takes a const string& and overload it with another that takes const char*. class MyClass { public: void Analyze(const string &text); void Analyze(const char *text, size_t textlen); }; Pros: Overloading can make code more intuitive by allowing an identically-named function to take different arguments. It may be necessary for templatized code, and it can be convenient for Visitors. Cons: If a function is overloaded by the argument types alone, a reader may have to understand C++'s complex matching rules in order to tell what's going on. Also many people are confused by the semantics of inheritance if a derived class overrides only some of the variants of a function. Decision: If you want to overload a function, consider qualifying the name with some information about the arguments, e.g., AppendString(), AppendInt() rather than just Append(). Default Arguments link ▶We do not allow default function parameters, except in a few uncommon situations explained below. Pros: Often you have a function that uses lots of default values, but occasionally you want to override the defaults. Default parameters allow an easy way to do this without having to define many functions for the rare exceptions. Cons: People often figure out how to use an API by looking at existing code that uses it. Default parameters are more difficult to maintain because copy-and-paste from previous code may not reveal all the parameters. Copy-and-pasting of code segments can cause major problems when the default arguments are not appropriate for the new code. Decision: Except as described below, we require all arguments to be explicitly specified, to force programmers to consider the API and the values they are passing for each argument rather than silently accepting defaults they may not be aware of. One specific exception is when default arguments are used to simulate variable-length argument lists. // Support up to 4 params by using a default empty AlphaNum. string StrCat(const AlphaNum &a, const AlphaNum &b = gEmptyAlphaNum, const AlphaNum &c = gEmptyAlphaNum, const AlphaNum &d = gEmptyAlphaNum); Variable-Length Arrays and alloca() link ▶We do not allow variable-length arrays or alloca(). Pros: Variable-length arrays have natural-looking syntax. Both variable-length arrays and alloca() are very efficient. Cons: Variable-length arrays and alloca are not part of Standard C++. More importantly, they allocate a data-dependent amount of stack space that can trigger difficult-to-find memory overwriting bugs: "It ran fine on my machine, but dies mysteriously in production". Decision: Use a safe allocator instead, such as scoped_ptr/scoped_array. Friends link ▶We allow use of friend classes and functions, within reason. Friends should usually be defined in the same file so that the reader does not have to look in another file to find uses of the private members of a class. A common use of friend is to have a FooBuilder class be a friend of Foo so that it can construct the inner state of Foo correctly, without exposing this state to the world. In some cases it may be useful to make a unittest class a friend of the class it tests. Friends extend, but do not break, the encapsulation boundary of a class. In some cases this is better than making a member public when you want to give only one other class access to it. However, most classes should interact with other classes solely through their public members. Exceptions link ▶We do not use C++ exceptions. Pros: Exceptions allow higher levels of an application to decide how to handle "can't happen" failures in deeply nested functions, without the obscuring and error-prone bookkeeping of error codes. Exceptions are used by most other modern languages. Using them in C++ would make it more consistent with Python, Java, and the C++ that others are familiar with. Some third-party C++ libraries use exceptions, and turning them off internally makes it harder to integrate with those libraries. Exceptions are the only way for a constructor to fail. We can simulate this with a factory function or an Init() method, but these require heap allocation or a new "invalid" state, respectively. Exceptions are really handy in testing frameworks. Cons: When you add a throw statement to an existing function, you must examine all of its transitive callers. Either they must make at least the basic exception safety guarantee, or they must never catch the exception and be happy with the program terminating as a result. For instance, if f() calls g() calls h(), and h throws an exception that f catches, g has to be careful or it may not clean up properly. More generally, exceptions make the control flow of programs difficult to evaluate by looking at code: functions may return in places you don't expect. This causes maintainability and debugging difficulties. You can minimize this cost via some rules on how and where exceptions can be used, but at the cost of more that a developer needs to know and understand. Exception safety requires both RAII and different coding practices. Lots of supporting machinery is needed to make writing correct exception-safe code easy. Further, to avoid requiring readers to understand the entire call graph, exception-safe code must isolate logic that writes to persistent state into a "commit" phase. This will have both benefits and costs (perhaps where you're forced to obfuscate code to isolate the commit). Allowing exceptions would force us to always pay those costs even when they're not worth it. Turning on exceptions adds data to each binary produced, increasing compile time (probably slightly) and possibly increasing address space pressure. The availability of exceptions may encourage developers to throw them when they are not appropriate or recover from them when it's not safe to do so. For example, invalid user input should not cause exceptions to be thrown. We would need to make the style guide even longer to document these restrictions! Decision: On their face, the benefits of using exceptions outweigh the costs, especially in new projects. However, for existing code, the introduction of exceptions has implications on all dependent code. If exceptions can be propagated beyond a new project, it also becomes problematic to integrate the new project into existing exception-free code. Because most existing C++ code at Google is not prepared to deal with exceptions, it is comparatively difficult to adopt new code that generates exceptions. Given that Google's existing code is not exception-tolerant, the costs of using exceptions are somewhat greater than the costs in a new project. The conversion process would be slow and error-prone. We don't believe that the available alternatives to exceptions, such as error codes and assertions, introduce a significant burden. Our advice against using exceptions is not predicated on philosophical or moral grounds, but practical ones. Because we'd like to use our open-source projects at Google and it's difficult to do so if those projects use exceptions, we need to advise against exceptions in Google open-source projects as well. Things would probably be different if we had to do it all over again from scratch. There is an exception to this rule (no pun intended) for Windows code. Run-Time Type Information (RTTI) link ▶We do not use Run Time Type Information (RTTI). Definition: RTTI allows a programmer to query the C++ class of an object at run time. Pros: It is useful in some unittests. For example, it is useful in tests of factory classes where the test has to verify that a newly created object has the expected dynamic type. In rare circumstances, it is useful even outside of tests. Cons: A query of type during run-time typically means a design problem. If you need to know the type of an object at runtime, that is often an indication that you should reconsider the design of your class. Decision: Do not use RTTI, except in unittests. If you find yourself in need of writing code that behaves differently based on the class of an object, consider one of the alternatives to querying the type. Virtual methods are the preferred way of executing different code paths depending on a specific subclass type. This puts the work within the object itself. If the work belongs outside the object and instead in some processing code, consider a double-dispatch solution, such as the Visitor design pattern. This allows a facility outside the object itself to determine the type of class using the built-in type system. If you think you truly cannot use those ideas, you may use RTTI. But think twice about it. :-) Then think twice again. Do not hand-implement an RTTI-like workaround. The arguments against RTTI apply just as much to workarounds like class hierarchies with type tags. Casting link ▶Use C++ casts like static_cast<>(). Do not use other cast formats like int y = (int)x; or int y = int(x);. Definition: C++ introduced a different cast system from C that distinguishes the types of cast operations. Pros: The problem with C casts is the ambiguity of the operation; sometimes you are doing a conversion (e.g., (int)3.5) and sometimes you are doing a cast (e.g., (int)"hello"); C++ casts avoid this. Additionally C++ casts are more visible when searching for them. Cons: The syntax is nasty. Decision: Do not use C-style casts. Instead, use these C++-style casts. Use static_cast as the equivalent of a C-style cast that does value conversion, or when you need to explicitly up-cast a pointer from a class to its superclass. Use const_cast to remove the const qualifier (see const). Use reinterpret_cast to do unsafe conversions of pointer types to and from integer and other pointer types. Use this only if you know what you are doing and you understand the aliasing issues. Do not use dynamic_cast except in test code. If you need to know type information at runtime in this way outside of a unittest, you probably have a design flaw. Streams link ▶Use streams only for logging. Definition: Streams are a replacement for printf() and scanf(). Pros: With streams, you do not need to know the type of the object you are printing. You do not have problems with format strings not matching the argument list. (Though with gcc, you do not have that problem with printf either.) Streams have automatic constructors and destructors that open and close the relevant files. Cons: Streams make it difficult to do functionality like pread(). Some formatting (particularly the common format string idiom %.*s) is difficult if not impossible to do efficiently using streams without using printf-like hacks. Streams do not support operator reordering (the %1s directive), which is helpful for internationalization. Decision: Do not use streams, except where required by a logging interface. Use printf-like routines instead. There are various pros and cons to using streams, but in this case, as in many other cases, consistency trumps the debate. Do not use streams in your code. Extended Discussion There has been debate on this issue, so this explains the reasoning in greater depth. Recall the Only One Way guiding principle: we want to make sure that whenever we do a certain type of I/O, the code looks the same in all those places. Because of this, we do not want to allow users to decide between using streams or using printf plus Read/Write/etc. Instead, we should settle on one or the other. We made an exception for logging because it is a pretty specialized application, and for historical reasons. Proponents of streams have argued that streams are the obvious choice of the two, but the issue is not actually so clear. For every advantage of streams they point out, there is an equivalent disadvantage. The biggest advantage is that you do not need to know the type of the object to be printing. This is a fair point. But, there is a downside: you can easily use the wrong type, and the compiler will not warn you. It is easy to make this kind of mistake without knowing when using streams. cout << this; // Prints the address cout << *this; // Prints the contents The compiler does not generate an error because << has been overloaded. We discourage overloading for just this reason. Some say printf formatting is ugly and hard to read, but streams are often no better. Consider the following two fragments, both with the same typo. Which is easier to discover? cerr << "Error connecting to '" << foo->bar()->hostname.first << ":" << foo->bar()->hostname.second << ": " << strerror(errno); fprintf(stderr, "Error connecting to '%s:%u: %s", foo->bar()->hostname.first, foo->bar()->hostname.second, strerror(errno)); And so on and so forth for any issue you might bring up. (You could argue, "Things would be better with the right wrappers," but if it is true for one scheme, is it not also true for the other? Also, remember the goal is to make the language smaller, not add yet more machinery that someone has to learn.) Either path would yield different advantages and disadvantages, and there is not a clearly superior solution. The simplicity doctrine mandates we settle on one of them though, and the majority decision was on printf + read/write. Preincrement and Predecrement link ▶Use prefix form (++i) of the increment and decrement operators with iterators and other template objects. Definition: When a variable is incremented (++i or i++) or decremented (--i or i--) and the value of the expression is not used, one must decide whether to preincrement (decrement) or postincrement (decrement). Pros: When the return value is ignored, the "pre" form (++i) is never less efficient than the "post" form (i++), and is often more efficient. This is because post-increment (or decrement) requires a copy of i to be made, which is the value of the expression. If i is an iterator or other non-scalar type, copying i could be expensive. Since the two types of increment behave the same when the value is ignored, why not just always pre-increment? Cons: The tradition developed, in C, of using post-increment when the expression value is not used, especially in for loops. Some find post-increment easier to read, since the "subject" (i) precedes the "verb" (++), just like in English. Decision: For simple scalar (non-object) values there is no reason to prefer one form and we allow either. For iterators and other template types, use pre-increment. Use of const link ▶We strongly recommend that you use const whenever it makes sense to do so. Definition: Declared variables and parameters can be preceded by the keyword const to indicate the variables are not changed (e.g., const int foo). Class functions can have the const qualifier to indicate the function does not change the state of the class member variables (e.g., class Foo { int Bar(char c) const; };). Pros: Easier for people to understand how variables are being used. Allows the compiler to do better type checking, and, conceivably, generate better code. Helps people convince themselves of program correctness because they know the functions they call are limited in how they can modify your variables. Helps people know what functions are safe to use without locks in multi-threaded programs. Cons: const is viral: if you pass a const variable to a function, that function must have const in its prototype (or the variable will need a const_cast). This can be a particular problem when calling library functions. Decision: const variables, data members, methods and arguments add a level of compile-time type checking; it is better to detect errors as soon as possible. Therefore we strongly recommend that you use const whenever it makes sense to do so: If a function does not modify an argument passed by reference or by pointer, that argument should be const. Declare methods to be const whenever possible. Accessors should almost always be const. Other methods should be const if they do not modify any data members, do not call any non-const methods, and do not return a non-const pointer or non-const reference to a data member. Consider making data members const whenever they do not need to be modified after construction. However, do not go crazy with const. Something like const int * const * const x; is likely overkill, even if it accurately describes how const x is. Focus on what's really useful to know: in this case, const int** x is probably sufficient. The mutable keyword is allowed but is unsafe when used with threads, so thread safety should be carefully considered first. Where to put the const Some people favor the form int const *foo to const int* foo. They argue that this is more readable because it's more consistent: it keeps the rule that const always follows the object it's describing. However, this consistency argument doesn't apply in this case, because the "don't go crazy" dictum eliminates most of the uses you'd have to be consistent with. Putting the const first is arguably more readable, since it follows English in putting the "adjective" (const) before the "noun" (int). That said, while we encourage putting const first, we do not require it. But be consistent with the code around you! Integer Types link ▶Of the built-in C++ integer types, the only one used is int. If a program needs a variable of a different size, use a precise-width integer type from , such as int16_t. Definition: C++ does not specify the sizes of its integer types. Typically people assume that short is 16 bits, int is 32 bits, long is 32 bits and long long is 64 bits. Pros: Uniformity of declaration. Cons: The sizes of integral types in C++ can vary based on compiler and architecture. Decision: defines types like int16_t, uint32_t, int64_t, etc. You should always use those in preference to short, unsigned long long and the like, when you need a guarantee on the size of an integer. Of the C integer types, only int should be used. When appropriate, you are welcome to use standard types like size_t and ptrdiff_t. We use int very often, for integers we know are not going to be too big, e.g., loop counters. Use plain old int for such things. You should assume that an int is at least 32 bits, but don't assume that it has more than 32 bits. If you need a 64-bit integer type, use int64_t or uint64_t. For integers we know can be "big", use int64_t. You should not use the unsigned integer types such as uint32_t, unless the quantity you are representing is really a bit pattern rather than a number, or unless you need defined twos-complement overflow. In particular, do not use unsigned types to say a number will never be negative. Instead, use assertions for this. On Unsigned Integers Some people, including some textbook authors, recommend using unsigned types to represent numbers that are never negative. This is intended as a form of self-documentation. However, in C, the advantages of such documentation are outweighed by the real bugs it can introduce. Consider: for (unsigned int i = foo.Length()-1; i >= 0; --i) ... This code will never terminate! Sometimes gcc will notice this bug and warn you, but often it will not. Equally bad bugs can occur when comparing signed and unsigned variables. Basically, C's type-promotion scheme causes unsigned types to behave differently than one might expect. So, document that a variable is non-negative using assertions. Don't use an unsigned type. 64-bit Portability link ▶Code should be 64-bit and 32-bit friendly. Bear in mind problems of printing, comparisons, and structure alignment. printf() specifiers for some types are not cleanly portable between 32-bit and 64-bit systems. C99 defines some portable format specifiers. Unfortunately, MSVC 7.1 does not understand some of these specifiers and the standard is missing a few, so we have to define our own ugly versions in some cases (in the style of the standard include file inttypes.h): // printf macros for size_t, in the style of inttypes.h #ifdef _LP64 #define __PRIS_PREFIX "z" #else #define __PRIS_PREFIX #endif // Use these macros after a % in a printf format string // to get correct 32/64 bit behavior, like this: // size_t size = records.size(); // printf("%"PRIuS"\n", size); #define PRIdS __PRIS_PREFIX "d" #define PRIxS __PRIS_PREFIX "x" #define PRIuS __PRIS_PREFIX "u" #define PRIXS __PRIS_PREFIX "X" #define PRIoS __PRIS_PREFIX "o" Type DO NOT use DO use Notes void * (or any pointer) %lx %p int64_t %qd, %lld %"PRId64" uint64_t %qu, %llu, %llx %"PRIu64", %"PRIx64" size_t %u %"PRIuS", %"PRIxS" C99 specifies %zu ptrdiff_t %d %"PRIdS" C99 specifies %zd Note that the PRI* macros expand to independent strings which are concatenated by the compiler. Hence if you are using a non-constant format string, you need to insert the value of the macro into the format, rather than the name. It is still possible, as usual, to include length specifiers, etc., after the % when using the PRI* macros. So, e.g. printf("x = %30"PRIuS"\n", x) would expand on 32-bit Linux to printf("x = %30" "u" "\n", x), which the compiler will treat as printf("x = %30u\n", x). Remember that sizeof(void *) != sizeof(int). Use intptr_t if you want a pointer-sized integer. You may need to be careful with structure alignments, particularly for structures being stored on disk. Any class/structure with a int64_t/uint64_t member will by default end up being 8-byte aligned on a 64-bit system. If you have such structures being shared on disk between 32-bit and 64-bit code, you will need to ensure that they are packed the same on both architectures. Most compilers offer a way to alter structure alignment. For gcc, you can use __attribute__((packed)). MSVC offers #pragma pack() and __declspec(align()). Use the LL or ULL suffixes a

立即下载
7z文件
获取USB摄像头的1080p的JPEG格式的图片20180608_1806.7z

获取USB摄像头的1080p的JPEG格式的图片20180608_1806.7z 电脑上的系统:ubuntu14.04 // http://www.linuxidc.com/Linux/2011-03/33020.htm // V4L2摄像头获取单幅图片测试程序(MMAP模式) // [日期:2011-03-06] 来源:Linux社区 作者:aokikyon [字体:大 中 小] // // #加了点注释 // // #Rockie Cheng // printf #include #include // memset #include #include #include #include // close write usleep read #include #include #include #include #include #include // mmap #include #include #include #include // pthread_create pthread_join #include #define CLEAR(x) memset (&(x), 0, sizeof (x)) #define REQ_COUNT 6 #define uchar unsigned char struct buffer { void * start; size_t length; }; static char * dev_name = "/dev/video0";//摄像头设备名 static int fd = -1; struct buffer * buffers = NULL; // static unsigned int n_buffers = 0; // 2012-7-13 11:33 camera flag // static int iFlagCamera = 0; volatile int iFlagCamera = 0; // 函数名称:thread1 // 函数功能:用于接受键盘的输入,之后通知thread2抓图 // 参数列表: // 返回值 : void thread1(void) { char ch; printf("\n !!!!Warning!!!!\n Max 1000 color bmp\n Input the char: \n"); printf("\n !!!!press o an capture 1 frame picture! \n"); printf("\n !!!!press t an capture 10 frame picture! \n"); printf("\n !!!!press h an capture 100 frame picture! \n"); while(1) { while((ch=getchar()) != '\n') { printf("%c\n", ch); if('o'==ch) { iFlagCamera = 1; printf("thread1=%d\n", iFlagCamera); } else if('t'==ch) { iFlagCamera = 10; printf("thread1=%d\n", iFlagCamera); } else if('h'==ch) { iFlagCamera = 101; printf("thread1=%d\n", iFlagCamera); } else if('q'==ch) { iFlagCamera = 10001; printf("thread1=%d\n", iFlagCamera); } } if(iFlagCamera>1000) { break; } } printf("\n exit\n"); } FILE *file_fd; int i; int r; struct v4l2_capability cap; struct v4l2_format fmt; struct v4l2_buffer buf[REQ_COUNT]; struct v4l2_requestbuffers req; struct v4l2_buffer tmp_buf; enum v4l2_buf_type type; struct timeval tv; struct timeval tp1; struct timeval tp3; struct timeval tp4; // void * mem[REQ_COUNT]; fd_set fds; // // http://blog.sina.com.cn/s/blog_602f87700100znq7.html // // 嵌入式Linux下Camera编程--V4L2 // // Z:\kernel_imx\include\linux\videodev2.h // /* Values for 'capabilities' field */ #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ #define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ #define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ /* Is a video capture device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 /* Is a video output device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ void getCameraCapabilities(int iCameraCapabilities) { if(iCameraCapabilities&V4L2;_CAP_VIDEO_CAPTURE) { printf("!!!!**** camera ****!!!! Is a video capture device\n"); } if(iCameraCapabilities&V4L2;_CAP_VIDEO_OUTPUT) { printf("**** camera **** Is a video output device\n"); } if(iCameraCapabilities&V4L2;_CAP_VIDEO_OVERLAY) { printf("**** camera **** Can do video overlay\n"); } if(iCameraCapabilities&V4L2;_CAP_VBI_CAPTURE) { printf("**** camera **** Is a raw VBI capture device\n"); } if(iCameraCapabilities&V4L2;_CAP_VBI_OUTPUT) { printf("**** camera **** Is a raw VBI output device\n"); } if(iCameraCapabilities&V4L2;_CAP_SLICED_VBI_CAPTURE) { printf("**** camera **** Is a sliced VBI capture device\n"); } if(iCameraCapabilities&V4L2;_CAP_SLICED_VBI_OUTPUT) { printf("**** camera **** Is a sliced VBI output device\n"); } if(iCameraCapabilities&V4L2;_CAP_RDS_CAPTURE) { printf("**** camera **** RDS data capture\n"); } if(iCameraCapabilities&V4L2;_CAP_VIDEO_OUTPUT_OVERLAY) { printf("**** camera **** Can do video output overlay\n"); } if(iCameraCapabilities&V4L2;_CAP_HW_FREQ_SEEK) { printf("**** camera **** Can do hardware frequency seek\n"); } if(iCameraCapabilities&V4L2;_CAP_RDS_OUTPUT) { printf("**** camera **** Is an RDS encoder\n"); } if(iCameraCapabilities&V4L2;_CAP_VIDEO_CAPTURE_MPLANE) { printf("**** camera **** Is a video capture device that supports multiplanar formats\n"); } if(iCameraCapabilities&V4L2;_CAP_VIDEO_OUTPUT_MPLANE) { printf("**** camera **** Is a video output device that supports multiplanar formats\n"); } if(iCameraCapabilities&V4L2;_CAP_TUNER) { printf("**** camera **** has a tuner\n"); } if(iCameraCapabilities&V4L2;_CAP_AUDIO) { printf("**** camera **** has audio support\n"); } if(iCameraCapabilities&V4L2;_CAP_RADIO) { printf("**** camera **** is a radio device\n"); } if(iCameraCapabilities&V4L2;_CAP_MODULATOR) { printf("**** camera **** has a modulator\n"); } if(iCameraCapabilities&V4L2;_CAP_READWRITE) { printf("**** camera **** read/write systemcalls\n"); } if(iCameraCapabilities&V4L2;_CAP_ASYNCIO) { printf("**** camera **** async I/O\n"); } if(iCameraCapabilities&V4L2;_CAP_STREAMING) { printf("!!!!**** camera ****!!!! streaming I/O ioctls\n"); } } // 公司 :红蝶科技(深圳)有限公司 // 作者 :蒋海滨 0755-86139000-1052 // 文件名 :main.c // 功能 :N001 // 日期 :2012-7-28 10:08 // 维护者 : // 维护记录: // #include "imgprocess.h" #include // int main () void thread2(void) { int iCounterCamera = 0; int iCounter100frame = 0; // 2012-11-8 05:27下午 RGB24 640*480分辨率的BMP图像头文件 // unsigned char head[54] = {0x42,0x4d,0x36,0x10,0x0e,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x80,0x02,0x00,0x00,0xe0,0x01,0x00,0x00,0x01,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; // 抓取Y分量所取得的灰度图 //unsigned char graybmphead[1078] = { 0x42, 0x4d, 0x36, 0xb4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x04, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x02, 0x00, 0x03, 0x03, 0x03, 0x00, 0x04, 0x04, 0x04, 0x00, 0x05, 0x05, 0x05, 0x00, 0x06, 0x06, 0x06, 0x00, 0x07, 0x07, 0x07, 0x00, 0x08, 0x08, 0x08, 0x00, 0x09, 0x09, 0x09, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x0b, 0x0b, 0x0b, 0x00, 0x0c, 0x0c, 0x0c, 0x00, 0x0d, 0x0d, 0x0d, 0x00, 0x0e, 0x0e, 0x0e, 0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x10, 0x10, 0x10, 0x00, 0x11, 0x11, 0x11, 0x00, 0x12, 0x12, 0x12, 0x00, 0x13, 0x13, 0x13, 0x00, 0x14, 0x14, 0x14, 0x00, 0x15, 0x15, 0x15, 0x00, 0x16, 0x16, 0x16, 0x00, 0x17, 0x17, 0x17, 0x00, 0x18, 0x18, 0x18, 0x00, 0x19, 0x19, 0x19, 0x00, 0x1a, 0x1a, 0x1a, 0x00, 0x1b, 0x1b, 0x1b, 0x00, 0x1c, 0x1c, 0x1c, 0x00, 0x1d, 0x1d, 0x1d, 0x00, 0x1e, 0x1e, 0x1e, 0x00, 0x1f, 0x1f, 0x1f, 0x00, 0x20, 0x20, 0x20, 0x00, 0x21, 0x21, 0x21, 0x00, 0x22, 0x22, 0x22, 0x00, 0x23, 0x23, 0x23, 0x00, 0x24, 0x24, 0x24, 0x00, 0x25, 0x25, 0x25, 0x00, 0x26, 0x26, 0x26, 0x00, 0x27, 0x27, 0x27, 0x00, 0x28, 0x28, 0x28, 0x00, 0x29, 0x29, 0x29, 0x00, 0x2a, 0x2a, 0x2a, 0x00, 0x2b, 0x2b, 0x2b, 0x00, 0x2c, 0x2c, 0x2c, 0x00, 0x2d, 0x2d, 0x2d, 0x00, 0x2e, 0x2e, 0x2e, 0x00, 0x2f, 0x2f, 0x2f, 0x00, 0x30, 0x30, 0x30, 0x00, 0x31, 0x31, 0x31, 0x00, 0x32, 0x32, 0x32, 0x00, 0x33, 0x33, 0x33, 0x00, 0x34, 0x34, 0x34, 0x00, 0x35, 0x35, 0x35, 0x00, 0x36, 0x36, 0x36, 0x00, 0x37, 0x37, 0x37, 0x00, 0x38, 0x38, 0x38, 0x00, 0x39, 0x39, 0x39, 0x00, 0x3a, 0x3a, 0x3a, 0x00, 0x3b, 0x3b, 0x3b, 0x00, 0x3c, 0x3c, 0x3c, 0x00, 0x3d, 0x3d, 0x3d, 0x00, 0x3e, 0x3e, 0x3e, 0x00, 0x3f, 0x3f, 0x3f, 0x00, 0x40, 0x40, 0x40, 0x00, 0x41, 0x41, 0x41, 0x00, 0x42, 0x42, 0x42, 0x00, 0x43, 0x43, 0x43, 0x00, 0x44, 0x44, 0x44, 0x00, 0x45, 0x45, 0x45, 0x00, 0x46, 0x46, 0x46, 0x00, 0x47, 0x47, 0x47, 0x00, 0x48, 0x48, 0x48, 0x00, 0x49, 0x49, 0x49, 0x00, 0x4a, 0x4a, 0x4a, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0x4c, 0x4c, 0x4c, 0x00, 0x4d, 0x4d, 0x4d, 0x00, 0x4e, 0x4e, 0x4e, 0x00, 0x4f, 0x4f, 0x4f, 0x00, 0x50, 0x50, 0x50, 0x00, 0x51, 0x51, 0x51, 0x00, 0x52, 0x52, 0x52, 0x00, 0x53, 0x53, 0x53, 0x00, 0x54, 0x54, 0x54, 0x00, 0x55, 0x55, 0x55, 0x00, 0x56, 0x56, 0x56, 0x00, 0x57, 0x57, 0x57, 0x00, 0x58, 0x58, 0x58, 0x00, 0x59, 0x59, 0x59, 0x00, 0x5a, 0x5a, 0x5a, 0x00, 0x5b, 0x5b, 0x5b, 0x00, 0x5c, 0x5c, 0x5c, 0x00, 0x5d, 0x5d, 0x5d, 0x00, 0x5e, 0x5e, 0x5e, 0x00, 0x5f, 0x5f, 0x5f, 0x00, 0x60, 0x60, 0x60, 0x00, 0x61, 0x61, 0x61, 0x00, 0x62, 0x62, 0x62, 0x00, 0x63, 0x63, 0x63, 0x00, 0x64, 0x64, 0x64, 0x00, 0x65, 0x65, 0x65, 0x00, 0x66, 0x66, 0x66, 0x00, 0x67, 0x67, 0x67, 0x00, 0x68, 0x68, 0x68, 0x00, 0x69, 0x69, 0x69, 0x00, 0x6a, 0x6a, 0x6a, 0x00, 0x6b, 0x6b, 0x6b, 0x00, 0x6c, 0x6c, 0x6c, 0x00, 0x6d, 0x6d, 0x6d, 0x00, 0x6e, 0x6e, 0x6e, 0x00, 0x6f, 0x6f, 0x6f, 0x00, 0x70, 0x70, 0x70, 0x00, 0x71, 0x71, 0x71, 0x00, 0x72, 0x72, 0x72, 0x00, 0x73, 0x73, 0x73, 0x00, 0x74, 0x74, 0x74, 0x00, 0x75, 0x75, 0x75, 0x00, 0x76, 0x76, 0x76, 0x00, 0x77, 0x77, 0x77, 0x00, 0x78, 0x78, 0x78, 0x00, 0x79, 0x79, 0x79, 0x00, 0x7a, 0x7a, 0x7a, 0x00, 0x7b, 0x7b, 0x7b, 0x00, 0x7c, 0x7c, 0x7c, 0x00, 0x7d, 0x7d, 0x7d, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x80, 0x80, 0x80, 0x00, 0x81, 0x81, 0x81, 0x00, 0x82, 0x82, 0x82, 0x00, 0x83, 0x83, 0x83, 0x00, 0x84, 0x84, 0x84, 0x00, 0x85, 0x85, 0x85, 0x00, 0x86, 0x86, 0x86, 0x00, 0x87, 0x87, 0x87, 0x00, 0x88, 0x88, 0x88, 0x00, 0x89, 0x89, 0x89, 0x00, 0x8a, 0x8a, 0x8a, 0x00, 0x8b, 0x8b, 0x8b, 0x00, 0x8c, 0x8c, 0x8c, 0x00, 0x8d, 0x8d, 0x8d, 0x00, 0x8e, 0x8e, 0x8e, 0x00, 0x8f, 0x8f, 0x8f, 0x00, 0x90, 0x90, 0x90, 0x00, 0x91, 0x91, 0x91, 0x00, 0x92, 0x92, 0x92, 0x00, 0x93, 0x93, 0x93, 0x00, 0x94, 0x94, 0x94, 0x00, 0x95, 0x95, 0x95, 0x00, 0x96, 0x96, 0x96, 0x00, 0x97, 0x97, 0x97, 0x00, 0x98, 0x98, 0x98, 0x00, 0x99, 0x99, 0x99, 0x00, 0x9a, 0x9a, 0x9a, 0x00, 0x9b, 0x9b, 0x9b, 0x00, 0x9c, 0x9c, 0x9c, 0x00, 0x9d, 0x9d, 0x9d, 0x00, 0x9e, 0x9e, 0x9e, 0x00, 0x9f, 0x9f, 0x9f, 0x00, 0xa0, 0xa0, 0xa0, 0x00, 0xa1, 0xa1, 0xa1, 0x00, 0xa2, 0xa2, 0xa2, 0x00, 0xa3, 0xa3, 0xa3, 0x00, 0xa4, 0xa4, 0xa4, 0x00, 0xa5, 0xa5, 0xa5, 0x00, 0xa6, 0xa6, 0xa6, 0x00, 0xa7, 0xa7, 0xa7, 0x00, 0xa8, 0xa8, 0xa8, 0x00, 0xa9, 0xa9, 0xa9, 0x00, 0xaa, 0xaa, 0xaa, 0x00, 0xab, 0xab, 0xab, 0x00, 0xac, 0xac, 0xac, 0x00, 0xad, 0xad, 0xad, 0x00, 0xae, 0xae, 0xae, 0x00, 0xaf, 0xaf, 0xaf, 0x00, 0xb0, 0xb0, 0xb0, 0x00, 0xb1, 0xb1, 0xb1, 0x00, 0xb2, 0xb2, 0xb2, 0x00, 0xb3, 0xb3, 0xb3, 0x00, 0xb4, 0xb4, 0xb4, 0x00, 0xb5, 0xb5, 0xb5, 0x00, 0xb6, 0xb6, 0xb6, 0x00, 0xb7, 0xb7, 0xb7, 0x00, 0xb8, 0xb8, 0xb8, 0x00, 0xb9, 0xb9, 0xb9, 0x00, 0xba, 0xba, 0xba, 0x00, 0xbb, 0xbb, 0xbb, 0x00, 0xbc, 0xbc, 0xbc, 0x00, 0xbd, 0xbd, 0xbd, 0x00, 0xbe, 0xbe, 0xbe, 0x00, 0xbf, 0xbf, 0xbf, 0x00, 0xc0, 0xc0, 0xc0, 0x00, 0xc1, 0xc1, 0xc1, 0x00, 0xc2, 0xc2, 0xc2, 0x00, 0xc3, 0xc3, 0xc3, 0x00, 0xc4, 0xc4, 0xc4, 0x00, 0xc5, 0xc5, 0xc5, 0x00, 0xc6, 0xc6, 0xc6, 0x00, 0xc7, 0xc7, 0xc7, 0x00, 0xc8, 0xc8, 0xc8, 0x00, 0xc9, 0xc9, 0xc9, 0x00, 0xca, 0xca, 0xca, 0x00, 0xcb, 0xcb, 0xcb, 0x00, 0xcc, 0xcc, 0xcc, 0x00, 0xcd, 0xcd, 0xcd, 0x00, 0xce, 0xce, 0xce, 0x00, 0xcf, 0xcf, 0xcf, 0x00, 0xd0, 0xd0, 0xd0, 0x00, 0xd1, 0xd1, 0xd1, 0x00, 0xd2, 0xd2, 0xd2, 0x00, 0xd3, 0xd3, 0xd3, 0x00, 0xd4, 0xd4, 0xd4, 0x00, 0xd5, 0xd5, 0xd5, 0x00, 0xd6, 0xd6, 0xd6, 0x00, 0xd7, 0xd7, 0xd7, 0x00, 0xd8, 0xd8, 0xd8, 0x00, 0xd9, 0xd9, 0xd9, 0x00, 0xda, 0xda, 0xda, 0x00, 0xdb, 0xdb, 0xdb, 0x00, 0xdc, 0xdc, 0xdc, 0x00, 0xdd, 0xdd, 0xdd, 0x00, 0xde, 0xde, 0xde, 0x00, 0xdf, 0xdf, 0xdf, 0x00, 0xe0, 0xe0, 0xe0, 0x00, 0xe1, 0xe1, 0xe1, 0x00, 0xe2, 0xe2, 0xe2, 0x00, 0xe3, 0xe3, 0xe3, 0x00, 0xe4, 0xe4, 0xe4, 0x00, 0xe5, 0xe5, 0xe5, 0x00, 0xe6, 0xe6, 0xe6, 0x00, 0xe7, 0xe7, 0xe7, 0x00, 0xe8, 0xe8, 0xe8, 0x00, 0xe9, 0xe9, 0xe9, 0x00, 0xea, 0xea, 0xea, 0x00, 0xeb, 0xeb, 0xeb, 0x00, 0xec, 0xec, 0xec, 0x00, 0xed, 0xed, 0xed, 0x00, 0xee, 0xee, 0xee, 0x00, 0xef, 0xef, 0xef, 0x00, 0xf0, 0xf0, 0xf0, 0x00, 0xf1, 0xf1, 0xf1, 0x00, 0xf2, 0xf2, 0xf2, 0x00, 0xf3, 0xf3, 0xf3, 0x00, 0xf4, 0xf4, 0xf4, 0x00, 0xf5, 0xf5, 0xf5, 0x00, 0xf6, 0xf6, 0xf6, 0x00, 0xf7, 0xf7, 0xf7, 0x00, 0xf8, 0xf8, 0xf8, 0x00, 0xf9, 0xf9, 0xf9, 0x00, 0xfa, 0xfa, 0xfa, 0x00, 0xfb, 0xfb, 0xfb, 0x00, 0xfc, 0xfc, 0xfc, 0x00, 0xfd, 0xfd, 0xfd, 0x00, 0xfe, 0xfe, 0xfe, 0x00, 0xff, 0xff, 0xff, 0x00 }; //int g_nWidth = 640; //int g_nHeight = 480; int g_nWidth = 1920; int g_nHeight = 1080; // 2012-8-8 04:29下午 V4L2初始化摄像头 // 注释资料来源: // http://wenku.baidu.com/view/2f92ce8c680203d8ce2f247f.html // 基于Linux视频驱动接口V4L2视频采集编程 // 用非阻塞模式打开摄像头设备 if((fd=open(dev_name,O_RDWR | O_NONBLOCK,0))<0) { printf("Error: open %s\n",dev_name); // return 0; return; } else { printf("**** wyb01 Open camera success!!!! fd=%d\n", fd); } // 获取当前视频设备支持的视频格式 struct v4l2_fmtdesc fmtd; int ret = 0; memset(&fmtd;, 0, sizeof(fmtd)); fmtd.index = 0; fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; while ((ret = ioctl(fd, VIDIOC_ENUM_FMT, &fmtd;)) == 0) { fmtd.index++; printf(" pixelformat = ''%c%c%c%c'', description = ''%s'' \n", fmtd.pixelformat & 0xFF, (fmtd.pixelformat >> 8) & 0xFF, (fmtd.pixelformat >> 16) & 0xFF, (fmtd.pixelformat >> 24) & 0xFF, fmtd.description); } // 查询视频设备的功能;执行完 VIDIOC_QUERYCAP 命令后,cap变量中包含了该视频设备的能力信息, // 程序中通过检查cap中的设备能力信息来判断设备是否支持某项功能。 if(ioctl(fd, VIDIOC_QUERYCAP, ∩)<0) { printf("Error: query cap\n"); // return 0; return; } printf("\n capabilities= 0xx\n",cap.capabilities); int iCapCapabilities=cap.capabilities; fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt.fmt.pix.width = g_nWidth; fmt.fmt.pix.height = g_nHeight; // 2018/6/8 17:19 只对USB摄像头有效! fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG; //fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; // fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P; fmt.fmt.pix.field = V4L2_FIELD_BOTTOM; printf("**** fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P; ****\n"); // 设置视频设备的视频数据格式,例如设置视频图像数据的长、宽,图像格式(JPEG、YUYV 格式); // 注意:如果该视频设备驱动不支持你所设定的图像格式, // 视频驱动会重新修改struct v4l2_format 结构体变量的值为该视频设备所支持的图像格式, // 所以在程序设计中,设定完所有的视频格式后,要获取实际的视频格式, // 要重新读取struct v4l2_format 结构体变量。 if(ioctl(fd,VIDIOC_S_FMT, &fmt;)<0) { printf("Error:VIDIOC_S_FMT \n"); // return 0; return; } // 读取当前驱动的频捕获格式 // 2012-8-8 03:07下午 确认所设置的制式是否是我们所需要的制式 struct v4l2_format fmt2; fmt2.type=V4L2_BUF_TYPE_VIDEO_CAPTURE; ret = ioctl(fd,VIDIOC_G_FMT, &fmt2;); printf("VIDIOC_G_FMT ret=%d \n", ret); printf("pixelformat = ''%c%c%c%c''\n", fmt2.fmt.pix.pixelformat & 0xFF, (fmt2.fmt.pix.pixelformat >> 8) & 0xFF, (fmt2.fmt.pix.pixelformat >> 16) & 0xFF, (fmt2.fmt.pix.pixelformat >> 24) & 0xFF); req.count = REQ_COUNT ; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.memory = V4L2_MEMORY_MMAP; // 请求V4L2驱动分配视频缓冲区 (申请 V4L2视频驱动分配内存),V4L2是视频设备的驱动层, // 位于内核空间,所以通过 VIDIOC_REQBUFS 控制命令字申请的内存位于内核空间, // 应用程序不能直接访问,需要通过调用 mmap内存映射函数把内核空间内存映射到用户空间后, // 应用程序通过访问用户空间地址来访问内核空间。 // 注意: VIDIOC_REQBUFS会修改tV4L2_reqbuf的count值, // tV4L2_reqbuf的count值返回实际申请成功的视频缓冲区数目。 if(ioctl(fd, VIDIOC_REQBUFS, &req;)<0) { printf("Error:VIDIOC_REQBUFS\n"); // return 0; return; } printf("req.count=%d\n",req.count); buffers = calloc (req.count, sizeof (*buffers));//内存中建立对应空间 printf(" sizeof (*buffers) =x\n", sizeof (*buffers)); for(i=0;i1000) { break; } // 2013-5-14 19:13 测帧率 iFrameCounter++; if(iFrameCounter0==0) { gettimeofday(&tp1;, NULL); iCostTime = (tp1.tv_sec - iSecond)*1000000 + tp1.tv_usec - iuSecond; // printf("@@@@ 100 frame=%u us, fps=%f\n",iCostTime, 1000000*100.0/iCostTime) ; iSecond = tp1.tv_sec; iuSecond = tp1.tv_usec; } FD_ZERO (&fds;); FD_SET (fd, &fds;); tv.tv_sec = 2; tv.tv_usec = 0; // VIDIOC_STREAMON函数执行成功后,视频设备驱动程序开始采集视频数据,此时应用程序 // 一般通过调用 select 函数来判断一帧视频数据是否采集完成,当视频设备驱动完成 // 一帧视频数据采集并保存到视频缓冲区中时,select 函数返回,应用程序接着可以 // 读取视频数据;否则 select 函数阻塞直到视频数据采集完成。 r = select (fd + 1, &fds;, NULL, NULL, &tv;); // printf("------------r=%d\n",r); if(r<0) { // continue; // return 0; return; } tmp_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; tmp_buf.memory = V4L2_MEMORY_MMAP; tmp_buf.index = 0; // 从视频缓冲区的输出队列中取得一个已经保存有一帧视频数据的视频缓冲区。 // 函数VIDIOC_DQBUF执行成功后,相应的内核视频缓冲区中保存有当前拍摄到的 // 视频数据,应用程序可以通过访问用户空间来读取该视频数据。 if(ioctl(fd, VIDIOC_DQBUF, &tmp;_buf)<0) { // printf("**** Error:VIDIOC_DQBUF\n"); // return 0; continue; } iFrameCounter3++; if(iFrameCounter30==0) { gettimeofday(&tp3;, NULL); iCostTime3 = (tp3.tv_sec - iSecond3)*1000000 + tp3.tv_usec - iuSecond3; // printf("####100 frame=%u us, fps=%f\n", iCostTime3, 1000000*100.0/iCostTime3) ; iSecond3 = tp3.tv_sec; iuSecond3 = tp3.tv_usec; } // 2013/2/20 19:54:10 存储灰度图 // if(j>200) // if(j>20) if(iFlagCamera) { iCameraCounter++; iFlagCamera--; // 写灰度图 char GRAYname[100]; // sprintf(GRAYname, "grayd.bmp", j); // sprintf(GRAYname, "/sdcard/grayd.bmp", j); //sprintf(GRAYname, "/sdcard/grayd.bmp", iCameraCounter); //sprintf(GRAYname, "/sdcard/yuyvd.yuv", iCameraCounter); //Segmentation fault (core dumped) //sprintf(GRAYname, "/tmp/yuyvd.yuv", iCameraCounter); sprintf(GRAYname, "jpegd.jpg", iCameraCounter); file_fd = fopen(GRAYname, "w"); if(file_fd) { // fwrite(graybmphead, sizeof (unsigned char),1078,fp_YUV ); //fwrite(graybmphead, sizeof (unsigned char), 1078, file_fd ); // 获取YUYV的图片 // fwrite(buffers[tmp_buf.index].start, 640*480*2, 1, file_fd); // fwrite(ucGrayBMP, 640*480, 1, file_fd); // 获取JPEG的图片 //fwrite(buffers[buf.index].start, buffers[buf.index].length, 1, file_fd); fwrite(buffers[tmp_buf.index].start, buffers[tmp_buf.index].length, 1, file_fd); } fclose (file_fd); // printf ("**** wyb3 write BMP success j=%d!!!!\n", j); printf ("**** wyb3 write BMP success j=%d!!!!\n", iCameraCounter); } tmp_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; tmp_buf.memory = V4L2_MEMORY_MMAP; // 投放一个空的视频缓冲区到视频缓冲区输入队列中。函数执行成功后,指令的视频缓冲区 // 进入视频输入队列,在启动视频设备拍摄图像时,相应的视频数据被保存到视频输入队列 // 相应的视频缓冲区中。 if(ioctl(fd, VIDIOC_QBUF, &tmp;_buf)<0) { // printf("#### Error:VIDIOC_QBUF\n"); // return 0; continue; } iFrameCounter4++; if(iFrameCounter40==0) { gettimeofday(&tp4;, NULL); iCostTime4 = (tp4.tv_sec - iSecond4)*1000000 + tp4.tv_usec - iuSecond4; // printf("@@@@ 100 frame=%u us, fps=%f\n",iCostTime, 1000000*100.0/iCostTime) ; // printf("####100 frame=%u us, fps=%f\n", iCostTime3, 1000000*100.0/iCostTime3) ; // printf("^^^^ 100 frame=%u us, fps=%f\n", iCostTime4, 1000000*100.0/iCostTime4) ; // fps = 1/( (iCostTime4/1000000)/100 ) printf("^^^^ 100 frame=%u us, fps=%f iCounter100frame=%d\n", iCostTime4, 1000000*100.0/iCostTime4, iCounter100frame) ; iSecond4 = tp4.tv_sec; iuSecond4 = tp4.tv_usec; iCounter100frame++; printf("\n\n") ; } } // 停止视频采集命令,应用程序调用 VIDIOC_ STREAMOFF停集命令后, // 视频设备驱动程序不再采集视频数据。 if(ioctl(fd, VIDIOC_STREAMOFF, &type;)<0) { printf("Error:VIDIOC_STREAMOFF\n"); // return 0; return; } printf("================streamoff\n"); printf("\n capabilities= 0xx, iCapCapabilities=0xx \n",cap.capabilities, iCapCapabilities); getCameraCapabilities(iCapCapabilities); // 解除内存映射 for(i=0;i

立即下载
rar文件
MS-DOS 5.0

README.TXT NOTES ON MS-DOS VERSION 5.0 =========================== In this file the following topics are covered: 1. Introduction 2. Solving Setup Problems 2.1 Priam and Everex Hard Disks 2.2 SyQuest Removable Hard Disk 2.3 Bernoulli Drive 2.4 Disk Manager 2.5 SpeedStor and Volume Expansion 2.6 Novell Partitions 2.7 Vfeature Deluxe 2.8 Columbia Data Systems Device Driver 2.9 Incompatible Partition 2.10 WYSE Partitions 2.11 286 Accelerator Cards 2.12 Bernoulli Cache 2.13 AT&T 6300 Computers 2.14 LANtastic 2.15 Western Digital SCSI Hard-Disk Controllers 2.16 Change CONFIG.SYS File 2.17 Toshiba T1600 and a Hard RAM Disk 3. Installing MS-DOS 5.0 on OS/2 Systems 3.1 Installing MS-DOS 5.0 and OS/2 Dual-Boot Systems 3.2 Using the Uninstall Program on an OS/2 System 4. Solving Memory Problems 4.1 386MAX 4.2 All Computers Expanded-Memory Driver 4.3 Bus Master DMA Controller 4.4 HIMEM.SYS Location 4.5 INT15 Access to Extended Memory 4.6 Intel LIM Driver 4.7 Phoenix BIOS and HIMEM.SYS 4.8 QEMM 4.9 XMAEM.SYS and XMA2EM.SYS 5. Solving Problems with Windows 5.1 DOS Applications in Windows Enhanced Mode 5.2 EMM386.EXE Location 5.3 WINA20.386 File 5.4 Windows 3.0 Enhanced Debug Version 5.5 Windows 2.03 5.6 Windows/286 2.1 5.7 Windows 386 and the Upper Memory Area 6. Making Your Hardware Compatible with MS-DOS 5.0 6.1 101-key Keyboards and QBasic/MS-DOS Editor 6.2 Acer 1100/33 6.3 Adaptec Controller Boards 6.4 Amstrad Systems and KEYB.COM 6.5 Hardcard II 6.6 COMPAQ EXTDISK.SYS Driver 6.7 Corel System Drivers 6.8 External Disk Drives 6.9 Mice and MS-DOS Shell 6.10 NCR VGA BIOS 6.11 Olivetti Systems 6.12 Toshiba T3100SX 6.13 Western Digital VGA Card 6.14 Zenith Computers 7. Making Your Network Compatible with MS-DOS 5.0 7.1 3+Share 7.2 AT&T StarGROUP 7.3 DCA 10Net and Word5 7.4 DOS LAN Requester 7.5 IBM PC LAN 1.31 7.6 LAN Manager and the Upper Memory Area 7.7 Net/One PC 7.8 Netware 7.9 Novell Networks 7.10 Novell Networks and IPX 7.11 PC-NFS 3.0 7.12 TOPS Network 8. New Information About MS-DOS 5.0 8.1 EXPAND Command 8.2 FORMAT and MIRROR Commands 8.3 QBasic "On Error" Command 8.4 SMARTDrive and Third-Party Partitions 8.5 SYS Command 8.6 UNDELETE Command 8.7 UNFORMAT /J Switch 1. INTRODUCTION =============== This document provides important information that is not included in the Microsoft MS-DOS User's Guide and Reference or in online Help. The readme includes notes on procedures you may have to do before running Setup and information about using Windows, memory, and hardware with MS-DOS 5.0. It also contains updates to the User's Guide and Reference. For information about using applications with MS-DOS 5.0, see the APPNOTE.TXT file. 2. SOLVING SETUP PROBLEMS ========================= 2.1 Priam and Everex Hard Disks ------------------------------- If your hard disk contains a Priam or Everex hard disk, you must do the following to install MS-DOS 5.0: 1. Install MS-DOS 5.0 on floppy disks by typing the following command: setup /f 2. Start MS-DOS 5.0 by using the floppy disks you created. 3. Make sure that you can access all your hard-disk partitions. 4. If you can access all the partitions, insert the floppy disk that contains the SYS.COM file into drive a: and type the following command: sys c: 5. Create a DOS directory on your hard disk. 5. Copy all files on your floppy disks to the DOS directory. 6. Modify your CONFIG.SYS and AUTOEXEC.BAT files as necessary. 2.2 SyQuest Removable Hard Disk ------------------------------- If your system contains a SyQuest removable hard disk, use the following procedure to install MS-DOS 5.0: 1. Remove or comment out the DEVICE=SYQ55.SYS command from your CONFIG.SYS file. 2. Restart your system. 3. Run Setup. After installing MS-DOS 5.0, you can put the DEVICE=SYQ55.SYS command back in your CONFIG.SYS file. 2.3 Bernoulli Drive ------------------- If Setup refers you to this section, contact Iomega at (801) 778-3000 before you install MS-DOS 5.0 to get information about an updated RCD.SYS device driver. 2.4 Disk Manager ---------------- To upgrade Ontrack Computer System's Disk Manager, do the following: 1. Use the EXPAND command to expand and copy the DMDRVR.BI_ file from Disk 6 to your DOS directory and the XBIOS.OV_ file from Disk 6 to your root directory. 2. Name the files DMDRVR.BIN and XBIOS.OVL. 3. Run Setup with the /u switch, as follows: setup /u 2.5 SpeedStor and Volume Expansion ---------------------------------- To upgrade Storage Dimensions' SpeedStor, or Hewlett-Packard Volume Expansion, do the following: 1. If your system has non-MicroChannel architecture (non-PS/2 compatible), use the EXPAND command to expand and copy the driver named SSTOR.SY_ from Disk 6 to your hard disk. If your system has MicroChannel architecture, contact your vendor for an updated driver. 2. If you are upgrading SpeedStor, name the driver SSTOR.SYS. If you are upgrading Volume Expansion, replace the DEVICE=HARDRIVE.SYS command with a DEVICE=SSTOR.SYS command in your CONFIG.SYS file. 3. Run Setup with the /u switch, as follows: setup /u 2.6 Novell Partitions --------------------- If your system includes Novell partitions, upgrade to MS-DOS 5.0 by running Setup with the /u switch, as follows: setup /u 2.7 Vfeature Deluxe ------------------- Contact Golden Bow Systems for information about Vfeature upgrades. Until the upgrade is available, you can either install MS-DOS 5.0 on floppy disks or delete Vfeature partitions by repartitioning your hard disk. To install MS-DOS 5.0 on floppy disks, run Setup with the /f switch, as follows: setup /f To delete Vfeature partitions your hard disk, see the procedure called "To repartition your hard disk" in Chapter 4 of the Microsoft MS-DOS Getting Started guide. 2.8 Columbia Data Systems Device Drivers ----------------------------------------- If you use a Columbia Data Systems device driver, you may experience problems running Setup. If you do, remove the DEVICE=SSTBIOS.SYS and DEVICE=SSTDRIVE.SYS commands from your CONFIG.SYS file and run Setup again. After completing Setup, install the device drivers by returning the DEVICE= commands to your CONFIG.SYS file and restarting your computer. 2.9 Incompatible Partition -------------------------- If you have a partition that is incompatible with MS-DOS 5.0, you must delete it from your hard disk. Incompatible partitions are listed as "Non-DOS" partitions in FDISK. See the procedure for repartitioning hard disks in Chapter 4 of the Microsoft MS-DOS Getting Started guide. 2.10 WYSE Partitions -------------------- If you have a partition created by WYSE DOS 2.11 or 3.1, you must delete the DOS partitions from your hard disk. See the procedure for repartitioning hard disks in Chapter 4 of the Microsoft MS-DOS Getting Started guide. 2.11 286 Accelerator Cards -------------------------- If your system includes a 286 accelerator card, Setup may not be able to determine the amount of extended memory you have. To avoid this problem, disable the card before running Setup. 2.12 Bernoulli Cache -------------------- Before running Setup, open the CONFIG.SYS file and remove or comment out the DEVICE command that installs the caching software for your Iomega Bernoulli drive. 2.13 AT&T 6300 Computers ------------------------ If you use an AT&T 6300 computer, contact AT&T to upgrade your ROM BIOS to version 1.21 or later. The ROM BIOS version number is displayed when you start your computer. 2.14 LANtastic -------------- If you use a LANtastic network, disable it before running Setup. 2.15 Western Digital SCSI Hard-Disk Controllers ----------------------------------------------- If you are using a Western Digital WD Fast 700 or AT/XT SCSI controller, before upgrading to MS-DOS 5.0 contact Western Digital to get an updated device driver and a new hard-disk ROM (version 3.36 or later). The ROM version number is displayed when you start your computer. 2.16 Change CONFIG.SYS File --------------------------- If you are installing MS-DOS 5.0 on one of the systems listed below, you must add the specified /machine switch to the DEVICE=HIMEM.SYS command in your CONFIG.SYS file before you run Setup. After changing the CONFIG.SYS file, run Setup. System Switch ------ ------ Bull Micral 60 /machine:16 COMPUADD 386 systems /machine:1 or /machine:8 Datamedia 386/486 /machine:2 Hitachi HL500C /machine:8 Intel 301z or 302 /machine:8 JDR 386/33 /machine:1 UNISYS PowerPort /machine:2 UNISYS 800/20c /machine:1 2.17 Toshiba T1600 and a Hard RAM Disk -------------------------------------- To use the hard RAM disk, do the following before installing MS-DOS 5.0: 1. Using the Toshiba Setup program, delete the RAM disk by allocating zero KB to it. All data on the RAM disk will be lost. 2. Restart your system. 3. Install MS-DOS 5.0. 4. Use the Toshiba setup program to reinstall the RAM disk. 5. Run FDISK, change to drive 2, and create a primary DOS partition. Exit FDISK. 6. Use the FORMAT command to format drive D. 3. INSTALLING MS-DOS 5.0 ON OS/2 SYSTEMS ======================================== 3.1 Installing MS-DOS 5.0 on OS/2 Dual Boot Systems --------------------------------------------------- To use MS-DOS 5.0 with the OS/2 dual-boot version that prompts you at system startup time to select an operating system, do the following, making sure that you complete all steps of the procedure: 1. Install MS-DOS 5.0 on your hard disk. 2. Create a system floppy disk by using the FORMAT A: /S command. 3. Delete the COMMAND.COM file from the floppy disk. 4. On the floppy disk, create a CONFIG.SYS file that includes the following: shell=c:\dos\command.com /p /e:256 5. On the floppy disk, create an AUTOEXEC.BAT file that includes the following commands: path=c:\dos append /e append c:\dos prompt $p$g set comspec= 6. Install the OS/2 operating system on your hard disk. 7. Insert the system disk you created in drive A and restart your computer. 8. Run the dual-boot program (C:\DUALBOOT\DUALBOOT.EXE). 3.2 Using the Uninstall Program on an OS/2 System ------------------------------------------------- You can run the Uninstall program on systems that have MS OS/2 1.0, or IBM and MS OS/2 1.1 and later versions. However, if you install MS-DOS 5.0 over IBM OS/2 1.0, you will not be able to run the Uninstall program. You can work around this problem by renaming the IBM OS/2 1.0 system files IBMBIO.COM and IBMDOS.COM, so that Setup does not confuse them with DOS system files. If you run the Uninstall program on a system that had OS/2 on it before the upgrade, running chkdsk may show some lost extended attributes. This will happen whenever a file which had extended attributes under OS/2 was altered under DOS before you ran the Uninstall program. 4. SOLVING MEMORY PROBLEMS ========================== 4.1 386MAX ---------- In some cases, after loading a program high with 386LOAD.COM prior to version 5.11, the loaded program reports "Incorrect DOS version." If this occurs, do one of the following: * Use the SETVER command to set the version number for Qualitas' 386MAX to the lower version required by the program reporting the error. * Use the LOADFIX command, as follows: 386LOAD LOADFIX Then use the SETVER command to set the version number for each application. For example, use the following two commands to load REDIR4.EXE: 386LOAD LOADFIX REDIR4.EXE SETVER REDIR4.EXE 4.01 WARNING: All programs loaded by 386LOAD.COM use the new version number. Do not use the MAXHI.EXE program supplied with versions of 386MAX prior to 5.0 with MS-DOS version 5.0 because it will cause your system to lock up. 4.2 All Computers Expanded-Memory Driver ----------------------------------------- You must have version 2.5 or later of the All Computers expanded-memory driver (ALLEMM4.SYS) to work with MS-DOS 5.0 HIMEM.SYS. Contact All Computers to get an updated driver. 4.3 Bus Master DMA Controller ----------------------------- If you have a bus master DMA controller and you have problems using the upper memory area, add a DEVICE=SMARTDRV.SYS command to your CONFIG.SYS file before any DEVICEHIGH commands. 4.4 HIMEM.SYS Location ---------------------- Setup does not install HIMEM.SYS if another XMS memory manager is active when you are running Setup. If Setup did not install HIMEM.SYS, you can copy it to your disk by using the EXPAND command. For information about using the EXPAND command, see Chapter 14 of the Microsoft MS-DOS User's Guide and Reference. 4.5 INT15 Access to Extended Memory ----------------------------------- Software such as older versions of Borland's Paradox, Oracle's Oracle, Quarterdeck's QEMM, and Lantana Technology's Turbo EMS may use interrupt 15 to access extended memory. To use this type of software with MS-DOS 5.0 loaded high, specify the HIMEM.SYS /int15=xxxx switch in your CONFIG.SYS file. The switch allocates the specified amount of extended memory for the INT15h interface. You may also have to use switches with the particular software to indicate the amount of extended memory accessible through INT15. For example, you can specify the /m switch with Turbo EMS. 4.6 Intel LIM Driver -------------------- Use the Intel LIM driver NE or E switch when installing the Intel EMM.SYS LIM driver for Aboveboard. 4.7 Phoenix BIOS and HIMEM.SYS ------------------------------ If your system includes a Phoenix BIOS and you have problems using HIMEM.SYS, add a /machine:1 or /machine:8 switch to the HIMEM.SYS command in your CONFIG.SYS file. 4.8 QEMM --------- Versions of Quarterdeck's QEMM prior to version 5.11 have problems when the HIMEM.SYS file is loaded with the INT15=xxxx option. If you have a problem, do one of the following: * Add the QEMM MEMORY=yyyy option to the DEVICE=QEMM.SYS line in your CONFIG.SYS file, where yyyy = xxxx - 64. * Use the LOADFIX command, as follows: LOADFIX QEMM.SYS Then use the SETVER command to set the version number for each application. * Update your QEMM to version 5.11. 4.9 XMAEM.SYS and XMA2EMS.SYS ----------------------------- Setup comments out the CONFIG.SYS commands that load IBM XMAEM.SYS and XMA2EMS.SYS. If your system uses both drivers, replace the commands with a DEVICE=EMM386.EXE command in your CONFIG.SYS file. If your system has physical expanded memory, remove the comment that disables XMA2EMS.SYS. 5. SOLVING PROBLEMS WITH WINDOWS ================================ 5.1 DOS Applications in Windows Enhanced Mode --------------------------------------------- If you run DOS applications that use EMS memory under Windows enhanced mode, use the EMM386.EXE /ram switch instead of the /noems switch. 5.2 EMM386.EXE Location ----------------------- When Windows enhanced mode starts, it finds EMM386.EXE by using the path specified in the DEVICE=EMM386.EXE command in your CONFIG.SYS file. If the command does not specify the correct location of the file, use the following command to specify the new path: device=emm386 /y=path 5.3 WINA20.386 File ------------------- Setup installs a read-only file named WINA20.386 in your root directory. If you move the WINA20.386 file to a different directory, do the following: 1. Add a SWITCHES=/W command to your CONFIG.SYS file. 2. Add a DEVICE=[drive:][path]]WINA20.386 command to the enhanced section of your Windows SYSTEM.INI file. 5.4 Windows 3.0 Enhanced Debug Version -------------------------------------- If you are running the debug version of Windows 3.0 enhanced mode with DOS=LOW, you may have problems with the display of debug information on your serial terminal. Contact Microsoft Product Support Services for help. See your registration card for the product support number. 5.5 Windows 2.03 ---------------- Windows 2.03 386 version is incompatible with MS-DOS versions 4.0 and 5.0. 5.6 Windows/286 2.1 ------------------- If you run Windows/286 version 2.1 on a computer with MS-DOS 5.0, you need to run COMMAND.COM from a program information file (PIF) that specifies enough memory for COMMAND.COM to run. The default value in the PIF file is not large enough. 5.7 Windows 386 and the Upper Memory Area ----------------------------------------- If you are using EMM386 with the /ram or /noems switch, you cannot run Windows in standard mode. 6. MAKING YOUR HARDWARE COMPATIBLE WITH MS-DOS 5.0 ========================================================== 6.1 101-key Keyboards and QBasic/MS-DOS Editor ---------------------------------------------- If you are unable to use the arrow keys on your numeric keypad when running QBasic or MS-DOS Editor, Microsoft offers a memory-resident program called FIXSHIFT.COM that may help. To obtain FIXSHIFT.COM, call Microsoft Product Support Services. See your registration card for the product support number. 6.2 Acer 1100/33 ---------------- If you have an Acer 1100/33 computer with an Award BIOS, your system may lock up if you are using EMM386. Contact Acer for a ROM upgrade. 6.3 Adaptec Controller Boards ----------------------------- If you are using Adaptec controller board model ACB2372, A, B, C or model ACB2322B with two hard disk drives attached, and you are using expanded memory (EMS), you need to obtain Adaptec's ADAPTEC.SYS device driver and add a DEVICE=ADAPTEC.SYS command to your CONFIG.SYS file. Contact your Adaptec dealer or distributor for more information. 6.4 Amstrad Systems and KEYB.COM -------------------------------- If you have problems using KEYB.COM an Amstrad system, check the version number of your BIOS. If it is less than 1.4, contact your vendor for a BIOS upgrade. 6.5 Hardcard II --------------- If you have trouble with Plus Development Hardcard II or Hardcard II XL when running EMM386.EXE, you need to use the x switch to prevent EMM386 from conflicting with the card's BIOS address. For example, if your Hardcard II or Hardcard II XL uses BIOS address D700-D7FF, add the x=D700-D7FF switch to the DEVICE= command for EMM386. See your Hardcard II manual to determine the BIOS addresses that Hardcard II or Hardcard II XL uses. 6.6 COMPAQ EXTDISK.SYS Driver ----------------------------- Versions 4.0 or 5.0 of the COMPAQ EXTDISK.SYS driver are needed to work with MS-DOS 5.0. 6.7 Corel Systems Drivers ------------------------- If you have trouble with a Corel Systems driver for a large capacity drive (WORM, Winchester, etc.), you may need to obtain an updated driver from Corel Systems. 6.8 External Disk Drives ------------------------ If you have trouble using an Nth external disk drive, contact Nth Group to get the latest version of the driver. If you have trouble using ProCom floppy disk drives, you may need to obtain an updated driver from ProCom. If you have trouble using Sysgen floppy disk drives, contact Sysgen to get the latest version of the driver (3.41 or later). If you receive an error message when using the DISKCOMP command with Sysgen external drives, retry the operation. 6.9 Mice and MS-DOS Shell ------------------------- If you are using a Logitech or Microsoft mouse with MS-DOS Shell, you may experience problems if you are not using the following versions: Logitech mouse version 5.01 or higher Microsoft mouse version 6.21 or higher 6.10 NCR VGA BIOS ----------------- If you have an NCR VGA BIOS and have trouble switching between screens when running MS-DOS Shell or QBasic, see your NCR PC User Manual for information about making your VGA BIOS "PS/2 Compatible." 6.11 Olivetti Systems --------------------- Some Olivetti systems with CGA video boards may have problems scrolling. If you have a scrolling problem, use the ANSI.SYS /s switch in your CONFIG.SYS file. 6.12 Toshiba T3100SX -------------------- Users of Toshiba T3100SX computers should either disable the suspend/resume feature or not use EMM386.EXE. 6.13 Western Digital VGA Card ----------------------------- If you have a Western Digital VGA card and your system locks up when you use RAMBIOS.EXE and RAMBIOS.SYS, load those files before loading ANSI.SYS, DISPLAY.SYS, and GRAPHICS.COM in your CONFIG.SYS file. 6.14 Zenith Computers --------------------- If you have difficulty using the GRAPHICS command on a Zenith computer, increase stack space by using the STACKS command in your CONFIG.SYS file. 7. MAKING YOUR NETWORK COMPATIBLE WITH MS-DOS 5.0 ================================================= 7.1 3+Share ------------ If you have installed 3Com Corporation 3+Share with minimal netbios implementation, do one of the following: * Run a complete netbios implementation. * Use the REDIR.400 file. * Call Microsoft Product Support Services and request the LAN Manager 2.0 supplemental disk. 7.2 AT&T StarGROUP ------------------- AT&T StarGROUP software is compatible with MS-DOS 5.0. If your version of StarGROUP does not include support for MS-DOS 5.0, contact your AT&T representative or the AT&T National Systems Support Hotline for information on required modifications or upgrades. 7.3 DCA 10Net and Word5 ----------------------- IF you run Microsoft Word5 on a net drive created by using DCA 10Net, and you start MS-DOS Shell from a local drive, your system may lock up if you use the Task Swapper to switch from Word5 to an application that is running on the local drive. To prevent this from happening, either run Word5 on the local drive or run MS-DOS Shell on the net drive. 7.4 DOS LAN Requester --------------------- If you have problems using the FC command with the IBM DOS LAN Requester, specify a lower value for the /nbc parameter. 7.5 IBM PC LAN 1.31 -------------------- Chapter three of the Microsoft MS-DOS Getting Started guide includes a section on updating IBM PC LAn version 1.3 or earlier. The procedures described in this section apply also to version 1.31. 7.6 LAN Manager Enhanced and the Upper Memory Area -------------------------------------------------- If you are running Microsoft LAN Manager Enhanced, use the EMM386 /ram switch and the LIM=YES command in your LANMAN.INI file. However, if you use the EMM386 /noems switch, add the LIM=NO command to your LANMAN.INI file. If you are using LAN Manager Enhanced version 2.0, you can load the redirector (NETWKSTA.EXE) and NetBEUI transport (NETBEUI.DOS) into the upper memory area. If your system includes sufficient space in the upper memory area, you may also be able to move LAN Manager services such as NETPOPUP.EXE, MSRV.EXE, and ENCRYPT.EXE out of conventional memory. If you want LAN Manager software and documentation about loading these services into the upper memory area, Contact Microsoft Product Support Services to request the MS-DOS 5.0 Supplemental Disk. See your registration card for the product support number. 7.7 Net/One PC --------------- If Ungermann-Bass, Inc., Net/One PC does not load with MS-DOS 5.0, do one of the following: * Contact your vendor to get an updated LOADNIU.EXE file. * Put a UBPAUSE command between the LOADNIU and XNSBIOS lines of the MSNET.INI file. * Issue network commands from a batch file that includes a PAUSE command between the LOADNIU and XNSBIOS lines. 7.8 NetWare ----------- Novell NetWare remote boot software is incompatible with MS-DOS 5.0. Contact Novell for an upgrade. Do not use NetWare LOGIN.EXE, MAP.EXE, and SESSION.EXE files after starting MS-DOS Shell. 7.9 Novell Networks ------------------- If you are running a Novell network and you set the COMSPEC variable after starting MS-DOS 5.0, either remove the c:\dos\ entry from the SHELL= command in your CONFIG.SYS file or contact your Novell vendor to get a new login program. 7.10 Novell Networks and IPX ---------------------------- If you experience problems switching between some applications, you may need to use TBMI.COM to allow switching between peer-to-peer applications that run under NetWare with a multitasking environment such as MS-DOS 5.0. To determine if you need TBMI, run your application for a period of time then enter the command TBMI /D. If the value in the field Far Call Usage is zero, you do not need TBMI. Start TBMI by entering the command "TBMI" on the command line, followed by any optional command line before starting the DOSSHELL. Type TBMI /? at the command line to display the valid command line parameters. Normally, the default configuration for TBMI is correct for most applications. If you experience problems, contact Novell for information on TBMI configuration parameters. NOTE: You must update to IPX 3.02 before you can use TBMI. 7.11 PC-NFS 3.0 --------------- Sun Microsystems, Inc., PC-NFS 3.0 is compatible with MS-DOS 5.0. If you use PC-NFS 3.0 with MS-DOS Shell, MS-DOS Shell may display more drives than you have currently enabled. To correct this problem, use the PC-NFS /d switch to specify the number of drives you are using. If you have trouble using the COPY or XCOPY command on PC-NFS 3.01, contact Sun Microsystems to get an updated version of the PCNFS.SYS device driver. 7.12 TOPS Network ----------------- If your system is a TOPS workstation, the MS-DOS Shell MOVE command may not work. Current versions of TOPS network are incompatible with the MS-DOS 5.0 LOADHIGH command. 8. NEW INFORMATION ABOUT MS-DOS 5.0 =================================== 8.1 EXPAND Command ------------------- The EXPAND command example in chapter four of the Microsoft MS-DOS User's Guide and Reference incorrectly refers to installation and upgrade disks. The disk referred to as "Disk 1" should be Disk 2; the disk referred to as "Disk 2" should be Disk 3. 8.2 FORMAT and MIRROR Commands ------------------------------ If you have problems using the FORMAT command to format an unformatted disk, try using the /u switch. You cannot use the FORMAT /q switch or the MIRROR command with 160K and 320K disks that have been formatted with versions of DOS other than MS-DOS 5.0. You cannot use the MIRROR command with a network drive or any drive that you have created using the ASSIGN, SUBST, or JOIN command. 8.3 QBasic "On Error" Command ----------------------------- Online help for Microsoft QBasic incorrectly states that ON ERROR RESUME NEXT is a valid statement. The correct syntax is as follows: ON ERROR GOTO 8.4 SMARTDrive and Third-party Partitions ----------------------------------------- If your system includes a third-party disk partition and you try to use SMARTDrive, you may receive a message stating that you cannot load SMARTDrive. You can force SMARTDrive to load by specifying the /p switch. However, doing so may corrupt your hard disk if either of the following conditions is true: * your hard disk contains more than 1024 cylinders * your hard disk is not supported directly by the system's ROM BIOS. If you have a Disk Manager partition, use the following two procedures to determine if either condition is true for your system. To determine if your hard drive has more than 1024 cylinders, do the following: 1. At the command prompt, type dm /m. 2. Type c to display the disk configuration. 3. If any disk displayed has an Actual Cylinder Count of more than 1024, you are at risk when using SMARTDrive. To determine whether or not your hard disk is supported by the system's ROM BIOS, do the following: 1. At the command prompt, type ver to display the version of DOS you are running. If it is earlier than 3.30, you are not at risk. Otherwise, continue. 2. Type dm /m to invoke Disk Manager in manual mode. 3. Type c to display the disk configuration. 4. If the display states "Parameters Are Replaced," continue. Otherwise, you are not at risk. 5. For each disk in your system, compare the Setup Parameters with the Actual Parameters displayed. If all disks displayed have a Setup Head Count that matches the Actual Head Count, and a Setup Sector Count that matches the Actual Sector Count, you are not at risk. When the values do not match, the drive is non-homogeneous. 6. From the Disk Manager main menu, type s to select the non- homogeneous drive. 7. Type p to display the partition table for the drive. 8. If the drive contains a partition with the type "DOS," and if one or more partitions are type "Write-Read" or "Read-Only," you are at risk. 9. Repeat steps 6 through 8 for each non-homogenous disk on your system. If you have partitions created by using third-party disk partitioning software other than Disk Manager, use SMARTDrive ONLY if you are sure your hard disk contains 1024 or fewer cylinders AND it is supported directly by the system's ROM BIOS. 8.5 SYS Command --------------- The SYS command copies the COMMAND.COM file to the root directory of the target disk. Make sure the SHELL= and COMSPEC= commands in your CONFIG.SYS file point to the root directory, or move the COMMAND.COM file to directory pointed to by those commands. 8.6 UNDELETE Command -------------------- You should not use the UNDELETE command in the following circumstances: * when other programs are active * with the LOAD= command or the Shift+Enter key combination in Windows * with the MS-DOS Task Swapper 8.7 UNFORMAT /J Switch ---------------------- You cannot use the UNFORMAT /p switch with the /j switch.

立即下载
其他文档
hls.min.js

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define;.amd?define([],e):"object"==typeof exports?exports.Hls=e():t.Hls=e()}(this,function(){return function(t){function e(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/hls.js/dist/",e(e.s=7)}([function(t,e,r){"use strict";function i(){}function a(t,e){return e="["+t+"] > "+e}function n(t){var e=self.console[t];return e?function(){for(var r=arguments.length,i=Array(r),n=0;n1?e-1:0),i=1;i0)return e.subarray(i,i+a)},t._readSize=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3]},t.getTimeStamp=function(e){for(var r=t.getID3Frames(e),i=0;i>4){case 0:return i;case 1:case 2:case 3:case 4:case 5:case 6:case 7:i+=String.fromCharCode(o);break;case 12:case 13:e=t[a++],i+=String.fromCharCode((31&o)<<6|63&e);break;case 14:e=t[a++],r=t[a++],i+=String.fromCharCode((15&o)<<12|(63&e)<<6|(63&r)<<0)}}return i},t}();e.a=a},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function a(t){return"number"==typeof t}function n(t){return"object"==typeof t&&null;!==t}function o(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!a(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,a,s,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var d=new Error('Uncaught, unspecified "error" event. ('+e+")");throw d.context=e,d}if(r=this._events[t],o(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(n(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),a=u.length,l=0;l0&&this;._events[t].length>a&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console;.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),a||(a=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var a=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,a,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,a=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this;.emit("removeListener",t,e);else if(n(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){a=s;break}if(a<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(a,1),this._events.removeListener&&this;.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete; this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this;.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this;._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){!function(e){var r=/^((?:[^\/;?#]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/;?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var a=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");return a.path=o.normalizePath(a.path),o.buildURLFromParts(a)}var n=this.parseURL(e);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=o.normalizePath(n.path),o.buildURLFromParts(n)):e;var s=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=i.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var u={scheme:s.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(u.netLoc=s.netLoc,"/"!==n.path[0]))if(n.path){var d=s.path,h=d.substring(0,d.lastIndexOf("/")+1)+n.path;u.path=o.normalizePath(h)}else u.path=s.path,n.params||(u.params=s.params,n.query||(u.query=s.query));return null===u.path&&(u.path=r.alwaysNormalize?o.normalizePath(n.path):n.path),o.buildURLFromParts(u)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(a,"");t.length!==(t=t.replace(n,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};t.exports=o}()},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e,r,i){var a,n,o,s,l,u=navigator.userAgent.toLowerCase(),d=i,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return a=1+((192&e[r+2])>>>6),(n=(60&e[r+2])>>>2)>h.length-1?void t.trigger(Event.ERROR,{type:k.b.MEDIA_ERROR,details:k.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+n}):(s=(1&e[r+2])<<2,s|=(192&e[r+3])>>>6,N.b.log("manifest codec:"+i+",ADTS data:type:"+a+",sampleingIndex:"+n+"["+h[n]+"Hz],channelConfig:"+s),/firefox/i.test(u)?n>=6?(a=5,l=new Array(4),o=n-3):(a=2,l=new Array(2),o=n):-1!==u.indexOf("android")?(a=2,l=new Array(2),o=n):(a=5,l=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&n>=6?o=n-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(n>=6&&1===s||/vivaldi/i.test(u))||!i&&1===s)&&(a=2,l=new Array(2)),o=n)),l[0]=a<<3,l[0]|=(14&n)>>1,l[1]|=(1&n)<<7,l[1]|=s<<3,5===a&&(l[1]|=(14&o)>>1,l[2]=(1&o)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:h[n],channelCount:s,codec:"mp4a.40."+a,manifestCodec:d})}function l(t,e){return 255===t[e]&&240;==(246&t[e+1])}function u(t,e){return 1&t[e+1]?7:9}function d(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function h(t,e){return!!(e+10&&e+n+o<=l)return s=r+i*a,{headerLength:n,frameLength:o,stamp:s}}function v(t,e,r,i,a){var n=p(t.samplerate),o=g(e,r,i,a,n);if(o){var s=o.stamp,l=o.headerLength,u=o.frameLength,d={unit:e.subarray(r+l,r+l+u),pts:s,dts:s};return t.samples.push(d),t.len+=u,{sample:d,length:u+l}}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var D=r(1),k=r(2),I=function(){function t(e,r){i(this,t),this.subtle=e,this.aesIV=r}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}(),O=I,C=function(){function t(e,r){a(this,t),this.subtle=e,this.key=r}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}(),P=C,x=function(){function t(){n(this,t),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}return t.prototype.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),i=0;i<4;i++)r[i]=e.getUint32(4*i);return r},t.prototype.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],o=r[3],s=this.invSubMix,l=s[0],u=s[1],d=s[2],h=s[3],c=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)c[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,t[f]=v,e[v]=f;var y=c[f],m=c[y],b=c[m],E=257*c[v]^16843008*v;i[f]=E<<24|E>>>8,a[f]=E<<16|E>>>16,n[f]=E<<8|E>>>24,o[f]=E,E=16843009*b^65537*m^257*y^16843008*f,l[v]=E<<24|E>>>8,u[v]=E<<16|E>>>16,d[v]=E<<8|E>>>24,h[v]=E,f?(f=y^c[c[c[b^y]]],p^=c[c[p]]):f=p=1}},t.prototype.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,i=0;i=8){return["moof","ftyp","styp"].indexOf(t.bin2str(e.subarray(4,8)))>=0}return!1},t.bin2str=function(t){return String.fromCharCode.apply(null,t)},t.readUint32=function(t,e){t.data&&(e+=t.start,t=t.data);var r=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return r<0?4294967296+r:r},t.writeUint32=function(t,e,r){t.data&&(e+=t.start,t=t.data),t[e]=r>>24,t[e+1]=r>>16&255;,t[e+2]=r>>8&255;,t[e+3]=255&r},t.findBox=function(e,r){var i,a,n,o,s,l,u,d=[];if(e.data?(l=e.start,o=e.end,e=e.data):(l=0,o=e.byteLength),!r.length)return null;for(i=l;i1?i+a:o,n===r[0]&&(1===r.length?d.push({data:e,start:i+8,end:u}):(s=t.findBox({data:e,start:i+8,end:u},r.slice(1)),s.length&&(d=d.concat(s)))),i=u;return d},t.parseInitSegment=function(e){var r=[];return t.findBox(e,["moov","trak"]).forEach(function(e){var i=t.findBox(e,["tkhd"])[0];if(i){var a=i.data[i.start],n=0===a?12:20,o=t.readUint32(i,n),s=t.findBox(e,["mdia","mdhd"])[0];if(s){a=s.data[s.start],n=0===a?12:20;var l=t.readUint32(s,n),u=t.findBox(e,["mdia","hdlr"])[0];if(u){var d=t.bin2str(u.data.subarray(u.start+8,u.start+12)),h={soun:"audio",vide:"video"}[d];h&&(r[o]={timescale:l,type:h},r[h]={timescale:l,id:o})}}}}),r},t.getStartDTS=function(e,r){var i,a,n;return i=t.findBox(r,["moof","traf"]),a=[].concat.apply([],i.map(function(r){return t.findBox(r,["tfhd"]).map(function(i){var a,n,o;return a=t.readUint32(i,4),n=e[a].timescale||9e4,o=t.findBox(r,["tfdt"]).map(function(e){var r,i;return r=e.data[e.start],i=t.readUint32(e,4),1===r&&(i*=Math.pow(2,32),i+=t.readUint32(e,8)),i})[0],(o=o||1/0)/n})})),n=Math.min.apply(null,a),isFinite(n)?n:0},t.offsetStartDTS=function(e,r,i){t.findBox(r,["moof","traf"]).map(function(r){return t.findBox(r,["tfhd"]).map(function(a){var n=t.readUint32(a,4),o=e[n].timescale||9e4;t.findBox(r,["tfdt"]).map(function(e){var r=e.data[e.start],a=t.readUint32(e,4);if(0===r)t.writeUint32(e,4,a-i*o);else{a*=Math.pow(2,32),a+=t.readUint32(e,8),a-=i*o;var n=Math.floor(a/(j+1)),s=Math.floor(a%(j+1));t.writeUint32(e,4,n),t.writeUint32(e,8,s)}})})})},t.prototype.append=function(e,r,i,a){var n=this.initData;n||(this.resetInitSegment(e,this.audioCodec,this.videoCodec),n=this.initData);var o=void 0,s=this.initPTS;if(void 0===s){var l=t.getStartDTS(n,e);this.initPTS=s=l-r,this.observer.trigger(D.a.INIT_PTS_FOUND,{initPTS:s})}t.offsetStartDTS(n,e,s),o=t.getStartDTS(n,e),this.remuxer.remux(n.audio,n.video,null,null,o,i,a,e)},t.prototype.destroy=function(){},t}(),W=K,V={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],appendFrame:function(t,e,r,i,a){if(!(r+24>e.length)){var n=this.parseHeader(e,r);if(n&&r+n.frameLength<=e.length){var o=10368e4/n.sampleRate,s=i+a*o,l={unit:e.subarray(r,r+n.frameLength),pts:s,dts:s};return t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(l),t.len+=n.frameLength,{sample:l,length:n.frameLength}}}},parseHeader:function(t,e){var r=t[e+1]>>3&3,i=t[e+1]>>1&3,a=t[e+2]>>4&15;,n=t[e+2]>>2&3,o=!!(2&t[e+2]);if(1!==r&&0!==a&&15;!==a&&3!==n){var s=3===r?3-i:3===i?3:4,l=1e3*V.BitratesMap[14*s+a-1],u=3===r?0:2===r?1:2,d=V.SamplingRateMap[3*u+n],h=o?1:0;return{sampleRate:d,channelCount:t[e+3]>>6==3?1:2,frameLength:3===i?(3===r?12:6)*l/d+h<<2:(3===r?144:72)*l/d+h|0}}},isHeaderPattern:function(t,e){return 255===t[e]&&224;==(224&t[e+1])&&0!=(6&t[e+1])},isHeader:function(t,e){return!!(e+1t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,e=t>>3,t-=e>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},t.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&N.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this;.loadWord(),e=t-e,e>0&&this;.bitsAvailable?r<>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},t.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},t.prototype.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},t.prototype.readBoolean=function(){return 1===this.readBits(1)},t.prototype.readUByte=function(){return this.readBits(8)},t.prototype.readUShort=function(){return this.readBits(16)},t.prototype.readUInt=function(){return this.readBits(32)},t.prototype.skipScalingList=function(t){var e,r,i=8,a=8;for(e=0;e=t.length)return void r();if(!(t[e].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,i),!i)return}}},t.prototype.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),i=0,a=32;a<=t.length-16;a+=160,i+=16)r.set(t.subarray(a,a+16),i);return r},t.prototype.getAvcDecryptedUnit=function(t,e){e=new Uint8Array(e);for(var r=0,i=32;i<=t.length-16;i+=160,r+=16)t.set(e.subarray(r,r+16),i);return t},t.prototype.decryptAvcSample=function(t,e,r,i,a,n){var o=this.discardEPB(a.data),s=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(s.buffer,function(s){a.data=l.getAvcDecryptedUnit(o,s),n||l.decryptAvcSamples(t,e,r+1,i)})},t.prototype.decryptAvcSamples=function(t,e,r,i){for(;;e++,r=0){if(e>=t.length)return void i();for(var a=t[e].units;!(r>=a.length);r++){var n=a[r];if(!(n.length<=48||1!==n.type&&5!==n.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(t,e,r,i,n,o),!o)return}}}},t}(),Q=q,J=function(){function t(e,r,i,a){T(this,t),this.observer=e,this.config=i,this.typeSupported=a,this.remuxer=r,this.sampleAes=null}return t.prototype.setDecryptData=function(t){null!=t&&null;!=t.key&&"SAMPLE-AES"===t.method?this.sampleAes=new Q(this.observer,this.config,t,this.discardEPB):this.sampleAes=null},t.probe=function(t){return t.length>=564&&71;===t[0]&&71;===t[188]&&71;===t[376]},t.prototype.resetInitSegment=function(t,e,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:0},this._audioTrack={container:"video/mp2t",type:"audio",id:-1,inputTimeScale:9e4,duration:i,sequenceNumber:0,samples:[],len:0,isAAC:!0},this._id3Track={type:"id3",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=r,this._duration=i},t.prototype.resetTimeStamp=function(){},t.prototype.append=function(t,e,r,i){var a,n,o,s,l,u=t.length,d=!1;this.contiguous=r;var h=this.pmtParsed,c=this._avcTrack,f=this._audioTrack,p=this._id3Track,g=c.id,v=f.id,y=p.id,m=this._pmtId,b=c.pesData,E=f.pesData,T=p.pesData,R=this._parsePAT,S=this._parsePMT,A=this._parsePES,_=this._parseAVCPES.bind(this),L=this._parseAACPES.bind(this),w=this._parseMPEGPES.bind(this),I=this._parseID3PES.bind(this);for(u-=u8,a=0;a>4>1){if((s=a+5+t[a+4])===a+188)continue}else s=a+4;switch(o){case g:n&&(b&&(l=A(b))&&_(l,!1),b={data:[],size:0}),b&&(b.data.push(t.subarray(s,a+188)),b.size+=a+188-s);break;case v:n&&(E&&(l=A(E))&&(f.isAAC?L(l):w(l)),E={data:[],size:0}),E&&(E.data.push(t.subarray(s,a+188)),E.size+=a+188-s);break;case y:n&&(T&&(l=A(T))&&I(l),T={data:[],size:0}),T&&(T.data.push(t.subarray(s,a+188)),T.size+=a+188-s);break;case 0:n&&(s+=t[s]+1),m=this._pmtId=R(t,s);break;case m:n&&(s+=t[s]+1);var O=S(t,s,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);g=O.avc,g>0&&(c.id=g),v=O.audio,v>0&&(f.id=v,f.isAAC=O.isAAC),y=O.id3,y>0&&(p.id=y),d&&!h&&(N.b.log("reparse from beginning"),d=!1,a=-188),h=this.pmtParsed=!0;break;case 17:case 8191:break;default:d=!0}}else this.observer.trigger(D.a.ERROR,{type:k.b.MEDIA_ERROR,details:k.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b&&(l=A(b))?(_(l,!0),c.pesData=null):c.pesData=b,E&&(l=A(E))?(f.isAAC?L(l):w(l),f.pesData=null):(E&&E.size&&N.b.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=E),T&&(l=A(T))?(I(l),p.pesData=null):p.pesData=T,null==this.sampleAes?this.remuxer.remux(f,c,p,this._txtTrack,e,r,i):this.decryptAndRemux(f,c,p,this._txtTrack,e,r,i)},t.prototype.decryptAndRemux=function(t,e,r,i,a,n,o){if(t.samples&&t.isAAC){var s=this;this.sampleAes.decryptAacSamples(t.samples,0,function(){s.decryptAndRemuxAvc(t,e,r,i,a,n,o)})}else this.decryptAndRemuxAvc(t,e,r,i,a,n,o)},t.prototype.decryptAndRemuxAvc=function(t,e,r,i,a,n,o){if(e.samples){var s=this;this.sampleAes.decryptAvcSamples(e.samples,0,0,function(){s.remuxer.remux(t,e,r,i,a,n,o)})}else this.remuxer.remux(t,e,r,i,a,n,o)},t.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},t.prototype._parsePMT=function(t,e,r,i){var a,n,o,s,l={audio:-1,avc:-1,id3:-1,isAAC:!0};for(a=(15&t[e+1])<<8|t[e+2],n=e+3+a-4,o=(15&t[e+10])<<8|t[e+11],e+=12+o;e1;){var h=new Uint8Array(d[0].length+d[1].length);h.set(d[0]),h.set(d[1],d[0].length),d[0]=h,d.splice(1,1)}if(e=d[0],1===(e[0]<<16)+(e[1]<<8)+e[2]){if((i=(e[4]<<8)+e[5])&&i>t.size-6)return null;r=e[7],192&r&&(o=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,o>4294967295&&(o-=8589934592),64&r?(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,s>4294967295&&(s-=8589934592),o-s>54e5&&(N.b.warn(Math.round((o-s)/9e4)+"s delta between PTS and DTS, align them"),o=s)):s=o),a=e[8],l=a+9,t.size-=l,n=new Uint8Array(t.size);for(var c=0,f=d.length;cp){l-=p;continue}e=e.subarray(l),p-=l,l=0}n.set(e,u),u+=p}return i&&(i-=a+3),{data:n,pts:o,dts:s,len:i}}return null},t.prototype.pushAccesUnit=function(t,e){if(t.units.length&&t.frame){var r=e.samples,i=r.length;!this.config.forceKeyFrameOnDiscontinuity||!0===t.key||e.sps&&(i||this.contiguous)?(t.id=i,r.push(t)):e.dropped++}t.debug.length&&N.b.log(t.pts+"/"+t.dts+":"+t.debug)},t.prototype._parseAVCPES=function(t,e){var r,i,a,n=this,o=this._avcTrack,s=this._parseAVCNALu(t.data),l=this.avcSample,u=!1,d=this.pushAccesUnit.bind(this),h=function(t,e,r,i){return{key:t,pts:e,dts:r,units:[],debug:i}};t.data=null,l&&s.length&&(d(l,o),l=this.avcSample=h(!1,t.pts,t.dts,"")),s.forEach(function(e){switch(e.type){case 1:i=!0,l.frame=!0;var s=e.data;if(u&&s.length>4){var c=new z(s).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(l.key=!0)}break;case 5:i=!0,l||(l=n.avcSample=h(!0,t.pts,t.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0,r=new z(n.discardEPB(e.data)),r.readUByte();for(var f=0,p=0,g=!1,v=0;!g&&r.bytesAvailable>1;){f=0;do{v=r.readUByte(),f+=v}while(255===v);p=0;do{v=r.readUByte(),p+=v}while(255===v);if(4===f&&0!==r.bytesAvailable){g=!0;if(181===r.readUByte()){if(49===r.readUShort()){if(1195456820===r.readUInt()){if(3===r.readUByte()){var y=r.readUByte(),m=r.readUByte(),b=31&y,E=[y,m];for(a=0;a0){if(e.pts>=t[r-1].pts)t.push(e);else for(var i=r-1;i>=0;i--)if(e.pts=0)i={data:t.subarray(c,o-u-1),type:n},h.push(i);else{var f=this._getLastNalUnit();if(f&&(d&&o<=4-d&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-d)),(r=o-u-1)>0)){var p=new Uint8Array(f.data.byteLength+r);p.set(f.data,0),p.set(t.subarray(0,r),f.data.byteLength),f.data=p}}o=0&&u>=0&&(i={data:t.subarray(c,s),type:n,state:u},h.push(i)),0===h.length){var g=this._getLastNalUnit();if(g){var v=new Uint8Array(g.data.byteLength+t.byteLength);v.set(g.data,0),v.set(t,g.data.byteLength),g.data=v}}return l.naluState=u,h},t.prototype.discardEPB=function(t){for(var e,r,i=t.byteLength,a=[],n=1;n1&&(N.b.log("AAC: align PTS for overlapping frames by "+Math.round((m-l)/90)),l=m)}for(;i>24&255;,e[1]=i>>16&255;,e[2]=i>>8&255;,e[3]=255&i,e.set(t,4),a=0,i=8;a>24&255;,e>>16&255;,e>>8&255;,255&e,i>>24,i>>16&255;,i>>8&255;,255&i,a>>24,a>>16&255;,a>>8&255;,255&a,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255;,e>>8&255;,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,r,i){return t.box(t.types.moof,t.mfhd(e),t.traf(i,r))},t.moov=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(i))},t.mvhd=function(e,r){r*=e;var i=Math.floor(r/(it+1)),a=Math.floor(r%(it+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255;,e>>16&255;,e>>8&255;,255&e,i>>24,i>>16&255;,i>>8&255;,255&i,a>>24,a>>16&255;,a>>8&255;,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,n)},t.sdtp=function(e){var r,i,a=e.samples||[],n=new Uint8Array(4+a.length);for(i=0;i>>8&255;),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r>>8&255;),o.push(255&a),o=o.concat(Array.prototype.slice.call(i));var s=t.box(t.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(o))),l=e.width,u=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255;,255&l,u>>8&255;,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([d>>24,d>>16&255;,d>>8&255;,255&d,h>>24,h>>16&255;,h>>8&255;,255&h])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255;,255&r,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255;,255&r,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var r=e.id,i=e.duration*e.timescale,a=e.width,n=e.height,o=Math.floor(i/(it+1)),s=Math.floor(i%(it+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255;,r>>16&255;,r>>8&255;,255&r,0,0,0,0,o>>24,o>>16&255;,o>>8&255;,255&o,s>>24,s>>16&255;,s>>8&255;,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255;,255&a,0,0,n>>8&255;,255&n,0,0]))},t.traf=function(e,r){var i=t.sdtp(e),a=e.id,n=Math.floor(r/(it+1)),o=Math.floor(r%(it+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255;,a>>8&255;,255&a])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255;,n>>8&255;,255&n,o>>24,o>>16&255;,o>>8&255;,255&o])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var r=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255;,r>>8&255;,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,r){var i,a,n,o,s,l,u=e.samples||[],d=u.length,h=12+16*d,c=new Uint8Array(h);for(r+=8+h,c.set([0,0,15,1,d>>>24&255;,d>>>16&255;,d>>>8&255;,255&d,r>>>24&255;,r>>>16&255;,r>>>8&255;,255&r],0),i=0;i>>24&255;,n>>>16&255;,n>>>8&255;,255&n,o>>>24&255;,o>>>16&255;,o>>>8&255;,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255;,l>>>16&255;,l>>>8&255;,255&l],12+16*i);return t.box(t.types.trun,c)},t.initSegment=function(e){t.types||t.init();var r,i=t.moov(e);return r=new Uint8Array(t.FTYP.byteLength+i.byteLength),r.set(t.FTYP),r.set(i,t.FTYP.byteLength),r},t}(),nt=at,ot=function(){function t(e,r,i,a){_(this,t),this.observer=e,this.config=r,this.typeSupported=i;var n=navigator.userAgent;this.isSafari=a&&a.indexOf("Apple")>-1&&n&&!n.match("CriOS"),this.ISGenerated=!1}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},t.prototype.resetInitSegment=function(){this.ISGenerated=!1},t.prototype.remux=function(t,e,r,i,a,n,o){if(this.ISGenerated){if(o){var s=this._initPTS,l=this._PTSNormalize,u=t.inputTimeScale||e.inputTimeScale,d=1/0,h=1/0,c=t.samples;if(c.length&&(d=h=l(c[0].pts-u*a,s)),c=e.samples,c.length){var f=c[0];d=Math.min(d,l(f.pts-u*a,s)),h=Math.min(h,l(f.dts-u*a,s))}if(d!==1/0){var p=s-d;Math.abs(p)>10*u&&(N.b.warn("timestamp inconsistency, "+(p/u).toFixed(3)+"s delta against expected value: missing discontinuity ? reset initPTS/initDTS"),this._initPTS=d,this._initDTS=h,this.observer.trigger(D.a.INIT_PTS_FOUND,{initPTS:d}))}}}else this.generateIS(t,e,a);if(this.ISGenerated)if(t.samples.length){t.timescale||(N.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,a));var g=this.remuxAudio(t,a,n,o);if(e.samples.length){var v=void 0;g&&(v=g.endPTS-g.startPTS),e.timescale||(N.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,a)),this.remuxVideo(e,a,n,v,o)}}else{var y=void 0;e.samples.length&&(y=this.remuxVideo(e,a,n,o)),y&&t.codec&&this;.remuxEmptyAudio(t,a,n,y)}r.samples.length&&this;.remuxID3(r,a),i.samples.length&&this;.remuxText(i,a),this.observer.trigger(D.a.FRAG_PARSED)},t.prototype.generateIS=function(t,e,r){var i,a,n=this.observer,o=t.samples,s=e.samples,l=this.typeSupported,u="audio/mp4",d={},h={tracks:d},c=void 0===this._initPTS;if(c&&(i=a=1/0),t.config&&o.length&&(t.timescale=t.samplerate,N.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(l.mpeg?(u="audio/mpeg",t.codec=""):l.mp3&&(t.codec="mp3")),d.audio={container:u,codec:t.codec,initSegment:!t.isAAC&&l.mpeg?new Uint8Array:nt.initSegment([t]),metadata:{channelCount:t.channelCount}},c&&(i=a=o[0].pts-t.inputTimeScale*r)),e.sps&&e.pps&&s.length){var f=e.inputTimeScale;e.timescale=f,d.video={container:"video/mp4",codec:e.codec,initSegment:nt.initSegment([e]),metadata:{width:e.width,height:e.height}},c&&(i=Math.min(i,s[0].pts-f*r),a=Math.min(a,s[0].dts-f*r),this.observer.trigger(D.a.INIT_PTS_FOUND,{initPTS:i}))}Object.keys(d).length?(n.trigger(D.a.FRAG_PARSING_INIT_SEGMENT,h),this.ISGenerated=!0,c&&(this._initPTS=i,this._initDTS=a)):n.trigger(D.a.ERROR,{type:k.b.MEDIA_ERROR,details:k.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.prototype.remuxVideo=function(t,e,r,i,a){var n,o,s,l,u,d,h,c=8,f=t.timescale,p=t.samples,g=[],v=p.length,y=this._PTSNormalize,m=this._initDTS,b=this.nextAvcDts,E=this.isSafari;E&&(r|=p.length&&b&&(a&&Math;.abs(e-b/f)<.1||Math.abs(p[0].pts-b-m)1?N.b.log("AVC:"+A+" ms hole between fragments detected,filling it"):A<-1&&N.b.log("AVC:"+-A+" ms overlapping between fragments detected"),u=b,p[0].dts=u,l=Math.max(l-A,b),p[0].pts=l,N.b.log("Video/PTS/DTS adjusted: "+Math.round(l/90)+"/"+Math.round(u/90)+",delta:"+A+" ms")),S=p[p.length-1],h=Math.max(S.dts,0),d=Math.max(S.pts,0,h),E&&(n=Math.round((h-u)/(p.length-1)));for(var _=0,L=0,w=0;w0?U-1:U].dts;if(z.stretchShortVideoTrack){var Q=z.maxBufferHole,J=z.maxSeekHole,$=Math.floor(Math.min(Q,J)*f),Z=(i?l+i*f:this.nextAudioPts)-B.pts;Z>$?(n=Z-q,n<0&&(n=q),N.b.log("It is approximately "+Z/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=q}else n=q}j=Math.round(B.pts-B.dts)}g.push({size:H,duration:n,cts:j,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:B.key?2:1,isNonSync:B.key?0:1}})}this.nextAvcDts=h+n;var tt=t.dropped;if(t.len=0,t.nbNalu=0,t.dropped=0,g.length&&navigator;.userAgent.toLowerCase().indexOf("chrome")>-1){var et=g[0].flags;et.dependsOn=2,et.isNonSync=0}t.samples=g,s=nt.moof(t.sequenceNumber++,u,t),t.samples=[];var rt={data1:s,data2:o,startPTS:l/f,endPTS:(d+n)/f,startDTS:u/f,endDTS:this.nextAvcDts/f,type:"video",nb:g.length,dropped:tt};return this.observer.trigger(D.a.FRAG_PARSING_DATA,rt),rt},t.prototype.remuxAudio=function(t,e,r,i){var a,n,o,s,l,u,d,h=t.inputTimeScale,c=t.timescale,f=h/c,p=t.isAAC?1024:1152,g=p*f,v=this._PTSNormalize,y=this._initDTS,m=!t.isAAC&&this;.typeSupported.mpeg,b=t.samples,E=[],T=this.nextAudioPts;if(r|=b.length&&T&&(i&&Math;.abs(e-T/h)<.1||Math.abs(b[0].pts-T-y)<20*g),r||(T=e*h),b.forEach(function(t){t.pts=t.dts=v(t.pts-y,T)}),b.sort(function(t,e){return t.pts-e.pts}),i&&t.isAAC)for(var R=0,S=T;R=g&&w<1e4&&S){var I=Math.round(A/g);N.b.warn("Injecting "+I+" audio frame @ "+(S/h).toFixed(3)+"s due to "+Math.round(1e3*A/h)+" ms gap.");for(var O=0;O0&&B<1e4)G=Math.round((U-T)/g),N.b.log(B+" ms hole between AAC samples detected,filling it"),G>0&&(o=rt.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),o||(o=M.subarray()),t.len+=G*o.length);else if(B<-12){N.b.log("drop overlapping AAC sample, expected/parsed/delta:"+(T/h).toFixed(3)+"s/"+(U/h).toFixed(3)+"s/"+-B+"ms"),t.len-=M.byteLength;continue}U=T}if(u=Math.max(0,U),!(t.len>0))return;var H=m?t.len:t.len+8;a=m?0:8;try{s=new Uint8Array(H)}catch(t){return void this.observer.trigger(D.a.ERROR,{type:k.b.MUX_ERROR,details:k.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:H,reason:"fail allocating audio mdat "+H})}if(!m){new DataView(s.buffer).setUint32(0,H),s.set(nt.types.mdat,4)}for(var j=0;j=2&&(W=E[V-2].duration,n.duration=W),V){this.nextAudioPts=T=d+f*W,t.len=0,t.samples=E,l=m?new Uint8Array:nt.moof(t.sequenceNumber++,u/f,t),t.samples=[];var Y=u/h,X=T/h,z={data1:l,data2:s,startPTS:Y,endPTS:X,startDTS:Y,endDTS:X,type:"audio",nb:V};return this.observer.trigger(D.a.FRAG_PARSING_DATA,z),z}return null},t.prototype.remuxEmptyAudio=function(t,e,r,i){var a=t.inputTimeScale,n=t.samplerate?t.samplerate:a,o=a/n,s=this.nextAudioPts,l=(void 0!==s?s:i.startDTS*a)+this._initDTS,u=i.endDTS*a+this._initDTS,d=1024*o,h=Math.ceil((u-l)/d),c=rt.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(N.b.warn("remux empty Audio"),!c)return void N.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var f=[],p=0;p4294967296;)t+=r;return t},t}(),st=ot,lt=function(){function t(e){L(this,t),this.observer=e}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(){},t.prototype.resetInitSegment=function(){},t.prototype.remux=function(t,e,r,i,a,n,o,s){var l=this.observer,u="";t&&(u+="audio"),e&&(u+="video"),l.trigger(D.a.FRAG_PARSING_DATA,{data1:s,startPTS:a,startDTS:a,type:u,nb:1,dropped:0}),l.trigger(D.a.FRAG_PARSED)},t}(),ut=lt,dt=function(){function t(e,r,i,a){w(this,t),this.observer=e,this.typeSupported=r,this.config=i,this.vendor=a}return t.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},t.prototype.push=function(t,e,r,i,a,n,o,s,l,u,d,h){if(t.byteLength>0&&null;!=e&&null;!=e.key&&"AES-128"===e.method){var c=this.decrypter;null==c&&(c=this.decrypter=new U(this.observer,this.config));var f,p=this;try{f=performance.now()}catch(t){f=Date.now()}c.decrypt(t,e.key.buffer,e.iv.buffer,function(t){var c;try{c=performance.now()}catch(t){c=Date.now()}p.observer.trigger(D.a.FRAG_DECRYPTED,{stats:{tstart:f,tdecrypt:c}}),p.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,n,o,s,l,u,d,h)})}else this.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,n,o,s,l,u,d,h)},t.prototype.pushDecrypted=function(t,e,r,i,a,n,o,s,l,u,d,h){var c=this.demuxer;if(!c||o&&!this.probe(t)){for(var f=this.observer,p=this.typeSupported,g=this.config,v=[{demux:$,remux:st},{demux:H,remux:st},{demux:tt,remux:st},{demux:W,remux:ut}],y=0,m=v.length;ye?i.start+i.duration:Math.max(i.start-a.duration,0):r>e?(i.duration=n-i.start,i.duration<0&&wt;.b.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-n,a.duration<0&&wt;.b.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!"))}function v(t,e,r,i,a,n){if(!isNaN(e.startPTS)){var o=Math.abs(e.startPTS-r);isNaN(e.deltaPTS)?e.deltaPTS=o:e.deltaPTS=Math.max(o,e.deltaPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),a=Math.min(a,e.startDTS),n=Math.max(n,e.endDTS)}var s=r-e.start;e.start=e.startPTS=r,e.endPTS=i,e.startDTS=a,e.endDTS=n,e.duration=i-r;var l=e.sn;if(!t||lt.endSN)return 0;var u,d,h;for(u=l-t.startSN,d=t.fragments,e=d[u],h=u;h>0;h--)g(d,h,h-1);for(h=u;h=0&&n

立即下载
其他文档
POJ 1002 487-3279 telephone numbers

487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 102808 Accepted: 17241 Description Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by dialing the memorable TUT-GLOP. Sometimes only part of the number is used to spell a word. When you get back to your hotel tonight you can order a pizza from Gino's by dialing 310-GINO. Another way to make a telephone number memorable is to group the digits in a memorable way. You could order your pizza from Pizza Hut by calling their ``three tens'' number 3-10-10-10. The standard form of a telephone number is seven decimal digits with a hyphen between the third and fourth digits (e.g. 888-1200). The keypad of a phone supplies the mapping of letters to numbers, as follows: A, B, and C map to 2 D, E, and F map to 3 G, H, and I map to 4 J, K, and L map to 5 M, N, and O map to 6 P, R, and S map to 7 T, U, and V map to 8 W, X, and Y map to 9 There is no mapping for Q or Z. Hyphens are not dialed, and can be added and removed as necessary. The standard form of TUT-GLOP is 888-4567, the standard form of 310-GINO is 310-4466, and the standard form of 3-10-10-10 is 310-1010. Two telephone numbers are equivalent if they have the same standard form. (They dial the same number.) Your company is compiling a directory of telephone numbers from local businesses. As part of the quality control process you want to check that no two (or more) businesses in the directory have the same telephone number. Input The input will consist of one case. The first line of the input specifies the number of telephone numbers in the directory (up to 100,000) as a positive integer alone on the line. The remaining lines list the telephone numbers in the directory, with each number alone on a line. Each telephone number consists of a string composed of decimal digits, uppercase letters (excluding Q and Z) and hyphens. Exactly seven of the characters in the string will be digits or letters. Output Generate a line of output for each telephone number that appears more than once in any form. The line should give the telephone number in standard form, followed by a space, followed by the number of times the telephone number appears in the directory. Arrange the output lines by telephone number in ascending lexicographical order. If there are no duplicates in the input print the line: No duplicates. Sample Input 12 4873279 ITS-EASY 888-4567 3-10-10-10 888-GLOP TUT-GLOP 967-11-11 310-GINO F101010 888-1200 -4-8-7-3-2-7-9- 487-3279 Sample Output 310-1010 2 487-3279 4 888-4567 3 Source East Central North America 1999 487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 102808 Accepted: 17241 Description 企业喜欢用容易被记住的电话号码。让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语。例如,你需要给滑铁卢大学打电话时,可以拨打TUT-GLOP。有时,只将电话号码中部分数字拼写成单词。当你晚上回到酒店,可以通过拨打310-GINO来向Gino's订一份pizza。让电话号码容易被记住的另一个办法是以一种好记的方式对号码的数字进行分组。通过拨打必胜客的“三个十”号码3-10-10-10,你可以从他们那里订pizza。 电话号码的标准格式是七位十进制数,并在第三、第四位数字之间有一个连接符。电话拨号盘提供了从字母到数字的映射,映射关系如下: A, B, 和C 映射到 2 D, E, 和F 映射到 3 G, H, 和I 映射到 4 J, K, 和L 映射到 5 M, N, 和O 映射到 6 P, R, 和S 映射到 7 T, U, 和V 映射到 8 W, X, 和Y 映射到 9 Q和Z没有映射到任何数字,连字符不需要拨号,可以任意添加和删除。 TUT-GLOP的标准格式是888-4567,310-GINO的标准格式是310-4466,3-10-10-10的标准格式是310-1010。 如果两个号码有相同的标准格式,那么他们就是等同的(相同的拨号) 你的公司正在为本地的公司编写一个电话号码薄。作为质量控制的一部分,你想要检查是否有两个和多个公司拥有相同的电话号码。 Input 输入的格式是,第一行是一个正整数,指定电话号码薄中号码的数量(最多100000)。余下的每行是一个电话号码。每个电话号码由数字,大写字母(除了Q和Z)以及连接符组成。每个电话号码中只会刚好有7个数字或者字母。 Output 对于每个出现重复的号码产生一行输出,输出是号码的标准格式紧跟一个空格然后是它的重复次数。如果存在多个重复的号码,则按照号码的字典升序输出。如果输入数据中没有重复的号码,输出一行: No duplicates. Sample Input 12 4873279 ITS-EASY 888-4567 3-10-10-10 888-GLOP TUT-GLOP 967-11-11 310-GINO F101010 888-1200 -4-8-7-3-2-7-9- 487-3279 Sample Output 310-1010 2 487-3279 4 888-4567 3 Source East Central North America 1999 Translator 北京大学程序设计实习2007

立即下载
热门资源标签
Global site tag (gtag.js) - Google Analytics