Kinetis Bootloader  2.0.0
Common bootloader for Kinetis devices
fsl_otfad_hal.h
1 /*
2  * Copyright (c) 2014, Freescale Semiconductor, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * o Redistributions of source code must retain the above copyright notice, this list
9  * of conditions and the following disclaimer.
10  *
11  * o Redistributions in binary form must reproduce the above copyright notice, this
12  * list of conditions and the following disclaimer in the documentation and/or
13  * other materials provided with the distribution.
14  *
15  * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef _fsl_otfad_hal_h
32 #define _fsl_oftad_hal_h
33 
34 #include "bootloader_common.h"
35 
38 
40 // Definitions
42 
45 {
49 };
50 
52 typedef struct OtfadContextInfo
53 {
54  uint32_t keyInfo[kOtfadNumKeyWords];
55  uint32_t ctrInfo[kOtfadNumCtrWords];
56  uint32_t regionInfo[kOtfadNumRgnWords];
58 
61 {
65 };
66 
69 {
70  kOtfadDisable = 0x00,
71  kOtfadEnable = 0x01
72 };
73 
75 // Prototypes
77 
78 #if defined(__cplusplus)
79 extern "C" {
80 #endif // __cplusplus
81 
86 uint32_t otfad_hal_get_mode(OTFAD_Type *baseAddr);
87 
94 void otfad_hal_global_enable(OTFAD_Type *baseAddr);
95 
100 bool otfad_hal_is_enabled(OTFAD_Type *baseAddr);
101 
108 void otfad_hal_restricted_register_access_enable(OTFAD_Type *baseAddr);
109 
114 bool otfad_hal_is_register_access_restricted(OTFAD_Type *baseAddr);
115 
120 uint32_t otfad_hal_get_hardware_revision_level(OTFAD_Type *baseAddr);
121 
126 uint32_t otfad_hal_get_number_of_contexts(OTFAD_Type *baseAddr);
127 
133 void otfad_hal_set_context(OTFAD_Type *baseAddr, uint32_t contextNum, const otfad_context_info_t *contextInfo);
134 
135 #if defined(__cplusplus)
136 }
137 #endif // __cplusplus
138 
140 
141 #endif // _fsl_otfad_hal.h_
142 
144 // EOF
uint32_t otfad_hal_get_mode(OTFAD_Type *baseAddr)
Get the current mode.
Definition: fsl_otfad_hal.c:46
Disable.
Definition: fsl_otfad_hal.h:70
void otfad_hal_global_enable(OTFAD_Type *baseAddr)
Enable the module.
Definition: fsl_otfad_hal.c:52
Number of key words.
Definition: fsl_otfad_hal.h:46
Number of region words.
Definition: fsl_otfad_hal.h:48
uint32_t otfad_hal_get_number_of_contexts(OTFAD_Type *baseAddr)
Get number of contexts.
Definition: fsl_otfad_hal.c:82
Logically Disabled Mode (LDM)
Definition: fsl_otfad_hal.h:64
_otfad_enables
Enable flags.
Definition: fsl_otfad_hal.h:68
Number of counter words.
Definition: fsl_otfad_hal.h:47
void otfad_hal_restricted_register_access_enable(OTFAD_Type *baseAddr)
Enable restricted register status.
Definition: fsl_otfad_hal.c:64
Security Violation Mode (SVM)
Definition: fsl_otfad_hal.h:63
bool otfad_hal_is_enabled(OTFAD_Type *baseAddr)
Get enabled state.
Definition: fsl_otfad_hal.c:58
Normal mode (NRM)
Definition: fsl_otfad_hal.h:62
_otfad_modes
Operational modes.
Definition: fsl_otfad_hal.h:60
_hal_constants
Constants.
Definition: fsl_otfad_hal.h:44
void otfad_hal_set_context(OTFAD_Type *baseAddr, uint32_t contextNum, const otfad_context_info_t *contextInfo)
Set context info.
Definition: fsl_otfad_hal.c:88
uint32_t otfad_hal_get_hardware_revision_level(OTFAD_Type *baseAddr)
Get hardware revision level.
Definition: fsl_otfad_hal.c:76
Format of context info.
Definition: fsl_otfad_hal.h:52
bool otfad_hal_is_register_access_restricted(OTFAD_Type *baseAddr)
Get restricted register access state.
Definition: fsl_otfad_hal.c:70
Enable.
Definition: fsl_otfad_hal.h:71