/* Return an allocated memory block back to a Memory Pool.  */
static osStatus_t svcRtxMemoryPoolFree(osMemoryPoolId_t mp_id, void *block)
/* Return an allocated memory block back to a Memory Pool.  */
static osStatus_t svcRtxMemoryPoolFree(osMemoryPoolId_t mp_id, void *block)
{
    EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
    return osErrorParameter;
  }
  status = osRtxMemoryPoolFree(&mp->mp_info, block);
  if (status == osOK) {
    EvrRtxMemoryPoolDeallocated(mp, block);
    if (mp->thread_list != NULL) {
      block0 = osRtxMemoryPoolAlloc(&mp->mp_info);
      if (block0 != NULL) {
        thread = osRtxThreadListGet(osRtxObject(mp));
        osRtxThreadWaitExit(thread, (uint32_t)block0, TRUE);
        EvrRtxMemoryPoolAllocated(mp, block0);
      }
    }
  } else {
    EvrRtxMemoryPoolFreeFailed(mp, block);
  }
  return status;
}