#ifndef CRYPTO_H_INCLUDED
#define CRYPTO_H_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

#define CRYPTO_CONFIG_DECODE_S              0
#define CRYPTO_CONFIG_ENCODE_M              (0 << CRYPTO_CONFIG_DECODE_S)
#define CRYPTO_CONFIG_DECODE_M              (1 << CRYPTO_CONFIG_DECODE_S)
#define CRYPTO_CONFIG_CORE_SEL_S            1
#define CRYPTO_CONFIG_CORE_SEL_M            (0X3 << CRYPTO_CONFIG_CORE_SEL_S)
#define CRYPTO_CONFIG_CORE_SEL_KUZNECHIK_M  (0X0 << CRYPTO_CONFIG_CORE_SEL_S)
#define CRYPTO_CONFIG_CORE_SEL_MAGMA_M      (0X1 << CRYPTO_CONFIG_CORE_SEL_S)
#define CRYPTO_CONFIG_CORE_SEL_AES_M        (0X2 << CRYPTO_CONFIG_CORE_SEL_S)
#define CRYPTO_CONFIG_MODE_SEL_S            3
#define CRYPTO_CONFIG_MODE_SEL_M            (0X3 << CRYPTO_CONFIG_MODE_SEL_S)
#define CRYPTO_CONFIG_MODE_SEL_ECB_M        (0X0 << CRYPTO_CONFIG_MODE_SEL_S)
#define CRYPTO_CONFIG_MODE_SEL_CBC_M        (0X1 << CRYPTO_CONFIG_MODE_SEL_S)
#define CRYPTO_CONFIG_MODE_SEL_CTR_M        (0X2 << CRYPTO_CONFIG_MODE_SEL_S)
#define CRYPTO_CONFIG_SWAP_MODE_S           5
#define CRYPTO_CONFIG_SWAP_MODE_M           (0X3 << CRYPTO_CONFIG_SWAP_MODE_S)
#define CRYPTO_CONFIG_SWAP_MODE_NONE_M      (0X0 << CRYPTO_CONFIG_SWAP_MODE_S)
#define CRYPTO_CONFIG_SWAP_MODE_HALF_WORD_M (0X1 << CRYPTO_CONFIG_SWAP_MODE_S)
#define CRYPTO_CONFIG_SWAP_MODE_BYTE_M      (0X2 << CRYPTO_CONFIG_SWAP_MODE_S)
#define CRYPTO_CONFIG_SWAP_MODE_BIT_M       (0X3 << CRYPTO_CONFIG_SWAP_MODE_S)
#define CRYPTO_CONFIG_ORDER_MODE_S          7
#define CRYPTO_CONFIG_ORDER_MODE_M          (1 << CRYPTO_CONFIG_ORDER_MODE_S)
#define CRYPTO_CONFIG_ORDER_MODE_LSW_M      (0 << CRYPTO_CONFIG_ORDER_MODE_S)
#define CRYPTO_CONFIG_ORDER_MODE_MSW_M      (1 << CRYPTO_CONFIG_ORDER_MODE_S)
#define CRYPTO_CONFIG_C_RESET_S             8
#define CRYPTO_CONFIG_C_RESET_M             (1 << CRYPTO_CONFIG_C_RESET_S)
#define CRYPTO_CONFIG_READY_S               9
#define CRYPTO_CONFIG_READY_M               (1 << CRYPTO_CONFIG_READY_S)
#define CRYPTO_CONFIG_WRITE_STATUS_S        10
#define CRYPTO_CONFIG_WRITE_STATUS_M        (1 << CRYPTO_CONFIG_WRITE_STATUS_S)
#define CRYPTO_CONFIG_READ_STATUS_S         11
#define CRYPTO_CONFIG_READ_STATUS_M         (1 << CRYPTO_CONFIG_READ_STATUS_S)


#ifndef _ASSEMBLER_
    #include <inttypes.h>

    typedef struct
    {
        volatile uint32_t BLOCK;               
        volatile uint32_t KEY;       
        volatile uint32_t INIT;       
        volatile uint32_t CONFIG;       
    } CRYPTO_TypeDef;
#endif

#ifdef __cplusplus
}
#endif

#endif // CRYPTO_H_INCLUDED