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_DMA,
79 APP_AES_TYPE_MAX
80 } app_aes_type_t;
81
85 typedef enum
86 {
87 APP_AES_MODE_ECB,
88 APP_AES_MODE_CBC,
89 APP_AES_MODE_MAX
90 } app_aes_mode_t;
91
95 typedef enum
96 {
97 APP_AES_EVT_ERROR,
98 APP_AES_EVT_DONE
99 } app_aes_evt_type_t;
110 typedef struct
111 {
112 app_aes_type_t use_type;
113 app_aes_mode_t use_mode;
114 aes_init_t init;
115 } app_aes_params_t;
116
120 typedef struct
121 {
122 app_aes_evt_type_t type;
123 uint32_t error_code;
124 } app_aes_evt_t;
125
129 typedef void (*app_aes_evt_handler_t)(app_aes_evt_t *p_evt);
130
133 /* Exported functions --------------------------------------------------------*/
152 uint16_t app_aes_init(app_aes_params_t *p_params, app_aes_evt_handler_t evt_handler);
153
161 uint16_t app_aes_deinit(void);
162
175 uint16_t app_aes_encrypt_sync(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data, uint32_t timeout);
176
189 uint16_t app_aes_decrypt_sync(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data, uint32_t timeout);
190
202 uint16_t app_aes_encrypt_async(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data);
203
215 uint16_t app_aes_decrypt_async(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data);
216
224 aes_handle_t *app_aes_get_handle(void);
225
226 #ifdef ENV_RTOS_USE_SEMP
227
238 uint16_t app_aes_decrypt_sem_sync(uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data);
239
251 uint16_t app_aes_encrypt_sem_sync(uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data);
252 #endif
253
256 #endif
257
258 #ifdef __cplusplus
259 }
260 #endif
261
262 #endif
263
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:86
app_aes_params_t
AES parameters structure definition.
Definition: app_aes.h:111
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:121
APP_AES_EVT_DONE
@ APP_AES_EVT_DONE
Definition: app_aes.h:98
APP_AES_TYPE_MAX
@ APP_AES_TYPE_MAX
Definition: app_aes.h:79
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:129
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:114
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:89
app_aes_evt_t::type
app_aes_evt_type_t type
Definition: app_aes.h:122
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:96
app_aes_params_t::use_type
app_aes_type_t use_type
Definition: app_aes.h:112
_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_TYPE_DMA
@ APP_AES_TYPE_DMA
Definition: app_aes.h:78
APP_AES_MODE_CBC
@ APP_AES_MODE_CBC
Definition: app_aes.h:88
APP_AES_MODE_ECB
@ APP_AES_MODE_ECB
Definition: app_aes.h:87
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:113
APP_AES_EVT_ERROR
@ APP_AES_EVT_ERROR
Definition: app_aes.h:97
app_aes_evt_t::error_code
uint32_t error_code
Definition: app_aes.h:123