[M2351] Hook crypto interrupt handler without NVIC_SetVector

pull/9656/head
ccli8 2019-02-11 14:21:41 +08:00
parent 267f62e928
commit 8988b6e9db
1 changed files with 8 additions and 9 deletions

View File

@ -60,11 +60,6 @@ static SingletonPtr<PlatformMutex> crypto_ecc_mutex;
/* Atomic flag for crypto SHA AC management */ /* Atomic flag for crypto SHA AC management */
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT; static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
/* NOTE: There's inconsistency in cryptography related naming, Crpt or Crypto. For example, cryptography IRQ
* handler could be CRPT_IRQHandler or CRYPTO_IRQHandler. To override default cryptography IRQ handler, see
* device/startup_{CHIP}.c for its name or call NVIC_SetVector regardless of its name. */
void CRPT_IRQHandler();
/* Crypto (AES, DES, SHA, etc.) init counter. Crypto's keeps active as it is non-zero. */ /* Crypto (AES, DES, SHA, etc.) init counter. Crypto's keeps active as it is non-zero. */
static uint16_t crypto_init_counter = 0U; static uint16_t crypto_init_counter = 0U;
@ -104,8 +99,7 @@ void crypto_init(void)
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure. * NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
*/ */
CLK_EnableModuleClock_S(CRPT_MODULE); CLK_EnableModuleClock_S(CRPT_MODULE);
NVIC_SetVector(CRPT_IRQn, (uint32_t) CRPT_IRQHandler);
NVIC_EnableIRQ(CRPT_IRQn); NVIC_EnableIRQ(CRPT_IRQn);
} }
core_util_critical_section_exit(); core_util_critical_section_exit();
@ -315,8 +309,13 @@ static bool crypto_submodule_wait(volatile uint16_t *submodule_done)
return false; return false;
} }
/* Crypto interrupt handler */ /* Crypto interrupt handler
void CRPT_IRQHandler() *
* There's inconsistency in cryptography related naming, Crpt or Crypto. For example,
* cryptography IRQ handler could be CRPT_IRQHandler or CRYPTO_IRQHandler. To override
* default cryptography IRQ handler, see device/startup_{CHIP}.c for its correct name
* or call NVIC_SetVector() in crypto_init() regardless of its name. */
extern "C" void CRPT_IRQHandler()
{ {
uint32_t intsts; uint32_t intsts;