Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

debug.h File Reference

Copyright (c) 2004 This file holds definitions to help software designers in debugging their applications. More...

#include "conf/conf_clock.h"

Go to the source code of this file.

Defines

#define _TRACE_   (DISABLE)
 This is Compilation switches definition.

#define _ASSERT_   (DISABLE)
#define OCD_BAUDRATE   19200
#define Ocd_soft_entry()   (OACTIV=0x55,OACTIV=0xAA)
 This is initialization of OCD_BRL_VALUE is used to insert OCD software entry sequence This macro is used to insert OCD software entry sequence.

#define TRACE_START_CHAR   ('#')
 Trace control characters definition : start & stop.

#define TRACE_STOP_CHAR   ( 0 )
#define Assert(expr)
 This macro is used to test fatal errors which may be caused by software or hardware bugs.

#define Trace_ptwo(hex)   (P2 = (hex))
#define Trace_nl()   trace("\n\r");
#define Trace_hex16(u16)
#define Trace_hex32(u32)

Functions

void trace (const U8 *str)
 Fonction used for send a texte on OCD/Serial Debug Interface.

void trace_hex (U8 val)
 Fonction used to display a byte value in the hex form on OCD/Serial Debug Interface.

void trace_u8 (U16 val)
 Fonction used to display a byte value in the decimal form (16 bits) on OCD/Serial Debug Interface.

void trace_u16 (U16 val)
 Fonction used to display a byte value in the decimal form (16 bits) on OCD/Serial Debug Interface.

void trace_u32 (U32 val)
 Fonction used to display a byte value in the decimal form (16 bits) on OCD/Serial Debug Interface.

void ocd_enable (Bool ocd_activ)

Variables

U8 _MEM_TYPE_SLOW_ g_trace_en
 Fonction used to enable OCD perform an OCD software entry, set Baudrate to valueperform an OCD software entry.


Detailed Description

Copyright (c) 2004 This file holds definitions to help software designers in debugging their applications.

Use of this program is subject to Atmel's End User License Agreement. Please read file license.txt for copyright notice.

Version:
1.1 (c5131-usb-generic-1_2_0)

Todo:
Bug:

Definition in file debug.h.


Define Documentation

#define _TRACE_   (DISABLE)
 

This is Compilation switches definition.

Definition at line 29 of file debug.h.

#define _ASSERT_   (DISABLE)
 

Definition at line 35 of file debug.h.

#define OCD_BAUDRATE   19200
 

Definition at line 38 of file debug.h.

 
#define Ocd_soft_entry  )     (OACTIV=0x55,OACTIV=0xAA)
 

This is initialization of OCD_BRL_VALUE is used to insert OCD software entry sequence This macro is used to insert OCD software entry sequence.

Definition at line 96 of file debug.h.

#define TRACE_START_CHAR   ('#')
 

Trace control characters definition : start & stop.

Definition at line 99 of file debug.h.

Referenced by trace(), trace_hex(), trace_u16(), trace_u32(), and trace_u8().

#define TRACE_STOP_CHAR   ( 0 )
 

Definition at line 100 of file debug.h.

Referenced by trace(), trace_hex(), trace_u16(), trace_u32(), and trace_u8().

#define Assert expr   ) 
 

Value:

{ \ if( !(expr) ) \ { \ trace("\n\r"); \ trace(__FILE__); \ trace(":"); \ trace_u16(__LINE__); \ while(1) { \ } \ } \ }
This macro is used to test fatal errors which may be caused by software or hardware bugs.

The macro tests if the expression is TRUE. If it is not, a fatal error is detected and the application hangs.

Parameters:
expr expression which is supposed to be TRUE.

Definition at line 111 of file debug.h.

#define Trace_ptwo hex   )     (P2 = (hex))
 

Definition at line 131 of file debug.h.

 
#define Trace_nl  )     trace("\n\r");
 

Definition at line 138 of file debug.h.

#define Trace_hex16 u16   ) 
 

Value:

trace("0x"); \ trace_hex(MSB(u16)); \ trace_hex(LSB(u16));

Definition at line 141 of file debug.h.

#define Trace_hex32 u32   ) 
 

Value:

trace("0x"); \ trace_hex(MSB0(u32)); \ trace_hex(MSB1(u32)); \ trace_hex(MSB2(u32)); \ trace_hex(MSB3(u32));

Definition at line 146 of file debug.h.


Function Documentation

void trace const U8 str  ) 
 

Fonction used for send a texte on OCD/Serial Debug Interface.

Parameters:
str: texte to send (max. size = 256)

Definition at line 176 of file debug.c.

References FALSE, g_trace_en, put_OCD(), TRACE_START_CHAR, TRACE_STOP_CHAR, and U8.

