/*!
* @file     Crypto_Sha256.h
*
* @version  1.0.0
*
* @brief    This file provides all the HASH firmware functions
 *           
* @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_SHA256_H
#define CRYPTO_SHA256_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_SHA256_H_VENDOR_ID                         0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_SHA256_H_AR_RELEASE_MAJOR_VERSION          0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_SHA256_H_AR_RELEASE_MINOR_VERSION          0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_SHA256_H_AR_RELEASE_REVISION_VERSION       0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_SHA256_H_SW_MAJOR_VERSION                  0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_SHA256_H_SW_MINOR_VERSION                  0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_SHA256_H_SW_PATCH_VERSION                  0x00U
/**@} end of group CRYPTO_Macros */
/*******************************************************************************
                                ENUMS
*******************************************************************************/
/** @defgroup CRYPTO_Enumerations
  @{
*/
/**
 * @brief SHA256 INI MODE Selection
 */
typedef enum
{
    SHA256_INIMODE_INIT=0,       //!< Select init mode
    SHA256_INIMODE_NONINIT       //!< Select non init mode
} Crypto_Sha256_IniModeType;

/**
 * @brief SHA256 PAD MODE Selection
 */
typedef enum
{
    SHA256_PADMODE_PAD=0,     //!< PAD mode 
    SHA256_PADMODE_NONPAD     //!< NONE-PAD mode 
} Crypto_Sha256_PadModeType;

/**
 * @brief SHA256 flag
 */
typedef enum
{
    SHA256_FLAG_OP_DONE    = BIT0,  //!< OP DONE flag 
    SHA256_FLAG_BUSY       = BIT1,  //!< Busy flag 
    SHA256_FLAG_INTR       = BIT2   //!< Calculation Completion Interrupt flag 
} Crypto_Sha256_FlagType;

/**
 * @brief SHA256 PAD & INIT mode
 */
typedef enum {
    MODE_PAD_INIT,
    MODE_PAD_NO_INIT,
    MODE_NO_PAD_INIT,
    MODE_NO_PAD_NO_INIT
} Crypto_Sha256_ModeType;
/**@} end of group CRYPTO_Enumerations */
/*******************************************************************************
                            STRUCTURES AND TYPEDEFS
*******************************************************************************/
/** @defgroup CRYPTO_Structure
  @{
*/
/**
 * @brief SHA256 message digest result structure
 */
typedef struct
{
    uint32_t Data[8];     //!< Message digest result 
} Crypto_Sha256_MessageDigestType;

/**@} end of group CRYPTO_Structure */
/*******************************************************************************
                            FUNCTION DECLARATIONS
*******************************************************************************/
/** @defgroup CRYPTO_Fuctions
  @{
*/
/** SHA256 Reset */
FUNC(void, CRYPTO_CODE) Crypto_Sha256_Reset(void);
/** Message Digest start */
FUNC(void, CRYPTO_CODE) Crypto_Sha256_CfgLastWordValidBitsNbr(VAR(uint64, AUTOMATIC) validNumber);
FUNC(void, CRYPTO_CODE) Crypto_Sha256_WritesInputData(VAR(uint32, AUTOMATIC) data);
FUNC(void, CRYPTO_CODE) Crypto_Sha256_ReadDigest(P2VAR( uint8, AUTOMATIC, CRYPTO_APPL_DATA ) outBuffer);
FUNC(void, CRYPTO_CODE) Crypto_Sha256_StartDigest(void);
/** Injected channels Configuration */
FUNC(void, CRYPTO_CODE) Crypto_Sha256_EnableInterrupt(void);
FUNC(void, CRYPTO_CODE) Crypto_Sha256_DisableInterrupt(void);
FUNC(uint8, CRYPTO_CODE) Crypto_Sha256_ReadFlagStatus(VAR(Crypto_Sha256_FlagType, AUTOMATIC) flag);
FUNC(void, CRYPTO_CODE) Crypto_Sha256_ClearStatusFlag(void);
/** Waits for processing data */
FUNC(uint8, CRYPTO_CODE) Crypto_Sha256_WaitForCompute(VAR(uint32, AUTOMATIC) timeOut);
FUNC(boolean, CRYPTO_CODE) Crypto_Sha256_IsBusy(void);

/**@} end of group CRYPTO_Fuctions */

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

