/*!
* @file     Crypto_Rng.h
*
* @version  1.0.0
*
* @brief    This file contains all the functions prototypes for the Random Number Generator(RNG) firmware library.
 *           
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_15-Nov-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the Geehy Semiconductor Software License Agreement for the governing permissions
* and limitations under the License.
*/

/* Define to prevent recursive inclusion */
#ifndef CRYPTO_RNG_H
#define CRYPTO_RNG_H

#ifdef __cplusplus
  extern "C" {
#endif

/* Includes */
 
#include "StdRegMacros.h"
#include "Crypto_Cse.h"
#include "Crypto_Common.h"
/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup CRYPTO_Driver
  * @brief CRYPTO driver modules
  @{
*/

/** @defgroup CRYPTO_Macros
  @{
*/
/*******************************************************************************
                    VENDOR ID & AUTOSAR VERSION INFO
*******************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define CRYPTO_RNG_H_VENDOR_ID                         0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_RNG_H_AR_RELEASE_MAJOR_VERSION          0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_RNG_H_AR_RELEASE_MINOR_VERSION          0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_RNG_H_AR_RELEASE_REVISION_VERSION       0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_RNG_H_SW_MAJOR_VERSION                  0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_RNG_H_SW_MINOR_VERSION                  0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_RNG_H_SW_PATCH_VERSION                  0x00U
/**@} end of group CRYPTO_Macros */
/*******************************************************************************
                                ENUMS
*******************************************************************************/
/** @defgroup CRYPTO_Enumerations
  @{
*/
/**
 * @brief RNG flags definition
 */
typedef enum
{
    RNG_FLAG_DATARDY    = (uint8_t)BIT0, //!< Data ready flag 
    RNG_FLAG_FSCSTS     = (uint8_t)BIT2  //!< Faulty sequence flag 
}Crypto_Rng_FlagType;

/**
 * @brief RNG interrupts definition
 */
 typedef enum
{
    RNG_INT_FLAG_FSINT  = (uint8_t)BIT6  //!< Faulty Sequence Interrupt 
}Crypto_Rng_IntFlagType;
/**@} end of group CRYPTO_Enumerations */
/*******************************************************************************
                            FUNCTION DECLARATIONS
*******************************************************************************/
/** @defgroup CRYPTO_Fuctions
  @{
*/
/** RNG Reset and Configuration */
FUNC(void, CRYPTO_CODE) Crypto_Rng_Reset(void);
FUNC(void, CRYPTO_CODE) Crypto_Rng_Enable(void);
FUNC(void, CRYPTO_CODE) Crypto_Rng_Disable(void);

/** Get 32 bit Random number */
FUNC(uint32, CRYPTO_CODE) Crypto_Rng_ReadRandomNumber(void);

/** Interrupts and flags */
FUNC(void, CRYPTO_CODE) Crypto_Rng_EnableInterrupt(void);
FUNC(void, CRYPTO_CODE) Crypto_Rng_DisableInterrupt(void);
FUNC(uint8, CRYPTO_CODE) Crypto_Rng_ReadStatusFlag(VAR(Crypto_Rng_FlagType, AUTOMATIC) flag);
FUNC(Crypto_Cse_ErrorCodeType, CRYPTO_CODE) Crypto_Rng_WaitReady(VAR(uint32, AUTOMATIC) timeout);
FUNC(uint8, CRYPTO_CODE) Crypto_Rng_ReadIntFlag(VAR(Crypto_Rng_IntFlagType, AUTOMATIC) flag);
FUNC(void, CRYPTO_CODE) Crypto_Rng_Init(void);
FUNC(void, CRYPTO_CODE) Crypto_Rng_ClearIntFlag(VAR(uint8, AUTOMATIC) flag);
FUNC(Crypto_Cse_ErrorCodeType, CRYPTO_CODE) Crypto_Rng_RandomGenerate(VAR(uint32, AUTOMATIC) size,P2VAR(uint8, AUTOMATIC, CRYPTO_APPL_DATA) srcPtr);
/**@} end of group CRYPTO_Fuctions */

#ifdef __cplusplus
}
#endif
#endif 
/**@} end of group CRYPTO_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
