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.h File Reference

The isf_init.h file contains the task initialization attributes required for initialization of the following ISF tasks:
. More...

#include "isf_user_config.h"
#include "isf.h"
#include <mqxlite.h>
#include <lwevent.h>
Include dependency graph for isf_init.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ISF_SYSTEM_READY_EVENT   (1<<1)
 Definition of the system ready event. More...
 
#define ISF_TASK_PRIORITY   (9)
 Definition of the base task priority for ISF tasks.
Note: Task priority of all ISF tasks must be set higher than user task priorities.
Note: Lower numbers represent higher task priorities and higher numbers represent lower priorities. More...
 
#define ISF_TASK_LOWEST_PRIORITY   (20)
 Definition of the task priority used by the lowest priority ISF task.
Note: User tasks must be set to a higher priority level than the task priority used by the lowest priority ISF task.
Note: Lower numbers represent higher task priorities and higher numbers represent lower priorities. More...
 
#define ISF_TASK_INDEX_START   (50)
 Definition of the starting task index for ISF tasks.
Note: User task indexes must have a LOWER value than the value defined here. More...
 
#define ISF_TASK_INIT_INDEX   (ISF_TASK_INDEX_START + 0)
 The following macros define the individual attributes for ISF Initialization Task startup.
Note: These macro definitions must not be changed by the user. More...
 
#define ISF_TASK_INIT_STACK_SIZE   (384)
 
#define ISF_TASK_INIT_PRIORITY   (ISF_TASK_PRIORITY-1)
 
#define ISF_TASK_INIT_NAME   ("ii")
 
#define ISF_TASK_INIT_PARAM   (0)
 
#define ISF_TASK_INIT_TIMESLICE   (0)
 
#define ISF_TASK_ATTRIBUTE_INIT
 Definition of the task-startup attributes macro for the ISF Initialization Task. This task initialization macro is used to initialize and launch the ISF initialization task. More...
 
#define ISF_TASK_ATTRIBUTE_SM
 
#define ISF_APP_CALLBACK_DEV_INFO   (isf_app_callback_dev_info)
 
#define ISF_APP_CALLBACK_MBOX   (isf_app_callback_mbox),
 
#define ISF_TASK_CI_INDEX   (ISF_TASK_INDEX_START + 2)
 The following macros define the individual attributes for ISF Command Interpreter task task-startup.
Note: These macro definitions must not be changed by the user. More...
 
#define ISF_TASK_CI_STACK_SIZE   (1024)
 
#define ISF_TASK_CI_PRIORITY   (ISF_TASK_PRIORITY + 2)
 
#define ISF_TASK_CI_NAME   ("ci")
 
#define ISF_TASK_CI_PARAM   (0)
 
#define ISF_TASK_CI_TIMESLICE   (0)
 
#define ISF_TASK_ATTRIBUTE_CI
 Definition of the ISF Command Interpreter task task-startup attributes macro. This task initialization macro is used to initialize and launch the Command Interpreter task. More...
 
#define ISF_TASK_BM_INDEX   (ISF_TASK_INDEX_START + 3)
 The following macros define the individual attributes for the ISF Bus Manager task task-startup.
Note: These macro definitions must not be changed by the user. More...
 
#define ISF_TASK_BM_STACK_SIZE   (512)
 
#define ISF_TASK_BM_PRIORITY   (ISF_TASK_PRIORITY + 1)
 
#define ISF_TASK_BM_NAME   ("bm")
 
#define ISF_TASK_BM_PARAM   (0)
 
#define ISF_TASK_BM_TIMESLICE   (0)
 
#define ISF_TASK_ATTRIBUTE_BM
 Definition of the ISF Bus Manager task task-startup attributes macro. This task initialization macro is used during the initial task-startup process to initialize and launch the Bus Manager task. More...
 
#define ISF_TASK_PM_INDEX   (ISF_TASK_INDEX_START + 4)
 Power Manager component task and attributes.
Care should be taken in changing these attributes. More...
 
#define ISF_TASK_PM_STACK_SIZE   (128)
 
#define ISF_TASK_PM_PRIORITY   (ISF_TASK_LOWEST_PRIORITY)
 
#define ISF_TASK_PM_NAME   ("pm")
 
#define ISF_TASK_PM_PARAM   (0)
 
