Date: March 20, 2011 This library is created from "LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library (GNU, Keil, IAR) (Jan 28, 2011)", available from NXP's website, under "All microcontrollers support documents" [[http://ics.nxp.com/support/documents/microcontrollers/?type=software]] You will need to follow [[/projects/libraries/svn/mbed/trunk/LPC1768/LPC17xx.h]] while using this library Examples provided here [[/users/frank26080115/programs/LPC1700CMSIS_Examples/]] The beautiful thing is that NXP does not place copyright protection on any of the files in here Only a few modifications are made to make it compile with the mbed online compiler, I fixed some warnings as well. This is untested as of March 20, 2011 Forum post about this library: [[/forum/mbed/topic/2030/]]
debug_frmwrk.h@0:84d7747641aa, 2011-03-20 (annotated)
- Committer:
- frank26080115
- Date:
- Sun Mar 20 18:45:15 2011 +0000
- Revision:
- 0:84d7747641aa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frank26080115 | 0:84d7747641aa | 1 | /***********************************************************************//** |
frank26080115 | 0:84d7747641aa | 2 | * @file debug_frmwrk.h |
frank26080115 | 0:84d7747641aa | 3 | * @brief Contains some utilities that used for debugging through UART |
frank26080115 | 0:84d7747641aa | 4 | * @version 2.0 |
frank26080115 | 0:84d7747641aa | 5 | * @date 21. May. 2010 |
frank26080115 | 0:84d7747641aa | 6 | * @author NXP MCU SW Application Team |
frank26080115 | 0:84d7747641aa | 7 | *---------------------------------------------------------------------------- |
frank26080115 | 0:84d7747641aa | 8 | * Software that is described herein is for illustrative purposes only |
frank26080115 | 0:84d7747641aa | 9 | * which provides customers with programming information regarding the |
frank26080115 | 0:84d7747641aa | 10 | * products. This software is supplied "AS IS" without any warranties. |
frank26080115 | 0:84d7747641aa | 11 | * NXP Semiconductors assumes no responsibility or liability for the |
frank26080115 | 0:84d7747641aa | 12 | * use of the software, conveys no license or title under any patent, |
frank26080115 | 0:84d7747641aa | 13 | * copyright, or mask work right to the product. NXP Semiconductors |
frank26080115 | 0:84d7747641aa | 14 | * reserves the right to make changes in the software without |
frank26080115 | 0:84d7747641aa | 15 | * notification. NXP Semiconductors also make no representation or |
frank26080115 | 0:84d7747641aa | 16 | * warranty that such application will be suitable for the specified |
frank26080115 | 0:84d7747641aa | 17 | * use without further testing or modification. |
frank26080115 | 0:84d7747641aa | 18 | **********************************************************************/ |
frank26080115 | 0:84d7747641aa | 19 | |
frank26080115 | 0:84d7747641aa | 20 | #ifndef DEBUG_FRMWRK_H_ |
frank26080115 | 0:84d7747641aa | 21 | #define DEBUG_FRMWRK_H_ |
frank26080115 | 0:84d7747641aa | 22 | |
frank26080115 | 0:84d7747641aa | 23 | //#include <stdarg.h> |
frank26080115 | 0:84d7747641aa | 24 | #include "lpc17xx_uart.h" |
frank26080115 | 0:84d7747641aa | 25 | |
frank26080115 | 0:84d7747641aa | 26 | #define USED_UART_DEBUG_PORT 0 |
frank26080115 | 0:84d7747641aa | 27 | |
frank26080115 | 0:84d7747641aa | 28 | #if (USED_UART_DEBUG_PORT==0) |
frank26080115 | 0:84d7747641aa | 29 | #define DEBUG_UART_PORT LPC_UART0 |
frank26080115 | 0:84d7747641aa | 30 | #elif (USED_UART_DEBUG_PORT==1) |
frank26080115 | 0:84d7747641aa | 31 | #define DEBUG_UART_PORT LPC_UART1 |
frank26080115 | 0:84d7747641aa | 32 | #endif |
frank26080115 | 0:84d7747641aa | 33 | |
frank26080115 | 0:84d7747641aa | 34 | #define _DBG(x) _db_msg(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 35 | #define _DBG_(x) _db_msg_(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 36 | #define _DBC(x) _db_char(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 37 | #define _DBD(x) _db_dec(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 38 | #define _DBD16(x) _db_dec_16(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 39 | #define _DBD32(x) _db_dec_32(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 40 | #define _DBH(x) _db_hex(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 41 | #define _DBH16(x) _db_hex_16(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 42 | #define _DBH32(x) _db_hex_32(DEBUG_UART_PORT, x) |
frank26080115 | 0:84d7747641aa | 43 | #define _DG _db_get_char(DEBUG_UART_PORT) |
frank26080115 | 0:84d7747641aa | 44 | //void _printf (const char *format, ...); |
frank26080115 | 0:84d7747641aa | 45 | |
frank26080115 | 0:84d7747641aa | 46 | extern void (*_db_msg)(LPC_UART_TypeDef *UARTx, const void *s); |
frank26080115 | 0:84d7747641aa | 47 | extern void (*_db_msg_)(LPC_UART_TypeDef *UARTx, const void *s); |
frank26080115 | 0:84d7747641aa | 48 | extern void (*_db_char)(LPC_UART_TypeDef *UARTx, uint8_t ch); |
frank26080115 | 0:84d7747641aa | 49 | extern void (*_db_dec)(LPC_UART_TypeDef *UARTx, uint8_t decn); |
frank26080115 | 0:84d7747641aa | 50 | extern void (*_db_dec_16)(LPC_UART_TypeDef *UARTx, uint16_t decn); |
frank26080115 | 0:84d7747641aa | 51 | extern void (*_db_dec_32)(LPC_UART_TypeDef *UARTx, uint32_t decn); |
frank26080115 | 0:84d7747641aa | 52 | extern void (*_db_hex)(LPC_UART_TypeDef *UARTx, uint8_t hexn); |
frank26080115 | 0:84d7747641aa | 53 | extern void (*_db_hex_16)(LPC_UART_TypeDef *UARTx, uint16_t hexn); |
frank26080115 | 0:84d7747641aa | 54 | extern void (*_db_hex_32)(LPC_UART_TypeDef *UARTx, uint32_t hexn); |
frank26080115 | 0:84d7747641aa | 55 | extern uint8_t (*_db_get_char)(LPC_UART_TypeDef *UARTx); |
frank26080115 | 0:84d7747641aa | 56 | |
frank26080115 | 0:84d7747641aa | 57 | void UARTPutChar (LPC_UART_TypeDef *UARTx, uint8_t ch); |
frank26080115 | 0:84d7747641aa | 58 | void UARTPuts(LPC_UART_TypeDef *UARTx, const void *str); |
frank26080115 | 0:84d7747641aa | 59 | void UARTPuts_(LPC_UART_TypeDef *UARTx, const void *str); |
frank26080115 | 0:84d7747641aa | 60 | void UARTPutDec(LPC_UART_TypeDef *UARTx, uint8_t decnum); |
frank26080115 | 0:84d7747641aa | 61 | void UARTPutDec16(LPC_UART_TypeDef *UARTx, uint16_t decnum); |
frank26080115 | 0:84d7747641aa | 62 | void UARTPutDec32(LPC_UART_TypeDef *UARTx, uint32_t decnum); |
frank26080115 | 0:84d7747641aa | 63 | void UARTPutHex (LPC_UART_TypeDef *UARTx, uint8_t hexnum); |
frank26080115 | 0:84d7747641aa | 64 | void UARTPutHex16 (LPC_UART_TypeDef *UARTx, uint16_t hexnum); |
frank26080115 | 0:84d7747641aa | 65 | void UARTPutHex32 (LPC_UART_TypeDef *UARTx, uint32_t hexnum); |
frank26080115 | 0:84d7747641aa | 66 | uint8_t UARTGetChar (LPC_UART_TypeDef *UARTx); |
frank26080115 | 0:84d7747641aa | 67 | void debug_frmwrk_init(void); |
frank26080115 | 0:84d7747641aa | 68 | |
frank26080115 | 0:84d7747641aa | 69 | #endif /* DEBUG_FRMWRK_H_ */ |