1
0

debug_frmwrk.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**********************************************************************
  2. * $Id$ debug_frmwrk.h 2011-06-02
  3. *//**
  4. * @file debug_frmwrk.h
  5. * @brief Contains some utilities that used for debugging through UART
  6. * @version 1.0
  7. * @date 02. June. 2011
  8. * @author NXP MCU SW Application Team
  9. *
  10. * Copyright(C) 2011, 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. #include "lpc_uart.h"
  34. #define USED_UART_DEBUG_PORT 0
  35. #define NUM_SKIPPED_ALLOWED (10)
  36. #define DBG_GETVAL_IN_DEC (0)
  37. #define DBG_GETVAL_IN_HEX (1)
  38. //#define DBG_GETVAL_IN_CHARS (2)
  39. #if (USED_UART_DEBUG_PORT == 0)
  40. #define DEBUG_UART_PORT (UART_0)
  41. #elif (USED_UART_DEBUG_PORT == 1)
  42. #define DEBUG_UART_PORT (UART_1)
  43. #elif (USED_UART_DEBUG_PORT == 2)
  44. #define DEBUG_UART_PORT (UART_2)
  45. #elif (USED_UART_DEBUG_PORT == 3)
  46. #define DEBUG_UART_PORT (UART_3)
  47. #elif (USED_UART_DEBUG_PORT == 4)
  48. #define DEBUG_UART_PORT (UART_4)
  49. #else
  50. #error "Invalid UART port selection!"
  51. #endif
  52. #define _DBG(x) _db_msg(DEBUG_UART_PORT, x)
  53. #define _DBG_(x) _db_msg_(DEBUG_UART_PORT, x)
  54. #define _DBC(x) _db_char(DEBUG_UART_PORT, x)
  55. #define _DBD(x) _db_dec(DEBUG_UART_PORT, x)
  56. #define _DBD16(x) _db_dec_16(DEBUG_UART_PORT, x)
  57. #define _DBD32(x) _db_dec_32(DEBUG_UART_PORT, x)
  58. #define _DBH(x) _db_hex(DEBUG_UART_PORT, x)
  59. #define _DBH16(x) _db_hex_16(DEBUG_UART_PORT, x)
  60. #define _DBH32(x) _db_hex_32(DEBUG_UART_PORT, x)
  61. #define _DBH_(x) _db_hex_(DEBUG_UART_PORT, x)
  62. #define _DBH16_(x) _db_hex_16_(DEBUG_UART_PORT, x)
  63. #define _DBH32_(x) _db_hex_32_(DEBUG_UART_PORT, x)
  64. #define _DG _db_get_char(DEBUG_UART_PORT)
  65. #define _DG_NONBLOCK(c) _db_get_char_nonblocking(DEBUG_UART_PORT,c)
  66. #define _DGV(option, numCh, val) _db_get_val(DEBUG_UART_PORT, option, numCh, val)
  67. //void _printf (const char *format, ...);
  68. extern void (*_db_msg)(UART_ID_Type UartID, const void *s);
  69. extern void (*_db_msg_)(UART_ID_Type UartID, const void *s);
  70. extern void (*_db_char)(UART_ID_Type UartID, uint8_t ch);
  71. extern void (*_db_dec)(UART_ID_Type UartID, uint8_t decn);
  72. extern void (*_db_dec_16)(UART_ID_Type UartID, uint16_t decn);
  73. extern void (*_db_dec_32)(UART_ID_Type UartID, uint32_t decn);
  74. extern void (*_db_hex)(UART_ID_Type UartID, uint8_t hexn);
  75. extern void (*_db_hex_16)(UART_ID_Type UartID, uint16_t hexn);
  76. extern void (*_db_hex_32)(UART_ID_Type UartID, uint32_t hexn);
  77. extern void (*_db_hex_)(UART_ID_Type UartID, uint8_t hexn);
  78. extern void (*_db_hex_16_)(UART_ID_Type UartID, uint16_t hexn);
  79. extern void (*_db_hex_32_)(UART_ID_Type UartID, uint32_t hexn);
  80. extern uint8_t (*_db_get_char)(UART_ID_Type UartID);
  81. extern Bool (*_db_get_char_nonblocking)(UART_ID_Type UartID, uint8_t* c);
  82. extern uint8_t (*_db_get_val)(UART_ID_Type UartID, uint8_t option, uint8_t numCh, uint32_t * val);
  83. uint8_t UARTGetValue (UART_ID_Type UartID, uint8_t option,
  84. uint8_t numCh, uint32_t* val);
  85. void UARTPutChar (UART_ID_Type UartID, uint8_t ch);
  86. void UARTPuts(UART_ID_Type UartID, const void *str);
  87. void UARTPuts_(UART_ID_Type UartID, const void *str);
  88. void UARTPutDec(UART_ID_Type UartID, uint8_t decnum);
  89. void UARTPutDec16(UART_ID_Type UartID, uint16_t decnum);
  90. void UARTPutDec32(UART_ID_Type UartID, uint32_t decnum);
  91. void UARTPutHex (UART_ID_Type UartID, uint8_t hexnum);
  92. void UARTPutHex16 (UART_ID_Type UartID, uint16_t hexnum);
  93. void UARTPutHex32 (UART_ID_Type UartID, uint32_t hexnum);
  94. uint8_t UARTGetChar (UART_ID_Type UartID);
  95. Bool UARTGetCharInNonBlock(UART_ID_Type UartID, uint8_t* c);
  96. void debug_frmwrk_init(void);
  97. #endif /* __DEBUG_FRMWRK_H_ */