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