Dependencies:   MMA7660 LM75B

Committer:
MACRUM
Date:
Sat Jun 30 01:40:30 2018 +0000
Revision:
0:119624335925
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:119624335925 1 // ----------------------------------------------------------------------------
MACRUM 0:119624335925 2 // Copyright 2016-2017 ARM Ltd.
MACRUM 0:119624335925 3 //
MACRUM 0:119624335925 4 // SPDX-License-Identifier: Apache-2.0
MACRUM 0:119624335925 5 //
MACRUM 0:119624335925 6 // Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 0:119624335925 7 // you may not use this file except in compliance with the License.
MACRUM 0:119624335925 8 // You may obtain a copy of the License at
MACRUM 0:119624335925 9 //
MACRUM 0:119624335925 10 // http://www.apache.org/licenses/LICENSE-2.0
MACRUM 0:119624335925 11 //
MACRUM 0:119624335925 12 // Unless required by applicable law or agreed to in writing, software
MACRUM 0:119624335925 13 // distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 0:119624335925 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 0:119624335925 15 // See the License for the specific language governing permissions and
MACRUM 0:119624335925 16 // limitations under the License.
MACRUM 0:119624335925 17 // ----------------------------------------------------------------------------
MACRUM 0:119624335925 18
MACRUM 0:119624335925 19 #include "ns_hal_init.h"
MACRUM 0:119624335925 20
MACRUM 0:119624335925 21 #include "ns_types.h"
MACRUM 0:119624335925 22 #include <stdlib.h>
MACRUM 0:119624335925 23 #include <assert.h>
MACRUM 0:119624335925 24
MACRUM 0:119624335925 25 #include "arm_hal_interrupt_private.h"
MACRUM 0:119624335925 26 #include "ns_event_loop.h"
MACRUM 0:119624335925 27 #include "eventOS_scheduler.h"
MACRUM 0:119624335925 28 #include "platform/arm_hal_timer.h"
MACRUM 0:119624335925 29 #include "ns_trace.h"
MACRUM 0:119624335925 30
MACRUM 0:119624335925 31
MACRUM 0:119624335925 32 void ns_hal_init(void *heap, size_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
MACRUM 0:119624335925 33 {
MACRUM 0:119624335925 34 static bool initted;
MACRUM 0:119624335925 35 if (initted) {
MACRUM 0:119624335925 36 return;
MACRUM 0:119624335925 37 }
MACRUM 0:119624335925 38 if (!heap) {
MACRUM 0:119624335925 39 heap = malloc(h_size);
MACRUM 0:119624335925 40 assert(heap);
MACRUM 0:119624335925 41 if (!heap) {
MACRUM 0:119624335925 42 return;
MACRUM 0:119624335925 43 }
MACRUM 0:119624335925 44 }
MACRUM 0:119624335925 45 platform_critical_init();
MACRUM 0:119624335925 46 ns_dyn_mem_init(heap, h_size, passed_fptr, info_ptr);
MACRUM 0:119624335925 47 eventOS_scheduler_init();
MACRUM 0:119624335925 48 // We do not initialise randlib, as it should be done after
MACRUM 0:119624335925 49 // RF driver has started, to get MAC address and RF noise as seed.
MACRUM 0:119624335925 50 // We do not initialise trace - left to application.
MACRUM 0:119624335925 51 ns_event_loop_thread_create();
MACRUM 0:119624335925 52 ns_event_loop_thread_start();
MACRUM 0:119624335925 53 initted = true;
MACRUM 0:119624335925 54 }