source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/UTILS/DEBUG/debug.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

File size: 4.1 KB
Line 
1/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
2
3/*This file is prepared for Doxygen automatic documentation generation.*/
4/*! \file *********************************************************************
5 *
6 * \brief Macros and functions dedicated to debug purposes.
7 *
8 * - Compiler:           IAR EWAVR32 and GNU GCC for AVR32
9 * - Supported devices:  All AVR32 devices with a USART module can be used.
10 *
11 * \author               Atmel Corporation: http://www.atmel.com \n
12 *                       Support and FAQ: http://support.atmel.no/
13 *
14 ******************************************************************************/
15
16/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are met:
20 *
21 * 1. Redistributions of source code must retain the above copyright notice, this
22 * list of conditions and the following disclaimer.
23 *
24 * 2. Redistributions in binary form must reproduce the above copyright notice,
25 * this list of conditions and the following disclaimer in the documentation
26 * and/or other materials provided with the distribution.
27 *
28 * 3. The name of Atmel may not be used to endorse or promote products derived
29 * from this software without specific prior written permission.
30 *
31 * 4. This software may only be redistributed and used in connection with an Atmel
32 * AVR product.
33 *
34 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
35 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
36 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
37 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
38 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
41 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
44 *
45 */
46
47#ifndef _DEBUG_H_
48#define _DEBUG_H_
49
50#include "stringz.h"
51
52/*! \brief These macros are used to add traces memory.
53 *
54 * First, initialise the trace with Uc3_trace_init(pointer), giving the start address
55 * of the memory location where will be stored the trace.
56 * Use Uc3_trace(something) to store "something" into the memory. The end of the trace
57 * is signaled by the "0xdeadbeef" pattern.
58 */
59#define Uc3_trace_init(debug_addr)   \
60      *(U32*)(debug_addr)=debug_addr+4
61
62#define Uc3_trace(debug_addr, x)   \
63      *(U32*)(*(U32*)(debug_addr)  ) = (U32)(x)   ;\
64      *(U32*)(*(U32*)(debug_addr)+4) = 0xdeadbeef ;\
65      *(U32*)(debug_addr  ) = *(U32*)(debug_addr)+4
66
67/*! \brief This macro is used to insert labels into assembly output.
68 *
69 */
70#define Insert_label(name)         \
71    __asm__ __volatile__ (STRINGZ(name)":");
72
73#if (defined __GNUC__)
74/*! \brief Returns the number of total of used bytes allocated from the HEAP.
75 *
76 * \retval total number of used bytes.
77 */
78U32 get_heap_total_used_size( void );
79
80/*! \brief Returns the number of bytes currently used from the HEAP.
81 *
82 * \retval total number of used bytes.
83 */
84U32 get_heap_curr_used_size( void );
85#endif
86
87/*! \brief Returns the number of free bytes in the HEAP.
88 *
89 * This funtion tries to allocate the maximum number of bytes by dichotomical method.
90 *
91 * \retval number of free bytes.
92 */
93extern U32 get_heap_free_size( void );
94
95/*! \name Traces function using a round buffer
96 */
97//! @{
98
99/*! \brief Initialize the trace using a round buffer.
100 *
101 * \param buf   Base address of the buffer used for the trace.
102 * \param size  Size of the round buffer. Must be a power of 2.
103 */
104void uc3_round_trace_init(void* buf, U32 size);
105
106/*! \brief Trace a data in the round buffer.
107 *
108 * The end of the trace is signaled by the "0xdeadbeef" pattern.
109 * \param val   Data to trace;
110 */
111void uc3_round_trace(U32 val);
112
113//! @}
114
115
116#endif  // _DEBUG_H_
Note: See TracBrowser for help on using the repository browser.