mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
added assert macro
This commit is contained in:
parent
a21ca6c0f1
commit
54e5289b73
@ -42,10 +42,39 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include "arch/arch.h"
|
||||
#include "compiler/compiler.h"
|
||||
#include "errors.h"
|
||||
|
||||
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
|
||||
#if 1
|
||||
#define PRINTF_LOCATION(mess) printf("Assert: %s at line %d: %s\n", __func__, __LINE__, mess)
|
||||
#else
|
||||
#define PRINTF_LOCATION(mess)
|
||||
#endif
|
||||
|
||||
#define ASSERT_MESSAGE(condition, value, message) \
|
||||
do{\
|
||||
if (!(condition)) {\
|
||||
PRINTF_LOCATION(message);\
|
||||
return (value);\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define ASSERT(condition, value) ASSERT_MESSAGE(condition, value, NULL)
|
||||
|
||||
#define ASSERT_STATUS_MESSAGE(sts, message) \
|
||||
do{\
|
||||
ErrorCode_t status = (sts);\
|
||||
if (LPC_OK != status) {\
|
||||
PRINTF_LOCATION(message);\
|
||||
return status;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define ASSERT_STATUS(sts) ASSERT_STATUS_MESSAGE(sts, NULL)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "dcd.h"
|
||||
#include "romdriver/power_api.h"
|
||||
#define USBD_API ((*(ROM **)(0x1FFF1FF8))->pUSBD) // TODO HAL
|
||||
#define ASSERT_STATUS(x) x
|
||||
|
||||
void dcd_init()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user