diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h index edc1a2c45..a3218b5f1 100644 --- a/tinyusb/common/assertion.h +++ b/tinyusb/common/assertion.h @@ -97,11 +97,11 @@ extern "C" //--------------------------------------------------------------------+ #define ASSERT_STATUS_MESSAGE(sts, message) \ ASSERT_DEFINE(tusb_error_t status = (tusb_error_t)(sts),\ - TUSB_ERROR_NONE == status, status, "%s: %s", TUSB_ErrorStr[status], message) + TUSB_ERROR_NONE == status, status, "%s: %s", tusb_strerr[status], message) #define ASSERT_STATUS(sts) \ ASSERT_DEFINE(tusb_error_t status = (tusb_error_t)(sts),\ - TUSB_ERROR_NONE == status, status, "%s", TUSB_ErrorStr[status]) + TUSB_ERROR_NONE == status, status, "%s", tusb_strerr[status]) //--------------------------------------------------------------------+ // Logical Assert diff --git a/tinyusb/common/tusb_error.c b/tinyusb/common/tusb_error.c deleted file mode 100644 index 3236a5a3f..000000000 --- a/tinyusb/common/tusb_error.c +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************/ -/*! - @file tusb_error.c - @author hathach (tinyusb.org) - - @section LICENSE - - Software License Agreement (BSD License) - - Copyright (c) 2013, hathach (tinyusb.org) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This file is part of the tinyusb stack. -*/ -/**************************************************************************/ - -#include "tusb_error.h" - -#if TUSB_CFG_DEBUG - -char const* const TUSB_ErrorStr[TUSB_ERROR_COUNT] = -{ - ERROR_TABLE(ERROR_STRING) -}; - -#endif diff --git a/tinyusb/common/tusb_error.h b/tinyusb/common/tusb_error.h index 24826f36f..96684ef5f 100644 --- a/tinyusb/common/tusb_error.h +++ b/tinyusb/common/tusb_error.h @@ -102,7 +102,7 @@ typedef enum #if TUSB_CFG_DEBUG /// 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_strerr[TUSB_ERROR_COUNT]; #endif #ifdef __cplusplus diff --git a/tinyusb/common/verify.h b/tinyusb/common/verify.h index efea73815..c472c293e 100644 --- a/tinyusb/common/verify.h +++ b/tinyusb/common/verify.h @@ -61,7 +61,7 @@ //--------------------------------------------------------------------+ #if TUSB_CFG_DEBUG >= 1 // #define _VERIFY_MESS(format, ...) cprintf("[%08ld] %s: %d: verify failed\n", get_millis(), __func__, __LINE__) - #define _VERIFY_MESS(_status) printf("%s: %d: verify failed, error = %s\n", __PRETTY_FUNCTION__, __LINE__, TUSB_ErrorStr[_status]); + #define _VERIFY_MESS(_status) printf("%s: %d: verify failed, error = %s\n", __PRETTY_FUNCTION__, __LINE__, tusb_strerr[_status]); #define _ASSERT_MESS() printf("%s: %d: assert failed\n", __PRETTY_FUNCTION__, __LINE__); #else #define _VERIFY_MESS(_status) diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c index cb944a761..309fcc249 100644 --- a/tinyusb/tusb.c +++ b/tinyusb/tusb.c @@ -68,3 +68,16 @@ void tusb_task(void) #endif } #endif + + +/*------------------------------------------------------------------*/ +/* Debug + *------------------------------------------------------------------*/ +#if TUSB_CFG_DEBUG + +char const* const tusb_strerr[TUSB_ERROR_COUNT] = +{ + ERROR_TABLE(ERROR_STRING) +}; + +#endif