blob: 245d27111b7c9f179a0399bda63ab9276a6c6cf1 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Manufacturing Support &mdash; Apache Mynewt latest documentation</title>
<link rel="shortcut icon" href="../../../_static/mynewt-logo-only-newt32x32.png"/>
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/sphinx_theme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/bootstrap-3.0.3.min.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/v2.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/restructuredtext.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/overrides.css" type="text/css" />
<link rel="index" title="Index"
href="../../../genindex.html"/>
<link rel="search" title="Search" href="../../../search.html"/>
<link rel="top" title="Apache Mynewt latest documentation" href="../../../index.html"/>
<link rel="up" title="OS User Guide" href="../../os_user_guide.html"/>
<link rel="next" title="Board support" href="../../bsp/index.html"/>
<link rel="prev" title="JSON" href="../json/json.html"/>
<script src="../../../_static/js/modernizr.min.js"></script>
<script>
(function(i, s, o, g, r, a, m) {
i["GoogleAnalyticsObject"] = r;
(i[r] =
i[r] ||
function() {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-72162311-1", "auto");
ga("send", "pageview");
</script>
</head>
<body class="not-front page-documentation" role="document" >
<div id="wrapper">
<div class="container">
<div id="banner" class="row v2-main-banner">
<a class="logo-cell" href="/">
<img class="logo" src="../../../_static/img/logo.png">
</a>
<div class="tagline-cell">
<h4 class="tagline">An OS to build, deploy and securely manage billions of devices</h4>
</div>
<div class="news-cell">
<div class="well">
<h4>Latest News:</h4> <a href="/download">Apache Mynewt 1.11.0, Apache NimBLE 1.6.0 </a> released September 7, 2023)
</div>
</div>
</div>
</div>
<header>
<nav id="navbar" class="navbar navbar-inverse" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav navbar-right">
<li>
<a href="/"><i class="fa fa-home" style="font-size: larger;"></i></a>
</li>
<li class="important">
<a href="/quick-start/">Quick Start</a>
</li>
<li>
<a href="/about/">About</a>
</li>
<li>
<a href="/talks/">Talks</a>
</li>
<li class="active">
<a href="/documentation/">Documentation</a>
</li>
<li>
<a href="/download/">Download</a>
</li>
<li>
<a href="/community/">Community</a>
</li>
<li>
<a href="/events/">Events</a>
</li>
</ul>
<!-- Search, Navigation and Repo links -->
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</div>
</nav>
</header>
<!-- STARTS MAIN CONTENT -->
<div id="main-content">
<div id="breadcrumb">
<div class="container">
<a href="/documentation/">Docs</a> /
<a href="../../os_user_guide.html">OS User Guide</a> /
Manufacturing Support
<div class="sourcelink">
<a href="https://github.com/apache/mynewt-core/edit/master/docs/os/modules/mfg/mfg.rst" class="icon icon-github"
rel="nofollow"> Edit on GitHub</a>
</div>
</div>
</div>
<!-- STARTS CONTAINER -->
<div class="container">
<!-- STARTS .content -->
<div id="content" class="row">
<!-- STARTS .container-sidebar -->
<div class="container-sidebar col-xs-12 col-sm-3">
<div id="docSidebar" class="sticky-container">
<div role="search" class="sphinx-search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="Search documentation" class="search-documentation" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<!-- Note: only works when deployed -->
<select class="form-control" onchange="if (this.value) window.location.href=this.value">
<option value="/latest" selected>
Version: latest
</option>
<option value="/v1_11_0" selected="selected" >
Version: 1.11.0
</option>
<option value="/v1_10_0" >
Version: 1.10.0
</option>
<option value="/v1_9_0" >
Version: 1.9.0
</option>
<option value="/v1_8_0" >
Version: 1.8.0
</option>
<option value="/v1_7_0" >
Version: 1.7.0
</option>
<option value="/v1_6_0" >
Version: 1.6.0
</option>
<option value="/v1_5_0" >
Version: 1.5.0
</option>
<option value="/v1_4_0" >
Version: 1.4.0
</option>
<option value="/v1_3_0/os/introduction" >
Version: 1.3.0
</option>
<option value="/v1_2_0/os/introduction" >
Version: 1.2.0
</option>
<option value="/v1_1_0/os/introduction" >
Version: 1.1.0
</option>
<option value="/v1_0_0/os/introduction" >
Version: 1.0.0
</option>
<option value="/v0_9_0/os/introduction" >
Version: 0.9.0
</option>
</select>
<div class="region region-sidebar">
<div class="docs-menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../get_started/index.html">Setup &amp; Get Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../concepts.html">Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../tutorials/tutorials.html">Tutorials</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../external_links.html">Third-party Resources</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../os_user_guide.html">OS User Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../core_os/mynewt_os.html">Kernel</a></li>
<li class="toctree-l2"><a class="reference internal" href="../system_modules.html">System</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hal/hal.html">Hardware Abstraction</a></li>
<li class="toctree-l2"><a class="reference internal" href="../bootloader/bootloader.html">Secure Bootloader</a></li>
<li class="toctree-l2"><a class="reference internal" href="../split/split.html">Split Images</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../core_os/porting/port_os.html">Porting Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="../baselibc.html">Baselibc</a></li>
<li class="toctree-l2"><a class="reference internal" href="../drivers/driver.html">Drivers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../devmgmt/newtmgr.html">Device Management with Newt Manager</a></li>
<li class="toctree-l2"><a class="reference internal" href="../mcumgr/mcumgr.html">Device Management with MCUmgr</a></li>
<li class="toctree-l2"><a class="reference internal" href="../imgmgr/imgmgr.html">Image Manager</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sysinitconfig/sysinitconfig.html">Compile-Time Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sysinitdown/sysinitdown.html">System Initialization and Shutdown</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extcmd/extcmd.html">Build-Time Hooks</a></li>
<li class="toctree-l2"><a class="reference internal" href="../fs/fs.html">File System</a></li>
<li class="toctree-l2"><a class="reference internal" href="../fcb/fcb.html">Flash Circular Buffer</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sensor_framework/sensor_framework.html">Sensor Framework</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testutil/testutil.html">Test Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="../json/json.html">JSON</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Manufacturing support</a><ul class="simple">
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../bsp/index.html">Board support</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../network/index.html">BLE User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../newt/index.html">Newt Tool Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../newtmgr/index.html">Newt Manager Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mynewt_faq/index.html">Mynewt FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../misc/index.html">Appendix</a></li>
</ul>
</div>
</div>
</div>
<!-- ENDS STICKY CONTAINER -->
</div>
<!-- ENDS .container-sidebar -->
<div class="col-xs-12 col-sm-9">
<div class="alert alert-warning">
<p>
Version 1.11.0 is not the most recent version of the
Apache Mynewt documentation. Click <a href="/latest">here</a> to
read the latest version.
</p>
</div>
<div class="">
<div class="rst-content">
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="manufacturing-support">
<h1>Manufacturing Support<a class="headerlink" href="#manufacturing-support" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<div class="section" id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>An mfgimage is a binary that gets written to a Mynewt device at
manufacturing time. Unlike a Mynewt target which corresponds to a
single executable image, an mfgimage represents the entire contents
of a flash device.</p>
</div>
<div class="section" id="definitions">
<h2>Definitions<a class="headerlink" href="#definitions" title="Permalink to this headline"></a></h2>
<table class="docutils align-default">
<colgroup>
<col style="width: 6%" />
<col style="width: 14%" />
<col style="width: 80%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Term</p></th>
<th class="head"><p>Long Name</p></th>
<th class="head"><p>Meaning</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Flashdev</p></td>
<td><p>Flash device</p></td>
<td><p>A single piece of flash hardware. A typical device might contain two flashdevs: 1) internal flash, and 2) external SPI flash.</p></td>
</tr>
<tr class="row-odd"><td><p>Mfgimage</p></td>
<td><p>Manufacturing image</p></td>
<td><p>A file with the entire contents of a single flashdev. At manufacturing time, a separate mfgimage is written to each of the device’s flashdevs.</p></td>
</tr>
<tr class="row-even"><td><p>Boot Mfgimage</p></td>
<td><p>Boot manufacturing image</p></td>
<td><p>The mfgimage containing the boot loader; always written to internal flash.</p></td>
</tr>
<tr class="row-odd"><td><p>MMR</p></td>
<td><p>Manufacturing Meta Region</p></td>
<td><p>A chunk of read-only data included in every mfgimage. Contains identifying information for the mfgimage and other data that stays with the device until end of life.</p></td>
</tr>
<tr class="row-even"><td><p>TLV</p></td>
<td><p>Type Length Value</p></td>
<td><p>A simple extensible means of representing data. Contains three fields: 1) type of data, 2) length of data, and 3) the data itself.</p></td>
</tr>
<tr class="row-odd"><td><p>MfgID</p></td>
<td><p>Manufacturing ID</p></td>
<td><p>Identifies which set of mfgimages a device was built with. Expressed as a list of SHA256 hashes.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="details">
<h2>Details<a class="headerlink" href="#details" title="Permalink to this headline"></a></h2>
<p>Typically, an mfgimage consists of:</p>
<ul class="simple">
<li><p>1 boot loader.</p></li>
<li><p>1 or 2 Mynewt images.</p></li>
<li><p>Extra configuration (e.g., a pre-populated <code class="docutils literal notranslate"><span class="pre">sys/config</span></code> region).</p></li>
</ul>
<p>In addition, each mfgimage contains a manufacturing meta region (MMR).
The MMR consists of read-only data that resides in flash for the
lifetime of the device. There is currently support for three MMR TLV
types:</p>
<ul class="simple">
<li><p>Hash of mfgimage</p></li>
<li><p>Flash map</p></li>
<li><p>Device / offset of next MMR</p></li>
</ul>
<p>The manufacturing hash indicates which manufacuturing image a device
was built with. A management system may need this information to
determine which images a device can be upgraded to, for example. A
Mynewt device exposes its manufacturing hash via the <code class="docutils literal notranslate"><span class="pre">id/mfghash</span></code>
config setting.</p>
<p>Since MMRs are not intended to be modified or erased, they must be placed in
unmodifiable areas of flash. In the boot mfgimage, the MMR <em>must</em> be placed in
the flash area containing the boot loader. For non-boot mfgimages, the MMR can go in any unused area in the relevant flashdev.</p>
</div>
<div class="section" id="manufacturing-id">
<h2>Manufacturing ID<a class="headerlink" href="#manufacturing-id" title="Permalink to this headline"></a></h2>
<p>Each mfgimage has its own MMR containing a hash.</p>
<p>The MMR at the end of the boot mfgimage (“boot MMR”) must be present. The boot
MMR indicates the flash locations of other MMRs via the <code class="docutils literal notranslate"><span class="pre">mmr_ref</span></code> TLV type.</p>
<p>At startup, the firmware reads the boot MMR. Next, it reads
any additional MMRs indicated by <code class="docutils literal notranslate"><span class="pre">mmr_ref</span></code> TLVs. An <code class="docutils literal notranslate"><span class="pre">mmr_ref</span></code> TLV contains
one field: The ID of the flash area where the next MMR is located.</p>
<p>After all MMRs have been read, the firmware populates the <code class="docutils literal notranslate"><span class="pre">id/mfghash</span></code>
setting with a colon-separated list of hashes. By reading and parsing
this setting, a client can derive the full list of mfgimages that the
device was built with.</p>
<p>One important implication is that MMR areas should never be moved in a BSP’s
flash map. Such a change would produce firmware that is incompatible with
older devices.</p>
</div>
<div class="section" id="mmr-structure">
<h2>MMR Structure<a class="headerlink" href="#mmr-structure" title="Permalink to this headline"></a></h2>
<p>An MMR is always located at the end its flash area. Any other placement is invalid.</p>
<p>An MMR has the following structure:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TLV type | TLV size | TLV data (&quot;TLV size&quot; bytes) ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ~
~ ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TLV type | TLV size | TLV data (&quot;TLV size&quot; bytes) ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ~
~ ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Region size | Version | 0xff padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Magic (0x3bb2a269) |
+-+-+-+-+-+--+-+-+-+-+-+end of flash area-+-+-+-+-+-+-+-+-+-+-+-+
</pre></div>
</div>
<p>The number of TLVs is variable; two are shown above for illustrative
purposes.</p>
<p><strong>Fields:</strong></p>
<p><em>&lt;TLVs&gt;</em></p>
<ol class="arabic simple">
<li><p>TLV type: Indicates the type of data to follow.</p></li>
<li><p>TLV size: The number of bytes of data to follow.</p></li>
<li><p>TLV data: “TLV size” bytes of data.</p></li>
</ol>
<p><em>&lt;Footer&gt;</em></p>
<ol class="arabic simple" start="4">
<li><p>Region size: The size, in bytes, of the entire manufacturing meta region; includes TLVs and footer.</p></li>
<li><p>Version: Manufacturing meta version number; always 0x02.</p></li>
<li><p>Magic: Indicates the presence of the manufacturing meta region.</p></li>
</ol>
<div class="section" id="api">
<h3>API<a class="headerlink" href="#api" title="Permalink to this headline"></a></h3>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-defines">Defines</p>
<dl class="c macro">
<dt id="c.MFG_HASH_SZ">
<span class="target" id="mfg_8h_1a34f1e46eeeab0634610887ef41c0dae8"></span><code class="sig-name descname"><span class="pre">MFG_HASH_SZ</span></code><a class="headerlink" href="#c.MFG_HASH_SZ" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c macro">
<dt id="c.MFG_META_TLV_TYPE_HASH">
<span class="target" id="mfg_8h_1aaf1326ee50f5bfc87094ca4381ae28bd"></span><code class="sig-name descname"><span class="pre">MFG_META_TLV_TYPE_HASH</span></code><a class="headerlink" href="#c.MFG_META_TLV_TYPE_HASH" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c macro">
<dt id="c.MFG_META_TLV_TYPE_FLASH_AREA">
<span class="target" id="mfg_8h_1a978491dad7fe90483a0d2b56720b0c0a"></span><code class="sig-name descname"><span class="pre">MFG_META_TLV_TYPE_FLASH_AREA</span></code><a class="headerlink" href="#c.MFG_META_TLV_TYPE_FLASH_AREA" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c macro">
<dt id="c.MFG_META_TLV_TYPE_FLASH_TRAITS">
<span class="target" id="mfg_8h_1a40853a05422db0092129dbbf8b991ed4"></span><code class="sig-name descname"><span class="pre">MFG_META_TLV_TYPE_FLASH_TRAITS</span></code><a class="headerlink" href="#c.MFG_META_TLV_TYPE_FLASH_TRAITS" title="Permalink to this definition"></a><br /></dt>
<dd><p>Informational only; not read by firmware. </p>
</dd></dl>
<dl class="c macro">
<dt id="c.MFG_META_TLV_TYPE_MMR_REF">
<span class="target" id="mfg_8h_1a0011209c5fa0b15dc14e18e93e3c3e75"></span><code class="sig-name descname"><span class="pre">MFG_META_TLV_TYPE_MMR_REF</span></code><a class="headerlink" href="#c.MFG_META_TLV_TYPE_MMR_REF" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</div>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-functions">Functions</p>
<dl class="c function">
<dt id="c.mfg_open">
<span class="target" id="mfg_8h_1a9db39551f403ed17ff0e53ccb0c257d3"></span><span class="pre">void</span> <code class="sig-name descname"><span class="pre">mfg_open</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_reader" title="mfg_reader"><span class="pre">mfg_reader</span></a> <span class="pre">*</span><em><span class="pre">out_reader</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mfg_open" title="Permalink to this definition"></a><br /></dt>
<dd><p>Opens the manufacturing space for reading. </p>
<p>The resulting <code class="docutils literal notranslate"><a class="reference internal" href="#structmfg__reader"><span class="std std-ref"><span class="pre">mfg_reader</span></span></a></code> object should be passed to subsequent seek and read functions. </p>
</dd></dl>
<dl class="c function">
<dt id="c.mfg_seek_next">
<span class="target" id="mfg_8h_1ac25df045c698c40fe53b0715d1fbe325"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">mfg_seek_next</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_reader" title="mfg_reader"><span class="pre">mfg_reader</span></a> <span class="pre">*</span><em><span class="pre">reader</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mfg_seek_next" title="Permalink to this definition"></a><br /></dt>
<dd><p>Seeks to the next mfg TLV. </p>
<p>The caller must initialize the supplied <code class="docutils literal notranslate"><a class="reference internal" href="#structmfg__reader"><span class="std std-ref"><span class="pre">mfg_reader</span></span></a></code> with <code class="docutils literal notranslate"><a class="reference internal" href="#mfg_8h_1a9db39551f403ed17ff0e53ccb0c257d3"><span class="std std-ref"><span class="pre">mfg_open()</span></span></a></code> prior to calling this function.</p>
<p><dl class="simple">
<dt><strong>Return</strong></dt><dd><p>0 if the next TLV was successfully seeked to. SYS_EDONE if there are no additional TLVs available. Other MFG error code on failure. </p>
</dd>
<dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reader</span></code>: The reader to seek with.</p></li>
</ul>
</dd>
</dl>
</p>
</dd></dl>
<dl class="c function">
<dt id="c.mfg_seek_next_with_type">
<span class="target" id="mfg_8h_1ae713e950af52f133ee84c8fdc8920c6e"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">mfg_seek_next_with_type</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_reader" title="mfg_reader"><span class="pre">mfg_reader</span></a> <span class="pre">*</span><em><span class="pre">reader</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">type</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mfg_seek_next_with_type" title="Permalink to this definition"></a><br /></dt>
<dd><p>Seeks to the next mfg TLV with the specified type. </p>
<p>The caller must initialize the supplied <code class="docutils literal notranslate"><a class="reference internal" href="#structmfg__reader"><span class="std std-ref"><span class="pre">mfg_reader</span></span></a></code> with <code class="docutils literal notranslate"><a class="reference internal" href="#mfg_8h_1a9db39551f403ed17ff0e53ccb0c257d3"><span class="std std-ref"><span class="pre">mfg_open()</span></span></a></code> prior to calling this function.</p>
<p><dl class="simple">
<dt><strong>Return</strong></dt><dd><p>0 if the next TLV was successfully seeked to. SYS_EDONE if there are no additional TLVs with the specified type available. Other MFG error code on failure. </p>
</dd>
<dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reader</span></code>: The reader to seek with. </p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">type</span></code>: The type of TLV to seek to; one of the MFG_META_TLV_TYPE_[…] constants.</p></li>
</ul>
</dd>
</dl>
</p>
</dd></dl>
<dl class="c function">
<dt id="c.mfg_read_tlv_hash">
<span class="target" id="mfg_8h_1a04952c7759618fdafbf71941bd4ef543"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">mfg_read_tlv_hash</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_reader" title="mfg_reader"><span class="pre">mfg_reader</span></a> <span class="pre">*</span><em><span class="pre">reader</span></em>, <span class="pre">void</span> <span class="pre">*</span><em><span class="pre">out_hash</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mfg_read_tlv_hash" title="Permalink to this definition"></a><br /></dt>
<dd><p>Reads a hash TLV from the manufacturing space. </p>
<p>This function should only be called when the provided reader is pointing at a TLV with the MFG_META_TLV_TYPE_HASH type.</p>
<p><dl class="simple">
<dt><strong>Return</strong></dt><dd><p>0 on success; MFG error code on failure. </p>
</dd>
<dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reader</span></code>: The reader to read with. </p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">out_mr</span></code>: (out) On success, the retrieved MMR reference information gets written here.</p></li>
</ul>
</dd>
</dl>
</p>
</dd></dl>
<dl class="c function">
<dt id="c.mfg_read_tlv_flash_area">
<span class="target" id="mfg_8h_1a79cd8956fa93a166f7e62a2901cbaeb5"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">mfg_read_tlv_flash_area</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_reader" title="mfg_reader"><span class="pre">mfg_reader</span></a> <span class="pre">*</span><em><span class="pre">reader</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_meta_flash_area" title="mfg_meta_flash_area"><span class="pre">mfg_meta_flash_area</span></a> <span class="pre">*</span><em><span class="pre">out_mfa</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mfg_read_tlv_flash_area" title="Permalink to this definition"></a><br /></dt>
<dd><p>Reads a flash-area TLV from the manufacturing space. </p>
<p>This function should only be called when the provided reader is pointing at a TLV with the MFG_META_TLV_TYPE_FLASH_AREA type.</p>
<p><dl class="simple">
<dt><strong>Return</strong></dt><dd><p>0 on success; MFG error code on failure. </p>
</dd>
<dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reader</span></code>: The reader to read with. </p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">out_mfa</span></code>: (out) On success, the retrieved flash area information gets written here.</p></li>
</ul>
</dd>
</dl>
</p>
</dd></dl>
<dl class="c function">
<dt id="c.mfg_read_tlv_mmr_ref">
<span class="target" id="mfg_8h_1a32a0c9c33301dc2e810357ebea3f5109"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">mfg_read_tlv_mmr_ref</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_reader" title="mfg_reader"><span class="pre">mfg_reader</span></a> <span class="pre">*</span><em><span class="pre">reader</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_meta_mmr_ref" title="mfg_meta_mmr_ref"><span class="pre">mfg_meta_mmr_ref</span></a> <span class="pre">*</span><em><span class="pre">out_mr</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mfg_read_tlv_mmr_ref" title="Permalink to this definition"></a><br /></dt>
<dd><p>Reads an MMR ref TLV from the manufacturing space. </p>
<p>This function should only be called when the provided reader is pointing at a TLV with the MFG_META_TLV_TYPE_MMR_REF type.</p>
<p><dl class="simple">
<dt><strong>Return</strong></dt><dd><p>0 on success; MFG error code on failure. </p>
</dd>
<dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reader</span></code>: The reader to read with. </p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">out_mr</span></code>: (out) On success, the retrieved MMR reference information gets written here.</p></li>
</ul>
</dd>
</dl>
</p>
</dd></dl>
<dl class="c function">
<dt id="c.mfg_init">
<span class="target" id="mfg_8h_1a98eb72f373a5554a5368302483a64d16"></span><span class="pre">void</span> <code class="sig-name descname"><span class="pre">mfg_init</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><a class="headerlink" href="#c.mfg_init" title="Permalink to this definition"></a><br /></dt>
<dd><p>Initializes the mfg package. </p>
</dd></dl>
</div>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-variables">Variables</p>
<dl class="c var">
<dt id="c.type">
<span class="target" id="mfg_8h_1a1d127017fb298b889f4ba24752d08b8e"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">type</span></code><a class="headerlink" href="#c.type" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.size">
<span class="target" id="mfg_8h_1ae5dc6ffcd9b7605c7787791e40cc6bb0"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">size</span></code><a class="headerlink" href="#c.size" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.area_id">
<span class="target" id="mfg_8h_1a67110770c51cac507896719e00bf143b"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">area_id</span></code><a class="headerlink" href="#c.area_id" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.device_id">
<span class="target" id="mfg_8h_1aebf6cf4331fcc15f0d3ed0890e01a380"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">device_id</span></code><a class="headerlink" href="#c.device_id" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.offset">
<span class="target" id="mfg_8h_1a894bdfa2d603d8343f8ef01dda6fcd23"></span><span class="pre">uint32_t</span> <code class="sig-name descname"><span class="pre">offset</span></code><a class="headerlink" href="#c.offset" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.min_write_sz">
<span class="target" id="mfg_8h_1aae9f9181ccb20209c57f5d8b55f10603"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">min_write_sz</span></code><a class="headerlink" href="#c.min_write_sz" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</div>
<dl class="c struct">
<dt id="c.mfg_meta_tlv">
<span class="target" id="structmfg__meta__tlv"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">mfg_meta_tlv</span></code><a class="headerlink" href="#c.mfg_meta_tlv" title="Permalink to this definition"></a><br /></dt>
<dd><em>#include &lt;mfg.h&gt;</em><div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt id="c.mfg_meta_tlv.type">
<span class="target" id="structmfg__meta__tlv_1aabb77e33bca9d61484275fc055bb14c8"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">type</span></code><a class="headerlink" href="#c.mfg_meta_tlv.type" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.mfg_meta_tlv.size">
<span class="target" id="structmfg__meta__tlv_1a5b1e907f1311c6676d6aa2bbff5d492c"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">size</span></code><a class="headerlink" href="#c.mfg_meta_tlv.size" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</div>
</dd></dl>
<dl class="c struct">
<dt id="c.mfg_meta_flash_area">
<span class="target" id="structmfg__meta__flash__area"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">mfg_meta_flash_area</span></code><a class="headerlink" href="#c.mfg_meta_flash_area" title="Permalink to this definition"></a><br /></dt>
<dd><em>#include &lt;mfg.h&gt;</em><div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt id="c.mfg_meta_flash_area.area_id">
<span class="target" id="structmfg__meta__flash__area_1a46e495bcab9e805dc143cc64dbe2cf6c"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">area_id</span></code><a class="headerlink" href="#c.mfg_meta_flash_area.area_id" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.mfg_meta_flash_area.device_id">
<span class="target" id="structmfg__meta__flash__area_1af582d86ac0af3c0b2c406e7a6716cc7b"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">device_id</span></code><a class="headerlink" href="#c.mfg_meta_flash_area.device_id" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.mfg_meta_flash_area.offset">
<span class="target" id="structmfg__meta__flash__area_1ad3e047e2583902bc6ef129c29a26fb60"></span><span class="pre">uint32_t</span> <code class="sig-name descname"><span class="pre">offset</span></code><a class="headerlink" href="#c.mfg_meta_flash_area.offset" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.mfg_meta_flash_area.size">
<span class="target" id="structmfg__meta__flash__area_1ad6b02ff134f1ac4d8c4fb10134f4cce5"></span><span class="pre">uint32_t</span> <code class="sig-name descname"><span class="pre">size</span></code><a class="headerlink" href="#c.mfg_meta_flash_area.size" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</div>
</dd></dl>
<dl class="c struct">
<dt id="c.mfg_meta_flash_traits">
<span class="target" id="structmfg__meta__flash__traits"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">mfg_meta_flash_traits</span></code><a class="headerlink" href="#c.mfg_meta_flash_traits" title="Permalink to this definition"></a><br /></dt>
<dd><em>#include &lt;mfg.h&gt;</em><p>Informational only; not read by firmware. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt id="c.mfg_meta_flash_traits.device_id">
<span class="target" id="structmfg__meta__flash__traits_1a63a1053f32cf062261a87acd8c7ed480"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">device_id</span></code><a class="headerlink" href="#c.mfg_meta_flash_traits.device_id" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
<dl class="c var">
<dt id="c.mfg_meta_flash_traits.min_write_sz">
<span class="target" id="structmfg__meta__flash__traits_1a7555ff3565989a4de42457e85a6064f9"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">min_write_sz</span></code><a class="headerlink" href="#c.mfg_meta_flash_traits.min_write_sz" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</div>
</dd></dl>
<dl class="c struct">
<dt id="c.mfg_meta_mmr_ref">
<span class="target" id="structmfg__meta__mmr__ref"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">mfg_meta_mmr_ref</span></code><a class="headerlink" href="#c.mfg_meta_mmr_ref" title="Permalink to this definition"></a><br /></dt>
<dd><em>#include &lt;mfg.h&gt;</em><div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt id="c.mfg_meta_mmr_ref.area_id">
<span class="target" id="structmfg__meta__mmr__ref_1af8ad894654c799a8c1dab9efe775aea4"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">area_id</span></code><a class="headerlink" href="#c.mfg_meta_mmr_ref.area_id" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</div>
</dd></dl>
<dl class="c struct">
<dt id="c.mfg_reader">
<span class="target" id="structmfg__reader"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">mfg_reader</span></code><a class="headerlink" href="#c.mfg_reader" title="Permalink to this definition"></a><br /></dt>
<dd><em>#include &lt;mfg.h&gt;</em><p>Object used for reading records from the manufacturing space. </p>
<p>The <code class="docutils literal notranslate"><a class="reference internal" href="#mfg_8h_1a9db39551f403ed17ff0e53ccb0c257d3"><span class="std std-ref"><span class="pre">mfg_open()</span></span></a></code> function should be used to construct a reader object. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt id="c.mfg_reader.cur_tlv">
<span class="target" id="structmfg__reader_1a897ed396e8206631cacc0cf9d83651e9"></span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.mfg_meta_tlv" title="mfg_meta_tlv"><span class="pre">mfg_meta_tlv</span></a> <code class="sig-name descname"><span class="pre">cur_tlv</span></code><a class="headerlink" href="#c.mfg_reader.cur_tlv" title="Permalink to this definition"></a><br /></dt>
<dd><p>Public (read-only). </p>
</dd></dl>
<dl class="c var">
<dt id="c.mfg_reader.mmr_idx">
<span class="target" id="structmfg__reader_1a7030f8c4e0f1eae6464923bed14cd6e5"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">mmr_idx</span></code><a class="headerlink" href="#c.mfg_reader.mmr_idx" title="Permalink to this definition"></a><br /></dt>
<dd><p>Private. </p>
</dd></dl>
<dl class="c var">
<dt id="c.mfg_reader.offset">
<span class="target" id="structmfg__reader_1a1dec27343467d58d53fd586fc9b68996"></span><span class="pre">uint32_t</span> <code class="sig-name descname"><span class="pre">offset</span></code><a class="headerlink" href="#c.mfg_reader.offset" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="rst-footer-buttons row" role="navigation" aria-label="footer navigation">
<a href="../../bsp/index.html" class="btn btn-neutral float-right" title="Board support" accesskey="n">Next: Board support <span class="fa fa-arrow-circle-right"></span></a>
<a href="../json/json.html" class="btn btn-neutral" title="JSON" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous: JSON</a>
</div>
</div>
</div>
</div>
<!-- ENDS CONTENT SECTION -->
</div>
<!-- ENDS .content -->
</div>
</div>
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12">
<p class="copyright">Apache Mynewt is available under Apache License, version 2.0.</p>
</div>
<div class="col-xs-12">
<div class="logos">
<img src="../../../_static/img/asf_logo_wide_small.png" alt="Apache" title="Apache">
<small class="footnote">
Apache Mynewt, Mynewt, Apache, the Apache feather logo, and the Apache Mynewt project logo are either
registered trademarks or trademarks of the Apache Software Foundation in the United States and other countries.
</small>
<a href="">
<img src="../../../_static/img/add_to_slack.png" alt="Slack Icon" title="Join our Slack Community" />
</a>
</div>
</div>
</div>
</div>
</footer>
</div>
<!-- ENDS #wrapper -->
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'latest',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
LINK_SUFFIX: '.html'
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/js/bootstrap-3.0.3.min.js"></script>
<script type="text/javascript" src="../../../_static/js/affix.js"></script>
<script type="text/javascript" src="../../../_static/js/main.js"></script>
</body>
</html>