?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>Procyon AVRlib: debug.c Source File</title>
4 <link href="dox.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.4.2 -->
7 <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
8 <h1>debug.c</h1><a href="debug_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file debug.c \brief Debugging function library. */</span>
9 00002 <span class="comment">//*****************************************************************************</span>
10 00003 <span class="comment">//</span>
11 00004 <span class="comment">// File Name : 'debug.c'</span>
12 00005 <span class="comment">// Title : Helpful debugging functions</span>
13 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2003</span>
14 00007 <span class="comment">// Created : 2003-03-13</span>
15 00008 <span class="comment">// Revised : 2003-03-13</span>
16 00009 <span class="comment">// Version : 0.1</span>
17 00010 <span class="comment">// Target MCU : Atmel AVR series</span>
18 00011 <span class="comment">// Editor Tabs : 4</span>
19 00012 <span class="comment">//</span>
20 00013 <span class="comment">// Description : This file contains a set of functions which may be useful</span>
21 00014 <span class="comment">// for general debugging.</span>
22 00015 <span class="comment">//</span>
23 00016 <span class="comment">// This code is distributed under the GNU Public License</span>
24 00017 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>
25 00018 <span class="comment">//</span>
26 00019 <span class="comment">//*****************************************************************************</span>
27 00020
28 00021 <span class="preprocessor">#include &lt;avr/io.h&gt;</span>
29 00022 <span class="preprocessor">#include &lt;avr/interrupt.h&gt;</span>
30 00023
31 00024 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>
32 00025 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span>
33 00026
34 00027 <span class="preprocessor">#include "<a class="code" href="rprintf_8h.html">rprintf.h</a>"</span> <span class="comment">// include printf support</span>
35 00028
36 00029 <span class="comment">// global variables</span>
37 00030
38 00031 <span class="comment">// functions</span>
39 00032
40 00033 <span class="comment">// Print a part of memory as a formatted hex table with ascii translation</span>
41 <a name="l00034"></a><a class="code" href="debug_8h.html#a0">00034</a> <span class="keywordtype">void</span> <a class="code" href="debug_8c.html#a0">debugPrintHexTable</a>(u16 length, u08 *buffer)
42 00035 {
43 00036 u08 i;
44 00037 u16 j;
45 00038 u08 *buf;
46 00039 u08 s;
47 00040
48 00041 buf = buffer;
49 00042
50 00043 <span class="comment">// print the low order address indicies and ASCII header</span>
51 00044 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF\r\n"</span>);
52 00045 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">" ----------------------------------------------- ---- ASCII -----\r\n"</span>);
53 00046
54 00047 <span class="comment">// print the data</span>
55 00048 <span class="keywordflow">for</span>(j=0; j&lt;((length+15)&gt;&gt;4); j++)
56 00049 {
57 00050 <span class="comment">// print the high order address index for this line</span>
58 00051 <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(j&lt;&lt;4);
59 00052 <a class="code" href="group__rprintf.html#ga1">rprintfChar</a>(<span class="charliteral">' '</span>);
60 00053
61 00054 <span class="comment">// print the hex data</span>
62 00055 <span class="keywordflow">for</span>(i=0; i&lt;0x10; i++)
63 00056 {
64 00057 <span class="comment">// be nice and print only up to the exact end of the data</span>
65 00058 <span class="keywordflow">if</span>( ((j&lt;&lt;4)+i) &lt; length)
66 00059 {
67 00060 <span class="comment">// print hex byte</span>
68 00061 <a class="code" href="group__rprintf.html#ga7">rprintfu08</a>(buf[(j&lt;&lt;4)+i]);
69 00062 <a class="code" href="group__rprintf.html#ga1">rprintfChar</a>(<span class="charliteral">' '</span>);
70 00063 }
71 00064 <span class="keywordflow">else</span>
72 00065 {
73 00066 <span class="comment">// we're past the end of the data's length</span>
74 00067 <span class="comment">// print spaces</span>
75 00068 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">" "</span>);
76 00069 }
77 00070 }
78 00071
79 00072 <span class="comment">// leave some space</span>
80 00073 <a class="code" href="group__rprintf.html#ga1">rprintfChar</a>(<span class="charliteral">' '</span>);
81 00074
82 00075 <span class="comment">// print the ascii data</span>
83 00076 <span class="keywordflow">for</span>(i=0; i&lt;0x10; i++)
84 00077 {
85 00078 <span class="comment">// be nice and print only up to the exact end of the data</span>
86 00079 <span class="keywordflow">if</span>( ((j&lt;&lt;4)+i) &lt; length)
87 00080 {
88 00081 <span class="comment">// get the character</span>
89 00082 s = buf[(j&lt;&lt;4)+i];
90 00083 <span class="comment">// make sure character is printable</span>
91 00084 <span class="keywordflow">if</span>(s &gt;= 0x20)
92 00085 <a class="code" href="group__rprintf.html#ga1">rprintfChar</a>(s);
93 00086 <span class="keywordflow">else</span>
94 00087 <a class="code" href="group__rprintf.html#ga1">rprintfChar</a>(<span class="charliteral">'.'</span>);
95 00088 }
96 00089 <span class="keywordflow">else</span>
97 00090 {
98 00091 <span class="comment">// we're past the end of the data's length</span>
99 00092 <span class="comment">// print a space</span>
100 00093 <a class="code" href="group__rprintf.html#ga1">rprintfChar</a>(<span class="charliteral">' '</span>);
101 00094 }
102 00095 }
103 00096 <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>();
104 00097 }
105 00098 }
106 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by&nbsp;
107 <a href="http://www.doxygen.org/index.html">
108 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
109 </body>
110 </html>
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3