| 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.c
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2013, Freescale Semiconductor, Inc.
4 *
5 */
6
7 /*!
8 * @file isf.c
9 * @brief Internal Isf library configuration.
10 *
11 */
12
13 #include "isf_target.h"
14 #include "isf.h"
15 #include "version.h"
16
17
18
19
20 /*!
21 * @brief IPSF library version information.
22 */
23 const isf_lib_info_t gIsfLibInfo =
24 {
25 ISF_LIB_VERSION_MAJOR,
26 ISF_LIB_VERSION_MINOR,
27 ISF_LIB_BUILD_CODE,
28 DEVICE_PART_NUM,
29 __TIME__
30 };
31
32
33 // See isf.h for documentation
34 isf_lib_info_t *isf_lib_get_info(void)
35 {
36 return ((isf_lib_info_t *)&gIsfLibInfo);
37 }
38
39
40 /*************************************************************************************************
41 * @brief Copies a device info structure to the supplied memory location and returns the
42 * number of bytes that were copied to the location.
43 *
44 * @details The device info structure contains:
45 * uint32 device_id; - ROM: Pseudo random part identification value
46 * uint16 rom_version; - ROM: ROM version code: major.minor
47 * uint16 fw_version; - FW: Firmware version code: major.minor
48 * uint16 hw_version; - ROM: Hardware version code: major.minor
49 * uint16 build_code; - FW: Firmware build number and date code. The value is
50 * encoded in the following bit fields:
51 * - [15:13] daily build number, 0 to 7
52 * - [12: 9] build month, 1 to 12
53 * - [ 8: 4] build day, 1 to 31
54 * - [ 3: 0] build year, 2012 to 2027
55 * uint16 part_number; - FW: BCD encoded part number, e.g. 0x9559
56 * uint8 reset_cause; - FW: Lower 5 bits from the RCSR reports reset source.
57 * uint8 secure_mode; - FW: Lower 2 bits of FOPT report the security mode of
58 * the device: 2 = secure, otherwise not secure.
59 *
60 * The values marked ROM are retrieved from the ROM using the ROM device info command, while the
61 * vales marked with FW are written by the firmware.
62 *
63 * The number of bytes copied to the destination is limited to the lesser of the number of bytes
64 * requested in the device structure, and the length of the device info structure.
65 *
66 * @return The number of bytes copied to the supplied destination.
67 ************************************************************************************************/
68 void _fw_device_info_get(device_info_t *rom_info)
69 {
70 isf_lib_info_t *fw_info;
71
72
73 // TODO: Port for Kinetis.
74 // Read device info from the ROM Code
75 //device_info_get(sizeof(device_info_t),(uint_16 *)rom_info); //device_info_get should take(device_info_t *) but it doesn't
76
77 fw_info = isf_lib_get_info();
78
79 // Replace / add the firmware and build values
80 rom_info->fw_version = (fw_info->majorVersion << 8) | (fw_info->minorVersion);
81 rom_info->part_number = fw_info->partNumber;
82 rom_info->build_code = fw_info->buildCode;
83
84
85 // TODO: Port for Kinetis.
86 //rom_info->reset_cause = RCSR & 0x1F;
87 //rom_info->secure_mode = FOPT & 3;
88 }
89
90
91
92
DEVICE_PART_NUM
#define DEVICE_PART_NUM
Definition: version.h:18
isf_target.h
ISF board support header files.
ISF_LIB_VERSION_MAJOR
#define ISF_LIB_VERSION_MAJOR
Definition: version.h:19
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_lib_info_t::buildCode
uint16 buildCode
Build code is the 16 bit code returned by the device info command.
Definition: isf.h:102
ISF_LIB_BUILD_CODE
#define ISF_LIB_BUILD_CODE
Definition: version.h:21
ISF_LIB_VERSION_MINOR
#define ISF_LIB_VERSION_MINOR
Definition: version.h:20
isf_lib_get_info
isf_lib_info_t * isf_lib_get_info(void)
API ISF library get information.
Definition: isf.c:34
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
version.h
Version information.
isf.h
Main ISF header file. Contains code common to all ISF components.
device_info_t::part_number
uint_16 part_number
Definition: isf.h:126
device_info_t::fw_version
uint_16 fw_version
Definition: isf.h:118
gIsfLibInfo
const isf_lib_info_t gIsfLibInfo
IPSF library version information.
Definition: isf.c:23
_fw_device_info_get
void _fw_device_info_get(device_info_t *rom_info)
Definition: isf.c:68
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.