Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 8a992fb1c776bb6b7cbeab1ae2f1b737 > files > 117

avr-libc-docs-1.7.1-6.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
    <title>avr-libc: &lt;avr/boot.h&gt;: Bootloader Support Utilities</title>
    <link href="dox.css" rel="stylesheet" type="text/css">
  </head>
<body>
<center>
<table width="80%">
  <tr>
    <td align="left"><a href="http://www.nongnu.org/avr-libc/">AVR Libc Home Page</a></td>
    <td align="center" colspan=4><img src="avrs.png" alt="AVRs" align="middle" border="0"></td>
    <td align="right"><a href="https://savannah.nongnu.org/projects/avr-libc/">AVR Libc Development Pages</a></td>
  </tr>
  <tr>
    <td align="center" width="13%"><a href="index.html">Main Page</a></td>
    <td align="center" width="13%"><a href="pages.html">User Manual</a></td>
    <td align="center" width="13%"><a href="modules.html">Library Reference</a></td>
    <td align="center" width="13%"><a href="FAQ.html">FAQ</a></td>
    <td align="center" width="13%"><a href="globals.html">Alphabetical Index</a></td>
    <td align="center" width="13%"><a href="group__demos.html">Example Projects</a></td>
  </tr>
</table>
</center>
<hr width="80%">
<!-- Generated by Doxygen 1.7.2 -->
<div class="header">
  <div class="summary">
<a href="#define-members">Defines</a>  </div>
  <div class="headertitle">
