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