<?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__format_8c" kind="file" language="C++">
    <compoundname>fat_format.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>
    <includes refid="fat__format_8h" local="yes">fat_format.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="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="1">
        <label>C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c</label>
        <link refid="fat__format_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>
        <childnode refid="21" relation="include">
        </childnode>
      </node>
      <node id="21">
        <label>fat_format.h</label>
        <link refid="fat__format_8h"/>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="16" 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>
    <innerclass refid="structsec__per__clus__table" prot="public">sec_per_clus_table</innerclass>
      <sectiondef kind="var">
      <memberdef kind="variable" id="fat__format_8c_1a6e7fb465153c7b01f723860f1b62a45d" prot="public" static="no" mutable="no">
        <type>struct <ref refid="structsec__per__clus__table" kindref="compound">sec_per_clus_table</ref></type>
        <definition>struct sec_per_clus_table _cluster_size_table16[]</definition>
        <argsstring>[]</argsstring>
        <name>_cluster_size_table16</name>
        <initializer>=
{
    { 32680, 2},    
    { 262144, 4},   
    { 524288, 8},   
    { 1048576, 16}, 
    { 2097152, 32}, 
    { 4194304, 64}, 
    { 8388608, 128},
    { 0 , 0 }       
}</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="63" column="29" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="52" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="fat__format_8c_1a4a1e7e5201e8fe2115b7bd0a8ec35bd2" prot="public" static="no" mutable="no">
        <type>struct <ref refid="structsec__per__clus__table" kindref="compound">sec_per_clus_table</ref></type>
        <definition>struct sec_per_clus_table _cluster_size_table32[]</definition>
        <argsstring>[]</argsstring>
        <name>_cluster_size_table32</name>
        <initializer>=
{
    { 532480, 1},     
    { 16777216, 8},   
    { 33554432, 16},  
    { 67108864, 32},  
    { 0xFFFFFFFF, 64},
    { 0 , 0 }         
}</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="63" column="29" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="64" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="fat__format_8c_1a4591b740410de71a68b2601d6e728432" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref></type>
        <definition>static uint8 fatfs_calc_cluster_size</definition>
        <argsstring>(uint32 sectors, int is_fat32)</argsstring>
        <name>fatfs_calc_cluster_size</name>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>sectors</declname>
        </param>
        <param>
          <type>int</type>
          <declname>is_fat32</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="77" column="14" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="77" bodyend="95"/>
      </memberdef>
      <memberdef kind="function" id="fat__format_8c_1ad809894c02fde1f06cb8ffc19a5eb69a" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int fatfs_create_boot_sector</definition>
        <argsstring>(struct fatfs *fs, uint32 boot_sector_lba, uint32 vol_sectors, const char *name, int is_fat32)</argsstring>
        <name>fatfs_create_boot_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>boot_sector_lba</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>vol_sectors</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type>
          <declname>name</declname>
        </param>
        <param>
          <type>int</type>
          <declname>is_fat32</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="115" column="12" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="115" bodyend="347"/>
      </memberdef>
      <memberdef kind="function" id="fat__format_8c_1ae21e1dda1df6715204a32634c3f9eb2c" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int fatfs_create_fsinfo_sector</definition>
        <argsstring>(struct fatfs *fs, uint32 sector_lba)</argsstring>
        <name>fatfs_create_fsinfo_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>sector_lba</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="351" column="12" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="351" bodyend="388"/>
      </memberdef>
      <memberdef kind="function" id="fat__format_8c_1a42ff479b3c0673062dc14e4d40c8b2ef" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int fatfs_erase_fat</definition>
        <argsstring>(struct fatfs *fs, int is_fat32)</argsstring>
        <name>fatfs_erase_fat</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type>int</type>
          <declname>is_fat32</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="392" column="12" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="392" bodyend="422"/>
      </memberdef>
      <memberdef kind="function" id="fat__format_8c_1abd23553825f73d2b164b550e9c9ece42" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int fatfs_erase_sectors</definition>
        <argsstring>(struct fatfs *fs, uint32 lba, int count)</argsstring>
        <name>fatfs_erase_sectors</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>int</type>
          <declname>count</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="99" column="12" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="99" bodyend="111"/>
      </memberdef>
      <memberdef kind="function" id="fat__format_8c_1a8958cfd5dc4bfceb08f41e50e54da92d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_format</definition>
        <argsstring>(struct fatfs *fs, uint32 volume_sectors, const char *name)</argsstring>
        <name>fatfs_format</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>volume_sectors</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type>
          <declname>name</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="524" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="524" bodyend="531"/>
        <references refid="fat__format_8c_1a7e6b1990138851af406cd5fc667569d6" compoundref="fat__format_8c" startline="426" endline="471">fatfs_format_fat16</references>
        <references refid="fat__format_8c_1a44986a3210ea48d5274da16dd60d27c1" compoundref="fat__format_8c" startline="475" endline="520">fatfs_format_fat32</references>
        <references refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" compoundref="pci_8c" startline="37">name</references>
        <referencedby refid="fat__filelib_8h_1af3d1cddac050fee30d1420e68b01e7c2" compoundref="fat__filelib_8c" startline="1476" endline="1478">fl_format</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__format_8c_1a7e6b1990138851af406cd5fc667569d6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_format_fat16</definition>
        <argsstring>(struct fatfs *fs, uint32 volume_sectors, const char *name)</argsstring>
        <name>fatfs_format_fat16</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>volume_sectors</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type>
          <declname>name</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="426" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="426" bodyend="471"/>
        <references refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" compoundref="fat__defs_8h" startline="109">FAT32_INVALID_CLUSTER</references>
        <references refid="fat__access_8h_1a2ffc1cf01469bc98451356bac154af38" compoundref="fat__access_8h" startline="11">FAT_INIT_MEDIA_ACCESS_ERROR</references>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <references refid="fat__table_8c_1acee4d83639e6fa1a228aec05618140e6" compoundref="fat__table_8c" startline="60" endline="79">fatfs_fat_init</references>
        <referencedby refid="fat__format_8h_1a8958cfd5dc4bfceb08f41e50e54da92d" compoundref="fat__format_8c" startline="524" endline="531">fatfs_format</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__format_8c_1a44986a3210ea48d5274da16dd60d27c1" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_format_fat32</definition>
        <argsstring>(struct fatfs *fs, uint32 volume_sectors, const char *name)</argsstring>
        <name>fatfs_format_fat32</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>volume_sectors</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type>
          <declname>name</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" line="475" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c" bodystart="475" bodyend="520"/>
        <references refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" compoundref="fat__defs_8h" startline="109">FAT32_INVALID_CLUSTER</references>
        <references refid="fat__access_8h_1a2ffc1cf01469bc98451356bac154af38" compoundref="fat__access_8h" startline="11">FAT_INIT_MEDIA_ACCESS_ERROR</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>
        <referencedby refid="fat__format_8h_1a8958cfd5dc4bfceb08f41e50e54da92d" compoundref="fat__format_8c" startline="524" endline="531">fatfs_format</referencedby>
      </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><highlight class="preprocessor">#include<sp/>&quot;<ref refid="fat__format_8h" kindref="compound">fat_format.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_FORMAT_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Tables</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="46" refid="structsec__per__clus__table" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsec__per__clus__table" kindref="compound">sec_per_clus_table</ref></highlight></codeline>
