| ISF 2.2 rev 5 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

isf_init.h
Go to the documentation of this file.
1 /**
2 * @file isf_init.h
3 * @brief The \b isf_init.h file contains the task initialization attributes required for initialization of the following
4 * ISF tasks: \n
5 * @li ISF Initialization task
6 * @li ISF Sensor Manager task
7 * @li ISF Command Interpreter task
8 * @li ISF Bus Manager task.
9 *
10 *
11 * @copyright Copyright (c) 2015, Freescale Semiconductor, Inc.
12 */
13
14 #ifndef ISF_INIT_H_
15 #define ISF_INIT_H_
16
17 #include "isf_user_config.h"
18 #include "isf.h"
19
20 /*!
21 * @brief Definition of the system ready event.
22 */
23 #define ISF_SYSTEM_READY_EVENT (1<<1)
24 /*!
25 * @brief Definition of the event handle to the system ready event.
26 */
27 /*!
28 * @brief Definition of the base task priority for ISF tasks.<br>
29 * \b Note: Task priority of all ISF tasks must be
30 * set higher than user task priorities. <br>
31 * \b Note: Lower numbers represent higher task priorities and
32 * higher numbers represent lower priorities.
33 */
34 #define ISF_TASK_PRIORITY (9)
35
36 /*!
37 * @brief Definition of the task priority used by the lowest priority ISF task. <br>
38 * \b Note: User tasks must be set to a higher priority level than the task priority
39 * used by the lowest priority ISF task. <br>
40 * \b Note: Lower numbers represent higher task priorities and
41 * higher numbers represent lower priorities.
42 *
43 */
44 #define ISF_TASK_LOWEST_PRIORITY (20)
45
46 /*!
47 * @brief Definition of the starting task index for ISF tasks. <br>
48 * \b Note: User task indexes must have a LOWER value than the value defined here.
49 */
50 #define ISF_TASK_INDEX_START (50)
51
52
53
54 // ==========================================================================
55
56 /*!
57 * @brief This function initializes the ISF library.
58 *
59 * @Purpose The isf_lib_init() function is called by an application to
60 * initialize the ISF library. <br>
61 * \b Note: This initialization must be done in the user application before it calls any
62 * ISF function.
63 *
64 * @param[in] pOptions This must be a NULL pointer.
65 *
66 * @return ::isf_lib_init() returns a value of type ::isf_status_t indicating
67 * the result of the operation.
68 *
69 * @retval ::ISF_SUCCESS is returned when the library initializes successfully.
70 * @retval ::ISF_ERR_LIB_INIT is returned when the library does not initialize successfully.
71 *
72 * @reentrant No
73 *
74 * @libs None.
75 *
76 */
77 isf_status_t isf_lib_init(void *pOptions);
78
79
80 /*!
81 * @brief This function initializes the ISF components for operation.
82 *
83 * @Purpose The ISF initialization task calls each ISF component to
84 * perform a one-time initialization. Each ISF component executes its initialization
85 * routine, if enabled in isf_user_config.h and if there are any initialization
86 * activities to perform.
87 *
88 * @param[in] initial_data This is required by MQX and any UINT32 value can be used.
89 *
90 * @return This function does not return any values.
91 *
92 * @Constraints (1) The isf_init_task() must be the highest priority task in the system. <br>
93 * (2) This API call must be invoked only once and must run before any other task in the system runs.
94 * This can be ensured by using the default setting
95 * in isf_init.h, which sets this task as the highest priority task in the system. \n
96 * Once initialization is complete, the task exits and its task memory is
97 * reclaimed by the system and is made available for application use.
98 *
99 * @Reentrant No
100 *
101 * @Libs isf_core.lib
102 *
103 */
104 void isf_init_task(uint32 initial_data);
105
106 /*!
107 * @brief This function synchronizes the user tasks and the system initialization.
108 *
109 * @Purpose This function blocks the user tasks from executing until ISF initialization is completed.
110 *
111 * @return This function does not return any values.
112 *
113 * @Constraints
114 *
115 * @Reentrant No
116 *
117 * @Libs isf_core.lib
118 *
119 */
120 void isf_system_sync(void);
121
122 /*!
123 * @brief The following macros define the individual attributes for ISF Initialization Task startup. <br>
124 * \b Note: These macro definitions must not be changed by the user.
125 */
126 #define ISF_TASK_INIT_INDEX (ISF_TASK_INDEX_START + 0)
127 #define ISF_TASK_INIT_STACK_SIZE (384)
128 #define ISF_TASK_INIT_PRIORITY (ISF_TASK_PRIORITY-1)
129 #define ISF_TASK_INIT_NAME ("ii")
130 #define ISF_TASK_INIT_PARAM (0)
131 #define ISF_TASK_INIT_TIMESLICE (0)
132
133 /*!
134 * @brief Definition of the task-startup attributes macro for the ISF Initialization Task.
135 * This task initialization macro is used to initialize and launch the ISF initialization task.
136 */
137 #define ISF_TASK_ATTRIBUTE_INIT { ISF_TASK_INIT_INDEX, \
138 isf_init_task, \
139 ISF_TASK_INIT_STACK_SIZE, \
140 ISF_TASK_INIT_PRIORITY, \
141 ISF_TASK_INIT_NAME, \
142 MQX_AUTO_START_TASK, \
143 ISF_TASK_INIT_PARAM, \
144 ISF_TASK_INIT_TIMESLICE },
145
146
147 // ==========================================================================
148
149 #if ISF_COMPONENT_SM
150 /*!
151 * @brief This is the external declaration of the ISF Sensor Manager Task task-startup function.
152 * This task performs all necessary startup operations for the Sensor Manager as well as initialization
153 * of all supported sensor device adapters. <br>
154 * \b Note: ISF library initialization calls this function. \n
155 * The user application must not call this function.
156 */
157 extern void sensor_mgr_task(uint32);
158
159 /*!
160 * @brief This is the external declaration of the ISF Sensor Manager task pre-initialization
161 * function. <br>
162 * \b Note: The ISF library initialization calls this function. \n
163 * The user application must not call this function.
164 */
165 extern isf_status_t sm_init(void);
166
167 /*!
168 * @brief The following macros define the individual attributes for the ISF Sensor Manager Task
169 * task-startup. <br>
170 * \b Note: These macro definitions must not be changed by the user.
171 */
172 #define ISF_TASK_SM_INDEX (ISF_TASK_INDEX_START + 1)
173 #define ISF_TASK_SM_STACK_SIZE (640)
174 #define ISF_TASK_SM_PRIORITY (ISF_TASK_PRIORITY + 0)
175 #define ISF_TASK_SM_NAME ("sm")
176 #define ISF_TASK_SM_PARAM (0)
177 #define ISF_TASK_SM_TIMESLICE (0)
178
179 /*!
180 * @brief Definition of the ISF Sensor Manager Task task-startup attributes macro.
181 * This task initialization macro is used during the initial task startup process to initialize and
182 * launch the Sensor Manager task.
183 */
184 #define ISF_TASK_ATTRIBUTE_SM { ISF_TASK_SM_INDEX, \
185 sensor_mgr_task, \
186 ISF_TASK_SM_STACK_SIZE, \
187 ISF_TASK_SM_PRIORITY, \
188 ISF_TASK_SM_NAME, \
189 MQX_AUTO_START_TASK, \
190 ISF_TASK_SM_PARAM, \
191 ISF_TASK_SM_TIMESLICE },
192 #else
193
194 #define ISF_TASK_ATTRIBUTE_SM
195
196 #endif // ISF_COMPONENT_SM
197
198
199
200
201
202 // ==========================================================================
203
204 #if ISF_COMPONENT_CI
205
206 extern void task_ci(uint32);
207 extern isf_status_t ci_init(void);
208
209 #define ISF_APP_CALLBACK_DEV_INFO (isf_app_callback_dev_info)
210 #define ISF_APP_CALLBACK_MBOX (isf_app_callback_mbox),
211
212 /*!
213 * @brief The following macros define the individual attributes for ISF Command Interpreter
214 * task task-startup. <br>
215 * \b Note: These macro definitions must not be changed by the user.
216 */
217 #define ISF_TASK_CI_INDEX (ISF_TASK_INDEX_START + 2)
218 #define ISF_TASK_CI_STACK_SIZE 1200
219 #define ISF_TASK_CI_PRIORITY 8
220 #define ISF_TASK_CI_NAME ("ci")
221 #define ISF_TASK_CI_PARAM (0)
222 #define ISF_TASK_CI_TIMESLICE (0)
223
224 /*!
225 * @brief Definition of the ISF Command Interpreter task task-startup attributes macro.
226 * This task initialization macro is used to initialize and launch the Command Interpreter task.
227 */
228 #define ISF_TASK_ATTRIBUTE_CI { ISF_TASK_CI_INDEX, \
229 task_ci, \
230 ISF_TASK_CI_STACK_SIZE, \
231 ISF_TASK_CI_PRIORITY, \
232 ISF_TASK_CI_NAME, \
233 MQX_AUTO_START_TASK, \
234 ISF_TASK_CI_PARAM, \
235 ISF_TASK_CI_TIMESLICE },
236
237 #else
238
239 #define ISF_TASK_ATTRIBUTE_CI
240 #define ISF_APP_CALLBACK_DEV_INFO
241 #define ISF_APP_CALLBACK_MBOX
242
243 #endif // ISF_COMPONENT_CI
244
245
246
247
248 // ==========================================================================
249
250 #if ISF_COMPONENT_BM
251
252 extern void task_bm(uint32);
253 extern isf_status_t bm_init(void);
254
255 /*!
256 * @brief The following macros define the individual attributes for the ISF Bus Manager
257 * task task-startup. <br>
258 * \b Note: These macro definitions must not be changed by the user.
259 */
260 #define ISF_TASK_BM_INDEX (ISF_TASK_INDEX_START + 3)
261 #define ISF_TASK_BM_STACK_SIZE 1024
262 #define ISF_TASK_BM_PRIORITY 9
263 #define ISF_TASK_BM_NAME ("BusManager")
264 #define ISF_TASK_BM_PARAM (0)
265 #define ISF_TASK_BM_TIMESLICE (0)
266
267 /*!
268 * @brief Definition of the ISF Bus Manager task task-startup attributes macro.
269 * This task initialization macro is used during the initial task-startup process to initialize
270 * and launch the Bus Manager task.
271 */
272 #define ISF_TASK_ATTRIBUTE_BM { ISF_TASK_BM_INDEX, \
273 task_bm, \
274 ISF_TASK_BM_STACK_SIZE, \
275 ISF_TASK_BM_PRIORITY, \
276 ISF_TASK_BM_NAME, \
277 MQX_AUTO_START_TASK, \
278 ISF_TASK_BM_PARAM, \
279 ISF_TASK_BM_TIMESLICE },
280
281 #else
282
283 #define ISF_TASK_ATTRIBUTE_BM
284
285 #endif // ISF_COMPONENT_BM
286
287
288
289
290 // ==========================================================================
291
292 #if ISF_COMPONENT_PM
293
294 void task_idle(uint32 initial_data);
295 extern isf_status_t pm_init(void);
296
297 /*!
298 *
299 * @brief Power Manager component task and attributes.\n
300 * Care should be taken in changing these attributes.
301 */
302 #define ISF_TASK_PM_INDEX (ISF_TASK_INDEX_START + 4)
303 #define ISF_TASK_PM_STACK_SIZE (128)
304 #define ISF_TASK_PM_PRIORITY (ISF_TASK_LOWEST_PRIORITY)
305 #define ISF_TASK_PM_NAME ("pm")
306 #define ISF_TASK_PM_PARAM (0)
307 #define ISF_TASK_PM_TIMESLICE (0)
308
309 #define ISF_TASK_ATTRIBUTE_PM { ISF_TASK_PM_INDEX, \
310 task_idle, \
311 ISF_TASK_PM_STACK_SIZE, \
312 ISF_TASK_PM_PRIORITY, \
313 ISF_TASK_PM_NAME, \
314 MQX_AUTO_START_TASK, \
315 ISF_TASK_PM_PARAM, \
316 ISF_TASK_PM_TIMESLICE },
317 #else
318
319 #define ISF_TASK_ATTRIBUTE_PM
320
321 #endif // ISF_COMPONENT_PM
322
323
324
325
326 /*!
327 * @brief ISF tasks attributes. The user puts these tasks\n
328 * in the MQX_template_list[] array.
329 */
330 #define ISF_TASKS_ATTRIBUTES ISF_TASK_ATTRIBUTE_INIT \
331 ISF_TASK_ATTRIBUTE_SM \
332 ISF_TASK_ATTRIBUTE_CI \
333 ISF_TASK_ATTRIBUTE_BM \
334 ISF_TASK_ATTRIBUTE_PM
335
336
337 /*!
338 * @brief This macro defines the ISF application Command Interpreter callback(s).\n
339 * \b Note: The user must put these callbacks at the beginning of the ci_callback[] array.
340 */
341 #define ISF_APP_CALLBACKS \
342 ISF_APP_CALLBACK_DEV_INFO, \
343 ISF_APP_CALLBACK_MBOX
344
345 #endif // ISF_INIT_H_
346
isf_init_task
void isf_init_task(uint32 initial_data)
This function initializes the ISF components for operation.
isf_system_sync
void isf_system_sync(void)
This function synchronizes the user tasks and the system initialization.
Definition: isf_init.c:50
isf_user_config.h
The isf_user_config.h file contains the user configurable settings to either include or exclude an IS...
isf_lib_init
isf_status_t isf_lib_init(void *pOptions)
This function initializes the ISF library.
Definition: isf_init.c:18
bm_init
isf_status_t bm_init(void)
Bus management initialization .
Definition: bus_management.c:445
task_ci
void task_ci(uint32)
Command Interpreter Task - main task to handle communication via mailboxes with the host...
Definition: task_ci.c:492
isf.h
Main ISF header file. Contains code common to all ISF components.
isf_status_t
int32 isf_status_t
ISF return status type.
Definition: isf.h:76
ci_init
isf_status_t ci_init(void)
This API initializes the Command Interpreter.
Definition: task_ci.c:580
task_bm
void task_bm(uint32)
Bus Manager Task - main task to handle communication via mailboxes with the host.
Definition: bus_management.c:673
pm_init
isf_status_t pm_init(void)
This API initializes the Power Manager.
uint32
unsigned long int uint32
Definition: isf_types.h:78
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.