infineon4engi@twitter infineon@linkedin infineon4engineers infineon@youtube
twitter Facebook Linkedin Youtube

+ Reply to Thread
Results 1 to 2 of 2

Thread: Custom interrupt callbacks

  1. #1
    Beginner Beginner ipek is on a distinguished road
    Join Date
    May 2019
    Location
    Turkey, Ankara
    Posts
    12
    Points
    92.5

    Custom interrupt callbacks

    Is it possible to customize interrupt callbacks ? For example when an interrupt occurs I want my_func to be called instead of IRQx_Handler.

  2. #2
    Beginner Beginner ipek is on a distinguished road
    Join Date
    May 2019
    Location
    Turkey, Ankara
    Posts
    12
    Points
    92.5
    I solve this problem. It is not the best solution but since I don't know all dynamics of this product and someone who knows didn't answer..

    --------------- .h file:
    void (*_IRQHandlerArray[32])(); //function pointer array

    #define IRQ_HANDLER_DEFINE(IRQNO) \
    void IRQ##IRQNO##_Handler(void) \
    { \
    _IRQHandlerArray[IRQNO](); \
    }
    void registerIRQHandler(uint32_t irqNo, void(*foo)());
    ------------------------

    --------.c file:
    IRQ_HANDLER_DEFINE(0);
    IRQ_HANDLER_DEFINE(1);
    IRQ_HANDLER_DEFINE(2);
    IRQ_HANDLER_DEFINE(3);
    IRQ_HANDLER_DEFINE(4);
    IRQ_HANDLER_DEFINE(5);
    IRQ_HANDLER_DEFINE(6);
    IRQ_HANDLER_DEFINE(7);
    IRQ_HANDLER_DEFINE(8);
    IRQ_HANDLER_DEFINE(9);
    IRQ_HANDLER_DEFINE(10);
    IRQ_HANDLER_DEFINE(11);
    IRQ_HANDLER_DEFINE(12);
    IRQ_HANDLER_DEFINE(13);
    IRQ_HANDLER_DEFINE(14);
    IRQ_HANDLER_DEFINE(15);
    IRQ_HANDLER_DEFINE(16);
    IRQ_HANDLER_DEFINE(17);
    IRQ_HANDLER_DEFINE(18);
    IRQ_HANDLER_DEFINE(19);
    IRQ_HANDLER_DEFINE(20);
    IRQ_HANDLER_DEFINE(21);
    IRQ_HANDLER_DEFINE(22);
    IRQ_HANDLER_DEFINE(23);
    IRQ_HANDLER_DEFINE(24);
    IRQ_HANDLER_DEFINE(25);
    IRQ_HANDLER_DEFINE(26);
    IRQ_HANDLER_DEFINE(27);
    IRQ_HANDLER_DEFINE(28);
    IRQ_HANDLER_DEFINE(29);
    IRQ_HANDLER_DEFINE(30);
    IRQ_HANDLER_DEFINE(31);


    void registerIRQHandler(uint32_t irqno, void(*foo)())
    {
    _IRQHandlerArray[irqno] = foo;
    }
    ----------

    When I am using it, I call registerIRQHandler function with enabled interrupt line number and my function whose signature is compatible with a regular interrupt handler (ex: void foo(void); )

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.