Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
#define TX_SOURCE_CODE
#include "tx_api.h"
#include "tx_mutex.h"
#include "tx_queue.h"
#include "tx_thread.h"
#include "txm_module.h"
...
...
_txm_module_manager_start(TXM_MODULE_INSTANCE *)
Files
loading (2/4)...
SourceVuSTM32 Libraries and Samplesthreadxcommon_modules/module_manager/src/txm_module_manager_start.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ ... /**************************************************************************/ /**************************************************************************/ /** */ /** ThreadX Component */ /** */ /** Module Manager */ /** */... /**************************************************************************/ /**************************************************************************/ #define TX_SOURCE_CODE #include "tx_api.h" #include "tx_mutex.h" #include "tx_queue.h" #include "tx_thread.h" #include "txm_module.h" 5 includes ... /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _txm_module_manager_start PORTABLE C */ /* 6.1.3 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function starts execution of the specified module. */ /* */ /* INPUT */ /* */ /* module_instance Module instance pointer */ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* _txm_module_manager_thread_create Module thread create */ /* _tx_mutex_get Get protection mutex */ /* _tx_mutex_put Release protection mutex */ /* _tx_queue_create Create module callback queue */ /* _tx_queue_delete Delete module callback queue */ /* _tx_thread_resume Resume start thread */ /* */ /* CALLED BY */ /* */ /* Application code */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 Scott Larson Initial Version 6.1 */ /* 12-31-2020 Scott Larson Modified comment(s), */ /* resulting in version 6.1.3 */ /* */... /**************************************************************************/ UINT _txm_module_manager_start(TXM_MODULE_INSTANCE *module_instance) { UINT status; /* Determine if the module manager has not been initialized yet. */ if (_txm_module_manager_ready != TX_TRUE) { /* Module manager has not been initialized. */ return(TX_NOT_AVAILABLE); }if (_txm_module_manager_ready != TX_TRUE) { ... } /* Determine if the module is valid. */ if (module_instance == TX_NULL) { /* Invalid module pointer. */ return(TX_PTR_ERROR); }if (module_instance == TX_NULL) { ... } /* Get module manager protection mutex. */ _tx_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER); /* Determine if the module instance is valid. */ if (module_instance -> txm_module_instance_id != TXM_MODULE_ID) { /* Release the protection mutex. */ _tx_mutex_put(&_txm_module_manager_mutex); /* Invalid module pointer. */ return(TX_PTR_ERROR); }if (module_instance -> txm_module_instance_id != TXM_MODULE_ID) { ... } /* Determine if the module instance is in the loaded state. */ if ((module_instance -> txm_module_instance_state != TXM_MODULE_LOADED) && (module_instance -> txm_module_instance_state != TXM_MODULE_STOPPED)) { /* Release the protection mutex. */ _tx_mutex_put(&_txm_module_manager_mutex); /* Return error if the module is not ready. */ return(TX_START_ERROR); }if ((module_instance -> txm_module_instance_state != TXM_MODULE_LOADED) && (module_instance -> txm_module_instance_state != TXM_MODULE_STOPPED)) { ... } /* Check the priorities of the start/stop and callback request threads. */ if (module_instance -> txm_module_instance_start_stop_priority < module_instance -> txm_module_instance_maximum_priority || module_instance -> txm_module_instance_callback_priority < module_instance -> txm_module_instance_maximum_priority) { /* Release the protection mutex. */ _tx_mutex_put(&_txm_module_manager_mutex); /* At least one thread has an invalid priority. */ return(TX_PRIORITY_ERROR); }if (module_instance -> txm_module_instance_start_stop_priority < module_instance -> txm_module_instance_maximum_priority || module_instance -> txm_module_instance_callback_priority < module_instance -> txm_module_instance_maximum_priority) { ... } /* Create the module's callback request queue. */ status = _tx_queue_create(&(module_instance -> txm_module_instance_callback_request_queue), "Module Callback Request Queue", (sizeof(TXM_MODULE_CALLBACK_MESSAGE)/sizeof(ULONG)), module_instance -> txm_module_instance_callback_request_queue_area, sizeof(module_instance -> txm_module_instance_callback_request_queue_area)); /* Determine if there was an error. */ if (status) { /* Release the protection mutex. */ _tx_mutex_put(&_txm_module_manager_mutex); /* Return error if the module is not ready. */ return(TX_START_ERROR); }if (status) { ... } /* Create the module start thread. */ status = _txm_module_manager_thread_create(&(module_instance -> txm_module_instance_start_stop_thread), "Module Start Thread", module_instance -> txm_module_instance_shell_entry_function, module_instance -> txm_module_instance_start_thread_entry, module_instance -> txm_module_instance_application_module_id, module_instance -> txm_module_instance_start_stop_stack_start_address, module_instance -> txm_module_instance_start_stop_stack_size, (UINT) module_instance -> txm_module_instance_start_stop_priority, (UINT) module_instance -> txm_module_instance_start_stop_priority, TXM_MODULE_TIME_SLICE, TX_DONT_START, sizeof(TX_THREAD), module_instance); /* Determine if the thread create was successful. */ if (status != TX_SUCCESS) { /* Delete the callback notification queue. */ _tx_queue_delete(&(module_instance -> txm_module_instance_callback_request_queue)); /* Release the protection mutex. */ _tx_mutex_put(&_txm_module_manager_mutex); /* Return the error status. */ return(status); }if (status != TX_SUCCESS) { ... } /* Create the module callback thread. */ status = _txm_module_manager_thread_create(&(module_instance -> txm_module_instance_callback_request_thread), "Module Callback Request Thread", module_instance -> txm_module_instance_shell_entry_function, module_instance -> txm_module_instance_callback_request_thread_entry, module_instance -> txm_module_instance_application_module_id, module_instance -> txm_module_instance_callback_stack_start_address, module_instance -> txm_module_instance_callback_stack_size, (UINT) module_instance -> txm_module_instance_callback_priority, (UINT) module_instance -> txm_module_instance_callback_priority, TX_NO_TIME_SLICE, TX_DONT_START, sizeof(TX_THREAD), module_instance); /* Determine if the thread create was successful. */ if (status != TX_SUCCESS) { /* Terminate the start thread. */ _tx_thread_terminate(&(module_instance -> txm_module_instance_start_stop_thread)); /* Delete the start thread. */ _tx_thread_delete(&(module_instance -> txm_module_instance_start_stop_thread)); /* Delete the callback notification queue. */ _tx_queue_delete(&(module_instance -> txm_module_instance_callback_request_queue)); /* Release the protection mutex. */ _tx_mutex_put(&_txm_module_manager_mutex); /* Return the error status. */ return(status); }if (status != TX_SUCCESS) { ... } /* Set the module state to started. */ module_instance -> txm_module_instance_state = TXM_MODULE_STARTED; /* Release the protection mutex. */ _tx_mutex_put(&_txm_module_manager_mutex); /* Resume the module's start thread. */ _tx_thread_resume(&(module_instance -> txm_module_instance_start_stop_thread)); /* Return success. */ return(TX_SUCCESS); }{ ... }
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.