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 Manager                                                      */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define TX_SOURCE_CODE
23 
24 #include "txm_module.h"
25 
26 
27 /**************************************************************************/
28 /*                                                                        */
29 /*  FUNCTION                                               RELEASE        */
30 /*                                                                        */
31 /*    _txm_module_manager_properties_get                  PORTABLE C      */
32 /*                                                           6.1          */
33 /*  AUTHOR                                                                */
34 /*                                                                        */
35 /*    Scott Larson, Microsoft Corporation                                 */
36 /*                                                                        */
37 /*  DESCRIPTION                                                           */
38 /*                                                                        */
39 /*    This function returns the properties of the specified module so they*/
40 /*    may be checked before executing the module.                         */
41 /*                                                                        */
42 /*  INPUT                                                                 */
43 /*                                                                        */
44 /*    module_instance                   Module instance pointer           */
45 /*                                                                        */
46 /*  OUTPUT                                                                */
47 /*                                                                        */
48 /*    status                            Completion status                 */
49 /*                                                                        */
50 /*  CALLS                                                                 */
51 /*                                                                        */
52 /*    None                                                                */
53 /*                                                                        */
54 /*  CALLED BY                                                             */
55 /*                                                                        */
56 /*    Application code                                                    */
57 /*                                                                        */
58 /*  RELEASE HISTORY                                                       */
59 /*                                                                        */
60 /*    DATE              NAME                      DESCRIPTION             */
61 /*                                                                        */
62 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
63 /*                                                                        */
64 /**************************************************************************/
_txm_module_manager_properties_get(TXM_MODULE_INSTANCE * module_instance,ULONG * module_properties_ptr)65 UINT  _txm_module_manager_properties_get(TXM_MODULE_INSTANCE *module_instance, ULONG *module_properties_ptr)
66 {
67 
68     /* Determine if the module manager has not been initialized yet.  */
69     if (_txm_module_manager_ready != TX_TRUE)
70     {
71 
72         /* Module manager has not been initialized.  */
73         return(TX_NOT_AVAILABLE);
74     }
75 
76     /* Determine if the module is valid.  */
77     if (module_instance == TX_NULL)
78     {
79 
80         /* Invalid module pointer.  */
81         return(TX_PTR_ERROR);
82     }
83 
84     /* Check the module ID.  */
85     if (module_instance -> txm_module_instance_id != TXM_MODULE_ID)
86     {
87 
88         /* Invalid module pointer.  */
89         return(TX_PTR_ERROR);
90     }
91 
92     /* Check for non-null buffer.  */
93     if (module_properties_ptr == TX_NULL)
94     {
95 
96         /* Invalid buffer pointer.  */
97         return(TX_PTR_ERROR);
98     }
99 
100     /* Simply return the property bitmap.  */
101     *module_properties_ptr =  module_instance -> txm_module_instance_property_flags;
102 
103     /* Return success.  */
104     return(TX_SUCCESS);
105 }
106