AnsweredAssumed Answered

Custom non-interruptible System Event Controller (SEC) interrupt dispatcher

Question asked by matthiaswe on Apr 9, 2018
Latest reply on May 18, 2018 by Jithul_Janardhanan

Hi,

 

the __sec_int_dispatcher is installed as the handler for IVG11 and also referred to as SEC interrupt dispatcher.

I am currently facing issues when an interrupt is interrupted by another interrupt (i.e. nested interrupts).

I'd like to disable interrupts during the handling of the SEC.

 

Is this

  • possible,
  • a good idea?

 

What would be the way to do it? I was thinking about writing a custom SEC interrupt dispatcher as a "wrapper".

  • It disables interrupts and stores the IMASK value in a register and disable interrupts (CLI).
  • The register is previously stored on the stack.
  • Call the original SEC interrupt dispatcher.
  • Restore IMASK via the register and re-enable interrupts (STI).
  • Restore the register.

 

The handler would look like this:

__sec_int_dispatcher_custom:

[--SP]=R2;

CLI R2;

 

[--SP]=P1;

P1 = [__sec_int_dispatcher];

CALL (P1);

P1=[SP++];

 

STI R2;

R2=[SP++];

 

I'd either have to replace the symbol in app_startup.s or call register_handler() to hook the new handler to IVG11.

 

Two issues here:

  • Let's say there's an interrupt directly after the "STI R2" instruction which leads to context-switching code.
    R2 may never be restored. Is there a way around it?
  • I couldn't manage to use the symbol __sec_int_dispatcher_custom and am getting linker errors. Can this be fixed?

 

The CEC internally uses/calls EX_DISPATCHED_HANDLER_NESTED(_adi_osal_stdWrapper, iid, index, arg). If I get it right it may be too late to disable and re-enable interrupts here, as the code before the call could be interrupted, right?

 

Thanks,
Matthias

Outcomes