MQX Kinetis disable all IRQ

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX Kinetis disable all IRQ

Jump to solution
841 Views
GudeADS
Contributor III

Hi,

I want to disable all IRQ on K64 for a short time. I found the following statement: "To disable all interrupts, use psp function cortex_int_disable in file cortex.c." But I cannot find a function cortex_int_disable(). Has anybody an idea?

Best Regards

0 Kudos
1 Solution
477 Views
soledad
NXP Employee
NXP Employee

HI Andeas,

You can use the _int_enable() and  _int_disable() functions, these functions enable and disable ALL interrupts EXCEPT NON MASKABLE interrupts becuase it is not possible to disable this type of interrupts.

These functions are defined in the mqx.h file, in addition you can find more information in Freescale MQX™RTOS Reference Manual(page 60), this manual is located at the path: C:\Freescale\Freescale_MQX_4_1\doc\mqx

Below you can find an example.

#include mqx_prv.h

#define WAIT_BLOCKED 0xF1

Restart(_task_id tid)

{

    TD_STRUCT_PTR td_ptr = _task_get_td(tid);

    _int_disable();

    if ((td_ptr != NULL) && (td_ptr->STATE == WAIT_BLOCKED)){

          _task_ready(td_ptr);

          }

    _int_enable();

}

Wait()

{

    TD_STRUCT_PTR td_ptr = _task_get_td(_task_get_id());

    _int_disable();

    td_ptr->STATE = WAIT_BLOCKED;

    _task_block();

    _int_enable();

}


Have a great day,
Sol
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
478 Views
soledad
NXP Employee
NXP Employee

HI Andeas,

You can use the _int_enable() and  _int_disable() functions, these functions enable and disable ALL interrupts EXCEPT NON MASKABLE interrupts becuase it is not possible to disable this type of interrupts.

These functions are defined in the mqx.h file, in addition you can find more information in Freescale MQX™RTOS Reference Manual(page 60), this manual is located at the path: C:\Freescale\Freescale_MQX_4_1\doc\mqx

Below you can find an example.

#include mqx_prv.h

#define WAIT_BLOCKED 0xF1

Restart(_task_id tid)

{

    TD_STRUCT_PTR td_ptr = _task_get_td(tid);

    _int_disable();

    if ((td_ptr != NULL) && (td_ptr->STATE == WAIT_BLOCKED)){

          _task_ready(td_ptr);

          }

    _int_enable();

}

Wait()

{

    TD_STRUCT_PTR td_ptr = _task_get_td(_task_get_id());

    _int_disable();

    td_ptr->STATE = WAIT_BLOCKED;

    _task_block();

    _int_enable();

}


Have a great day,
Sol
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos