<?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__table_8c" kind="file" language="C++">
    <compoundname>fat_table.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>
    <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="1">
        <label>C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c</label>
        <link refid="fat__table_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>
      </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="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="18">
        <label>fat_misc.h</label>
        <link refid="fat__misc_8h"/>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>fat_opts.h</label>
        <link refid="fat__opts_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
    </incdepgraph>
      <sectiondef kind="define">
      <memberdef kind="define" id="fat__table_8c_1a9082df82fd33440e77f0562ad1aab170" prot="public" static="no">
        <name>FAT16_GET_16BIT_WORD</name>
        <param><defname>pbuf</defname></param>
        <param><defname>location</defname></param>
        <initializer>( <ref refid="fat__misc_8h_1ad253d9c5238132f5ee8cf06638f87829" kindref="member">GET_16BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;ptr, location) )</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="54" column="9" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="54" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="fat__table_8c_1a27ec80884b91839c4bee7151a5e217cd" prot="public" static="no">
        <name>FAT16_SET_16BIT_WORD</name>
        <param><defname>pbuf</defname></param>
        <param><defname>location</defname></param>
        <param><defname>value</defname></param>
        <initializer>{ <ref refid="fat__misc_8h_1a187f3aa267c44c2bb1cdd55d27a2dbf4" kindref="member">SET_16BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;ptr, location, value); <ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;dirty = 1; }</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="55" column="9" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="55" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="fat__table_8c_1a0a6522450298f8a790c9f1d65f48127c" prot="public" static="no">
        <name>FAT32_GET_32BIT_WORD</name>
        <param><defname>pbuf</defname></param>
        <param><defname>location</defname></param>
        <initializer>( <ref refid="fat__misc_8h_1a857557cc9a2fc6a7f721a2960dcc6f33" kindref="member">GET_32BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;ptr, location) )</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="52" column="9" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="52" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="fat__table_8c_1abb5f187f6fb765eef1e56176c6c5b181" prot="public" static="no">
        <name>FAT32_SET_32BIT_WORD</name>
        <param><defname>pbuf</defname></param>
        <param><defname>location</defname></param>
        <param><defname>value</defname></param>
        <initializer>{ <ref refid="fat__misc_8h_1a33478d59d8bd88a65f6d9c35f9a8ee02" kindref="member">SET_32BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;ptr, location, value); <ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;dirty = 1; }</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="53" column="9" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="53" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="fat__table_8c_1aa75d9d34a1735e3691f800a075966018" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
        <definition>uint32 fatfs_count_free_clusters</definition>
        <argsstring>(struct fatfs *fs)</argsstring>
        <name>fatfs_count_free_clusters</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="445" column="8" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="445" bodyend="478"/>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1af55ecc38d5888e53106fd26fd6805d5c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_fat_add_cluster_to_chain</definition>
        <argsstring>(struct fatfs *fs, uint32 start_cluster, uint32 newEntry)</argsstring>
        <name>fatfs_fat_add_cluster_to_chain</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>start_cluster</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>newEntry</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="414" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="414" bodyend="440"/>
        <references refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" compoundref="fat__defs_8h" startline="108">FAT32_LAST_CLUSTER</references>
        <references refid="fat__table_8c_1a9869304acfd1d264b8cebe1561dfe60a" compoundref="fat__table_8c" startline="349" endline="383">fatfs_fat_set_cluster</references>
        <references refid="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" compoundref="fat__table_8c" startline="205" endline="256">fatfs_find_next_cluster</references>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1acee4d83639e6fa1a228aec05618140e6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void fatfs_fat_init</definition>
        <argsstring>(struct fatfs *fs)</argsstring>
        <name>fatfs_fat_init</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="60" column="6" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="60" bodyend="79"/>
        <references refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" compoundref="fat__defs_8h" startline="109">FAT32_INVALID_CLUSTER</references>
        <references refid="fat__opts_8h_1aa9354e4947875cd05f1d02b6e1f0ae96" compoundref="fat__opts_8h" startline="35">FAT_BUFFERS</references>
        <references refid="string_8h_1ace4b911463887af5e748326323e99a23">memset</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <referencedby refid="fat__format_8h_1a7e6b1990138851af406cd5fc667569d6" compoundref="fat__format_8c" startline="426" endline="471">fatfs_format_fat16</referencedby>
        <referencedby refid="fat__format_8h_1a44986a3210ea48d5274da16dd60d27c1" compoundref="fat__format_8c" startline="475" endline="520">fatfs_format_fat32</referencedby>
        <referencedby refid="fat__access_8h_1a79896ebc01463ec2121874995ea7d922" compoundref="fat__access_8c" startline="43" endline="186">fatfs_init</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1a4122bbba15645ebdeea241ef7bcb663e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_fat_purge</definition>
        <argsstring>(struct fatfs *fs)</argsstring>
        <name>fatfs_fat_purge</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="179" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="179" bodyend="195"/>
        <references refid="structfat__buffer_1a1679a1936a7f1862e0a13389f03f7270" compoundref="fat__access_8h" startline="44">fat_buffer::dirty</references>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1a4c9f91dc01184ac4d14ebb394dc1f648" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structfat__buffer" kindref="compound">fat_buffer</ref> *</type>
        <definition>static struct fat_buffer* fatfs_fat_read_sector</definition>
        <argsstring>(struct fatfs *fs, uint32 sector)</argsstring>
        <name>fatfs_fat_read_sector</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>sector</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="116" column="24" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="116" bodyend="175"/>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1a9869304acfd1d264b8cebe1561dfe60a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_fat_set_cluster</definition>
        <argsstring>(struct fatfs *fs, uint32 cluster, uint32 next_cluster)</argsstring>
        <name>fatfs_fat_set_cluster</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>cluster</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>next_cluster</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="349" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="349" bodyend="383"/>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <referencedby refid="fat__write_8h_1ae8950d150955379c297d1ac53583f8e0" compoundref="fat__write_8c" startline="45" endline="76">fatfs_add_free_space</referencedby>
        <referencedby refid="fat__write_8h_1a68d609a89800a61f700b18500a56d30a" compoundref="fat__write_8c" startline="82" endline="125">fatfs_allocate_free_space</referencedby>
        <referencedby refid="fat__table_8h_1af55ecc38d5888e53106fd26fd6805d5c" compoundref="fat__table_8c" startline="414" endline="440">fatfs_fat_add_cluster_to_chain</referencedby>
        <referencedby refid="fat__table_8h_1a7a329446088ccb4d6348f05fcd848ee4" compoundref="fat__table_8c" startline="389" endline="407">fatfs_free_cluster_chain</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1a7bc1a88313e8353189dc0ca6ef108a76" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int fatfs_fat_writeback</definition>
        <argsstring>(struct fatfs *fs, struct fat_buffer *pcur)</argsstring>
        <name>fatfs_fat_writeback</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type>struct <ref refid="structfat__buffer" kindref="compound">fat_buffer</ref> *</type>
          <declname>pcur</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="83" column="12" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="83" bodyend="112"/>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1a595276233a4e5f4696cb6030ec54ed64" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_find_blank_cluster</definition>
        <argsstring>(struct fatfs *fs, uint32 start_cluster, uint32 *free_cluster)</argsstring>
        <name>fatfs_find_blank_cluster</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>start_cluster</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref> *</type>
          <declname>free_cluster</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="288" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="288" bodyend="342"/>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <referencedby refid="fat__write_8h_1ae8950d150955379c297d1ac53583f8e0" compoundref="fat__write_8c" startline="45" endline="76">fatfs_add_free_space</referencedby>
        <referencedby refid="fat__write_8h_1a68d609a89800a61f700b18500a56d30a" compoundref="fat__write_8c" startline="82" endline="125">fatfs_allocate_free_space</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
        <definition>uint32 fatfs_find_next_cluster</definition>
        <argsstring>(struct fatfs *fs, uint32 current_cluster)</argsstring>
        <name>fatfs_find_next_cluster</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>current_cluster</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="205" column="8" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="205" bodyend="256"/>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <referencedby refid="fat__table_8h_1af55ecc38d5888e53106fd26fd6805d5c" compoundref="fat__table_8c" startline="414" endline="440">fatfs_fat_add_cluster_to_chain</referencedby>
        <referencedby refid="fat__table_8h_1a7a329446088ccb4d6348f05fcd848ee4" compoundref="fat__table_8c" startline="389" endline="407">fatfs_free_cluster_chain</referencedby>
        <referencedby refid="fat__access_8h_1aaa34effab2043ace65e92d060a0e74c5" compoundref="fat__access_8c" startline="213" endline="258">fatfs_sector_reader</referencedby>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1a7a329446088ccb4d6348f05fcd848ee4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int fatfs_free_cluster_chain</definition>
        <argsstring>(struct fatfs *fs, uint32 start_cluster)</argsstring>
        <name>fatfs_free_cluster_chain</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>start_cluster</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="389" column="5" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="389" bodyend="407"/>
        <references refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" compoundref="fat__defs_8h" startline="108">FAT32_LAST_CLUSTER</references>
        <references refid="fat__table_8c_1a9869304acfd1d264b8cebe1561dfe60a" compoundref="fat__table_8c" startline="349" endline="383">fatfs_fat_set_cluster</references>
        <references refid="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" compoundref="fat__table_8c" startline="205" endline="256">fatfs_find_next_cluster</references>
      </memberdef>
      <memberdef kind="function" id="fat__table_8c_1a41c8ddc94d8c036d0b62a67c021a0d71" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void fatfs_set_fs_info_next_free_cluster</definition>
        <argsstring>(struct fatfs *fs, uint32 newValue)</argsstring>
        <name>fatfs_set_fs_info_next_free_cluster</name>
        <param>
          <type>struct <ref refid="structfatfs" kindref="compound">fatfs</ref> *</type>
          <declname>fs</declname>
        </param>
        <param>
          <type><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref></type>
          <declname>newValue</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" line="260" column="6" bodyfile="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c" bodystart="260" bodyend="283"/>
        <references refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" compoundref="fat__access_8h" startline="53">FAT_TYPE_16</references>
        <referencedby refid="fat__write_8h_1ae8950d150955379c297d1ac53583f8e0" compoundref="fat__write_8c" startline="45" endline="76">fatfs_add_free_space</referencedby>
        <referencedby refid="fat__write_8h_1a68d609a89800a61f700b18500a56d30a" compoundref="fat__write_8c" startline="82" endline="125">fatfs_allocate_free_space</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></codeline>
