| 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.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2013, Freescale Semiconductor, Inc.
4 *
5 */
6
7 /*!
8 * @file isf.h
9 * @brief Main ISF header file. Contains code common to all ISF components.
10 *
11 */
12
13
14
15 #ifndef ISF_H_
16 #define ISF_H_
17
18
19 #include "mqxlite.h"
20 #include "isf_types.h"
21
22
23
24 /*!
25 * @enum isf_status_enum
26 *
27 * @brief ISF library return status type.
28 */
29 typedef enum
30 {
31 /*! General ISF success status
32 */
33 ISF_SUCCESS = 0,
34
35 //! General library initialization failure status.
36 ISF_ERR_LIB_INIT = 1
37
38 } isf_status_enum;
39
40
41 /*!
42 * @typedef isf_status_t
43 *
44 * @brief ISF return status type.
45 * @details ISF general success status for API functions.<br>
46 * Any value not equal to ISF_SUCCESS is considered a<br>
47 * failure and the error is application specific. See<br>
48 * application API documentation for specific error<br>
49 * definitions.
50 */
51 typedef int32 isf_status_t;
52
53
54 /*!
55 * @typedef isf_duration_t
56 *
57 * @brief ISF time duration in microseconds.
58 */
59 typedef uint32 isf_duration_t;
60
61
62 /*!
63 * @def MAX_ISF_APPLICATIONS
64 * @brief Maximum number of applications
65 * @details The maximum number of applications that can exists. Note <br>
66 * that the application id can be anywhere between APP_ID_NULL and <br>
67 * NO_APP_FBID_INDX, but the maximum number of those applications<br>
68 * is limited to the value set here.
69 */
70 #define MAX_ISF_APPLICATIONS (32)
71
72
73 /*!
74 * @def APP_ID_NULL
75 * @brief Null application ID
76 * @details Value for null application ID.
77 */
78 #define APP_ID_NULL (0)
79
80
81
82
83
84 /*!
85 * @struct isf_lib_info_t
86 * @brief This structure holds the ISF library information such <br>
87 * as version and part number.
88 *
89 */
90 typedef struct
91 {
92 //! IPSF library major version number.- dev info cmd encodes this in 8 bits
93 uint8 majorVersion;
94 //! ISF library minor version number.- dev info cmd encodes this in 8 bits
95 uint8 minorVersion;
96 //! Build code is the 16 bit code returned by the device info command
97 // Bit field encoding:
98 // - [15:13] daily build number, 3 bits range 0 to 7, mask 0xE000
99 // - [12: 9] build month, 4 bits range 1 to 12, mask 0x1E00
100 // - [ 8: 4] build day, 5 bits range 1 to 31, mask 0x01F0
101 // - [ 3: 0] build year - 2012, 4 bits range 0 to 15 = 2012 to 2027, mask 0x000F
102 uint16 buildCode;
103 //! Part number this library is targeted for.- dev info cmd encodes this in 8 bits
104 uint16 partNumber;
105 //! The time of the ISF build "hh:mm:ss"
106 uint8 buildTime[9];
107 } isf_lib_info_t;
108
109 /*!
110 * @struct device_info_t
111 * @brief This structure holds the ROM device information such as version and part number
112 * and is returned by the _fw_device_info_get() command.
113 *
114 */
115 typedef struct {
116 uint_32 device_id; /**< ROM: Pseudo random part identification value */
117 uint_16 rom_version; /**< ROM: ROM version code: major.minor */
118 uint_16 fw_version; /**< FW: Firmware version code: major.minor */
119 uint_16 hw_version; /**< ROM: Hardware version code: major.minor */
120 uint_16 build_code; /**< FW: Firmware build number and date code. The value is
121 * encoded in the following bit fields:
122 * - [15:12] daily build number, 0 to 15
123 * - [11: 8] build month, 1 to 12
124 * - [ 7: 3] build day, 1 to 31
125 * - [ 2: 0] build year, 2010 to 2017 */
126 uint_16 part_number; /**< FW: BCD encoded part number, e.g. 0x500x */
127 uint_8 reset_cause; /**< FW: Lower 5 bits from the RCSR reports reset source */
128 uint_8 secure_mode; /**< FW: Lower 2 bits of FOPT report the security mode of
129 * the device: 2 = secure, otherwise not secure */
130 uint_16 pad;
131 } device_info_t;
132
133 /*!
134 * @brief API ISF library get information
135 *
136 * The isf_lib_get_info() function is called by an application that needs <br>
137 * retrieve library version and part number that the library is targeted for.
138 *
139 *
140 * @return Pointer to isf_lib_info_t structure containing the<br>
141 * library information.
142 *
143 * @errors
144 *
145 * @constraints
146 *
147 * @reentrant No<br>
148 *
149 * @libs isf_core.lib
150 *
151 * @see
152 *
153 */
154 extern isf_lib_info_t * isf_lib_get_info(void);
155
156
157 /*!
158 * @brief API ISF library get information
159 *
160 * The isf_lib_get_info() function is called by an application that needs <br>
161 * retrieve library version and part number that the library is targeted for.
162 *
163 * @return ISF_SUCCESS if initialization was successful.<br>
164 * ISF_ERR_LIB_INIT if tasks were not created properly.
165 *
166 * @errors <br>
167 *
168 * @constraints <br>
169 *
170 * @reentrant No<br>
171 *
172 * @libs <br>
173 *
174 * @see <br>
175 *
176 */
177 extern isf_status_t isf_lib_init(void *pNull);
178
179
180
181 /*!
182 * @enum isf_app_id_enum
183 * @brief ISF application number.
184 *
185 */
186 enum isf_app_id_enum
187 {
188 ISF_APP_ID_DEV_INFO = 0,
189 ISF_APP_ID_MBOX = 1,
190 ISF_APP_ID_LAST
191 };
192 #define USER_APP_ID_START (ISF_APP_ID_LAST)
193
194
195
196
197 /*!
198 * @def ISF_TASK_INDEX_START
199 * @brief ISF starting task index
200 *
201 * @details This define specifies the starting task index of ISF<br>
202 * tasks. The user should use task index that are LOWER than<br>
203 * the value stated here.
204 */
205 #define ISF_TASK_INDEX_START (50)
206
207
208
209 /*************************************************************************************************
210 * @brief Copies a device info structure to the supplied memory location and returns the
211 * number of bytes that were copied to the location.
212 *
213 * @details The device info structure contains:
214 * uint32 device_id; - ROM: Pseudo random part identification value
215 * uint16 rom_version; - ROM: ROM version code: major.minor
216 * uint16 fw_version; - FW: Firmware version code: major.minor
217 * uint16 hw_version; - ROM: Hardware version code: major.minor
218 * uint16 build_code; - FW: Firmware build number and date code. The value is
219 * encoded in the following bit fields:
220 * - [15:13] daily build number, 0 to 7
221 * - [12: 9] build month, 1 to 12
222 * - [ 8: 4] build day, 1 to 31
223 * - [ 3: 0] build year, 2012 to 2027
224 * uint16 part_number; - FW: BCD encoded part number, e.g. 0x9559
225 * uint8 reset_cause; - FW: Lower 5 bits from the RCSR reports reset source.
226 * uint8 secure_mode; - FW: Lower 2 bits of FOPT report the security mode of
227 * the device: 2 = secure, otherwise not secure.
228 *
229 * The values marked ROM are retrieved from the ROM using the ROM device info command, while the
230 * vales marked with FW are written by the firmware.
231 *
232 * The number of bytes copied to the destination is limited to the lesser of the number of bytes
233 * requested in the device structure, and the length of the device info structure.
234 *
235 * @return The number of bytes copied to the supplied destination.
236 ************************************************************************************************/
237 void _fw_device_info_get(device_info_t *info_ptr);
238
239
240
241
242 /*! @brief This API returns the time in microseconds.
243 *
244 *
245 * @details This API call uses the RTOS services to calculate and
246 * return the elapsed time since the system started running. Note that
247 * if the elapsed time has exceeded a 32bit value, that is 2^32-1 or
248 * 4294.96 seconds, then the time elapsed will rollover and start at
249 * zero.
250 *
251 * @return ::isf_time_util_get_usec() returns a value of type
252 * uint32 providing the number of microseconds since
253 * the system started running.
254 *
255 * @Constraints None
256 *
257 * @Reentrant No
258 *
259 * @Libs libisf_core.a
260 *
261 */
262 uint32 isf_time_util_get_usec(void);
263
264
265
266
267 #endif /* ISF_H_ */
268
269
isf_lib_get_info
isf_lib_info_t * isf_lib_get_info(void)
API ISF library get information.
Definition: isf.c:34
device_info_t::secure_mode
uint_8 secure_mode
Definition: isf.h:128
isf_app_id_enum
isf_app_id_enum
ISF application number.
Definition: isf.h:186
uint8
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
_fw_device_info_get
void _fw_device_info_get(device_info_t *info_ptr)
Definition: isf.c:68
device_info_t
This structure holds the ROM device information such as version and part number and is returned by th...
Definition: isf.h:115
ISF_APP_ID_MBOX
Definition: isf.h:189
ISF_SUCCESS
Definition: isf.h:33
isf_time_util_get_usec
uint32 isf_time_util_get_usec(void)
This API returns the time in microseconds.
Definition: isf_util.c:52
uint32
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
isf_lib_info_t::buildCode
uint16 buildCode
Build code is the 16 bit code returned by the device info command.
Definition: isf.h:102
isf_types.h
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
device_info_t::device_id
uint_32 device_id
Definition: isf.h:116
device_info_t::pad
uint_16 pad
Definition: isf.h:130
isf_lib_init
isf_status_t isf_lib_init(void *pNull)
API ISF library get information.
Definition: isf_init.c:18
isf_lib_info_t::minorVersion
uint8 minorVersion
ISF library minor version number.- dev info cmd encodes this in 8 bits.
Definition: isf.h:95
device_info_t::build_code
uint_16 build_code
Definition: isf.h:120
isf_status_enum
isf_status_enum
ISF library return status type.
Definition: isf.h:29
device_info_t::reset_cause
uint_8 reset_cause
Definition: isf.h:127
isf_duration_t
uint32 isf_duration_t
ISF time duration in microseconds.
Definition: isf.h:59
int32
long int32
This defines int32 as long.
Definition: isf_types.h:32
device_info_t::part_number
uint_16 part_number
Definition: isf.h:126
device_info_t::rom_version
uint_16 rom_version
Definition: isf.h:117
ISF_ERR_LIB_INIT
General library initialization failure status.
Definition: isf.h:36
ISF_APP_ID_LAST
Definition: isf.h:190
uint16
unsigned short uint16
This defines uint16 as unsigned short.
Definition: isf_types.h:27
isf_status_t
int32 isf_status_t
ISF return status type.
Definition: isf.h:51
device_info_t::fw_version
uint_16 fw_version
Definition: isf.h:118
device_info_t::hw_version
uint_16 hw_version
Definition: isf.h:119
ISF_APP_ID_DEV_INFO
Definition: isf.h:188
isf_lib_info_t::partNumber
uint16 partNumber
Part number this library is targeted for.- dev info cmd encodes this in 8 bits.
Definition: isf.h:104
isf_lib_info_t
This structure holds the ISF library information such as version and part number.
Definition: isf.h:90
isf_lib_info_t::majorVersion
uint8 majorVersion
IPSF library major version number.- dev info cmd encodes this in 8 bits.
Definition: isf.h:93
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.