gtpc2m16C/C++ Language Support User's Guide

cretc, __CRETC-Create a Time-Initiated Entry

This macro creates an independent ECB after a specified amount of time has elapsed. A 4-byte parameter is placed in EBW000-EBW003 of the newly created ECB.

Format

#include   <tpfapi.h>
void       cretc(int flags, void (*segname)(), int units,
                 const void *action);
void       __CRETC(int flags, const char *segname, int units
                   const void *action);

flags
Logical or (|) of the following bit flags that are defined in tpfapi.h:

CRETC_SECONDS or CRETC_MINUTES
Use CRETC_SECONDS or CRETC_MINUTES to indicate whether the units parameter is expressed in seconds or minutes. Code only one of these options.

CRETC_1052
This optional parameter permits the program specified by seg_name to be activated at the time requested, even when the system is in 1052 state. If CRETC_1052 is not specified, the program cannot be activated until the system is cycled above 1052 state.

segname
For cretc, a pointer to the external function to be called. For __CRETC, a pointer to the name of the segment to be called. segname must map to an assembler segment name, a TARGET(TPF) segment name (or transfer vector), or a TPF ISO-C DLM name.
Migration to ISO-C consideration

The TARGET(TPF) cretc function can handle segment names that are #pragma mapped. The ISO-C cretc function only handles #pragma mapped names if the first 4 characters are the same as the program name.

TARGET(TPF) restriction

Only calls to certain TPF API functions permit the use of function pointers. Pointers to functions are not supported in TARGET(TPF); their use will normally result in a compiler error.

units
An integer value defining the time increment in minutes or seconds that will elapse before activating the ECB.
Note:
When you specify the time increment in minutes, an ECB is created at a full minute boundary, which can be less than the interval specified with the unit parameter. For example, assume you specified an interval of 1 minute. If the current time is 10:35:55, the new ECB can be created at 10:36:00.

action
Treated as a pointer to type void, the first 4 bytes of which are passed to the created ECB as an action word in EBW000-003.

Normal Return

Void.

Error Return

Not applicable.

Programming Considerations

Examples

The following example creates a new ECB for program QZZ0 after 5 seconds have elapsed. The 4-byte character string INIT is placed in EBW000-003 of the new ECB.

#include <tpfapi.h>
void QZZ0();

  ·
  ·
  ·
cretc(CRETC_SECONDS,QZZ0,5,"INIT");

Related Information