Skip to content

Critical - use mbed assert #1829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hal/common/critical.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <stdint.h>
#include <stddef.h>
#include "cmsis.h"
#include <assert.h>
#include "mbed_assert.h"

// Module include
#include "critical.h"
Expand All @@ -40,9 +40,9 @@ void core_util_critical_section_enter()
/* If the interrupt_enable_counter overflows or we are in a nested critical section and interrupts
are enabled, then something has gone badly wrong thus assert an error.
*/
assert(interrupt_enable_counter < UINT32_MAX);
MBED_ASSERT(interrupt_enable_counter < UINT32_MAX);
if (interrupt_enable_counter > 0) {
assert(primask & 0x1);
MBED_ASSERT(primask & 0x1);
}
interrupt_enable_counter++;
}
Expand All @@ -54,7 +54,7 @@ void core_util_critical_section_exit()

uint32_t primask = __get_PRIMASK(); /* get the current interrupt enabled state */

assert(primask & 0x1); /* Interrupts must be disabled on invoking an exit from a critical section */
MBED_ASSERT(primask & 0x1); /* Interrupts must be disabled on invoking an exit from a critical section */

interrupt_enable_counter--;

Expand Down