#define ISF_TASK_PM_TIMESLICE   (0)
 
#define ISF_TASK_ATTRIBUTE_PM
 
#define ISF_TASKS_ATTRIBUTES
 ISF tasks attributes. The user puts these tasks
in the MQX_template_list[] array. More...
 
#define ISF_APP_CALLBACKS
 This macro defines the ISF application Command Interpreter callback(s).
Note: The user must put these callbacks at the beginning of the ci_callback[] array. More...
 

Functions

isf_status_t isf_lib_init (void *pOptions)
 This function initializes the ISF library. More...
 
void isf_init_task (uint32 initial_data)
 This function initializes the ISF components for operation. More...
 
void isf_system_sync (void)
 This function synchronizes the user tasks and the system initialization. More...
 
void task_ci (uint32)
 Command Interpreter Task - main task to handle communication
via mailboxes with the host. More...
 
isf_status_t ci_init (void)
 This API initializes the Command Interpreter. More...
 
void task_bm (uint32)
 Bus Manager Task - main task to handle communication
via mailboxes with the host. More...
 
isf_status_t bm_init (void)
 Bus management initialization
. More...
 
void task_idle (uint32 initial_data)
 
isf_status_t pm_init (void)
 

Variables

LWEVENT_STRUCT isfSysEventHandler
 Definition of the event handle to the system ready event. More...
 

Detailed Description

The isf_init.h file contains the task initialization attributes required for initialization of the following ISF tasks:
.

  • ISF Initialization task
  • ISF Sensor Manager task
  • ISF Command Interpreter task
  • ISF Bus Manager task.

Definition in file isf_init.h.

Macro Definition Documentation

#define ISF_APP_CALLBACK_DEV_INFO   (isf_app_callback_dev_info)

Definition at line 211 of file isf_init.h.

#define ISF_APP_CALLBACK_MBOX   (isf_app_callback_mbox),

Definition at line 212 of file isf_init.h.

#define ISF_APP_CALLBACKS
Value:
#define ISF_APP_CALLBACK_DEV_INFO
Definition: isf_init.h:211
#define ISF_APP_CALLBACK_MBOX
Definition: isf_init.h:212

This macro defines the ISF application Command Interpreter callback(s).
Note: The user must put these callbacks at the beginning of the ci_callback[] array.

Definition at line 343 of file isf_init.h.

#define ISF_SYSTEM_READY_EVENT   (1<<1)

Definition of the system ready event.

Definition at line 24 of file isf_init.h.

Referenced by isf_lib_init(), and isf_system_sync().

#define ISF_TASK_ATTRIBUTE_BM
Value:
MQX_AUTO_START_TASK, \
#define ISF_TASK_BM_PARAM
Definition: isf_init.h:266
#define ISF_TASK_BM_NAME
Definition: isf_init.h:265
#define ISF_TASK_BM_PRIORITY
Definition: isf_init.h:264
#define ISF_TASK_BM_INDEX
The following macros define the individual attributes for the ISF Bus Manager task task-startup...
Definition: isf_init.h:262
#define ISF_TASK_BM_STACK_SIZE
Definition: isf_init.h:263
#define ISF_TASK_BM_TIMESLICE
Definition: isf_init.h:267
void task_bm(uint32)
Bus Manager Task - main task to handle communication via mailboxes with the host.

Definition of the ISF Bus Manager task task-startup attributes macro. This task initialization macro is used during the initial task-startup process to initialize and launch the Bus Manager task.

Definition at line 274 of file isf_init.h.

#define ISF_TASK_ATTRIBUTE_CI
Value:
MQX_AUTO_START_TASK, \
#define ISF_TASK_CI_INDEX
The following macros define the individual attributes for ISF Command Interpreter task task-startup...
Definition: isf_init.h:219
#define ISF_TASK_CI_STACK_SIZE
Definition: isf_init.h:220
#define ISF_TASK_CI_PRIORITY
Definition: isf_init.h:221
void task_ci(uint32)
Command Interpreter Task - main task to handle communication via mailboxes with the host...
Definition: task_ci.c:499
#define ISF_TASK_CI_NAME
Definition: isf_init.h:222
#define ISF_TASK_CI_TIMESLICE
Definition: isf_init.h:224
#define ISF_TASK_CI_PARAM
Definition: isf_init.h:223