<h1>&lt;avr/boot.h&gt;: Bootloader Support Utilities</h1>  </div>
</div>
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga8a60eb0985d40ff71c42bb18f0f5789e">BOOTLOADER_SECTION</a>&#160;&#160;&#160;__attribute__ ((section (&quot;.bootloader&quot;)))</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga072040fce54f112355cb9ebf9ce41dd7">boot_spm_interrupt_enable</a>()&#160;&#160;&#160;(__SPM_REG |= (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(SPMIE))</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gaf1e01d09c839793a6c0c990b1c5ae8b3">boot_spm_interrupt_disable</a>()&#160;&#160;&#160;(__SPM_REG &amp;= (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)~_BV(SPMIE))</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gacd6843d51a4fa7d68f3c4bc5aa393a3e">boot_is_spm_interrupt</a>()&#160;&#160;&#160;(__SPM_REG &amp; (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(SPMIE))</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gaaba5a29359af671a37bccaa6a77bca7c">boot_rww_busy</a>()&#160;&#160;&#160;(__SPM_REG &amp; (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(__COMMON_ASB))</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gae50dc01180110f30093a92fe64fe1565">boot_spm_busy</a>()&#160;&#160;&#160;(__SPM_REG &amp; (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(__SPM_ENABLE))</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a>()&#160;&#160;&#160;do{}while(boot_spm_busy())</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gac68c37ecf2354ba2af6e08379d65899f">GET_LOW_FUSE_BITS</a>&#160;&#160;&#160;(0x0000)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gae12d288a22cfbfa9d0cde12b1a779bfe">GET_LOCK_BITS</a>&#160;&#160;&#160;(0x0001)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gaf08aabaebbd69da659357f402d4d28ce">GET_EXTENDED_FUSE_BITS</a>&#160;&#160;&#160;(0x0002)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga44e70c9662e7ac06484144c15bc69aea">GET_HIGH_FUSE_BITS</a>&#160;&#160;&#160;(0x0003)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gad2cbdea59ffec2e77ee2e63106459797">boot_lock_fuse_bits_get</a>(address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gaf375d2543ba38dc56697b4f4bc37a717">boot_signature_byte_get</a>(addr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga61add108c778273ff68233d044c3acca">boot_page_fill</a>(address, data)&#160;&#160;&#160;__boot_page_fill_normal(address, data)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga7249d12e06789cd306583abf7def8176">boot_page_erase</a>(address)&#160;&#160;&#160;__boot_page_erase_normal(address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga013d6d8c679ebdbc0e5fac179c38c9aa">boot_page_write</a>(address)&#160;&#160;&#160;__boot_page_write_normal(address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga8d2baaca2991318e0b06fdf9a5264923">boot_rww_enable</a>()&#160;&#160;&#160;__boot_rww_enable()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gadaa352690ac1c82c535da9d8faf77590">boot_lock_bits_set</a>(lock_bits)&#160;&#160;&#160;__boot_lock_bits_set(lock_bits)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga3f549e2ef9ca0f119a7070064c4dc372">boot_page_fill_safe</a>(address, data)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga5c345350a2fb349619b859dcf0dc0466">boot_page_erase_safe</a>(address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#ga107ad4c789e5c498062947d394ed98d5">boot_page_write_safe</a>(address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gaeb0dba1dd9d338516a94c0bd8a8db78a">boot_rww_enable_safe</a>()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__avr__boot.html#gac80bd4f863ff7645204adb0eda3556ea">boot_lock_bits_set_safe</a>(lock_bits)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor">    #include &lt;<a class="code" href="io_8h.html">avr/io.h</a>&gt;</span>
<span class="preprocessor">    #include &lt;<a class="code" href="boot_8h.html">avr/boot.h</a>&gt;</span>
</pre></div><p>The macros in this module provide a C language interface to the bootloader support functionality of certain AVR processors. These macros are designed to work with all sizes of flash memory.</p>
<p>Global interrupts are not automatically disabled for these macros. It is left up to the programmer to do this. See the code example below. Also see the processor datasheet for caveats on having global interrupts enabled during writing of the Flash.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>Not all AVR processors provide bootloader support. See your processor datasheet to see if it provides bootloader support.</dd></dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000001">Todo:</a></b></dt><dd>From email with Marek: On smaller devices (all except ATmega64/128), __SPM_REG is in the I/O space, accessible with the shorter "in" and "out" instructions - since the boot loader has a limited size, this could be an important optimization.</dd></dl>
<dl class="user"><dt><b>API Usage Example</b></dt><dd>The following code shows typical usage of the boot API.</dd></dl>
<div class="fragment"><pre class="fragment"><span class="preprocessor">    #include &lt;<a class="code" href="inttypes_8h.html">inttypes.h</a>&gt;</span>
<span class="preprocessor">    #include &lt;<a class="code" href="interrupt_8h.html">avr/interrupt.h</a>&gt;</span>
<span class="preprocessor">    #include &lt;<a class="code" href="pgmspace_8h.html">avr/pgmspace.h</a>&gt;</span>
    
    <span class="keywordtype">void</span> boot_program_page (<a class="code" href="group__avr__stdint.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> page, <a class="code" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *buf)
    {
        <a class="code" href="group__avr__stdint.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a> i;
        <a class="code" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> sreg;

        <span class="comment">// Disable interrupts.</span>

        sreg = SREG;
        <a class="code" href="group__avr__interrupts.html#ga68c330e94fe121eba993e5a5973c3162">cli</a>();
    
        <a class="code" href="group__avr__eeprom.html#ga44c64ebb425fcb34b8d4dc19c4079869">eeprom_busy_wait</a> ();

        <a class="code" href="group__avr__boot.html#ga7249d12e06789cd306583abf7def8176">boot_page_erase</a> (page);
        <a class="code" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a> ();      <span class="comment">// Wait until the memory is erased.</span>

        <span class="keywordflow">for</span> (i=0; i&lt;SPM_PAGESIZE; i+=2)
        {
            <span class="comment">// Set up little-endian word.</span>

            <a class="code" href="group__avr__stdint.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a> w = *buf++;
            w += (*buf++) &lt;&lt; 8;
        
            <a class="code" href="group__avr__boot.html#ga61add108c778273ff68233d044c3acca">boot_page_fill</a> (page + i, w);
        }

        <a class="code" href="group__avr__boot.html#ga013d6d8c679ebdbc0e5fac179c38c9aa">boot_page_write</a> (page);     <span class="comment">// Store buffer in flash page.</span>
        <a class="code" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a>();       <span class="comment">// Wait until the memory is written.</span>

        <span class="comment">// Reenable RWW-section again. We need this if we want to jump back</span>
        <span class="comment">// to the application after bootloading.</span>

        <a class="code" href="group__avr__boot.html#ga8d2baaca2991318e0b06fdf9a5264923">boot_rww_enable</a> ();

        <span class="comment">// Re-enable interrupts (if they were ever enabled).</span>

        SREG = sreg;
    }
</pre></div> <hr/><h2>Define Documentation</h2>
<a class="anchor" id="gacd6843d51a4fa7d68f3c4bc5aa393a3e"></a><!-- doxytag: member="boot.h::boot_is_spm_interrupt" ref="gacd6843d51a4fa7d68f3c4bc5aa393a3e" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_is_spm_interrupt</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td>&#160;&#160;&#160;(__SPM_REG &amp; (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(SPMIE))</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Check if the SPM interrupt is enabled. </p>

</div>
</div>
<a class="anchor" id="gadaa352690ac1c82c535da9d8faf77590"></a><!-- doxytag: member="boot.h::boot_lock_bits_set" ref="gadaa352690ac1c82c535da9d8faf77590" args="(lock_bits)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_lock_bits_set</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">lock_bits&#160;)</td>
          <td>&#160;&#160;&#160;__boot_lock_bits_set(lock_bits)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Set the bootloader lock bits.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">lock_bits</td><td>A mask of which Boot Loader Lock Bits to set.</td></tr>
  </table>
  </dd>
</dl>
<dl class="note"><dt><b>Note:</b></dt><dd>In this context, a 'set bit' will be written to a zero value. Note also that only BLBxx bits can be programmed by this command.</dd></dl>
<p>For example, to disallow the SPM instruction from writing to the Boot Loader memory section of flash, you would use this macro as such:</p>
<div class="fragment"><pre class="fragment">    <a class="code" href="group__avr__boot.html#gadaa352690ac1c82c535da9d8faf77590">boot_lock_bits_set</a> (<a class="code" href="group__avr__sfr.html#ga11643f271076024c395a93800b3d9546">_BV</a> (BLB11));
</pre></div><dl class="note"><dt><b>Note:</b></dt><dd>Like any lock bits, the Boot Loader Lock Bits, once set, cannot be cleared again except by a chip erase which will in turn also erase the boot loader itself. </dd></dl>

</div>
</div>
<a class="anchor" id="gac80bd4f863ff7645204adb0eda3556ea"></a><!-- doxytag: member="boot.h::boot_lock_bits_set_safe" ref="gac80bd4f863ff7645204adb0eda3556ea" args="(lock_bits)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_lock_bits_set_safe</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">lock_bits&#160;)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \
    <a class="code" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a>();                       \
    <a class="code" href="group__avr__eeprom.html#ga44c64ebb425fcb34b8d4dc19c4079869">eeprom_busy_wait</a>();                         \
    <a class="code" href="group__avr__boot.html#gadaa352690ac1c82c535da9d8faf77590">boot_lock_bits_set</a> (lock_bits);             \
} <span class="keywordflow">while</span> (0)
</pre></div><p>Same as <a class="el" href="group__avr__boot.html#gadaa352690ac1c82c535da9d8faf77590">boot_lock_bits_set()</a> except waits for eeprom and spm operations to complete before setting the lock bits. </p>

