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.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/ns_hal_init.c
- Committer:
 - jacobjohnson
 - Date:
 - 2017-02-27
 - Revision:
 - 1:f30bdcd2b33b
 - Parent:
 - 0:098463de4c5d
 
File content as of revision 1:f30bdcd2b33b:
/*
 * Copyright (c) 2016 ARM Limited, All Rights Reserved
 */
#include "ns_types.h"
#include <stdlib.h>
#include <assert.h>
#include "eventOS_scheduler.h"
#include "ns_event_loop.h"
#include "randLIB.h"
#include "platform/arm_hal_timer.h"
#include "ns_trace.h"
#include "arm_hal_interrupt_private.h"
#include "ns_hal_init.h"
void ns_hal_init(void *heap, size_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
{
    static bool initted;
    if (initted) {
        return;
    }
    if (!heap) {
        heap = malloc(h_size);
        assert(heap);
        if (!heap) {
            return;
        }
    }
    platform_critical_init();
    ns_dyn_mem_init(heap, h_size, passed_fptr, info_ptr);
    platform_timer_enable();
    eventOS_scheduler_init();
    // We do not initialise randlib, as it should be done after
    // RF driver has started, to get MAC address and RF noise as seed.
    // We do not initialise trace - left to application.
    ns_event_loop_thread_create();
    ns_event_loop_thread_start();
    initted = true;
}