dhgdh

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by joey shelton

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nsdynmemLIB_stub.c Source File

nsdynmemLIB_stub.c

00001 /*
00002  * Copyright (c) 2014-2016 ARM Limited. All rights reserved.
00003  */
00004 
00005 #include "nsdynmemLIB_stub.h"
00006 #include <stdint.h>
00007 #include <string.h>
00008 #include "nsdynmemLIB.h"
00009 #include "platform/arm_hal_interrupt.h"
00010 #include <stdlib.h>
00011 
00012 nsdynmemlib_stub_data_t nsdynmemlib_stub;
00013 
00014 void ns_dyn_mem_init(uint8_t *heap, uint16_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
00015 {
00016 }
00017 
00018 void *ns_dyn_mem_alloc(int16_t alloc_size)
00019 {
00020     if (nsdynmemlib_stub.returnCounter > 0)
00021     {
00022         nsdynmemlib_stub.returnCounter--;
00023         return malloc(alloc_size);
00024     }
00025     else
00026     {
00027         return(nsdynmemlib_stub.expectedPointer);
00028     }
00029 }
00030 
00031 void *ns_dyn_mem_temporary_alloc(int16_t alloc_size)
00032 {
00033     if (nsdynmemlib_stub.returnCounter > 0)
00034     {
00035         nsdynmemlib_stub.returnCounter--;
00036         return malloc(alloc_size);
00037     }
00038     else
00039     {
00040         return(nsdynmemlib_stub.expectedPointer);
00041     }
00042 }
00043 
00044 void ns_dyn_mem_free(void *block)
00045 {
00046         free(block);
00047 }
00048