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