Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ns_hal_init.c
00001 /* 00002 * Copyright (c) 2016-2018 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #include "ns_types.h" 00018 #include <stdlib.h> 00019 #include <assert.h> 00020 00021 #include "eventOS_scheduler.h" 00022 #include "ns_event_loop.h" 00023 #include "randLIB.h" 00024 #include "platform/arm_hal_timer.h" 00025 #include "ns_trace.h" 00026 00027 #include "arm_hal_interrupt_private.h" 00028 #include "ns_hal_init.h" 00029 00030 void ns_hal_init(void *heap, size_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr) 00031 { 00032 static bool initted; 00033 if (initted) { 00034 return; 00035 } 00036 if (!heap) { 00037 heap = malloc(h_size); 00038 assert(heap); 00039 if (!heap) { 00040 return; 00041 } 00042 } 00043 platform_critical_init(); 00044 ns_dyn_mem_init(heap, h_size, passed_fptr, info_ptr); 00045 platform_timer_enable(); 00046 eventOS_scheduler_init(); 00047 00048 // We do not initialise randlib, as it should be done after 00049 // RF driver has started, to get MAC address and RF noise as seed. 00050 // We do not initialise trace - left to application. 00051 00052 // Prepare the event loop lock which is used even if the loop 00053 // is not ran in a separate thread. 00054 ns_event_loop_init(); 00055 00056 #if !MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_DISPATCH_FROM_APPLICATION 00057 ns_event_loop_thread_create(); 00058 ns_event_loop_thread_start(); 00059 #endif 00060 00061 initted = true; 00062 }
Generated on Tue Aug 9 2022 00:37:17 by
1.7.2