</div>
</div>
<a class="anchor" id="gad2cbdea59ffec2e77ee2e63106459797"></a><!-- doxytag: member="boot.h::boot_lock_fuse_bits_get" ref="gad2cbdea59ffec2e77ee2e63106459797" args="(address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_lock_fuse_bits_get</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">address&#160;)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment">(__extension__({                                           \
    <a class="code" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> __result;                                      \
    __asm__ __volatile__                                   \
    (                                                      \
        <span class="stringliteral">&quot;sts %1, %2\n\t&quot;</span>                                   \
        <span class="stringliteral">&quot;lpm %0, Z\n\t&quot;</span>                                    \
        : <span class="stringliteral">&quot;=r&quot;</span> (__result)                                  \
        : <span class="stringliteral">&quot;i&quot;</span> (_SFR_MEM_ADDR(__SPM_REG)),                  \
          <span class="stringliteral">&quot;r&quot;</span> ((<a class="code" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)(__BOOT_LOCK_BITS_SET)),           \
          <span class="stringliteral">&quot;z&quot;</span> ((<a class="code" href="group__avr__stdint.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a>)(address))                        \
    );                                                     \
    __result;                                              \
}))
</pre></div><p>Read the lock or fuse bits at <code>address</code>.</p>
<p>Parameter <code>address</code> can be any of GET_LOW_FUSE_BITS, GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>The lock and fuse bits returned are the physical values, i.e. a bit returned as 0 means the corresponding fuse or lock bit is programmed. </dd></dl>

</div>
</div>
<a class="anchor" id="ga7249d12e06789cd306583abf7def8176"></a><!-- doxytag: member="boot.h::boot_page_erase" ref="ga7249d12e06789cd306583abf7def8176" args="(address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_page_erase</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">address&#160;)</td>
          <td>&#160;&#160;&#160;__boot_page_erase_normal(address)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Erase the flash page that contains address.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>address is a byte address in flash, not a word address. </dd></dl>

</div>
</div>
<a class="anchor" id="ga5c345350a2fb349619b859dcf0dc0466"></a><!-- doxytag: member="boot.h::boot_page_erase_safe" ref="ga5c345350a2fb349619b859dcf0dc0466" args="(address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_page_erase_safe</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">address&#160;)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \
    <a class="code" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a>();                       \
    <a class="code" href="group__avr__eeprom.html#ga44c64ebb425fcb34b8d4dc19c4079869">eeprom_busy_wait</a>();                         \
    <a class="code" href="group__avr__boot.html#ga7249d12e06789cd306583abf7def8176">boot_page_erase</a> (address);                  \
} <span class="keywordflow">while</span> (0)
</pre></div><p>Same as <a class="el" href="group__avr__boot.html#ga7249d12e06789cd306583abf7def8176">boot_page_erase()</a> except it waits for eeprom and spm operations to complete before erasing the page. </p>

</div>
</div>
<a class="anchor" id="ga61add108c778273ff68233d044c3acca"></a><!-- doxytag: member="boot.h::boot_page_fill" ref="ga61add108c778273ff68233d044c3acca" args="(address, data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_page_fill</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">address, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">data&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;__boot_page_fill_normal(address, data)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Fill the bootloader temporary page buffer for flash address with data word.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>The address is a byte address. The data is a word. The AVR writes data to the buffer a word at a time, but addresses the buffer per byte! So, increment your address by 2 between calls, and send 2 data bytes in a word format! The LSB of the data is written to the lower address; the MSB of the data is written to the higher address. </dd></dl>

</div>
</div>
<a class="anchor" id="ga3f549e2ef9ca0f119a7070064c4dc372"></a><!-- doxytag: member="boot.h::boot_page_fill_safe" ref="ga3f549e2ef9ca0f119a7070064c4dc372" args="(address, data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_page_fill_safe</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">address, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">data&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \
    <a class="code" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a>();                       \
    <a class="code" href="group__avr__eeprom.html#ga44c64ebb425fcb34b8d4dc19c4079869">eeprom_busy_wait</a>();                         \
    <a class="code" href="group__avr__boot.html#ga61add108c778273ff68233d044c3acca">boot_page_fill</a>(address, data);              \
} <span class="keywordflow">while</span> (0)
</pre></div><p>Same as <a class="el" href="group__avr__boot.html#ga61add108c778273ff68233d044c3acca">boot_page_fill()</a> except it waits for eeprom and spm operations to complete before filling the page. </p>

</div>
</div>
<a class="anchor" id="ga013d6d8c679ebdbc0e5fac179c38c9aa"></a><!-- doxytag: member="boot.h::boot_page_write" ref="ga013d6d8c679ebdbc0e5fac179c38c9aa" args="(address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_page_write</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">address&#160;)</td>
          <td>&#160;&#160;&#160;__boot_page_write_normal(address)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Write the bootloader temporary page buffer to flash page that contains address.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>address is a byte address in flash, not a word address. </dd></dl>

</div>
</div>
<a class="anchor" id="ga107ad4c789e5c498062947d394ed98d5"></a><!-- doxytag: member="boot.h::boot_page_write_safe" ref="ga107ad4c789e5c498062947d394ed98d5" args="(address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_page_write_safe</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">address&#160;)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \
    <a class="code" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a>();                       \
    <a class="code" href="group__avr__eeprom.html#ga44c64ebb425fcb34b8d4dc19c4079869">eeprom_busy_wait</a>();                         \
    <a class="code" href="group__avr__boot.html#ga013d6d8c679ebdbc0e5fac179c38c9aa">boot_page_write</a> (address);                  \
} <span class="keywordflow">while</span> (0)
</pre></div><p>Same as <a class="el" href="group__avr__boot.html#ga013d6d8c679ebdbc0e5fac179c38c9aa">boot_page_write()</a> except it waits for eeprom and spm operations to complete before writing the page. </p>