Definition of the ISF Command Interpreter task task-startup attributes macro. This task initialization macro is used to initialize and launch the Command Interpreter task.

Definition at line 230 of file isf_init.h.

#define ISF_TASK_ATTRIBUTE_INIT
Value:
MQX_AUTO_START_TASK, \
void isf_init_task(uint32 initial_data)
This function initializes the ISF components for operation.
#define ISF_TASK_INIT_INDEX
The following macros define the individual attributes for ISF Initialization Task startup...
Definition: isf_init.h:128
#define ISF_TASK_INIT_STACK_SIZE
Definition: isf_init.h:129
#define ISF_TASK_INIT_TIMESLICE
Definition: isf_init.h:133
#define ISF_TASK_INIT_NAME
Definition: isf_init.h:131
#define ISF_TASK_INIT_PRIORITY
Definition: isf_init.h:130
#define ISF_TASK_INIT_PARAM
Definition: isf_init.h:132

Definition of the task-startup attributes macro for the ISF Initialization Task. This task initialization macro is used to initialize and launch the ISF initialization task.

Definition at line 139 of file isf_init.h.

#define ISF_TASK_ATTRIBUTE_PM
Value:
MQX_AUTO_START_TASK, \
#define ISF_TASK_PM_PARAM
Definition: isf_init.h:308
#define ISF_TASK_PM_TIMESLICE
Definition: isf_init.h:309
#define ISF_TASK_PM_INDEX
Power Manager component task and attributes. Care should be taken in changing these attributes...
Definition: isf_init.h:304
#define ISF_TASK_PM_PRIORITY
Definition: isf_init.h:306
void task_idle(uint32 initial_data)
Definition: pm.c:156
#define ISF_TASK_PM_NAME
Definition: isf_init.h:307
#define ISF_TASK_PM_STACK_SIZE
Definition: isf_init.h:305

Definition at line 311 of file isf_init.h.

#define ISF_TASK_ATTRIBUTE_SM

Definition at line 196 of file isf_init.h.

#define ISF_TASK_BM_INDEX   (ISF_TASK_INDEX_START + 3)

The following macros define the individual attributes for the ISF Bus Manager task task-startup.
Note: These macro definitions must not be changed by the user.

Definition at line 262 of file isf_init.h.

#define ISF_TASK_BM_NAME   ("bm")

Definition at line 265 of file isf_init.h.

#define ISF_TASK_BM_PARAM   (0)

Definition at line 266 of file isf_init.h.

#define ISF_TASK_BM_PRIORITY   (ISF_TASK_PRIORITY + 1)

Definition at line 264 of file isf_init.h.

#define ISF_TASK_BM_STACK_SIZE   (512)

Definition at line 263 of file isf_init.h.

#define ISF_TASK_BM_TIMESLICE   (0)

Definition at line 267 of file isf_init.h.

#define ISF_TASK_CI_INDEX   (ISF_TASK_INDEX_START + 2)

The following macros define the individual attributes for ISF Command Interpreter task task-startup.
Note: These macro definitions must not be changed by the user.

Definition at line 219 of file isf_init.h.

#define ISF_TASK_CI_NAME   ("ci")

Definition at line 222 of file isf_init.h.

#define ISF_TASK_CI_PARAM   (0)

Definition at line 223 of file isf_init.h.

#define ISF_TASK_CI_PRIORITY   (ISF_TASK_PRIORITY + 2)

Definition at line 221 of file isf_init.h.

#define ISF_TASK_CI_STACK_SIZE   (1024)

Definition at line 220 of file isf_init.h.

#define ISF_TASK_CI_TIMESLICE   (0)

Definition at line 224 of file isf_init.h.

#define ISF_TASK_INDEX_START   (50)

Definition of the starting task index for ISF tasks.
Note: User task indexes must have a LOWER value than the value defined here.

Definition at line 52 of file isf_init.h.

#define ISF_TASK_INIT_INDEX   (ISF_TASK_INDEX_START + 0)

The following macros define the individual attributes for ISF Initialization Task startup.
Note: These macro definitions must not be changed by the user.

Definition at line 128 of file isf_init.h.

#define ISF_TASK_INIT_NAME   ("ii")

