change default TUSB_CFG_DEBUG to 0

change meaning of TUSB_CFG_DEBUG
This commit is contained in:
hathach
2014-04-17 10:33:59 +07:00
parent 5c6f8750da
commit ccc65e620a
8 changed files with 52 additions and 53 deletions

View File

@@ -73,7 +73,7 @@
<OPTFL> <OPTFL>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget> <IsCurrentTarget>1</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>8</CpuCode> <CpuCode>8</CpuCode>
<DllOpt> <DllOpt>
@@ -355,7 +355,7 @@
<OPTFL> <OPTFL>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget> <IsCurrentTarget>0</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>8</CpuCode> <CpuCode>8</CpuCode>
<DllOpt> <DllOpt>
@@ -608,7 +608,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>27</ColumnNumber> <ColumnNumber>27</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>96</TopLine> <TopLine>97</TopLine>
<CurrentLine>98</CurrentLine> <CurrentLine>98</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName> <PathWithFileName>..\src\main.c</PathWithFileName>
@@ -1248,7 +1248,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>81</TopLine> <TopLine>95</TopLine>
<CurrentLine>103</CurrentLine> <CurrentLine>103</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\boards\board.c</PathWithFileName> <PathWithFileName>..\..\..\boards\board.c</PathWithFileName>
@@ -1416,7 +1416,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>148</TopLine> <TopLine>149</TopLine>
<CurrentLine>154</CurrentLine> <CurrentLine>154</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s</PathWithFileName> <PathWithFileName>..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s</PathWithFileName>

View File

@@ -73,7 +73,7 @@
<OPTFL> <OPTFL>
<tvExp>1</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget> <IsCurrentTarget>1</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>8</CpuCode> <CpuCode>8</CpuCode>
<DllOpt> <DllOpt>
@@ -212,7 +212,7 @@
<LExpSel>0</LExpSel> <LExpSel>0</LExpSel>
</OPTXL> </OPTXL>
<OPTFL> <OPTFL>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget> <IsCurrentTarget>0</IsCurrentTarget>
</OPTFL> </OPTFL>
@@ -355,7 +355,7 @@
<OPTFL> <OPTFL>
<tvExp>1</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget> <IsCurrentTarget>0</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>8</CpuCode> <CpuCode>8</CpuCode>
<DllOpt> <DllOpt>
@@ -613,7 +613,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>9</ColumnNumber> <ColumnNumber>9</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>85</TopLine> <TopLine>86</TopLine>
<CurrentLine>90</CurrentLine> <CurrentLine>90</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName> <PathWithFileName>..\src\main.c</PathWithFileName>
@@ -645,7 +645,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>113</TopLine> <TopLine>114</TopLine>
<CurrentLine>117</CurrentLine> <CurrentLine>117</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\keyboard_host_app.c</PathWithFileName> <PathWithFileName>..\src\keyboard_host_app.c</PathWithFileName>
@@ -659,10 +659,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>9</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>122</TopLine> <TopLine>120</TopLine>
<CurrentLine>126</CurrentLine> <CurrentLine>135</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\mouse_host_app.c</PathWithFileName> <PathWithFileName>..\src\mouse_host_app.c</PathWithFileName>
<FilenameWithoutPath>mouse_host_app.c</FilenameWithoutPath> <FilenameWithoutPath>mouse_host_app.c</FilenameWithoutPath>
@@ -677,7 +677,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>155</TopLine> <TopLine>142</TopLine>
<CurrentLine>159</CurrentLine> <CurrentLine>159</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\msc_host_app.c</PathWithFileName> <PathWithFileName>..\src\msc_host_app.c</PathWithFileName>
@@ -781,7 +781,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>350</TopLine> <TopLine>351</TopLine>
<CurrentLine>354</CurrentLine> <CurrentLine>354</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName> <PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
@@ -1349,7 +1349,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>144</TopLine> <TopLine>145</TopLine>
<CurrentLine>151</CurrentLine> <CurrentLine>151</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s</PathWithFileName> <PathWithFileName>..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s</PathWithFileName>

View File

@@ -70,8 +70,8 @@ extern "C"
#endif #endif
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG ) //#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
#if TUSB_CFG_DEBUG == 3 #if TUSB_CFG_DEBUG
#define _PRINTF(...) printf(__VA_ARGS__) // PRINTF #define _PRINTF(...) printf(__VA_ARGS__)
#else #else
#define _PRINTF(...) #define _PRINTF(...)
#endif #endif
@@ -80,11 +80,9 @@ extern "C"
// Assert Helper // Assert Helper
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#ifndef _TEST_ #ifndef _TEST_
#define ASSERT_MESSAGE(format, ...)\ #define ASSERT_MESSAGE(format, ...) _PRINTF("Assert at %s: %s: %d: " format "\n", __BASE_FILE__, __func__ , __LINE__, __VA_ARGS__)
_PRINTF("Assert at %s: %s: %d: " format "\n", __BASE_FILE__, __func__ , __LINE__, __VA_ARGS__) #else // TODO remove this
#else #define ASSERT_MESSAGE(format, ...) _PRINTF("%d:note: Assert " format "\n", __LINE__, __VA_ARGS__)
#define ASSERT_MESSAGE(format, ...)\
_PRINTF("%d:note: Assert " format "\n", __LINE__, __VA_ARGS__)
#endif #endif
#ifndef _TEST_ASSERT_ #ifndef _TEST_ASSERT_
@@ -97,11 +95,8 @@ extern "C"
do{\ do{\
setup_statement;\ setup_statement;\
if (!(condition)) {\ if (!(condition)) {\
if (hal_debugger_is_attached()){\
hal_debugger_breakpoint();\ hal_debugger_breakpoint();\
}else{\
ASSERT_MESSAGE(format, __VA_ARGS__);\ ASSERT_MESSAGE(format, __VA_ARGS__);\
}\
error_handler(error, handler_para);\ error_handler(error, handler_para);\
}\ }\
}while(0) }while(0)
@@ -165,7 +160,7 @@ extern "C"
#define ASSERT_HEX_WITHIN(...) ASSERT_XXX_WITHIN("0x%x", __VA_ARGS__) #define ASSERT_HEX_WITHIN(...) ASSERT_XXX_WITHIN("0x%x", __VA_ARGS__)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// TODO Bin Assert // Bin Assert
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define BIN8_PRINTF_PATTERN "%d%d%d%d%d%d%d%d" #define BIN8_PRINTF_PATTERN "%d%d%d%d%d%d%d%d"
#define BIN8_PRINTF_CONVERT(byte) \ #define BIN8_PRINTF_CONVERT(byte) \

