<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16">
  <compounddef id="fat__access_8c" kind="file" language="C++">
    <compoundname>fat_access.c</compoundname>
    <includes refid="string_8h" local="no">string.h</includes>
    <includes refid="fat__defs_8h" local="yes">fat_defs.h</includes>
    <includes refid="fat__access_8h" local="yes">fat_access.h</includes>
    <includes refid="fat__table_8h" local="yes">fat_table.h</includes>
    <includes refid="fat__write_8h" local="yes">fat_write.h</includes>
    <includes refid="fat__string_8h" local="yes">fat_string.h</includes>
    <includes refid="fat__misc_8h" local="yes">fat_misc.h</includes>
    <incdepgraph>
      <node id="10">
        <label>strings.h</label>
        <link refid="strings_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>fat/fat.h</label>
        <link refid="fat_8h"/>
      </node>
      <node id="9">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="17">
        <label>fat_table.h</label>
        <link refid="fat__table_8h"/>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="15">
        <label>fat_types.h</label>
        <link refid="fat__types_8h"/>
      </node>
      <node id="2">
        <label>string.h</label>
        <link refid="string_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>fat_defs.h</label>
        <link refid="fat__defs_8h"/>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
        <childnode refid="5" relation="include">
        </childnode>
      </node>
      <node id="6">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="4">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="20">
        <label>fat_string.h</label>
        <link refid="fat__string_8h"/>
      </node>
      <node id="7">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="14">
        <label>stdio.h</label>
      </node>
      <node id="8">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c</label>
        <link refid="fat__access_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>fat_access.h</label>
        <link refid="fat__access_8h"/>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
      </node>
      <node id="19">
        <label>fat_write.h</label>
        <link refid="fat__write_8h"/>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
      </node>
      <node id="18">
        <label>fat_misc.h</label>
        <link refid="fat__misc_8h"/>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>fat_opts.h</label>
        <link refid="fat__opts_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
    </incdepgraph>
      <sectiondef kind="func">
      <memberdef kind="function" id="fat__access_8c_1a0585d01a38409645830c9e7f57a4bf1b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
        <definition>uint32 fatfs_get_file_entry</definition>
        <argsstring>(struct fatfs *fs, uint32 Cluster, char *name_to_find, struct fat_dir_entry *sfEntry)</argsstring>
        <name>fatfs_get_file_entry</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>Cluster</declname>
        </param>
        <param>
          <type>char *</type>
          <declname>name_to_find</declname>
        </param>
        <param>
          <type>struct <ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref> *</type>
          <declname>sfEntry</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="380" column="8" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="380" bodyend="472"/>
        <references refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" compoundref="fat__access_8h" startline="19">FAT_DIR_ENTRIES_PER_SECTOR</references>
        <references refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" compoundref="fat__defs_8h" startline="67">FAT_DIR_ENTRY_SIZE</references>
        <references refid="fat__string_8c_1a88289160199a24ccb76d819a07c47921" compoundref="fat__string_8c" startline="260" endline="319">fatfs_compare_names</references>
        <references refid="fat__misc_8c_1a27351ac7857382bf893d7e5a74cf5710" compoundref="fat__misc_8c" startline="132" endline="137">fatfs_entry_lfn_exists</references>
        <references refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" compoundref="fat__misc_8c" startline="121" endline="126">fatfs_entry_lfn_invalid</references>
        <references refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" compoundref="fat__misc_8c" startline="110" endline="115">fatfs_entry_lfn_text</references>
        <references refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" compoundref="fat__misc_8c" startline="142" endline="147">fatfs_entry_sfn_only</references>
        <references refid="fat__misc_8c_1a37178e1cd0b3c962e4c41bd4e350c712" compoundref="fat__misc_8c" startline="56" endline="88">fatfs_lfn_cache_entry</references>
        <references refid="fat__misc_8c_1a30fee82472e2faf585b0a84068abc672" compoundref="fat__misc_8c" startline="94" endline="104">fatfs_lfn_cache_get</references>
        <references refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" compoundref="fat__misc_8c" startline="38" endline="50">fatfs_lfn_cache_init</references>
        <references refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" compoundref="fat__access_8c" startline="213" endline="258">fatfs_sector_reader</references>
        <references refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c">memcpy</references>
        <references refid="string_8h_1ace4b911463887af5e748326323e99a23">memset</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a6d36c74c7a9ba228d327067786ecb0c2" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
        <definition>uint32 fatfs_get_root_cluster</definition>
        <argsstring>(struct fatfs *fs)</argsstring>
        <name>fatfs_get_root_cluster</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="373" column="8" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="373" bodyend="376"/>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a79896ebc01463ec2121874995ea7d922" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_init</definition>
        <argsstring>(struct fatfs *fs)</argsstring>
        <name>fatfs_init</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="43" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="43" bodyend="186"/>
        <references refid="fat__defs_8h_1a64f6214c3cd6ea996aa49c66ef704440" compoundref="fat__defs_8h" startline="16">BPB_BYTSPERSEC</references>
        <references refid="fat__defs_8h_1a2f7e14590bc89d5c273e4945b1378ee8" compoundref="fat__defs_8h" startline="37">BPB_FAT32_FATSZ32</references>
        <references refid="fat__defs_8h_1a6b66c1d291ef97e70fbe5f1f36fda793" compoundref="fat__defs_8h" startline="41">BPB_FAT32_FSINFO</references>
        <references refid="fat__defs_8h_1ac22b455a3ed7ca414efe28f0da310f7a" compoundref="fat__defs_8h" startline="40">BPB_FAT32_ROOTCLUS</references>
        <references refid="fat__defs_8h_1a495df1c692e51d1590dbe5d5b0f5dbb3" compoundref="fat__defs_8h" startline="23">BPB_FATSZ16</references>
        <references refid="fat__defs_8h_1a530b676e7e69bbc5038bd4b3cb499331" compoundref="fat__defs_8h" startline="19">BPB_NUMFATS</references>
        <references refid="fat__defs_8h_1a788e987621983dd44b5f7e22b17577bb" compoundref="fat__defs_8h" startline="20">BPB_ROOTENTCNT</references>
        <references refid="fat__defs_8h_1ab42c8f7a0994062257044882b2ff4313" compoundref="fat__defs_8h" startline="18">BPB_RSVDSECCNT</references>
        <references refid="fat__defs_8h_1a23d5a5317bb9b8c2c299d37d3fae1207" compoundref="fat__defs_8h" startline="17">BPB_SECPERCLUS</references>
        <references refid="fat__defs_8h_1a54c5035f6b96c9e4d5b0844f30de59e2" compoundref="fat__defs_8h" startline="21">BPB_TOTSEC16</references>
        <references refid="fat__defs_8h_1a48e78c7d6a5b5afa2dc41541dd31ee2c" compoundref="fat__defs_8h" startline="27">BPB_TOTSEC32</references>
        <references refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" compoundref="fat__defs_8h" startline="109">FAT32_INVALID_CLUSTER</references>
        <references refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" compoundref="fat__defs_8h" startline="67">FAT_DIR_ENTRY_SIZE</references>
        <references refid="fat__access_8h_1a103f88475b041e05731cc90432456bad" compoundref="fat__access_8h" startline="14">FAT_INIT_ENDIAN_ERROR</references>
        <references refid="fat__access_8h_1a841405f1315c0f5ebdf68b42794878bb" compoundref="fat__access_8h" startline="12">FAT_INIT_INVALID_SECTOR_SIZE</references>
        <references refid="fat__access_8h_1a1cc1a9d192efb390bbad20c87e9150fe" compoundref="fat__access_8h" startline="13">FAT_INIT_INVALID_SIGNATURE</references>
        <references refid="fat__access_8h_1a2ffc1cf01469bc98451356bac154af38" compoundref="fat__access_8h" startline="11">FAT_INIT_MEDIA_ACCESS_ERROR</references>
        <references refid="fat__access_8h_1ae6aa6129ce17d5e7286e043c850e23c2" compoundref="fat__access_8h" startline="10">FAT_INIT_OK</references>
        <references refid="fat__access_8h_1afdc968293058f0c497f5929f863f5d10" compoundref="fat__access_8h" startline="17">FAT_INIT_STRUCT_PACKING</references>
        <references refid="fat__access_8h_1af12f4a6f5430715270eb4e677cc6ec41" compoundref="fat__access_8h" startline="15">FAT_INIT_WRONG_FILESYS_TYPE</references>
        <references refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" compoundref="fat__opts_8h" startline="70">FAT_SECTOR_SIZE</references>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13baf87a06e051a75de30afdcb374f70ec58" compoundref="fat__access_8h" startline="54">FAT_TYPE_32</references>
        <references refid="fat__table_8c_1acee4d83639e6fa1a228aec05618140e6" compoundref="fat__table_8c" startline="60" endline="79">fatfs_fat_init</references>
        <references refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" compoundref="fat__misc_8h" startline="17">GET_16BIT_WORD</references>
        <references refid="fat__misc_8h_1a857557cc9a2fc6a7f721a2960dcc6f33" compoundref="fat__misc_8h" startline="16">GET_32BIT_WORD</references>
        <references refid="fat__defs_8h_1a3fe9dae3b04bdb4bfacd8a49aec4823d" compoundref="fat__defs_8h" startline="64">PARTITION1_LBA_BEGIN_LOCATION</references>
        <references refid="fat__defs_8h_1a812cfec2f2979480abd1b320d1762498" compoundref="fat__defs_8h" startline="61">PARTITION1_TYPECODE_LOCATION</references>
        <references refid="fat__defs_8h_1aa2e01dc9f319fbe7ce7ae6467aa27e76" compoundref="fat__defs_8h" startline="59">SIGNATURE_POSITION</references>
        <references refid="fat__defs_8h_1a0a6c76f061940b33990aff8b968805b8" compoundref="fat__defs_8h" startline="60">SIGNATURE_VALUE</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
        <definition>uint32 fatfs_lba_of_cluster</definition>
        <argsstring>(struct fatfs *fs, uint32 Cluster_Number)</argsstring>
        <name>fatfs_lba_of_cluster</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>Cluster_Number</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="191" column="8" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="191" bodyend="196"/>
        <references refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" compoundref="fat__opts_8h" startline="70">FAT_SECTOR_SIZE</references>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <referencedby refid="fat__access_8h_1a588054b2e9acc4cfd00dcd7b83627828" compoundref="fat__access_8c" startline="263" endline="305">fatfs_read_sector</referencedby>
        <referencedby refid="fat__access_8h_1aaa34effab2043ace65e92d060a0e74c5" compoundref="fat__access_8c" startline="213" endline="258">fatfs_sector_reader</referencedby>
        <referencedby refid="fat__access_8h_1aba0dfdb700ff90e17883a8fea582f491" compoundref="fat__access_8c" startline="311" endline="357">fatfs_write_sector</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a256495a47634d609602fc487830aba5c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_list_directory_next</definition>
        <argsstring>(struct fatfs *fs, struct fs_dir_list_status *dirls, struct fs_dir_ent *entry)</argsstring>
        <name>fatfs_list_directory_next</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type>struct <ref refid="structfs__dir__list__status" kindref="compound">fs_dir_list_status</ref> *</type>
          <declname>dirls</declname>
        </param>
        <param>
          <type>struct <ref refid="structfs__dir__ent" kindref="compound">fs_dir_ent</ref> *</type>
          <declname>entry</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="719" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="719" bodyend="846"/>
        <references refid="structfs__dir__list__status_1acffc0e07120b8ffa7ae56ecf5723554c" compoundref="fat__access_8h" startline="93">fs_dir_list_status::cluster</references>
        <references refid="structfs__dir__ent_1a6286cbb9d382cacf4e15b03ffd0c352c" compoundref="fat__access_8h" startline="101">fs_dir_ent::cluster</references>
        <references refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" compoundref="fat__access_8h" startline="19">FAT_DIR_ENTRIES_PER_SECTOR</references>
        <references refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" compoundref="fat__defs_8h" startline="67">FAT_DIR_ENTRY_SIZE</references>
        <references refid="fat__types_8h_1a79f47acd161cf6d4943a43745c179a6e" compoundref="fat__types_8h" startline="46">FAT_HTONL</references>
        <references refid="fat__types_8h_1abbb9c5db3bb96b1398c9b011870c335b" compoundref="fat__types_8h" startline="45">FAT_HTONS</references>
        <references refid="fat__misc_8c_1adca70c7e5b6a384a99baf9e1ecb9d1a8" compoundref="fat__misc_8c" startline="152" endline="157">fatfs_entry_is_dir</references>
        <references refid="fat__misc_8c_1a27351ac7857382bf893d7e5a74cf5710" compoundref="fat__misc_8c" startline="132" endline="137">fatfs_entry_lfn_exists</references>
        <references refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" compoundref="fat__misc_8c" startline="121" endline="126">fatfs_entry_lfn_invalid</references>
        <references refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" compoundref="fat__misc_8c" startline="110" endline="115">fatfs_entry_lfn_text</references>
        <references refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" compoundref="fat__misc_8c" startline="142" endline="147">fatfs_entry_sfn_only</references>
        <references refid="fat__string_8c_1a591f207df5e2aa9fe091df89b0c0f3f8" compoundref="fat__string_8c" startline="345" endline="364">fatfs_get_sfn_display_name</references>
        <references refid="fat__misc_8c_1a37178e1cd0b3c962e4c41bd4e350c712" compoundref="fat__misc_8c" startline="56" endline="88">fatfs_lfn_cache_entry</references>
        <references refid="fat__misc_8c_1a30fee82472e2faf585b0a84068abc672" compoundref="fat__misc_8c" startline="94" endline="104">fatfs_lfn_cache_get</references>
        <references refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" compoundref="fat__misc_8c" startline="38" endline="50">fatfs_lfn_cache_init</references>
        <references refid="fat__opts_8h_1a0512aa1c7fba93172e1ff275e5046dd4" compoundref="fat__opts_8h" startline="19">FATFS_MAX_LONG_FILENAME</references>
        <references refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" compoundref="fat__access_8c" startline="213" endline="258">fatfs_sector_reader</references>
        <references refid="structfs__dir__ent_1a9c50317e9dbf71b2ae46de67f1aabec3" compoundref="fat__access_8h" startline="99">fs_dir_ent::filename</references>
        <references refid="structfs__dir__ent_1a75040e64d85a88d848982ac263f8d7dd" compoundref="fat__access_8h" startline="100">fs_dir_ent::is_dir</references>
        <references refid="string_8h_1ace4b911463887af5e748326323e99a23">memset</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structfs__dir__list__status_1a79e4d964afc1d3bdfcf7e9d2626b62bd" compoundref="fat__access_8h" startline="94">fs_dir_list_status::offset</references>
        <references refid="structfs__dir__list__status_1aecc41c4832bec5e4d6af1a2b16b04ac4" compoundref="fat__access_8h" startline="92">fs_dir_list_status::sector</references>
        <references refid="structfs__dir__ent_1a5bd24ee8ccb96c8d105368ab92202b8f" compoundref="fat__access_8h" startline="102">fs_dir_ent::size</references>
        <references refid="string_8h_1a3a2a3fddad0b7aa0ddb8fcd7509b9e27">strncpy</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a4873df5d542fddb4a1d3b2884b56525e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void fatfs_list_directory_start</definition>
        <argsstring>(struct fatfs *fs, struct fs_dir_list_status *dirls, uint32 StartCluster)</argsstring>
        <name>fatfs_list_directory_start</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type>struct <ref refid="structfs__dir__list__status" kindref="compound">fs_dir_list_status</ref> *</type>
          <declname>dirls</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>StartCluster</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="708" column="6" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="708" bodyend="712"/>
        <references refid="structfs__dir__list__status_1acffc0e07120b8ffa7ae56ecf5723554c" compoundref="fat__access_8h" startline="93">fs_dir_list_status::cluster</references>
        <references refid="structfs__dir__list__status_1a79e4d964afc1d3bdfcf7e9d2626b62bd" compoundref="fat__access_8h" startline="94">fs_dir_list_status::offset</references>
        <references refid="structfs__dir__list__status_1aecc41c4832bec5e4d6af1a2b16b04ac4" compoundref="fat__access_8h" startline="92">fs_dir_list_status::sector</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a7333a9802b496ce05ca6df36c2fc6009" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_mark_file_deleted</definition>
        <argsstring>(struct fatfs *fs, uint32 Cluster, char *shortname)</argsstring>
        <name>fatfs_mark_file_deleted</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>Cluster</declname>
        </param>
        <param>
          <type>char *</type>
          <declname>shortname</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="643" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="643" bodyend="702"/>
        <references refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" compoundref="fat__access_8h" startline="19">FAT_DIR_ENTRIES_PER_SECTOR</references>
        <references refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" compoundref="fat__defs_8h" startline="67">FAT_DIR_ENTRY_SIZE</references>
        <references refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" compoundref="fat__misc_8c" startline="121" endline="126">fatfs_entry_lfn_invalid</references>
        <references refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" compoundref="fat__misc_8c" startline="110" endline="115">fatfs_entry_lfn_text</references>
        <references refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" compoundref="fat__misc_8c" startline="142" endline="147">fatfs_entry_sfn_only</references>
        <references refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" compoundref="fat__access_8c" startline="213" endline="258">fatfs_sector_reader</references>
        <references refid="fat__access_8h_1a7c037882a907d50957d58ba53e1ef897">fatfs_update_timestamps</references>
        <references refid="fat__defs_8h_1acc2882877e3f516e53feb76ee87013d3" compoundref="fat__defs_8h" startline="83">FILE_HEADER_DELETED</references>
        <references refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c">memcpy</references>
        <references refid="lib_8h_1a6395668b53785234b479045e1773a6a4">strncmp</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a588054b2e9acc4cfd00dcd7b83627828" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_read_sector</definition>
        <argsstring>(struct fatfs *fs, uint32 cluster, uint32 sector, uint8 *target)</argsstring>
        <name>fatfs_read_sector</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>cluster</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>sector</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref> *</type>
          <declname>target</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="263" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="263" bodyend="305"/>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <references refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" compoundref="fat__access_8c" startline="191" endline="196">fatfs_lba_of_cluster</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1ac227af7896c2e9ef03e27a73c52630e6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_sector_read</definition>
        <argsstring>(struct fatfs *fs, uint32 lba, uint8 *target, uint32 count)</argsstring>
        <name>fatfs_sector_read</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>lba</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref> *</type>
          <declname>target</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>count</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="200" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="200" bodyend="202"/>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_sector_reader</definition>
        <argsstring>(struct fatfs *fs, uint32 start_cluster, uint32 offset, uint8 *target)</argsstring>
        <name>fatfs_sector_reader</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>start_cluster</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>offset</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref> *</type>
          <declname>target</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="213" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="213" bodyend="258"/>
        <references refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" compoundref="fat__defs_8h" startline="108">FAT32_LAST_CLUSTER</references>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <references refid="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" compoundref="fat__table_8c" startline="205" endline="256">fatfs_find_next_cluster</references>
        <references refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" compoundref="fat__access_8c" startline="191" endline="196">fatfs_lba_of_cluster</references>
        <referencedby refid="fat__access_8h_1a8a18a3afa5804c2c3143f671d462687d" compoundref="fat__access_8c" startline="380" endline="472">fatfs_get_file_entry</referencedby>
        <referencedby refid="fat__access_8h_1a256495a47634d609602fc487830aba5c" compoundref="fat__access_8c" startline="719" endline="846">fatfs_list_directory_next</referencedby>
        <referencedby refid="fat__access_8h_1a7333a9802b496ce05ca6df36c2fc6009" compoundref="fat__access_8c" startline="643" endline="702">fatfs_mark_file_deleted</referencedby>
        <referencedby refid="fat__access_8h_1a8bdad35bc1dd908eda5d02f47a8d73d4" compoundref="fat__access_8c" startline="478" endline="519">fatfs_sfn_exists</referencedby>
        <referencedby refid="fat__access_8h_1af94f715b4cdb59cf7854b564de855a65" compoundref="fat__access_8c" startline="578" endline="636">fatfs_update_file_length</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a04e80392b0318629a8f1b609b8204b69" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_sector_write</definition>
        <argsstring>(struct fatfs *fs, uint32 lba, uint8 *target, uint32 count)</argsstring>
        <name>fatfs_sector_write</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>lba</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref> *</type>
          <declname>target</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>count</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="206" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="206" bodyend="208"/>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a8bdad35bc1dd908eda5d02f47a8d73d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_sfn_exists</definition>
        <argsstring>(struct fatfs *fs, uint32 Cluster, char *shortname)</argsstring>
        <name>fatfs_sfn_exists</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>Cluster</declname>
        </param>
        <param>
          <type>char *</type>
          <declname>shortname</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="478" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="478" bodyend="519"/>
        <references refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" compoundref="fat__access_8h" startline="19">FAT_DIR_ENTRIES_PER_SECTOR</references>
        <references refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" compoundref="fat__defs_8h" startline="67">FAT_DIR_ENTRY_SIZE</references>
        <references refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" compoundref="fat__misc_8c" startline="121" endline="126">fatfs_entry_lfn_invalid</references>
        <references refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" compoundref="fat__misc_8c" startline="110" endline="115">fatfs_entry_lfn_text</references>
        <references refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" compoundref="fat__misc_8c" startline="142" endline="147">fatfs_entry_sfn_only</references>
        <references refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" compoundref="fat__access_8c" startline="213" endline="258">fatfs_sector_reader</references>
        <references refid="lib_8h_1a6395668b53785234b479045e1773a6a4">strncmp</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1a8b312d9fb7f328e0bf02e3c6d3725b6b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void fatfs_show_details</definition>
        <argsstring>(struct fatfs *fs)</argsstring>
        <name>fatfs_show_details</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="362" column="6" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="362" bodyend="369"/>
        <references refid="fat__opts_8h_1a77e202c52dfa1ae6a4a060b21b70a80c" compoundref="fat__opts_8h" startline="81">FAT_PRINTF</references>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13baf87a06e051a75de30afdcb374f70ec58" compoundref="fat__access_8h" startline="54">FAT_TYPE_32</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1af94f715b4cdb59cf7854b564de855a65" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_update_file_length</definition>
        <argsstring>(struct fatfs *fs, uint32 Cluster, char *shortname, uint32 fileLength)</argsstring>
        <name>fatfs_update_file_length</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>Cluster</declname>
        </param>
        <param>
          <type>char *</type>
          <declname>shortname</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>fileLength</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="578" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="578" bodyend="636"/>
        <references refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" compoundref="fat__access_8h" startline="19">FAT_DIR_ENTRIES_PER_SECTOR</references>
        <references refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" compoundref="fat__defs_8h" startline="67">FAT_DIR_ENTRY_SIZE</references>
        <references refid="fat__types_8h_1a79f47acd161cf6d4943a43745c179a6e" compoundref="fat__types_8h" startline="46">FAT_HTONL</references>
        <references refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" compoundref="fat__misc_8c" startline="121" endline="126">fatfs_entry_lfn_invalid</references>
        <references refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" compoundref="fat__misc_8c" startline="110" endline="115">fatfs_entry_lfn_text</references>
        <references refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" compoundref="fat__misc_8c" startline="142" endline="147">fatfs_entry_sfn_only</references>
        <references refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" compoundref="fat__access_8c" startline="213" endline="258">fatfs_sector_reader</references>
        <references refid="fat__access_8h_1a7c037882a907d50957d58ba53e1ef897">fatfs_update_timestamps</references>
        <references refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c">memcpy</references>
        <references refid="lib_8h_1a6395668b53785234b479045e1773a6a4">strncmp</references>
      </memberdef>
      <memberdef kind="function" id="fat__access_8c_1aba0dfdb700ff90e17883a8fea582f491" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_write_sector</definition>
        <argsstring>(struct fatfs *fs, uint32 cluster, uint32 sector, uint8 *target)</argsstring>
        <name>fatfs_write_sector</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>cluster</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>sector</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref> *</type>
          <declname>target</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" line="311" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c" bodystart="311" bodyend="357"/>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <references refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" compoundref="fat__access_8c" startline="191" endline="196">fatfs_lba_of_cluster</references>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>FAT16/32<sp/>File<sp/>IO<sp/>Library</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>V2.6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Ultra-Embedded.com</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Copyright<sp/>2003<sp/>-<sp/>2012</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Email:<sp/>admin@ultra-embedded.com</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>License:<sp/>GPL</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/>If<sp/>you<sp/>would<sp/>like<sp/>a<sp/>version<sp/>with<sp/>a<sp/>more<sp/>permissive<sp/>license<sp/>for<sp/>use<sp/>in</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="12"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/>closed<sp/>source<sp/>commercial<sp/>applications<sp/>please<sp/>contact<sp/>me<sp/>for<sp/>details.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="13"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="14"><highlight class="normal"></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="15"><highlight class="normal"></highlight><highlight class="comment">//<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>FAT<sp/>File<sp/>IO<sp/>Library.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="16"><highlight class="normal"></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight><highlight class="comment">//<sp/>FAT<sp/>File<sp/>IO<sp/>Library<sp/>is<sp/>free<sp/>software;<sp/>you<sp/>can<sp/>redistribute<sp/>it<sp/>and/or<sp/>modify</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="18"><highlight class="normal"></highlight><highlight class="comment">//<sp/>it<sp/>under<sp/>the<sp/>terms<sp/>of<sp/>the<sp/>GNU<sp/>General<sp/>Public<sp/>License<sp/>as<sp/>published<sp/>by</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight><highlight class="comment">//<sp/>the<sp/>Free<sp/>Software<sp/>Foundation;<sp/>either<sp/>version<sp/>2<sp/>of<sp/>the<sp/>License,<sp/>or</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight><highlight class="comment">//<sp/>(at<sp/>your<sp/>option)<sp/>any<sp/>later<sp/>version.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="comment">//<sp/>FAT<sp/>File<sp/>IO<sp/>Library<sp/>is<sp/>distributed<sp/>in<sp/>the<sp/>hope<sp/>that<sp/>it<sp/>will<sp/>be<sp/>useful,</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight><highlight class="comment">//<sp/>but<sp/>WITHOUT<sp/>ANY<sp/>WARRANTY;<sp/>without<sp/>even<sp/>the<sp/>implied<sp/>warranty<sp/>of</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight><highlight class="comment">//<sp/>MERCHANTABILITY<sp/>or<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE.<sp/><sp/>See<sp/>the</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="comment">//<sp/>GNU<sp/>General<sp/>Public<sp/>License<sp/>for<sp/>more<sp/>details.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight><highlight class="comment">//<sp/>You<sp/>should<sp/>have<sp/>received<sp/>a<sp/>copy<sp/>of<sp/>the<sp/>GNU<sp/>General<sp/>Public<sp/>License</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight><highlight class="comment">//<sp/>along<sp/>with<sp/>FAT<sp/>File<sp/>IO<sp/>Library;<sp/>if<sp/>not,<sp/>write<sp/>to<sp/>the<sp/>Free<sp/>Software</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Foundation,<sp/>Inc.,<sp/>59<sp/>Temple<sp/>Place,<sp/>Suite<sp/>330,<sp/>Boston,<sp/>MA<sp/><sp/>02111-1307<sp/><sp/>USA</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="string_8h" kindref="compound">string.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="fat__defs_8h" kindref="compound">fat_defs.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="fat__access_8h" kindref="compound">fat_access.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="fat__table_8h" kindref="compound">fat_table.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="fat__write_8h" kindref="compound">fat_write.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="37"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="fat__string_8h" kindref="compound">fat_string.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="fat__misc_8h" kindref="compound">fat_misc.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_init:<sp/>Load<sp/>FAT<sp/>Parameters</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43" refid="fat__access_8h_1a79896ebc01463ec2121874995ea7d922" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a79896ebc01463ec2121874995ea7d922" kindref="member">fatfs_init</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>)<sp/>{</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>num_of_fats;</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>reserved_sectors;</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>FATSz;</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>root_dir_sectors;</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>total_sectors;</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>data_sectors;</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>count_of_clusters;</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>valid_partition<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="52"><highlight class="normal"></highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address<sp/>=<sp/><ref refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" kindref="member">FAT32_INVALID_CLUSTER</ref>;</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.dirty<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;next_free_cluster<sp/>=<sp/>0;<sp/></highlight><highlight class="comment">//<sp/>Invalid</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/><ref refid="fat__table_8c_1acee4d83639e6fa1a228aec05618140e6" kindref="member">fatfs_fat_init</ref>(<ref refid="structfs" kindref="compound">fs</ref>);</highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Make<sp/>sure<sp/>we<sp/>have<sp/>a<sp/>read<sp/>function<sp/>(write<sp/>function<sp/>is<sp/>optional)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media)</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a2ffc1cf01469bc98451356bac154af38" kindref="member">FAT_INIT_MEDIA_ACCESS_ERROR</ref>;</highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>MBR:<sp/>Sector<sp/>0<sp/>on<sp/>the<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>NOTE:<sp/>Some<sp/>removeable<sp/>media<sp/>does<sp/>not<sp/>have<sp/>this.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Load<sp/>MBR<sp/>(LBA<sp/>0)<sp/>into<sp/>the<sp/>512<sp/>byte<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(0,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1))</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a2ffc1cf01469bc98451356bac154af38" kindref="member">FAT_INIT_MEDIA_ACCESS_ERROR</ref>;</highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Make<sp/>Sure<sp/>0x55<sp/>and<sp/>0xAA<sp/>are<sp/>at<sp/>end<sp/>of<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>(this<sp/>should<sp/>be<sp/>the<sp/>case<sp/>regardless<sp/>of<sp/>the<sp/>MBR<sp/>or<sp/>boot<sp/>sector)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[<ref refid="fat__defs_8h_1aa2e01dc9f319fbe7ce7ae6467aa27e76" kindref="member">SIGNATURE_POSITION</ref>]<sp/>!=<sp/>0x55<sp/>||<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[<ref refid="fat__defs_8h_1aa2e01dc9f319fbe7ce7ae6467aa27e76" kindref="member">SIGNATURE_POSITION</ref><sp/>+<sp/>1]<sp/>!=<sp/>0xAA)</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a1cc1a9d192efb390bbad20c87e9150fe" kindref="member">FAT_INIT_INVALID_SIGNATURE</ref>;</highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Now<sp/>check<sp/>again<sp/>using<sp/>the<sp/>access<sp/>function<sp/>to<sp/>prove<sp/>endian<sp/>conversion<sp/>function</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__defs_8h_1aa2e01dc9f319fbe7ce7ae6467aa27e76" kindref="member">SIGNATURE_POSITION</ref>)<sp/>!=<sp/><ref refid="fat__defs_8h_1a0a6c76f061940b33990aff8b968805b8" kindref="member">SIGNATURE_VALUE</ref>)</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a103f88475b041e05731cc90432456bad" kindref="member">FAT_INIT_ENDIAN_ERROR</ref>;</highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Verify<sp/>packed<sp/>structures</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>)<sp/>!=<sp/><ref refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" kindref="member">FAT_DIR_ENTRY_SIZE</ref>)</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1afdc968293058f0c497f5929f863f5d10" kindref="member">FAT_INIT_STRUCT_PACKING</ref>;</highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Check<sp/>the<sp/>partition<sp/>type<sp/>code</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[<ref refid="fat__defs_8h_1a812cfec2f2979480abd1b320d1762498" kindref="member">PARTITION1_TYPECODE_LOCATION</ref>])<sp/>{</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0x0B:</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0x06:</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0x0C:</highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0x0E:</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0x0F:</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0x05:</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>valid_partition<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0x00:</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>valid_partition<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[<ref refid="fat__defs_8h_1a812cfec2f2979480abd1b320d1762498" kindref="member">PARTITION1_TYPECODE_LOCATION</ref>]<sp/>&lt;=<sp/>0x06)</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>valid_partition<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>LBA<sp/>Begin<sp/>for<sp/>the<sp/>file<sp/>system</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(valid_partition)</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>=<sp/><ref refid="fat__misc_8h_1a857557cc9a2fc6a7f721a2960dcc6f33" kindref="member">GET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a3fe9dae3b04bdb4bfacd8a49aec4823d" kindref="member">PARTITION1_LBA_BEGIN_LOCATION</ref>);</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Else<sp/>possibly<sp/>MBR<sp/>less<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Load<sp/>Volume<sp/>1<sp/>table<sp/>into<sp/>sector<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>(We<sp/>may<sp/>already<sp/>have<sp/>this<sp/>in<sp/>the<sp/>buffer<sp/>if<sp/>MBR<sp/>less<sp/>drive!)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1))</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a2ffc1cf01469bc98451356bac154af38" kindref="member">FAT_INIT_MEDIA_ACCESS_ERROR</ref>;</highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Make<sp/>sure<sp/>there<sp/>are<sp/>512<sp/>bytes<sp/>per<sp/>cluster</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0x0B)<sp/>!=<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>)</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a841405f1315c0f5ebdf68b42794878bb" kindref="member">FAT_INIT_INVALID_SECTOR_SIZE</ref>;</highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Load<sp/>Parameters<sp/>of<sp/>FAT<sp/>partition</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[<ref refid="fat__defs_8h_1a23d5a5317bb9b8c2c299d37d3fae1207" kindref="member">BPB_SECPERCLUS</ref>];</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/>reserved_sectors<sp/>=<sp/><ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1ab42c8f7a0994062257044882b2ff4313" kindref="member">BPB_RSVDSECCNT</ref>);</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/>num_of_fats<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[<ref refid="fat__defs_8h_1a530b676e7e69bbc5038bd4b3cb499331" kindref="member">BPB_NUMFATS</ref>];</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;root_entry_count<sp/>=<sp/><ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a788e987621983dd44b5f7e22b17577bb" kindref="member">BPB_ROOTENTCNT</ref>);</highlight></codeline>
