- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
alt_irq_register
hello everybody !
I look forward to your help !
The development environment : Quartus II 13.1 (64-bit);
Eclipse IDE for C/C++ Developers(Version: Indigo Service Release 2)
FPGA model :EP4CE75U19I7N
The following code:
int uart_init(void)
{
// printf("Hello from Nios II-3-1!\n");
// usleep(1000*1000);
alt_irq_register(DEVICECTRL_0_IRQ, NULL,Button_Irq_Handler); //1906 line
// usleep(1000*1000);
// printf("Hello from Nios II-3-2!\n");
// usleep(1000*1000);
set_tr_type(0); //End data transfer
printf("Hello from Nios II-3-3!\n");
usleep(1000*1000);
return 0;
}
calling alt_irq_register.c :
int alt_irq_register (alt_u32 id,
void* context,
alt_isr_func handler)
{
int rc = -EINVAL;
alt_irq_context status;
if (id < ALT_NIRQ)
{
/*
* interrupts are disabled while the handler tables are updated to ensure
* that an interrupt doesn't occur while the tables are in an inconsistant
* state.
*/
status = alt_irq_disable_all ();
alt_irq[id].handler = handler;
alt_irq[id].context = context;
rc = (handler) ? alt_irq_enable (id): alt_irq_disable (id); //95 line
alt_irq_enable_all(status);
}
return rc;
}
In alt_IRq_register.c, alt_irq_enable (ID) will be executed when the handle is true,
in line 1906 of Uart.c, call this function alt_irq_register(DEVICECTRL_0_IRQ, NULL,Button_Irq_Handler);
Start registering interrupt functions. According to the definition of this function parameter, the first parameter is IRQ, interrupt priority number,The second argument is null, never mind, and the third argument is the sentence returned by the interrupt function.
Finally stop at alt_irq_enable_all(status);
This function is then called as follows
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
#if (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) || (defined NIOS2_EIC_PRESENT) || \
(defined NIOS2_MMU_PRESENT) || (defined NIOS2_MPU_PRESENT)
alt_irq_context status;
NIOS2_READ_STATUS (status);
status &= ~NIOS2_STATUS_PIE_MSK;
status |= (context & NIOS2_STATUS_PIE_MSK);
NIOS2_WRITE_STATUS (status);
#else
NIOS2_WRITE_STATUS (context); // The debug program stops here
#endif
}
that's all.
Thanks in advance.
- Tags:
- alt_irq_register
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Allen_2020,
Thank you for posting in Intel community forum and hope you are doing well.
Further clarification, do you mind explaining more on what do you mean by normal?
Also do you see any error or warning upon compiling?
There are some design example that you can refer to which is using the interrupt request here.
More details for the HAL Api function can also be found here.
Warm regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
static ALT_INLINE void ALT_ALWAYS_INLINE
alt_irq_enable_all (alt_irq_context context)
{
#if (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) || (defined NIOS2_EIC_PRESENT) || \
(defined NIOS2_MMU_PRESENT) || (defined NIOS2_MPU_PRESENT)
alt_irq_context status;
NIOS2_READ_STATUS (status);
status &= ~NIOS2_STATUS_PIE_MSK;
status |= (context & NIOS2_STATUS_PIE_MSK);
NIOS2_WRITE_STATUS (status);
#else
NIOS2_WRITE_STATUS (context); // The debug program stops here
#endif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Allen_2020,
Looking on the code that you have, I am suspecting there might be something off with the way the alt_irq_register are invoked, maybe the parameters.
Possible for you to share your quartus project for us to look into further more?
Note: for the time being here is a different design example which make use of HAL api reference here and you can have a look at it. (download the example 'an459-design-files.zip', it is based on the following guideline)
Warm regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Allen_2020,
Hope this message find you well and good day, as we do not receive any response from you to the previous clarification that we have provided. Please post a response in the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you with your follow-up questions.
Warm Regards
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page