mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-18 20:42:24 +00:00
more error string clean up
This commit is contained in:
parent
604275341e
commit
111065c042
@ -97,11 +97,11 @@ extern "C"
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#define ASSERT_STATUS_MESSAGE(sts, message) \
|
#define ASSERT_STATUS_MESSAGE(sts, message) \
|
||||||
ASSERT_DEFINE(tusb_error_t status = (tusb_error_t)(sts),\
|
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) \
|
#define ASSERT_STATUS(sts) \
|
||||||
ASSERT_DEFINE(tusb_error_t status = (tusb_error_t)(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
|
// Logical Assert
|
||||||
|
@ -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
|
|
@ -102,7 +102,7 @@ typedef enum
|
|||||||
|
|
||||||
#if TUSB_CFG_DEBUG
|
#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_strerr[TUSB_ERROR_COUNT];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#if TUSB_CFG_DEBUG >= 1
|
#if TUSB_CFG_DEBUG >= 1
|
||||||
// #define _VERIFY_MESS(format, ...) cprintf("[%08ld] %s: %d: verify failed\n", get_millis(), __func__, __LINE__)
|
// #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__);
|
#define _ASSERT_MESS() printf("%s: %d: assert failed\n", __PRETTY_FUNCTION__, __LINE__);
|
||||||
#else
|
#else
|
||||||
#define _VERIFY_MESS(_status)
|
#define _VERIFY_MESS(_status)
|
||||||
|
@ -68,3 +68,16 @@ void tusb_task(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*/
|
||||||
|
/* Debug
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
#if TUSB_CFG_DEBUG
|
||||||
|
|
||||||
|
char const* const tusb_strerr[TUSB_ERROR_COUNT] =
|
||||||
|
{
|
||||||
|
ERROR_TABLE(ERROR_STRING)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user