Definition at line 131 of file isf_init.h.

#define ISF_TASK_INIT_PARAM   (0)

Definition at line 132 of file isf_init.h.

#define ISF_TASK_INIT_PRIORITY   (ISF_TASK_PRIORITY-1)

Definition at line 130 of file isf_init.h.

#define ISF_TASK_INIT_STACK_SIZE   (384)

Definition at line 129 of file isf_init.h.

#define ISF_TASK_INIT_TIMESLICE   (0)

Definition at line 133 of file isf_init.h.

#define ISF_TASK_LOWEST_PRIORITY   (20)

Definition of the task priority used by the lowest priority ISF task.
Note: User tasks must be set to a higher priority level than the task priority used by the lowest priority ISF task.
Note: Lower numbers represent higher task priorities and higher numbers represent lower priorities.

Definition at line 46 of file isf_init.h.

#define ISF_TASK_PM_INDEX   (ISF_TASK_INDEX_START + 4)

Power Manager component task and attributes.
Care should be taken in changing these attributes.

Definition at line 304 of file isf_init.h.

#define ISF_TASK_PM_NAME   ("pm")

Definition at line 307 of file isf_init.h.

#define ISF_TASK_PM_PARAM   (0)

Definition at line 308 of file isf_init.h.

#define ISF_TASK_PM_PRIORITY   (ISF_TASK_LOWEST_PRIORITY)

Definition at line 306 of file isf_init.h.

#define ISF_TASK_PM_STACK_SIZE   (128)

Definition at line 305 of file isf_init.h.

#define ISF_TASK_PM_TIMESLICE   (0)

Definition at line 309 of file isf_init.h.

#define ISF_TASK_PRIORITY   (9)

Definition of the base task priority for ISF tasks.
Note: Task priority of all ISF tasks must be set higher than user task priorities.
Note: Lower numbers represent higher task priorities and higher numbers represent lower priorities.

Definition at line 36 of file isf_init.h.

#define ISF_TASKS_ATTRIBUTES
Value:

ISF tasks attributes. The user puts these tasks
in the MQX_template_list[] array.

Definition at line 332 of file isf_init.h.

Function Documentation

isf_status_t bm_init ( void  )

Bus management initialization
.

This API initializes the Bus Manager.

Returns
ISF_SUCCESS if initialization is successful. ISF_ERR_LIB_INIT if initialization failed.
Errors:

Constraints:

Reentrant: No.
Link Libraries:

See also

Definition at line 409 of file bus_management.c.

References BM_PIPELINE_STAGES, bm_timer_init(), bm_t::cb_events, bm_t::cb_list_cur_cnt, bm_t::cb_token_active_mask, bm_t::cb_token_registered_mask, event_bm_callback, FALSE, gpBm_cb_list, ISF_SUCCESS, bm_t::pipeline_index, sema_bm_access, and TIMER_TPM_INIT.

Referenced by isf_lib_init().

Here is the call graph for this function:

Here is the caller graph for this function:

isf_status_t ci_init ( void  )

This API initializes the Command Interpreter.

The Command Interpreter requires a one time initialization at system startup performed by this API call. It creates and initializes internal variables. In addition, it installs an interrupt service routine for the slave-port interrupt.

Returns
ci_init() returns a value of type isf_status_t providing the status of the initialization operation.
Return values
ISF_SUCCESSThe initialization completed successfully.
ISF_ERR_LIB_INITThe interrupt service routine for the uart channel used by the Command Interpereter could not installed.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • An interrupt routine for the uart channel used by the Command Interpereter has not been installed.
Reentrant: No
Link Libraries:
isf_core.lib
See also
ci_status_t

Definition at line 584 of file task_ci.c.

References CI_ALLOC_MEM_ZERO, CI_MAX_PROTOCOL, ci_protocol_initptr_table, COMM_STATE_OK, dm_channel_desc, dm_channel_get_state(), dm_channel_init(), dm_channel_start(), dm_device_open(), get_ci_comm(), isf_ci_get_recv_size(), ISF_ERR_LIB_INIT, ISF_SUCCESS, ci_protocol_t::protcolID, and ci_rx_packet_t::pRxbuf.

Referenced by isf_lib_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void isf_init_task ( uint32  initial_data)

This function initializes the ISF components for operation.

