ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
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  */
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 
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 */
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  */
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.
62 
63 
64 
65 /*!
66  * @brief This defines the DSA adapter device information block.
67  */
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. */
74 
75 /*!
76  * @brief This defines the DSA sensor configuration parameter structure configuring the sensor settings
77  * by a subscriber task.
78  */
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 */
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 */
96 
97 
98 /*
99  * Forward declaration of the sensor configuration struct
100  */
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 */
115 
116 typedef struct
117 {
118  char *name;
120 
122 
123 /*!
124  * @brief This defines the DSA adapter control interface abstract function list.
125  */
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. */
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.
void * pSensorSpecificSettings
unsigned char uint8
Definition: isf_types.h:76
This defines the DSA sensor configuration structure defining each individual sensor adapter in the DS...
isf_dsa_status_t(* Configure)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_dsa_status_t(* Shutdown)(isf_SensorHandle_t *pSensorHandle)
const void * commInfo
isf_dsa_ControlData_t controlData
const isf_dsa_Adapter_t * pAdapter
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
This defines the DSA adapter device information block.
isf_dsa_status_t(* Flash)(isf_SensorHandle_t *pSensorHandle, void *pFlashData, uint8 numBytes)
isf_dsa_status_t(* StartData)(isf_SensorHandle_t *pSensorHandle)
isf_SensorTypes_t
isf_dsa_status_t(* Calibrate)(isf_SensorHandle_t *pSensorHandle, void *pCalData)
isf_dsa_AdapterStatus_enums
This defines the standard DSA adapter sensor status types. User defined sensor adapters may need addi...
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_status_t(* ValidateSettings)(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
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_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...
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_dsa_status_t( isf_dsa_data_converter_t)(volatile isf_SensorHandle_t *, isf_SensorDataTypes_t, isf_dsa_result_types_t, void *, void *, int32 *numBytes)
isf_SensorDataTypes_t
const isf_SensorConfig_t * pSensorStaticConfig
isf_SensorDataTypes_t resultType
Main ISF header file. Contains code common to all ISF components.
isf_dsa_AdapterStatus_t adapterStatus
signed long int int32
Definition: isf_types.h:74
sys_channelId_t channelId
struct isf_dsa_ControlInterface_st isf_dsa_ControlInterface_t
This defines the DSA adapter control interface abstract function list.
This defines the DSA adapter functional interface.
isf_dsa_status_t(* Initialize)(isf_SensorHandle_t *pSensorHandle)
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.
unsigned long int uint32
Definition: isf_types.h:78
isf_dsa_error_enums
This enumerates the error types returned by the DSA sensor functions.
isf_dsa_status_t(* EndData)(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...