ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
isf_init.c
Go to the documentation of this file.
1 /**
2  * @file isf_init.c
3  *
4  * @brief The \b isf_init.c file contains implementation of the ISF library
5  * initialization functions.
6  *
7  * @copyright Copyright (c) 2012, Freescale Semiconductor, Inc.
8  */
9 
10 #include "isf_user_config.h"
11 #include "isf_init.h"
12 #include <mqxlite.h>
13 #include <lwevent.h>
14 
15 LWEVENT_STRUCT isfSysEventHandler;
16 volatile uint8 synchCreate = 0;
17 /*! @brief Please see isf_init.h for complete documentation. */
18 isf_status_t isf_lib_init(void *pOptions)
19 {
20 
21  isf_status_t status = ISF_SUCCESS;
22 
23 
24 #if ISF_COMPONENT_BM
25  // Initialize the Bus Manager
26  status |= bm_init();
27 #endif
28 #if ISF_COMPONENT_CI
29  // Initialize the Command Interpreter
30  status |= ci_init();
31 #endif
32 #if ISF_COMPONENT_PM
33  // Initialize the Power Manager
34  status |= pm_init();
35 #endif
36 
37  if (status){
38  status = ISF_ERR_LIB_INIT;
39  }
40  else{
42  }
43  return status;
44 }
45 
46 
47 /*!
48  * @brief This function synchronizes the user tasks and the system initialization. */
49 
50 void isf_system_sync(void)
51 {
52  _int_disable();
53  if(!synchCreate){
54  _mqx_uint MQX_stat = _lwevent_create(&isfSysEventHandler, FALSE);
55  if(MQX_stat != MQX_OK){
56  return;
57  }
58  synchCreate = 1;
59  }
60  _int_enable();
61  // wait for the system ready event.
62  _lwevent_wait_for(&isfSysEventHandler, ISF_SYSTEM_READY_EVENT, FALSE, NULL);
63 }
64 
65 
isf_status_t pm_init(void)
Definition: pm.c:44
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
#define ISF_SYSTEM_READY_EVENT
Definition of the system ready event.
Definition: isf_init.h:24
isf_status_t isf_lib_init(void *pOptions)
Please see isf_init.h for complete documentation.
Definition: isf_init.c:18
volatile uint8 synchCreate
Definition: isf_init.c:16
#define FALSE
Definition: isf_types.h:56
The isf_user_config.h file contains the user configurable settings to either include or exclude an IS...
LWEVENT_STRUCT isfSysEventHandler
Definition of the event handle to the system ready event.
Definition: isf_init.c:15
isf_status_t ci_init(void)
This API initializes the Command Interpreter.
Definition: task_ci.c:584
isf_status_t bm_init(void)
Bus management initialization .
General library initialization failure status.
Definition: isf.h:36
The isf_init.h file contains the task initialization attributes required for initialization of the fo...
int32 isf_status_t
ISF return status type.
Definition: isf.h:51
void isf_system_sync(void)
This function synchronizes the user tasks and the system initialization.
Definition: isf_init.c:50