Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
ns_hal_init.c
00001 /* 00002 * Copyright (c) 2016 ARM Limited, All Rights Reserved 00003 */ 00004 00005 #include "ns_types.h" 00006 #include <stdlib.h> 00007 #include <assert.h> 00008 00009 #include "eventOS_scheduler.h" 00010 #include "ns_event_loop.h" 00011 #include "randLIB.h" 00012 #include "platform/arm_hal_timer.h" 00013 #include "ns_trace.h" 00014 00015 #include "arm_hal_interrupt_private.h" 00016 #include "ns_hal_init.h" 00017 00018 void ns_hal_init(void *heap, size_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr) 00019 { 00020 static bool initted; 00021 if (initted) { 00022 return; 00023 } 00024 if (!heap) { 00025 heap = malloc(h_size); 00026 assert(heap); 00027 if (!heap) { 00028 return; 00029 } 00030 } 00031 platform_critical_init(); 00032 ns_dyn_mem_init(heap, h_size, passed_fptr, info_ptr); 00033 platform_timer_enable(); 00034 eventOS_scheduler_init(); 00035 // We do not initialise randlib, as it should be done after 00036 // RF driver has started, to get MAC address and RF noise as seed. 00037 // We do not initialise trace - left to application. 00038 ns_event_loop_thread_create(); 00039 ns_event_loop_thread_start(); 00040 initted = true; 00041 }
Generated on Sun Jul 17 2022 08:25:28 by 1.7.2