There is:
/*! @brief CAAM handle
* Specifies jobRing and optionally the user callback function.
* The user callback functions is invoked only if jobRing interrupt has been enabled by the user.
* By default the jobRing interrupt is disabled (default job complete test is polling CAAM output ring).
*/
typedef struct _caam_handle_t
{
caam_job_ring_t jobRing;
/* Callback functions */
caam_job_callback_t callback; /*!< Callback function */
void *userData; /*!< Parameter for CAAM job complete callback */
} caam_handle_t;
So i wrote a callback and mapped it to caam_handle_t* handle
static void xpnd_CAAM_job_ring_1_complete_clb(void* args) {
BaseType_t pxHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR(sem[ITF_1],
&pxHigherPriorityTaskWoken);
DisableIRQ(CAAM_IRQ1_IRQn);
}
At the very end i tried:
EnableIRQ(CAAM_IRQ1_IRQn);
drv_res = CAAM_RNG_GetRandomDataNonBlocking(
base, handle, kCAAM_RngStateHandle0, desc, data, dataSize,
kCAAM_RngDataAny, NULL);
if (drv_res == kStatus_Success) {
if (pdTRUE != xSemaphoreTake(sem[ITF_1], MS_TIMEOUT)) {
PRINTF("CAAM operation failed\r\n");
return ST_FAILURE;
}
} else {
PRINTF("Failed to setup driver operation, res %d\r\n", drv_res);
return ST_FAILURE;
}
The program crashes after short time i think - because it didn't report an error from semaphore.
Do i need to do something else?
In assembly startup_mimxrt1176 there is CAAM_IRQ0_IRQHandler prototyped but i think it might be not defined - might this be the case?
Also in the driver code i don't see where is the custom callback is called.