fsl_otfad_hal.h
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _fsl_otfad_hal_h
#define _fsl_oftad_hal_h
#include "bootloader_common.h"
// Definitions
enum _hal_constants
{
kOtfadNumKeyWords = 4,
kOtfadNumCtrWords = 2,
kOtfadNumRgnWords = 2
};
typedef struct OtfadContextInfo
{
uint32_t keyInfo[kOtfadNumKeyWords];
uint32_t ctrInfo[kOtfadNumCtrWords];
uint32_t regionInfo[kOtfadNumRgnWords];
} otfad_context_info_t;
enum _otfad_modes
{
kOtfadMode_Normal = 0x00,
kOtfadMode_SecurityViolation = 0x02,
kOtfadMode_LogiallyDisabled = 0x03
};
enum _otfad_enables
{
kOtfadDisable = 0x00,
kOtfadEnable = 0x01
};
// Prototypes
#if defined(__cplusplus)
extern "C" {
#endif // __cplusplus
uint32_t otfad_hal_get_mode(OTFAD_Type *baseAddr);
void otfad_hal_global_enable(OTFAD_Type *baseAddr);
bool otfad_hal_is_enabled(OTFAD_Type *baseAddr);
void otfad_hal_restricted_register_access_enable(OTFAD_Type *baseAddr);
bool otfad_hal_is_register_access_restricted(OTFAD_Type *baseAddr);
uint32_t otfad_hal_get_hardware_revision_level(OTFAD_Type *baseAddr);
uint32_t otfad_hal_get_number_of_contexts(OTFAD_Type *baseAddr);
void otfad_hal_set_context(OTFAD_Type *baseAddr, uint32_t contextNum, const otfad_context_info_t *contextInfo);
#if defined(__cplusplus)
}
#endif // __cplusplus
#endif // _fsl_otfad_hal.h_
// EOF
otfad_hal_get_mode
uint32_t otfad_hal_get_mode(OTFAD_Type *baseAddr)
Get the current mode.
Definition: fsl_otfad_hal.c:46
kOtfadDisable
Disable.
Definition: fsl_otfad_hal.h:70
otfad_hal_global_enable
void otfad_hal_global_enable(OTFAD_Type *baseAddr)
Enable the module.
Definition: fsl_otfad_hal.c:52
kOtfadNumKeyWords
Number of key words.
Definition: fsl_otfad_hal.h:46
kOtfadNumRgnWords
Number of region words.
Definition: fsl_otfad_hal.h:48
otfad_hal_get_number_of_contexts
uint32_t otfad_hal_get_number_of_contexts(OTFAD_Type *baseAddr)
Get number of contexts.
Definition: fsl_otfad_hal.c:82
kOtfadMode_LogiallyDisabled
Logically Disabled Mode (LDM)
Definition: fsl_otfad_hal.h:64
_otfad_enables
_otfad_enables
Enable flags.
Definition: fsl_otfad_hal.h:68
kOtfadNumCtrWords
Number of counter words.
Definition: fsl_otfad_hal.h:47
otfad_hal_restricted_register_access_enable
void otfad_hal_restricted_register_access_enable(OTFAD_Type *baseAddr)
Enable restricted register status.
Definition: fsl_otfad_hal.c:64
kOtfadMode_SecurityViolation
Security Violation Mode (SVM)
Definition: fsl_otfad_hal.h:63
otfad_hal_is_enabled
bool otfad_hal_is_enabled(OTFAD_Type *baseAddr)
Get enabled state.
Definition: fsl_otfad_hal.c:58
kOtfadMode_Normal
Normal mode (NRM)
Definition: fsl_otfad_hal.h:62
_otfad_modes
_otfad_modes
Operational modes.
Definition: fsl_otfad_hal.h:60
_hal_constants
_hal_constants
Constants.
Definition: fsl_otfad_hal.h:44
otfad_hal_set_context
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
otfad_hal_get_hardware_revision_level
uint32_t otfad_hal_get_hardware_revision_level(OTFAD_Type *baseAddr)
Get hardware revision level.
Definition: fsl_otfad_hal.c:76
otfad_context_info_t
Format of context info.
Definition: fsl_otfad_hal.h:52
otfad_hal_is_register_access_restricted
bool otfad_hal_is_register_access_restricted(OTFAD_Type *baseAddr)
Get restricted register access state.
Definition: fsl_otfad_hal.c:70
kOtfadEnable
Enable.
Definition: fsl_otfad_hal.h:71