sdk-ameba-v4.0b_without_nda.../doc/api_doc/group__flash.html
2017-10-15 14:36:37 +08:00

903 lines
39 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>SDK4.0: FLASH</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">SDK4.0
</div>
<div id="projectbrief">This document shows Ameba SDK 4.0 APIs</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">FLASH<div class="ingroups"><a class="el" href="group__sdk.html">Ameba SDK</a> &raquo; <a class="el" href="group__hal.html">HAL</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>flash functions
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
Ameba Common</h2></td></tr>
<tr class="memitem:ga4b9cefba5eb591210b43ce2f31145784"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga4b9cefba5eb591210b43ce2f31145784"></a>
typedef struct flash_s&#160;</td><td class="memItemRight" valign="bottom"><b>flash_t</b></td></tr>
<tr class="separator:ga4b9cefba5eb591210b43ce2f31145784"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae99567fff68ce173f22692b16255ac95"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#gae99567fff68ce173f22692b16255ac95">flash_erase_sector</a> (flash_t *obj, uint32_t address)</td></tr>
<tr class="memdesc:gae99567fff68ce173f22692b16255ac95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erase flash sector. <a href="#gae99567fff68ce173f22692b16255ac95">More...</a><br /></td></tr>
<tr class="separator:gae99567fff68ce173f22692b16255ac95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad18bac4a83b344c97c44bc527dd27c33"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#gad18bac4a83b344c97c44bc527dd27c33">flash_erase_block</a> (flash_t *obj, uint32_t address)</td></tr>
<tr class="memdesc:gad18bac4a83b344c97c44bc527dd27c33"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erase flash block(64KB) <a href="#gad18bac4a83b344c97c44bc527dd27c33">More...</a><br /></td></tr>
<tr class="separator:gad18bac4a83b344c97c44bc527dd27c33"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad5e4c414bb37e27b30bf846b6a174bec"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#gad5e4c414bb37e27b30bf846b6a174bec">flash_read_word</a> (flash_t *obj, uint32_t address, uint32_t *data)</td></tr>
<tr class="memdesc:gad5e4c414bb37e27b30bf846b6a174bec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a word from specified address. <a href="#gad5e4c414bb37e27b30bf846b6a174bec">More...</a><br /></td></tr>
<tr class="separator:gad5e4c414bb37e27b30bf846b6a174bec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaef8b6bb9e52c26badfb9f8c644cf2633"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#gaef8b6bb9e52c26badfb9f8c644cf2633">flash_write_word</a> (flash_t *obj, uint32_t address, uint32_t data)</td></tr>
<tr class="memdesc:gaef8b6bb9e52c26badfb9f8c644cf2633"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a word to specified address. <a href="#gaef8b6bb9e52c26badfb9f8c644cf2633">More...</a><br /></td></tr>
<tr class="separator:gaef8b6bb9e52c26badfb9f8c644cf2633"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac1b58fa05ce302a10f7ce9ba6524c169"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#gac1b58fa05ce302a10f7ce9ba6524c169">flash_stream_read</a> (flash_t *obj, uint32_t address, uint32_t len, uint8_t *data)</td></tr>
<tr class="memdesc:gac1b58fa05ce302a10f7ce9ba6524c169"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a stream of data from specified address. <a href="#gac1b58fa05ce302a10f7ce9ba6524c169">More...</a><br /></td></tr>
<tr class="separator:gac1b58fa05ce302a10f7ce9ba6524c169"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga025166692c958e48e2ef824c371b722b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga025166692c958e48e2ef824c371b722b">flash_stream_write</a> (flash_t *obj, uint32_t address, uint32_t len, uint8_t *data)</td></tr>
<tr class="memdesc:ga025166692c958e48e2ef824c371b722b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a stream of data to specified address. <a href="#ga025166692c958e48e2ef824c371b722b">More...</a><br /></td></tr>
<tr class="separator:ga025166692c958e48e2ef824c371b722b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadac33ed905a07a2cb15746cd9b4e08d3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#gadac33ed905a07a2cb15746cd9b4e08d3">flash_write_protect</a> (flash_t *obj, uint32_t protect)</td></tr>
<tr class="memdesc:gadac33ed905a07a2cb15746cd9b4e08d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Control the flash chip write protect enable/disable. <a href="#gadac33ed905a07a2cb15746cd9b4e08d3">More...</a><br /></td></tr>
<tr class="separator:gadac33ed905a07a2cb15746cd9b4e08d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1c5ccb2f6a0f9cec2dc139894ecb24ec"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga1c5ccb2f6a0f9cec2dc139894ecb24ec">flash_get_status</a> (flash_t *obj)</td></tr>
<tr class="memdesc:ga1c5ccb2f6a0f9cec2dc139894ecb24ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the value of status register1. <a href="#ga1c5ccb2f6a0f9cec2dc139894ecb24ec">More...</a><br /></td></tr>
<tr class="separator:ga1c5ccb2f6a0f9cec2dc139894ecb24ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8a41e95c78069e69c1cd4a1ebd83de6e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga8a41e95c78069e69c1cd4a1ebd83de6e">flash_set_status</a> (flash_t *obj, uint32_t data)</td></tr>
<tr class="memdesc:ga8a41e95c78069e69c1cd4a1ebd83de6e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set Status register to enable desired operation. <a href="#ga8a41e95c78069e69c1cd4a1ebd83de6e">More...</a><br /></td></tr>
<tr class="separator:ga8a41e95c78069e69c1cd4a1ebd83de6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad990aea38eef9a60af5fb6f2657b7c4a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#gad990aea38eef9a60af5fb6f2657b7c4a">flash_reset_status</a> (flash_t *obj)</td></tr>
<tr class="memdesc:gad990aea38eef9a60af5fb6f2657b7c4a"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function aims to reset the status register, please make sure the operation is appropriate. <a href="#gad990aea38eef9a60af5fb6f2657b7c4a">More...</a><br /></td></tr>
<tr class="separator:gad990aea38eef9a60af5fb6f2657b7c4a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9be5e145f4d318d6672de6943e766829"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga9be5e145f4d318d6672de6943e766829">flash_burst_write</a> (flash_t *obj, uint32_t address, uint32_t Length, uint8_t *data)</td></tr>
<tr class="memdesc:ga9be5e145f4d318d6672de6943e766829"><td class="mdescLeft">&#160;</td><td class="mdescRight">It is the same with flash_stream_write function which is used to write a stream of data to specified address. <a href="#ga9be5e145f4d318d6672de6943e766829">More...</a><br /></td></tr>
<tr class="separator:ga9be5e145f4d318d6672de6943e766829"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga592e3960781eca38eae47db9b28df223"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga592e3960781eca38eae47db9b28df223">flash_burst_read</a> (flash_t *obj, uint32_t address, uint32_t Length, uint8_t *data)</td></tr>
<tr class="memdesc:ga592e3960781eca38eae47db9b28df223"><td class="mdescLeft">&#160;</td><td class="mdescRight">It is the same with flash_stream_read function which is used to read a stream of data from specified address. <a href="#ga592e3960781eca38eae47db9b28df223">More...</a><br /></td></tr>
<tr class="separator:ga592e3960781eca38eae47db9b28df223"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4fed0728cd2ad93b8eb8e4418fda0c22"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga4fed0728cd2ad93b8eb8e4418fda0c22">flash_set_extend_addr</a> (flash_t *obj, uint32_t data)</td></tr>
<tr class="memdesc:ga4fed0728cd2ad93b8eb8e4418fda0c22"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is only for Micron 128MB flash to access beyond 16MB by switching between eight 16MB-area(segment). Please refer to flash datasheet for more information about memory mapping. <a href="#ga4fed0728cd2ad93b8eb8e4418fda0c22">More...</a><br /></td></tr>
<tr class="separator:ga4fed0728cd2ad93b8eb8e4418fda0c22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga029b2c59c24bf1733be9a1b5c2c63160"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga029b2c59c24bf1733be9a1b5c2c63160">flash_get_extend_addr</a> (flash_t *obj)</td></tr>
<tr class="memdesc:ga029b2c59c24bf1733be9a1b5c2c63160"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is only for Micron 128MB flash to read from Extended Address Register, which shows the current segment. Please refer to flash datasheet for more information about memory mapping. <a href="#ga029b2c59c24bf1733be9a1b5c2c63160">More...</a><br /></td></tr>
<tr class="separator:ga029b2c59c24bf1733be9a1b5c2c63160"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga053004871fb4a0f1ca3204cd7cc72177"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga053004871fb4a0f1ca3204cd7cc72177">flash_read_id</a> (flash_t *obj, uint8_t *buf, uint8_t len)</td></tr>
<tr class="memdesc:ga053004871fb4a0f1ca3204cd7cc72177"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get flash ID (command: 0x9F). <a href="#ga053004871fb4a0f1ca3204cd7cc72177">More...</a><br /></td></tr>
<tr class="separator:ga053004871fb4a0f1ca3204cd7cc72177"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga50ab8970fa850369baa6065a29e0f3b9"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga50ab8970fa850369baa6065a29e0f3b9">flash_read_unique_id</a> (flash_t *obj, uint8_t *buf, uint8_t len)</td></tr>
<tr class="memdesc:ga50ab8970fa850369baa6065a29e0f3b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is only for Winbond flash to get unique ID (command: 0x4B). <a href="#ga50ab8970fa850369baa6065a29e0f3b9">More...</a><br /></td></tr>
<tr class="separator:ga50ab8970fa850369baa6065a29e0f3b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
AmebaZ Only</h2></td></tr>
<tr class="memitem:ga95d0a0924c4be8345169940bf90ed321"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__flash.html#ga95d0a0924c4be8345169940bf90ed321">flash_erase_chip</a> (flash_t *obj)</td></tr>
<tr class="memdesc:ga95d0a0924c4be8345169940bf90ed321"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erase the whole flash chip. <a href="#ga95d0a0924c4be8345169940bf90ed321">More...</a><br /></td></tr>
<tr class="separator:ga95d0a0924c4be8345169940bf90ed321"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>flash functions </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga592e3960781eca38eae47db9b28df223"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_burst_read </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>Length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>It is the same with flash_stream_read function which is used to read a stream of data from specified address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the starting address to read from. </td></tr>
<tr><td class="paramname">len</td><td>Specifies the length of the data to read. </td></tr>
<tr><td class="paramname">data</td><td>Specified the address to save the readback data. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga9be5e145f4d318d6672de6943e766829"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_burst_write </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>Length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>It is the same with flash_stream_write function which is used to write a stream of data to specified address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the starting address to write to. </td></tr>
<tr><td class="paramname">len</td><td>Specifies the length of the data to write. </td></tr>
<tr><td class="paramname">data</td><td>Pointer to a byte array that is to be written. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gad18bac4a83b344c97c44bc527dd27c33"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void flash_erase_block </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Erase flash block(64KB) </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the starting address to be erased.LSB 16bits will be masked. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga95d0a0924c4be8345169940bf90ed321"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void flash_erase_chip </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Erase the whole flash chip. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gae99567fff68ce173f22692b16255ac95"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void flash_erase_sector </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Erase flash sector. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the starting address to be erased. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga029b2c59c24bf1733be9a1b5c2c63160"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_get_extend_addr </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is only for Micron 128MB flash to read from Extended Address Register, which shows the current segment. Please refer to flash datasheet for more information about memory mapping. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"></td><td>The value of current Extended Address Register. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga1c5ccb2f6a0f9cec2dc139894ecb24ec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_get_status </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the value of status register1. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"></td><td>The value of status register1. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga053004871fb4a0f1ca3204cd7cc72177"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_read_id </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get flash ID (command: 0x9F). </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">buf</td><td>Pointer to a byte array to save the readback ID. </td></tr>
<tr><td class="paramname">len</td><td>Specifies the length of the buf. It should be 3. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">-1</td><td>Fail. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga50ab8970fa850369baa6065a29e0f3b9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_read_unique_id </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is only for Winbond flash to get unique ID (command: 0x4B). </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">buf</td><td>Pointer to a byte array to save the readback unique ID. </td></tr>
<tr><td class="paramname">len</td><td>Specifies the length of the buf. It should be 8. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">-1</td><td>Fail. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gad5e4c414bb37e27b30bf846b6a174bec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_read_word </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t *&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read a word from specified address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the address to read from. </td></tr>
<tr><td class="paramname">data</td><td>Specified the address to save the readback data. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>auto mode read is ok, because we have flash cache </dd></dl>
</div>
</div>
<a class="anchor" id="gad990aea38eef9a60af5fb6f2657b7c4a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void flash_reset_status </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function aims to reset the status register, please make sure the operation is appropriate. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Specifies the parameter of flash object. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga4fed0728cd2ad93b8eb8e4418fda0c22"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_set_extend_addr </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is only for Micron 128MB flash to access beyond 16MB by switching between eight 16MB-area(segment). Please refer to flash datasheet for more information about memory mapping. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">data</td><td>Specified which segment to choose. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga8a41e95c78069e69c1cd4a1ebd83de6e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_set_status </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set Status register to enable desired operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Specifies the parameter of flash object. </td></tr>
<tr><td class="paramname">data</td><td>Specifies which bit users like to set. ex: if users want to set the third bit, data = 0x8. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>Please refer to the datatsheet of flash for more details of the content of status register. The block protected area and the corresponding control bits are provided in the flash datasheet. </dd></dl>
</div>
</div>
<a class="anchor" id="gac1b58fa05ce302a10f7ce9ba6524c169"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_stream_read </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read a stream of data from specified address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the starting address to read from. </td></tr>
<tr><td class="paramname">len</td><td>Specifies the length of the data to read. </td></tr>
<tr><td class="paramname">data</td><td>Specified the address to save the readback data. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>auto mode is ok, because we have flash cache </dd></dl>
</div>
</div>
<a class="anchor" id="ga025166692c958e48e2ef824c371b722b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_stream_write </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Write a stream of data to specified address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the starting address to write to. </td></tr>
<tr><td class="paramname">len</td><td>Specifies the length of the data to write. </td></tr>
<tr><td class="paramname">data</td><td>Pointer to a byte array that is to be written. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gadac33ed905a07a2cb15746cd9b4e08d3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void flash_write_protect </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>protect</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Control the flash chip write protect enable/disable. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">protect</td><td>This parameter can be 1 or 0. <ul>
<li>1: Protect the whole chip from being programmed/erased. </li>
<li>0: Unprotect the whole chip from being programmed/erased. </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gaef8b6bb9e52c26badfb9f8c644cf2633"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int flash_write_word </td>
<td>(</td>
<td class="paramtype">flash_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Write a word to specified address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>Flash object define in application software. </td></tr>
<tr><td class="paramname">address</td><td>Specifies the address to be programmed to. </td></tr>
<tr><td class="paramname">data</td><td>Specified the data to be programmed. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">1</td><td>Success </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>user mode write used </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>