CMSIS-RTOS2: Memory Pool Functions

| CMSIS-RTOS2 Version 2.1.3 Real-Time Operating System: API and RTX Reference Implementation

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Memory Pool Functions
Event functions

Events generated by memory pool functions. More...

## Functions

void | EvrRtxMemoryPoolError (osMemoryPoolId_t mp_id, int32_t status)
| Event on memory pool error (Error) More...
void | EvrRtxMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr)
| Event on memory pool create and initialize (API) More...
void | EvrRtxMemoryPoolCreated (osMemoryPoolId_t mp_id, const char *name)
| Event on successful memory pool create (Op) More...
void | EvrRtxMemoryPoolGetName (osMemoryPoolId_t mp_id, const char *name)
| Event on memory pool name retrieve (API) More...
void | EvrRtxMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout)
| Event on memory pool allocation (API) More...
void | EvrRtxMemoryPoolAllocPending (osMemoryPoolId_t mp_id, uint32_t timeout)
| Event on pending memory pool allocation (Op) More...
void | EvrRtxMemoryPoolAllocTimeout (osMemoryPoolId_t mp_id)
| Event on memory pool allocation timeout (Op) More...
void | EvrRtxMemoryPoolAllocated (osMemoryPoolId_t mp_id, void *block)
| Event on successful memory pool allocation (Op) More...
void | EvrRtxMemoryPoolAllocFailed (osMemoryPoolId_t mp_id)
| Event on unsuccessful memory pool allocation (Op) More...
void | EvrRtxMemoryPoolFree (osMemoryPoolId_t mp_id, void *block)
| Event on memory pool free (API) More...
void | EvrRtxMemoryPoolDeallocated (osMemoryPoolId_t mp_id, void *block)
| Event on successful memory pool free (Op) More...
void | EvrRtxMemoryPoolFreeFailed (osMemoryPoolId_t mp_id, void *block)
| Event on unsuccessful memory pool free (Op) More...
void | EvrRtxMemoryPoolGetCapacity (osMemoryPoolId_t mp_id, uint32_t capacity)
| Event on memory pool capacity retrieve (API) More...
void | EvrRtxMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id, uint32_t block_size)
| Event on memory pool block size retrieve (API) More...
void | EvrRtxMemoryPoolGetCount (osMemoryPoolId_t mp_id, uint32_t count)
| Event on used memory pool blocks retrieve (API) More...
void | EvrRtxMemoryPoolGetSpace (osMemoryPoolId_t mp_id, uint32_t space)
| Event on available memory pool blocks retrieve (API) More...
void | EvrRtxMemoryPoolDelete (osMemoryPoolId_t mp_id)
| Event on memory pool delete (API) More...
void | EvrRtxMemoryPoolDestroyed (osMemoryPoolId_t mp_id)
| Event on successful memory pool delete (Op) More...

## Description

## Function Documentation

void EvrRtxMemoryPoolError | ( | osMemoryPoolId_t | mp_id,
|  | int32_t | status
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew or NULL when ID is unknown.
  [in] | status | extended execution status.

The event MemoryPoolError is generated when Memory Pool routines complete their execution due to an error.

The status parameter indicates the execution status and can be one of the osStatus_t codes or one of the extended execution status codes which are summarized in the table below.

Extended Status Code | Description
--- | ---
osRtxErrorKernelNotReady | Kernel scheduler is not in Ready state.
osRtxErrorKernelNotRunning | Kernel scheduler is not executing - there is no running thread.
osRtxErrorInvalidControlBlock | Object control block with invalid alignment or size was specified.
osRtxErrorInvalidDataMemory | Object data memory with invalid alignment or size was specified.
osRtxErrorInvalidThreadStack | Thread stack memory with invalid alignment or size was specified.
osRtxErrorInvalidPriority | Invalid thread priority was specified.
osRtxErrorThreadNotJoinable | Specified thread is not joinable.
osRtxErrorMutexNotOwned | Specified mutex is not owned by the current running thread.
osRtxErrorMutexNotLocked | Specified mutex is not locked.
osRtxErrorMutexLockLimit | Maximum number of recursive mutex locks reached.
osRtxErrorSemaphoreCountLimit | Semaphore count limit reached.
osRtxErrorTZ_InitContext_S | Secure context memory system initialization failed.
osRtxErrorTZ_AllocContext_S | Secure context memory allocation failed.
osRtxErrorTZ_FreeContext_S | Secure context memory deallocation failed.
osRtxErrorTZ_LoadContext_S | Secure context load failed.
osRtxErrorTZ_SaveContext_S | Secure context save failed.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- status : execution status code.

void EvrRtxMemoryPoolNew | ( | uint32_t | block_count,
|  | uint32_t | block_size,
|  | const osMemoryPoolAttr_t * | attr
| ) |  |

Parameters

  [in] | block_count | maximum number of memory blocks in memory pool.
  [in] | block_size | memory block size in bytes.
  [in] | attr | memory pool attributes; NULL: default values.

The event MemoryPoolNew is generated when the function osMemoryPoolNew is called.

Value in the Event Recorder shows:

- block_count : maximum number of memory blocks in memory pool.
- block_size : memory block size in bytes.
- attr : memory address of Memory Pool attributes or 0 when they are not specified.

void EvrRtxMemoryPoolCreated | ( | osMemoryPoolId_t | mp_id,
|  | const char * | name
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | name | pointer to memory pool object name.

The event MemoryPoolCreated is generated when the function osMemoryPoolNew successfully creates a memory pool object.

Value in the Event Recorder shows:

- mp_id : memory pool ID.

void EvrRtxMemoryPoolGetName | ( | osMemoryPoolId_t | mp_id,
|  | const char * | name
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | name | pointer to memory pool object name.

The event MemoryPoolGetName is generated when the function osMemoryPoolGetName is called and its execution result is known.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- name : retrieved memory address of name string (0 in case of a failure).

void EvrRtxMemoryPoolAlloc | ( | osMemoryPoolId_t | mp_id,
|  | uint32_t | timeout
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | timeout | Timeout Value or 0 in case of no time-out.

The event MemoryPoolAlloc is generated when the function osMemoryPoolAlloc is called.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- timeout : Timeout Value.

void EvrRtxMemoryPoolAllocPending | ( | osMemoryPoolId_t | mp_id,
|  | uint32_t | timeout
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | timeout | Timeout Value or 0 in case of no time-out.

The event MemoryPoolAllocPending is generated when the function osMemoryPoolAlloc blocks current running thread and waits for memory block to become available.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- timeout : Timeout Value.

void EvrRtxMemoryPoolAllocTimeout | ( | osMemoryPoolId_t | mp_id | ) |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.

The event MemoryPoolAllocTimeout is generated when wait for memory pool to become available is aborted due to expired wait timeout.

Value in the Event Recorder shows:

- mp_id : memory pool ID.

void EvrRtxMemoryPoolAllocated | ( | osMemoryPoolId_t | mp_id,
|  | void * | block
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | block | address of the allocated memory block.

The event MemoryPoolAllocated is generated when the function osMemoryPoolAlloc successfully allocates the memory block.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- block : memory address of the allocated memory block.

void EvrRtxMemoryPoolAllocFailed | ( | osMemoryPoolId_t | mp_id | ) |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.

The event MemoryPoolAllocFailed is generated when the function osMemoryPoolAlloc fails to allocate the memory block due to out of available memory.

Value in the Event Recorder shows:

- mp_id : memory pool ID.

void EvrRtxMemoryPoolFree | ( | osMemoryPoolId_t | mp_id,
|  | void * | block
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | block | address of the allocated memory block to be returned to the memory pool.

The event MemoryPoolFree is generated when the function osMemoryPoolFree is called.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- block : memory address of the memory block to be returned to the memory pool.

void EvrRtxMemoryPoolDeallocated | ( | osMemoryPoolId_t | mp_id,
|  | void * | block
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | block | address of the allocated memory block to be returned to the memory pool.

The event MemoryPoolDeallocated is generated when the function osMemoryPoolFree successfully deallocates the memory block.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- block : memory address of the memory block returned to the memory pool.

void EvrRtxMemoryPoolFreeFailed | ( | osMemoryPoolId_t | mp_id,
|  | void * | block
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | block | address of the allocated memory block to be returned to the memory pool.

The event MemoryPoolFreeFailed is generated when the function osMemoryPoolFree fails to deallocate the memory block.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- block : memory address of the memory block to be returned to the memory pool.

void EvrRtxMemoryPoolGetCapacity | ( | osMemoryPoolId_t | mp_id,
|  | uint32_t | capacity
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | capacity | maximum number of memory blocks.

The event MemoryPoolGetCapacity is generated when the function osMemoryPoolGetCapacity is called and its execution result is known.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- capacity : retrieved maximum number of memory blocks (0 in case of a failure).

void EvrRtxMemoryPoolGetBlockSize | ( | osMemoryPoolId_t | mp_id,
|  | uint32_t | block_size
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | block_size | memory block size in bytes.

The event MemoryPoolGetBlockSize is generated when the function osMemoryPoolGetBlockSize is called and its execution result is known.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- block_size : retrieved memory block size in bytes (0 in case of a failure).

void EvrRtxMemoryPoolGetCount | ( | osMemoryPoolId_t | mp_id,
|  | uint32_t | count
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | count | number of memory blocks used.

The event MemoryPoolGetCount is generated when the function osMemoryPoolGetCount is called and its execution result is known.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- count : retrieved number of memory block used (0 in case of a failure).

void EvrRtxMemoryPoolGetSpace | ( | osMemoryPoolId_t | mp_id,
|  | uint32_t | space
| ) |  |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.
  [in] | space | number of memory blocks available.

The event MemoryPoolGetSpace is generated when the function osMemoryPoolGetSpace is called and its execution result is known.

Value in the Event Recorder shows:

- mp_id : memory pool ID.
- space : retrieved number of memory blocks available (0 in case of a failure).

void EvrRtxMemoryPoolDelete | ( | osMemoryPoolId_t | mp_id | ) |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.

The event MemoryPoolDelete is generated when the function osMemoryPoolDelete is called.

Value in the Event Recorder shows:

- mp_id : memory pool ID.

void EvrRtxMemoryPoolDestroyed | ( | osMemoryPoolId_t | mp_id | ) |

Parameters

  [in] | mp_id | memory pool ID obtained by osMemoryPoolNew.

The event MemoryPoolDestroyed is generated when the function osMemoryPoolDelete successfully deletes the memory pool object.

Value in the Event Recorder shows:

- mp_id : memory pool ID.