⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 ARM 10 KEYPAD DESIGN
💻 CPP
📖 第 1 页 / 共 2 页
字号:
				break;			case 'f' :				AskQuestions = false;				break;			case 'o' :				{					struct operation *op;					option = -1;					if (strlen(optarg) == 1){						for (op=ops; op < ops + nops; op++){							if (*optarg == op->optchr){								option = toupper(*optarg);								break;							}						}					} else {						for (op=ops; op < ops + nops; op++){							if (!strcmp(optarg, op->optstr)){								option = toupper(op->optchr);								break;							}						}					}					if (option == -1){						printf("invalid option in operation [%s].\n", optarg);						return -1;					}				}				/* not support */				break;			case 'p' :				platform = optarg;				break;			case 'h' :				jflashmm_usage();				return 0;			case '?' :				jflashmm_usage();				return -1;		}	}	strcpy(filename, (optind < argc) ? argv[optind] : "");	printf("\nJFLASH Version %s\n",  VERSION);    printf("COPYRIGHT (C) 2000 - 2003 Intel Corporation\n\n");	printf("PLATFORM SELECTION:\n");	// find platform data	s = find_platform_filename(platform);	strcpy(plat_name, s ? s : "");/*	if (!strlen(plat_name)){		if (!AskQuestions) return -1;		while (1){			printf(" Enter platform data file name : ");			fgets(plat_name, sizeof(plat_name), stdin);			s = strchr(plat_name, '\n');			if (s) *s = '\0';			s = find_platform_filename(plat_name);			if (s){ strcpy(plat_name, s); break; }			printf(" Cannot find platform %s\n", plat_name);		}	}*/	sprintf(data_filename, "%s", plat_name);	sprintf(int_data_filename, "%s_integrity.dat", plat_name);	ParseAndLoad();	Set_Platform_Global_Variables();	InitPinArray();	InitLockUnlock();	InitAddressOrder();	InitInputDataOrder();	InitOutputDataOrder();	InitChipSelectRegions();	AnalyzeChain();	printf(" Processor= \t\t%s\n", &WORDARRAY[p_processor][0]);	printf(" Development System= \t%s\n", "XSBase270");	printf(" Data Version= \t\t%s\n\n", &WORDARRAY[p_dataver][0]);	lpt_address = test_port();	// find a valid parallel port address	if(!lpt_address) error_out("Error, unable to find parallel port");    test_logic_reset();	// get binary file name		if (!strlen(filename)){		if(!UsageShown) usage();		printf("Enter binary file name : ");		fgets(filename, sizeof(filename), stdin);		// gets(filename);		s = strchr(filename, '\n');		if (s) *s = '\0';	}	test_logic_reset();	id_command();	//bypass_all();	IR_Command(IR_Bypass);    test_logic_reset();	gpio_unlock_flash();    //check_rom_info(&max_erase_time, &dsize, &max_write_buffer, &block_size, &nblocks);    check_rom_info(&max_erase_time, &dsize, &max_write_buffer);	in_file = fopen(filename, "rb" );	if (!in_file) error_out("error, can not open binary input file");	check_file_info(&fsize , &last_non_zero, &last_non_ff, dsize);        // Don't waste time programming ff's at the end of the file this is the erase state    fsize = last_non_ff;  	if(100 - (last_non_zero * 100)/last_non_ff > 20){		if(AskQuestions){			printf("The last %2ld percent of image file is all zeros\n",100 - (last_non_zero * 100)/last_non_ff);			printf("Would you like to save time by not programming that area? [y/n]: ");			if(toupper(_getche()) == 'Y')			fsize = last_non_zero;		} else {			fsize = last_non_zero;		}	}	printf("\n");	    if(option == 'P'){		EraseBlocks(base_address, fsize);		program_flash(max_write_buffer, base_address, fsize);				Write_Rom(0, F_READ_ARRAY);				// put back into read mode		access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going		time(&start);		gpio_lock_flash();		verify_flash(base_address, fsize);	} else if(option == 'I'){ // just used for identifying the chips without programming anything		printf("Program successful completion.\n");		printf("Processor and Flash Memory Identified.\n");		printf("No programming operation performed.\n");	} else if(option == 'N'){ // Program only with no verify cycle		EraseBlocks(base_address, fsize);		program_flash(max_write_buffer, base_address, fsize);				Write_Rom(0, F_READ_ARRAY);				// put back into read mode		access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going		time(&start);		gpio_lock_flash();	} else if(option == 'V'){		Write_Rom(0, F_READ_ARRAY);				// put back into read mode		access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going		time(&start);		gpio_lock_flash();		verify_flash(base_address, fsize);	} else if(option == 'S'){		Integrity_Check();	} else if(option == 'T'){ // test the flash by attempting to write to all sectors		if(AskQuestions) {			printf("About to test the entire flash memory..... \n");			printf("Is this what you want to do? (Y or N)\n");			if(toupper(_getche()) == 'Y'){				i = 0;				do {					test_logic_reset();					gpio_unlock_flash();					base_address = BLOCK_ADDRESS[i];					EraseBlocks(base_address, fsize);					program_flash(max_write_buffer, base_address, fsize);//    				Write_Rom(0, F_READ_ARRAY);				// put back into read mode//		  			access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going//					gpio_lock_flash();//					verify_flash(base_address, fsize);					i++;				} while (BLOCK_ADDRESS[i] != 0);				i = 0;				do				{					test_logic_reset();					gpio_unlock_flash();					base_address = BLOCK_ADDRESS[i];//					EraseBlocks(base_address, fsize);//					program_flash(max_write_buffer, base_address, fsize);    				Write_Rom(0, F_READ_ARRAY);				// put back into read mode		  			access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going					gpio_lock_flash();					verify_flash(base_address, fsize);					i++;				} while (BLOCK_ADDRESS[i] != 0);				printf("Successfully Completed a write to all sectors\n");			} else {				error_out("Cancelling the test....\n");			}		} else {			i = 0;			do {				test_logic_reset();				gpio_unlock_flash();				base_address = BLOCK_ADDRESS[i];				EraseBlocks(base_address, fsize);				program_flash(max_write_buffer, base_address, fsize);//    			Write_Rom(0, F_READ_ARRAY);				// put back into read mode//		  		access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going//				gpio_lock_flash();//				verify_flash(base_address, fsize);				i++;			} while (BLOCK_ADDRESS[i] != 0);			i = 0;			do {				test_logic_reset();				gpio_unlock_flash();				base_address = BLOCK_ADDRESS[i];//				EraseBlocks(base_address, fsize);//				program_flash(max_write_buffer, base_address, fsize);    			Write_Rom(0, F_READ_ARRAY);				// put back into read mode		  		access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going				gpio_lock_flash();				verify_flash(base_address, fsize);				i++;			} while (BLOCK_ADDRESS[i] != 0);			printf("Successfully Completed a write to all sectors\n");		}	} else if(option == 'R'){		Write_Rom(0, F_READ_ARRAY);				// put back into read mode		access_rom(READ, base_address, 0x0L, IGNORE_PORT); //extra read to get the pipeline going		if((intercom_file_pointer = fopen("VB2JFLASH_READ_DATA.BIN", "w")) == NULL){			printf("Cannot open output file: %s\n", "VB2JFLASH_READ_DATA.BIN");			exit(1);		} else { 			 sprintf(buf, "%lX", Read_Rom(base_address)); 			 fputs(buf,intercom_file_pointer);			 fclose (intercom_file_pointer); 			//printf("%X\n",Read_Rom(base_address));		}	} else if(option == 'E'){		if(AskQuestions){			printf("About to erase the entire flash memory..... \n");			printf("Is this what you want to do? (Y or N)\n");			if(toupper(_getche()) == 'Y'){				fsize = dsize - 1;				EraseBlocks(0, fsize);			} else {				error_out("Cancelling the erase....\n");			}		} else {			fsize = dsize - 1;			EraseBlocks(0, fsize);		}	} else {		printf("error specifying programming option. \n\n");		printf("Commands: \n");		printf("P = Program and verify\n");		printf("V = Verify only\n");		printf("T = Test flash. Program and verify same binary at every block.\n");		printf("I = Identify processor and flash type. No programming performed.\n");		printf("R = Read a location and write to file. RESERVED OPERATION\n");		printf("N = Program only with no verify\n");		printf("E = Erase entire flash memory\n");//		printf("S = Stuck bit search. Uses platform_integrity.dat file.\n");	}	fclose(in_file);	test_logic_reset();	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -