/*!
 * @file        bmp561_hmac.h
 *
 * @brief       This file contains all the functions prototypes for the HMAC firmware library
 *
 * @version     V1.0.0
 *
 * @date        2025-01-01
 *
 * @attention
 *
 *  Copyright (C) 2025 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful 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 SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */

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

/* Includes */
#include "bmp561.h"

#ifdef __cplusplus
  extern "C" {
#endif

/** @addtogroup Peripherals_Library Standard Peripheral Library
  @{
*/

/** @addtogroup HMAC_Driver HMAC Driver
  @{
*/

/** @addtogroup HMAC_Enumerations Enumerations
  @{
*/

/**
 * @brief   HMAC work mode
 */
typedef enum
{
    HMAC_WK_MODE_NORMAL  = 0x00,    /*!< Normal mode */
    HMAC_WK_MODE_SPECIAL = 0x01     /*!< Special mode */
} HMAC_WK_MODE_T;

/**
 * @brief   HMAC operation mode
 */
typedef enum
{
    HMAC_OP_MODE_HMAC = 0x00,    /*!< HMAC-SHA256 */
    HMAC_OP_MODE_SHA  = 0x01     /*!< 512bit input SHA-256 */
} HMAC_OP_MODE_T;

/**
 * @brief   HMAC flag
 */
typedef enum
{
    HMAC_FLAG_INTF = 0x01,    /*!< Operate completed interrupt flag */
    HMAC_FLAG_DONE = 0x02     /*!< Operate done flag */
} HMAC_FLAG_T;

/**@} end of group HMAC_Enumerations */

/** @addtogroup HMAC_Functions Functions
  @{
*/

/* HMAC common configuration */
void HMAC_Reset(void);
void HMAC_ConfigWorkMode(HMAC_WK_MODE_T mode);
void HMAC_ConfigOperationMode(HMAC_OP_MODE_T mode);
void HMAC_ConfigMessageLength(uint16_t length);
void HMAC_Enable(void);
void HMAC_Disable(void);
void HMAC_StartCalc(void);
void HMAC_WriteKey(uint8_t* pKey);
void HMAC_WriteMessage(uint8_t* pMsg);
void HMAC_UpdateInitVal(uint8_t* pRes);
void HMAC_GetCalcResult(uint8_t* pRes);

/** HMAC interrupt configuration */
void HMAC_EnableInterrupt(void);
void HMAC_DisableInterrupt(void);
uint8_t HMAC_ReadFlag(HMAC_FLAG_T flag);
void HMAC_ClearFlag(void);

/* HMAC calculation */
void HMAC_CalcHMAC(uint8_t* pKey, uint8_t* pData, uint8_t dataLen, uint8_t* result);
void HMAC_CalcSHA256(uint8_t* pData, uint16_t dataLen, uint8_t* result);

/**@} end of group HMAC_Functions*/
/**@} end of group HMAC_Driver*/
/**@} end of group Peripherals_Library*/

#ifdef __cplusplus
}
#endif

#endif /* __BMP561_HMAC_H */
