MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClGlikey.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2022-2024 NXP */
3/* */
4/* NXP Confidential and Proprietary. This software is owned or controlled */
5/* by NXP and may only be used strictly in accordance with the applicable */
6/* license terms. By expressly accepting such terms or by downloading, */
7/* installing, activating and/or otherwise using the software, you are */
8/* agreeing that you have read, and that you agree to comply with and are */
9/* bound by, such license terms. If you do not agree to be bound by the */
10/* applicable license terms, then you may not retain, install, activate or */
11/* otherwise use the software. */
12/*--------------------------------------------------------------------------*/
13
23
24#ifndef MCUXCLGLIKEY_H_
25#define MCUXCLGLIKEY_H_
26
27#include <mcuxClConfig.h> // Exported features flags header
28
29#include <stdint.h>
30#include <stddef.h>
31
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39
40/**********************************************
41 * CONSTANTS
42 **********************************************/
49
50/* [Design]
51 Value: XX YZ UU VW
52 - XX: F0: write to WR_EN1, 0F: do not write to WR_EN1
53 - UU: F0: write to WR_EN0, 0F: do not write to WR_EN0
54 - Y: equal to <step> ^ W
55 - Z: value to write to WR_EN1 or equal to ~W
56 - V: equal to <step> ^ Z
57 - W: value to write to WR_EN0 or equal to ~Z
58 Invariant: XXYZ ^ UUVW == 0xFFFF
59*/
60#define MCUXCLGLIKEY_CODEWORD_STEP1 ((uint32_t) 0xF0C10F3EU)
61#define MCUXCLGLIKEY_CODEWORD_STEP2 ((uint32_t) 0x0F1DF0E2U)
62#define MCUXCLGLIKEY_CODEWORD_STEP3 ((uint32_t) 0xF0B00F4FU)
63#define MCUXCLGLIKEY_CODEWORD_STEP4 ((uint32_t) 0x0F4EF0B1U)
64#define MCUXCLGLIKEY_CODEWORD_STEP5 ((uint32_t) 0xF0810F7EU)
65#define MCUXCLGLIKEY_CODEWORD_STEP6 ((uint32_t) 0x0F5DF0A2U)
66#define MCUXCLGLIKEY_CODEWORD_STEP7 ((uint32_t) 0xF0700F8FU)
67#define MCUXCLGLIKEY_CODEWORD_STEP_EN ((uint32_t) 0x0FFFF000U)
68
69#define MCUXCLGLIKEY_STATUS_OK 0x0FF22E03u
70#define MCUXCLGLIKEY_STATUS_NOT_LOCKED 0x0FF22E07u
71#define MCUXCLGLIKEY_STATUS_LOCKED 0x0FF22E0Bu
72
73#define MCUXCLGLIKEY_STATUS_VERSION_ERROR 0x0FF25334u
74#define MCUXCLGLIKEY_STATUS_LOCKED_ERROR 0x0FF25338u
75
76// Glikey state defines
77#define MCUXCLGLIKEY_FSM_WR_DIS 0x0Bu
78#define MCUXCLGLIKEY_FSM_INIT 0x16u
79#define MCUXCLGLIKEY_FSM_STEP1 0x2Cu
80#define MCUXCLGLIKEY_FSM_STEP2 0x58u
81#define MCUXCLGLIKEY_FSM_STEP3 0xB0u
82#define MCUXCLGLIKEY_FSM_STEP4 0x160u
83#define MCUXCLGLIKEY_FSM_LOCKED 0xC01u
84#define MCUXCLGLIKEY_FSM_WR_EN 0x1802u
85#define MCUXCLGLIKEY_FSM_SSR_RESET 0x1005u
87
91
92
93
94/**********************************************
95 * TYPEDEFS
96 **********************************************/
103
104typedef uint32_t mcuxClGlikey_BaseAddress_t;
105typedef uint32_t mcuxClGlikey_Status_t;
106typedef uint32_t mcuxClGlikey_IntEnable_t;
107typedef uint32_t mcuxClGlikey_GlikeyStatus_t;
111
112/**********************************************
113 * FUNCTIONS
114 **********************************************/
121
122
136 mcuxClGlikey_BaseAddress_t * base,
137 mcuxClGlikey_GlikeyStatus_t * result
138 );
155 mcuxClGlikey_BaseAddress_t * base
156 );
157
172 mcuxClGlikey_BaseAddress_t * base,
173 mcuxClGlikey_IntEnable_t value
174 );
175
189 mcuxClGlikey_BaseAddress_t * base,
190 mcuxClGlikey_IntEnable_t * value
191 );
192
204 mcuxClGlikey_BaseAddress_t * base
205 );
206
218 mcuxClGlikey_BaseAddress_t * base
219 );
220
232 mcuxClGlikey_BaseAddress_t * base
233 );
234
247 mcuxClGlikey_BaseAddress_t * base
248 );
249
263 mcuxClGlikey_BaseAddress_t * base,
264 uint32_t index
265 );
266
288 mcuxClGlikey_BaseAddress_t * base,
289 uint32_t index
290 );
291
312/* [Design]
313 - Check if Glikey is locked
314 if ( GLIKEY_LOCKED == GLIKEY_GET_SFR_LOCK(base) ) return MCUXCLGLIKEY_STATUS_LOCKED_ERROR
315 - Decode the codeword and write to Glikey CTRL[]
316 EnableSelect = (XX - 0xF)%2
317 EnableValue = (XXYZUUVW >> (EnableSelect << 4))&3
318 Write GLIKEY_CTRL(base, EnableSelect, EnableValue)
319 - Return MCUXCLGLIKEY_STATUS_OK
320*/
323 mcuxClGlikey_BaseAddress_t * base,
324 uint32_t codeword
325 );
326
344 mcuxClGlikey_BaseAddress_t * base
345 );
346
364 mcuxClGlikey_BaseAddress_t * base,
365 uint32_t index
366 );
367
368
369
389 mcuxClGlikey_BaseAddress_t * base
390 );
391
392
396
397#ifdef __cplusplus
398} /* extern "C" */
399#endif
400
401#endif // MCUXCLGLIKEY_H_
Definition of function identifiers for the flow protection mechanism.
Provides the API for the CSSL flow protection mechanism.
mcuxClGlikey_Status_t mcuxClGlikey_ContinueEnable(mcuxClGlikey_BaseAddress_t *base, uint32_t codeword)
Continue Glikey enable.
mcuxClGlikey_Status_t mcuxClGlikey_GetIntEnable(mcuxClGlikey_BaseAddress_t *base, mcuxClGlikey_IntEnable_t *value)
Get interrupt enable flag of Glikey.
mcuxClGlikey_Status_t mcuxClGlikey_StartEnable(mcuxClGlikey_BaseAddress_t *base, uint32_t index)
Start Glikey enable.
mcuxClGlikey_Status_t mcuxClGlikey_SetIntStatus(mcuxClGlikey_BaseAddress_t *base)
Set the interrupt status flag of Glikey.
mcuxClGlikey_Status_t mcuxClGlikey_IsLocked(mcuxClGlikey_BaseAddress_t *base)
Check if Glikey is locked.
mcuxClGlikey_Status_t mcuxClGlikey_ResetIndex(mcuxClGlikey_BaseAddress_t *base, uint32_t index)
Reset Glikey index.
mcuxClGlikey_Status_t mcuxClGlikey_IsIndexLocked(mcuxClGlikey_BaseAddress_t *base, uint32_t index)
Check if Glikey index is locked.
mcuxClGlikey_Status_t mcuxClGlikey_Lock(mcuxClGlikey_BaseAddress_t *base)
Lock Glikey SFR interface.
mcuxClGlikey_Status_t mcuxClGlikey_GetStatus(mcuxClGlikey_BaseAddress_t *base, mcuxClGlikey_GlikeyStatus_t *result)
Retrieves the current status of Glikey.
mcuxClGlikey_Status_t mcuxClGlikey_LockIndex(mcuxClGlikey_BaseAddress_t *base)
Lock Glikey index.
mcuxClGlikey_Status_t mcuxClGlikey_SyncReset(mcuxClGlikey_BaseAddress_t *base)
Perform a synchronous reset of Glikey.
mcuxClGlikey_Status_t mcuxClGlikey_SetIntEnable(mcuxClGlikey_BaseAddress_t *base, mcuxClGlikey_IntEnable_t value)
Set interrupt enable flag of Glikey.
mcuxClGlikey_Status_t mcuxClGlikey_EndOperation(mcuxClGlikey_BaseAddress_t *base)
End Glikey operation TODO: if we are in locked state we cannot exit(move to init) as curent index is ...
mcuxClGlikey_Status_t mcuxClGlikey_ClearIntStatus(mcuxClGlikey_BaseAddress_t *base)
Clear the interrupt status flag of Glikey.
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition mcuxCsslFlowProtection.h:166
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:138