<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/37307/artx---arm7---os_evt_set-os_evt_wait_or</link><description> 
Hi, 

 
I&amp;#39;m developping on ARM7 chip with ARTX OS and I would like to
implement periodic task. My software is based onto the example you
can find at the following link : 
 http://www.keil.com/support/docs/3008.htm 

 
During my tests, I&amp;#39;ve detected</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/146085?ContentTypeID=1</link><pubDate>Tue, 19 Jun 2007 07:32:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5ac1df78-4821-47c0-b2c9-cb29cb4d2a66</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
You will need to put together code that gives you the behavior
that you desire. A &amp;quot;simple&amp;quot; solution that does not do what you want
is not a good choice. I do not believe the Keil will be changing the
way events work any time soon (if at all) so you will need to either
add a flag to your code or use some other technique. It is not clear
exactly what you are trying to do so what I did was explain what the
event system was doing. If it does not do what you want, then use
something that does do what you want.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/144247?ContentTypeID=1</link><pubDate>Tue, 19 Jun 2007 01:50:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:865f9f9b-739d-495f-97cd-5f4eeabc2d0e</guid><dc:creator>Stephen Isidore</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi,&lt;/p&gt;

&lt;p&gt;
I&amp;#39;ve arrived at the same point, but instead using mailbox to fix
the problem I would like to use something easier such a flag.&lt;br /&gt;
I think that it is a bug. The event would be clear by the waiting
task when it&amp;#39;s running. In my example, the waiting task were never
running (low priority task). The scheduler reset the event flag not
propaly before waiting task running&lt;/p&gt;

&lt;p&gt;
Do you have some idea ?&lt;/p&gt;

&lt;p&gt;
Thanks for all !&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/141798?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2007 10:26:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b7e5beb4-09da-43f7-979d-eaf2696e4768</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
OK. I can replicate and explain what it is doing. It is debatable
if it is actaully a bug (I would not submit it as a bug, but that is
because it is not causing me any problems)&lt;/p&gt;

&lt;p&gt;
Task2 is WAITING for an event.&lt;/p&gt;

&lt;p&gt;
Task1 sets the event for Task2.&lt;/p&gt;

&lt;p&gt;
In the context of Task1, Task2 is set READY to run.&lt;br /&gt;
The event that caused the wakeup is set. (for os_get_evt)&lt;br /&gt;
The event(s) that caused the wakeup is cleared.&lt;/p&gt;

&lt;p&gt;
Task1 continues to run and sets the event again.&lt;/p&gt;

&lt;p&gt;
Task2 actaully returns from the first wait and runs.&lt;/p&gt;

&lt;p&gt;
Task2 does a 0 time wait on the event, and finds that it is set
and returns it.&lt;/p&gt;

&lt;p&gt;
Knowing this, you may want to change your logic accordingly.
(maybe you should use a mailbox instead of an event)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/138471?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2007 02:47:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:12d290b6-7aa8-4c44-87fb-feecc9fbd9fc</guid><dc:creator>Stephen Isidore</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi,&lt;/p&gt;

&lt;p&gt;
tsk_lock and tsk_unlock are not the problem. If I remove them the
same problem occured, the code return OS_R_EVT on the second call to
os_evt_wait_or...&lt;/p&gt;

&lt;p&gt;
thanks&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/135027?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2007 10:01:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cfbce410-b507-4eaa-ad07-0cbb43470935</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
Actually there may be another issue. It is not a good idea to call
os_set_evt() while you have interrupts disabled. os_set_evt() MAY
dispatch a task other than the currently running task, this has a
side effect of causing interrupts to be reenabled at that point in
time. (It should only do it if the task you are sending it to is
waiting for it and a higher priority) I am not sure, but
isr_set_evt() might work better.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/123883?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2007 09:32:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d610c3cb-576b-411b-9de3-ed4eada9ce2e</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
The code you have posted SHOULD return OS_R_TMO on the second call
to os_wait_evt_or(); If it is not there is something wrong. If this
is what you are seeing (and I believe you are) then the event system
is working properly.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/112952?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2007 03:50:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f6455c6b-b820-437e-bb1b-a4029dde7da9</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
If you read the above code - do you see anything strange wit the
formatting? Doesn&amp;#39;t the indenting look a bit aggresive? Did you
convert from tab characters to spaces?&lt;/p&gt;

&lt;p&gt;
You shouldn&amp;#39;t expect to get two wakeups for doing two calls to
os_evt_set().&lt;/p&gt;

&lt;p&gt;
Have you read the manual for the function?&lt;br /&gt;
&lt;a href="http://www.keil.com/support/man/docs/rlarm/rlarm_os_evt_set.htm"&gt;http://www.keil.com/support/man/docs/rlarm/rlarm_os_evt_set.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
&amp;quot;The os_evt_set function sets the event flags for the task
identified by the function argument. The function only sets the event
flags whose corresponding bit is set to 1 in the event_flags
argument.&amp;quot;&lt;/p&gt;

&lt;p&gt;
The documentation says nothing about a counter to keep track of
number of calls to os_evt_set(). If the second task hasn&amp;#39;t run when
you call os_evt_set() the second time, there will be no state
change.&lt;/p&gt;

&lt;p&gt;
If you are trying to write a producer-consumer, where one task
adds two resources for task 2 to use, then it is up to you to create
the queue or counter that contains the amount of work that task 2 has
pending..&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/99334?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2007 03:27:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:de25fa5f-fdd6-46f4-ba8b-6e30caac38f3</guid><dc:creator>Stephen Isidore</dc:creator><description>&lt;p&gt;&lt;p&gt;
hi,&lt;/p&gt;

