This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

My idea about ARTX isr_evt_set()

In the ARTX help say 'It might happen that two isr_evt_set() functions for the same task are called before the task gets a chance to run from os_evt_wait_xx() event waiting function. Of course one event is lost because event flags are not counting objects.' I think if two isr_evt_set() functions should be called, we can set the different bit of the event_flags, then no event will be lost. I mean the isr_evt_set() functions just OR the event_flags but not cover with the event_flags. My idea is right?

Parents
  • Well, I give an example.
    void EXT3irq(void) __irq
    { isr_evt_set (0x0010, tskSendErrMSG);
    EXTINT = 0x00000008;
    VICVectAddr = 0x00000000;
    }

    void EXT2irq(void) __irq
    { isr_evt_set (0x0001, tskSendErrMSG);
    EXTINT = 0x00000004;
    VICVectAddr = 0x00000000;
    }

    void TaskSendErrMSG (void) __task
    { uint16 _retFlag;
    while (1)
    { os_evt_wait_or (0x0011, 0xFFFF);
    _retFlag = os_evt_get ();
    if (_retFlag&0x0001)
    {
    ...
    processA
    }
    if (_retFlag&0x0010)
    {
    ...
    processB
    }
    }
    }

    Of course EXT3 interrupt and EXT2 interrupt will not happer very frequently. When EXT2 interrupt happen, and the program not go to os_evt_wait_or, at this time EXT3 interrupt happen. So, in this condition, the event_flag will be cover as 0x0010? Or the event_flag is 'OR' as ox0011? processA will be lost? In another condition, EXT2 interrupt happen and the program just processing the task and still not finish, at this time EXt3 interrupt happen. In this condition, the event will be lost?

Reply
  • Well, I give an example.
    void EXT3irq(void) __irq
    { isr_evt_set (0x0010, tskSendErrMSG);
    EXTINT = 0x00000008;
    VICVectAddr = 0x00000000;
    }

    void EXT2irq(void) __irq
    { isr_evt_set (0x0001, tskSendErrMSG);
    EXTINT = 0x00000004;
    VICVectAddr = 0x00000000;
    }

    void TaskSendErrMSG (void) __task
    { uint16 _retFlag;
    while (1)
    { os_evt_wait_or (0x0011, 0xFFFF);
    _retFlag = os_evt_get ();
    if (_retFlag&0x0001)
    {
    ...
    processA
    }
    if (_retFlag&0x0010)
    {
    ...
    processB
    }
    }
    }

    Of course EXT3 interrupt and EXT2 interrupt will not happer very frequently. When EXT2 interrupt happen, and the program not go to os_evt_wait_or, at this time EXT3 interrupt happen. So, in this condition, the event_flag will be cover as 0x0010? Or the event_flag is 'OR' as ox0011? processA will be lost? In another condition, EXT2 interrupt happen and the program just processing the task and still not finish, at this time EXt3 interrupt happen. In this condition, the event will be lost?

Children
  • I think that with your example it might work. If both event flags are set before the task has resumed execution, it will resume execution only once. Howeveer both flags are captured and both events processed.

    This is a possible solution when it is guaranteed that one interrupt does not happen very frequently. For example when EXT2irq repeat again with no delay in between, one event will be lost.

    Franc