This commit is contained in:
rusefi 2017-06-07 21:04:04 -04:00
parent 84ffca6d33
commit 08f5b23a61
3 changed files with 11 additions and 0 deletions

View File

@ -365,6 +365,11 @@ extern "C"
*/ */
#define CH_DBG_SYSTEM_STATE_CHECK TRUE #define CH_DBG_SYSTEM_STATE_CHECK TRUE
/**
* micro-optimization: use same (lower-level) api for lock/unlock regardless on context
* this saves us one branching
*/
#define USE_PORT_LOCK FALSE
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.

View File

@ -285,6 +285,9 @@ bool lockAnyContext(void) {
int alreadyLocked = isLocked(); int alreadyLocked = isLocked();
if (alreadyLocked) if (alreadyLocked)
return true; return true;
#if USE_PORT_LOCK
port_lock();
#else
if (isIsrContext()) { if (isIsrContext()) {
chSysLockFromISR() chSysLockFromISR()
; ;
@ -292,6 +295,7 @@ bool lockAnyContext(void) {
chSysLock() chSysLock()
; ;
} }
#endif
return false; return false;
} }

View File

@ -338,6 +338,8 @@
*/ */
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#define USE_PORT_LOCK TRUE
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
* @details If enabled then the checks on the API functions input * @details If enabled then the checks on the API functions input