MQX 4.2: Know interrupt ID from default ISR

cancel
Showing results for 
Search instead for 
Did you mean: 

MQX 4.2: Know interrupt ID from default ISR

Jump to solution
166 Views
Contributor II

Hi,

We are using MQX 4.2.0 on a Kinetis MK64FX512VDC12.

I am trying to know which interruption is triggered by an action.

To do so, as a test, I installed a custom default ISR just before the action. My ISR is called but I cannot find how to get the interrupt ID (or vector if I understand correclty) from the ISR itself.

_int_install_default_isr takes a INT_ISR_FPTR as a parameter, which is defined as

typedef void (_CODE_PTR_ INT_ISR_FPTR)(void *);

From what I understand, the pointer we get as a parameter would be the one given with the custom ISR, if I had set it using _int_install_isr for example. If so, no information related to the current interruption should be available there.

Is there any way, from an ISR, to know what interrupt it is currently reacting to?

Thanks,

Rudy

Tags (2)
0 Kudos
1 Solution
18 Views
NXP TechSupport
NXP TechSupport

Hi Rudy:

I would suggest you refer to function _int_unexpected_isr (mqx/source/psp/cortex_m/int_unx.c)

I hope it helps.

void _int_unexpected_isr
(
    void   *parameter
)
{ /* Body */
    KERNEL_DATA_STRUCT_PTR     kernel_data;
    TD_STRUCT_PTR              td_ptr;

    _GET_KERNEL_DATA(kernel_data);
    td_ptr = kernel_data->ACTIVE_PTR;

#if 0
#if !MQX_LITE_VERSION_NUMBER
    {
        uint32_t                    psp, msp, i;
        printf("\n\r*** UNHANDLED INTERRUPT ***\n\r");
        printf("Vector #: 0x%02x Task Id: 0x%0x Td_ptr 0x%x\n\r",
        (uint32_t)parameter, (uint32_t)td_ptr->TASK_ID, (uint32_t)td_ptr);

        psp = __get_PSP();
        msp = __get_MSP();
        printf("PC: 0x%08x LR: 0x%08x PSP: 0x%08x MSP: 0x%08x PSR: 0x%08x\n\r", __get_PC(), __get_LR(), psp, msp, __get_PSR());

        printf("\n\r\n\rMemory dump:\n\r");
        for (i = 0; i < 32; i += 4) {
            printf("0x%08x : 0x%08x 0x%08x 0x%08x 0x%08x\n\r", psp + i * 4, ((uint32_t*)psp)[i], ((uint32_t*)psp)[i + 1], ((uint32_t*)psp)[i + 2], ((uint32_t*)psp)[i + 3]);
        }

        printf("\n\r\n\rMemory dump:\n\r");
        for (i = 0; i < 32; i += 4) {
            printf("0x%08x : 0x%08x 0x%08x 0x%08x 0x%08x\n\r", msp + i * 4, ((uint32_t*)msp)[i], ((uint32_t*)msp)[i + 1], ((uint32_t*)msp)[i + 2], ((uint32_t*)msp)[i + 3]);
        }
    }
#endif
#endif

    _INT_DISABLE();
    if (td_ptr->STATE != UNHANDLED_INT_BLOCKED) {
    td_ptr->STATE = UNHANDLED_INT_BLOCKED;
    td_ptr->INFO  = (_mqx_uint)parameter;

    _QUEUE_UNLINK(td_ptr);
    } /* Endif */
   _INT_ENABLE();


Have a great day,
Daniel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
19 Views
NXP TechSupport
NXP TechSupport

Hi Rudy:

I would suggest you refer to function _int_unexpected_isr (mqx/source/psp/cortex_m/int_unx.c)

I hope it helps.

void _int_unexpected_isr
(
    void   *parameter
)
{ /* Body */
    KERNEL_DATA_STRUCT_PTR     kernel_data;
    TD_STRUCT_PTR              td_ptr;

    _GET_KERNEL_DATA(kernel_data);
    td_ptr = kernel_data->ACTIVE_PTR;

#if 0
#if !MQX_LITE_VERSION_NUMBER
    {
        uint32_t                    psp, msp, i;
        printf("\n\r*** UNHANDLED INTERRUPT ***\n\r");
        printf("Vector #: 0x%02x Task Id: 0x%0x Td_ptr 0x%x\n\r",
        (uint32_t)parameter, (uint32_t)td_ptr->TASK_ID, (uint32_t)td_ptr);

        psp = __get_PSP();
        msp = __get_MSP();
        printf("PC: 0x%08x LR: 0x%08x PSP: 0x%08x MSP: 0x%08x PSR: 0x%08x\n\r", __get_PC(), __get_LR(), psp, msp, __get_PSR());

        printf("\n\r\n\rMemory dump:\n\r");
        for (i = 0; i < 32; i += 4) {
            printf("0x%08x : 0x%08x 0x%08x 0x%08x 0x%08x\n\r", psp + i * 4, ((uint32_t*)psp)[i], ((uint32_t*)psp)[i + 1], ((uint32_t*)psp)[i + 2], ((uint32_t*)psp)[i + 3]);
        }

        printf("\n\r\n\rMemory dump:\n\r");
        for (i = 0; i < 32; i += 4) {
            printf("0x%08x : 0x%08x 0x%08x 0x%08x 0x%08x\n\r", msp + i * 4, ((uint32_t*)msp)[i], ((uint32_t*)msp)[i + 1], ((uint32_t*)msp)[i + 2], ((uint32_t*)msp)[i + 3]);
        }
    }
#endif
#endif

    _INT_DISABLE();
    if (td_ptr->STATE != UNHANDLED_INT_BLOCKED) {
    td_ptr->STATE = UNHANDLED_INT_BLOCKED;
    td_ptr->INFO  = (_mqx_uint)parameter;

    _QUEUE_UNLINK(td_ptr);
    } /* Endif */
   _INT_ENABLE();


Have a great day,
Daniel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
18 Views
Contributor II

Hi Daniel,

Based on _int_unexpected_isr, I got what I needed!

Thanks a lot!

Rudy

0 Kudos