CMSIS/RTX: Allow overwriting mutex ops for ARMC

(cherry picked from commit b88254809e)
pull/7875/head
Bartek Szatkowski 2017-10-18 11:29:48 -05:00 committed by Russ Butler
parent 1be672d5f0
commit 4fd0daf9f5
1 changed files with 15 additions and 8 deletions

View File

@ -745,11 +745,12 @@ typedef void *mutex;
//lint -e818 "Pointer 'm' could be declared as pointing to const"
// Initialize mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
#endif
int _mutex_initialize(mutex *m);
int _mutex_initialize(mutex *m) {
__WEAK int _mutex_initialize(mutex *m) {
int result;
*m = osMutexNew(NULL);
if (*m != NULL) {
result = 1;
@ -761,8 +762,10 @@ int _mutex_initialize(mutex *m) {
}
// Acquire mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
void _mutex_acquire(mutex *m);
#endif
__WEAK void _mutex_acquire(mutex *m);
void _mutex_acquire(mutex *m) {
if (os_kernel_is_active() != 0U) {
(void)osMutexAcquire(*m, osWaitForever);
@ -770,8 +773,10 @@ void _mutex_acquire(mutex *m) {
}
// Release mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
void _mutex_release(mutex *m);
#endif
__WEAK void _mutex_release(mutex *m);
void _mutex_release(mutex *m) {
if (os_kernel_is_active() != 0U) {
(void)osMutexRelease(*m);
@ -779,8 +784,10 @@ void _mutex_release(mutex *m) {
}
// Free mutex
#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION < 6010050
__USED
void _mutex_free(mutex *m);
#endif
__WEAK void _mutex_free(mutex *m);
void _mutex_free(mutex *m) {
(void)osMutexDelete(*m);
}