View File

@@ -39,26 +39,30 @@
/** \ingroup Group_Common /** \ingroup Group_Common
* \defgroup Group_Compiler Compiler * \defgroup Group_Compiler Compiler
* \brief Group_Compiler brief * \brief Group_Compiler brief
* * @{ */
* @{
*/
#ifndef _TUSB_COMPILER_H_ #ifndef _TUSB_COMPILER_H_
#define _TUSB_COMPILER_H_ #define _TUSB_COMPILER_H_
#ifndef _TEST_ #ifndef _TEST_
// TODO move some to tusb_option.h
#define STATIC_ static #define STATIC_ static
#define INLINE_ inline #define INLINE_ inline
#define ATTR_TEST_WEAK #define ATTR_TEST_WEAK
#if TUSB_CFG_DEBUG == 3 // allow debugger to watch any module-wide variables anywhere
#define ATTR_ALWAYS_INLINE // no inline for debug = 3 #if TUSB_CFG_DEBUG
#define STATIC_VAR #define STATIC_VAR
#else #else
#define STATIC_VAR static #define STATIC_VAR static
#endif #endif
#else // function will not be inline for easy step by step debugging
#if TUSB_CFG_DEBUG >= 2
#define ATTR_ALWAYS_INLINE
#endif
#else // TODO remove this, try to pass using compiler command option
#define ATTR_ALWAYS_INLINE #define ATTR_ALWAYS_INLINE
#define STATIC_ #define STATIC_
#define STATIC_VAR #define STATIC_VAR
@@ -73,4 +77,5 @@
#endif #endif
#endif /* _TUSB_COMPILER_H_ */ #endif /* _TUSB_COMPILER_H_ */
/// @} /// @}

View File

@@ -38,7 +38,7 @@
#include "tusb_errors.h" #include "tusb_errors.h"
#if TUSB_CFG_DEBUG == 3 #if TUSB_CFG_DEBUG
char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT] = char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT] =
{ {

View File

@@ -38,8 +38,7 @@
/** \ingroup Group_Common /** \ingroup Group_Common
* \defgroup Group_Error Error Codes * \defgroup Group_Error Error Codes
* @{ * @{ */
*/
#ifndef _TUSB_ERRORS_H_ #ifndef _TUSB_ERRORS_H_
#define _TUSB_ERRORS_H_ #define _TUSB_ERRORS_H_
@@ -94,15 +93,13 @@
ENTRY(TUSB_ERROR_FAILED )\ ENTRY(TUSB_ERROR_FAILED )\
/** \enum tusb_error_t /// \brief Error Code returned
* \brief Error Code returned
*/
typedef enum { typedef enum {
ERROR_TABLE(ERROR_ENUM) ERROR_TABLE(ERROR_ENUM)
TUSB_ERROR_COUNT TUSB_ERROR_COUNT
}tusb_error_t; }tusb_error_t;
#if TUSB_CFG_DEBUG == 3 #if TUSB_CFG_DEBUG
/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0 /// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
extern char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT]; extern char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT];
#endif #endif

View File

@@ -110,12 +110,14 @@ tusb_error_t tusb_init(void);
@code @code
int main(void) int main(void)
{ {
// some init code your_init_code();
tusb_init(); tusb_init();
while(1) // the mainloop while(1) // the mainloop
{ {
tusb_task_runner(); your_application_code();
// other code
tusb_task_runner(); // handle tinyusb event, task etc ...
} }
} }
@endcode @endcode

View File

@@ -107,14 +107,14 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
/** /**
determines the debug level for the stack determines the debug level for the stack
- Level 3: ATTR_ALWAYS_INLINE is null, ASSERT has text, Error has its String, STATIC_VAR is NULL - Level 3: TBD
- Level 2: ATTR_ALWAYS_INLINE is attribute, ASSERT has no text, Error has no strings - Level 2: ATTR_ALWAYS_INLINE is null --> no function is inline
- Level 1: TBD - Level 1: Print out if Assert failed. STATIC_VAR is NULL --> accessible when debugging
- Level 0: no debug information is generated - Level 0: no debug information is generated
*/ */
#ifndef TUSB_CFG_DEBUG #ifndef TUSB_CFG_DEBUG
#define TUSB_CFG_DEBUG 2 #define TUSB_CFG_DEBUG 0
#warning TUSB_CFG_DEBUG is not defined, default value is 3 #warning TUSB_CFG_DEBUG is not defined, default value is 0
#endif #endif
#ifndef TUSB_CFG_ATTR_USBRAM #ifndef TUSB_CFG_ATTR_USBRAM