AM64x MCU+ SDK  11.00.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  */
64 #ifndef SDL_MCRC_H_
65 #define SDL_MCRC_H_
66 
67 /* ========================================================================== */
68 /* Include Files */
69 /* ========================================================================== */
70 #include "sdl_mcrc_hw.h"
71 #include <sdl/include/sdlr.h>
72 #include <sdl/mcrc/v0/soc/sdl_mcrc_soc.h>
73 
74 #ifdef _cplusplus
75 extern "C" {
76 #endif
77 
78 /* ========================================================================== */
79 /* Macros & Typedefs */
80 /* ========================================================================== */
81 
85 #define SDL_MCRC_CHANNEL_IRQSTATUS_RAW_MAIN_ALL \
86  (uint32_t) ((uint32_t)SDL_MCRC_INTS_CH1_CCITENS_MASK | \
87  (uint32_t)SDL_MCRC_INTR_CH1_FAILENR_MASK | \
88  (uint32_t)SDL_MCRC_INTR_CH1_OVERENR_MASK | \
89  (uint32_t)SDL_MCRC_INTR_CH1_UNDERENR_MASK | \
90  (uint32_t)SDL_MCRC_INTR_CH1_TIME_OUT_ENR_MASK)
91 
95 #define SDL_MCRC_PATTERN_COUNT_MAX (0x000FFFFFU)
96 
100 #define SDL_MCRC_SECTOR_COUNT_MAX (0x0000FFFFU)
101 
106 #define SDL_MCRC_BCTOPLD_MAX (0x00FFFFFFU)
107 
111 #define SDL_MCRC_WDTOPLD_MAX (0x00FFFFFFU)
112 
116 #define SDL_MCRC_DATAWIDTH_SEL_64BIT (0x00000000U)
117 
118 #define SDL_MCRC_DATAWIDTH_SEL_16BIT (0x00000001U)
119 
120 #define SDL_MCRC_DATAWIDTH_SEL_32BIT (0x00000002U)
121 
125 #define SDL_MCRC_MAX_NUM_OF_CHANNELS (4U)
126 
137 typedef uint32_t SDL_MCRC_ModeType;
138 
139 #define SDL_MCRC_OPERATION_MODE_DATA (SDL_MCRC_CTRL2_CH1_MODE_DATA)
140 
141 #define SDL_MCRC_OPERATION_MODE_AUTO (SDL_MCRC_CTRL2_CH1_MODE_AUTO)
142 
143 #define SDL_MCRC_OPERATION_MODE_SEMICPU (SDL_MCRC_CTRL2_CH1_MODE_SEMICPU)
144 
145 #define SDL_MCRC_OPERATION_MODE_FULLCPU (SDL_MCRC_CTRL2_CH1_MODE_FULLCPU)
146 
158 typedef uint32_t SDL_MCRC_Channel_t;
159 #define SDL_MCRC_CHANNEL_1 (0x1U)
160 
161 #define SDL_MCRC_CHANNEL_2 (0x2U)
162 
163 #define SDL_MCRC_CHANNEL_3 (0x3U)
164 
165 #define SDL_MCRC_CHANNEL_4 (0x4U)
166 
177 typedef uint32_t SDL_MCRC_Type_t;
178 
179 #define SDL_MCRC_TYPE_16BIT (SDL_MCRC_CTRL0_CH1_CRC_SEL_16BIT)
180 
181 #define SDL_MCRC_TYPE_32BIT (SDL_MCRC_CTRL0_CH1_CRC_SEL_32BIT)
182 
183 #define SDL_MCRC_TYPE_64BIT (SDL_MCRC_CTRL0_CH1_CRC_SEL_64BIT)
184 
185 #define SDL_MCRC_TYPE_E2EPROFILE (SDL_MCRC_CTRL0_CH1_CRC_SEL_E2EPROFILE4)
186 
187 #define SDL_MCRC_TYPE_VDA_CAN_SAEJ1850 (SDL_MCRC_CTRL0_CH1_CRC_SEL_VDA_CAN_SAEJ1850)
188 
189 #define SDL_MCRC_TYPE_H2F_AUTOSAR4 (SDL_MCRC_CTRL0_CH1_CRC_SEL_H2F_AUTOSAR4)
190 
191 #define SDL_MCRC_TYPE_CASTAGNOLI_ISCSI (SDL_MCRC_CTRL0_CH1_CRC_SEL_CASTAGNOLI_ISCSI)
192 
199 typedef enum {
206 #if defined(SOC_AM263X) || defined (SOC_AM263PX) || defined (SOC_AM261X) || defined (SOC_AM273X) || defined (SOC_AWR294X)
207  SDL_MCRC_DATA_64_BIT = 4,
209 #endif
211 
220 typedef uint32_t SDL_MCRC_DataLength_t;
221 
222 #define SDL_MCRC_DATALENGTH_16BIT (SDL_MCRC_CTRL0_CH1_DW_SEL_16BIT)
223 
224 #define SDL_MCRC_DATALENGTH_32BIT (SDL_MCRC_CTRL0_CH1_DW_SEL_32BIT)
225 
226 #define SDL_MCRC_DATALENGTH_64BIT (SDL_MCRC_CTRL0_CH1_DW_SEL_64BIT)
227 
238 typedef uint32_t SDL_MCRC_BitSwap_t;
239 
240 #define SDL_MCRC_BITSWAP_MSB (SDL_MCRC_CTRL0_CH1_BIT_SWAP_MSB)
241 
242 #define SDL_MCRC_BITSWAP_LSB (SDL_MCRC_CTRL0_CH1_BIT_SWAP_LSB)
243 
254 typedef uint32_t SDL_MCRC_ByteSwap_t;
255 
256 #define SDL_MCRC_BYTESWAP_DISABLE (SDL_MCRC_CTRL0_CH1_BTYE_SWAP_DISABLE)
257 
258 #define SDL_MCRC_BYTESWAP_ENABLE (SDL_MCRC_CTRL0_CH1_BTYE_SWAP_ENABLE)
259 
262 /* ========================================================================== */
263 /* Structure Declarations */
264 /* ========================================================================== */
265 
269 typedef struct SDL_MCRC_Config_s
270 {
282 
286 typedef struct SDL_MCRC_Signature
287 {
288  uint32_t regL;
290  uint32_t regH;
293 
297 typedef struct SDL_MCRC_SigantureRegAddr
298 {
299  uint32_t regL;
301  uint32_t regH;
304 
308 typedef struct {
309  volatile uint32_t PCOUNT;
311  volatile uint32_t SCOUNT;
313  volatile uint32_t WDTOPLD;
315  volatile uint32_t BCTOPLD;
318 
322 typedef struct {
325  volatile uint32_t CTRL0;
327  volatile uint32_t CTRL1;
329  volatile uint32_t BUS_SEL;
332 
336 typedef struct SDL_MCRC_DataConfig
337 {
338  uint32_t *pMCRCData;
340  uint32_t size;
345 
346 /* ========================================================================== */
347 /* Function Declarations */
348 /* ========================================================================== */
349 
372  SDL_MCRC_Channel_t channel,
373  uint32_t watchdogPreload,
374  uint32_t blockPreload);
375 
397  SDL_MCRC_Channel_t channel,
398  uint32_t watchdogPreload,
399  uint32_t blockPreload);
400 
419  SDL_MCRC_Channel_t channel,
420  uint32_t patternCount,
421  uint32_t sectorCount,
423 
424 #if defined(SOC_AM263X) || defined (SOC_AM263PX) || defined (SOC_AM261X) || defined (SOC_AM273X) || defined (SOC_AWR294X)
425 
440 int32_t SDL_MCRC_addConfig(SDL_MCRC_InstType instance,
441  SDL_MCRC_Channel_t channel,
442  const SDL_MCRC_Config_t *pConfig);
443 #endif
444 
465  SDL_MCRC_Channel_t channel,
466  uint32_t patternCount,
467  uint32_t sectorCount,
469 #if defined(SOC_AM263X) || defined (SOC_AM263PX) || defined (SOC_AM261X) || defined (SOC_AM273X) || defined (SOC_AWR294X)
470  ,const SDL_MCRC_Config_t *pConfig);
471 #else
472 );
473 #endif
474 
488  SDL_MCRC_Channel_t channel);
489 
506  SDL_MCRC_Channel_t channel,
507  const SDL_MCRC_Signature_t *pSeedSign);
508 
525  SDL_MCRC_Channel_t channel,
526  SDL_MCRC_Signature_t *pSecSign);
542  SDL_MCRC_Channel_t channel,
543  uint32_t *pIntrStatus);
544 
559  SDL_MCRC_Channel_t channel,
560  uint32_t intrMask);
561 
576  SDL_MCRC_Channel_t channel,
577  uint32_t intrMask);
578 
593  SDL_MCRC_Channel_t channel,
594  uint32_t intrMask);
595 
618  SDL_MCRC_Channel_t channel,
619  uint32_t *pBusyFlag);
620 
639  SDL_MCRC_Channel_t channel,
640  uint32_t *pCurSecNum);
641 
658  SDL_MCRC_Channel_t channel,
659  SDL_MCRC_Signature_t *pPSAsig);
660 
675  SDL_MCRC_StaticRegs_t *pStaticRegs);
676 
694  SDL_MCRC_Channel_t channel,
695  SDL_MCRC_Signature_t *pCurPSASig);
712  SDL_MCRC_SignatureRegAddr_t *pMCRCregAddr);
713 
726  SDL_MCRC_Channel_t channel,
727  const SDL_MCRC_DataConfig_t *pDataConfig,
728  SDL_MCRC_Signature_t *sectSignVal);
745  SDL_MCRC_Channel_t channel,
746  SDL_MCRC_SignatureRegAddr_t *pMCRCregAddr);
758  SDL_MCRC_Channel_t channel);
759 
760 #ifdef _cplusplus
761 }
762 
763 #endif /*extern "C" */
764 
765 #endif
766 
SDL_MCRC_SignatureRegAddr_t::regL
uint32_t regL
Definition: mcrc/v0/sdl_mcrc.h:299
SDL_MCRC_DataLength_t
uint32_t SDL_MCRC_DataLength_t
CRC Data Length supported.
Definition: mcrc/v0/sdl_mcrc.h:220
SDL_MCRC_StaticRegs_t::CTRL1
volatile uint32_t CTRL1
Definition: mcrc/v0/sdl_mcrc.h:327
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:325
SDL_MCRC_Config_t::dataBitSize
SDL_MCRC_DataBitSize dataBitSize
Definition: mcrc/v0/sdl_mcrc.h:275
SDL_MCRC_Config_t::type
SDL_MCRC_Type_t type
Definition: mcrc/v0/sdl_mcrc.h:271
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:329
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_BitSwap_t
uint32_t SDL_MCRC_BitSwap_t
CRC Bit Swap supported.
Definition: mcrc/v0/sdl_mcrc.h:238
SDL_MCRC_Config_t::bitSwap
SDL_MCRC_BitSwap_t bitSwap
Definition: mcrc/v0/sdl_mcrc.h:277
SDL_MCRC_Channel_t
uint32_t SDL_MCRC_Channel_t
MCRC channel supported.
Definition: mcrc/v0/sdl_mcrc.h:158
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
instance
uint8_t instance
Definition: tisci_dkek.h:1
SDL_MCRC_StaticRegs_t
MCRC static registers list.
Definition: mcrc/v0/sdl_mcrc.h:322
SDL_MCRC_DataBitSize
SDL_MCRC_DataBitSize
This enumerator defines the Data size for input MCRC DATA.
Definition: mcrc/v0/sdl_mcrc.h:199
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:125
SDL_MCRC_Config_t
CRC Configuration.
Definition: mcrc/v0/sdl_mcrc.h:270
SDL_MCRC_DATA_32_BIT
@ SDL_MCRC_DATA_32_BIT
Definition: mcrc/v0/sdl_mcrc.h:204
SDL_MCRC_DATA_8_BIT
@ SDL_MCRC_DATA_8_BIT
Definition: mcrc/v0/sdl_mcrc.h:200
SDL_MCRC_SignatureRegAddr_t::regH
uint32_t regH
Definition: mcrc/v0/sdl_mcrc.h:301
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:308
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:290
SDL_MCRC_ChannelStaticRegs::WDTOPLD
volatile uint32_t WDTOPLD
Definition: mcrc/v0/sdl_mcrc.h:313
SDL_MCRC_ChannelStaticRegs::SCOUNT
volatile uint32_t SCOUNT
Definition: mcrc/v0/sdl_mcrc.h:311
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:337
SDL_MCRC_DataConfig_t::dataBitSize
SDL_MCRC_DataBitSize dataBitSize
Definition: mcrc/v0/sdl_mcrc.h:342
SDL_MCRC_DataConfig_t::size
uint32_t size
Definition: mcrc/v0/sdl_mcrc.h:340
SDL_MCRC_Type_t
uint32_t SDL_MCRC_Type_t
CRC Type supported.
Definition: mcrc/v0/sdl_mcrc.h:177
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_Config_t::dataLen
SDL_MCRC_DataLength_t dataLen
Definition: mcrc/v0/sdl_mcrc.h:273
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:137
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:315
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.
mode
char mode[32]
Definition: tisci_pm_core.h:1
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:309
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:338
SDL_MCRC_Signature_t
Structure for accessing MCRC register data which are 64 bit wide.
Definition: mcrc/v0/sdl_mcrc.h:287
SDL_MCRC_ByteSwap_t
uint32_t SDL_MCRC_ByteSwap_t
CRC Byte Swap supported.
Definition: mcrc/v0/sdl_mcrc.h:254
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:298
SDL_MCRC_DATA_16_BIT
@ SDL_MCRC_DATA_16_BIT
Definition: mcrc/v0/sdl_mcrc.h:202
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_Config_t::byteSwap
SDL_MCRC_ByteSwap_t byteSwap
Definition: mcrc/v0/sdl_mcrc.h:279
SDL_MCRC_Signature_t::regL
uint32_t regL
Definition: mcrc/v0/sdl_mcrc.h:288