1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** ThreadX Component                                                     */
16 /**                                                                       */
17 /**   Module                                                              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define TXM_MODULE
23 #include "txm_module.h"
24 #ifndef TXM_MODULE_OBJECT_POINTER_GET_EXTENDED_CALL_NOT_USED
25 /**************************************************************************/
26 /*                                                                        */
27 /*  FUNCTION                                               RELEASE        */
28 /*                                                                        */
29 /*    _txm_module_manager_object_pointer_get_extended     PORTABLE C      */
30 /*                                                           6.1.10       */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    Scott Larson, Microsoft Corporation                                 */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This function retrieves the object pointer of a particular type     */
38 /*    with a particular name. If the object is not found, an error is     */
39 /*    returned. Otherwise, if the object is found, the address of that    */
40 /*    object is placed in object_ptr.                                     */
41 /*                                                                        */
42 /*  INPUT                                                                 */
43 /*                                                                        */
44 /*    object_type                       Type of object, as follows:       */
45 /*                                                                        */
46 /*                                          TXM_BLOCK_POOL_OBJECT         */
47 /*                                          TXM_BYTE_POOL_OBJECT          */
48 /*                                          TXM_EVENT_FLAGS_OBJECT        */
49 /*                                          TXM_MUTEX_OBJECT              */
50 /*                                          TXM_QUEUE_OBJECT              */
51 /*                                          TXM_SEMAPHORE_OBJECT          */
52 /*                                          TXM_THREAD_OBJECT             */
53 /*                                          TXM_TIMER_OBJECT              */
54 /*    name                              Name to search for                */
55 /*    name_length                       Length of the name excluding      */
56 /*                                        null-terminator                 */
57 /*    object_ptr                        Pointer to the object             */
58 /*                                                                        */
59 /*  OUTPUT                                                                */
60 /*                                                                        */
61 /*    TX_SUCCESS                        Successful completion             */
62 /*    TX_PTR_ERROR                      Invalid name or object ptr        */
63 /*    TX_OPTION_ERROR                   Invalid option type               */
64 /*    TX_NO_INSTANCE                    Object not found                  */
65 /*                                                                        */
66 /*  CALLS                                                                 */
67 /*                                                                        */
68 /*    _txm_module_kernel_call_dispatcher                                  */
69 /*                                                                        */
70 /*  CALLED BY                                                             */
71 /*                                                                        */
72 /*    Module application code                                             */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
79 /*  01-31-2022      Scott Larson            Modified comments and added   */
80 /*                                            CALL_NOT_USED option,       */
81 /*                                            resulting in version 6.1.10 */
82 /*                                                                        */
83 /**************************************************************************/
_txm_module_object_pointer_get_extended(UINT object_type,CHAR * name,UINT name_length,VOID ** object_ptr)84 UINT _txm_module_object_pointer_get_extended(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr)
85 {
86 
87 UINT return_value;
88 ALIGN_TYPE extra_parameters[2];
89 
90     extra_parameters[0] = (ALIGN_TYPE) name_length;
91     extra_parameters[1] = (ALIGN_TYPE) object_ptr;
92 
93     /* Call module manager dispatcher.  */
94     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MODULE_OBJECT_POINTER_GET_EXTENDED_CALL, (ALIGN_TYPE) object_type, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
95 
96     /* Return value to the caller.  */
97     return(return_value);
98 }
99 #endif
100