📄 debug_8c-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Procyon AVRlib: debug.c Source File</title><link href="dox.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.6 --><div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>debug.c</h1><a href="debug_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*! \file debug.c \brief Debugging function library. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name : 'debug.c'</span>00005 <span class="comment">// Title : Helpful debugging functions</span>00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2003</span>00007 <span class="comment">// Created : 2003-03-13</span>00008 <span class="comment">// Revised : 2003-03-13</span>00009 <span class="comment">// Version : 0.1</span>00010 <span class="comment">// Target MCU : Atmel AVR series</span>00011 <span class="comment">// Editor Tabs : 4</span>00012 <span class="comment">//</span>00013 <span class="comment">// Description : This file contains a set of functions which may be useful</span>00014 <span class="comment">// for general debugging.</span>00015 <span class="comment">//</span>00016 <span class="comment">// This code is distributed under the GNU Public License</span>00017 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>00018 <span class="comment">//</span>00019 <span class="comment">//*****************************************************************************</span>00020 00021 <span class="preprocessor">#include <avr/io.h></span>00022 <span class="preprocessor">#include <avr/signal.h></span>00023 <span class="preprocessor">#include <avr/interrupt.h></span>00024 00025 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00026 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span>00027 00028 <span class="preprocessor">#include "<a class="code" href="rprintf_8h.html">rprintf.h</a>"</span> <span class="comment">// include printf support</span>00029 00030 <span class="comment">// global variables</span>00031 00032 <span class="comment">// functions</span>00033 00034 <span class="comment">// Print a part of memory as a formatted hex table with ascii translation</span><a name="l00035"></a><a class="code" href="debug_8h.html#a0">00035</a> <span class="keywordtype">void</span> <a class="code" href="debug_8h.html#a0">debugPrintHexTable</a>(u16 length, u08 *buffer)00036 {00037 u08 i;00038 u16 j;00039 u08 *buf;00040 u08 s;00041 00042 buf = buffer;00043 00044 <span class="comment">// print the low order address indicies and ASCII header</span>00045 rprintfProgStrM(<span class="stringliteral">" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF\r\n"</span>);00046 rprintfProgStrM(<span class="stringliteral">" ----------------------------------------------- ---- ASCII -----\r\n"</span>);00047 00048 <span class="comment">// print the data</span>00049 <span class="keywordflow">for</span>(j=0; j<((length+15)>>4); j++)00050 {00051 <span class="comment">// print the high order address index for this line</span>00052 <a class="code" href="rprintf_8h.html#a14">rprintfu16</a>(j<<4);00053 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00054 00055 <span class="comment">// print the hex data</span>00056 <span class="keywordflow">for</span>(i=0; i<0x10; i++)00057 {00058 <span class="comment">// be nice and print only up to the exact end of the data</span>00059 <span class="keywordflow">if</span>( ((j<<4)+i) < length)00060 {00061 <span class="comment">// print hex byte</span>00062 <a class="code" href="rprintf_8h.html#a13">rprintfu08</a>(buf[(j<<4)+i]);00063 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00064 }00065 <span class="keywordflow">else</span>00066 {00067 <span class="comment">// we're past the end of the data's length</span>00068 <span class="comment">// print spaces</span>00069 rprintfProgStrM(<span class="stringliteral">" "</span>);00070 }00071 }00072 00073 <span class="comment">// leave some space</span>00074 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00075 00076 <span class="comment">// print the ascii data</span>00077 <span class="keywordflow">for</span>(i=0; i<0x10; i++)00078 {00079 <span class="comment">// be nice and print only up to the exact end of the data</span>00080 <span class="keywordflow">if</span>( ((j<<4)+i) < length)00081 {00082 <span class="comment">// get the character</span>00083 s = buf[(j<<4)+i]; 00084 <span class="comment">// make sure character is printable</span>00085 <span class="keywordflow">if</span>(s >= 0x20)00086 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(s);00087 <span class="keywordflow">else</span>00088 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">'.'</span>);00089 }00090 <span class="keywordflow">else</span>00091 {00092 <span class="comment">// we're past the end of the data's length</span>00093 <span class="comment">// print a space</span>00094 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00095 }00096 }00097 <a class="code" href="rprintf_8c.html#a9">rprintfCRLF</a>();00098 }00099 }</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Oct 15 03:50:21 2004 for Procyon AVRlib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.6 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -