app_aes.h
Go to the documentation of this file.
1
52 #ifndef _APP_AES_H_
53 #define _APP_AES_H_
54
55 #include "gr55xx_hal.h"
56 #include "app_drv_error.h"
57 #ifdef ENV_USE_FREERTOS
58 #include "app_rtos_cfg.h"
59 #endif
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65 #ifdef HAL_AES_MODULE_ENABLED
66
74 typedef enum
75 {
76 APP_AES_TYPE_INTERRUPT,
77 APP_AES_TYPE_POLLING,
78 APP_AES_TYPE_MAX
79 } app_aes_type_t;
80
84 typedef enum
85 {
86 APP_AES_MODE_ECB,
87 APP_AES_MODE_CBC,
88 APP_AES_MODE_MAX
89 } app_aes_mode_t;
90
94 typedef enum
95 {
96 APP_AES_EVT_ERROR,
97 APP_AES_EVT_DONE
98 } app_aes_evt_type_t;
109 typedef struct
110 {
111 app_aes_type_t use_type;
112 app_aes_mode_t use_mode;
113 aes_init_t init;
114 } app_aes_params_t;
115
119 typedef struct
120 {
121 app_aes_evt_type_t type;
122 uint32_t error_code;
123 } app_aes_evt_t;
124
128 typedef void (*app_aes_evt_handler_t)(app_aes_evt_t *p_evt);
129
132 /* Exported functions --------------------------------------------------------*/
151 uint16_t app_aes_init(app_aes_params_t *p_params, app_aes_evt_handler_t evt_handler);
152
160 uint16_t app_aes_deinit(void);
161
174 uint16_t app_aes_encrypt_sync(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data, uint32_t timeout);
175
188 uint16_t app_aes_decrypt_sync(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data, uint32_t timeout);
189
201 uint16_t app_aes_encrypt_async(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data);
202
214 uint16_t app_aes_decrypt_async(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data);
215
223 aes_handle_t *app_aes_get_handle(void);
224
225 #ifdef ENV_RTOS_USE_SEMP
226
237 uint16_t app_aes_decrypt_sem_sync(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data);
238
250 uint16_t app_aes_encrypt_sem_sync(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data);
251 #endif
252
255 #endif
256
257 #ifdef __cplusplus
258 }
259 #endif
260
261 #endif
262
app_aes_type_t
app_aes_type_t
AES operating mode Enumerations definition.
Definition: app_aes.h:75
app_aes_mode_t
app_aes_mode_t
AES encryption and decryption mode Enumerations definition.
Definition: app_aes.h:85
app_aes_params_t
AES parameters structure definition.
Definition: app_aes.h:110
APP_AES_TYPE_POLLING
@ APP_AES_TYPE_POLLING
Definition: app_aes.h:77
app_aes_evt_t
AES event structure definition.
Definition: app_aes.h:120
APP_AES_EVT_DONE
@ APP_AES_EVT_DONE
Definition: app_aes.h:97
APP_AES_TYPE_MAX
@ APP_AES_TYPE_MAX
Definition: app_aes.h:78
app_aes_encrypt_sync
uint16_t app_aes_encrypt_sync(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data, uint32_t timeout)
Encrypted an amount of data in blocking mode.
_aes_init
AES Init Structure definition.
Definition: gr55xx_hal_aes.h:101
app_aes_evt_handler_t
void(* app_aes_evt_handler_t)(app_aes_evt_t *p_evt)
AES event callback definition.
Definition: app_aes.h:128
app_aes_get_handle
aes_handle_t * app_aes_get_handle(void)
Return the AES handle.
app_aes_params_t::init
aes_init_t init
Definition: app_aes.h:113
app_aes_decrypt_async
uint16_t app_aes_decrypt_async(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data)
Decrypted an amount of data in non-blocking mode.
APP_AES_TYPE_INTERRUPT
@ APP_AES_TYPE_INTERRUPT
Definition: app_aes.h:76
app_aes_decrypt_sync
uint16_t app_aes_decrypt_sync(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data, uint32_t timeout)
Decrypted an amount of data in blocking mode.
APP_AES_MODE_MAX
@ APP_AES_MODE_MAX
Definition: app_aes.h:88
app_aes_evt_t::type
app_aes_evt_type_t type
Definition: app_aes.h:121
app_aes_init
uint16_t app_aes_init(app_aes_params_t *p_params, app_aes_evt_handler_t evt_handler)
Initialize the APP AES DRIVER according to the specified parameters in the app_aes_params_t and app_a...
app_aes_deinit
uint16_t app_aes_deinit(void)
De-initialize the APP AES DRIVER peripheral.
app_aes_evt_type_t
app_aes_evt_type_t
AES event Enumerations definition.
Definition: app_aes.h:95
app_aes_params_t::use_type
app_aes_type_t use_type
Definition: app_aes.h:111
_aes_handle
AES handle Structure definition.
Definition: gr55xx_hal_aes.h:130
gr55xx_hal.h
This file contains all the functions prototypes for the HAL module driver.
APP_AES_MODE_CBC
@ APP_AES_MODE_CBC
Definition: app_aes.h:87
APP_AES_MODE_ECB
@ APP_AES_MODE_ECB
Definition: app_aes.h:86
app_aes_encrypt_async
uint16_t app_aes_encrypt_async(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data)
Encrypted an amount of data in non-blocking mode.
app_rtos_cfg.h
Header file of app rtos config code.
app_drv_error.h
Header file of app driver error code.
app_aes_params_t::use_mode
app_aes_mode_t use_mode
Definition: app_aes.h:112
APP_AES_EVT_ERROR
@ APP_AES_EVT_ERROR
Definition: app_aes.h:96
app_aes_evt_t::error_code
uint32_t error_code
Definition: app_aes.h:122