Added example asserts to decouple
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
VERSION = 3.2.0
|
||||
|
||||
DEBUG ?= 0
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
DEBUG_FLAGS = -g -DXASSERT_ENABLE_ASSERTIONS_DECOUPLE=1
|
||||
else
|
||||
DEBUG_FLAGS = -DXASSERT_DISABLE_ASSERTIONS_DECOUPLE=1
|
||||
endif
|
||||
|
||||
DEPENDENT_MODULES = lib_locks(>=2.1.0) \
|
||||
lib_logging(>=3.1.1) \
|
||||
lib_mic_array(>=4.5.0) \
|
||||
@@ -11,7 +19,8 @@ MODULE_XCC_FLAGS = $(XCC_FLAGS) \
|
||||
-O3 \
|
||||
-DREF_CLK_FREQ=100 \
|
||||
-fasm-linenum \
|
||||
-fcomment-asm
|
||||
-fcomment-asm \
|
||||
$(DEBUG_FLAGS)
|
||||
|
||||
# Core
|
||||
XCC_FLAGS_xua_endpoint0.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include "xua.h"
|
||||
|
||||
#define XASSERT_UNIT DECOUPLE
|
||||
#include "xassert.h"
|
||||
|
||||
#if XUA_USB_EN
|
||||
#include <xs1.h>
|
||||
#include "xc_ptr.h"
|
||||
@@ -503,6 +506,8 @@ __builtin_unreachable();
|
||||
space_left = aud_to_host_fifo_end - g_aud_to_host_wrptr;
|
||||
}
|
||||
|
||||
assert(space_left > 0 && msg("space_left expected to be positive"));
|
||||
|
||||
if((space_left < (totalSampsToWrite * g_numUsbChan_In * (unsigned) g_curSubSlot_In + 4)))
|
||||
{
|
||||
/* In pipe has filled its buffer - we need to overflow
|
||||
@@ -538,6 +543,8 @@ __builtin_unreachable();
|
||||
space_left += datalength;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, rdPtr);
|
||||
|
||||
assert(rdPtr < aud_to_host_fifo_end && msg("rdPtr must be within buffer"));
|
||||
|
||||
} while(space_left < (BUFF_SIZE_IN - 2 * max_pkt_size));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user