Пример #1
0
void TestFile(void){   int i; char data; 
  printf("\n\rEE345M/EE380L, Lab 5 eFile test\n\r");
  // simple test of eFile
  if(eFile_Init())              diskError("eFile_Init",0); 
  if(eFile_Format())            diskError("eFile_Format",0); 
  //eFile_Directory(&Serial_OutChar);
  eFile_Directory(&UARTPut);
  if(eFile_Create("file1"))     diskError("eFile_Create",0);
  if(eFile_WOpen("file1"))      diskError("eFile_WOpen",0);
  for(i=0;i<1000;i++){
    if(eFile_Write('a'+i%26))   diskError("eFile_Write",i);
    if(i%52==51){
      if(eFile_Write('\n'))     diskError("eFile_Write",i);  
      if(eFile_Write('\r'))     diskError("eFile_Write",i);
    }
  }
  if(eFile_WClose())            diskError("eFile_Close",0);
  //eFile_Directory(&Serial_OutChar);
  eFile_Directory(&UARTPut);
  if(eFile_ROpen("file1"))      diskError("eFile_ROpen",0);
  for(i=0;i<1000;i++){
    if(eFile_ReadNext(&data))   diskError("eFile_ReadNext",i);
    //Serial_OutChar(data);
	UARTPut(data);
  }
  if(eFile_Delete("file1"))     diskError("eFile_Delete",0);
  //eFile_Directory(&Serial_OutChar);
  eFile_Directory(&UARTPut);
  printf("Successful test of creating a file\n\r");
  OS_Kill();
}
Пример #2
0
void TestFile(void){   int i; char data; DSTATUS result; 
  OSuart_OutString(UART0_BASE, "\n\rEE345M/EE380L, Lab 5 eFile test\n\r");
  // simple test of eFile
  result = eDisk_Init(0);  // initialize disk
  if(result) diskError("eDisk_Init",result);
  if(eFile_Init())              diskError("eFile_Init",0); 
//  if(eFile_Format())            diskError("eFile_Format",0); 
  eFile_Directory();
  if(eFile_ROpen("file1"))      diskError("eFile_ROpen",0);
  eFile_Directory();
  for(i=0;i<1000;i++){
    if(eFile_ReadNext(&data))   diskError("eFile_ReadNext",i);
    OSuart_OutChar(UART0_BASE, data);
	SysCtlDelay(SysCtlClockGet()/10000);
  }
  eFile_Directory();	
  if(eFile_Create("file1"))     diskError("eFile_Create",0);
  if(eFile_WOpen("file1"))      diskError("eFile_WOpen",0);
  for(i=0;i<1000;i++){
    if(eFile_Write('a'+i%26))   diskError("eFile_Write",i);
    if(i%52==51){
      if(eFile_Write('\n'))     diskError("eFile_Write",i);  
      if(eFile_Write('\r'))     diskError("eFile_Write",i);
    }
  }
  if(eFile_WClose())            diskError("eFile_Close",0);
  eFile_Directory();
  if(eFile_Create("file2"))     diskError("eFile_Create",0);
  if(eFile_WOpen("file2"))      diskError("eFile_WOpen",0);
  for(i=0;i<1000;i++){
    if(eFile_Write('a'+i%26))   diskError("eFile_Write",i);
    if(i%52==51){
      if(eFile_Write('\n'))     diskError("eFile_Write",i);  
      if(eFile_Write('\r'))     diskError("eFile_Write",i);
    }
  }
  if(eFile_WClose())            diskError("eFile_Close",0);
  eFile_Directory();
/*  if(eFile_ROpen("file1"))      diskError("eFile_ROpen",0);
  eFile_Directory();
  for(i=0;i<1000;i++){
    if(eFile_ReadNext(&data))   diskError("eFile_ReadNext",i);
    OSuart_OutChar(UART0_BASE, data);
	SysCtlDelay(SysCtlClockGet()/10000);
  }
  eFile_Directory();
  if(eFile_Delete("file1"))     diskError("eFile_Delete",0);
//  eFile_Directory();	 */
  OSuart_OutString(UART0_BASE, "Successful test of creating a file\n\r");
  OS_Kill();
}
Пример #3
0
//writing to a file that does not exit
int main3(void){
	if(eFile_Init())              diskError("eFile_Init",0); 
  if(eFile_Format())            diskError("eFile_Format",0); 
  eFile_Directory(UART_OutChar);
	if(eFile_WOpen("f"))          diskError("eFile_WOpen", 0);
	eFile_Write('f');
	
return 0;
 }
Пример #4
0
//closing a file that is not open
int main2(void){
	if(eFile_Init())              diskError("eFile_Init",0); 
  if(eFile_Format())            diskError("eFile_Format",0); 
  eFile_Directory(UART_OutChar);
  eFile_Create("file1");    
  eFile_WOpen("file1");  

  eFile_RClose();    
  eFile_RClose();	
  return 0;
}
Пример #5
0
int process_cmd(char *input){
// static int screen1Line;
// unsigned short adc_val;
// char *strptr;
// char inString1[MAXSTRLEN];
// char inString2[MAXSTRLEN];
// int i;
unsigned char outVal;

  

 
//   1) print performance measures 
//    time-jitter, number of data points lost, number of calculations performed
//    i.e., NumSamples, NumCreated, MaxJitter-MinJitter, DataLost, FilterWork, PIDwork

 if(strncmp(input, "initFileSystem", 14) == 0){
  eFile_Init();
	 return 1;

 }
  
  if(strncmp(input, "formatDisk", 10) == 0){
   //format disk
   if(eFile_Format())  printf("Error: efile_format");
    return 1; 
  }
  
  if(strncmp(input, "printDirectory", 14) == 0){
   //output disk directory
	 UART_OutChar('\n');
	 UART_OutChar('\r');	
   eFile_Directory(UART_OutChar);
   return 1;
  }
  
  if(strncmp(input, "printFile ", 9) == 0){
		UART_OutChar('\n');
		UART_OutChar('\r');
   eFile_ROpen(input + 10);
   while(eFile_ReadNext(&outVal) == 0)
		 { 
			 UART_OutChar(outVal);
		 }
	 eFile_RClose();
   return 1;
  }
  
  if(strncmp(input, "deleteFile ", 11) == 0){
   eFile_Delete(input + 11);
   return 1;
  }
  
  if(strncmp(input, "redirect ", 9) == 0){
    eFile_RedirectToFile(input + 9);
	return 1;
  }   
  
  return 0;
  
  
  

}
Пример #6
0
static int _SH_DirectoryList(void)
{
	eFile_Directory(&printf);
	return 0;
}