<codeline lineno="37"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>FAT_BUFFERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#define<sp/>FAT_BUFFERS<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>FAT_BUFFER_SECTORS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#define<sp/>FAT_BUFFER_SECTORS<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FAT_BUFFERS<sp/>&lt;<sp/>1<sp/>||<sp/>FAT_BUFFER_SECTORS<sp/>&lt;<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#error<sp/>&quot;FAT_BUFFERS<sp/>&amp;<sp/>FAT_BUFFER_SECTORS<sp/>must<sp/>be<sp/>at<sp/>least<sp/>1&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><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/>FAT<sp/>Sector<sp/>Buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="52" refid="fat__table_8c_1a0a6522450298f8a790c9f1d65f48127c" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>FAT32_GET_32BIT_WORD(pbuf,<sp/>location)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<sp/>GET_32BIT_WORD(pbuf-&gt;ptr,<sp/>location)<sp/>)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="53" refid="fat__table_8c_1abb5f187f6fb765eef1e56176c6c5b181" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>FAT32_SET_32BIT_WORD(pbuf,<sp/>location,<sp/>value)<sp/>{<sp/>SET_32BIT_WORD(pbuf-&gt;ptr,<sp/>location,<sp/>value);<sp/>pbuf-&gt;dirty<sp/>=<sp/>1;<sp/>}</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54" refid="fat__table_8c_1a9082df82fd33440e77f0562ad1aab170" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>FAT16_GET_16BIT_WORD(pbuf,<sp/>location)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<sp/>GET_16BIT_WORD(pbuf-&gt;ptr,<sp/>location)<sp/>)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55" refid="fat__table_8c_1a27ec80884b91839c4bee7151a5e217cd" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>FAT16_SET_16BIT_WORD(pbuf,<sp/>location,<sp/>value)<sp/>{<sp/>SET_16BIT_WORD(pbuf-&gt;ptr,<sp/>location,<sp/>value);<sp/>pbuf-&gt;dirty<sp/>=<sp/>1;<sp/>}</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_fat_init:</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60" refid="fat__table_8h_1acee4d83639e6fa1a228aec05618140e6" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="fat__table_8c_1acee4d83639e6fa1a228aec05618140e6" kindref="member">fatfs_fat_init</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>)</highlight></codeline>
<codeline lineno="61"><highlight class="normal">{</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FAT<sp/>buffer<sp/>chain<sp/>head</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffer_head<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i&lt;<ref refid="fat__opts_8h_1aa9354e4947875cd05f1d02b6e1f0ae96" kindref="member">FAT_BUFFERS</ref>;i++)</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialise<sp/>buffers<sp/>to<sp/>invalid</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffers[i].address<sp/>=<sp/><ref refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" kindref="member">FAT32_INVALID_CLUSTER</ref>;</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffers[i].dirty<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffers[i].sector,<sp/>0x00,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffers[i].sector));</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffers[i].ptr<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Add<sp/>to<sp/>head<sp/>of<sp/>queue</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffers[i].next<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffer_head;</highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffer_head<sp/>=<sp/>&amp;<ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffers[i];</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="79"><highlight class="normal">}</highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_fat_writeback:<sp/>Writeback<sp/>&apos;dirty&apos;<sp/>FAT<sp/>sectors<sp/>to<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>fatfs_fat_writeback(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*pcur)</highlight></codeline>
<codeline lineno="84"><highlight class="normal">{</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcur)</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Writeback<sp/>sector<sp/>if<sp/>changed</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcur-&gt;<ref refid="structfat__buffer_1a1679a1936a7f1862e0a13389f03f7270" kindref="member">dirty</ref>)</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</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="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media)</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>sectors<sp/>=<sp/><ref refid="fat__opts_8h_1a16d1dd1641be9f2d5b9bc7016d3e4558" kindref="member">FAT_BUFFER_SECTORS</ref>;</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>offset<sp/>=<sp/>pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref><sp/>-<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba;</highlight></codeline>
<codeline lineno="94"><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Limit<sp/>to<sp/>sectors<sp/>used<sp/>for<sp/>the<sp/>FAT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((offset<sp/>+<sp/><ref refid="fat__opts_8h_1a16d1dd1641be9f2d5b9bc7016d3e4558" kindref="member">FAT_BUFFER_SECTORS</ref>)<sp/>&lt;=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors)</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sectors<sp/>=<sp/><ref refid="fat__opts_8h_1a16d1dd1641be9f2d5b9bc7016d3e4558" kindref="member">FAT_BUFFER_SECTORS</ref>;</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sectors<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors<sp/>-<sp/>offset;</highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref>,<sp/>pcur-&gt;<ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref>,<sp/>sectors))</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcur-&gt;<ref refid="structfat__buffer_1a1679a1936a7f1862e0a13389f03f7270" kindref="member">dirty</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><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="109"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><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="112"><highlight class="normal">}</highlight></codeline>
<codeline lineno="113"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_fat_read_sector:<sp/>Read<sp/>a<sp/>FAT<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*fatfs_fat_read_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/><ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref>)</highlight></codeline>
<codeline lineno="117"><highlight class="normal">{</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*last<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*pcur<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffer_head;</highlight></codeline>
<codeline lineno="120"><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Itterate<sp/>through<sp/>sector<sp/>buffer<sp/>list</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pcur)</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sector<sp/>within<sp/>this<sp/>buffer?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref><sp/>&gt;=<sp/>pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref>)<sp/>&amp;&amp;<sp/>(<ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref><sp/>&lt;<sp/>(pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref><sp/>+<sp/><ref refid="fat__opts_8h_1a16d1dd1641be9f2d5b9bc7016d3e4558" kindref="member">FAT_BUFFER_SECTORS</ref>)))</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="127"><highlight class="normal"></highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>End<sp/>of<sp/>list?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcur-&gt;<ref refid="structfat__buffer_1a7bf0427e8229c466e093aad4563ce369" kindref="member">next</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Remove<sp/>buffer<sp/>from<sp/>list</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><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/>(last)</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>last-&gt;<ref refid="structfat__buffer_1a7bf0427e8229c466e093aad4563ce369" kindref="member">next</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>We<sp/>the<sp/>first<sp/>and<sp/>last<sp/>buffer<sp/>in<sp/>the<sp/>chain?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="135"><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="136"><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;fat_buffer_head<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="138"><highlight class="normal"></highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>last<sp/>=<sp/>pcur;</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcur<sp/>=<sp/>pcur-&gt;<ref refid="structfat__buffer_1a7bf0427e8229c466e093aad4563ce369" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="142"><highlight class="normal"></highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>We<sp/>found<sp/>the<sp/>sector<sp/>already<sp/>in<sp/>FAT<sp/>buffer<sp/>chain</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcur)</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcur-&gt;<ref refid="structfat__buffer_1acc02e408347f85e6c24db4574365e102" kindref="member">ptr</ref><sp/>=<sp/>(<ref refid="fat__types_8h_1adde6aaee8457bee49c2a92621fe22b79" kindref="member">uint8</ref><sp/>*)(pcur-&gt;<ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref><sp/>+<sp/>((<ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref><sp/>-<sp/>pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref>)<sp/>*<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>));</highlight></codeline>
<codeline lineno="147"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pcur;</highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="149"><highlight class="normal"></highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Else,<sp/>we<sp/>removed<sp/>the<sp/>last<sp/>item<sp/>from<sp/>the<sp/>list</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/>pcur<sp/>=<sp/>last;</highlight></codeline>
<codeline lineno="152"><highlight class="normal"></highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Add<sp/>to<sp/>start<sp/>of<sp/>sector<sp/>buffer<sp/>list<sp/>(now<sp/>newest<sp/>sector)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/>pcur-&gt;<ref refid="structfat__buffer_1a7bf0427e8229c466e093aad4563ce369" kindref="member">next</ref><sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffer_head;</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffer_head<sp/>=<sp/>pcur;</highlight></codeline>
<codeline lineno="156"><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Writeback<sp/>sector<sp/>if<sp/>changed</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcur-&gt;<ref refid="structfat__buffer_1a1679a1936a7f1862e0a13389f03f7270" kindref="member">dirty</ref>)</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!fatfs_fat_writeback(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>pcur))</highlight></codeline>
<codeline lineno="160"><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="161"><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Address<sp/>is<sp/>now<sp/>new<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/>pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref><sp/>=<sp/><ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref>;</highlight></codeline>
<codeline lineno="164"><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>next<sp/>sector</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><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(pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref>,<sp/>pcur-&gt;<ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref>,<sp/><ref refid="fat__opts_8h_1a16d1dd1641be9f2d5b9bc7016d3e4558" kindref="member">FAT_BUFFER_SECTORS</ref>))</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>failed,<sp/>invalidate<sp/>buffer<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcur-&gt;<ref refid="structfat__buffer_1aac81891a2e6cdeceeb0b875b1b5aaad6" kindref="member">address</ref><sp/>=<sp/><ref refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" kindref="member">FAT32_INVALID_CLUSTER</ref>;</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="172"><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/>pcur-&gt;<ref refid="structfat__buffer_1acc02e408347f85e6c24db4574365e102" kindref="member">ptr</ref><sp/>=<sp/>pcur-&gt;<ref refid="structfat__buffer_1ad26f6eb3714e0ea2cdb08e22cb6d1ae1" kindref="member">sector</ref>;</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pcur;</highlight></codeline>
<codeline lineno="175"><highlight class="normal">}</highlight></codeline>
<codeline lineno="176"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_fat_purge:<sp/>Purge<sp/>&apos;dirty&apos;<sp/>FAT<sp/>sectors<sp/>to<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="179" refid="fat__table_8h_1a4122bbba15645ebdeea241ef7bcb663e" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__table_8c_1a4122bbba15645ebdeea241ef7bcb663e" kindref="member">fatfs_fat_purge</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>)</highlight></codeline>
<codeline lineno="180"><highlight class="normal">{</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*pcur<sp/>=<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_buffer_head;</highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Itterate<sp/>through<sp/>sector<sp/>buffer<sp/>list</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pcur)</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Writeback<sp/>sector<sp/>if<sp/>changed</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcur-&gt;<ref refid="structfat__buffer_1a1679a1936a7f1862e0a13389f03f7270" kindref="member">dirty</ref>)</highlight></codeline>
<codeline lineno="188"><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/>(!fatfs_fat_writeback(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>pcur))</highlight></codeline>
<codeline lineno="189"><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/>0;</highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcur<sp/>=<sp/>pcur-&gt;<ref refid="structfat__buffer_1a7bf0427e8229c466e093aad4563ce369" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="193"><highlight class="normal"></highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="195"><highlight class="normal">}</highlight></codeline>
<codeline lineno="196"><highlight class="normal"></highlight></codeline>
<codeline lineno="197"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>General<sp/>FAT<sp/>Table<sp/>Operations</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="200"><highlight class="normal"></highlight></codeline>
<codeline lineno="201"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="202"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_find_next_cluster:<sp/>Return<sp/>cluster<sp/>number<sp/>of<sp/>next<sp/>cluster<sp/>in<sp/>chain<sp/>by</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="203"><highlight class="normal"></highlight><highlight class="comment">//<sp/>reading<sp/>FAT<sp/>table<sp/>and<sp/>traversing<sp/>it.<sp/>Return<sp/>0xffffffff<sp/>for<sp/>end<sp/>of<sp/>chain.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="204"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="205" refid="fat__table_8h_1af6297d64179e09d929493451ab68d6e6" refkind="member"><highlight class="normal"><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/><ref refid="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" kindref="member">fatfs_find_next_cluster</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>current_cluster)</highlight></codeline>
<codeline lineno="206"><highlight class="normal">{</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>fat_sector_offset,<sp/>position;</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>nextcluster;</highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*<ref refid="structpbuf" kindref="compound">pbuf</ref>;</highlight></codeline>
<codeline lineno="210"><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Why<sp/>is<sp/>&apos;..&apos;<sp/>labelled<sp/>with<sp/>cluster<sp/>0<sp/>when<sp/>it<sp/>should<sp/>be<sp/>2<sp/>??</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(current_cluster<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>current_cluster<sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>which<sp/>sector<sp/>of<sp/>FAT<sp/>table<sp/>to<sp/>read</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="216"><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;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>)</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fat_sector_offset<sp/>=<sp/>current_cluster<sp/>/<sp/>256;</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fat_sector_offset<sp/>=<sp/>current_cluster<sp/>/<sp/>128;</highlight></codeline>
<codeline lineno="220"><highlight class="normal"></highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>FAT<sp/>sector<sp/>into<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>=<sp/>fatfs_fat_read_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba+fat_sector_offset);</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structpbuf" kindref="compound">pbuf</ref>)</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>);</highlight></codeline>
<codeline lineno="225"><highlight class="normal"></highlight></codeline>
<codeline lineno="226"><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;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>)</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>32<sp/>bit<sp/>entry<sp/>of<sp/>current<sp/>sector<sp/>relating<sp/>to<sp/>cluster<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>position<sp/>=<sp/>(current_cluster<sp/>-<sp/>(fat_sector_offset<sp/>*<sp/>256))<sp/>*<sp/>2;</highlight></codeline>
<codeline lineno="230"><highlight class="normal"></highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>Next<sp/>Clusters<sp/>value<sp/>from<sp/>Sector<sp/>Buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nextcluster<sp/>=<sp/><ref refid="fat__table_8c_1a9082df82fd33440e77f0562ad1aab170" kindref="member">FAT16_GET_16BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)position);</highlight></codeline>
<codeline lineno="233"><highlight class="normal"></highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>end<sp/>of<sp/>chain<sp/>found</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(nextcluster<sp/>&gt;=<sp/>0xFFF8<sp/>&amp;&amp;<sp/>nextcluster<sp/>&lt;=<sp/>0xFFFF)</highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>);</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>32<sp/>bit<sp/>entry<sp/>of<sp/>current<sp/>sector<sp/>relating<sp/>to<sp/>cluster<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>position<sp/>=<sp/>(current_cluster<sp/>-<sp/>(fat_sector_offset<sp/>*<sp/>128))<sp/>*<sp/>4;</highlight></codeline>
<codeline lineno="242"><highlight class="normal"></highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>Next<sp/>Clusters<sp/>value<sp/>from<sp/>Sector<sp/>Buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nextcluster<sp/>=<sp/><ref refid="fat__table_8c_1a0a6522450298f8a790c9f1d65f48127c" kindref="member">FAT32_GET_32BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)position);</highlight></codeline>
<codeline lineno="245"><highlight class="normal"></highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Mask<sp/>out<sp/>MS<sp/>4<sp/>bits<sp/>(its<sp/>28bit<sp/>addressing)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nextcluster<sp/>=<sp/>nextcluster<sp/>&amp;<sp/>0x0FFFFFFF;</highlight></codeline>
<codeline lineno="248"><highlight class="normal"></highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>end<sp/>of<sp/>chain<sp/>found</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(nextcluster<sp/>&gt;=<sp/>0x0FFFFFF8<sp/>&amp;&amp;<sp/>nextcluster<sp/>&lt;=<sp/>0x0FFFFFFF)</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>);</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="253"><highlight class="normal"></highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Else<sp/>return<sp/>next<sp/>cluster</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(nextcluster);</highlight></codeline>
<codeline lineno="256"><highlight class="normal">}</highlight></codeline>
<codeline lineno="257"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="258"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_set_fs_info_next_free_cluster:<sp/>Write<sp/>the<sp/>next<sp/>free<sp/>cluster<sp/>to<sp/>the<sp/>FSINFO<sp/>table</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="259"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="260" refid="fat__table_8h_1a41c8ddc94d8c036d0b62a67c021a0d71" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="fat__table_8c_1a41c8ddc94d8c036d0b62a67c021a0d71" kindref="member">fatfs_set_fs_info_next_free_cluster</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>newValue)</highlight></codeline>
<codeline lineno="261"><highlight class="normal">{</highlight></codeline>
<codeline lineno="262"><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;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>)</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Load<sp/>sector<sp/>to<sp/>change<sp/>it</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*<ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>=<sp/>fatfs_fat_read_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;lba_begin+<ref refid="structfs" kindref="compound">fs</ref>-&gt;fs_info_sector);</highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structpbuf" kindref="compound">pbuf</ref>)</highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>return<sp/>;</highlight></codeline>
<codeline lineno="270"><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Change</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__table_8c_1abb5f187f6fb765eef1e56176c6c5b181" kindref="member">FAT32_SET_32BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>492,<sp/>newValue);</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;next_free_cluster<sp/>=<sp/>newValue;</highlight></codeline>
<codeline lineno="274"><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>back<sp/>FSINFO<sp/>sector<sp/>to<sp/>disk</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="276"><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)</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;disk_io.write_media(<ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;address,<sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;sector,<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/>Invalidate<sp/>cache<sp/>entry</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;address<sp/>=<sp/><ref refid="fat__defs_8h_1a8dd000b545e9a127169fdbd82d418965" kindref="member">FAT32_INVALID_CLUSTER</ref>;</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>-&gt;dirty<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="283"><highlight class="normal">}</highlight></codeline>
<codeline lineno="284"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="285"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_find_blank_cluster:<sp/>Find<sp/>a<sp/>free<sp/>cluster<sp/>entry<sp/>by<sp/>reading<sp/>the<sp/>FAT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="287"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="288" refid="fat__table_8h_1a595276233a4e5f4696cb6030ec54ed64" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__table_8c_1a595276233a4e5f4696cb6030ec54ed64" kindref="member">fatfs_find_blank_cluster</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>start_cluster,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>*free_cluster)</highlight></codeline>
<codeline lineno="289"><highlight class="normal">{</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>fat_sector_offset,<sp/>position;</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>nextcluster;</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>current_cluster<sp/>=<sp/>start_cluster;</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*<ref refid="structpbuf" kindref="compound">pbuf</ref>;</highlight></codeline>
<codeline lineno="294"><highlight class="normal"></highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>which<sp/>sector<sp/>of<sp/>FAT<sp/>table<sp/>to<sp/>read</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="298"><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;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>)</highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fat_sector_offset<sp/>=<sp/>current_cluster<sp/>/<sp/>256;</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fat_sector_offset<sp/>=<sp/>current_cluster<sp/>/<sp/>128;</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="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>fat_sector_offset<sp/>&lt;<sp/>fs-&gt;fat_sectors)</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>FAT<sp/>sector<sp/>into<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>=<sp/>fatfs_fat_read_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba+fat_sector_offset);</highlight></codeline>
<codeline lineno="307"><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="structpbuf" kindref="compound">pbuf</ref>)</highlight></codeline>
<codeline lineno="308"><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/>0;</highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><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="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="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>32<sp/>bit<sp/>entry<sp/>of<sp/>current<sp/>sector<sp/>relating<sp/>to<sp/>cluster<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>position<sp/>=<sp/>(current_cluster<sp/>-<sp/>(fat_sector_offset<sp/>*<sp/>256))<sp/>*<sp/>2;</highlight></codeline>
<codeline lineno="314"><highlight class="normal"></highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>Next<sp/>Clusters<sp/>value<sp/>from<sp/>Sector<sp/>Buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nextcluster<sp/>=<sp/><ref refid="fat__table_8c_1a9082df82fd33440e77f0562ad1aab170" kindref="member">FAT16_GET_16BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)position);</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="318"><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="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>32<sp/>bit<sp/>entry<sp/>of<sp/>current<sp/>sector<sp/>relating<sp/>to<sp/>cluster<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>position<sp/>=<sp/>(current_cluster<sp/>-<sp/>(fat_sector_offset<sp/>*<sp/>128))<sp/>*<sp/>4;</highlight></codeline>
<codeline lineno="322"><highlight class="normal"></highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>Next<sp/>Clusters<sp/>value<sp/>from<sp/>Sector<sp/>Buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nextcluster<sp/>=<sp/><ref refid="fat__table_8c_1a0a6522450298f8a790c9f1d65f48127c" kindref="member">FAT32_GET_32BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)position);</highlight></codeline>
<codeline lineno="325"><highlight class="normal"></highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Mask<sp/>out<sp/>MS<sp/>4<sp/>bits<sp/>(its<sp/>28bit<sp/>addressing)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nextcluster<sp/>=<sp/>nextcluster<sp/>&amp;<sp/>0x0FFFFFFF;</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="329"><highlight class="normal"></highlight></codeline>
<codeline lineno="330"><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/>(nextcluster<sp/>!=0<sp/>)</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>current_cluster++;</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Otherwise,<sp/>run<sp/>out<sp/>of<sp/>FAT<sp/>sectors<sp/>to<sp/>check...</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="335"><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="336"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(nextcluster<sp/>!=<sp/>0x0);</highlight></codeline>
<codeline lineno="338"><highlight class="normal"></highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Found<sp/>blank<sp/>entry</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/>*free_cluster<sp/>=<sp/>current_cluster;</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="342"><highlight class="normal">}</highlight></codeline>
<codeline lineno="343"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="344"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="345"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_fat_set_cluster:<sp/>Set<sp/>a<sp/>cluster<sp/>link<sp/>in<sp/>the<sp/>chain.<sp/>NOTE:<sp/>Immediate</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"></highlight><highlight class="comment">//<sp/>write<sp/>(slow).</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="347"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="348"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="349" refid="fat__table_8h_1a9869304acfd1d264b8cebe1561dfe60a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__table_8c_1a9869304acfd1d264b8cebe1561dfe60a" kindref="member">fatfs_fat_set_cluster</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>cluster,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>next_cluster)</highlight></codeline>
<codeline lineno="350"><highlight class="normal">{</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*<ref refid="structpbuf" kindref="compound">pbuf</ref>;</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>fat_sector_offset,<sp/>position;</highlight></codeline>
<codeline lineno="353"><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>which<sp/>sector<sp/>of<sp/>FAT<sp/>table<sp/>to<sp/>read</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="355"><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;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>)</highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fat_sector_offset<sp/>=<sp/>cluster<sp/>/<sp/>256;</highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fat_sector_offset<sp/>=<sp/>cluster<sp/>/<sp/>128;</highlight></codeline>
<codeline lineno="359"><highlight class="normal"></highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>FAT<sp/>sector<sp/>into<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>=<sp/>fatfs_fat_read_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba+fat_sector_offset);</highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structpbuf" kindref="compound">pbuf</ref>)</highlight></codeline>
<codeline lineno="363"><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="364"><highlight class="normal"></highlight></codeline>
<codeline lineno="365"><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;fat_type<sp/>==<sp/><ref refid="fat__access_8h_1abd20c4673fcbadb1753696ba8353a13ba5ba99630da99c25c9e9efd7ed0bebf51" kindref="member">FAT_TYPE_16</ref>)</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>16<sp/>bit<sp/>entry<sp/>of<sp/>current<sp/>sector<sp/>relating<sp/>to<sp/>cluster<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>position<sp/>=<sp/>(cluster<sp/>-<sp/>(fat_sector_offset<sp/>*<sp/>256))<sp/>*<sp/>2;</highlight></codeline>
<codeline lineno="369"><highlight class="normal"></highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>Next<sp/>Clusters<sp/>value<sp/>to<sp/>Sector<sp/>Buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__table_8c_1a27ec80884b91839c4bee7151a5e217cd" kindref="member">FAT16_SET_16BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)position,<sp/>((<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)next_cluster));</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>32<sp/>bit<sp/>entry<sp/>of<sp/>current<sp/>sector<sp/>relating<sp/>to<sp/>cluster<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>position<sp/>=<sp/>(cluster<sp/>-<sp/>(fat_sector_offset<sp/>*<sp/>128))<sp/>*<sp/>4;</highlight></codeline>
<codeline lineno="377"><highlight class="normal"></highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Write<sp/>Next<sp/>Clusters<sp/>value<sp/>to<sp/>Sector<sp/>Buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__table_8c_1abb5f187f6fb765eef1e56176c6c5b181" kindref="member">FAT32_SET_32BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)position,<sp/>next_cluster);</highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="381"><highlight class="normal"></highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="383"><highlight class="normal">}</highlight></codeline>
<codeline lineno="384"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="385"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="386"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_free_cluster_chain:<sp/>Follow<sp/>a<sp/>chain<sp/>marking<sp/>each<sp/>element<sp/>as<sp/>free</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="387"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="388"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="389" refid="fat__table_8h_1a7a329446088ccb4d6348f05fcd848ee4" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__table_8c_1a7a329446088ccb4d6348f05fcd848ee4" kindref="member">fatfs_free_cluster_chain</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>start_cluster)</highlight></codeline>
<codeline lineno="390"><highlight class="normal">{</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>last_cluster;</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>next_cluster<sp/>=<sp/>start_cluster;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"></highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Loop<sp/>until<sp/>end<sp/>of<sp/>chain</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<sp/>(next_cluster<sp/>!=<sp/><ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>)<sp/>&amp;&amp;<sp/>(next_cluster<sp/>!=<sp/>0x00000000)<sp/>)</highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>last_cluster<sp/>=<sp/>next_cluster;</highlight></codeline>
<codeline lineno="398"><highlight class="normal"></highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>next<sp/>link</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>next_cluster<sp/>=<sp/><ref refid="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" kindref="member">fatfs_find_next_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>next_cluster);</highlight></codeline>
<codeline lineno="401"><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Clear<sp/>last<sp/>link</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="fat__table_8c_1a9869304acfd1d264b8cebe1561dfe60a" kindref="member">fatfs_fat_set_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>last_cluster,<sp/>0x00000000);</highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="405"><highlight class="normal"></highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="407"><highlight class="normal">}</highlight></codeline>
<codeline lineno="408"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="409"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="410"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_fat_add_cluster_to_chain:<sp/>Follow<sp/>a<sp/>chain<sp/>marking<sp/>and<sp/>then<sp/>add<sp/>a<sp/>new<sp/>entry</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="411"><highlight class="normal"></highlight><highlight class="comment">//<sp/>to<sp/>the<sp/>current<sp/>tail.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="412"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="413"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>FATFS_INC_WRITE_SUPPORT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="414" refid="fat__table_8h_1af55ecc38d5888e53106fd26fd6805d5c" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fat__table_8c_1af55ecc38d5888e53106fd26fd6805d5c" kindref="member">fatfs_fat_add_cluster_to_chain</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structfatfs" kindref="compound">fatfs</ref><sp/>*<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>start_cluster,<sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>newEntry)</highlight></codeline>
<codeline lineno="415"><highlight class="normal">{</highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>last_cluster<sp/>=<sp/><ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>;</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>next_cluster<sp/>=<sp/>start_cluster;</highlight></codeline>
<codeline lineno="418"><highlight class="normal"></highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(start_cluster<sp/>==<sp/><ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>)</highlight></codeline>
<codeline lineno="420"><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="421"><highlight class="normal"></highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Loop<sp/>until<sp/>end<sp/>of<sp/>chain</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<sp/>next_cluster<sp/>!=<sp/><ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref><sp/>)</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>last_cluster<sp/>=<sp/>next_cluster;</highlight></codeline>
<codeline lineno="426"><highlight class="normal"></highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>next<sp/>link</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>next_cluster<sp/>=<sp/><ref refid="fat__table_8c_1af6297d64179e09d929493451ab68d6e6" kindref="member">fatfs_find_next_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>next_cluster);</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!next_cluster)</highlight></codeline>
<codeline lineno="430"><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="431"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="432"><highlight class="normal"></highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Add<sp/>link<sp/>in<sp/>for<sp/>new<sp/>cluster</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__table_8c_1a9869304acfd1d264b8cebe1561dfe60a" kindref="member">fatfs_fat_set_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>last_cluster,<sp/>newEntry);</highlight></codeline>
<codeline lineno="435"><highlight class="normal"></highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Mark<sp/>new<sp/>cluster<sp/>as<sp/>end<sp/>of<sp/>chain</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__table_8c_1a9869304acfd1d264b8cebe1561dfe60a" kindref="member">fatfs_fat_set_cluster</ref>(<ref refid="structfs" kindref="compound">fs</ref>,<sp/>newEntry,<sp/><ref refid="fat__defs_8h_1a6542eeb37905e8f378fb8f3e5e94d083" kindref="member">FAT32_LAST_CLUSTER</ref>);</highlight></codeline>
<codeline lineno="438"><highlight class="normal"></highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="440"><highlight class="normal">}</highlight></codeline>
<codeline lineno="441"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="442"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fatfs_count_free_clusters:</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="444"><highlight class="normal"></highlight><highlight class="comment">//-----------------------------------------------------------------------------</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="445" refid="fat__table_8h_1aa75d9d34a1735e3691f800a075966018" refkind="member"><highlight class="normal"><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/><ref refid="fat__table_8c_1aa75d9d34a1735e3691f800a075966018" kindref="member">fatfs_count_free_clusters</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>)</highlight></codeline>
<codeline lineno="446"><highlight class="normal">{</highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>i,j;</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="fat__types_8h_1a4b435a49c74bb91f284f075e63416cb6" kindref="member">uint32</ref><sp/>count<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfat__buffer" kindref="compound">fat_buffer</ref><sp/>*<ref refid="structpbuf" kindref="compound">pbuf</ref>;</highlight></codeline>
<codeline lineno="450"><highlight class="normal"></highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_sectors;<sp/>i++)</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Read<sp/>FAT<sp/>sector<sp/>into<sp/>buffer</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>=<sp/>fatfs_fat_read_sector(<ref refid="structfs" kindref="compound">fs</ref>,<sp/><ref refid="structfs" kindref="compound">fs</ref>-&gt;fat_begin_lba<sp/>+<sp/>i);</highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="structpbuf" kindref="compound">pbuf</ref>)</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="457"><highlight class="normal"></highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(j<sp/>=<sp/>0;<sp/>j<sp/>&lt;<sp/><ref refid="fat__opts_8h_1a873b78b38ef34edf6291274eb0708634" kindref="member">FAT_SECTOR_SIZE</ref>;<sp/>)</highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="460"><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="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="461"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__table_8c_1a9082df82fd33440e77f0562ad1aab170" kindref="member">FAT16_GET_16BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)j)<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>count++;</highlight></codeline>
<codeline lineno="464"><highlight class="normal"></highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>+=<sp/>2;</highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="467"><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="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__table_8c_1a0a6522450298f8a790c9f1d65f48127c" kindref="member">FAT32_GET_32BIT_WORD</ref>(<ref refid="structpbuf" kindref="compound">pbuf</ref>,<sp/>(<ref refid="fat__types_8h_1a05f6b0ae8f6a6e135b0e290c25fe0e4e" kindref="member">uint16</ref>)j)<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>count++;</highlight></codeline>
<codeline lineno="471"><highlight class="normal"></highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>+=<sp/>4;</highlight></codeline>
<codeline lineno="473"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="475"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="476"><highlight class="normal"></highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>count;</highlight></codeline>
<codeline lineno="478"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c"/>
  </compounddef>
</doxygen>
