MQX Kinetis disable all IRQ

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MQX Kinetis disable all IRQ

跳至解决方案
1,041 次查看
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 项奖励
回复
1 解答
677 次查看
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 项奖励
回复
1 回复
678 次查看
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 项奖励
回复