00177 { 00178 U8 index=0; 00179 if( FALSE==g_trace_en ) return; 00180 put_OCD( TRACE_START_CHAR ); 00181 00182 while( 0 != str[index] ) 00183 { 00184 put_OCD( str[index++] ); 00185 } 00186 put_OCD( TRACE_STOP_CHAR ); 00187 }

void trace_hex U8  val  ) 
 

Fonction used to display a byte value in the hex form on OCD/Serial Debug Interface.

Parameters:
val: value of byte

Definition at line 156 of file debug.c.

References FALSE, g_trace_en, put_OCD(), TRACE_START_CHAR, and TRACE_STOP_CHAR.

00157 { 00158 if( FALSE==g_trace_en ) return; 00159 put_OCD( TRACE_START_CHAR ); 00160 00161 if ((val >> 4) >= 10) { put_OCD('A' + (val >> 4) - 10); } 00162 else { put_OCD('0' + (val >> 4)); } 00163 00164 if ((val & 0x0F) >= 10) { put_OCD('A' + (val & 0x0F) - 10); } 00165 else { put_OCD('0' + (val & 0x0F)); } 00166 00167 put_OCD( TRACE_STOP_CHAR ); 00168 }

void trace_u8 U16  val  ) 
 

Fonction used to display a byte value in the decimal form (16 bits) on OCD/Serial Debug Interface.

Parameters:
val: value of byte

Definition at line 133 of file debug.c.

References _MEM_TYPE_SLOW_, Bool, FALSE, g_trace_en, put_OCD(), TRACE_START_CHAR, TRACE_STOP_CHAR, TRUE, and U8.

00134 { 00135 _MEM_TYPE_SLOW_ U8 div; 00136 _MEM_TYPE_SLOW_ U8 tmp; 00137 Bool filter=TRUE; 00138 if( FALSE==g_trace_en ) return; 00139 put_OCD( TRACE_START_CHAR ); 00140 00141 for( div=100 ; div!=1 ; val%=div, div/=10 ) 00142 { 00143 tmp = val/div; 00144 if ( ( filter==TRUE ) && !tmp ) { continue; } 00145 filter=FALSE; 00146 put_OCD('0' + tmp ); 00147 } 00148 put_OCD('0' + val ); 00149 put_OCD( TRACE_STOP_CHAR ); 00150 }

void trace_u16 U16  val  ) 
 

Fonction used to display a byte value in the decimal form (16 bits) on OCD/Serial Debug Interface.

Parameters:
val: value of byte

Definition at line 110 of file debug.c.

References _MEM_TYPE_SLOW_, Bool, FALSE, g_trace_en, put_OCD(), TRACE_START_CHAR, TRACE_STOP_CHAR, TRUE, and U16.

00111 { 00112 _MEM_TYPE_SLOW_ U16 div; 00113 _MEM_TYPE_SLOW_ U16 tmp; 00114 Bool filter=TRUE; 00115 if( FALSE==g_trace_en ) return; 00116 put_OCD( TRACE_START_CHAR ); 00117 00118 for( div=10000 ; div!=1 ; val%=div, div/=10 ) 00119 { 00120 tmp = val/div; 00121 if ( ( filter==TRUE ) && !tmp ) { continue; } 00122 filter=FALSE; 00123 put_OCD('0' + tmp ); 00124 } 00125 put_OCD('0' + val ); 00126 put_OCD( TRACE_STOP_CHAR ); 00127 }

void trace_u32 U32  val  ) 
 

Fonction used to display a byte value in the decimal form (16 bits) on OCD/Serial Debug Interface.

Parameters:
val: value of byte

Definition at line 87 of file debug.c.

References _MEM_TYPE_SLOW_, Bool, FALSE, g_trace_en, put_OCD(), TRACE_START_CHAR, TRACE_STOP_CHAR, TRUE, and U32.

00088 { 00089 _MEM_TYPE_SLOW_ U32 div; 00090 _MEM_TYPE_SLOW_ U32 tmp; 00091 Bool filter=TRUE; 00092 if( FALSE==g_trace_en ) return; 00093 put_OCD( TRACE_START_CHAR ); 00094 00095 for( div=1000000000 ; div!=1 ; val%=div, div/=10 ) 00096 { 00097 tmp = val/div; 00098 if ( ( filter==TRUE ) && !tmp ) { continue; } 00099 filter=FALSE; 00100 put_OCD('0' + tmp ); 00101 } 00102 put_OCD('0' + val ); 00103 put_OCD( TRACE_STOP_CHAR ); 00104 }

void ocd_enable Bool  ocd_activ  ) 
 


Variable Documentation

U8 _MEM_TYPE_SLOW_ g_trace_en
 

Fonction used to enable OCD perform an OCD software entry, set Baudrate to valueperform an OCD software entry.

Definition at line 128 of file debug.h.

Referenced by trace(), trace_hex(), trace_u16(), trace_u32(), and trace_u8().


Generated on Mon Apr 10 17:23:30 2006 for Atmel by doxygen 1.3.7