There are several additional API functions available to a module, as follows:
Additional error codes are returned for some ThreadX APIs. These additional error codes are defined as follows:
Application-specific request to resident code.
UINT txm_module_application_request(
ULONG request,
ULONG param_1,
ULONG param_2,
ULONG param_3);
This service makes the specified request to the resident portion of the application. It is assumed that the request structure is prepared prior to the call. The actual processing of the request takes place in the resident code in the function _txm_module_manager_application_request. By default, this function is left empty and is designed for the resident application developer to modify.
Module threads
/* Call application resident code with ID=77 and the
parameters set to 1, 2, 3. */
status = txm_module_application_request(77, 1, 2, 3);
/* If status is TX_SUCCESS the request was successful. */
Allocate memory in the object pool (created by the resident application) for a module object control block.
UINT txm_module_object_allocate(
VOID **object_ptr,
ULONG object_size);
This service allocates memory for a module object from memory outside of the module, which helps prevent corruption of the object control block by the module’s code. In memory protected systems, all object control blocks must be allocated with this API before they can be created.
Module threads
TX_QUEUE *queue_pointer;
/* Allocate a control block for a module message queue. */
status = txm_module_object_allocate(&queue_pointer, sizeof(TX_QUEUE));
/* If status is TX_SUCCESS the queue_pointer points to
memory allocated outside of the module and can be supplied
to tx_queue_create to create a queue for the module. */
Deallocate previously allocated object memory
UINT txm_module_object_deallocate(VOID *object_ptr);
This service has been deprecated because it is no longer needed.
The memory that was previously allocated via txm_module_object_allocate is deallocated in the tx_*_delete service.
Module threads
TX_QUEUE *queue_pointer;
/* Deallocate control block for a module message queue. */
status = txm_module_object_deallocate(queue_pointer);
/* If status is TX_SUCCESS the object memory associated
with queue_pointer is deallocated. */
Find system object and retrieve object pointer
UINT txm_module_object_pointer_get(
UINT object_type, CHAR *name,
VOID **object_ptr);
This service retrieves the object pointer of a particular type with a particular name. If the object is not found, an error is returned. Otherwise, if the object is found, the address of that object is placed in “object_ptr.” This pointer can then be used to make system service calls, to interact with the resident code, and/or other loaded modules in the system.
Module threads
TX_QUEUE *queue_pointer;
/* Find the pointer for "fft_queue" in the resident part
of the application. */
status = txm_module_object_pointer_get(TXM_QUEUE_OBJECT,
"fft_queue", &queue_pointer);
/* If status is TX_SUCCESS the found queue pointer is in
"queue_pointer". This queue pointer can then be used to
send messages to the "fft_queue." */
Find system object and retrieve object pointer
UINT txm_module_object_pointer_get_extended(UINT object_type,
CHAR *name,
UINT name_length,
VOID **object_ptr);
This service retrieves the object pointer of a particular type with a particular name. If the object is not found, an error is returned. Otherwise, if the object is found, the address of that object is placed in “object_ptr.” This pointer can then be used to make system service calls, to interact with the resident code, and/or other loaded modules in the system.
Module threads
TX_QUEUE *queue_pointer;
/* Find the pointer for "fft_queue" in the resident part
of the application. */
status = txm_module_object_pointer_get_extended(TXM_QUEUE_OBJECT,
"fft_queue", 9, &queue_pointer);
/* If status is TX_SUCCESS the found queue pointer is in
"queue_pointer". This queue pointer can then be used to
send messages to the "fft_queue." */