/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers.  That should only be done when
task.h is included from an application file. */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#include "FreeRTOS.h"
#include "task.h"
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE

#include "heap.h"

void *pvPortMalloc( size_t xWantedSize )
{
  void *pvReturn;

  pvReturn = malloc_dtcm( xWantedSize );
  traceMALLOC( pvReturn, xWantedSize );

#if( configUSE_MALLOC_FAILED_HOOK == 1 )
  if( pvReturn == NULL )
  {
      extern void vApplicationMallocFailedHook( void );
      vApplicationMallocFailedHook();
  }
#endif

  return pvReturn;
}

void vPortFree( void *pv )
{
  if( pv )
  {
    free_dtcm( pv );
    traceFREE( pv, 0 );
  }
}
