ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 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  */
34 
35  //! General library initialization failure status.
37 
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 */
52 
53 
54 /*!
55  * @typedef isf_duration_t
56  *
57  * @brief ISF time duration in microseconds.
58 */
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
94  //! ISF library minor version number.- dev info cmd encodes this in 8 bits
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
103  //! Part number this library is targeted for.- dev info cmd encodes this in 8 bits
105  //! The time of the ISF build "hh:mm:ss"
106  uint8 buildTime[9];
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 */
187 {
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  */
263 
264 
265 
266 
267 #endif /* ISF_H_ */
268 
269 
isf_lib_info_t * isf_lib_get_info(void)
API ISF library get information.
Definition: isf.c:34
uint_8 secure_mode
Definition: isf.h:128
isf_app_id_enum
ISF application number.
Definition: isf.h:186
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
void _fw_device_info_get(device_info_t *info_ptr)
Definition: isf.c:68
This structure holds the ROM device information such as version and part number and is returned by th...
Definition: isf.h:115
uint32 isf_time_util_get_usec(void)
This API returns the time in microseconds.
Definition: isf_util.c:52
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
uint16 buildCode
Build code is the 16 bit code returned by the device info command.
Definition: isf.h:102
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
uint_32 device_id
Definition: isf.h:116
uint_16 pad
Definition: isf.h:130
isf_status_t isf_lib_init(void *pNull)
API ISF library get information.
Definition: isf_init.c:18
uint8 minorVersion
ISF library minor version number.- dev info cmd encodes this in 8 bits.
Definition: isf.h:95
uint_16 build_code
Definition: isf.h:120
isf_status_enum
ISF library return status type.
Definition: isf.h:29
uint_8 reset_cause
Definition: isf.h:127
uint32 isf_duration_t
ISF time duration in microseconds.
Definition: isf.h:59
long int32
This defines int32 as long.
Definition: isf_types.h:32
uint_16 part_number
Definition: isf.h:126
uint_16 rom_version
Definition: isf.h:117
General library initialization failure status.
Definition: isf.h:36
unsigned short uint16
This defines uint16 as unsigned short.
Definition: isf_types.h:27
int32 isf_status_t
ISF return status type.
Definition: isf.h:51
uint_16 fw_version
Definition: isf.h:118
uint_16 hw_version
Definition: isf.h:119
uint16 partNumber
Part number this library is targeted for.- dev info cmd encodes this in 8 bits.
Definition: isf.h:104
This structure holds the ISF library information such as version and part number.
Definition: isf.h:90
uint8 majorVersion
IPSF library major version number.- dev info cmd encodes this in 8 bits.
Definition: isf.h:93