</div>
</div>
<a class="anchor" id="gaaba5a29359af671a37bccaa6a77bca7c"></a><!-- doxytag: member="boot.h::boot_rww_busy" ref="gaaba5a29359af671a37bccaa6a77bca7c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_rww_busy</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td>&#160;&#160;&#160;(__SPM_REG &amp; (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(__COMMON_ASB))</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Check if the RWW section is busy. </p>

</div>
</div>
<a class="anchor" id="ga8d2baaca2991318e0b06fdf9a5264923"></a><!-- doxytag: member="boot.h::boot_rww_enable" ref="ga8d2baaca2991318e0b06fdf9a5264923" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_rww_enable</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td>&#160;&#160;&#160;__boot_rww_enable()</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Enable the Read-While-Write memory section. </p>

</div>
</div>
<a class="anchor" id="gaeb0dba1dd9d338516a94c0bd8a8db78a"></a><!-- doxytag: member="boot.h::boot_rww_enable_safe" ref="gaeb0dba1dd9d338516a94c0bd8a8db78a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_rww_enable_safe</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \
    <a class="code" href="group__avr__boot.html#ga24900c15109e8b419736d4b81b093fb8">boot_spm_busy_wait</a>();                       \
    <a class="code" href="group__avr__eeprom.html#ga44c64ebb425fcb34b8d4dc19c4079869">eeprom_busy_wait</a>();                         \
    <a class="code" href="group__avr__boot.html#ga8d2baaca2991318e0b06fdf9a5264923">boot_rww_enable</a>();                          \
} <span class="keywordflow">while</span> (0)
</pre></div><p>Same as <a class="el" href="group__avr__boot.html#ga8d2baaca2991318e0b06fdf9a5264923">boot_rww_enable()</a> except waits for eeprom and spm operations to complete before enabling the RWW mameory. </p>