Purpose:
The ISF initialization task calls each ISF component to perform a one-time initialization. Each ISF component executes its initialization routine, if enabled in isf_user_config.h and if there are any initialization activities to perform.
Parameters
[in]initial_dataThis is required by MQX and any UINT32 value can be used.
Returns
This function does not return any values.
Constraints:
(1) The isf_init_task() must be the highest priority task in the system.
(2) This API call must be invoked only once and must run before any other task in the system runs. This can be ensured by using the default setting in isf_init.h, which sets this task as the highest priority task in the system.
Once initialization is complete, the task exits and its task memory is reclaimed by the system and is made available for application use.
Reentrant: No
Link Libraries:
isf_core.lib
isf_status_t isf_lib_init ( void *  pOptions)

This function initializes the ISF library.

Purpose:
The isf_lib_init() function is called by an application to initialize the ISF library.
Note: This initialization must be done in the user application before it calls any ISF function.
Parameters
[in]pOptionsThis must be a NULL pointer.
Returns
isf_lib_init() returns a value of type isf_status_t indicating the result of the operation.
Return values
ISF_SUCCESSis returned when the library initializes successfully.
ISF_ERR_LIB_INITis returned when the library does not initialize successfully.
Reentrant: No
Link Libraries:
None.

This function initializes the ISF library.

API ISF library get information.

Definition at line 18 of file isf_init.c.

References bm_init(), ci_init(), ISF_ERR_LIB_INIT, ISF_SUCCESS, ISF_SYSTEM_READY_EVENT, isfSysEventHandler, and pm_init().

Here is the call graph for this function:

void isf_system_sync ( void  )

This function synchronizes the user tasks and the system initialization.

Purpose:
This function blocks the user tasks from executing until ISF initialization is completed.
Returns
This function does not return any values.
Constraints:
Reentrant: No
Link Libraries:
isf_core.lib

Definition at line 50 of file isf_init.c.

References FALSE, ISF_SYSTEM_READY_EVENT, isfSysEventHandler, and synchCreate.

Referenced by CI_task(), PM_task(), TaskApp1_task(), TaskBusManager_task(), and TaskRLI1_task().

Here is the caller graph for this function:

isf_status_t pm_init ( void  )

Definition at line 44 of file pm.c.

Referenced by isf_lib_init().

Here is the caller graph for this function:

void task_bm ( uint32  initial_data)

Bus Manager Task - main task to handle communication
via mailboxes with the host.

Parameters
initial_data- value passed in when task is created, not used.
Returns
None
Errors:

Constraints:

Reentrant: No.
Link Libraries:

See also
main.c/MQX_template_list[]

Definition at line 643 of file bus_management.c.

References bm_t::cb_token_active_mask, event_bm_callback, FALSE, gpBm_cb_list, bm_cb_config_t::pCallback, and TIMER_TPM_GET_CNT.

Referenced by TaskBusManager_task().

Here is the caller graph for this function:

void task_ci ( uint32  initial_data)

Command Interpreter Task - main task to handle communication
via mailboxes with the host.

Parameters
initial_data- value passed in when task is created, not used.
Returns
None
Errors:

Constraints:

Reentrant: No.
Link Libraries:

See also
main.c/MQX_template_list[]

Definition at line 499 of file task_ci.c.

References ci_get_protocol_id, CI_PACKET_RECV_STATUS_YES, CI_PROTOCOL_DATA_OFFSET, CI_PROTOCOL_ID_MAX, CI_PROTOCOL_ID_NULL, CI_PROTOCOL_ID_SIZE, dm_device_read(), ISF_CI_FAILURE, ISF_SUCCESS, ci_rx_packet_t::mbIndex, process_recv_byte(), and ci_rx_packet_t::pRxbuf.

Here is the call graph for this function:

void task_idle ( uint32  initial_data)

Definition at line 156 of file pm.c.

References ISF_POWER_LOW, ISF_POWER_NORMAL, and ISF_POWER_SLEEP.

Referenced by PM_task().

Here is the caller graph for this function:

Variable Documentation

LWEVENT_STRUCT isfSysEventHandler

Definition of the event handle to the system ready event.

Definition at line 15 of file isf_init.c.

Referenced by isf_lib_init(), and isf_system_sync().