⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fat32.lst

📁 atmel at89c51snd1c mp3芯片方案源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 735   5              }
 736   4            }
 737   3            else
 738   3            { /* append beginning of name to ease scrolling display */
 739   4              lfn_name[i++] = ' ';
 740   4              lfn_name[i++] = ' ';
 741   4              lfn_name[i++] = lfn_name[0];
 742   4              lfn_name[i++] = lfn_name[1];
 743   4              lfn_name[i++] = lfn_name[2];
 744   4              lfn_name[i++] = lfn_name[3];
 745   4              lfn_name[i++] = lfn_name[4];
 746   4              lfn_name[i++] = lfn_name[5];
 747   4              lfn_name[i++] = lfn_name[6];
 748   4              lfn_name[i++] = lfn_name[7];
 749   4              lfn_name[i++] = lfn_name[8];
 750   4              lfn_name[i++] = lfn_name[9];
 751   4              lfn_name[i++] = lfn_name[10];
 752   4              lfn_name[i++] = lfn_name[11];
 753   4              lfn_name[i++] = lfn_name[12];
 754   4            }
 755   3            lfn_name[i] = '\0';        /* end of name */      
 756   3          }
 757   2          else
 758   2          {
 759   3            /* true DOS 8.3 entry format */
 760   3            for (i = 0; i < 8; i++)
 761   3            {
 762   4              lfn_name[i] = gl_buffer[i];
 763   4              
 764   4              if (lfn_name[i] == ' ')
 765   4              { /* space is end of name */
 766   5                break;
 767   5              }
 768   4            }
 769   3            if ((gl_buffer[8] == ' ') &&
 770   3                (gl_buffer[9] == ' ') &&
 771   3                (gl_buffer[10] == ' '))
 772   3              lfn_name[i++] = ' ';
 773   3            else
 774   3              lfn_name[i++] = '.';                                  /* append extension */
 775   3            lfn_name[i++] = gl_buffer[8];
 776   3            lfn_name[i++] = gl_buffer[9];
 777   3            lfn_name[i++] = gl_buffer[10];
 778   3        
 779   3            for (; i != 14; i++)
 780   3            {
 781   4              lfn_name[i] = ' ';                                  /* append spaces for display reason */
 782   4            }
 783   3            lfn_name[i] = '\0';                                   /* end of string */
 784   3          } 
 785   2          fat_cache.current.attributes = gl_buffer[11];       /* filter on the file type */
 786   2          
 787   2          ext[0]= gl_buffer[8];                                   /* store extension */
 788   2          ext[1]= gl_buffer[9];
 789   2          ext[2]= gl_buffer[10];
 790   2      
 791   2          fat_current_end_entry_position++;
 792   2          if ((fat32_check_ext() & current_ext) == FILE_XXX)
