www.pudn.com > MPC8241BSP.rar > trueFFS.c
#include#include "blkIo.h" #include "ioLib.h" #include "iosLib.h" #include "memLib.h" #include "errnoLib.h" #include "string.h" #include "stdlib.h" #include "stdio.h" #include "dosFsLib.h" #include "stat.h" #include "time.h" #include "config.h" #include "usrLib.h" #include "flash.h" /*#include "mpc8260.h" #include "target.h" */ /************************************************************************ description: This function is used to format a flash device if needed, create a block device,mount the DOS file system on a TFFS Flash disk input: isFormat: 1 : need format 0 : without format output: return value: NULL ************************************************************************/ void CreateBlkDev(int isFormat) { STATUS rtValue; /* PDA* ppda;*/ /* ppda = (PDA*)(0x0f000000);*/ /****some initialization for system needed****/ /* ppda->pio_pcpar &= ~(BIT1); ppda->pio_pcdir |= BIT1;*/ /*printf("S_PortCDataReg is 0x%x\n",S_PortCDataReg);*/ /*ppda->pio_pcdat &= ~(BIT1);*/ /*printf("S_PortCDataReg is 0x%x\n",S_PortCDataReg);*/ /*ppda->pio_pcdat |= 1<< (31-1); ppda->pio_pcdat &= ~(1<< (31-1)); ppda->pio_pcdat |= (BIT2); ppda->pio_pcdat &= ~(BIT2); ppda->pio_pcdat |= (BIT4); ppda->pio_pcdat &= ~(BIT4); ppda->pio_pcdat = 0x88888888; temp = ppda->pio_pcdat; ppda->pio_pcdat |= (BIT1); ppda->pio_pcdat = 0x0; temp = ppda->pio_pcdat; ppda->pio_pcdat |= (BIT1);*/ /*printf("S_PortCDataReg is 0x%x\n",S_PortCDataReg);*/ /*ppda->pio_pcdat &= ~(BIT1);*/ if(isFormat == 1 ) { /*FlashEraseSector(0);*//*modified by msy*/ rtValue = tffsDevFormat(0,0); if(rtValue == ERROR) { printf("\ntffsDevFormat error"); return; } else { printf("\ntffsDevFormat sucessfully"); } } rtValue = usrTffsConfig(0,0,"RFA"); if(rtValue == ERROR) { printf("\nusrTffsConfig error"); return; } printf("\ntrueFFS flash file system is created sucessfully"); }