<codeline lineno="47"><highlight class="normal">{</highlight></codeline>
<codeline lineno="48" refid="structsec__per__clus__table_1a7f836c999e6750764ea47e4faf15cacc" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/><sp/><ref refid="structsec__per__clus__table_1a7f836c999e6750764ea47e4faf15cacc" kindref="member">sectors</ref>;</highlight></codeline>
<codeline lineno="49" refid="structsec__per__clus__table_1a7009c7be6eceedeefc3973baee0fc524" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/><sp/><sp/><ref refid="structsec__per__clus__table_1a7009c7be6eceedeefc3973baee0fc524" kindref="member">sectors_per_cluster</ref>;</highlight></codeline>
<codeline lineno="50"><highlight class="normal">};</highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight></codeline>
<codeline lineno="52" refid="fat__format_8c_1a6e7fb465153c7b01f723860f1b62a45d" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsec__per__clus__table" kindref="compound">sec_per_clus_table</ref><sp/><ref refid="fat__format_8c_1a6e7fb465153c7b01f723860f1b62a45d" kindref="member">_cluster_size_table16</ref>[]<sp/>=</highlight></codeline>
<codeline lineno="53"><highlight class="normal">{</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>32680,<sp/>2},<sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>16MB<sp/>-<sp/>1K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>262144,<sp/>4},<sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>128MB<sp/>-<sp/>2K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>524288,<sp/>8},<sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>256MB<sp/>-<sp/>4K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>1048576,<sp/>16},<sp/></highlight><highlight class="comment">//<sp/>512MB<sp/>-<sp/>8K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>2097152,<sp/>32},<sp/></highlight><highlight class="comment">//<sp/>1GB<sp/>-<sp/>16K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>4194304,<sp/>64},<sp/></highlight><highlight class="comment">//<sp/>2GB<sp/>-<sp/>32K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>8388608,<sp/>128},</highlight><highlight class="comment">//<sp/>2GB<sp/>-<sp/>64K<sp/>[Warning<sp/>only<sp/>supported<sp/>by<sp/>Windows<sp/>XP<sp/>onwards]</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>0<sp/>,<sp/>0<sp/>}<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Invalid</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal">};</highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight></codeline>
<codeline lineno="64" refid="fat__format_8c_1a4a1e7e5201e8fe2115b7bd0a8ec35bd2" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structsec__per__clus__table" kindref="compound">sec_per_clus_table</ref><sp/><ref refid="fat__format_8c_1a4a1e7e5201e8fe2115b7bd0a8ec35bd2" kindref="member">_cluster_size_table32</ref>[]<sp/>=</highlight></codeline>
<codeline lineno="65"><highlight class="normal">{</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>532480,<sp/>1},<sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>260MB<sp/>-<sp/>512b</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>16777216,<sp/>8},<sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>8GB<sp/>-<sp/>4K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>33554432,<sp/>16},<sp/><sp/></highlight><highlight class="comment">//<sp/>16GB<sp/>-<sp/>8K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>67108864,<sp/>32},<sp/><sp/></highlight><highlight class="comment">//<sp/>32GB<sp/>-<sp/>16K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>0xFFFFFFFF,<sp/>64},</highlight><highlight class="comment">//<sp/>&gt;32GB<sp/>-<sp/>32K</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>0<sp/>,<sp/>0<sp/>}<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Invalid</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal">};</highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_calc_cluster_size:<sp/>Calculate<sp/>what<sp/>cluster<sp/>size<sp/>should<sp/>be<sp/>used</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>fatfs_calc_cluster_size(<ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/><ref refid="structsec__per__clus__table_1a7f836c999e6750764ea47e4faf15cacc" kindref="member">sectors</ref>,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>is_fat32)</highlight></codeline>
<codeline lineno="78"><highlight class="normal">{</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!is_fat32)</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;<sp/><ref refid="fat__format_8c_1a6e7fb465153c7b01f723860f1b62a45d" kindref="member">_cluster_size_table16</ref>[i].<ref refid="structsec__per__clus__table_1a7009c7be6eceedeefc3973baee0fc524" kindref="member">sectors_per_cluster</ref><sp/>!=<sp/>0;i++)</highlight></codeline>
<codeline lineno="84"><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="structsec__per__clus__table_1a7f836c999e6750764ea47e4faf15cacc" kindref="member">sectors</ref><sp/>&lt;=<sp/><ref refid="fat__format_8c_1a6e7fb465153c7b01f723860f1b62a45d" kindref="member">_cluster_size_table16</ref>[i].<ref refid="structsec__per__clus__table_1a7f836c999e6750764ea47e4faf15cacc" kindref="member">sectors</ref>)</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__format_8c_1a6e7fb465153c7b01f723860f1b62a45d" kindref="member">_cluster_size_table16</ref>[i].<ref refid="structsec__per__clus__table_1a7009c7be6eceedeefc3973baee0fc524" kindref="member">sectors_per_cluster</ref>;</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;<sp/><ref refid="fat__format_8c_1a4a1e7e5201e8fe2115b7bd0a8ec35bd2" kindref="member">_cluster_size_table32</ref>[i].<ref refid="structsec__per__clus__table_1a7009c7be6eceedeefc3973baee0fc524" kindref="member">sectors_per_cluster</ref><sp/>!=<sp/>0;i++)</highlight></codeline>
<codeline lineno="90"><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="structsec__per__clus__table_1a7f836c999e6750764ea47e4faf15cacc" kindref="member">sectors</ref><sp/>&lt;=<sp/><ref refid="fat__format_8c_1a4a1e7e5201e8fe2115b7bd0a8ec35bd2" kindref="member">_cluster_size_table32</ref>[i].<ref refid="structsec__per__clus__table_1a7f836c999e6750764ea47e4faf15cacc" kindref="member">sectors</ref>)</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__format_8c_1a4a1e7e5201e8fe2115b7bd0a8ec35bd2" kindref="member">_cluster_size_table32</ref>[i].<ref refid="structsec__per__clus__table_1a7009c7be6eceedeefc3973baee0fc524" kindref="member">sectors_per_cluster</ref>;</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="93"><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="95"><highlight class="normal">}</highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_erase_sectors:<sp/>Erase<sp/>a<sp/>number<sp/>of<sp/>sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fatfs_erase_sectors(</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/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>count)</highlight></codeline>
<codeline lineno="100"><highlight class="normal">{</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Zero<sp/>sector<sp/>first</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0,<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>);</highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;count;i++)</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(lba<sp/>+<sp/>i,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1))</highlight></codeline>
<codeline lineno="108"><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/>0;</highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="111"><highlight class="normal">}</highlight></codeline>
<codeline lineno="112"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="113"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_create_boot_sector:<sp/>Create<sp/>the<sp/>boot<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fatfs_create_boot_sector(</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/>boot_sector_lba,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>vol_sectors,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>is_fat32)</highlight></codeline>
<codeline lineno="116"><highlight class="normal">{</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>total_clusters;</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Zero<sp/>sector<sp/>initially</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0,<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>);</highlight></codeline>
<codeline lineno="122"><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>OEM<sp/>Name<sp/>&amp;<sp/>Jump<sp/>Code</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[0]<sp/>=<sp/>0xEB;</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[1]<sp/>=<sp/>0x3C;</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[2]<sp/>=<sp/>0x90;</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[3]<sp/>=<sp/>0x4D;</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[4]<sp/>=<sp/>0x53;</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[5]<sp/>=<sp/>0x44;</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[6]<sp/>=<sp/>0x4F;</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[7]<sp/>=<sp/>0x53;</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[8]<sp/>=<sp/>0x35;</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[9]<sp/>=<sp/>0x2E;</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[10]<sp/>=<sp/>0x30;</highlight></codeline>
<codeline lineno="135"><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Bytes<sp/>per<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[11]<sp/>=<sp/>(<ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref><sp/>&gt;&gt;<sp/>0)<sp/>&amp;<sp/>0xFF;</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[12]<sp/>=<sp/>(<ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref><sp/>&gt;&gt;<sp/>8)<sp/>&amp;<sp/>0xFF;</highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>sectors<sp/>per<sp/>cluster<sp/>size<sp/>for<sp/>the<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster<sp/>=<sp/>fatfs_calc_cluster_size(vol_sectors,<sp/>is_fat32);</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster)</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;<sp/></highlight><highlight class="comment">//<sp/>Invalid<sp/>disk<sp/>size</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="normal"></highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sectors<sp/>per<sp/>cluster</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[13]<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster;</highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Reserved<sp/>Sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!is_fat32)</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;reserved_sectors<sp/>=<sp/>8;</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;reserved_sectors<sp/>=<sp/>32;</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[14]<sp/>=<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;reserved_sectors<sp/>&gt;&gt;<sp/>0)<sp/>&amp;<sp/>0xFF;</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[15]<sp/>=<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;reserved_sectors<sp/>&gt;&gt;<sp/>8)<sp/>&amp;<sp/>0xFF;</highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Number<sp/>of<sp/>FATS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;num_of_fats<sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[16]<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;num_of_fats;</highlight></codeline>
<codeline lineno="159"><highlight class="normal"></highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Max<sp/>entries<sp/>in<sp/>root<sp/>dir<sp/>(FAT16<sp/>only)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!is_fat32)</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;root_entry_count<sp/>=<sp/>512;</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[17]<sp/>=<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;root_entry_count<sp/>&gt;&gt;<sp/>0)<sp/>&amp;<sp/>0xFF;</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[18]<sp/>=<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;root_entry_count<sp/>&gt;&gt;<sp/>8)<sp/>&amp;<sp/>0xFF;</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;root_entry_count<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[17]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[18]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="173"><highlight class="normal"></highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>[FAT16]<sp/>Total<sp/>sectors<sp/>(use<sp/>FAT32<sp/>count<sp/>instead)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[19]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[20]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="177"><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Media<sp/>type</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[21]<sp/>=<sp/>0xF8;</highlight></codeline>
<codeline lineno="180"><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"></highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT16<sp/>BS<sp/>Details</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!is_fat32)</highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Count<sp/>of<sp/>sectors<sp/>used<sp/>by<sp/>the<sp/>FAT<sp/>table<sp/>(FAT16<sp/>only)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>total_clusters<sp/>=<sp/>(vol_sectors<sp/>/<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster)<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors<sp/>=<sp/>(total_clusters/(<ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>/2))<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[22]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors<sp/>&gt;&gt;<sp/>0)<sp/>&amp;<sp/>0xFF);</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[23]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors<sp/>&gt;&gt;<sp/>8)<sp/>&amp;<sp/>0xFF);</highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sectors<sp/>per<sp/>track</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[24]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[25]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="194"><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Heads</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[26]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[27]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Hidden<sp/>sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[28]<sp/>=<sp/>0x20;</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[29]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[30]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[31]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="204"><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Total<sp/>sectors<sp/>for<sp/>this<sp/>volume</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[32]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;0)&amp;0xFF);</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[33]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;8)&amp;0xFF);</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[34]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;16)&amp;0xFF);</highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[35]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;24)&amp;0xFF);</highlight></codeline>
<codeline lineno="210"><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Drive<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[36]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="213"><highlight class="normal"></highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Reserved</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[37]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="216"><highlight class="normal"></highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Boot<sp/>signature</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[38]<sp/>=<sp/>0x29;</highlight></codeline>
<codeline lineno="219"><highlight class="normal"></highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>ID</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[39]<sp/>=<sp/>0x12;</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[40]<sp/>=<sp/>0x34;</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[41]<sp/>=<sp/>0x56;</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[42]<sp/>=<sp/>0x78;</highlight></codeline>
<codeline lineno="225"><highlight class="normal"></highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>name</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;11;i++)</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="229"><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/>(i<sp/>&lt;<sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)<ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>))</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[i+43]<sp/>=<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>[i];</highlight></codeline>
<codeline lineno="231"><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="232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[i+43]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="234"><highlight class="normal"></highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>File<sp/>sys<sp/>type</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[54]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;F&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[55]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;A&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[56]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;T&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[57]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;1&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[58]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;6&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[59]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[60]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[61]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="244"><highlight class="normal"></highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Signature</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[510]<sp/>=<sp/>0x55;</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[511]<sp/>=<sp/>0xAA;</highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT32<sp/>BS<sp/>Details</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Count<sp/>of<sp/>sectors<sp/>used<sp/>by<sp/>the<sp/>FAT<sp/>table<sp/>(FAT16<sp/>only)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[22]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[23]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="255"><highlight class="normal"></highlight></codeline>
<codeline lineno="256"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sectors<sp/>per<sp/>track<sp/>(default)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[24]<sp/>=<sp/>0x3F;</highlight></codeline>
<codeline lineno="258"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[25]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="259"><highlight class="normal"></highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Heads<sp/>(default)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[26]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[27]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="263"><highlight class="normal"></highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Hidden<sp/>sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[28]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[29]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[30]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[31]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="269"><highlight class="normal"></highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Total<sp/>sectors<sp/>for<sp/>this<sp/>volume</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[32]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;0)&amp;0xFF);</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[33]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;8)&amp;0xFF);</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[34]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;16)&amp;0xFF);</highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[35]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((vol_sectors&gt;&gt;24)&amp;0xFF);</highlight></codeline>
<codeline lineno="275"><highlight class="normal"></highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>total_clusters<sp/>=<sp/>(vol_sectors<sp/>/<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster)<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors<sp/>=<sp/>(total_clusters/(<ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>/4))<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="278"><highlight class="normal"></highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>BPB_FATSz32</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[36]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors&gt;&gt;0)&amp;0xFF);</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[37]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors&gt;&gt;8)&amp;0xFF);</highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[38]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors&gt;&gt;16)&amp;0xFF);</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[39]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors&gt;&gt;24)&amp;0xFF);</highlight></codeline>
<codeline lineno="284"><highlight class="normal"></highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>BPB_ExtFlags</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[40]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[41]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="288"><highlight class="normal"></highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>BPB_FSVer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[42]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[43]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="292"><highlight class="normal"></highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>BPB_RootClus</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[44]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster&gt;&gt;0)&amp;0xFF);</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[45]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster&gt;&gt;8)&amp;0xFF);</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[46]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster&gt;&gt;16)&amp;0xFF);</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[47]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster&gt;&gt;24)&amp;0xFF);</highlight></codeline>
<codeline lineno="298"><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>BPB_FSInfo</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[48]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fs_info_sector&gt;&gt;0)&amp;0xFF);</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[49]<sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref>)((<ref refid="structfs" kindref="compound">fs</ref>-&gt;fs_info_sector&gt;&gt;8)&amp;0xFF);</highlight></codeline>
<codeline lineno="302"><highlight class="normal"></highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>BPB_BkBootSec</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[50]<sp/>=<sp/>6;</highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[51]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="306"><highlight class="normal"></highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Drive<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[64]<sp/>=<sp/>0x00;</highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Boot<sp/>signature</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[66]<sp/>=<sp/>0x29;</highlight></codeline>
<codeline lineno="312"><highlight class="normal"></highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>ID</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[67]<sp/>=<sp/>0x12;</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[68]<sp/>=<sp/>0x34;</highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[69]<sp/>=<sp/>0x56;</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[70]<sp/>=<sp/>0x78;</highlight></codeline>
<codeline lineno="318"><highlight class="normal"></highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>name</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;11;i++)</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="322"><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/>(i<sp/>&lt;<sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)<ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>))</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[i+71]<sp/>=<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>[i];</highlight></codeline>
<codeline lineno="324"><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="325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[i+71]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="327"><highlight class="normal"></highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>File<sp/>sys<sp/>type</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[82]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;F&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[83]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;A&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[84]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;T&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[85]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;3&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[86]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;2&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[87]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[88]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[89]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;<sp/>&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="337"><highlight class="normal"></highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Signature</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[510]<sp/>=<sp/>0x55;</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[511]<sp/>=<sp/>0xAA;</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="342"><highlight class="normal"></highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(boot_sector_lba,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1))</highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="347"><highlight class="normal">}</highlight></codeline>
<codeline lineno="348"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="349"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_create_fsinfo_sector:<sp/>Create<sp/>the<sp/>FSInfo<sp/>sector<sp/>(FAT32)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="350"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="351"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fatfs_create_fsinfo_sector(</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/>sector_lba)</highlight></codeline>
<codeline lineno="352"><highlight class="normal">{</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Zero<sp/>sector<sp/>initially</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0,<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>);</highlight></codeline>
<codeline lineno="355"><highlight class="normal"></highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FSI_LeadSig</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[0]<sp/>=<sp/>0x52;</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[1]<sp/>=<sp/>0x52;</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[2]<sp/>=<sp/>0x61;</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[3]<sp/>=<sp/>0x41;</highlight></codeline>
<codeline lineno="361"><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FSI_StrucSig</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[484]<sp/>=<sp/>0x72;</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[485]<sp/>=<sp/>0x72;</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[486]<sp/>=<sp/>0x41;</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[487]<sp/>=<sp/>0x61;</highlight></codeline>
<codeline lineno="367"><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FSI_Free_Count</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[488]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[489]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[490]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[491]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="373"><highlight class="normal"></highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FSI_Nxt_Free</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[492]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[493]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[494]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[495]<sp/>=<sp/>0xFF;</highlight></codeline>
<codeline lineno="379"><highlight class="normal"></highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Signature</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[510]<sp/>=<sp/>0x55;</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector[511]<sp/>=<sp/>0xAA;</highlight></codeline>
<codeline lineno="383"><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(sector_lba,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1))</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="388"><highlight class="normal">}</highlight></codeline>
<codeline lineno="389"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="390"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_erase_fat:<sp/>Erase<sp/>FAT<sp/>table<sp/>using<sp/>fs<sp/>details<sp/>in<sp/>fs<sp/>struct</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="391"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="392"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fatfs_erase_fat(</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="keywordtype">int</highlight><highlight class="normal"><sp/>is_fat32)</highlight></codeline>
<codeline lineno="393"><highlight class="normal">{</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>i;</highlight></codeline>
<codeline lineno="395"><highlight class="normal"></highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Zero<sp/>sector<sp/>initially</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0,<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>);</highlight></codeline>
<codeline lineno="398"><highlight class="normal"></highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialise<sp/>default<sp/>allocate<sp/>/<sp/>reserved<sp/>clusters</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!is_fat32)</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8h_1a187f3aa267c44c2bb1cdd55d27a2dbf4" kindref="member">SET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0,<sp/>0xFFF8);</highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8h_1a187f3aa267c44c2bb1cdd55d27a2dbf4" kindref="member">SET_16BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>2,<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8h_1a33478d59d8bd88a65f6d9c35f9a8ee02" kindref="member">SET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0,<sp/>0x0FFFFFF8);</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8h_1a33478d59d8bd88a65f6d9c35f9a8ee02" kindref="member">SET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>4,<sp/>0xFFFFFFFF);</highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__misc_8h_1a33478d59d8bd88a65f6d9c35f9a8ee02" kindref="member">SET_32BIT_WORD</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>8,<sp/>0x0FFFFFFF);</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="411"><highlight class="normal"></highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</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;fat_begin_lba<sp/>+<sp/>0,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1))</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="414"><highlight class="normal"></highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Zero<sp/>remaining<sp/>FAT<sp/>sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>0,<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>);</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=1;i&lt;<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors*<ref refid="structfs" kindref="compound">fs</ref>-&gt;num_of_fats;i++)</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</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;fat_begin_lba<sp/>+<sp/>i,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.sector,<sp/>1))</highlight></codeline>
<codeline lineno="419"><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/>0;</highlight></codeline>
<codeline lineno="420"><highlight class="normal"></highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="422"><highlight class="normal">}</highlight></codeline>
<codeline lineno="423"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="424"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_format_fat16:<sp/>Format<sp/>a<sp/>FAT16<sp/>partition</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="425"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="426" refid="fat__format_8h_1a7e6b1990138851af406cd5fc667569d6" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__format_8c_1a7e6b1990138851af406cd5fc667569d6" kindref="member">fatfs_format_fat16</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/>volume_sectors,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>)</highlight></codeline>
<codeline lineno="427"><highlight class="normal">{</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><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="429"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.dirty<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="430"><highlight class="normal"></highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><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="432"><highlight class="normal"></highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><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="434"><highlight class="normal"></highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Make<sp/>sure<sp/>we<sp/>have<sp/>read<sp/>+<sp/>write<sp/>functions</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media<sp/>||<sp/>!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media)</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/><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="438"><highlight class="normal"></highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>is<sp/>FAT16</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="440"><highlight class="normal"><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="441"><highlight class="normal"></highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Not<sp/>valid<sp/>for<sp/>FAT16</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fs_info_sector<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="445"><highlight class="normal"></highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sector<sp/>0:<sp/>Boot<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>NOTE:<sp/>We<sp/>don&apos;t<sp/>need<sp/>an<sp/>MBR,<sp/>it<sp/>is<sp/>a<sp/>waste<sp/>of<sp/>a<sp/>good<sp/>sector!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_create_boot_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin,<sp/>volume_sectors,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>0))</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="451"><highlight class="normal"></highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><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="453"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_sector<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;reserved_sectors<sp/>+<sp/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;num_of_fats<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors);</highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><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="455"><highlight class="normal"></highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>First<sp/>FAT<sp/>LBA<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/><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/><ref refid="structfs" kindref="compound">fs</ref>-&gt;reserved_sectors;</highlight></codeline>
<codeline lineno="458"><highlight class="normal"></highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><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="460"><highlight class="normal"><sp/><sp/><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/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;num_of_fats<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors);</highlight></codeline>
<codeline lineno="461"><highlight class="normal"></highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialise<sp/>FAT<sp/>sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_erase_fat(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>0))</highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="465"><highlight class="normal"></highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Erase<sp/>Root<sp/>directory</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_erase_sectors(<ref refid="structfs" kindref="compound">fs</ref>,<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/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_sectors))</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="469"><highlight class="normal"></highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="471"><highlight class="normal">}</highlight></codeline>
<codeline lineno="472"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="473"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_format_fat32:<sp/>Format<sp/>a<sp/>FAT32<sp/>partition</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="474"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="475" refid="fat__format_8h_1a44986a3210ea48d5274da16dd60d27c1" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__format_8c_1a44986a3210ea48d5274da16dd60d27c1" kindref="member">fatfs_format_fat32</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/>volume_sectors,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>)</highlight></codeline>
<codeline lineno="476"><highlight class="normal">{</highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><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="478"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;currentsector.dirty<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="479"><highlight class="normal"></highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><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="481"><highlight class="normal"></highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/><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="483"><highlight class="normal"></highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Make<sp/>sure<sp/>we<sp/>have<sp/>read<sp/>+<sp/>write<sp/>functions</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.read_media<sp/>||<sp/>!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media)</highlight></codeline>
<codeline lineno="486"><highlight class="normal"><sp/><sp/><sp/><sp/><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="487"><highlight class="normal"></highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Volume<sp/>is<sp/>FAT32</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="489"><highlight class="normal"><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="490"><highlight class="normal"></highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Basic<sp/>defaults<sp/>for<sp/>normal<sp/>FAT32<sp/>partitions</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fs_info_sector<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster<sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="494"><highlight class="normal"></highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sector<sp/>0:<sp/>Boot<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>NOTE:<sp/>We<sp/>don&apos;t<sp/>need<sp/>an<sp/>MBR,<sp/>it<sp/>is<sp/>a<sp/>waste<sp/>of<sp/>a<sp/>good<sp/>sector!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_create_boot_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin,<sp/>volume_sectors,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>1))</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="500"><highlight class="normal"></highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>First<sp/>FAT<sp/>LBA<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><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/><ref refid="structfs" kindref="compound">fs</ref>-&gt;reserved_sectors;</highlight></codeline>
<codeline lineno="503"><highlight class="normal"></highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><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="505"><highlight class="normal"><sp/><sp/><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/>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;num_of_fats<sp/>*<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors);</highlight></codeline>
<codeline lineno="506"><highlight class="normal"></highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialise<sp/>FSInfo<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_create_fsinfo_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fs_info_sector))</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="510"><highlight class="normal"></highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialise<sp/>FAT<sp/>sectors</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_erase_fat(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>1))</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="514"><highlight class="normal"></highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Erase<sp/>Root<sp/>directory</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_erase_sectors(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__access_8c_1adda5a5dde3548cd09943efcbe5534c62" kindref="member">fatfs_lba_of_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;rootdir_first_cluster),<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;sectors_per_cluster))</highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="518"><highlight class="normal"></highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="520"><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_format:<sp/>Format<sp/>a<sp/>partition<sp/>with<sp/>either<sp/>FAT16<sp/>or<sp/>FAT32<sp/>based<sp/>on<sp/>size</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" refid="fat__format_8h_1a8958cfd5dc4bfceb08f41e50e54da92d" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__format_8c_1a8958cfd5dc4bfceb08f41e50e54da92d" kindref="member">fatfs_format</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/>volume_sectors,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>)</highlight></codeline>
<codeline lineno="525"><highlight class="normal">{</highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>2GB<sp/>-<sp/>32K<sp/>limit<sp/>for<sp/>safe<sp/>behaviour<sp/>for<sp/>FAT16</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(volume_sectors<sp/>&lt;=<sp/>4194304)</highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__format_8c_1a7e6b1990138851af406cd5fc667569d6" kindref="member">fatfs_format_fat16</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>volume_sectors,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__format_8c_1a44986a3210ea48d5274da16dd60d27c1" kindref="member">fatfs_format_fat32</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>volume_sectors,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="531"><highlight class="normal">}</highlight></codeline>
<codeline lineno="532"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*FATFS_INC_FORMAT_SUPPORT*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c"/>
  </compounddef>
</doxygen>
