Changeset 358 for soft


Ignore:
Timestamp:
Jul 19, 2014, 5:04:57 PM (10 years ago)
Author:
alain
Message:

Improve debug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_fat32/fat32.c

    r354 r358  
    790790
    791791#if GIET_DEBUG_FAT
    792 _printf("\n[FAT DEBUG] enter _scan_directory() searching dir/file %s", file_name );
     792_printf("\n[FAT DEBUG] enter _scan_directory() for dir/file %s\n", file_name );
    793793#endif
    794794
     
    822822
    823823    fat.cache_lba = lba;
     824
     825#if ( GIET_DEBUG_FAT > 1 )
     826display_fat_cache();
     827#endif
    824828
    825829    // in this loop we scan all names in directory identified by cluster:
     
    10711075    fat.last_cluster_allocated = read_entry( FS_FREE_CLUSTER_HINT, fat.fat_cache, 1);
    10721076
    1073 #if GIET_DEBUG_FAT
    1074 _printf("\n[FAT DEBUG] Processor[%d,%d,%d] exit _fat_init() / "
    1075         "free clusters = %x / last allocated cluster = %x\n",
    1076         x, y, lpid, fat.number_free_cluster, fat.last_cluster_allocated );
     1077
     1078#if GIET_DEBUG_FAT
     1079_printf("\n[FAT DEBUG] Processor[%d,%d,%d] initialises FAT descriptor\n", x, y, lpid );
     1080_fat_print();
     1081_printf("\n[FAT DEBUG] Processor[%d,%d,%d] exit _fat_init()\n", x, y, lpid );
    10771082#endif
    10781083
     
    10831088void _fat_print()
    10841089{
    1085     _printf("\n########################## FAT32 ###########################"); 
    1086     _printf("\nFAT initialised                %x", fat.initialised );
    1087     _printf("\nSector Size  (bytes)           %x", fat.sector_size );
    1088     _printf("\nSectors per cluster            %x", fat.sectors_per_cluster );
    1089     _printf("\nFAT region first lba           %x", fat.fat_lba );
    1090     _printf("\nData region first lba          %x", fat.data_lba );
    1091     _printf("\nNumber of sectors for one FAT  %x", fat.fat_sectors );
    1092     _printf("\n############################################################\n");
     1090    _printf("\n########################## FAT32 ################################"); 
     1091    _printf("\nFAT initialised                  %x", fat.initialised );
     1092    _printf("\nSector Size  (bytes)             %x", fat.sector_size );
     1093    _printf("\nSectors per cluster              %x", fat.sectors_per_cluster );
     1094    _printf("\nFAT region first lba             %x", fat.fat_lba );
     1095    _printf("\nData region first lba            %x", fat.data_lba );
     1096    _printf("\nNumber of sectors for one FAT    %x", fat.fat_sectors );
     1097    _printf("\nNumber of free clusters          %x", fat.number_free_cluster );
     1098    _printf("\nLast last allocated cluster      %x", fat.last_cluster_allocated );
     1099    _printf("\n#################################################################\n");
    10931100}
    10941101
     
    11501157        {
    11511158            _printf("[FAT ERROR] in _fat_open() : Cannot initialize FAT descriptor\n");
    1152 
    1153             // release FAT lock
    11541159            _release_lock( &fat.fat_lock );
    1155 
    11561160            return -1;
    11571161        }
    1158 
    1159 #if GIET_DEBUG_FAT
    1160 _printf("\n[FAT DEBUG] Processor[%d,%d,%d] initialises FAT descriptor\n",
    1161         x, y, lpid );
    1162 _fat_print();
    1163 #endif
    1164 
    11651162    }
    11661163 
     
    12831280    unsigned int sectors_to_skip;   // number of sectors to skip in first iteration
    12841281
    1285     // compute file size as a number of sectors
    1286     file_size    = fat.fd[fd_id].file_size;
    1287     if ( file_size & 0x1FF ) file_sectors = (file_size >> 9) + 1;
    1288     else                     file_sectors = (file_size >> 9);
    1289 
    12901282    // arguments checking
    12911283    if ( fd_id >= GIET_OPEN_FILES_MAX )
     
    13041296        return -1;
    13051297    }
     1298
     1299    // compute file size as a number of sectors
     1300    file_size    = fat.fd[fd_id].file_size;
     1301    if ( file_size & 0x1FF ) file_sectors = (file_size >> 9) + 1;
     1302    else                     file_sectors = (file_size >> 9);
     1303
    13061304    if ( offset >= file_sectors )
    13071305    {
     
    13591357    else                                          iter_sectors = spc - sectors_to_skip;
    13601358
    1361     // loop on the clusters
     1359    // loop on the clusters: one IOC access per cluster
    13621360    while ( todo_sectors > 0 )
    13631361    {
    13641362
    13651363#if GIET_DEBUG_FAT
    1366 _printf("\n[FAT DEBUG] Processor[%d,%d,%d] makes an IOC read :"
    1367         " buf = %x / lba = %x / sectors = %d\n",
    1368         x, y, lpid, (unsigned int)dst, lba, iter_sectors );
     1364_printf("\n[FAT DEBUG] Processor[%d,%d,%d] makes an IOC read "
     1365        " for cluster %x : buf = %x / lba = %x / sectors = %d\n",
     1366        x, y, lpid, cluster, (unsigned int)dst, lba, iter_sectors );
    13691367#endif
    13701368
Note: See TracChangeset for help on using the changeset viewer.