C51 COMPILER V7.50   FAT32                                                                 11/27/2007 20:46:00 PAGE 14  

 793   2          {
 794   3            fat_dir_current_offs += ((fat_current_end_entry_position - fat_current_start_entry_position) << 5); 
             - 
 795   3          }
 796   2        }
 797   1        while ((fat32_check_ext() & current_ext) == FILE_XXX);
 798   1      
 799   1      
 800   1        entry->start_cluster  = gl_buffer[26];                    /* starting cluster value */
 801   1        entry->start_cluster += ((Uint32) gl_buffer[27]) << 8;
 802   1        entry->start_cluster += ((Uint32) gl_buffer[20]) << 16;
 803   1        entry->start_cluster += ((Uint32) gl_buffer[21]) << 24;
 804   1        entry->size.b[3]      = gl_buffer[28];                    /* file size value        */
 805   1        entry->size.b[2]      = gl_buffer[29];
 806   1        entry->size.b[1]      = gl_buffer[30];
 807   1        entry->size.b[0]      = gl_buffer[31];
 808   1        Hard_read_close();                                        /* close physical read */
 809   1      
 810   1      }
 811          
 812          
 813          /*F**************************************************************************
 814          * NAME: fat_get_root_directory
 815          *----------------------------------------------------------------------------
 816          * PARAMS:
 817          *   id: file extension to select
 818          *
 819          * return:
 820          *   - OK: file available
 821          *   - KO: no requested file found
 822          *   - KO: low_level memory error
 823          *----------------------------------------------------------------------------
 824          * PURPOSE:
 825          *   Select first available file/dir in root diretory
 826          *----------------------------------------------------------------------------
 827          * EXAMPLE:
 828          *----------------------------------------------------------------------------
 829          * NOTE:
 830          *   Fill all the cache information for the first time
 831          *----------------------------------------------------------------------------
 832          * REQUIREMENTS:
 833          *****************************************************************************/
 834          bit fat32_get_root_directory (Byte id)
 835          {
 836   1        dir_is_root = TRUE;                                       /* set directory root flag */
 837   1        fat_cache.current.start_cluster = fat_rootclus_fat32 ;    /* #cluster root directory */
 838   1        fat32_get_clusters(&dclusters, MAX_DIR_FRAGMENT_NUMBER);    /* Construct root directory cluster chain */
 839   1        fat_last_dclust_index = fat_last_clust_index;             /* save last index position for chain cluster 
             -*/
 840   1      
 841   1                            
 842   1        /* computes sector address from allocation table */
 843   1        fat_dir_current_sect = (((Uint32)(dclusters[0].cluster)) * fat_cluster_size)
 844   1                             + fat_ptr_data;
 845   1      
 846   1        fat32_get_dir_file_list(id);                                /* create list of entries */
 847   1        if (fat_dir_list_last == 0)
 848   1          return KO;                                              /* no requested (id) entry */
 849   1      
 850   1        fat_dir_list_index = 1;                                   /* point on first root entry */
 851   1        fat_current_start_entry_position = 0;
 852   1        fat_current_end_entry_position = 0;
C51 COMPILER V7.50   FAT32                                                                 11/27/2007 20:46:00 PAGE 15  

 853   1        fat32_fetch_file_info(&fat_cache.current, FETCH_NEXT);
 854   1        fat_cache.parent.start_cluster = fat_rootclus_fat32;    /* parent dir is also root */   
 855   1        fat_cache.parent.attributes = ATTR_DIRECTORY;           /* mark as directory */
 856   1        return OK;
 857   1      }
 858          
 859          
 860          /*F**************************************************************************
 861          * NAME: fat_goto_next
 862          *----------------------------------------------------------------------------
 863          * PARAMS:
 864          *
 865          * return:
 866          *   - OK: next file available
 867          *   - KO: last file reached
 868          *   - KO: low_level memory error
 869          *----------------------------------------------------------------------------
 870          * PURPOSE:
 871          *   Fetch the next dir/file info in cache
 872          *----------------------------------------------------------------------------
 873          * EXAMPLE:
 874          *----------------------------------------------------------------------------
 875          * NOTE:
 876          *----------------------------------------------------------------------------
 877          * REQUIREMENTS:
 878          *****************************************************************************/ 
 879          bit fat32_goto_next (void)
 880          {
 881   1        if (fat_dir_list_index < fat_dir_list_last)
 882   1        {
 883   2          fat_dir_list_index++;
 884   2          fat32_fetch_file_info(&fat_cache.current, FETCH_NEXT);
 885   2          return OK;
 886   2        }
 887   1        else
 888   1          return KO;                              /* already on last file */
 889   1      }
 890          
 891          
 892          /*F**************************************************************************
 893          * NAME: fat_goto_prev
 894          *----------------------------------------------------------------------------
 895          * PARAMS:
 896          *
 897          * return:
 898          *   - OK: previous file available
 899          *   - KO: first file reached
 900          *   - KO: low_level memory error
 901          *----------------------------------------------------------------------------
 902          * PURPOSE:
 903          *   Fetch the previous directory info in cache
 904          *----------------------------------------------------------------------------
 905          * EXAMPLE:
 906          *----------------------------------------------------------------------------
 907          * NOTE:
 908          *----------------------------------------------------------------------------
 909          * REQUIREMENTS:
 910          *****************************************************************************/ 
 911          bit fat32_goto_prev (void)
 912          {
 913   1      Byte min;
 914   1        
C51 COMPILER V7.50   FAT32                                                                 11/27/2007 20:46:00 PAGE 16  

 915   1        if (dir_is_root)
 916   1          min = 1;
 917   1        else
 918   1          min = 3;
 919   1      
 920   1        if (fat_dir_list_index != min)            /* first file of the directory? */
 921   1        {
 922   2          fat_dir_list_index--;
 923   2          fat32_fetch_file_info(&fat_cache.current, FETCH_PREV);
 924   2          return OK;
 925   2        }
 926   1        else
 927   1          return KO;                              /* already on first file */
 928   1      }
 929          
 930          /*F**************************************************************************
 931          * NAME: fat_seek_last
 932          *----------------------------------------------------------------------------
 933          * PARAMS:
 934          *
 935          * return:
 936          *   OK: last file available
 937          *   KO: low level error
 938          *----------------------------------------------------------------------------
 939          * PURPOSE:
 940          *   Fetch the last directory info in cache
 941          *----------------------------------------------------------------------------
 942          * EXAMPLE:
 943          *----------------------------------------------------------------------------
 944          * NOTE:
 945          *----------------------------------------------------------------------------
 946          * REQUIREMENTS:
 947          *****************************************************************************/ 
 948          bit fat32_seek_last (void)
 949          {
 950   1      bit result;
 951   1        do
 952   1        {
 953   2          result = fat32_goto_next();
 954   2        }
 955   1        while (result == OK);
 956   1        return result;
 957   1      }
 958          
 959          /*F**************************************************************************
 960          * NAME: fat_seek_entry_record
 961          *----------------------------------------------------------------------------
 962          * PARAMS:
 963          *   fat_dir_list_index : # of the fetched entry
 964          *   
 965          * return:
 966          *   OK: file available
 967          *   KO: low level error
 968          *----------------------------------------------------------------------------
 969          * PURPOSE:
 970          *   Fetch the selected entry
 971          *----------------------------------------------------------------------------
 972          * EXAMPLE:
 973          *----------------------------------------------------------------------------
 974          * NOTE:
 975          *----------------------------------------------------------------------------
 976          * REQUIREMENTS:
C51 COMPILER V7.50   FAT32                                                                 11/27/2007 20:46:00 PAGE 17  

 977          *****************************************************************************/ 
 978          bit fat32_seek_entry_record (void)
 979          {
 980   1      bit result;
 981   1      Uint16 temp;
 982   1      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -