Provide information for recommended "Size of the regular memory pool" used in "ux_system_initialize" API for Host/ device class

Apurva Kumar 21 Reputation points

I want to know how i can finalize the recommended "Size of the regular memory pool" used in "ux_system_initialize" API while using USBX Host/ Device Class in my application code . Refer below code snipet :

UINT ux_system_initialize(VOID *regular_memory_pool_start,
ULONG regular_memory_size,
VOID *cache_safe_memory_pool_start,
ULONG cache_safe_memory_size);

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
326 questions
{count} votes

Accepted answer
  1. Chaoqiong Xiao 486 Reputation points Microsoft Employee

    There is no easy API for memory allocation check, but there is some way to check memory usage, by checking fiedls in global _ux_system.

    The regular memory passed by ux_system_initialize splits to two part: the system structures and memory pool for allocation.
    So at any time the memory usage is as follow:

    ux_global_structure_memory_bytes = (ALIGN_TYPE)_ux_system -> ux_system_regular_memory_pool_start - (ALIGN_TYPE)_ux_system;
    ux_allocated_regular_memory_bytes = _ux_system -> ux_system_regular_memory_pool_size - _ux_system -> ux_system_regular_memory_pool_free;

    The total usage is the sum of above two.

    Thus the size of memory usage can be estimated.

    Note with UX_ENABLE_MEMORY_STATISTICS defined there is another variable _ux_system -> ux_system_regular_memory_pool_min_free can be used to check max memory usage.

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful