home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / os-include.lha / os-include / libraries / realtime.i < prev    next >
Text File  |  1993-10-15  |  7KB  |  186 lines

  1.     IFND    LIBRARIES_REALTIME_I
  2. LIBRARIES_REALTIME_I      SET      1
  3. **
  4. **    $VER: realtime.i 40.3 (5.4.93)
  5. **    Includes Release 40.15
  6. **
  7. **    realtime.library timing and syncing system
  8. **
  9. **    (C) Copyright 1991-1993 Commodore-Amiga, Inc.
  10. **    All Rights Reserved
  11. **
  12.  
  13. ;---------------------------------------------------------------------------
  14.  
  15.     IFND EXEC_TYPES_I
  16.     INCLUDE "exec/types.i"
  17.     ENDC
  18.  
  19.     IFND EXEC_NODES_I
  20.     INCLUDE "exec/nodes.i"
  21.     ENDC
  22.  
  23.     IFND EXEC_LISTS_I
  24.     INCLUDE "exec/lists.i"
  25.     ENDC
  26.  
  27.     IFND EXEC_LIBRARIES_I
  28.     INCLUDE "exec/libraries.i"
  29.     ENDC
  30.  
  31.     IFND UTILITY_TAGITEM_I
  32.     INCLUDE "utility/tagitem.i"
  33.     ENDC
  34.  
  35. ;---------------------------------------------------------------------------
  36.  
  37. ; realtime.library's idea of time is based on a clock which emits a pulse
  38. ; 1200 times a second (1.2kHz). All time values maintained by realtime.library
  39. ; are based on this number. For example, the field RealTimeBase->rtb_Time
  40. ; expresses an amount of time equivalent to (RealTimeBase->rtb_Time/TICK_FREQ)
  41. ; seconds.
  42. ;
  43. TICK_FREQ equ 1200
  44.  
  45. ;---------------------------------------------------------------------------
  46.  
  47. ; Each Conductor represents a group of applications which wish to remain
  48. ; synchronized together.
  49. ;
  50. ; This structure must only be allocated by realtime.library and is
  51. ; READ-ONLY!
  52. ;
  53.    STRUCTURE Conductor,LN_SIZE
  54.     UWORD    cdt_Reserved0
  55.     STRUCT  cdt_Players,MLH_SIZE    ; this conductor's players
  56.     ULONG    cdt_ClockTime        ; current time of this sequence
  57.     ULONG    cdt_StartTime        ; start time of this sequence
  58.     ULONG    cdt_ExternalTime    ; time from external unit
  59.     ULONG    cdt_MaxExternalTime    ; upper limit on sync'd time
  60.     ULONG    cdt_Metronome        ; MetricTime highest pri node
  61.      UWORD    cdt_Reserved1
  62.     UWORD    cdt_Flags        ; conductor flags
  63.     UBYTE    cdt_State        ; playing or stopped
  64.    LABEL Conductor_SIZEOF
  65.  
  66. ; Flag bits for Conductor.cdt_Flags
  67.     BITDEF  CONDUCT,EXTERNAL,0        ; clock is externally driven
  68.     BITDEF  CONDUCT,GOTTICK,1        ; received 1st external tick
  69.     BITDEF  CONDUCT,METROSET,2        ; cdt_Metronome filled in
  70.     BITDEF  CONDUCT,PRIVATE,3        ; conductor is private
  71.  
  72. ; constants for Conductor.cdt_State and SetConductorState()
  73. CONDSTATE_STOPPED EQU      0        ; clock is stopped
  74. CONDSTATE_PAUSED  EQU      1        ; clock is paused
  75. CONDSTATE_LOCATE  EQU      2        ; go to 'running' when ready
  76. CONDSTATE_RUNNING EQU      3        ; run clock NOW
  77.  
  78. ; These do not actually exist as Conductor states, but are used as additional
  79. ; arguments to SetConductorState()
  80. CONDSTATE_METRIC  EQU     -1        ; ask high node to locate
  81. CONDSTATE_SHUTTLE EQU     -2        ; time changing but not running
  82. CONDSTATE_LOCATE_SET EQU  -3        ; maestro done locating
  83.  
  84. ;---------------------------------------------------------------------------
  85.  
  86. ; The Player is the connection between a Conductor and an application.
  87. ;
  88. ; This structure must only be allocated by realtime.library and is
  89. ; READ-ONLY!
  90. ;
  91.    STRUCTURE Player,LN_SIZE
  92.     BYTE    pl_Reserved0
  93.     BYTE    pl_Reserved1
  94.     APTR    pl_Hook            ; player's hook function
  95.     APTR    pl_Source        ; pointer to parent context
  96.     APTR    pl_Task            ; task to signal for changes
  97.     LONG    pl_MetricTime        ; current time in app's metric
  98.         LONG    pl_AlarmTime        ; time to wake up
  99.         APTR    pl_UserData        ; for application use
  100.         UWORD    pl_PlayerID        ; for application use
  101.         UWORD    pl_Flags        ; general Player flags
  102.    LABEL Player_SIZEOF
  103.  
  104. ; Flag bits for the Player.pl_Flags
  105.     BITDEF  PLAYER,READY,0        ; player is ready to go!
  106.     BITDEF  PLAYER,ALARMSET,1        ; alarm is set
  107.     BITDEF  PLAYER,QUIET,2        ; a dummy player, used for sync
  108.     BITDEF  PLAYER,CONDUCTED,3        ; give me metered time
  109.     BITDEF  PLAYER,EXTSYNC,4        ; granted external sync
  110.  
  111. ;---------------------------------------------------------------------------
  112.  
  113. ; Tags for CreatePlayer(), SetPlayerAttrs(), and GetPlayerAttrs()
  114. PLAYER_Base         EQU TAG_USER + 64
  115. PLAYER_Hook        EQU PLAYER_Base + 1    ; set address of hook function
  116. PLAYER_Name         EQU PLAYER_Base + 2    ; name of player
  117. PLAYER_Priority     EQU PLAYER_Base + 3    ; priority of player
  118. PLAYER_Conductor    EQU PLAYER_Base + 4    ; set conductor for player
  119. PLAYER_Ready        EQU PLAYER_Base + 5    ; the "ready" flag
  120. PLAYER_AlarmTime    EQU PLAYER_Base + 12   ; alarm time (sets PLAYERF_ALARMSET)
  121. PLAYER_Alarm        EQU PLAYER_Base + 13   ; sets/clears PLAYERF_ALARMSET flag
  122. PLAYER_AlarmSigTask EQU PLAYER_Base + 6    ; task to signal for alarm/state change
  123. PLAYER_AlarmSigBit  EQU PLAYER_Base + 8    ; signal bit for alarm (or -1)
  124. PLAYER_Conducted    EQU PLAYER_Base + 7    ; sets/clears PLAYERF_CONDUCTED flag
  125. PLAYER_Quiet        EQU PLAYER_Base + 9    ; don't process time thru this
  126. PLAYER_UserData     EQU PLAYER_Base + 10
  127. PLAYER_ID        EQU PLAYER_Base + 11
  128. PLAYER_ExtSync        EQU PLAYER_Base + 14   ; attempt/release to ext sync
  129. PLAYER_ErrorCode    EQU PLAYER_Base + 15   ; error return code
  130.  
  131. ;---------------------------------------------------------------------------
  132.  
  133. ; Method types for messages sent via a Player's hook
  134. PM_TICK      EQU 0
  135. PM_STATE     EQU 1
  136. PM_POSITION  EQU 2
  137. PM_SHUTTLE   EQU 3
  138.  
  139. ; used for PM_TICK, PM_POSITION and PM_SHUTTLE methods
  140.    STRUCTURE pmTime,0
  141.     ULONG pmt_Method    ; PM_TICK, PM_POSITION, or PM_SHUTTLE
  142.     ULONG pmt_Time
  143.    LABEL pmTime_SIZEOF
  144.  
  145. ; used for the PM_STATE method
  146.    STRUCTURE pmState,0
  147.     ULONG pms_Method    ; PM_STATE
  148.     ULONG pms_OldState
  149.    LABEL pmState_SIZEOF
  150.  
  151. ;---------------------------------------------------------------------------
  152.  
  153. ; possible lock types for LockRealTime()
  154. RT_CONDUCTORS EQU 0  ; conductor list
  155.  
  156. ;---------------------------------------------------------------------------
  157.  
  158. ; realtime.library error codes
  159. RTE_NOMEMORY    EQU 801       ; memory allocation failed
  160. RTE_NOCONDUCTOR EQU 802       ; player needs a conductor
  161. RTE_NOTIMER     EQU 803       ; timer (CIA) allocation failed
  162. RTE_PLAYING     EQU 804       ; can't shuttle while playing
  163.  
  164. ;---------------------------------------------------------------------------
  165.  
  166. ; OpenLibrary("realtime.library",0) returns a pointer to this structure.
  167. ; All fields are READ-ONLY.
  168. ;
  169.    STRUCTURE RealTimeBase,LIB_SIZE
  170.     STRUCT rtb_Reserved0,2
  171.  
  172.     ULONG  rtb_Time        ; current time
  173.     ULONG  rtb_TimeFrac    ; fixed-point fractional part of  time
  174.     WORD   rtb_Reserved1
  175.     WORD   rtb_TickErr    ; nanosecond error from ideal Tick length to
  176.    LABEL RealTimeBase_SIZEOF          ; real tick length
  177.  
  178. ; Actual tick length is: 1/TICK_FREQ + rtb_TickErr/1e9
  179.  
  180. RealTime_TickErr_Min EQU -705
  181. RealTime_TickErr_Max EQU  705
  182.  
  183. ;---------------------------------------------------------------------------
  184.  
  185.     ENDC    ; LIBRARIES_REALTIME_I
  186.