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

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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