</div>
</div>
<a class="anchor" id="gaf375d2543ba38dc56697b4f4bc37a717"></a><!-- doxytag: member="boot.h::boot_signature_byte_get" ref="gaf375d2543ba38dc56697b4f4bc37a717" args="(addr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_signature_byte_get</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">addr&#160;)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment">(__extension__({                      \
      <a class="code" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> __result;                         \
      __asm__ __volatile__                      \
      (                                         \
        <span class="stringliteral">&quot;sts %1, %2\n\t&quot;</span>                        \
        <span class="stringliteral">&quot;lpm %0, Z&quot;</span> <span class="stringliteral">&quot;\n\t&quot;</span>                      \
        : <span class="stringliteral">&quot;=r&quot;</span> (__result)                       \
        : <span class="stringliteral">&quot;i&quot;</span> (_SFR_MEM_ADDR(__SPM_REG)),       \
          <span class="stringliteral">&quot;r&quot;</span> ((<a class="code" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)(__BOOT_SIGROW_READ)),  \
          <span class="stringliteral">&quot;z&quot;</span> ((<a class="code" href="group__avr__stdint.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a>)(addr))                \
      );                                        \
      __result;                                 \
}))
</pre></div><p>Read the Signature Row byte at <code>address</code>. For some MCU types, this function can also retrieve the factory-stored oscillator calibration bytes.</p>
<p>Parameter <code>address</code> can be 0-0x1f as documented by the datasheet. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>The values are MCU type dependent. </dd></dl>

</div>
</div>
<a class="anchor" id="gae50dc01180110f30093a92fe64fe1565"></a><!-- doxytag: member="boot.h::boot_spm_busy" ref="gae50dc01180110f30093a92fe64fe1565" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_spm_busy</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td>&#160;&#160;&#160;(__SPM_REG &amp; (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(__SPM_ENABLE))</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Check if the SPM instruction is busy. </p>

</div>
</div>
<a class="anchor" id="ga24900c15109e8b419736d4b81b093fb8"></a><!-- doxytag: member="boot.h::boot_spm_busy_wait" ref="ga24900c15109e8b419736d4b81b093fb8" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_spm_busy_wait</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td>&#160;&#160;&#160;do{}while(boot_spm_busy())</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Wait while the SPM instruction is busy. </p>

</div>
</div>
<a class="anchor" id="gaf1e01d09c839793a6c0c990b1c5ae8b3"></a><!-- doxytag: member="boot.h::boot_spm_interrupt_disable" ref="gaf1e01d09c839793a6c0c990b1c5ae8b3" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_spm_interrupt_disable</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td>&#160;&#160;&#160;(__SPM_REG &amp;= (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)~_BV(SPMIE))</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Disable the SPM interrupt. </p>

</div>
</div>
<a class="anchor" id="ga072040fce54f112355cb9ebf9ce41dd7"></a><!-- doxytag: member="boot.h::boot_spm_interrupt_enable" ref="ga072040fce54f112355cb9ebf9ce41dd7" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define boot_spm_interrupt_enable</td>
          <td>(</td>
          <td class="paramname">&#160;)</td>
          <td>&#160;&#160;&#160;(__SPM_REG |= (<a class="el" href="group__avr__stdint.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>)_BV(SPMIE))</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Enable the SPM interrupt. </p>

</div>
</div>
<a class="anchor" id="ga8a60eb0985d40ff71c42bb18f0f5789e"></a><!-- doxytag: member="boot.h::BOOTLOADER_SECTION" ref="ga8a60eb0985d40ff71c42bb18f0f5789e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BOOTLOADER_SECTION&#160;&#160;&#160;__attribute__ ((section (&quot;.bootloader&quot;)))</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Used to declare a function or variable to be placed into a new section called .bootloader. This section and its contents can then be relocated to any address (such as the bootloader NRWW area) at link-time. </p>

</div>
</div>
<a class="anchor" id="gaf08aabaebbd69da659357f402d4d28ce"></a><!-- doxytag: member="boot.h::GET_EXTENDED_FUSE_BITS" ref="gaf08aabaebbd69da659357f402d4d28ce" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GET_EXTENDED_FUSE_BITS&#160;&#160;&#160;(0x0002)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>address to read the extended fuse bits, using boot_lock_fuse_bits_get </p>

</div>
</div>
<a class="anchor" id="ga44e70c9662e7ac06484144c15bc69aea"></a><!-- doxytag: member="boot.h::GET_HIGH_FUSE_BITS" ref="ga44e70c9662e7ac06484144c15bc69aea" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GET_HIGH_FUSE_BITS&#160;&#160;&#160;(0x0003)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>address to read the high fuse bits, using boot_lock_fuse_bits_get </p>

</div>
</div>
<a class="anchor" id="gae12d288a22cfbfa9d0cde12b1a779bfe"></a><!-- doxytag: member="boot.h::GET_LOCK_BITS" ref="gae12d288a22cfbfa9d0cde12b1a779bfe" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GET_LOCK_BITS&#160;&#160;&#160;(0x0001)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>address to read the lock bits, using boot_lock_fuse_bits_get </p>

</div>
</div>
<a class="anchor" id="gac68c37ecf2354ba2af6e08379d65899f"></a><!-- doxytag: member="boot.h::GET_LOW_FUSE_BITS" ref="gac68c37ecf2354ba2af6e08379d65899f" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GET_LOW_FUSE_BITS&#160;&#160;&#160;(0x0000)</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>address to read the low fuse bits, using boot_lock_fuse_bits_get </p>

</div>
</div>
</div>

<hr width="80%">
<p><center>Automatically generated by Doxygen 1.7.2 on Wed Feb 16 2011.</center></p>

</body>
</html>