The optional SetSync routine complements GetSync. It can be used to implement the VESA Device Power Management Standard (DPMS) as well as to enable a sync-on-green, sync-on-red, or sync-on-blue mode for a frame buffer.
enum {
kDisableHorizontalSyncBit = 0,
kDisableVerticalSyncBit = 1,
kDisableCompositeSyncBit = 2,
kEnableSyncOnBlue = 3,
kEnableSyncOnGreen = 4,
kEnableSyncOnRed = 5
}
The following illustrates a typical use of SetSync :
OSErr = Control(theDeviceRefNum, cscSetSync, &theVDSyncInfoRec);
Following is the information that the status routine must return in the fields of the VDSyncInfoRec record passed by SetSync :
To preserve compatibility with the current Energy Saver control panel, the following special case should be implemented. If the csFlags parameter of a SetSync routine is 0, the routine should be interpreted as if the csFlags parameter were 0x3. This interpretation is necessary because the Energy Saver control panel sends a csMode value of 0 and a csFlags value of 0 in its parameter block when it wants the display to enable all the horizontal, vertical, and composite sync lines. With the new definition, this would have no effect; the result would be that the display would never come out of sleep mode.
The SetSync routine can be used to implement the VESA DPMS standard by disabling the horizontal or vertical sync lines, or both. The VESA DPMS standard specifies four software-controlled modes of operation: On, Standby, Suspend, and Off. Mode switches are accomplished by controlling the horizontal and vertical sync signals. Table 13-1 illustrates the relationship between modes and signals.
Table 13-1 Implementing VESA DPMS modes with SetSync
In the case of a display using only the composite sync line, only the On and Off modes are possible.