| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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