1 // Copyright 2020 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 16 #include "esp_aes_dma_priv.h" 17 18 #include "soc/soc_caps.h" 19 #include "soc/crypto_dma_reg.h" 20 #include "hal/crypto_dma_ll.h" 21 22 esp_aes_dma_start(const lldesc_t * input,const lldesc_t * output)23esp_err_t esp_aes_dma_start(const lldesc_t *input, const lldesc_t *output) 24 { 25 crypto_dma_ll_reset(); 26 crypto_dma_ll_set_mode(CRYPTO_DMA_AES); 27 28 /* Set descriptors, input to AES comes from outlink DMA and viceversa */ 29 crypto_dma_ll_outlink_set((uint32_t)input); 30 crypto_dma_ll_inlink_set((uint32_t)output); 31 32 /* Start transfer */ 33 crypto_dma_ll_outlink_start(); 34 crypto_dma_ll_inlink_start(); 35 36 return ESP_OK; 37 } 38 esp_aes_dma_done(const lldesc_t * output)39bool esp_aes_dma_done(const lldesc_t *output) 40 { 41 return (crypto_dma_ll_inlink_is_eof() && (output->owner == 0)); 42 } 43