<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software Solutions中的主题 How reset time-slice counter back to zero?</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-reset-time-slice-counter-back-to-zero/m-p/179653#M2593</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using a few tasks as TIME_SLICE (time-slice = 100 millisec) and one main task which create this time-slice tasks and next it is blocked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I have finished main task, sheduler time-slice counter is not zero. As result first task has a little bit time less then 100 millisec.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I reset this time-slice counter before sheduller will start first time-slice counter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Good Luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Jan 2011 18:06:33 GMT</pubDate>
    <dc:creator>troll</dc:creator>
    <dc:date>2011-01-28T18:06:33Z</dc:date>
    <item>
      <title>How reset time-slice counter back to zero?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-reset-time-slice-counter-back-to-zero/m-p/179653#M2593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using a few tasks as TIME_SLICE (time-slice = 100 millisec) and one main task which create this time-slice tasks and next it is blocked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I have finished main task, sheduler time-slice counter is not zero. As result first task has a little bit time less then 100 millisec.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I reset this time-slice counter before sheduller will start first time-slice counter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Good Luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jan 2011 18:06:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-reset-time-slice-counter-back-to-zero/m-p/179653#M2593</guid>
      <dc:creator>troll</dc:creator>
      <dc:date>2011-01-28T18:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: How reset time-slice counter back to zero?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-reset-time-slice-counter-back-to-zero/m-p/179654#M2594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi troll &lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;scheduler time-slice is only a default value for time-slice. Don't bother with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You want to have the tasks run the same amount of time. In that case you need to start new task on the new re-scheduling caused by timer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a bit complex issue, needs small hack, but you can do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) create task queue, store it as global variable: suspended_tasks = _taskq_create(MQX_TASK_QUEUE_FIFO);&lt;/P&gt;&lt;P&gt;2) create new tasks with higher priority (= more important tasks) than the starter task: _task_create(0, TASK_ID, 0);&lt;/P&gt;&lt;P&gt;3) create some variable to signal that tasks are ready to run on following interrupt (see small hack below): &amp;nbsp;&amp;nbsp; reinit_tasks_on_interrupts = 1;&lt;/P&gt;&lt;P&gt;4) after (3), the starting task should run in infinite loop and not to call any function that can make rescheduling (e.g. _task_wait or _lwsem_wait ), just waiting for interrupt: wait(1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5) every new started task will do as first step sleep onto taks queue: _taskq_suspend(suspended_tasks);&lt;/P&gt;&lt;P&gt;small hack:&lt;/P&gt;&lt;P&gt;6) open _bsp_timer_isr() int init_bsp.c and make that&amp;nbsp; the signal from (3) will resume all sleeping tasks:&amp;nbsp; if (reinit_tasks_on_interrupts) {&amp;nbsp; _taskq_resume(suspended_tasks); } before _time_notify_kernel();&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Jan 2011 21:29:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-reset-time-slice-counter-back-to-zero/m-p/179654#M2594</guid>
      <dc:creator>JuroV</dc:creator>
      <dc:date>2011-01-31T21:29:04Z</dc:date>
    </item>
  </channel>
</rss>

