📄 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 ARMlib-LPC2100: 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="files.html">File List</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 : any</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 "<a class="code" href="global_8h.html">global.h</a>"</span>00022 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span>00023 00024 <span class="preprocessor">#include "<a class="code" href="rprintf_8h.html">rprintf.h</a>"</span> <span class="comment">// include printf support</span>00025 00026 <span class="comment">// global variables</span>00027 00028 <span class="comment">// functions</span>00029 00030 <span class="comment">// Print a part of memory as a formatted hex table with ascii translation</span><a name="l00031"></a><a class="code" href="debug_8h.html#a0">00031</a> <span class="keywordtype">void</span> <a class="code" href="debug_8h.html#a0">debugPrintHexTable</a>(u16 length, u08 *buffer)00032 {00033 u08 i;00034 u16 j;00035 u08 *buf;00036 u08 s;00037 00038 buf = buffer;00039 00040 <span class="comment">// print the low order address indicies and ASCII header</span>00041 <a class="code" href="rprintf_8h.html#a8">rprintfStr</a>(<span class="stringliteral">" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF\r\n"</span>);00042 <a class="code" href="rprintf_8h.html#a8">rprintfStr</a>(<span class="stringliteral">" ----------------------------------------------- ---- ASCII -----\r\n"</span>);00043 00044 <span class="comment">// print the data</span>00045 <span class="keywordflow">for</span>(j=0; j<((length+15)>>4); j++)00046 {00047 <span class="comment">// print the high order address index for this line</span>00048 <a class="code" href="rprintf_8h.html#a14">rprintfu16</a>(j<<4);00049 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00050 00051 <span class="comment">// print the hex data</span>00052 <span class="keywordflow">for</span>(i=0; i<0x10; i++)00053 {00054 <span class="comment">// be nice and print only up to the exact end of the data</span>00055 <span class="keywordflow">if</span>( ((j<<4)+i) < length)00056 {00057 <span class="comment">// print hex byte</span>00058 <a class="code" href="rprintf_8h.html#a13">rprintfu08</a>(buf[(j<<4)+i]);00059 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00060 }00061 <span class="keywordflow">else</span>00062 {00063 <span class="comment">// we're past the end of the data's length</span>00064 <span class="comment">// print spaces</span>00065 <a class="code" href="rprintf_8h.html#a8">rprintfStr</a>(<span class="stringliteral">" "</span>);00066 }00067 }00068 00069 <span class="comment">// leave some space</span>00070 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00071 00072 <span class="comment">// print the ascii data</span>00073 <span class="keywordflow">for</span>(i=0; i<0x10; i++)00074 {00075 <span class="comment">// be nice and print only up to the exact end of the data</span>00076 <span class="keywordflow">if</span>( ((j<<4)+i) < length)00077 {00078 <span class="comment">// get the character</span>00079 s = buf[(j<<4)+i]; 00080 <span class="comment">// make sure character is printable</span>00081 <span class="keywordflow">if</span>(s >= 0x20)00082 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(s);00083 <span class="keywordflow">else</span>00084 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">'.'</span>);00085 }00086 <span class="keywordflow">else</span>00087 {00088 <span class="comment">// we're past the end of the data's length</span>00089 <span class="comment">// print a space</span>00090 <a class="code" href="rprintf_8h.html#a7">rprintfChar</a>(<span class="charliteral">' '</span>);00091 }00092 }00093 <a class="code" href="rprintf_8c.html#a10">rprintfCRLF</a>();00094 }00095 }</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Jul 13 03:38:11 2004 for Procyon ARMlib-LPC2100 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 + -