| 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_dsa_adapter.h
Go to the documentation of this file.
1 /*
2 * @file isf_dsa_adapter.h
3 * @brief The \b isf_dsa_adapter.h contains the data types and enumerations used in
4 * the Digital Sensor Abstraction (DSA) interface.
5 *
6 * @copyright Copyright (c) 2014, Freescale Semiconductor, Inc.
7 */
8
9 #ifndef ISF_DSA_ADAPTER_H_
10 #define ISF_DSA_ADAPTER_H_
11
12
13 #include "isf_target.h"
14 #include "isf_types.h"
15 #include "lwevent.h"
16 #include "isf_sysconf_types.h"
17 #include "isf_sensor_types.h"
18 #include "isf_fifo.h"
19
20 /*!
21 * @brief This is the Sensor Manager API return type definition.
22 */
23 typedef int32 isf_dsa_status_t;
24
25
26 /*!
27 * @brief This enumerates the error types returned by the DSA sensor functions.
28 */
29 typedef enum isf_dsa_error_enums
30 {
31 DSA_ERR_INITIALIZE = 1, /*!< Adapter initialize error. */
32 DSA_ERR_VALIDATE_SETTINGS, /*!< Adapter settings validation error. */
33 DSA_ERR_CONFIGURE, /*!< Driver configuration error. */
34 DSA_ERR_START_DATA, /*!< Adapter data start error. */
35 DSA_ERR_END_DATA, /*!< Adapter data end error. */
36 DSA_ERR_CALIBRATE, /*!< Adapter calibration error. */
37 DSA_ERR_SHUTDOWN, /*!< Adapter shutdown error. */
38 DSA_ERR_PARAM, /*!< Adapter parameter error. */
39 DSA_ERR_NO_MEM, /*!< A dynamic memory allocation request failed */
40 DSA_ERR_BAD_SENSOR_DATA_TYPE, /*!< The requested sensor data type is not supported */
41 DSA_ERR_BAD_RESULT_TYPE, /*!< The requested result type is not supported */
42 DSA_RET_SETTINGS_CHANGED, /*!< Requested settings were changed for compatibility */
43 DSA_FIFO_FULL, /*!< The FIFO has reached its maximum depth */
44
45 } isf_dsa_err_t;
46
47 typedef enum isf_dsa_result_enums
48 {
49 DSA_RESULT_TYPE_RAW_COUNTS = 1, /* The sensor adapter returns raw sensor count data */
50 DSA_RESULT_TYPE_ENG_FIXED = 2, /* The sensor adapter converts sensor data to engineering fixed point format */
51 DSA_RESULT_TYPE_ENG_FLOAT = 3 /* The sensor adapter converts sensor data to engineering floating point format */
52 } isf_dsa_result_types_t;
53
54 /*!
55 * @brief This defines the standard DSA adapter sensor status types.
56 * User defined sensor adapters may need additional or different states.
57 */
58 typedef enum isf_dsa_AdapterStatus_enums {
59 DSA_STATE_NOT_INITIALIZED = 0, // Sensor is not initialized (Initial State).
60 DSA_STATE_INITIALIZED = 1, // Sensor is Initialized.
61 DSA_STATE_CONFIGURED_STOPPED = 2, // Sensor is Configured; Data Flow is Stopped.
62 DSA_STATE_CONFIGURED_STARTED = 3, // Sensor is Configured; Data Flow is Started.
63 } isf_dsa_AdapterStatus_t;
64
65
66
67 /*!
68 * @brief This defines the DSA adapter device information block.
69 */
70 typedef struct isf_dsa_DeviceInfoBlock_st
71 {
72 isf_SensorTypes_t *pSupportedSensorTypes; /*!< Pointer to a zero-terminated array of sensor types */
73 isf_SensorDataTypes_t *pSupportedSensorDataTypes; /*!< Pointer to a zero-terminated array of sensor data types */
74 uint8 nNativeDataSetSize; /*!< The size of the native data set for this sensor. */
75 } isf_dsa_DeviceInfoBlock_t;
76
77 /*!
78 * @brief This defines the DSA sensor configuration parameter structure configuring the sensor settings
79 * by a subscriber task.
80 */
81 typedef struct isf_dsa_SensorSettings_st
82 {
83 isf_fifo_t *pSampleBufferInfo; /*!< information about the data buffer for sample data */
84 uint32 nSamplePeriod; /*!< Sample period in microseconds. */
85 isf_SensorDataTypes_t resultType; /*!< The desired data type to be returned */
86 isf_dsa_result_types_t resultFormat; /*!< The format of data to be returned- RAW, FIXED, FLOAT */
87 } isf_dsa_SensorSettings_t;
88
89 /*!
90 * @brief This defines the DSA adapter functional interface.
91 */
92 typedef struct isf_dsa_ControlData_st
93 {
94 LWEVENT_STRUCT *pEventGroup; /*!< The event group to signal after depositing sensor sample in pDataBuff. */
95 uint32 nEventFieldIndex; /*!< The event flag of the event group to signal after depositing sensor sample in pSampleBuffer. */
96 isf_dsa_SensorSettings_t sensorSettings; /*!< The configuration parameters from the user including the fifo to use */
97 } isf_dsa_ControlData_t;
98
99
100 /*
101 * Forward declaration of the sensor configuration struct
102 */
103 typedef struct SensorConfig_st isf_SensorConfig_t;
104
105 /*!
106 * @brief This defines the DSA sensor device handle structure
107 * used to invoke the adapter access functions.
108 */
109 typedef struct isf_SensorHandle_st
110 {
111 void *pDeviceDescriptor; /*!< Pointer to the adapter-specific device descriptor data. */
112 const isf_SensorConfig_t *pSensorStaticConfig; /*!< Handle for SensorConfiguration data */
113 isf_dsa_ControlData_t controlData;
114 isf_dsa_AdapterStatus_t adapterStatus;
115 } isf_SensorHandle_t;
116
117 typedef struct
118 {
119 char *name;
120 } isf_dsa_info_t;
121
122 typedef isf_dsa_status_t (isf_dsa_data_converter_t)(volatile isf_SensorHandle_t *, isf_SensorDataTypes_t, isf_dsa_result_types_t, void *, void *, int32 *numBytes);
123
124 /*!
125 * @brief This defines the DSA adapter control interface abstract function list.
126 */
127 typedef struct isf_dsa_ControlInterface_st
128 {
129 isf_dsa_status_t (*Initialize)( isf_SensorHandle_t *pSensorHandle); /*!< Pointer to the adapter Initialize() function. */
130 isf_dsa_status_t (*ValidateSettings)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings); /*!< Pointer to the adapter ValidateSettings() function. */
131 isf_dsa_status_t (*Configure)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings); /*!< Pointer to the adapter Configure() function. */
132 isf_dsa_status_t (*StartData)(isf_SensorHandle_t *pSensorHandle ); /*!< Pointer to the adapter StartData() function. */
133 isf_dsa_status_t (*EndData)(isf_SensorHandle_t *pSensorHandle ); /*!< Pointer to the adapter EndData() function. */
134 isf_dsa_status_t (*Calibrate)(isf_SensorHandle_t *pSensorHandle, void *pCalData ); /*!< Pointer to the adapter Calibrate() function. */
135 isf_dsa_status_t (*Shutdown)(isf_SensorHandle_t *pSensorHandle ); /*!< Pointer to the adapter Shutdown() function. */
136 isf_dsa_data_converter_t *Convert; /*!< Pointer to the adapter Convert() function. */
137 } isf_dsa_ControlInterface_t;
138
139
140 /*!
141 * @brief This defines the DSA adapter structure required for static initialization of
142 * the concrete instance of a given sensor adapter.
143 */
144 typedef struct isf_dsa_Adapter_st
145 {
146 isf_dsa_DeviceInfoBlock_t devInfo; /*!< Adapter device information block field. */
147 isf_dsa_ControlInterface_t control; /*!< Adapter control interface field. */
148 } isf_dsa_Adapter_t;
149
150 /*!
151 * @brief This defines the DSA sensor configuration structure
152 * defining each individual sensor adapter in the DSA Sensor List.
153 */
154 struct SensorConfig_st
155 {
156 const isf_dsa_Adapter_t *pAdapter; /*!< Pointer to the statically initialized adapter structure. */
157 void *pSensorSpecificSettings; /*!< Pointer to the adapter sensor specific settings. */
158 sys_channelId_t channelId; /*!< Sensor device physical channel identification value. */
159 const void *commInfo; /*!< Sensor device specific communications info. */
160 };
161
162 #endif /* ISF_DSA_ADAPTER_H_ */
isf_SensorHandle_st::pDeviceDescriptor
void * pDeviceDescriptor
Definition: isf_dsa_adapter.h:111
DSA_FIFO_FULL
Definition: isf_dsa_adapter.h:43
isf_dsa_DeviceInfoBlock_t
struct isf_dsa_DeviceInfoBlock_st isf_dsa_DeviceInfoBlock_t
This defines the DSA adapter device information block.
isf_target.h
ISF board support header files.
SensorConfig_st::pSensorSpecificSettings
void * pSensorSpecificSettings
Definition: isf_dsa_adapter.h:157
uint8
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
DSA_ERR_BAD_RESULT_TYPE
Definition: isf_dsa_adapter.h:41
SensorConfig_st
This defines the DSA sensor configuration structure defining each individual sensor adapter in the DS...
Definition: isf_dsa_adapter.h:154
isf_dsa_ControlInterface_st::StartData
isf_dsa_status_t(* StartData)(isf_SensorHandle_t *pSensorHandle)
Definition: isf_dsa_adapter.h:132
isf_dsa_ControlInterface_st::EndData
isf_dsa_status_t(* EndData)(isf_SensorHandle_t *pSensorHandle)
Definition: isf_dsa_adapter.h:133
isf_dsa_DeviceInfoBlock_st::nNativeDataSetSize
uint8 nNativeDataSetSize
Definition: isf_dsa_adapter.h:74
DSA_ERR_BAD_SENSOR_DATA_TYPE
Definition: isf_dsa_adapter.h:40
SensorConfig_st::commInfo
const void * commInfo
Definition: isf_dsa_adapter.h:159
isf_SensorHandle_st::controlData
isf_dsa_ControlData_t controlData
Definition: isf_dsa_adapter.h:113
SensorConfig_st::pAdapter
const isf_dsa_Adapter_t * pAdapter
Definition: isf_dsa_adapter.h:156
isf_dsa_data_converter_t
isf_dsa_status_t( isf_dsa_data_converter_t)(volatile isf_SensorHandle_t *, isf_SensorDataTypes_t, isf_dsa_result_types_t, void *, void *, int32 *numBytes)
Definition: isf_dsa_adapter.h:122
DSA_STATE_CONFIGURED_STARTED
Definition: isf_dsa_adapter.h:62
isf_dsa_err_t
enum isf_dsa_error_enums isf_dsa_err_t
This enumerates the error types returned by the DSA sensor functions.
isf_SensorHandle_st
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
Definition: isf_dsa_adapter.h:109
DSA_RESULT_TYPE_RAW_COUNTS
Definition: isf_dsa_adapter.h:49
isf_dsa_SensorSettings_st::nSamplePeriod
uint32 nSamplePeriod
Definition: isf_dsa_adapter.h:84
isf_dsa_Adapter_st::control
isf_dsa_ControlInterface_t control
Definition: isf_dsa_adapter.h:147
isf_dsa_info_t::name
char * name
Definition: isf_dsa_adapter.h:119
isf_dsa_ControlInterface_st::ValidateSettings
isf_dsa_status_t(* ValidateSettings)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
Definition: isf_dsa_adapter.h:130
isf_dsa_DeviceInfoBlock_st
This defines the DSA adapter device information block.
Definition: isf_dsa_adapter.h:70
uint32
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
isf_SensorTypes_t
isf_SensorTypes_t
Definition: isf_sensor_types.h:14
isf_dsa_AdapterStatus_enums
isf_dsa_AdapterStatus_enums
This defines the standard DSA adapter sensor status types. User defined sensor adapters may need addi...
Definition: isf_dsa_adapter.h:58
isf_types.h
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
DSA_ERR_INITIALIZE
Definition: isf_dsa_adapter.h:31
isf_dsa_Adapter_t
struct isf_dsa_Adapter_st isf_dsa_Adapter_t
This defines the DSA adapter structure required for static initialization of the concrete instance of...
isf_dsa_ControlInterface_st::Convert
isf_dsa_data_converter_t * Convert
Definition: isf_dsa_adapter.h:136
sys_channelId_t
uint8 sys_channelId_t
Definition: isf_sysconf_types.h:17
isf_dsa_result_enums
isf_dsa_result_enums
Definition: isf_dsa_adapter.h:47
DSA_ERR_END_DATA
Definition: isf_dsa_adapter.h:35
DSA_RESULT_TYPE_ENG_FIXED
Definition: isf_dsa_adapter.h:50
isf_dsa_Adapter_st::devInfo
isf_dsa_DeviceInfoBlock_t devInfo
Definition: isf_dsa_adapter.h:146
DSA_STATE_INITIALIZED
Definition: isf_dsa_adapter.h:60
isf_dsa_status_t
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
Definition: isf_dsa_adapter.h:23
isf_dsa_ControlInterface_st::Configure
isf_dsa_status_t(* Configure)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
Definition: isf_dsa_adapter.h:131
isf_dsa_DeviceInfoBlock_st::pSupportedSensorDataTypes
isf_SensorDataTypes_t * pSupportedSensorDataTypes
Definition: isf_dsa_adapter.h:73
isf_SensorHandle_t
struct isf_SensorHandle_st isf_SensorHandle_t
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
isf_dsa_ControlInterface_st::Calibrate
isf_dsa_status_t(* Calibrate)(isf_SensorHandle_t *pSensorHandle, void *pCalData)
Definition: isf_dsa_adapter.h:134
isf_sensor_types.h
The isf_sensor_types.h contains the enumerated list of sensor types used by ISF.
isf_dsa_result_types_t
enum isf_dsa_result_enums isf_dsa_result_types_t
isf_dsa_Adapter_st
This defines the DSA adapter structure required for static initialization of the concrete instance of...
Definition: isf_dsa_adapter.h:144
DSA_ERR_NO_MEM
Definition: isf_dsa_adapter.h:39
isf_dsa_DeviceInfoBlock_st::pSupportedSensorTypes
isf_SensorTypes_t * pSupportedSensorTypes
Definition: isf_dsa_adapter.h:72
isf_dsa_SensorSettings_st::resultFormat
isf_dsa_result_types_t resultFormat
Definition: isf_dsa_adapter.h:86
isf_SensorDataTypes_t
isf_SensorDataTypes_t
Definition: isf_sensor_types.h:61
isf_fifo_t
Definition: isf_fifo.h:18
isf_SensorHandle_st::pSensorStaticConfig
const isf_SensorConfig_t * pSensorStaticConfig
Definition: isf_dsa_adapter.h:112
int32
long int32
This defines int32 as long.
Definition: isf_types.h:32
isf_dsa_SensorSettings_st::resultType
isf_SensorDataTypes_t resultType
Definition: isf_dsa_adapter.h:85
DSA_ERR_VALIDATE_SETTINGS
Definition: isf_dsa_adapter.h:32
isf_dsa_ControlData_st::pEventGroup
LWEVENT_STRUCT * pEventGroup
Definition: isf_dsa_adapter.h:94
isf_SensorHandle_st::adapterStatus
isf_dsa_AdapterStatus_t adapterStatus
Definition: isf_dsa_adapter.h:114
SensorConfig_st::channelId
sys_channelId_t channelId
Definition: isf_dsa_adapter.h:158
isf_dsa_ControlInterface_t
struct isf_dsa_ControlInterface_st isf_dsa_ControlInterface_t
This defines the DSA adapter control interface abstract function list.
DSA_STATE_CONFIGURED_STOPPED
Definition: isf_dsa_adapter.h:61
DSA_ERR_PARAM
Definition: isf_dsa_adapter.h:38
isf_dsa_ControlInterface_st::Shutdown
isf_dsa_status_t(* Shutdown)(isf_SensorHandle_t *pSensorHandle)
Definition: isf_dsa_adapter.h:135
isf_dsa_ControlData_st
This defines the DSA adapter functional interface.
Definition: isf_dsa_adapter.h:92
DSA_RESULT_TYPE_ENG_FLOAT
Definition: isf_dsa_adapter.h:51
DSA_RET_SETTINGS_CHANGED
Definition: isf_dsa_adapter.h:42
isf_dsa_ControlData_st::nEventFieldIndex
uint32 nEventFieldIndex
Definition: isf_dsa_adapter.h:95
isf_dsa_SensorSettings_st::pSampleBufferInfo
isf_fifo_t * pSampleBufferInfo
Definition: isf_dsa_adapter.h:83
DSA_ERR_SHUTDOWN
Definition: isf_dsa_adapter.h:37
DSA_ERR_CALIBRATE
Definition: isf_dsa_adapter.h:36
isf_fifo.h
isf_dsa_SensorSettings_t
struct isf_dsa_SensorSettings_st isf_dsa_SensorSettings_t
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
DSA_STATE_NOT_INITIALIZED
Definition: isf_dsa_adapter.h:59
isf_dsa_SensorSettings_st
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
Definition: isf_dsa_adapter.h:81
isf_dsa_ControlData_t
struct isf_dsa_ControlData_st isf_dsa_ControlData_t
This defines the DSA adapter functional interface.
isf_dsa_ControlData_st::sensorSettings
isf_dsa_SensorSettings_t sensorSettings
Definition: isf_dsa_adapter.h:96
isf_dsa_ControlInterface_st
This defines the DSA adapter control interface abstract function list.
Definition: isf_dsa_adapter.h:127
DSA_ERR_START_DATA
Definition: isf_dsa_adapter.h:34
isf_dsa_error_enums
isf_dsa_error_enums
This enumerates the error types returned by the DSA sensor functions.
Definition: isf_dsa_adapter.h:29
isf_dsa_ControlInterface_st::Initialize
isf_dsa_status_t(* Initialize)(isf_SensorHandle_t *pSensorHandle)
Definition: isf_dsa_adapter.h:129
isf_dsa_info_t
Definition: isf_dsa_adapter.h:117
isf_sysconf_types.h
This file defines the configuration types and structures for the system communication channel...
DSA_ERR_CONFIGURE
Definition: isf_dsa_adapter.h:33
isf_dsa_AdapterStatus_t
enum isf_dsa_AdapterStatus_enums isf_dsa_AdapterStatus_t
This defines the standard DSA adapter sensor status types. User defined sensor adapters may need addi...
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.