ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 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  */
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 
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 */
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  */
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.
64 
65 
66 
67 /*!
68  * @brief This defines the DSA adapter device information block.
69  */
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. */
76 
77 /*!
78  * @brief This defines the DSA sensor configuration parameter structure configuring the sensor settings
79  * by a subscriber task.
80  */
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 */
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 */
98 
99 
100 /*
101  * Forward declaration of the sensor configuration struct
102  */
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 */
116 
117 typedef struct
118 {
119  char *name;
121 
123 
124 /*!
125  * @brief This defines the DSA adapter control interface abstract function list.
126  */
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. */
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. */
149 
150 /*!
151  * @brief This defines the DSA sensor configuration structure
152  * defining each individual sensor adapter in the DSA Sensor List.
153  */
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_ */
struct isf_dsa_DeviceInfoBlock_st isf_dsa_DeviceInfoBlock_t
This defines the DSA adapter device information block.
ISF board support header files.
void * pSensorSpecificSettings
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
This defines the DSA sensor configuration structure defining each individual sensor adapter in the DS...
isf_dsa_status_t(* StartData)(isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t(* EndData)(isf_SensorHandle_t *pSensorHandle)
const void * commInfo
isf_dsa_ControlData_t controlData
const isf_dsa_Adapter_t * pAdapter
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)
enum isf_dsa_error_enums isf_dsa_err_t
This enumerates the error types returned by the DSA sensor functions.
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
isf_dsa_ControlInterface_t control
isf_dsa_status_t(* ValidateSettings)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This defines the DSA adapter device information block.
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
isf_SensorTypes_t
isf_dsa_AdapterStatus_enums
This defines the standard DSA adapter sensor status types. User defined sensor adapters may need addi...
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
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_data_converter_t * Convert
uint8 sys_channelId_t
isf_dsa_result_enums
isf_dsa_DeviceInfoBlock_t devInfo
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
isf_dsa_status_t(* Configure)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_SensorDataTypes_t * pSupportedSensorDataTypes
struct isf_SensorHandle_st isf_SensorHandle_t
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
isf_dsa_status_t(* Calibrate)(isf_SensorHandle_t *pSensorHandle, void *pCalData)
The isf_sensor_types.h contains the enumerated list of sensor types used by ISF.
enum isf_dsa_result_enums isf_dsa_result_types_t
This defines the DSA adapter structure required for static initialization of the concrete instance of...
isf_SensorTypes_t * pSupportedSensorTypes
isf_dsa_result_types_t resultFormat
isf_SensorDataTypes_t
const isf_SensorConfig_t * pSensorStaticConfig
long int32
This defines int32 as long.
Definition: isf_types.h:32
isf_SensorDataTypes_t resultType
LWEVENT_STRUCT * pEventGroup
isf_dsa_AdapterStatus_t adapterStatus
sys_channelId_t channelId
struct isf_dsa_ControlInterface_st isf_dsa_ControlInterface_t
This defines the DSA adapter control interface abstract function list.
isf_dsa_status_t(* Shutdown)(isf_SensorHandle_t *pSensorHandle)
This defines the DSA adapter functional interface.
struct isf_dsa_SensorSettings_st isf_dsa_SensorSettings_t
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
struct isf_dsa_ControlData_st isf_dsa_ControlData_t
This defines the DSA adapter functional interface.
isf_dsa_SensorSettings_t sensorSettings
This defines the DSA adapter control interface abstract function list.
isf_dsa_error_enums
This enumerates the error types returned by the DSA sensor functions.
isf_dsa_status_t(* Initialize)(isf_SensorHandle_t *pSensorHandle)
This file defines the configuration types and structures for the system communication channel...
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...