/* Allocate a memory block from a Memory Pool.  */
static void* svcRtxMemoryPoolAlloc(osMemoryPoolId_t mp_id, uint32_t timeout)
/* Allocate a memory block from a Memory Pool.  */
static void* svcRtxMemoryPoolAlloc(osMemoryPoolId_t mp_id, uint32_t timeout)
{
    EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
    return NULL;
  }
  block = osRtxMemoryPoolAlloc(&mp->mp_info);
  if (block != NULL) {
    EvrRtxMemoryPoolAllocated(mp, block);
  } else {
    if (timeout != 0U) {
      EvrRtxMemoryPoolAllocPending(mp, timeout);
      if (osRtxThreadWaitEnter(osRtxThreadWaitingMemoryPool, timeout)) {
        osRtxThreadListPut(osRtxObject(mp), osRtxThreadGetRunning());
      } else {
        EvrRtxMemoryPoolAllocTimeout(mp);
      }
    } else {
      EvrRtxMemoryPoolAllocFailed(mp);
    }
  }
  return block;
}