?? sjf.c
字號:
/********************************************************************************** The SJF is written by analyzing ezTAG program, which was written by Jaewook Cheong, SEC S/W Centor. Special thanks to Jaewook Cheong and Dale Roberts(the author of GIVEIO.sys) In SJF, the following feature is updated from ezTAG 1. The structure of JTAG functions is changed for speed-up. 2. The indexs of the pins become coherent with the BSDL file. 3. SAMPLE/PRELOAD is used for initializing outCellValue[]. 4. The array size error is fixed(S3C2410_MAX_CELLS -> S3C2410_MAX_CELL_INDEX+2) 5. The array was not followed by '\0', which is fixed. 6. JTAG_ID reading error is fixed. 7. Support K9S1208 SMD card for the SMDK2410 board. 8. The programming speed is enhanced. **********************************************************************************//******************************************* Revision history 2002.06.10:purnnamu:ver 0.1 -first release 2002.06.21:purnnamu:ver 0.11 -trivial display error is fixed. 2002.08.20:purnnamu:ver 0.3 -Strata flash is supported. *******************************************/#include <stdio.h>#include "def.h"#include "pin2410.h"#include "jtag.h"#include "ppt.h"#include "k9s1208.h"#include "strata32.h"#include "mem_rdwr.h"FILE *stream;U32 imageSize;char srcFileName[256];void OpenImageFile(char *filename);void OpenPpt(void);void ErrorBanner(void);static void *function[]={ "K9S1208 program ", "28F128J3A program ", "Memory Rd/Wr ", "Exit ", 0};void main(int argc,char *argv[]){ char num=0; int i; printf("\n"); printf("+------------------------------------+\n"); printf("| SEC JTAG FLASH(SJF) v 0.3 |\n"); printf("| (S3C2410X & SMDK2410 B/D) |\n"); printf("+------------------------------------+\n"); printf("Usage: SJF /f:<filename> /d=<delay>\n"); delayLoopCount=100; srcFileName[0]='\0'; for(i=1;i<argc;i++) { switch(argv[i][1]) { case 'f': strcpy(srcFileName,&(argv[i][3])); break; case 'd': delayLoopCount=atoi(&argv[i][3]); break; default: printf("ERROR: unknown option /%c is detected.\n",argv[i][1]); break; } } OpenPpt(); if(srcFileName[0]!='\0') OpenImageFile(srcFileName); JTAG_ReadId(); S2410_InitCell(); printf("\n[SJF Main Menu]\n"); i=0; while(1) { //display menu printf("%2d:%s",i,function[i]); i++; if((int)(function[i])==0) { printf("\n"); break; } if((i%4)==0) printf("\n"); } printf("Select the function to test:"); scanf("%d",&i); switch(i) { case 0: if(srcFileName[0]==0) { printf("ERROR:Source file name is not valid.\n"); return; } K9S1208_Menu(); break; case 1: if(srcFileName[0]==0) { printf("ERROR:Source file name is not valid.\n"); return; } Program28F128J3A(); break; case 2: MRW_Menu(); break; default: return; break; //Exit menu } return;}void OpenImageFile(char *filename){ U32 fileEnd,fileStart; stream = fopen(filename,"rb"); if(stream==NULL) { printf("\nERROR:can't find the file.\n"); exit(0); } fseek(stream,0L,SEEK_END); fileEnd=ftell(stream); fseek(stream,0L,SEEK_SET); fileStart=ftell(stream); imageSize=fileEnd-fileStart; /*fileend == peof+1 */}int LoadImageFile(U8 *buf,int size){ int i,readSize=size; for(i=0;i<size;i++) { if(feof(stream)) { readSize=i; for(;i<size;i++)buf[i]=0; break; } buf[i] = fgetc(stream); } return readSize;}void OpenPpt(void){ if(!InstallGiveIo()) { printf("ERROR: Couldn't open giveio.sys\n"); exit(0); } validPpt = GetValidPpt(); if(!validPpt) { printf("ERROR: Unable to find a parallel port\n"); exit(0); } SetPptCompMode(); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -