IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page


RTX_EC RTX_Wait_Period ( void   ) 

This API puts the calling task to sleep until it's next period comes around (or manual trigger).

This API is intended for periodic tasks, but it can be used by any task to await the next trigger pulse.

Returns:
Zero on success, else error code.

Here is an example program which uses this API with a periodic task timer to provide timing for a 10 Hz processing loop.

Example:
#include <clib.h>

extern void Activity_10Hz(void) ;

static void Task_10Hz(void)
{
    while (1)               // 10 Hz loop
    {
        Activity_10Hz() ;   // Get here each 100 ms.
        RTX_Wait_Period() ; // Await next auto-trigger.
    }
}

static DWORD    MyStack[500] ;

static const RtxTaskDefS Task_10Hz_Def = 
{
    { '1', '0', 'H', 'z' },             // tkdTag[4]
    (RTX_TASK_PROC) Task_10Hz,          // tkdProc
    &MyStack[0],                        // tkdStackBase
    sizeof(MyStack),                    // tkdStackSize
    0,                                  // tkdlParam (not used here)
    30,                                 // tkdPriority
    RTX_TA_PERIODIC | RTX_TA_CATCH_UP,  // tkdAttr
    0,                                  // tkdSlice
    100,                                // tkdPeriod [ms] -> 10 Hz
    // Remaining members tkdPhase, and tkdPhaseRef
    // play no role in this example since their corresponding tkdAttr 
    // flags are zero.
} ;

static RTX_ID   TaskID_10Hz ;

void Initialize(void)
{
    TaskID_10Hz = RTX_NewTask (&Task_10Hz_Def) ;
}           
See also:
RTX_GearChg()     RTX_Trigger_Task()     RTX_End_Execution()
Compatibility:
Not available in SC1x, SC2x and SC1x3 systems
Since:
SC2x3 V1.00 - CLIB V1.00





Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Thu Jan 26 16:21:37 2017 by Doxygen 1.6.1