Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 362 → Rev 363

/trunk/fat16.c
716,8 → 716,7
if(SD_SUCCESS != SDC_PutSector(file->SectorInCache, file->Cache))
{
Fat16_Deinit();
retvalue = 0;
return(retvalue);
return(0);
}
}
return(retvalue);
756,7 → 755,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache)) // read sector from sd-card
{
Fat16_Deinit();
return (cluster);
return (CLUSTER_UNDEFINED);
}
}
// read the next cluster from cache
805,7 → 804,7
if( SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache)) // read sector of fat from sd-card.
{
Fat16_Deinit();
return(free_cluster);
return(CLUSTER_UNDEFINED);
}
 
fat = (Fat16Entry_t *)file->Cache; // set fat pointer to file cache
818,7 → 817,7
if(SD_SUCCESS != SDC_PutSector(file->SectorInCache, file->Cache)) // and save the sector at the sd-card.
{
Fat16_Deinit();
return(free_cluster);
return(CLUSTER_UNDEFINED);
}
free_cluster = (u16)(fat_sector * FAT16_ENTRIES_PER_SECTOR + (u32)fat_entry);
fat_entry = FAT16_ENTRIES_PER_SECTOR; // terminate the search for a free cluster in this sector.
1095,7 → 1094,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache))// read in the sector.
{
Fat16_Deinit();
return(direntry_exist);
return(0);
}
dir = (DirEntry_t *)file->Cache; // set pointer to directory
switch((u8)dir[file->DirectoryIndex].Name[0]) // check if current directory exist
1131,7 → 1130,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache))// read the sector
{
Fat16_Deinit();
return(direntry_exist);
return(0);
}
dir = (DirEntry_t *)file->Cache; // set pointer to directory
// search all directory entries within that sector
1228,7 → 1227,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache))// read in the sector.
{
Fat16_Deinit();
return(retvalue);
return(0);
}
dir = (DirEntry_t *)file->Cache; // set pointer to directory
switch((u8)dir[file->DirectoryIndex].Name[0]) // check if current directory exist
1270,7 → 1269,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache))// read in the sector.
{
Fat16_Deinit();
return(retvalue);
return(0);
}
 
dir = (DirEntry_t *)file->Cache; // set pointer to directory
1296,7 → 1295,7
if(SD_SUCCESS != SDC_PutSector(file->SectorInCache, file->Cache)) // write back to card
{
Fat16_Deinit();
return(retvalue);
return(0);
}
file->FirstSectorOfFirstCluster = Fat16ClusterToSector(subdircluster); // Calculate absolute sectorposition of first datacluster.
file->FirstSectorOfCurrCluster = file->FirstSectorOfFirstCluster; // Start reading the file with the first sector of the first datacluster.
1314,7 → 1313,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache))// read in the sector.
{
Fat16_Deinit();
return(retvalue);
return(0);
}
dir = (DirEntry_t *)file->Cache;
// create direntry "." to current dir
1333,7 → 1332,7
if(SD_SUCCESS != SDC_PutSector(file->SectorInCache, file->Cache))// read in the sector.
{
Fat16_Deinit();
return(retvalue);
return(0);
}
}
retvalue = 1;
1722,7 → 1721,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache,file->Cache))
{
Fat16_Deinit();
return(c);
return(EOF);
}
}
c = (s16) file->Cache[file->ByteOfCurrSector];
2053,7 → 2052,7
if(SD_SUCCESS != SDC_GetSector(file->SectorInCache, file->Cache))// read the sector
{
Fat16_Deinit();
return(pVolumeLabel);
return(NULL);
}
dir = (DirEntry_t *)file->Cache; // set pointer to directory
// search all directory entries within that sector
2141,7 → 2140,12
 
do
{ // search the next 16 rootentries in this sector of the roordirectory.
SDC_GetSector(((u32) file.FirstSectorOfCurrCluster + (u32)file.SectorOfCurrCluster), file.Cache); // Read the Rootdirectory.
if(SD_SUCCESS != SDC_GetSector(((u32) file.FirstSectorOfCurrCluster + (u32)file.SectorOfCurrCluster), file.Cache)); // Read the Rootdirectory.
{
Fat16_Deinit();
return(0);
}
DirectoryEntry = (DirEntry_t *)file.Cache;
 
while((!retvalue)&&(index<16) && (SD_WatchDog))