Comments (2)
aes_param_t aes_param;
aes_param.cipher_mode = AES_CBC;
aes_param.input_data = new uint8_t[AES_TEST_LENGTH];
memset(aes_param.input_data, 0x00, AES_TEST_LENGTH);
aes_param.input_data_len = AES_TEST_LENGTH;
aes_param.input_key = new uint8_t[16];
memset(aes_param.input_key, 0x00, 16);
aes_param.input_key_len = 16;
aes_param.iv = new uint8_t[16];
memset(aes_param.iv, 0x00, 16);
aes_param.iv_len = 16;
aes_param.output_data = new uint8_t[AES_TEST_LENGTH];
memset(aes_param.output_data, 0x00, AES_TEST_LENGTH);
uint64_t mcycle_start, mcycle_end;
__asm volatile("csrr %0, mcycle" : "=r"(mcycle_start)::);
aes_hard_encrypt(&aes_param);
__asm volatile("csrr %0, mcycle" : "=r"(mcycle_end)::);
auto time_spent = (mcycle_end - mcycle_start) * 1.0 / ck_cpu;
volatile aes_t *aes = (volatile aes_t *)0x50450000;
aes->aes_endian |= 1;
aes->aes_key[0] = 0;
aes->aes_key[1] = 0;
aes->aes_key[2] = 0;
aes->aes_key[3] = 0;
aes->encrypt_sel = 0;
aes->mode_ctl.cipher_mode = 0;
aes->mode_ctl.kmode = 0;
aes->aes_iv[0] = 0;
aes->aes_iv[1] = 0;
aes->aes_iv[2] = 0;
aes->aes_iv[3] = 0;
aes->gb_aad_end_adr = -1;
aes->gb_pc_end_adr = -1;
aes->gb_aes_en |= 1;
aes->dma_sel |= 1;
uint64_t mcycle_start, mcycle_end;
uint32_t *in = new uint32_t[AES_TEST_LENGTH / sizeof(aes->aes_text_data)];
uint32_t *out = new uint32_t[AES_TEST_LENGTH / sizeof(aes->aes_text_data)];
if (!out || !in) {
printf("AES RAWDMA ALLOC FAILED\n");
return;
}
SemaphoreHandle_t signal_s, signal_r;
signal_s = xSemaphoreCreateBinary();
signal_r = xSemaphoreCreateBinary();
auto h_dma_s = dma_open_free();
auto h_dma_r = dma_open_free();
dma_set_request_source(h_dma_r, SYSCTL_DMA_SELECT_AES_REQ);
__asm volatile("csrr %0, mcycle" : "=r"(mcycle_start)::);
/*
* batch size larger than 80B cannot work here
*/
for (uint64_t i = 0; i < AES_TEST_LENGTH / 160; i++) {
dma_transmit_async(h_dma_s, &in[i * 40], &aes->aes_text_data, 1, 0, 4,
40, 4, signal_s);
dma_transmit_async(h_dma_r, &aes->aes_out_data, &out[i * 40], 0, 1, 4,
40, 4, signal_r);
xSemaphoreTake(signal_s, 1000);
xSemaphoreTake(signal_r, 1000);
}
__asm volatile("csrr %0, mcycle" : "=r"(mcycle_end)::);
vSemaphoreDelete(signal_s);
vSemaphoreDelete(signal_r);
delete[] in;
delete[] out;
auto ck_cpu = sysctl_clock_get_freq(SYSCTL_CLOCK_CPU);
auto __time = (mcycle_end - mcycle_start) * 1.0 / ck_cpu;
from kendryte-freertos-sdk.
Performance of AES has been improved to ~30MB/s in v0.5.0.
from kendryte-freertos-sdk.
Related Issues (20)
- hello_world doesn't compile HOT 1
- E (47408858) FreeRTOS: (kendryte-freertos-sdk/lib/drivers/src/network/dm9051.cpp:255) value == 0x90510a46
- UART sending data shorter than 17 bytes wont work
- A way to unmount SD Cards and handle failed initialization
- Move on to the Amazon maintained FreeRTOS base HOT 3
- 为什么不用fld 而是用 flw?
- Cannot compile on develop due to locks.c
- vApplicationIdleHook() cannot be overridden.
- Port Tensorflow Lite FreeRTOS SDK v0.7.0
- UART DMA
- compiling issue
- kpu.cpp 3 Layer Type missed!
- Kendryte GNU toolchain for Macox HOT 1
- ov5640?what is the purpose?
- Exceptions not working HOT 1
- 这个地方是否要改成(>=0),否则在YB-DKA01 VER1.0开发板上led0无法控制
- nncase
- FreeRTOS port up to date HOT 11
- No SDK for the APU
- FreeRTOS not possible to load models kmodel
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kendryte-freertos-sdk.