Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SW] Expand xirq interrupt function by a parameter. #614

Closed
wants to merge 1 commit into from
Closed

[SW] Expand xirq interrupt function by a parameter. #614

wants to merge 1 commit into from

Conversation

emb4fun
Copy link
Collaborator

@emb4fun emb4fun commented May 17, 2023

Now the interrupt function is expanded by a parameter:

void xirq_handler_ch0(void *param) {
  (void)param;
  neorv32_uart0_printf("XIRQ interrupt from channel %i\n", 0);
}

neorv32_xirq_install(0, xirq_handler_ch0, NULL);

@stnolting
Copy link
Owner

What's the intended purpose of those additional parameters? Could you provide a (typical?) use case?

If I understand your proposal the right way, then the XIRQ software library add two additional 32*4-byte look up tables for storing a function pointer plus some parameter for each XIRQ channel handler. What's the benefit here?

@stnolting stnolting self-assigned this May 18, 2023
@stnolting stnolting added the SW software-related label May 18, 2023
@emb4fun
Copy link
Collaborator Author

emb4fun commented May 18, 2023

The purpose is to use the same interrupt handler for more that one
channels. E.g. if you have connected 2 Ethernet modules, one on channel 0
and the other on channel 1, you can use the same interrupt function with
different Ethernet interface context:

neorv32_xirq_install(0, NicInterrupt, netif1);
neorv32_xirq_install(1, NicInterrupt, netif2);

The old way can be used too, but hier it looks like:

neorv32_xirq_install(0, NicInterrupt1);
neorv32_xirq_install(1, NicInterrupt2);

void NicInterrupt1 (void)
{
   NicInterrupt(netif1);
}

void NicInterrupt2 (void)
{
   NicInterrupt(netif2);
}

I do not know what version use less resources. It could be possible
that it makes not sense for this PR in the moment.

@emb4fun
Copy link
Collaborator Author

emb4fun commented Feb 4, 2024

It looks like this doesn't make sense at this point, so I'm closing my pull request.

@emb4fun emb4fun closed this Feb 4, 2024
@emb4fun emb4fun deleted the xirq_param branch February 4, 2024 09:53
@stnolting
Copy link
Owner

Feel free to open a new PR if you'd like to continue on this 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SW software-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants