summaryrefslogtreecommitdiff
path: root/tinyusb/osal/osal.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-02-06 12:03:01 +0700
committerhathach <[email protected]>2013-02-06 12:03:01 +0700
commite20025b54d16deccbd6e86433f31d80f5a976fd4 (patch)
treeb94fc6905de315cc5ce3778d297cc711cc195f0f /tinyusb/osal/osal.h
parentaeccdfde3f4462fae5e3b9cbb4eae76526bdb204 (diff)
refractor move test enum to its own file
add assert with handler add task assert with error catcher
Diffstat (limited to 'tinyusb/osal/osal.h')
-rw-r--r--tinyusb/osal/osal.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h
index 055f28d1a..2482695fa 100644
--- a/tinyusb/osal/osal.h
+++ b/tinyusb/osal/osal.h
@@ -85,10 +85,17 @@ typedef uint32_t osal_task_t;
#define OSAL_TASK_LOOP_BEGIN
#define OSAL_TASK_LOOP_END
+#define TASK_ASSERT_ERROR_HANDLER(error, func_call)\
+ func_call; return error
+
+#define TASK_ASSERT_STATUS_HANDLER(sts, func_call) \
+ ASSERT_DEFINE_WITH_HANDLER(TASK_ASSERT_ERROR_HANDLER, func_call, tusb_error_t status = (tusb_error_t)(sts),\
+ TUSB_ERROR_NONE == status, status, "%s", TUSB_ErrorStr[status])
#define TASK_ASSERT_STATUS(sts) \
ASSERT_DEFINE(tusb_error_t status = (tusb_error_t)(sts),\
TUSB_ERROR_NONE == status, (void) 0, "%s", TUSB_ErrorStr[status])
+
#define TASK_ASSERT(condition) ASSERT(condition, (void) 0)
tusb_error_t osal_task_create(osal_task_t *task);