This file defines a Debug interface. More...
Go to the source code of this file.
Data Structures | |
union | DEBUG_ERROR_FLAGS |
Macros | |
#define | DEBUG_LEVEL_OFF 0 |
#define | DEBUG_LEVEL_CRITICAL 1 |
#define | DEBUG_LEVEL_ERROR 2 |
#define | DEBUG_LEVEL_WARNING 3 |
#define | DEBUG_LEVEL_INFO 4 |
#define | DEBUG_LEVEL_FINE 5 |
#define | DEBUG_TEMP_BUF_SIZE 128 |
#define | DEBUG_TXBUF_SIZE 256 |
#define | DEBUG_RXBUF_SIZE 32 |
#define | debugInit() |
#define | debugAllInitDone() |
#define | debugService() |
#define | debugPutChar(c) |
#define | debugPutByte(b) |
#define | debugPutWord(w) |
#define | debugPutArray(pArr, size) |
#define | debugPutString(str) |
#define | debugPutHexByte(w) |
#define | debugPutHexWord(w) |
#define | debugPutHexLine(adr, buf, len) |
#define | debugWaitForSpace(required) |
#define | debugWaitTillAllSent() |
#define | debugIsTxBufEmpty() (1) |
#define | DEBUG_PUT_STR(lvl, str) {if (MY_DEBUG_LEVEL >= lvl) {debugPutString(str);}} |
#define | DEBUG_PUT_CHAR(lvl, c) {if (MY_DEBUG_LEVEL >= lvl) {debugPutChar(c);}} |
#define | DEBUG_PUT_BYTE(lvl, c) {if (MY_DEBUG_LEVEL >= lvl) {debugPutByte(c);}} |
#define | DEBUG_PUT_WORD(lvl, w) {if (MY_DEBUG_LEVEL >= lvl) {debugPutWord(w);}} |
#define | DEBUG_PUT_HEXBYTE(lvl, b) {if (MY_DEBUG_LEVEL >= lvl) {debugPutHexByte(b);}} |
#define | DEBUG_PUT_HEXWORD(lvl, w) {if (MY_DEBUG_LEVEL >= lvl) {debugPutHexWord(w);}} |
Variables | |
char | debugTempBuf [128] |
DEBUG_ERROR_FLAGS | debugErrorFlags |
This file defines a Debug interface.
This file defines a Debug interface. The implementation has to be done in a separate c file by creating instances of these functions. To use debugging in a project, the following must be done:
For additional information, see Debugging
The following defines are used to configure this module, and should be placed in projdefs.h. Note that all items marked [-DEFAULT-] are defaults, and do not have to be placed in projdefs.h if they contain desired configuration! For details, see Project Configuration.
Software License Agreement
The software supplied herewith is owned by Modtronix Engineering, and is protected under applicable copyright laws. The software supplied herewith is intended and supplied to you, the Company customer, for use solely and exclusively on products manufactured by Modtronix Engineering. The code may be modified and can be used free of charge for commercial and non commercial applications. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
File History
2010-11-16, David H. (DH):
#define DEBUG_PUT_BYTE | ( | lvl, | |
c | |||
) | {if (MY_DEBUG_LEVEL >= lvl) {debugPutByte(c);}} |
Write BYTE in decimal format to debug output. For example, following will write "100" to debug output:
BYTE bVal = 100; DEBUG_PUT_BYTE(DEBUG_LEVEL_ERROR, bVal);
lvl | Level above which this debug message is written to the debug port. |
c | Byte to write to the debug port |
#define DEBUG_PUT_CHAR | ( | lvl, | |
c | |||
) | {if (MY_DEBUG_LEVEL >= lvl) {debugPutChar(c);}} |
Write a single character. For example:
DEBUG_PUT_CHAR(DEBUG_LEVEL_ERROR, 'm');
lvl | Level above which this debug message is written to the debug port. |
c | Null terminated string to write to debug port |
#define DEBUG_PUT_HEXBYTE | ( | lvl, | |
b | |||
) | {if (MY_DEBUG_LEVEL >= lvl) {debugPutHexByte(b);}} |
Write the given BYTE as a 2-character "ASCII Hexidecimal" formatted string to the debug output. For example, following will write "A2" to the debug output:
BYTE bVal = 0xa2; DEBUG_PUT_HEXBYTE(DEBUG_LEVEL_ERROR, bVal);
lvl | Level above which this debug message is written to the debug port. |
b | Byte to write to the debug port |
#define DEBUG_PUT_HEXWORD | ( | lvl, | |
w | |||
) | {if (MY_DEBUG_LEVEL >= lvl) {debugPutHexWord(w);}} |
Write the given WORD as a 4-character "ASCII Hexidecimal" formatted string to the debug output. For example, following will write "01A2" to the debug output:
WORD wVal = 0x1a2; DEBUG_PUT_HEXWORD(DEBUG_LEVEL_ERROR, wVal);
lvl | Level above which this debug message is written to the debug port. |
w | Word to write to the debug port |
#define DEBUG_PUT_STR | ( | lvl, | |
str | |||
) | {if (MY_DEBUG_LEVEL >= lvl) {debugPutString(str);}} |
Write string to debug output. For example:
DEBUG_PUT_STR(DEBUG_LEVEL_ERROR, "\nThis is a debug string");
lvl | Level above which this debug message is written to the debug port. |
str | Null terminated string to write to debug port |
#define DEBUG_PUT_WORD | ( | lvl, | |
w | |||
) | {if (MY_DEBUG_LEVEL >= lvl) {debugPutWord(w);}} |
Write WORD in decimal format to debug output. For example, following will write "100" to debug output:
WORD wVal = 100; DEBUG_PUT_WORD(DEBUG_LEVEL_ERROR, wVal);
lvl | Level above which this debug message is written to the debug port. |
w | Word to write to the debug port |
#define DEBUG_RXBUF_SIZE 32 |
Size of Debug RX buffer. Depending on circular buffer used for implementation, might HAVE TO BE a power of 2 value (if nz_circularBufferPwr2.c is used)! Ensure it is large enought to hold largest string written to debug port. For example, when using the USB port for debugging, text message are sent to the debug port from the Netcruzer USB Terminal.
#define DEBUG_TXBUF_SIZE 256 |
Size of Debug TX buffer. Depending on circular buffer used for implementation, might HAVE TO BE a power of 2 value (if nz_circularBufferPwr2.c is used)! Increase size of this buffer if debug information is getting lost. This can be the case if the application writes debug information to the debug buffer faster than it can send.
DEBUG_ERROR_FLAGS debugErrorFlags |
Initialization Error Flags. Are flags for errors that occur during initialization before any debug message can be printed. After initialization, and debug system has been initialized, an attempt will be made to write an error message out onto the debug port.