Simple interface for Mbed Cloud Client
Embed:
(wiki syntax)
Show/hide line numbers
arm_hal_interrupt.c
00001 // ---------------------------------------------------------------------------- 00002 // Copyright 2016-2017 ARM Ltd. 00003 // 00004 // SPDX-License-Identifier: Apache-2.0 00005 // 00006 // Licensed under the Apache License, Version 2.0 (the "License"); 00007 // you may not use this file except in compliance with the License. 00008 // You may obtain a copy of the License at 00009 // 00010 // http://www.apache.org/licenses/LICENSE-2.0 00011 // 00012 // Unless required by applicable law or agreed to in writing, software 00013 // distributed under the License is distributed on an "AS IS" BASIS, 00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 // See the License for the specific language governing permissions and 00016 // limitations under the License. 00017 // ---------------------------------------------------------------------------- 00018 00019 #include "platform/arm_hal_interrupt.h" 00020 00021 #include "arm_hal_interrupt_private.h" 00022 #include "pal.h" 00023 00024 #include <assert.h> 00025 00026 00027 static uint8_t sys_irq_disable_counter; 00028 00029 static palMutexID_t critical_mutex_id; 00030 00031 void platform_critical_init(void) 00032 { 00033 palStatus_t status; 00034 status = pal_osMutexCreate(&critical_mutex_id); 00035 assert(PAL_SUCCESS == status); 00036 } 00037 00038 void platform_enter_critical(void) 00039 { 00040 palStatus_t status; 00041 status = pal_osMutexWait(critical_mutex_id, UINT32_MAX); 00042 assert(PAL_SUCCESS == status); 00043 sys_irq_disable_counter++; 00044 } 00045 00046 void platform_exit_critical(void) 00047 { 00048 palStatus_t status; 00049 --sys_irq_disable_counter; 00050 status = pal_osMutexRelease(critical_mutex_id); 00051 assert(PAL_SUCCESS == status); 00052 }
Generated on Tue Jul 12 2022 19:01:32 by 1.7.2