質問

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