Advertisement

Partition memory: utility services and data structures

December 11, 2017

Colin Walls-December 11, 2017

This article continues the look at RTOS partition memory.

Partition Pool Utility Services

Nucleus RTOS has three API calls which provide utility functions associated with partition pools: return information about a partition pool, return number of partition pools in the application and return pointers to all partition pools in the application. The first two of these are implemented in Nucleus SE.

Obtaining Partition Pool Information

This service call obtains a selection of information about a partition pool. The Nucleus SE implementation differs from Nucleus RTOS in that it returns less information, as object naming and suspend ordering are not supported and task suspend may not be enabled.

Nucleus RTOS API Call for Partition Pool Information

Service call prototype:

STATUS NU_Partition_Pool_Information(NU_PARTITION_POOL *pool, CHAR  *name, VOID **start_address, UNSIGNED *pool_size, UNSIGNED *partition_size, UNSIGNED *available, UNSIGNED *allocated, OPTION  *suspend_type, UNSIGNED *tasks_waiting, NU_TASK  **first_task);

Parameters:

pool – pointer to the partition pool about which information is being requested

name – pointer to an 8-character destination area for the partition pool’s name; this includes space for the null terminator.

start_address – a pointer to a variable, which will receive a pointer to the start of the partition pool data area

pool_size – a pointer to a variable, which will receive the size of the partition pool (in bytes)

partition_size – a pointer to a variable, which will receive the size of partitions in this pool

available – a pointer to a variable, which will receive the number of partitions currently available in this pool

allocated – a pointer to a variable, which will receive the number of partitions currently in use in this pool

suspend_type – pointer to a variable for holding the task suspend type; valid task suspend types are NU_FIFO and NU_PRIORITY.

tasks_waiting – a pointer to a variable which will receive the number of tasks suspended on this partition pool

first_task – a pointer to a task pointer into which is placed the pointer of the first suspended task

Returns:

NU_SUCCESS – the call was completed successfully

NU_INVALID_POOL – the partition pool pointer is not valid

Nucleus SE API Call for Partition Pool Information

This API call supports the key functionality of the Nucleus RTOS API.

Service call prototype:

STATUS NUSE_Partition_Pool_Information(NUSE_PARTITION_POOL pool, ADDR *start_address, U32 *pool_size, U16 *partition_size, U8 *available, U8 *allocated, U8 *tasks_waiting, NUSE_TASK *first_task) 

Parameters:

pool – the index of the partition pool about which information is being requested

start_address – a pointer to a variable, which will receive a pointer to the start of the partition pool data area

pool_size – a pointer to a variable, which will receive the size of the partition pool (in bytes)

partition_size – a pointer to a variable, which will receive the size of partitions in this pool

available – a pointer to a variable, which will receive the number of partitions currently available in this pool

allocated – a pointer to a variable, which will receive the number of partitions currently in use in this pool

tasks_waiting – a pointer to a variable which will receive the number of tasks suspended on this partition pool (nothing returned if task suspend is disabled)

first_task – a pointer to a variable of type NUSE_TASK which will receive the index of the first suspended task (nothing returned if task suspend is disabled)

Returns:

NUSE_SUCCESS – the call was completed successfully

NUSE_INVALID_POOL – the partition pool index is not valid

NUSE_INVALID_POINTER – one or more of the pointer parameters is invalid

Nucleus SE Implementation of Partition Pool Information

The implementation of this API call is quite straightforward:

The function returns the partition pool status. Then, if blocking API calls is enabled, the number of waiting tasks and the index of the first one are returned (otherwise these two parameters are set to 0).

Obtaining the Number of Partition Pools

This service call returns the number of partition pools configured in the application. Whilst in Nucleus RTOS this will vary over time and the returned value will represent the current number of pools, in Nucleus SE the value returned is set at build time and cannot change.

Nucleus RTOS API Call for Number of Partition Pools

This API call supports the key functionality of the Nucleus RTOS API.

Service call prototype:

UNSIGNED NU_Established_Partition_Pools(VOID);

Parameters:

None

Returns:

The number of created partition pools in the application

Nucleus SE API Call for Number of Partition Pools

This API call supports the key functionality of the Nucleus RTOS API.

Service call prototype:

U8 NUSE_Partition_Pool_Count(void);

Parameters:

None

Returns:

The number of configured partition pools in the application

Implementation

The implementation of this API call is almost trivially simple: the value of the #define symbol NUSE_PARTITION_POOL_NUMBER is returned.


Continue reading on page two >>

 

< Previous
Page 1 of 2
Next >

Loading comments...

Most Commented