uint32_t ecb_encrypt_nonblocking(struct ecb *ecb) { /* prepare to be used in a BE AES h/w */ if (ecb->in_key_le) { mem_rcopy(&ecb->in_key_be[0], ecb->in_key_le, sizeof(ecb->in_key_be)); } if (ecb->in_clear_text_le) { mem_rcopy(&ecb->in_clear_text_be[0], ecb->in_clear_text_le, sizeof(ecb->in_clear_text_be)); } /* setup the encryption h/w */ NRF_ECB->ECBDATAPTR = (uint32_t)ecb; NRF_ECB->EVENTS_ENDECB = 0; NRF_ECB->EVENTS_ERRORECB = 0; NRF_ECB->INTENSET = ECB_INTENSET_ERRORECB_Msk | ECB_INTENSET_ENDECB_Msk; /* enable interrupt */ _NvicIrqUnpend(ECB_IRQn); irq_enable(ECB_IRQn); /* start the encryption h/w */ NRF_ECB->TASKS_STARTECB = 1; return 0; }
/** * * @brief Enable an interrupt line * * Clear possible pending interrupts on the line, and enable the interrupt * line. After this call, the CPU will receive interrupts for the specified * <irq>. * * @return N/A */ void _arch_irq_enable(unsigned int irq) { /* before enabling interrupts, ensure that interrupt is cleared */ _NvicIrqUnpend(irq); _NvicIrqEnable(irq); }