1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter&#160;3.&#160;Usage</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Reed-Solomon Library Programming Interface"><link rel="up" href="index.html" title="Reed-Solomon Library Programming Interface"><link rel="prev" href="bugs.html" title="Chapter&#160;2.&#160;Known Bugs And Assumptions"><link rel="next" href="ch03s02.html" title="Encoding"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;3.&#160;Usage</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bugs.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch03s02.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="usage"></a>Chapter&#160;3.&#160;Usage</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="usage.html#idp1123136676">Initializing</a></span></dt><dt><span class="sect1"><a href="ch03s02.html">Encoding</a></span></dt><dt><span class="sect1"><a href="ch03s03.html">Decoding</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch03s03.html#idp1121072492">
2			Decoding with syndrome calculation, direct data correction
3		</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#idp1121073572">
4			Decoding with syndrome given by hardware decoder, direct data correction
5		</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#idp1121074700">
6			Decoding with syndrome given by hardware decoder, no direct data correction.
7		</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch03s04.html">Cleanup</a></span></dt></dl></div><p>
8		This chapter provides examples of how to use the library.
9	</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1123136676"></a>Initializing</h2></div></div></div><p>
10			The init function init_rs returns a pointer to an
11			rs decoder structure, which holds the necessary
12			information for encoding, decoding and error correction
13			with the given polynomial. It either uses an existing
14			matching decoder or creates a new one. On creation all
15			the lookup tables for fast en/decoding are created.
16			The function may take a while, so make sure not to 
17			call it in critical code paths.
18		</p><pre class="programlisting">
19/* the Reed Solomon control structure */
20static struct rs_control *rs_decoder;
21
22/* Symbolsize is 10 (bits)
23 * Primitive polynomial is x^10+x^3+1
24 * first consecutive root is 0
25 * primitive element to generate roots = 1
26 * generator polynomial degree (number of roots) = 6
27 */
28rs_decoder = init_rs (10, 0x409, 0, 1, 6);
29		</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bugs.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="ch03s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;2.&#160;Known Bugs And Assumptions&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Encoding</td></tr></table></div></body></html>
30