A function prototype is

int alt_irq_register (alt_u32 id, void* context, void (*isr)(void*, alt_u32));

What does the last part mean? What is the *isr doing?

有帮助吗?

解决方案

It is a pointer to a function. You must use a function as parameter of the alt_irq_register function. Example:

void irq_handler(void *ptr, alt_u32 val) { /* my function */
    /* I'm handling the interupt */
}
int alt_irq_register (alt_u32 id, void* context, void (*isr)(void*, alt_u32));

In your code, you must use alt_irq_register function in this way:

/* your code */
ret = alt_irq_register(id, context_ptr, irq_handler);
/* other code */

I am supposing that this function register and interrupt handler, so during the registration you are passing to the system the function that it must uses when the associated interrupt occur.

其他提示

It's a pointer to a function. The function takes two arguments (void* and alt_u32) and returns nothing (void). Its parameter name is isr.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top