int main(ULONG argc, char **argv) { INT NandImageFile, RamDiskFile; /* Flat NAND, no OOB */ if (argc == 2) NeedsOob = FALSE; /* Open or create NAND Image File */ NandImageFile = CreateFlashFile(); if (!NandImageFile) exit(-1); /* Write components */ WriteLlb(NandImageFile); WriteBootLdr(NandImageFile); if (NeedsOob) { /* Write the ramdisk normaly */ WriteFileSystem(NandImageFile); } else { /* Open a new file for the ramdisk */ RamDiskFile = open(RamImageName, O_RDWR | O_CREAT); if (!RamDiskFile) exit(-1); /* Write it */ WriteRamDisk(RamDiskFile); /* Close */ close(RamDiskFile); } /* Close and return */ close(NandImageFile); return 0; }
INT32S Simu_Write_ChData(INT32S nLength[],INT32S nChNo[],INT32S nCnt, INT32U nDynamicChDataOffset[],INT32U nDynamicKeyOffset[],INT32U nDynamicStep[], INT32U nTranChDataOffset[],INT32U nTranKeyOffset[],INT32U nTranStep[]) { INT32S re=0; INT32S i=0,j,nLth,nSit; INT8S* pData=(INT8S *)g_pOutChData; INT32S nChDataSize=sizeof(struct tagChData2060)+(_MAX_KEY_PT_CNT+g_nDatalth-1)*sizeof(INT32S); INT32S noKey[]={0,0,0,0}; for(i=0;i<_MAX_SIGNAL_CHANNEL_CNT;i++) { if(nChNo[re]==i) { INT8S* p=(INT8S *)g_pOutChDataArray[i]; INT32S* pChData=(INT32S *)(p+sizeof(struct tagChData2060)+(_MAX_KEY_PT_CNT-1)*sizeof(INT32S)); Mem_Clr(g_nDynamicResult, sizeof(g_nDynamicResult)); nLth=(g_nDynamicStart[i]+_DEFAULT_DATA_LTH)/nDynamicStep[i]; g_nDynamicResult[0]=nLth; nSit=g_nDynamicStart[i]; for(j=1;j<nLth+1;j++) { g_nDynamicResult[j]=pChData[nSit]; nSit+=nDynamicStep[i]; } WriteRamDisk(nDynamicChDataOffset[i],g_nDynamicResult,nLth+1); g_nDynamicStart[i]=(g_nDynamicStart[i]+_DEFAULT_DATA_LTH)%nDynamicStep[i]; Mem_Clr(g_nTranResult, sizeof(g_nTranResult)); nLth=(g_nTranStart[i]+_DEFAULT_DATA_LTH)/nTranStep[i]; g_nTranResult[0]=nLth; nSit=g_nTranStart[i]; for(j=1;j<nLth+1;j++) { g_nTranResult[j]=pChData[nSit]; nSit+=nTranStep[i]; } WriteRamDisk(nTranChDataOffset[i],g_nTranResult,nLth+1); g_nTranStart[i]=(g_nTranStart[i]+_DEFAULT_DATA_LTH)%nTranStep[i]; re++; if(re==nCnt) break; } } for(i=0;i<_MAX_JKEY_CHANNEL_CNT;i++) { if(g_pOutChDataArray[g_nKeyChannSit[i]]->nKeycnt) { nLth=g_pOutChDataArray[g_nKeyChannSit[i]]->nKeycnt; g_nKeyResult[0]=nLth; nSit=g_nDynamicStart[i]; Mem_Copy(g_nKeyResult+1,g_pOutChDataArray[g_nKeyChannSit[i]]->pData,nLth*sizeof(INT32S)); for(j=1;j<nLth+1;j++) { g_nKeyResult[j]/=nDynamicStep[i]; } WriteRamDisk(nDynamicKeyOffset[i],g_nKeyResult,nLth+1); Mem_Copy(g_nKeyResult+1,g_pOutChDataArray[g_nKeyChannSit[i]]->pData,nLth*sizeof(INT32S)); for(j=1;j<nLth+1;j++) { g_nKeyResult[j]/=nTranStep[i]; } WriteRamDisk(nTranKeyOffset[i],g_nKeyResult,nLth+1); }else { WriteRamDisk(nDynamicKeyOffset[i],noKey,sizeof(noKey)/sizeof(INT32S)); WriteRamDisk(nTranKeyOffset[i],noKey,sizeof(noKey)/sizeof(INT32S)); } } return re; }