&lt;p&gt;
I make a mistake in the task1 in the following source.&lt;br /&gt;
In fact the code I&amp;#39;m using to generate the error is :&lt;/p&gt;

&lt;pre&gt;
void task1 (void) __task {
        while (1)        {

                        os_dly_wait(70);                          /* Pass control to other tasks for 70 tick*/
                                        tsk_lock();
                                        os_evt_set (0x0001,tsk2) ;        /* set the event 0x0001 two times */
                                        os_evt_set (0x0001,tsk2) ;
                                        tsk_unlock();

                                }
}

&lt;/pre&gt;

&lt;p&gt;
thanks!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/75192?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2007 03:21:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:aaf76ca5-f90f-4335-9d9f-519563df34b7</guid><dc:creator>Stephen Isidore</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi,&lt;/p&gt;

&lt;p&gt;
you can find bellow my source&lt;/p&gt;

&lt;pre&gt;
/*----------------------------------------------------------------------------
 *
 *----------------------------------------------------------------------------
 *      Name:    Event.c
 *
 *----------------------------------------------------------------------------
 *
 *---------------------------------------------------------------------------*/

#include &amp;lt;RTL.h&amp;gt;                      /* RTX kernel functions &amp;amp; defines      */
#include &amp;lt;LPC21xx.H&amp;gt;                  /* LPC21xx definitions                 */
#include &amp;lt;stdio.h&amp;gt;

extern void init_serial (void);       /* Initialize Serial Interface         */

OS_TID tsk1, tsk2;

#define INDEFINTE_TIMEOUT     0xffff  /*indefinite timeout*/
#define NO_TIMEOUT                        0x0000  /*Timeout=0*/
/*----------------------------------------------------------------------------
 *  Task 1 - High Priority -
 *---------------------------------------------------------------------------*/
void task1 (void) __task {
        while (1)        {

                                                  /* Pass control to other tasks for 70 tick*/
                                        tsk_lock();
                                        os_evt_set (0x0001,tsk2) ;        /* set the event 0x0001 two times */
                                        os_evt_set (0x0001,tsk2) ;
                                        tsk_unlock();
                                        os_dly_wait(70);
                                }
}

/*----------------------------------------------------------------------------
 *  Task 2 - Low Priority -
 *---------------------------------------------------------------------------*/
void task2 (void) __task {
        while (1)   {
                                        static OS_RESULT ret ;

                                        ret = os_evt_wait_or (0x0001, INDEFINTE_TIMEOUT) ;       /* wait for event without timeout */

                                        ret =  os_evt_wait_or (0x0001, NO_TIMEOUT)      ;            /* wait for event with timeout 0 */
                                        if(ret==OS_R_EVT)                                                                        /* The flag 0x0001 is still set !!!!!!!!!  */
                                        {                                                                                                        /* if an event is set two times or more os_evt_wait will completed 2 times */
                                        printf(&amp;quot;it is not normal\n\r&amp;quot;);                                                /* It is not a good operation */
                                        }                                                                                                        /* Normally ret = OS_R_TMO     in the second os_evt_wait_or */
                        }
}

/*----------------------------------------------------------------------------
 *    Task &amp;#39;init&amp;#39;
 *---------------------------------------------------------------------------*/
void init (void) __task {


   /* Initialize the UART */
   init_serial ();
   /* Create an instance of task1 with priority 10 */
   tsk1 = os_tsk_create (task1, 10);
   /* Create an instance of task2 with priority 10 */
   tsk2 = os_tsk_create (task2, 5);
   /* Delete the init task */
   os_tsk_delete_self ();

}



/*----------------------------------------------------------------------------
 *    Main: Initialize and start RTX Kernel
 *---------------------------------------------------------------------------*/
int main (void) {
#ifdef MCB2100
   U32 volatile start;

   /* Wait for debugger connection (about 0.3 sec) */
   for (start = 0; start &amp;lt; 1000000; start++) { ; }
#endif
   /* Initialize RTX and start init   */
   os_sys_init (init);
}

/*----------------------------------------------------------------------------
 * end of file
 *---------------------------------------------------------------------------*/

&lt;/pre&gt;

&lt;p&gt;
thnks for all!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARTX - ARM7 - os_evt_set, os_evt_wait_or</title><link>https://community.arm.com/thread/48234?ContentTypeID=1</link><pubDate>Thu, 14 Jun 2007 07:50:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:95e191ea-2b51-4dc0-a095-de195ad0a703</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
The os_evt_set() and os_evt_wait() do work properly.&lt;/p&gt;

&lt;p&gt;
IF a high priority task calls os_evt_set() twice without doing an
os_block at any point, the lower priority task will only wakeup
once.&lt;/p&gt;

&lt;p&gt;
note:&lt;/p&gt;

&lt;p&gt;
1) os_itv_wait() causes an os_block&lt;br /&gt;
2) priorities go from 0 (low priority) to 255 (high priority). This
is different than some kernels, but I think it makes more sense.&lt;br /&gt;
3) as soon as the low priority task &amp;quot;takes&amp;quot; the event (returns from
the os_evt_wait_or()) the evt is cleared and another one can be
received BEFORE you call os_evt_wait_or() again. This means as soon
as you call os_evt_wait_or() you may wakeup again.&lt;/p&gt;

&lt;p&gt;
The os_evt_wait() does work as advertised and as it should (this
does not mean it works in the way you are trying to make it work)&lt;/p&gt;

&lt;p&gt;
If you want to post code or describe what you would really like to
happen, I would be happy to comment again.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>