SDL API Guide for J7200
sdl_mcrc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2021
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
71 #ifndef SDL_MCRC_H_
72 #define SDL_MCRC_H_
73 
74 /* ========================================================================== */
75 /* Include Files */
76 /* ========================================================================== */
77 #include <src/sdl/mcrc/sdl_mcrc_hw.h>
78 
79 #if defined (SOC_J721E)
80 #include <include/soc/j721e/sdlr_soc_baseaddress.h>
81 #endif /* SOC_J721E */
82 
83 #ifdef _cplusplus
84 extern "C" {
85 #endif
86 
107 /* ========================================================================== */
108 /* Macros & Typedefs */
109 /* ========================================================================== */
110 
120 #define SDL_MCRC_CHANNEL_IRQSTATUS_RAW_MAIN_ALL \
121  (uint32_t) ((uint32_t)SDL_MCRC_INTS_CH1_CCITENS_MASK | \
122  (uint32_t)SDL_MCRC_INTR_CH1_FAILENR_MASK | \
123  (uint32_t)SDL_MCRC_INTR_CH1_OVERENR_MASK | \
124  (uint32_t)SDL_MCRC_INTR_CH1_UNDERENR_MASK | \
125  (uint32_t)SDL_MCRC_INTR_CH1_TIME_OUT_ENR_MASK)
126 
130 #define SDL_MCRC_PATTERN_COUNT_MAX (0x000FFFFFU)
131 
135 #define SDL_MCRC_SECTOR_COUNT_MAX (0x0000FFFFU)
136 
141 #define SDL_MCRC_BCTOPLD_MAX (0x00FFFFFFU)
142 
146 #define SDL_MCRC_WDTOPLD_MAX (0x00FFFFFFU)
147 
151 #define SDL_MCRC_MAX_NUM_OF_CHANNELS (4U)
152 
171 typedef uint32_t SDL_MCRC_ModeType;
172 
173 #define SDL_MCRC_OPERATION_MODE_DATA (SDL_MCRC_CTRL2_CH1_MODE_DATA)
174 
175 #define SDL_MCRC_OPERATION_MODE_AUTO (SDL_MCRC_CTRL2_CH1_MODE_AUTO)
176 
177 #define SDL_MCRC_OPERATION_MODE_SEMICPU (SDL_MCRC_CTRL2_CH1_MODE_SEMICPU)
178 
179 #define SDL_MCRC_OPERATION_MODE_FULLCPU (SDL_MCRC_CTRL2_CH1_MODE_FULLCPU)
180 
181 /* @} */
182 
192 typedef uint32_t SDL_MCRC_channel_t;
193 #define SDL_MCRC_CHANNEL_1 (0x1U)
194 
195 #define SDL_MCRC_CHANNEL_2 (0x2U)
196 
197 #define SDL_MCRC_CHANNEL_3 (0x3U)
198 
199 #define SDL_MCRC_CHANNEL_4 (0x4U)
200 
201 /* @} */
202 
207 typedef enum {
215 
220 typedef enum {
228 
231 /* ========================================================================== */
232 /* Structure Declarations */
233 /* ========================================================================== */
234 
244 typedef struct SDL_MCRC_Signature
245 {
246  uint32_t regL;
248  uint32_t regH;
251 
255 typedef struct SDL_MCRC_SigantureRegAddr
256 {
257  uint32_t regL;
259  uint32_t regH;
262 
266 typedef struct {
267  volatile uint32_t PCOUNT;
269  volatile uint32_t SCOUNT;
271  volatile uint32_t WDTOPLD;
273  volatile uint32_t BCTOPLD;
276 
280 typedef struct {
283  volatile uint32_t CTRL0;
285  volatile uint32_t CTRL1;
287  volatile uint32_t BUS_SEL;
290 
294 typedef struct SDL_MCRC_dataConfig
295 {
296  uint32_t *pMCRCData;
298  uint32_t size;
303 
306 /* ========================================================================== */
307 /* Function Declarations */
308 /* ========================================================================== */
336 int32_t SDL_MCRC_init(SDL_MCRC_InstType instance,
337  SDL_MCRC_channel_t channel,
338  uint32_t watchdogPreload,
339  uint32_t blockPreload);
340 
361 int32_t SDL_MCRC_verifyInit(SDL_MCRC_InstType instance,
362  SDL_MCRC_channel_t channel,
363  uint32_t watchdogPreload,
364  uint32_t blockPreload);
365 
383 int32_t SDL_MCRC_config(SDL_MCRC_InstType instance,
384  SDL_MCRC_channel_t channel,
385  uint32_t patternCount,
386  uint32_t sectorCount,
387  SDL_MCRC_ModeType mode);
388 
409  SDL_MCRC_channel_t channel,
410  uint32_t patternCount,
411  uint32_t sectorCount,
412  SDL_MCRC_ModeType mode);
413 
427  SDL_MCRC_channel_t channel);
428 
445  SDL_MCRC_channel_t channel,
446  const SDL_MCRC_Signature_t *pSeedSign);
447 
464  SDL_MCRC_channel_t channel,
465  SDL_MCRC_Signature_t *pSecSign);
480 int32_t SDL_MCRC_intrStatus(SDL_MCRC_InstType instance,
481  SDL_MCRC_channel_t channel,
482  uint32_t *pIntrStatus);
483 
497 int32_t SDL_MCRC_enableIntr(SDL_MCRC_InstType instance,
498  SDL_MCRC_channel_t channel,
499  uint32_t intrMask);
500 
514 int32_t SDL_MCRC_disableIntr(SDL_MCRC_InstType instance,
515  SDL_MCRC_channel_t channel,
516  uint32_t intrMask);
517 
531 int32_t SDL_MCRC_clearIntr(SDL_MCRC_InstType instance,
532  SDL_MCRC_channel_t channel,
533  uint32_t intrMask);
534 
556 int32_t SDL_MCRC_isBusy(SDL_MCRC_InstType instance,
557  SDL_MCRC_channel_t channel,
558  uint32_t *pBusyFlag);
559 
578  SDL_MCRC_channel_t channel,
579  uint32_t *pCurSecNum);
580 
596 int32_t SDL_MCRC_getPSASig(SDL_MCRC_InstType instance,
597  SDL_MCRC_channel_t channel,
598  SDL_MCRC_Signature_t *pPSAsig);
599 
613 int32_t SDL_MCRC_readStaticReg (SDL_MCRC_InstType instance,
614  SDL_MCRC_StaticRegs_t *pStaticRegs);
615 
633  SDL_MCRC_channel_t channel,
634  SDL_MCRC_Signature_t *pCurPSASig);
651  SDL_MCRC_SignatureRegAddr_t *pMCRCregAddr);
652 
665  SDL_MCRC_channel_t channel,
666  const SDL_MCRC_dataConfig_t *pDataConfig,
667  SDL_MCRC_Signature_t *sectSignVal);
668 
671 #ifdef _cplusplus
672 }
673 
674 #endif /*extern "C" */
675 
676 #endif
677 
int32_t SDL_MCRC_getCurPSASig(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, SDL_MCRC_Signature_t *pCurPSASig)
This API is used to get current known good signature value/ MCRC value for given channel.
int32_t SDL_MCRC_intrStatus(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t *pIntrStatus)
This API is used to get the pending interrupts for given Channel.
uint32_t SDL_MCRC_channel_t
MCRC channel supported.
Definition: sdl_mcrc.h:192
volatile uint32_t WDTOPLD
Definition: sdl_mcrc.h:271
int32_t SDL_MCRC_disableIntr(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t intrMask)
This API is used to disable interrupts for given Channel.
uint32_t SDL_MCRC_ModeType
MCRC operation mode supported. MCRC can either operate in Semi-CPU, Full-CPU or Auto mode...
Definition: sdl_mcrc.h:171
int32_t SDL_MCRC_channelReset(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel)
This API is used to reset the MCRC channel.
int32_t SDL_MCRC_config(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t patternCount, uint32_t sectorCount, SDL_MCRC_ModeType mode)
This API will configure MCRC mode, pattern and sector count for given channel.
uint32_t regH
Definition: sdl_mcrc.h:248
Definition: sdl_mcrc.h:212
MCRC static registers list.
Definition: sdl_mcrc.h:280
int32_t SDL_MCRC_clearIntr(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t intrMask)
This API is used to clear interrupts for given Channel.
volatile uint32_t BUS_SEL
Definition: sdl_mcrc.h:287
int32_t SDL_MCRC_getPSASectorSig(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, SDL_MCRC_Signature_t *pSecSign)
This API is used to get sector signature Value/ MCRC value for given channel.
#define SDL_MCRC_MAX_NUM_OF_CHANNELS
Max number of channels supported in MCRC.
Definition: sdl_mcrc.h:151
volatile uint32_t PCOUNT
Definition: sdl_mcrc.h:267
int32_t SDL_MCRC_setPSASeedSig(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, const SDL_MCRC_Signature_t *pSeedSign)
This API is used to set the PSA seed value without compression for given Channel. ...
Definition: sdl_mcrc.h:225
Structure for accessing MCRC register data which are 64 bit wide.
Definition: sdl_mcrc.h:244
SDL_MCRC_dataBitSize dataBitSize
Definition: sdl_mcrc.h:300
int32_t SDL_MCRC_computeSignCPUmode(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, const SDL_MCRC_dataConfig_t *pDataConfig, SDL_MCRC_Signature_t *sectSignVal)
This API is used to compute the signature for CPU-only mode and it check if the generated MCRC signat...
SDL_MCRC_InstType
MCRC Instance supported.
Definition: sdl_mcrc.h:207
SDL_MCRC_dataBitSize
This enumerator defines the Data size for input MCRC DATA.
Definition: sdl_mcrc.h:220
volatile uint32_t BCTOPLD
Definition: sdl_mcrc.h:273
int32_t SDL_MCRC_readStaticReg(SDL_MCRC_InstType instance, SDL_MCRC_StaticRegs_t *pStaticRegs)
This API is used to read static registers of MCRC module. This API needs to be called after the initi...
int32_t SDL_MCRC_getPSASig(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, SDL_MCRC_Signature_t *pPSAsig)
This API is used to get current known good signature value/ MCRC value for given channel.
Definition: sdl_mcrc.h:208
uint32_t size
Definition: sdl_mcrc.h:298
volatile uint32_t SCOUNT
Definition: sdl_mcrc.h:269
int32_t SDL_MCRC_getPSASigRegAddr(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, SDL_MCRC_SignatureRegAddr_t *pMCRCregAddr)
This API is used to get the PSA register address for given Channel.
int32_t SDL_MCRC_verifyInit(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t watchdogPreload, uint32_t blockPreload)
Verify the MCRC watchdog and block preload value initialized for given channel.
Definition: sdl_mcrc.h:210
Structure for MCRC CPU inputs data.
Definition: sdl_mcrc.h:294
Structure for accessing MCRC registers address which are 64 bit wide.
Definition: sdl_mcrc.h:255
volatile uint32_t CTRL0
Definition: sdl_mcrc.h:283
volatile uint32_t CTRL1
Definition: sdl_mcrc.h:285
Definition: sdl_mcrc.h:223
int32_t SDL_MCRC_verifyConfig(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t patternCount, uint32_t sectorCount, SDL_MCRC_ModeType mode)
This API will verify the configure of MCRC mode, pattern and sector count for given channel...
uint32_t regH
Definition: sdl_mcrc.h:259
int32_t SDL_MCRC_enableIntr(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t intrMask)
This API is used to enable interrupts for given Channel.
uint32_t regL
Definition: sdl_mcrc.h:246
int32_t SDL_MCRC_init(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t watchdogPreload, uint32_t blockPreload)
Initialize MCRC channel and will configure watchdog and block preload value for given channel...
int32_t SDL_MCRC_isBusy(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t *pBusyFlag)
This API is used to check if MCRC is busy for given Channel.
MCRC channel static registers list.
Definition: sdl_mcrc.h:266
Definition: sdl_mcrc.h:221
int32_t SDL_MCRC_getCurSecNum(SDL_MCRC_InstType instance, SDL_MCRC_channel_t channel, uint32_t *pCurSecNum)
This API is used to get the current sector number of which the signature verification fails in AUTO m...
uint32_t regL
Definition: sdl_mcrc.h:257
uint32_t * pMCRCData
Definition: sdl_mcrc.h:296