OSSetPeriodicAlarm

Syntax

#include <cafe/os.h>

typedef void (* OSAlarmHandler) (OSAlarm* alarm, OSContext* context);

BOOL OSSetPeriodicAlarm(OSAlarm*       alarm,
                        OSTime         start,
                        OSTime         period,
                        OSAlarmHandler handler);

Parameters

alarm Pointer to the alarm to set.
start Period origin in ticks, set in absolute time.
period Ticks for counting each period.
handler Alarm handler to call.

Return Values

BOOL indicating whether the alarm was previously initialized.

Description

Sets a periodic alarm. To set in absolute time, include the current OSGetTime value with the start argument. For example, the following provides a constant 35 millisecond start delta for the first alarm.

    BOOL OSSetPeriodicAlarm(&alarm,
	    OSGetTime()+OSMillisecondsToTicks(35),
	    OSMicrosecondsToTicks(33333),
	    &OnAlarm);

The alarm must have been created previously and initialized using the OSCreateAlarm function.

CAUTION:
Do not allocate or use an OSContext through an address that was mapped by the OSMapMemory function. For more information, see OSMapMemory.

Do Not Call From

None.

See Also

OSCancelAlarm
OSSetAlarm
OSWaitAlarm

Revision History

2014/01/24 Added Caution to Description block.
2013/05/08 Automated cleanup pass.
2012/05/04 Matched the prototype.
2011/03/17 Added BOOL result to the function.
2010/08/30 Initial version.


CONFIDENTIAL