AM273x MCU+ SDK  09.02.00
mcrc/v0/sdl_mcrc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2022-2024
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  */
63 #ifndef SDL_MCRC_H_
64 #define SDL_MCRC_H_
65 
66 /* ========================================================================== */
67 /* Include Files */
68 /* ========================================================================== */
69 #include "sdl_mcrc_hw.h"
70 #include <sdl/include/sdlr.h>
71 #include <sdl/mcrc/v0/soc/sdl_mcrc_soc.h>
72 
73 #ifdef _cplusplus
74 extern "C" {
75 #endif
76 
77 /* ========================================================================== */
78 /* Macros & Typedefs */
79 /* ========================================================================== */
80 
84 #define SDL_MCRC_CHANNEL_IRQSTATUS_RAW_MAIN_ALL \
85  (uint32_t) ((uint32_t)SDL_MCRC_INTS_CH1_CCITENS_MASK | \
86  (uint32_t)SDL_MCRC_INTR_CH1_FAILENR_MASK | \
87  (uint32_t)SDL_MCRC_INTR_CH1_OVERENR_MASK | \
88  (uint32_t)SDL_MCRC_INTR_CH1_UNDERENR_MASK | \
89  (uint32_t)SDL_MCRC_INTR_CH1_TIME_OUT_ENR_MASK)
90 
94 #define SDL_MCRC_PATTERN_COUNT_MAX (0x000FFFFFU)
95 
99 #define SDL_MCRC_SECTOR_COUNT_MAX (0x0000FFFFU)
100 
105 #define SDL_MCRC_BCTOPLD_MAX (0x00FFFFFFU)
106 
110 #define SDL_MCRC_WDTOPLD_MAX (0x00FFFFFFU)
111 
116 #define SDL_MCRC_TYPE_16BIT (0x4CU)
117 
118 #define SDL_MCRC_TYPE_32BIT (0x54U)
119 
120 #define SDL_MCRC_TYPE_64BIT (0x44U)
121 
122 #define SDL_MCRC_DATAWIDTH_SEL_64BIT (0x00U)
123 
124 #define SDL_MCRC_DATAWIDTH_SEL_16BIT (0x01U)
125 
126 #define SDL_MCRC_DATAWIDTH_SEL_32BIT (0x02U)
127 
131 #define SDL_MCRC_MAX_NUM_OF_CHANNELS (4U)
132 
143 typedef uint32_t SDL_MCRC_ModeType;
144 
145 #define SDL_MCRC_OPERATION_MODE_DATA (SDL_MCRC_CTRL2_CH1_MODE_DATA)
146 
147 #define SDL_MCRC_OPERATION_MODE_AUTO (SDL_MCRC_CTRL2_CH1_MODE_AUTO)
148 
149 #define SDL_MCRC_OPERATION_MODE_SEMICPU (SDL_MCRC_CTRL2_CH1_MODE_SEMICPU)
150 
151 #define SDL_MCRC_OPERATION_MODE_FULLCPU (SDL_MCRC_CTRL2_CH1_MODE_FULLCPU)
152 
164 typedef uint32_t SDL_MCRC_Channel_t;
165 #define SDL_MCRC_CHANNEL_1 (0x1U)
166 
167 #define SDL_MCRC_CHANNEL_2 (0x2U)
168 
169 #define SDL_MCRC_CHANNEL_3 (0x3U)
170 
171 #define SDL_MCRC_CHANNEL_4 (0x4U)
172 
179 typedef enum {
187 
188 /* ========================================================================== */
189 /* Structure Declarations */
190 /* ========================================================================== */
191 
195 typedef struct SDL_MCRC_Signature
196 {
197  uint32_t regL;
199  uint32_t regH;
202 
206 typedef struct SDL_MCRC_SigantureRegAddr
207 {
208  uint32_t regL;
210  uint32_t regH;
213 
217 typedef struct {
218  volatile uint32_t PCOUNT;
220  volatile uint32_t SCOUNT;
222  volatile uint32_t WDTOPLD;
224  volatile uint32_t BCTOPLD;
227 
231 typedef struct {
234  volatile uint32_t CTRL0;
236  volatile uint32_t CTRL1;
238  volatile uint32_t BUS_SEL;
241 
245 typedef struct SDL_MCRC_DataConfig
246 {
247  uint32_t *pMCRCData;
249  uint32_t size;
254 
255 /* ========================================================================== */
256 /* Function Declarations */
257 /* ========================================================================== */
258 
281  SDL_MCRC_Channel_t channel,
282  uint32_t watchdogPreload,
283  uint32_t blockPreload);
284 
306  SDL_MCRC_Channel_t channel,
307  uint32_t watchdogPreload,
308  uint32_t blockPreload);
309 
328  SDL_MCRC_Channel_t channel,
329  uint32_t patternCount,
330  uint32_t sectorCount,
331  SDL_MCRC_ModeType mode);
332 
353  SDL_MCRC_Channel_t channel,
354  uint32_t patternCount,
355  uint32_t sectorCount,
356  SDL_MCRC_ModeType mode);
357 
371  SDL_MCRC_Channel_t channel);
372 
389  SDL_MCRC_Channel_t channel,
390  const SDL_MCRC_Signature_t *pSeedSign);
391 
408  SDL_MCRC_Channel_t channel,
409  SDL_MCRC_Signature_t *pSecSign);
425  SDL_MCRC_Channel_t channel,
426  uint32_t *pIntrStatus);
427 
442  SDL_MCRC_Channel_t channel,
443  uint32_t intrMask);
444 
459  SDL_MCRC_Channel_t channel,
460  uint32_t intrMask);
461 
476  SDL_MCRC_Channel_t channel,
477  uint32_t intrMask);
478 
501  SDL_MCRC_Channel_t channel,
502  uint32_t *pBusyFlag);
503 
522  SDL_MCRC_Channel_t channel,
523  uint32_t *pCurSecNum);
524 
541  SDL_MCRC_Channel_t channel,
542  SDL_MCRC_Signature_t *pPSAsig);
543 
558  SDL_MCRC_StaticRegs_t *pStaticRegs);
559 
577  SDL_MCRC_Channel_t channel,
578  SDL_MCRC_Signature_t *pCurPSASig);
595  SDL_MCRC_SignatureRegAddr_t *pMCRCregAddr);
596 
609  SDL_MCRC_Channel_t channel,
610  const SDL_MCRC_DataConfig_t *pDataConfig,
611  SDL_MCRC_Signature_t *sectSignVal);
628  SDL_MCRC_Channel_t channel,
629  SDL_MCRC_SignatureRegAddr_t *pMCRCregAddr);
641  SDL_MCRC_Channel_t channel);
642 
659  SDL_MCRC_Channel_t channel, uint32_t datawidth);
660 
661 #ifdef _cplusplus
662 }
663 
664 #endif /*extern "C" */
665 
666 #endif
667 
SDL_MCRC_SignatureRegAddr_t::regL
uint32_t regL
Definition: mcrc/v0/sdl_mcrc.h:208
SDL_MCRC_StaticRegs_t::CTRL1
volatile uint32_t CTRL1
Definition: mcrc/v0/sdl_mcrc.h:236
SDL_MCRC_channelReset
int32_t SDL_MCRC_channelReset(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel)
This API is used to reset the MCRC channel.
SDL_MCRC_config
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.
SDL_MCRC_StaticRegs_t::CTRL0
volatile uint32_t CTRL0
Definition: mcrc/v0/sdl_mcrc.h:234
SDL_MCRC_enableIntr
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.
SDL_MCRC_StaticRegs_t::BUS_SEL
volatile uint32_t BUS_SEL
Definition: mcrc/v0/sdl_mcrc.h:238
SDL_MCRC_isBusy
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.
SDL_MCRC_getPSASigRegAddr
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.
SDL_MCRC_Channel_t
uint32_t SDL_MCRC_Channel_t
MCRC channel supported.
Definition: mcrc/v0/sdl_mcrc.h:164
SDL_MCRC_getPSASectorSig
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.
SDL_MCRC_InstType
SDL_MCRC_InstType
MCRC Instance supported.
Definition: sdl_mcrc_soc.h:60
SDL_MCRC_StaticRegs_t
MCRC static registers list.
Definition: mcrc/v0/sdl_mcrc.h:231
SDL_MCRC_DataBitSize
SDL_MCRC_DataBitSize
This enumerator defines the Data size for input MCRC DATA.
Definition: mcrc/v0/sdl_mcrc.h:179
SDL_MCRC_MAX_NUM_OF_CHANNELS
#define SDL_MCRC_MAX_NUM_OF_CHANNELS
Max number of channels supported in MCRC.
Definition: mcrc/v0/sdl_mcrc.h:131
SDL_MCRC_DATA_32_BIT
@ SDL_MCRC_DATA_32_BIT
Definition: mcrc/v0/sdl_mcrc.h:184
SDL_MCRC_DATA_8_BIT
@ SDL_MCRC_DATA_8_BIT
Definition: mcrc/v0/sdl_mcrc.h:180
SDL_MCRC_SignatureRegAddr_t::regH
uint32_t regH
Definition: mcrc/v0/sdl_mcrc.h:210
SDL_MCRC_clearIntr
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.
SDL_MCRC_getCRCRegAddr
int32_t SDL_MCRC_getCRCRegAddr(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel, SDL_MCRC_SignatureRegAddr_t *pMCRCregAddr)
This API is used to get the MCRC register address for given Channel.
SDL_MCRC_getIntrStatus
int32_t SDL_MCRC_getIntrStatus(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel, uint32_t *pIntrStatus)
This API is used to get the pending interrupts for given Channel.
SDL_MCRC_ChannelStaticRegs
MCRC channel static registers list.
Definition: mcrc/v0/sdl_mcrc.h:217
SDL_MCRC_init
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.
SDL_MCRC_Signature_t::regH
uint32_t regH
Definition: mcrc/v0/sdl_mcrc.h:199
SDL_MCRC_ChannelStaticRegs::WDTOPLD
volatile uint32_t WDTOPLD
Definition: mcrc/v0/sdl_mcrc.h:222
SDL_MCRC_ChannelStaticRegs::SCOUNT
volatile uint32_t SCOUNT
Definition: mcrc/v0/sdl_mcrc.h:220
SDL_MCRC_getCurPSASig
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.
SDL_MCRC_DataConfig_t
Structure for MCRC CPU inputs data.
Definition: mcrc/v0/sdl_mcrc.h:246
SDL_MCRC_DataConfig_t::dataBitSize
SDL_MCRC_DataBitSize dataBitSize
Definition: mcrc/v0/sdl_mcrc.h:251
SDL_MCRC_DataConfig_t::size
uint32_t size
Definition: mcrc/v0/sdl_mcrc.h:249
SDL_MCRC_setPSASeedSig
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.
SDL_MCRC_ModeType
uint32_t SDL_MCRC_ModeType
MCRC operation mode supported. MCRC can either operate in Semi-CPU, Full-CPU or Auto mode.
Definition: mcrc/v0/sdl_mcrc.h:143
SDL_MCRC_getCurSecNum
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...
SDL_MCRC_ChannelStaticRegs::BCTOPLD
volatile uint32_t BCTOPLD
Definition: mcrc/v0/sdl_mcrc.h:224
SDL_MCRC_verifyInit
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.
SDL_MCRC_disableIntr
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.
SDL_MCRC_ChannelStaticRegs::PCOUNT
volatile uint32_t PCOUNT
Definition: mcrc/v0/sdl_mcrc.h:218
SDL_MCRC_computeSignCPUmode
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_DataConfig_t::pMCRCData
uint32_t * pMCRCData
Definition: mcrc/v0/sdl_mcrc.h:247
SDL_MCRC_Signature_t
Structure for accessing MCRC register data which are 64 bit wide.
Definition: mcrc/v0/sdl_mcrc.h:196
SDL_MCRC_readStaticReg
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...
SDL_MCRC_SignatureRegAddr_t
Structure for accessing MCRC registers address which are 64 bit wide.
Definition: mcrc/v0/sdl_mcrc.h:207
SDL_MCRC_DATA_16_BIT
@ SDL_MCRC_DATA_16_BIT
Definition: mcrc/v0/sdl_mcrc.h:182
SDL_MCRC_configCRCType
int32_t SDL_MCRC_configCRCType(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel)
This API is used to configure the MCRC type for given Channel.
SDL_MCRC_getPSASig
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.
SDL_MCRC_verifyConfig
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.
SDL_MCRC_configDataWidth
int32_t SDL_MCRC_configDataWidth(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel, uint32_t datawidth)
This API is used to configure the MCRC data width for given Channel.
SDL_MCRC_Signature_t::regL
uint32_t regL
Definition: mcrc/v0/sdl_mcrc.h:197