<codeline lineno="125"><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a495df1c692e51d1590dbe5d5b0f5dbb3" kindref="member">BPB_FATSZ16</ref>)<sp/>!=<sp/>0)</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors<sp/>=<sp/><ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a495df1c692e51d1590dbe5d5b0f5dbb3" kindref="member">BPB_FATSZ16</ref>);</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors<sp/>=<sp/><ref refid="fat__misc_8h_1a857557cc9a2fc6a7f721a2960dcc6f33" kindref="member">GET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a2f7e14590bc89d5c273e4945b1378ee8" kindref="member">BPB_FAT32_FATSZ32</ref>);</highlight></codeline>
<codeline lineno="130"><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>For<sp/>FAT32<sp/>(which<sp/>this<sp/>may<sp/>be)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster<sp/>=<sp/><ref refid="fat__misc_8h_1a857557cc9a2fc6a7f721a2960dcc6f33" kindref="member">GET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1ac22b455a3ed7ca414efe28f0da310f7a" kindref="member">BPB_FAT32_ROOTCLUS</ref>);</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fs_info_sector<sp/>=<sp/><ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a6b66c1d291ef97e70fbe5f1f36fda793" kindref="member">BPB_FAT32_FSINFO</ref>);</highlight></codeline>
<codeline lineno="134"><highlight class="normal"></highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>For<sp/>FAT16<sp/>(which<sp/>this<sp/>may<sp/>be),<sp/>rootdir_first_cluster<sp/>is<sp/>actuall<sp/>rootdir_first_sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_sector<sp/>=<sp/>reserved_sectors<sp/>+<sp/>(num_of_fats<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors);</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_sectors<sp/>=<sp/>((<ref refid="structfs" kindref="compound">fs</ref>-&gt;root_entry_count<sp/>*<sp/>32)<sp/>+<sp/>(<ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref><sp/>-<sp/>1))<sp/>/<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>;</highlight></codeline>
<codeline lineno="138"><highlight class="normal"></highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>First<sp/>FAT<sp/>LBA<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>+<sp/>reserved_sectors;</highlight></codeline>
<codeline lineno="141"><highlight class="normal"></highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>The<sp/>address<sp/>of<sp/>the<sp/>first<sp/>data<sp/>cluster<sp/>on<sp/>this<sp/>volume</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;cluster_begin_lba<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba<sp/>+<sp/>(num_of_fats<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors);</highlight></codeline>
<codeline lineno="144"><highlight class="normal"></highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0x1FE)<sp/>!=<sp/>0xAA55)<sp/></highlight><highlight class="comment">//<sp/>This<sp/>signature<sp/>should<sp/>be<sp/>AA55</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a1cc1a9d192efb390bbad20c87e9150fe" kindref="member">FAT_INIT_INVALID_SIGNATURE</ref>;</highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>the<sp/>root<sp/>dir<sp/>sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/>root_dir_sectors<sp/>=<sp/>((<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a788e987621983dd44b5f7e22b17577bb" kindref="member">BPB_ROOTENTCNT</ref>)<sp/>*<sp/>32)<sp/>+<sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a64f6214c3cd6ea996aa49c66ef704440" kindref="member">BPB_BYTSPERSEC</ref>)<sp/>-<sp/>1))<sp/>/<sp/><ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a64f6214c3cd6ea996aa49c66ef704440" kindref="member">BPB_BYTSPERSEC</ref>);</highlight></codeline>
<codeline lineno="150"><highlight class="normal"></highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a495df1c692e51d1590dbe5d5b0f5dbb3" kindref="member">BPB_FATSZ16</ref>)<sp/>!=<sp/>0)</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/>FATSz<sp/>=<sp/><ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a495df1c692e51d1590dbe5d5b0f5dbb3" kindref="member">BPB_FATSZ16</ref>);</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/>FATSz<sp/>=<sp/><ref refid="fat__misc_8h_1a857557cc9a2fc6a7f721a2960dcc6f33" kindref="member">GET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a2f7e14590bc89d5c273e4945b1378ee8" kindref="member">BPB_FAT32_FATSZ32</ref>);</highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a54c5035f6b96c9e4d5b0844f30de59e2" kindref="member">BPB_TOTSEC16</ref>)<sp/>!=<sp/>0)</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/>total_sectors<sp/>=<sp/><ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a54c5035f6b96c9e4d5b0844f30de59e2" kindref="member">BPB_TOTSEC16</ref>);</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/>total_sectors<sp/>=<sp/><ref refid="fat__misc_8h_1a857557cc9a2fc6a7f721a2960dcc6f33" kindref="member">GET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1a48e78c7d6a5b5afa2dc41541dd31ee2c" kindref="member">BPB_TOTSEC32</ref>);</highlight></codeline>
<codeline lineno="160"><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/>data_sectors<sp/>=<sp/>total_sectors<sp/>-<sp/>(<ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/><ref refid="fat__defs_8h_1ab42c8f7a0994062257044882b2ff4313" kindref="member">BPB_RSVDSECCNT</ref>)<sp/>+<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[<ref refid="fat__defs_8h_1a530b676e7e69bbc5038bd4b3cb499331" kindref="member">BPB_NUMFATS</ref>]<sp/>*<sp/>FATSz)<sp/>+<sp/>root_dir_sectors);</highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>out<sp/>which<sp/>version<sp/>of<sp/>FAT<sp/>this<sp/>is...</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/>count_of_clusters<sp/>=<sp/>data_sectors<sp/>/<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster;</highlight></codeline>
<codeline lineno="166"><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(count_of_clusters<sp/>&lt;<sp/>4085)</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>is<sp/>FAT12</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1af12f4a6f5430715270eb4e677cc6ec41" kindref="member">FAT_INIT_WRONG_FILESYS_TYPE</ref>;</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(count_of_clusters<sp/>&lt;<sp/>65525)<sp/>{</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Clear<sp/>this<sp/>FAT32<sp/>specific<sp/>param</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="173"><highlight class="normal"></highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>is<sp/>FAT16</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_type<sp/>=<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>;</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1ae6aa6129ce17d5e7286e043c850e23c2" kindref="member">FAT_INIT_OK</ref>;</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>is<sp/>FAT32</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_type<sp/>=<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13baf87a06e051a75de30afdcb374f70ec58" kindref="member">FAT_TYPE_32</ref>;</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1ae6aa6129ce17d5e7286e043c850e23c2" kindref="member">FAT_INIT_OK</ref>;</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1af12f4a6f5430715270eb4e677cc6ec41" kindref="member">FAT_INIT_WRONG_FILESYS_TYPE</ref>;</highlight></codeline>
<codeline lineno="186"><highlight class="normal">}</highlight></codeline>
<codeline lineno="187"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_lba_of_cluster:<sp/>This<sp/>function<sp/>converts<sp/>a<sp/>cluster<sp/>number<sp/>into<sp/>a<sp/>sector<sp/>/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="189"><highlight class="normal"></highlight><highlight class="comment">//<sp/>LBA<sp/>number.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="191" refid="fat__access_8h_1adda5a5dde3548cd09943efcbe5534c62" refkind="member"><highlight class="normal"><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/><ref refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" kindref="member">fatfs_lba_of_cluster</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>Cluster_Number)<sp/>{</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>)</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;cluster_begin_lba<sp/>+<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;root_entry_count<sp/>*<sp/>32<sp/>/<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>)<sp/>+<sp/>((Cluster_Number<sp/>-<sp/>2)<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster));</highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>((<ref refid="structfs" kindref="compound">fs</ref>-&gt;cluster_begin_lba<sp/>+<sp/>((Cluster_Number<sp/>-<sp/>2)<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster)));</highlight></codeline>
<codeline lineno="196"><highlight class="normal">}</highlight></codeline>
<codeline lineno="197"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_sector_read:</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="200" refid="fat__access_8h_1ac227af7896c2e9ef03e27a73c52630e6" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1ac227af7896c2e9ef03e27a73c52630e6" kindref="member">fatfs_sector_read</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>lba,<sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>*target,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>count)<sp/>{</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(lba,<sp/>target,<sp/>count);</highlight></codeline>
<codeline lineno="202"><highlight class="normal">}</highlight></codeline>
<codeline lineno="203"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="204"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_sector_write:</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="206" refid="fat__access_8h_1a04e80392b0318629a8f1b609b8204b69" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a04e80392b0318629a8f1b609b8204b69" kindref="member">fatfs_sector_write</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>lba,<sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>*target,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>count)<sp/>{</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(lba,<sp/>target,<sp/>count);</highlight></codeline>
<codeline lineno="208"><highlight class="normal">}</highlight></codeline>
<codeline lineno="209"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="210"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_sector_reader:<sp/>From<sp/>the<sp/>provided<sp/>startcluster<sp/>and<sp/>sector<sp/>offset</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Returns<sp/>True<sp/>if<sp/>success,<sp/>returns<sp/>False<sp/>if<sp/>not<sp/>(including<sp/>if<sp/>read<sp/>out<sp/>of<sp/>range)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="213" refid="fat__access_8h_1aaa34effab2043ace65e92d060a0e74c5" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" kindref="member">fatfs_sector_reader</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>start_cluster,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>offset,<sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>*target)<sp/>{</highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>sector_to_read<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>cluster_to_read<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>cluster_chain<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>i;</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>lba;</highlight></codeline>
<codeline lineno="219"><highlight class="normal"></highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT16<sp/>Root<sp/>directory</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref><sp/>&amp;&amp;<sp/>start_cluster<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(offset<sp/>&lt;<sp/>fs-&gt;rootdir_sectors)</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lba<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>+<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_sector<sp/>+<sp/>offset;</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT16/32<sp/>Other</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Set<sp/>start<sp/>of<sp/>cluster<sp/>chain<sp/>to<sp/>initial<sp/>value</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/>cluster_chain<sp/>=<sp/>start_cluster;</highlight></codeline>
<codeline lineno="231"><highlight class="normal"></highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>parameters</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/>cluster_to_read<sp/>=<sp/>offset<sp/>/<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster;</highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/>sector_to_read<sp/>=<sp/>offset<sp/>-<sp/>(cluster_to_read<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster);</highlight></codeline>
<codeline lineno="235"><highlight class="normal"></highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Follow<sp/>chain<sp/>to<sp/>find<sp/>cluster<sp/>to<sp/>read</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>cluster_to_read;<sp/>i++)</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cluster_chain<sp/>=<sp/><ref refid="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" kindref="member">fatfs_find_next_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>cluster_chain);</highlight></codeline>
<codeline lineno="239"><highlight class="normal"></highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>end<sp/>of<sp/>cluster<sp/>chain<sp/>then<sp/>return<sp/>false</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(cluster_chain<sp/>==<sp/><ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>)</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="243"><highlight class="normal"></highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>sector<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/>lba<sp/>=<sp/><ref refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" kindref="member">fatfs_lba_of_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>cluster_chain)<sp/>+<sp/>sector_to_read;</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="247"><highlight class="normal"></highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>User<sp/>provided<sp/>target<sp/>array</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(target)</highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(lba,<sp/>target,<sp/>1);</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Else<sp/>read<sp/>sector<sp/>if<sp/>not<sp/>already<sp/>loaded</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(lba<sp/>!=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address)<sp/>{</highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address<sp/>=<sp/>lba;</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1);</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="256"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="258"><highlight class="normal">}</highlight></codeline>
<codeline lineno="259"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="260"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_read_sector:<sp/>Read<sp/>from<sp/>the<sp/>provided<sp/>cluster<sp/>and<sp/>sector<sp/>offset</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="261"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Returns<sp/>True<sp/>if<sp/>success,<sp/>returns<sp/>False<sp/>if<sp/>not</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="262"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="263" refid="fat__access_8h_1a588054b2e9acc4cfd00dcd7b83627828" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a588054b2e9acc4cfd00dcd7b83627828" kindref="member">fatfs_read_sector</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>cluster,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>sector,<sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>*target)<sp/>{</highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT16<sp/>Root<sp/>directory</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref><sp/>&amp;&amp;<sp/>cluster<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>lba;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"></highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>In<sp/>FAT16,<sp/>there<sp/>are<sp/>a<sp/>limited<sp/>amount<sp/>of<sp/>sectors<sp/>in<sp/>root<sp/>dir!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(sector<sp/>&lt;<sp/>fs-&gt;rootdir_sectors)</highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lba<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>+<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_sector<sp/>+<sp/>sector;</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="273"><highlight class="normal"></highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>User<sp/>target<sp/>buffer<sp/>passed<sp/>in</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(target)<sp/>{</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>from<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(lba,<sp/>target,<sp/>1);</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>read<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address<sp/>=<sp/>lba;</highlight></codeline>
<codeline lineno="282"><highlight class="normal"></highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>from<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1);</highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT16/32<sp/>Other</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>User<sp/>target<sp/>buffer<sp/>passed<sp/>in</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(target)<sp/>{</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>read<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>lba<sp/>=<sp/><ref refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" kindref="member">fatfs_lba_of_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>cluster)<sp/>+<sp/>sector;</highlight></codeline>
<codeline lineno="293"><highlight class="normal"></highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>from<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(lba,<sp/>target,<sp/>1);</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>write<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address<sp/>=<sp/><ref refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" kindref="member">fatfs_lba_of_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>cluster)<sp/>+<sp/>sector;</highlight></codeline>
<codeline lineno="300"><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>from<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1);</highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="305"><highlight class="normal">}</highlight></codeline>
<codeline lineno="306"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="307"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_write_sector:<sp/>Write<sp/>to<sp/>the<sp/>provided<sp/>cluster<sp/>and<sp/>sector<sp/>offset</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Returns<sp/>True<sp/>if<sp/>success,<sp/>returns<sp/>False<sp/>if<sp/>not</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="311" refid="fat__access_8h_1aba0dfdb700ff90e17883a8fea582f491" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1aba0dfdb700ff90e17883a8fea582f491" kindref="member">fatfs_write_sector</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>cluster,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>sector,<sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>*target)<sp/>{</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>No<sp/>write<sp/>access?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media)</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="315"><highlight class="normal"></highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT16<sp/>Root<sp/>directory</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref><sp/>&amp;&amp;<sp/>cluster<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>lba;</highlight></codeline>
<codeline lineno="319"><highlight class="normal"></highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>In<sp/>FAT16<sp/>we<sp/>cannot<sp/>extend<sp/>the<sp/>root<sp/>dir!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(sector<sp/>&lt;<sp/>fs-&gt;rootdir_sectors)</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lba<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>+<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_sector<sp/>+<sp/>sector;</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="325"><highlight class="normal"></highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>User<sp/>target<sp/>buffer<sp/>passed<sp/>in</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(target)<sp/>{</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>to<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(lba,<sp/>target,<sp/>1);</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>write<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address<sp/>=<sp/>lba;</highlight></codeline>
<codeline lineno="334"><highlight class="normal"></highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>to<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1);</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT16/32<sp/>Other</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>User<sp/>target<sp/>buffer<sp/>passed<sp/>in</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(target)<sp/>{</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>write<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>lba<sp/>=<sp/><ref refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" kindref="member">fatfs_lba_of_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>cluster)<sp/>+<sp/>sector;</highlight></codeline>
<codeline lineno="345"><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>to<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(lba,<sp/>target,<sp/>1);</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Calculate<sp/>write<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address<sp/>=<sp/><ref refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" kindref="member">fatfs_lba_of_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>cluster)<sp/>+<sp/>sector;</highlight></codeline>
<codeline lineno="352"><highlight class="normal"></highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>to<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1);</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="357"><highlight class="normal">}</highlight></codeline>
<codeline lineno="358"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="359"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="360"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_show_details:<sp/>Show<sp/>the<sp/>details<sp/>about<sp/>the<sp/>filesystem</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="361"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="362" refid="fat__access_8h_1a8b312d9fb7f328e0bf02e3c6d3725b6b" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a8b312d9fb7f328e0bf02e3c6d3725b6b" kindref="member">fatfs_show_details</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>)<sp/>{</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><ref refid="fat__opts_8h_1a77e202c52dfa1ae6a4a060b21b70a80c" kindref="member">FAT_PRINTF</ref>((</highlight><highlight class="stringliteral">&quot;FAT<sp/>details:\r\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/><ref refid="fat__opts_8h_1a77e202c52dfa1ae6a4a060b21b70a80c" kindref="member">FAT_PRINTF</ref>((</highlight><highlight class="stringliteral">&quot;<sp/>Type<sp/>=%s&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13baf87a06e051a75de30afdcb374f70ec58" kindref="member">FAT_TYPE_32</ref>)<sp/>?<sp/></highlight><highlight class="stringliteral">&quot;FAT32&quot;</highlight><highlight class="normal">:<sp/></highlight><highlight class="stringliteral">&quot;FAT16&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><ref refid="fat__opts_8h_1a77e202c52dfa1ae6a4a060b21b70a80c" kindref="member">FAT_PRINTF</ref>((</highlight><highlight class="stringliteral">&quot;<sp/>Root<sp/>Dir<sp/>First<sp/>Cluster<sp/>=<sp/>%x\r\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster));</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><ref refid="fat__opts_8h_1a77e202c52dfa1ae6a4a060b21b70a80c" kindref="member">FAT_PRINTF</ref>((</highlight><highlight class="stringliteral">&quot;<sp/>FAT<sp/>Begin<sp/>LBA<sp/>=<sp/>0x%x\r\n&quot;</highlight><highlight class="normal">,<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba));</highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/><ref refid="fat__opts_8h_1a77e202c52dfa1ae6a4a060b21b70a80c" kindref="member">FAT_PRINTF</ref>((</highlight><highlight class="stringliteral">&quot;<sp/>Cluster<sp/>Begin<sp/>LBA<sp/>=<sp/>0x%x\r\n&quot;</highlight><highlight class="normal">,<ref refid="structfs" kindref="compound">fs</ref>-&gt;cluster_begin_lba));</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><ref refid="fat__opts_8h_1a77e202c52dfa1ae6a4a060b21b70a80c" kindref="member">FAT_PRINTF</ref>((</highlight><highlight class="stringliteral">&quot;<sp/>Sectors<sp/>Per<sp/>Cluster<sp/>=<sp/>%d\r\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster));</highlight></codeline>
<codeline lineno="369"><highlight class="normal">}</highlight></codeline>
<codeline lineno="370"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="371"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_get_root_cluster:<sp/>Get<sp/>the<sp/>root<sp/>dir<sp/>cluster</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="372"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="373" refid="fat__access_8h_1a6d36c74c7a9ba228d327067786ecb0c2" refkind="member"><highlight class="normal"><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/><ref refid="fat__access_8c_1a6d36c74c7a9ba228d327067786ecb0c2" kindref="member">fatfs_get_root_cluster</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>)<sp/>{</highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>NOTE:<sp/>On<sp/>FAT16<sp/>this<sp/>will<sp/>be<sp/>0<sp/>which<sp/>has<sp/>a<sp/>special<sp/>meaning...</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster;</highlight></codeline>
<codeline lineno="376"><highlight class="normal">}</highlight></codeline>
<codeline lineno="377"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="378"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_get_file_entry:<sp/>Find<sp/>the<sp/>file<sp/>entry<sp/>for<sp/>a<sp/>filename</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="379"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="380" refid="fat__access_8h_1a8a18a3afa5804c2c3143f671d462687d" refkind="member"><highlight class="normal"><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/><ref refid="fat__access_8c_1a0585d01a38409645830c9e7f57a4bf1b" kindref="member">fatfs_get_file_entry</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>Cluster,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*name_to_find,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref><sp/>*sfEntry)<sp/>{</highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>item<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>recordoffset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>i<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*long_filename<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>short_filename[13];</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlfn__cache" kindref="compound">lfn_cache</ref><sp/>lfn;</highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>dotRequired<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref><sp/>*<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>;</highlight></codeline>
<codeline lineno="390"><highlight class="normal"></highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><ref refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" kindref="member">fatfs_lfn_cache_init</ref>(&amp;lfn,<sp/>1);</highlight></codeline>
<codeline lineno="392"><highlight class="normal"></highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Main<sp/>cluster<sp/>following<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(1)<sp/>{</highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" kindref="member">fatfs_sector_reader</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>Cluster,<sp/>x++,<sp/>0))<sp/>{<sp/></highlight><highlight class="comment">//<sp/>If<sp/>sector<sp/>read<sp/>was<sp/>successfull</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Analyse<sp/>Sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(item<sp/>=<sp/>0;<sp/>item<sp/>&lt;<sp/><ref refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" kindref="member">FAT_DIR_ENTRIES_PER_SECTOR</ref>;<sp/>item++)<sp/>{</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Create<sp/>the<sp/>multiplier<sp/>for<sp/>sector<sp/>access</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>recordoffset<sp/>=<sp/><ref refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" kindref="member">FAT_DIR_ENTRY_SIZE</ref><sp/>*<sp/>item;</highlight></codeline>
<codeline lineno="401"><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Overlay<sp/>directory<sp/>entry<sp/>over<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref><sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>*)<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset);</highlight></codeline>
<codeline lineno="404"><highlight class="normal"></highlight></codeline>
<codeline lineno="405"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_LFN_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="406"><highlight class="normal"></highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" kindref="member">fatfs_entry_lfn_text</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{<sp/></highlight><highlight class="comment">//<sp/>Long<sp/>File<sp/>Name<sp/>Text<sp/>Found</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8c_1a37178e1cd0b3c962e4c41bd4e350c712" kindref="member">fatfs_lfn_cache_entry</ref>(&amp;lfn,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset);</highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" kindref="member">fatfs_entry_lfn_invalid</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{<sp/></highlight><highlight class="comment">//<sp/>If<sp/>Invalid<sp/>record<sp/>found<sp/>delete<sp/>any<sp/>long<sp/>file<sp/>name<sp/>information<sp/>collated</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="411"><highlight class="normal"></highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" kindref="member">fatfs_lfn_cache_init</ref>(&amp;lfn,<sp/>0);</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a27351ac7857382bf893d7e5a74cf5710" kindref="member">fatfs_entry_lfn_exists</ref>(&amp;lfn,<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{<sp/></highlight><highlight class="comment">//<sp/>Normal<sp/>SFN<sp/>Entry<sp/>and<sp/>Long<sp/>text<sp/>exists</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>long_filename<sp/>=<sp/><ref refid="fat__misc_8c_1a30fee82472e2faf585b0a84068abc672" kindref="member">fatfs_lfn_cache_get</ref>(&amp;lfn);</highlight></codeline>
<codeline lineno="416"><highlight class="normal"></highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Compare<sp/>names<sp/>to<sp/>see<sp/>if<sp/>they<sp/>match</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__string_8c_1a88289160199a24ccb76d819a07c47921" kindref="member">fatfs_compare_names</ref>(long_filename,<sp/>name_to_find))<sp/>{</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>(sfEntry,<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>));</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="422"><highlight class="normal"></highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" kindref="member">fatfs_lfn_cache_init</ref>(&amp;lfn,<sp/>0);</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="426"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" kindref="member">fatfs_entry_sfn_only</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{<sp/></highlight><highlight class="comment">//<sp/>Normal<sp/>Entry,<sp/>only<sp/>8.3<sp/>Text</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(short_filename,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(short_filename));</highlight></codeline>
<codeline lineno="429"><highlight class="normal"></highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Copy<sp/>name<sp/>to<sp/>string</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>8;<sp/>i++)</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[i]<sp/>=<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name[i];</highlight></codeline>
<codeline lineno="433"><highlight class="normal"></highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Extension</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dotRequired<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for<sp/>(i<sp/>=<sp/>8;<sp/>i<sp/>&lt;<sp/>11;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[i<sp/>+<sp/>1]<sp/>=<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name[i];</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name[i]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dotRequired<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="441"><highlight class="normal"></highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Dot<sp/>only<sp/>required<sp/>if<sp/>extension<sp/>present</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dotRequired)<sp/>{</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>not<sp/>.<sp/>or<sp/>..<sp/>entry</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(short_filename[0]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;.&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[8]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;.&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[8]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[8]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="452"><highlight class="normal"></highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Compare<sp/>names<sp/>to<sp/>see<sp/>if<sp/>they<sp/>match</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__string_8c_1a88289160199a24ccb76d819a07c47921" kindref="member">fatfs_compare_names</ref>(short_filename,<sp/>name_to_find))<sp/>{</highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>(sfEntry,<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>));</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="458"><highlight class="normal"></highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" kindref="member">fatfs_lfn_cache_init</ref>(&amp;lfn,<sp/>0);</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="461"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_LFN_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="463"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="464"><highlight class="normal"></highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>for</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>while<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="470"><highlight class="normal"></highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="472"><highlight class="normal">}</highlight></codeline>
<codeline lineno="473"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="474"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_sfn_exists:<sp/>Check<sp/>if<sp/>a<sp/>short<sp/>filename<sp/>exists.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="475"><highlight class="normal"></highlight><highlight class="comment">//<sp/>NOTE:<sp/>shortname<sp/>is<sp/>XXXXXXXXYYY<sp/>not<sp/>XXXXXXXX.YYY</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="476"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="477"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="478" refid="fat__access_8h_1a8bdad35bc1dd908eda5d02f47a8d73d4" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a8bdad35bc1dd908eda5d02f47a8d73d4" kindref="member">fatfs_sfn_exists</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>Cluster,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*shortname)<sp/>{</highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>item<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>recordoffset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref><sp/>*<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>;</highlight></codeline>
<codeline lineno="483"><highlight class="normal"></highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Main<sp/>cluster<sp/>following<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(1)<sp/>{</highlight></codeline>
<codeline lineno="486"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" kindref="member">fatfs_sector_reader</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>Cluster,<sp/>x++,<sp/>0))<sp/></highlight><highlight class="comment">//<sp/>If<sp/>sector<sp/>read<sp/>was<sp/>successfull</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Analyse<sp/>Sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(item<sp/>=<sp/>0;<sp/>item<sp/>&lt;<sp/><ref refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" kindref="member">FAT_DIR_ENTRIES_PER_SECTOR</ref>;<sp/>item++)<sp/>{</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Create<sp/>the<sp/>multiplier<sp/>for<sp/>sector<sp/>access</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>recordoffset<sp/>=<sp/><ref refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" kindref="member">FAT_DIR_ENTRY_SIZE</ref><sp/>*<sp/>item;</highlight></codeline>
<codeline lineno="493"><highlight class="normal"></highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Overlay<sp/>directory<sp/>entry<sp/>over<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref><sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>*)<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset);</highlight></codeline>
<codeline lineno="496"><highlight class="normal"></highlight></codeline>
<codeline lineno="497"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_LFN_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Long<sp/>File<sp/>Name<sp/>Text<sp/>Found</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" kindref="member">fatfs_entry_lfn_text</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline>
<codeline lineno="501"><highlight class="normal"></highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>Invalid<sp/>record<sp/>found<sp/>delete<sp/>any<sp/>long<sp/>file<sp/>name<sp/>information<sp/>collated</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" kindref="member">fatfs_entry_lfn_invalid</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="506"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Normal<sp/>Entry,<sp/>only<sp/>8.3<sp/>Text</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" kindref="member">fatfs_entry_sfn_only</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="lib_8h_1a6395668b53785234b479045e1773a6a4" kindref="member">strncmp</ref>((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name,<sp/>shortname,<sp/>11)<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>if</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>while<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="517"><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="519"><highlight class="normal">}</highlight></codeline>
<codeline lineno="520"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="521"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="522"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_update_timestamps:<sp/>Update<sp/>date/time<sp/>details</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="523"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="524"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_TIME_DATE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="525"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8h_1a7c037882a907d50957d58ba53e1ef897" kindref="member">fatfs_update_timestamps</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref><sp/>*<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>create,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>modify,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="gdt_8h_1a8c3d836bf6ce197ad635d670265b97e1" kindref="member">access</ref>)</highlight></codeline>
<codeline lineno="526"><highlight class="normal">{</highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="__timespec_8h_1ac8234dac99fc3a2dcc8b7998afd40d49" kindref="member">time_t</ref><sp/>time_now;</highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tm<sp/>*<sp/>time_info;</highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>fat_time;</highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>fat_date;</highlight></codeline>
<codeline lineno="531"><highlight class="normal"></highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>system<sp/>time</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/><sp/><sp/>time(&amp;time_now);</highlight></codeline>
<codeline lineno="534"><highlight class="normal"></highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Convert<sp/>to<sp/>local<sp/>time</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/>time_info<sp/>=<sp/>localtime(&amp;time_now);</highlight></codeline>
<codeline lineno="537"><highlight class="normal"></highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Convert<sp/>time<sp/>to<sp/>FAT<sp/>format</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/>fat_time<sp/>=<sp/><ref refid="fat__misc_8h_1a42fbd44505592745afb1fdca6f074aab" kindref="member">fatfs_convert_to_fat_time</ref>(time_info-&gt;tm_hour,<sp/>time_info-&gt;tm_min,<sp/>time_info-&gt;tm_sec);</highlight></codeline>
<codeline lineno="540"><highlight class="normal"></highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Convert<sp/>date<sp/>to<sp/>FAT<sp/>format</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/><sp/><sp/>fat_date<sp/>=<sp/><ref refid="fat__misc_8h_1a1d864cba89ca98550fcaa4c7e0e5e976" kindref="member">fatfs_convert_to_fat_date</ref>(time_info-&gt;tm_mday,<sp/>time_info-&gt;tm_mon<sp/>+<sp/>1,<sp/>time_info-&gt;tm_year<sp/>+<sp/>1900);</highlight></codeline>
<codeline lineno="543"><highlight class="normal"></highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Update<sp/>requested<sp/>fields</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(create)</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtTime[1]<sp/>=<sp/>fat_time<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtTime[0]<sp/>=<sp/>fat_time<sp/>&gt;&gt;<sp/>0;</highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtDate[1]<sp/>=<sp/>fat_date<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtDate[0]<sp/>=<sp/>fat_date<sp/>&gt;&gt;<sp/>0;</highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="552"><highlight class="normal"></highlight></codeline>
<codeline lineno="553"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(modify)</highlight></codeline>
<codeline lineno="554"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtTime[1]<sp/>=<sp/>fat_time<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="556"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtTime[0]<sp/>=<sp/>fat_time<sp/>&gt;&gt;<sp/>0;</highlight></codeline>
<codeline lineno="557"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtDate[1]<sp/>=<sp/>fat_date<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="558"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtDate[0]<sp/>=<sp/>fat_date<sp/>&gt;&gt;<sp/>0;</highlight></codeline>
<codeline lineno="559"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="560"><highlight class="normal"></highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="gdt_8h_1a8c3d836bf6ce197ad635d670265b97e1" kindref="member">access</ref>)</highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[1]<sp/>=<sp/>fat_time<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[0]<sp/>=<sp/>fat_time<sp/>&gt;&gt;<sp/>0;</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[1]<sp/>=<sp/>fat_date<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[0]<sp/>=<sp/>fat_date<sp/>&gt;&gt;<sp/>0;</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="568"><highlight class="normal"></highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="570"><highlight class="normal">}</highlight></codeline>
<codeline lineno="571"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="572"><highlight class="normal"></highlight></codeline>
<codeline lineno="573"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="574"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_update_file_length:<sp/>Find<sp/>a<sp/>SFN<sp/>entry<sp/>and<sp/>update<sp/>it</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="575"><highlight class="normal"></highlight><highlight class="comment">//<sp/>NOTE:<sp/>shortname<sp/>is<sp/>XXXXXXXXYYY<sp/>not<sp/>XXXXXXXX.YYY</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="576"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="577"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="578" refid="fat__access_8h_1af94f715b4cdb59cf7854b564de855a65" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1af94f715b4cdb59cf7854b564de855a65" kindref="member">fatfs_update_file_length</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>Cluster,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*shortname,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>fileLength)<sp/>{</highlight></codeline>
<codeline lineno="579"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>item<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>recordoffset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref><sp/>*<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>;</highlight></codeline>
<codeline lineno="583"><highlight class="normal"></highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>No<sp/>write<sp/>access?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media)</highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="587"><highlight class="normal"></highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Main<sp/>cluster<sp/>following<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(1)<sp/>{</highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="591"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" kindref="member">fatfs_sector_reader</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>Cluster,<sp/>x++,<sp/>0))<sp/></highlight><highlight class="comment">//<sp/>If<sp/>sector<sp/>read<sp/>was<sp/>successfull</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="592"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Analyse<sp/>Sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="594"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(item<sp/>=<sp/>0;<sp/>item<sp/>&lt;<sp/><ref refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" kindref="member">FAT_DIR_ENTRIES_PER_SECTOR</ref>;<sp/>item++)<sp/>{</highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Create<sp/>the<sp/>multiplier<sp/>for<sp/>sector<sp/>access</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>recordoffset<sp/>=<sp/><ref refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" kindref="member">FAT_DIR_ENTRY_SIZE</ref><sp/>*<sp/>item;</highlight></codeline>
<codeline lineno="597"><highlight class="normal"></highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Overlay<sp/>directory<sp/>entry<sp/>over<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref><sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>*)<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset);</highlight></codeline>
<codeline lineno="600"><highlight class="normal"></highlight></codeline>
<codeline lineno="601"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_LFN_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="602"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Long<sp/>File<sp/>Name<sp/>Text<sp/>Found</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" kindref="member">fatfs_entry_lfn_text</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline>
<codeline lineno="605"><highlight class="normal"></highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>Invalid<sp/>record<sp/>found<sp/>delete<sp/>any<sp/>long<sp/>file<sp/>name<sp/>information<sp/>collated</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" kindref="member">fatfs_entry_lfn_invalid</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline>
<codeline lineno="609"><highlight class="normal"></highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Normal<sp/>Entry,<sp/>only<sp/>8.3<sp/>Text</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="612"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" kindref="member">fatfs_entry_sfn_only</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{</highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="lib_8h_1a6395668b53785234b479045e1773a6a4" kindref="member">strncmp</ref>((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name,<sp/>shortname,<sp/>11)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;FileSize<sp/>=<sp/><ref refid="fat__types_8h_1a79f47acd161cf6d4943a43745c179a6e" kindref="member">FAT_HTONL</ref>(fileLength);</highlight></codeline>
<codeline lineno="616"><highlight class="normal"></highlight></codeline>
<codeline lineno="617"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_TIME_DATE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Update<sp/>access<sp/>/<sp/>modify<sp/>time<sp/>&amp;<sp/>date</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__access_8h_1a7c037882a907d50957d58ba53e1ef897" kindref="member">fatfs_update_timestamps</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>,<sp/>0,<sp/>1,<sp/>1);</highlight></codeline>
<codeline lineno="620"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="621"><highlight class="normal"></highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Update<sp/>sfn<sp/>entry</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>((<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>*)<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset),<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>*)<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>));</highlight></codeline>
<codeline lineno="624"><highlight class="normal"></highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>sector<sp/>back</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1);</highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>if</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="631"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="632"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="633"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>while<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="634"><highlight class="normal"></highlight></codeline>
<codeline lineno="635"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="636"><highlight class="normal">}</highlight></codeline>
<codeline lineno="637"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="638"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="639"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_mark_file_deleted:<sp/>Find<sp/>a<sp/>SFN<sp/>entry<sp/>and<sp/>mark<sp/>if<sp/>as<sp/>deleted</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="640"><highlight class="normal"></highlight><highlight class="comment">//<sp/>NOTE:<sp/>shortname<sp/>is<sp/>XXXXXXXXYYY<sp/>not<sp/>XXXXXXXX.YYY</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="641"><highlight class="normal"></highlight><highlight class="comment">//-------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="642"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="643" refid="fat__access_8h_1a7333a9802b496ce05ca6df36c2fc6009" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a7333a9802b496ce05ca6df36c2fc6009" kindref="member">fatfs_mark_file_deleted</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>Cluster,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*shortname)<sp/>{</highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>item<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="645"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>recordoffset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="647"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref><sp/>*<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>;</highlight></codeline>
<codeline lineno="648"><highlight class="normal"></highlight></codeline>
<codeline lineno="649"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>No<sp/>write<sp/>access?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media)</highlight></codeline>
<codeline lineno="651"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="652"><highlight class="normal"></highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Main<sp/>cluster<sp/>following<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(1)<sp/>{</highlight></codeline>
<codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="656"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" kindref="member">fatfs_sector_reader</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>Cluster,<sp/>x++,<sp/>0))<sp/></highlight><highlight class="comment">//<sp/>If<sp/>sector<sp/>read<sp/>was<sp/>successfull</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="657"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Analyse<sp/>Sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(item<sp/>=<sp/>0;<sp/>item<sp/>&lt;<sp/><ref refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" kindref="member">FAT_DIR_ENTRIES_PER_SECTOR</ref>;<sp/>item++)<sp/>{</highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Create<sp/>the<sp/>multiplier<sp/>for<sp/>sector<sp/>access</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>recordoffset<sp/>=<sp/><ref refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" kindref="member">FAT_DIR_ENTRY_SIZE</ref><sp/>*<sp/>item;</highlight></codeline>
<codeline lineno="662"><highlight class="normal"></highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Overlay<sp/>directory<sp/>entry<sp/>over<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref><sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>*)<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset);</highlight></codeline>
<codeline lineno="665"><highlight class="normal"></highlight></codeline>
<codeline lineno="666"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_LFN_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Long<sp/>File<sp/>Name<sp/>Text<sp/>Found</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" kindref="member">fatfs_entry_lfn_text</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="669"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline>
<codeline lineno="670"><highlight class="normal"></highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>Invalid<sp/>record<sp/>found<sp/>delete<sp/>any<sp/>long<sp/>file<sp/>name<sp/>information<sp/>collated</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" kindref="member">fatfs_entry_lfn_invalid</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline>
<codeline lineno="674"><highlight class="normal"></highlight></codeline>
<codeline lineno="675"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Normal<sp/>Entry,<sp/>only<sp/>8.3<sp/>Text</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="677"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" kindref="member">fatfs_entry_sfn_only</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{</highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="lib_8h_1a6395668b53785234b479045e1773a6a4" kindref="member">strncmp</ref>((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name,<sp/>shortname,<sp/>11)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Mark<sp/>as<sp/>deleted</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="681"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name[0]<sp/>=<sp/><ref refid="fat__defs_8h_1acc2882877e3f516e53feb76ee87013d3" kindref="member">FILE_HEADER_DELETED</ref>;</highlight></codeline>
<codeline lineno="682"><highlight class="normal"></highlight></codeline>
<codeline lineno="683"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_TIME_DATE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Update<sp/>access<sp/>/<sp/>modify<sp/>time<sp/>&amp;<sp/>date</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__access_8h_1a7c037882a907d50957d58ba53e1ef897" kindref="member">fatfs_update_timestamps</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>,<sp/>0,<sp/>1,<sp/>1);</highlight></codeline>
<codeline lineno="686"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="687"><highlight class="normal"></highlight></codeline>
<codeline lineno="688"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Update<sp/>sfn<sp/>entry</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="689"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ae33b18edb618c656b9b795b9fce2316c" kindref="member">memcpy</ref>((<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>*)<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset),<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>*)<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>));</highlight></codeline>
<codeline lineno="690"><highlight class="normal"></highlight></codeline>
<codeline lineno="691"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>sector<sp/>back</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="692"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.address,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1);</highlight></codeline>
<codeline lineno="693"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="695"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>if</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="696"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="698"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>while<sp/>loop</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="700"><highlight class="normal"></highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="702"><highlight class="normal">}</highlight></codeline>
<codeline lineno="703"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="704"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="705"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_list_directory_start:<sp/>Initialise<sp/>a<sp/>directory<sp/>listing<sp/>procedure</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="706"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="707"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_DIR_LIST_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="708" refid="fat__access_8h_1a4873df5d542fddb4a1d3b2884b56525e" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a4873df5d542fddb4a1d3b2884b56525e" kindref="member">fatfs_list_directory_start</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfs__dir__list__status" kindref="compound">fs_dir_list_status</ref><sp/>*dirls,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>StartCluster)<sp/>{</highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1acffc0e07120b8ffa7ae56ecf5723554c" kindref="member">cluster</ref><sp/>=<sp/>StartCluster;</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1aecc41c4832bec5e4d6af1a2b16b04ac4" kindref="member">sector</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1a79e4d964afc1d3bdfcf7e9d2626b62bd" kindref="member">offset</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="712"><highlight class="normal">}</highlight></codeline>
<codeline lineno="713"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="714"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="715"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_list_directory_next:<sp/>Get<sp/>the<sp/>next<sp/>entry<sp/>in<sp/>the<sp/>directory.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="716"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Returns:<sp/>1<sp/>=<sp/>found,<sp/>0<sp/>=<sp/>end<sp/>of<sp/>listing</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="717"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="718"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_DIR_LIST_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="719" refid="fat__access_8h_1a256495a47634d609602fc487830aba5c" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__access_8c_1a256495a47634d609602fc487830aba5c" kindref="member">fatfs_list_directory_next</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfs__dir__list__status" kindref="compound">fs_dir_list_status</ref><sp/>*dirls,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfs__dir__ent" kindref="compound">fs_dir_ent</ref><sp/>*entry)<sp/>{</highlight></codeline>
<codeline lineno="720"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>i,<sp/>item;</highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/><ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref><sp/>recordoffset;</highlight></codeline>
<codeline lineno="722"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref><sp/>*<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>;</highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*long_filename<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>short_filename[13];</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlfn__cache" kindref="compound">lfn_cache</ref><sp/>lfn;</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>dotRequired<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>result<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="728"><highlight class="normal"></highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialise<sp/>LFN<sp/>cache<sp/>first</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="730"><highlight class="normal"><sp/><sp/><ref refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" kindref="member">fatfs_lfn_cache_init</ref>(&amp;lfn,<sp/>0);</highlight></codeline>
<codeline lineno="731"><highlight class="normal"></highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(1)<sp/>{</highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>data<sp/>read<sp/>OK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__access_8c_1a934acbcc4c095b05eaacea0333675ed3" kindref="member">fatfs_sector_reader</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1acffc0e07120b8ffa7ae56ecf5723554c" kindref="member">cluster</ref>,<sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1aecc41c4832bec5e4d6af1a2b16b04ac4" kindref="member">sector</ref>,<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Maximum<sp/>of<sp/>16<sp/>directory<sp/>entries</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="736"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(item<sp/>=<sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1a79e4d964afc1d3bdfcf7e9d2626b62bd" kindref="member">offset</ref>;<sp/>item<sp/>&lt;<sp/><ref refid="fat__access_8h_1a1974ef4260c8dbfe17e49be71cf3d637" kindref="member">FAT_DIR_ENTRIES_PER_SECTOR</ref>;<sp/>item++)<sp/>{</highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Increase<sp/>directory<sp/>offset</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>recordoffset<sp/>=<sp/><ref refid="fat__defs_8h_1a0d73859aacf6d6e4ece7720fed28b9ca" kindref="member">FAT_DIR_ENTRY_SIZE</ref><sp/>*<sp/>item;</highlight></codeline>
<codeline lineno="739"><highlight class="normal"></highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Overlay<sp/>directory<sp/>entry<sp/>over<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref><sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__dir__entry" kindref="compound">fat_dir_entry</ref>*)<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset);</highlight></codeline>
<codeline lineno="742"><highlight class="normal"></highlight></codeline>
<codeline lineno="743"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_LFN_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Long<sp/>File<sp/>Name<sp/>Text<sp/>Found</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a7dac9a0d5348d1d6e9df6479c29d03c4" kindref="member">fatfs_entry_lfn_text</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8c_1a37178e1cd0b3c962e4c41bd4e350c712" kindref="member">fatfs_lfn_cache_entry</ref>(&amp;lfn,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector<sp/>+<sp/>recordoffset);</highlight></codeline>
<codeline lineno="747"><highlight class="normal"></highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>Invalid<sp/>record<sp/>found<sp/>delete<sp/>any<sp/>long<sp/>file<sp/>name<sp/>information<sp/>collated</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a4ed58a36d5257fed8f10aaca95433cdf" kindref="member">fatfs_entry_lfn_invalid</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" kindref="member">fatfs_lfn_cache_init</ref>(&amp;lfn,<sp/>0);</highlight></codeline>
<codeline lineno="751"><highlight class="normal"></highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Normal<sp/>SFN<sp/>Entry<sp/>and<sp/>Long<sp/>text<sp/>exists</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a27351ac7857382bf893d7e5a74cf5710" kindref="member">fatfs_entry_lfn_exists</ref>(&amp;lfn,<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{</highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>text</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>long_filename<sp/>=<sp/><ref refid="fat__misc_8c_1a30fee82472e2faf585b0a84068abc672" kindref="member">fatfs_lfn_cache_get</ref>(&amp;lfn);</highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1a3a2a3fddad0b7aa0ddb8fcd7509b9e27" kindref="member">strncpy</ref>(entry-&gt;<ref refid="structfs__dir__ent_1a9c50317e9dbf71b2ae46de67f1aabec3" kindref="member">filename</ref>,<sp/>long_filename,<sp/><ref refid="fat__opts_8h_1a0512aa1c7fba93172e1ff275e5046dd4" kindref="member">FATFS_MAX_LONG_FILENAME</ref><sp/>-<sp/>1);</highlight></codeline>
<codeline lineno="757"><highlight class="normal"></highlight></codeline>
<codeline lineno="758"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1adca70c7e5b6a384a99baf9e1ecb9d1a8" kindref="member">fatfs_entry_is_dir</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a75040e64d85a88d848982ac263f8d7dd" kindref="member">is_dir</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a75040e64d85a88d848982ac263f8d7dd" kindref="member">is_dir</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"></highlight></codeline>
<codeline lineno="763"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_TIME_DATE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>time<sp/>/<sp/>dates</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;create_time<sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtTime[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtTime[0];</highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;create_date<sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtDate[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtDate[0];</highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;access_date<sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[0];</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;write_time<sp/><sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtTime[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtTime[0];</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;write_date<sp/><sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtDate[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtDate[0];</highlight></codeline>
<codeline lineno="770"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="771"><highlight class="normal"></highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a5bd24ee8ccb96c8d105368ab92202b8f" kindref="member">size</ref><sp/>=<sp/><ref refid="fat__types_8h_1a79f47acd161cf6d4943a43745c179a6e" kindref="member">FAT_HTONL</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;FileSize);</highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a6286cbb9d382cacf4e15b03ffd0c352c" kindref="member">cluster</ref><sp/>=<sp/>(<ref refid="fat__types_8h_1abbb9c5db3bb96b1398c9b011870c335b" kindref="member">FAT_HTONS</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;FstClusHI)<sp/>&lt;&lt;<sp/>16)<sp/>|<sp/><ref refid="fat__types_8h_1abbb9c5db3bb96b1398c9b011870c335b" kindref="member">FAT_HTONS</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;FstClusLO);</highlight></codeline>
<codeline lineno="774"><highlight class="normal"></highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Next<sp/>starting<sp/>position</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1a79e4d964afc1d3bdfcf7e9d2626b62bd" kindref="member">offset</ref><sp/>=<sp/>item<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>result<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Normal<sp/>Entry,<sp/>only<sp/>8.3<sp/>Text</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="782"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1a0c733bd55626e6751be7a7fcd770acd5" kindref="member">fatfs_entry_sfn_only</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))<sp/>{</highlight></codeline>
<codeline lineno="784"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8c_1aa1fe29de6c2c59fdcf3159607ac2af47" kindref="member">fatfs_lfn_cache_init</ref>(&amp;lfn,<sp/>0);</highlight></codeline>
<codeline lineno="785"><highlight class="normal"></highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(short_filename,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(short_filename));</highlight></codeline>
<codeline lineno="787"><highlight class="normal"></highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Copy<sp/>name<sp/>to<sp/>string</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>8;<sp/>i++)</highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[i]<sp/>=<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name[i];</highlight></codeline>
<codeline lineno="791"><highlight class="normal"></highlight></codeline>
<codeline lineno="792"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Extension</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="793"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dotRequired<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="794"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for<sp/>(i<sp/>=<sp/>8;<sp/>i<sp/>&lt;<sp/>11;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="795"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[i<sp/>+<sp/>1]<sp/>=<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name[i];</highlight></codeline>
<codeline lineno="796"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;Name[i]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dotRequired<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="798"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="799"><highlight class="normal"></highlight></codeline>
<codeline lineno="800"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Dot<sp/>only<sp/>required<sp/>if<sp/>extension<sp/>present</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="801"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dotRequired)<sp/>{</highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>not<sp/>.<sp/>or<sp/>..<sp/>entry</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="803"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(short_filename[0]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;.&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[8]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;.&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[8]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="807"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>short_filename[8]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="810"><highlight class="normal"></highlight></codeline>
<codeline lineno="811"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__string_8c_1a591f207df5e2aa9fe091df89b0c0f3f8" kindref="member">fatfs_get_sfn_display_name</ref>(entry-&gt;<ref refid="structfs__dir__ent_1a9c50317e9dbf71b2ae46de67f1aabec3" kindref="member">filename</ref>,<sp/>short_filename);</highlight></codeline>
<codeline lineno="812"><highlight class="normal"></highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__misc_8c_1adca70c7e5b6a384a99baf9e1ecb9d1a8" kindref="member">fatfs_entry_is_dir</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>))</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a75040e64d85a88d848982ac263f8d7dd" kindref="member">is_dir</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a75040e64d85a88d848982ac263f8d7dd" kindref="member">is_dir</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="817"><highlight class="normal"></highlight></codeline>
<codeline lineno="818"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_TIME_DATE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>time<sp/>/<sp/>dates</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="820"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;create_time<sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtTime[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtTime[0];</highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;create_date<sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtDate[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;CrtDate[0];</highlight></codeline>
<codeline lineno="822"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;access_date<sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;LstAccDate[0];</highlight></codeline>
<codeline lineno="823"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;write_time<sp/><sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtTime[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtTime[0];</highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;write_date<sp/><sp/>=<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtDate[1]<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/><ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;WrtDate[0];</highlight></codeline>
<codeline lineno="825"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="826"><highlight class="normal"></highlight></codeline>
<codeline lineno="827"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a5bd24ee8ccb96c8d105368ab92202b8f" kindref="member">size</ref><sp/>=<sp/><ref refid="fat__types_8h_1a79f47acd161cf6d4943a43745c179a6e" kindref="member">FAT_HTONL</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;FileSize);</highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;<ref refid="structfs__dir__ent_1a6286cbb9d382cacf4e15b03ffd0c352c" kindref="member">cluster</ref><sp/>=<sp/>(<ref refid="fat__types_8h_1abbb9c5db3bb96b1398c9b011870c335b" kindref="member">FAT_HTONS</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;FstClusHI)<sp/>&lt;&lt;<sp/>16)<sp/>|<sp/><ref refid="fat__types_8h_1abbb9c5db3bb96b1398c9b011870c335b" kindref="member">FAT_HTONS</ref>(<ref refid="structdirectoryEntry" kindref="compound">directoryEntry</ref>-&gt;FstClusLO);</highlight></codeline>
<codeline lineno="829"><highlight class="normal"></highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Next<sp/>starting<sp/>position</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="831"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1a79e4d964afc1d3bdfcf7e9d2626b62bd" kindref="member">offset</ref><sp/>=<sp/>item<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="832"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>result<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="834"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="835"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="comment">//<sp/>end<sp/>of<sp/>for</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="836"><highlight class="normal"></highlight></codeline>
<codeline lineno="837"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>reached<sp/>end<sp/>of<sp/>the<sp/>dir<sp/>move<sp/>onto<sp/>next<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="838"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1aecc41c4832bec5e4d6af1a2b16b04ac4" kindref="member">sector</ref>++;</highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dirls-&gt;<ref refid="structfs__dir__list__status_1a79e4d964afc1d3bdfcf7e9d2626b62bd" kindref="member">offset</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="844"><highlight class="normal"></highlight></codeline>
<codeline lineno="845"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="846"><highlight class="normal">}</highlight></codeline>
<codeline lineno="847"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c"/>
  </compounddef>
</doxygen>
