280 lines
24 KiB
HTML
280 lines
24 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"/>
|
||
|
<title>Sample Use of Storage Driver</title>
|
||
|
<title>CMSIS-Driver: Sample Use of Storage Driver</title>
|
||
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
<link href="cmsis.css" rel="stylesheet" type="text/css" />
|
||
|
<script type="text/javascript" src="jquery.js"></script>
|
||
|
<script type="text/javascript" src="dynsections.js"></script>
|
||
|
<script type="text/javascript" src="printComponentTabs.js"></script>
|
||
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="resize.js"></script>
|
||
|
<script type="text/javascript" src="navtree.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(initResizable);
|
||
|
$(window).load(resizeHeight);
|
||
|
</script>
|
||
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="search/search.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
||
|
</script>
|
||
|
</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: 46px;">
|
||
|
<td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
|
||
|
<td style="padding-left: 0.5em;">
|
||
|
<div id="projectname">CMSIS-Driver
|
||
|
 <span id="projectnumber">Version 2.05</span>
|
||
|
</div>
|
||
|
<div id="projectbrief">Peripheral Interface for Middleware and Application Code</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- end header part -->
|
||
|
<div id="CMSISnav" class="tabs1">
|
||
|
<ul class="tablist">
|
||
|
<script type="text/javascript">
|
||
|
<!--
|
||
|
writeComponentTabs.call(this);
|
||
|
//-->
|
||
|
</script>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<!-- Generated by Doxygen 1.8.6 -->
|
||
|
<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 Page</span></a></li>
|
||
|
<li><a href="pages.html"><span>Usage and Description</span></a></li>
|
||
|
<li><a href="modules.html"><span>Reference</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 -->
|
||
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||
|
<div id="nav-tree">
|
||
|
<div id="nav-tree-contents">
|
||
|
<div id="nav-sync" class="sync"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="splitbar" style="-moz-user-select:none;"
|
||
|
class="ui-resizable-handle">
|
||
|
</div>
|
||
|
</div>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function(){initNavTree('group__SampleUseOfStorageDriver.html','');});
|
||
|
</script>
|
||
|
<div id="doc-content">
|
||
|
<!-- window showing the filter options -->
|
||
|
<div id="MSearchSelectWindow"
|
||
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></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">Sample Use of Storage Driver<div class="ingroups"><a class="el" href="group__storage__interface__gr.html">Storage Interface</a></div></div> </div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
<p><b>Example Code:</b></p>
|
||
|
<p>The following is a generic algorithm to erase and program one <a class="el" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">ARM_STORAGE_BLOCK_ATTRIBUTES::erase_unit</a> worth of storage and then read it back to be verified. It handles both synchronous and asynchronous driver implementations.</p>
|
||
|
<div class="fragment"><div class="line"><span class="comment">// Copyright (c) 2006-2016, ARM Limited, All Rights Reserved</span></div>
|
||
|
<div class="line"><span class="comment">// SPDX-License-Identifier: Apache-2.0</span></div>
|
||
|
<div class="line"><span class="comment">//</span></div>
|
||
|
<div class="line"><span class="comment">// Licensed under the Apache License, Version 2.0 (the "License"); you may</span></div>
|
||
|
<div class="line"><span class="comment">// not use this file except in compliance with the License.</span></div>
|
||
|
<div class="line"><span class="comment">// You may obtain a copy of the License at</span></div>
|
||
|
<div class="line"><span class="comment">//</span></div>
|
||
|
<div class="line"><span class="comment">// http:// www.apache.org/licenses/LICENSE-2.0</span></div>
|
||
|
<div class="line"><span class="comment">//</span></div>
|
||
|
<div class="line"><span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
|
||
|
<div class="line"><span class="comment">// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT</span></div>
|
||
|
<div class="line"><span class="comment">// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
|
||
|
<div class="line"><span class="comment">// See the License for the specific language governing permissions and</span></div>
|
||
|
<div class="line"><span class="comment">// limitations under the License.</span></div>
|
||
|
<div class="line"></div>
|
||
|
<div class="line"><span class="preprocessor">#include "<a class="code" href="Driver__Storage_8h.html">Driver_Storage.h</a>"</span></div>
|
||
|
<div class="line"><span class="preprocessor">#include <stdio.h></span></div>
|
||
|
<div class="line"><span class="preprocessor">#include <string.h></span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"><span class="preprocessor">#define TEST_ASSERT(Expr) if (!(Expr)) { printf("%s:%u: assertion failure\n", __FUNCTION__, __LINE__); while (1) ;}</span></div>
|
||
|
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define TEST_ASSERT_EQUAL(expected, actual) if ((expected) != (actual)) {printf("%s:%u: assertion failure\n", __FUNCTION__, __LINE__); while (1) ;}</span></div>
|
||
|
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define TEST_ASSERT_NOT_EQUAL(expected, actual) if ((expected) == (actual)) {printf("%s:%u: assertion failure\n", __FUNCTION__, __LINE__); while (1) ;}</span></div>
|
||
|
<div class="line"><span class="preprocessor"></span> </div>
|
||
|
<div class="line"><span class="comment">// forward declarations</span></div>
|
||
|
<div class="line"><span class="keywordtype">void</span> callbackHandler(int32_t status, <a class="code" href="group__storage__interface__gr.html#ga3a9277f89946d61c41b22da72e3eef7c">ARM_STORAGE_OPERATION</a> operation);</div>
|
||
|
<div class="line"><span class="keywordtype">void</span> progressStateMachine(<span class="keywordtype">void</span>);</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"><span class="keyword">static</span> <span class="keyword">enum</span> {</div>
|
||
|
<div class="line"> NEEDS_INITIALIZATION,</div>
|
||
|
<div class="line"> NEEDS_ERASE,</div>
|
||
|
<div class="line"> NEEDS_PROGRAMMING,</div>
|
||
|
<div class="line"> NEEDS_READ,</div>
|
||
|
<div class="line"> NEEDS_VERIFICATION_FOLLOWING_READ,</div>
|
||
|
<div class="line"> FINISHED</div>
|
||
|
<div class="line">} state;</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"><span class="keyword">extern</span> <a class="code" href="group__storage__interface__gr.html#structARM__DRIVER__STORAGE">ARM_DRIVER_STORAGE</a> <a class="code" href="Driver__Storage_8h.html#af4ce245f055ef69edd1306ef8fde37cf">ARM_Driver_Storage_</a>(0);</div>
|
||
|
<div class="line"><a class="code" href="group__storage__interface__gr.html#structARM__DRIVER__STORAGE">ARM_DRIVER_STORAGE</a> *drv = &<a class="code" href="Driver__Storage_8h.html#af4ce245f055ef69edd1306ef8fde37cf">ARM_Driver_Storage_</a>(0);</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> BUFFER_SIZE = 16384;</div>
|
||
|
<div class="line"><span class="keyword">static</span> uint8_t buffer[BUFFER_SIZE];</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"><span class="keywordtype">void</span> main(<span class="keywordtype">int</span> argc __unused, <span class="keywordtype">char</span>** argv __unused)</div>
|
||
|
<div class="line">{</div>
|
||
|
<div class="line"> state = NEEDS_INITIALIZATION;</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> progressStateMachine();</div>
|
||
|
<div class="line"> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
|
||
|
<div class="line"> <span class="comment">// WFE(); // optional low-power sleep</span></div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line">}</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"><span class="keywordtype">void</span> progressStateMachine(<span class="keywordtype">void</span>)</div>
|
||
|
<div class="line">{</div>
|
||
|
<div class="line"> int32_t rc;</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keyword">static</span> <a class="code" href="group__storage__interface__gr.html#structARM__STORAGE__BLOCK">ARM_STORAGE_BLOCK</a> firstBlock;</div>
|
||
|
<div class="line"> <span class="keywordflow">if</span> (!<a class="code" href="Driver__Storage_8h.html#a955b1ca2ea24cfd3a8923731b581cfd4">ARM_STORAGE_VALID_BLOCK</a>(&firstBlock)) {</div>
|
||
|
<div class="line"> <span class="comment">// Get the first block. This block is entered only once.</span></div>
|
||
|
<div class="line"> rc = drv-><a class="code" href="group__storage__interface__gr.html#adda93f4d74519247517f036c4551dd13">GetNextBlock</a>(NULL, &firstBlock); <span class="comment">// get first block</span></div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(<a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>, rc);</div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line"> TEST_ASSERT(<a class="code" href="Driver__Storage_8h.html#a955b1ca2ea24cfd3a8923731b581cfd4">ARM_STORAGE_VALID_BLOCK</a>(&firstBlock));</div>
|
||
|
<div class="line"> TEST_ASSERT(firstBlock.<a class="code" href="group__storage__interface__gr.html#af931a8871310b4dad23f0f0b0f623560">size</a> > 0);</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keywordflow">switch</span> (state) {</div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> NEEDS_INITIALIZATION:</div>
|
||
|
<div class="line"> rc = drv-><a class="code" href="group__storage__interface__gr.html#a4a126668a113ce450b0d831c74199b23">Initialize</a>(callbackHandler);</div>
|
||
|
<div class="line"> TEST_ASSERT(rc >= <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>);</div>
|
||
|
<div class="line"> <span class="keywordflow">if</span> (rc == <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>) {</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(1, drv-><a class="code" href="group__storage__interface__gr.html#abbfb3aa4b6adb4407de79221bf12cc55">GetCapabilities</a>().<a class="code" href="group__storage__interface__gr.html#a15ade4ca762bc6ce72d435a16febb4cc">asynchronous_ops</a>);</div>
|
||
|
<div class="line"> state = NEEDS_ERASE;</div>
|
||
|
<div class="line"> <span class="keywordflow">return</span>; <span class="comment">// there is pending asynchronous activity which will lead to a completion callback later.</span></div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(1, rc); <span class="comment">// synchronous completion</span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="comment">// intentional fall-through</span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> NEEDS_ERASE:</div>
|
||
|
<div class="line"> TEST_ASSERT(firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a> > 0);</div>
|
||
|
<div class="line"> rc = drv-><a class="code" href="group__storage__interface__gr.html#abb5018d1afb3ea4632e6e6006314f37f">Erase</a>(firstBlock.<a class="code" href="group__storage__interface__gr.html#a0e89cf6b9f6cd3125470b1bed2b823df">addr</a>, firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>);</div>
|
||
|
<div class="line"> TEST_ASSERT(rc >= <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>);</div>
|
||
|
<div class="line"> <span class="keywordflow">if</span> (rc == <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>) {</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(1, drv-><a class="code" href="group__storage__interface__gr.html#abbfb3aa4b6adb4407de79221bf12cc55">GetCapabilities</a>().<a class="code" href="group__storage__interface__gr.html#a15ade4ca762bc6ce72d435a16febb4cc">asynchronous_ops</a>);</div>
|
||
|
<div class="line"> state = NEEDS_PROGRAMMING;</div>
|
||
|
<div class="line"> <span class="keywordflow">return</span>; <span class="comment">// there is pending asynchronous activity which will lead to a completion callback later.</span></div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>, (uint32_t)rc); <span class="comment">// synchronous completion</span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="comment">// intentional fall-through</span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> NEEDS_PROGRAMMING:</div>
|
||
|
<div class="line"> TEST_ASSERT(BUFFER_SIZE >= firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>);</div>
|
||
|
<div class="line"><span class="preprocessor"> #define PATTERN 0xAA</span></div>
|
||
|
<div class="line"><span class="preprocessor"></span> memset(buffer, PATTERN, firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>);</div>
|
||
|
<div class="line"> rc = drv-><a class="code" href="group__storage__interface__gr.html#aedda6cc77ea7c4ef2356c683f9013d8b">ProgramData</a>(firstBlock.<a class="code" href="group__storage__interface__gr.html#a0e89cf6b9f6cd3125470b1bed2b823df">addr</a>, buffer, firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>);</div>
|
||
|
<div class="line"> TEST_ASSERT(rc >= <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>);</div>
|
||
|
<div class="line"> <span class="keywordflow">if</span> (rc == <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>) {</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(1, drv-><a class="code" href="group__storage__interface__gr.html#abbfb3aa4b6adb4407de79221bf12cc55">GetCapabilities</a>().<a class="code" href="group__storage__interface__gr.html#a15ade4ca762bc6ce72d435a16febb4cc">asynchronous_ops</a>);</div>
|
||
|
<div class="line"> state = NEEDS_READ;</div>
|
||
|
<div class="line"> <span class="keywordflow">return</span>; <span class="comment">// there is pending asynchronous activity which will lead to a completion callback later.</span></div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>, (uint32_t)rc); <span class="comment">// synchronous completion</span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="comment">// intentional fall-through</span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> NEEDS_READ:</div>
|
||
|
<div class="line"> rc = drv-><a class="code" href="group__storage__interface__gr.html#a79b015933daca07a88f98a8f20e1144d">ReadData</a>(firstBlock.<a class="code" href="group__storage__interface__gr.html#a0e89cf6b9f6cd3125470b1bed2b823df">addr</a>, buffer, firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>);</div>
|
||
|
<div class="line"> TEST_ASSERT(rc >= <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>);</div>
|
||
|
<div class="line"> <span class="keywordflow">if</span> (rc == <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>) {</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(1, drv-><a class="code" href="group__storage__interface__gr.html#abbfb3aa4b6adb4407de79221bf12cc55">GetCapabilities</a>().<a class="code" href="group__storage__interface__gr.html#a15ade4ca762bc6ce72d435a16febb4cc">asynchronous_ops</a>);</div>
|
||
|
<div class="line"> state = NEEDS_VERIFICATION_FOLLOWING_READ;</div>
|
||
|
<div class="line"> <span class="keywordflow">return</span>; <span class="comment">// there is pending asynchronous activity which will lead to a completion callback later.</span></div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>, (uint32_t)rc);</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="comment">// intentional fall-through</span></div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> NEEDS_VERIFICATION_FOLLOWING_READ:</div>
|
||
|
<div class="line"> printf(<span class="stringliteral">"verifying data\r\n"</span>);</div>
|
||
|
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < firstBlock.<a class="code" href="group__storage__interface__gr.html#ade62c905888479b4f6d078d45cec5830">attributes</a>.<a class="code" href="group__storage__interface__gr.html#aac21d3f798c9fcad415b99cf4157935a">erase_unit</a>; i++) {</div>
|
||
|
<div class="line"> TEST_ASSERT_EQUAL(PATTERN, buffer[i]);</div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line"> state = FINISHED;</div>
|
||
|
<div class="line"> printf(<span class="stringliteral">"done\r\n"</span>);</div>
|
||
|
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> FINISHED:</div>
|
||
|
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
|
<div class="line"> } <span class="comment">// switch (state)</span></div>
|
||
|
<div class="line">}</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"><span class="keywordtype">void</span> callbackHandler(int32_t status, <a class="code" href="group__storage__interface__gr.html#ga3a9277f89946d61c41b22da72e3eef7c">ARM_STORAGE_OPERATION</a> operation)</div>
|
||
|
<div class="line">{</div>
|
||
|
<div class="line"> (void)status;</div>
|
||
|
<div class="line"> (void)operation;</div>
|
||
|
<div class="line"> <span class="keywordflow">switch</span> (operation) {</div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="Driver__Storage_8h.html#ga3a9277f89946d61c41b22da72e3eef7caca3985b874bf393dc2e448b339668971">ARM_STORAGE_OPERATION_INITIALIZE</a>:</div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="Driver__Storage_8h.html#ga3a9277f89946d61c41b22da72e3eef7ca177812f3cb27c413473d94ebe9480454">ARM_STORAGE_OPERATION_READ_DATA</a>:</div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="Driver__Storage_8h.html#ga3a9277f89946d61c41b22da72e3eef7ca586b4774a7a092d1932d3415cc42abb0">ARM_STORAGE_OPERATION_PROGRAM_DATA</a>:</div>
|
||
|
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="Driver__Storage_8h.html#ga3a9277f89946d61c41b22da72e3eef7cab52a1d10b8087452fd97af8cdb9a6f75">ARM_STORAGE_OPERATION_ERASE</a>:</div>
|
||
|
<div class="line"> progressStateMachine();</div>
|
||
|
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
|
<div class="line"> </div>
|
||
|
<div class="line"> <span class="keywordflow">default</span>:</div>
|
||
|
<div class="line"> printf(<span class="stringliteral">"callbackHandler: unexpected callback for opcode %u with status %ld\r\n"</span>, operation, status);</div>
|
||
|
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
|
<div class="line"> }</div>
|
||
|
<div class="line">}</div>
|
||
|
</div><!-- fragment --> </div><!-- contents -->
|
||
|
</div><!-- doc-content -->
|
||
|
<!-- start footer part -->
|
||
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||
|
<ul>
|
||
|
<li class="footer">Generated on Wed Feb 8 2017 10:20:44 for CMSIS-Driver by ARM Ltd. All rights reserved.
|
||
|
<!--
|
||
|
<a href="http://www.doxygen.org/index.html">
|
||
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6
|
||
|
-->
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|