lpc-field

Template project for programming NXP's LPC1768 MCUs
git clone git://git.mdnr.space/lpc-field
Log | Files | Refs | README | LICENSE

debug_frmwrk.h (3584B)


      1 /**********************************************************************
      2 * $Id$		debug_frmwrk.h		2010-05-21
      3 *//**
      4 * @file		debug_frmwrk.h
      5 * @brief	Contains some utilities that used for debugging through UART
      6 * @version	2.0
      7 * @date		21. May. 2010
      8 * @author	NXP MCU SW Application Team
      9 *
     10 * Copyright(C) 2010, NXP Semiconductor
     11 * All rights reserved.
     12 *
     13 ***********************************************************************
     14 * Software that is described herein is for illustrative purposes only
     15 * which provides customers with programming information regarding the
     16 * products. This software is supplied "AS IS" without any warranties.
     17 * NXP Semiconductors assumes no responsibility or liability for the
     18 * use of the software, conveys no license or title under any patent,
     19 * copyright, or mask work right to the product. NXP Semiconductors
     20 * reserves the right to make changes in the software without
     21 * notification. NXP Semiconductors also make no representation or
     22 * warranty that such application will be suitable for the specified
     23 * use without further testing or modification.
     24 * Permission to use, copy, modify, and distribute this software and its
     25 * documentation is hereby granted, under NXP Semiconductors'
     26 * relevant copyright in the software, without fee, provided that it
     27 * is used in conjunction with NXP Semiconductors microcontrollers.  This
     28 * copyright, permission, and disclaimer notice must appear in all copies of
     29 * this code.
     30 **********************************************************************/
     31 #ifndef DEBUG_FRMWRK_H_
     32 #define DEBUG_FRMWRK_H_
     33 
     34 //#include <stdarg.h>
     35 #include "lpc17xx_uart.h"
     36 
     37 #define USED_UART_DEBUG_PORT	0
     38 
     39 #if (USED_UART_DEBUG_PORT==0)
     40 #define DEBUG_UART_PORT	LPC_UART0
     41 #elif (USED_UART_DEBUG_PORT==1)
     42 #define DEBUG_UART_PORT	LPC_UART1
     43 #endif
     44 
     45 #define _DBG(x)	 	_db_msg(DEBUG_UART_PORT, x)
     46 #define _DBG_(x)	_db_msg_(DEBUG_UART_PORT, x)
     47 #define _DBC(x)	 	_db_char(DEBUG_UART_PORT, x)
     48 #define _DBD(x)	 	_db_dec(DEBUG_UART_PORT, x)
     49 #define _DBD16(x)	 _db_dec_16(DEBUG_UART_PORT, x)
     50 #define _DBD32(x)	 _db_dec_32(DEBUG_UART_PORT, x)
     51 #define _DBH(x)	 	_db_hex(DEBUG_UART_PORT, x)
     52 #define _DBH16(x)	 _db_hex_16(DEBUG_UART_PORT, x)
     53 #define _DBH32(x)	 _db_hex_32(DEBUG_UART_PORT, x)
     54 #define _DG			_db_get_char(DEBUG_UART_PORT)
     55 //void  _printf (const  char *format, ...);
     56 
     57 extern void (*_db_msg)(LPC_UART_TypeDef *UARTx, const void *s);
     58 extern void (*_db_msg_)(LPC_UART_TypeDef *UARTx, const void *s);
     59 extern void (*_db_char)(LPC_UART_TypeDef *UARTx, uint8_t ch);
     60 extern void (*_db_dec)(LPC_UART_TypeDef *UARTx, uint8_t decn);
     61 extern void (*_db_dec_16)(LPC_UART_TypeDef *UARTx, uint16_t decn);
     62 extern void (*_db_dec_32)(LPC_UART_TypeDef *UARTx, uint32_t decn);
     63 extern void (*_db_hex)(LPC_UART_TypeDef *UARTx, uint8_t hexn);
     64 extern void (*_db_hex_16)(LPC_UART_TypeDef *UARTx, uint16_t hexn);
     65 extern void (*_db_hex_32)(LPC_UART_TypeDef *UARTx, uint32_t hexn);
     66 extern uint8_t (*_db_get_char)(LPC_UART_TypeDef *UARTx);
     67 
     68 void UARTPutChar (LPC_UART_TypeDef *UARTx, uint8_t ch);
     69 void UARTPuts(LPC_UART_TypeDef *UARTx, const void *str);
     70 void UARTPuts_(LPC_UART_TypeDef *UARTx, const void *str);
     71 void UARTPutDec(LPC_UART_TypeDef *UARTx, uint8_t decnum);
     72 void UARTPutDec16(LPC_UART_TypeDef *UARTx, uint16_t decnum);
     73 void UARTPutDec32(LPC_UART_TypeDef *UARTx, uint32_t decnum);
     74 void UARTPutHex (LPC_UART_TypeDef *UARTx, uint8_t hexnum);
     75 void UARTPutHex16 (LPC_UART_TypeDef *UARTx, uint16_t hexnum);
     76 void UARTPutHex32 (LPC_UART_TypeDef *UARTx, uint32_t hexnum);
     77 uint8_t UARTGetChar (LPC_UART_TypeDef *UARTx);
     78 void debug_frmwrk_init(void);
     79 
     80 #endif /* DEBUG_FRMWRK_H_ */