MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClOsccaSafo_Sfr_RegBank.h
1/*--------------------------------------------------------------------------*/
2/* Copyright 2023 NXP */
3/* */
4/* SPDX-License-Identifier: BSD-3-Clause */
5/* */
6/* Redistribution and use in source and binary forms, with or without */
7/* modification, are permitted provided that the following conditions are */
8/* met: */
9/* */
10/* 1. Redistributions of source code must retain the above copyright */
11/* notice, this list of conditions and the following disclaimer. */
12/* */
13/* 2. Redistributions in binary form must reproduce the above copyright */
14/* notice, this list of conditions and the following disclaimer in the */
15/* documentation and/or other materials provided with the distribution. */
16/* */
17/* 3. Neither the name of the copyright holder nor the names of its */
18/* contributors may be used to endorse or promote products derived from */
19/* this software without specific prior written permission. */
20/* */
21/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS */
22/* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
23/* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
24/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
25/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
26/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
27/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
28/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
29/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
30/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
31/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
32/*--------------------------------------------------------------------------*/
33
34#ifndef MCUXCLOSCCASAFO_SFR_REGBANK_H_
35#define MCUXCLOSCCASAFO_SFR_REGBANK_H_
36
38#include <platform_specific_headers.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45
47MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_getAddrOfDataReg)
48static inline uint32_t * mcuxClOsccaSafo_Sfr_getAddrOfDataReg(uint32_t dataRegIndex)
49{
50 MCUX_CSSL_ANALYSIS_START_PATTERN_HW_READ()
51 return &(((uint32_t *) &(MCUXCLOSCCASAFO_SFR_READ(DATIN0A)))[dataRegIndex]);
52 MCUX_CSSL_ANALYSIS_STOP_PATTERN_HW_READ()
53}
54
56MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_getAddrOfKeyReg)
57static inline uint32_t * mcuxClOsccaSafo_Sfr_getAddrOfKeyReg(uint32_t keyRegIndex)
58{
59 MCUX_CSSL_ANALYSIS_START_PATTERN_HW_READ()
60 return &(((uint32_t *) &(MCUXCLOSCCASAFO_SFR_READ(KEY0A)))[keyRegIndex]);
61 MCUX_CSSL_ANALYSIS_STOP_PATTERN_HW_READ()
62}
63
65MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_writeKeyWord)
66static inline void mcuxClOsccaSafo_Sfr_writeKeyWord(uint32_t index, uint32_t value)
67{
68 MCUX_CSSL_ANALYSIS_START_PATTERN_HW_WRITE()
69 volatile uint32_t *const safoKeyWord = (uint32_t *) &(MCUXCLOSCCASAFO_SFR_READ(KEY0A));
70 MCUX_CSSL_ANALYSIS_START_SUPPRESS_OUT_OF_BOUNDS_ACCESS("Apply an index to the base address of a HW peripheral to access the correct SFR-word. The caller is responsible for ensuring that the index is valid.")
71 safoKeyWord[index] = value;
72 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_OUT_OF_BOUNDS_ACCESS()
73 MCUX_CSSL_ANALYSIS_STOP_PATTERN_HW_WRITE()
74}
75
77MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_readKeyWord)
78static inline uint32_t mcuxClOsccaSafo_Sfr_readKeyWord(uint32_t index)
79{
80 MCUX_CSSL_ANALYSIS_START_PATTERN_HW_READ()
81 volatile uint32_t *const safoKeyWord = (uint32_t *) &(MCUXCLOSCCASAFO_SFR_READ(KEY0A));
82 MCUX_CSSL_ANALYSIS_START_SUPPRESS_OUT_OF_BOUNDS_ACCESS("Apply an index to the base address of a HW peripheral to access the correct SFR-word. The caller is responsible for ensuring that the index is valid.")
83 return safoKeyWord[index];
84 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_OUT_OF_BOUNDS_ACCESS()
85 MCUX_CSSL_ANALYSIS_STOP_PATTERN_HW_READ()
86}
87
89MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_writeDatinWord)
90static inline void mcuxClOsccaSafo_Sfr_writeDatinWord(uint32_t index, uint32_t value)
91{
92 MCUX_CSSL_ANALYSIS_START_PATTERN_HW_WRITE()
93 volatile uint32_t *const safoDatinWord = (uint32_t *) &(MCUXCLOSCCASAFO_SFR_READ(DATIN0A));
94 MCUX_CSSL_ANALYSIS_START_SUPPRESS_OUT_OF_BOUNDS_ACCESS("Apply an index to the base address of a HW peripheral to access the correct SFR-word. The caller is responsible for ensuring that the index is valid.")
95 safoDatinWord[index] = value;
96 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_OUT_OF_BOUNDS_ACCESS()
97 MCUX_CSSL_ANALYSIS_STOP_PATTERN_HW_WRITE()
98}
99
100#ifdef MCUXCL_FEATURE_HW_SAFO_SM3
101MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_writeFifoWord)
102static inline void mcuxClOsccaSafo_Sfr_writeFifoWord(uint32_t value)
103{
104 MCUXCLOSCCASAFO_SFR_WRITE(SM3_FIFO, value);
105}
106#endif
107
109MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_readDatinWord)
110static inline uint32_t mcuxClOsccaSafo_Sfr_readDatinWord(uint32_t index)
111{
112 MCUX_CSSL_ANALYSIS_START_PATTERN_HW_READ()
113 volatile uint32_t *const safoDatinWord = (uint32_t *) &(MCUXCLOSCCASAFO_SFR_READ(DATIN0A));
114 MCUX_CSSL_ANALYSIS_START_SUPPRESS_OUT_OF_BOUNDS_ACCESS("Apply an index to the base address of a HW peripheral to access the correct SFR-word. The caller is responsible for ensuring that the index is valid.")
115 return safoDatinWord[index];
116 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_OUT_OF_BOUNDS_ACCESS()
117 MCUX_CSSL_ANALYSIS_STOP_PATTERN_HW_READ()
118}
119
121MCUX_CSSL_FP_FUNCTION_DEF(mcuxClOsccaSafo_Sfr_readDatoutWord)
122static inline uint32_t mcuxClOsccaSafo_Sfr_readDatoutWord(uint32_t index)
123{
124 MCUX_CSSL_ANALYSIS_START_PATTERN_HW_READ()
125 volatile uint32_t *const safoDatoutWord = (uint32_t *) &(MCUXCLOSCCASAFO_SFR_READ(DATOUTA));
126 MCUX_CSSL_ANALYSIS_START_SUPPRESS_OUT_OF_BOUNDS_ACCESS("Apply an index to the base address of a HW peripheral to access the correct SFR-word. The caller is responsible for ensuring that the index is valid.")
127 return safoDatoutWord[index];
128 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_OUT_OF_BOUNDS_ACCESS()
129 MCUX_CSSL_ANALYSIS_STOP_PATTERN_HW_READ()
130}
131
132#ifdef __cplusplus
133} /* extern "C" */
134#endif
135
136#endif /* MCUXCLOSCCASAFO_SFR_REGBANK_H_ */
Macros for abstracting SAFO hardware SFR access.
#define MCUXCLOSCCASAFO_SFR_READ(sfr)
Read from SAFO SFR.
Definition mcuxClOsccaSafo_SfrAccess.h:62
#define MCUXCLOSCCASAFO_SFR_WRITE(sfr, value)
Write to SAFO SFR.
Definition mcuxClOsccaSafo_SfrAccess.h:68
Provides the API for the CSSL flow protection mechanism.
#define MCUX_CSSL_FP_FUNCTION_DEF(...)
Definition of a flow protected function.
Definition mcuxCsslFlowProtection.h:179