ftp.nice.ch/peanuts/GeneralData/Documents/NeXT/MIDIDriver.tar.gz#/MIDIDriver/CFunctions/TimerOperations.rtf

This is TimerOperations.rtf in view mode; [Download] [Up]

paperh22175 margl-907 margr0 margt0 margb0 {fonttblf0fswiss Helvetica;f1froman Times;f2fmodern Courier;f3ftech Symbol;f4froman Palantino;}fi0 ri0 ql sb0 f1 fs24 Release 2.0  Copyright f3 'e3f1 1991 by NeXT Computer, Inc.  All Rights Reserved.

b fs36 f1 ql ri1007 li1108 fi-503 Timer Operations
fs16 
fs36 pard s28 li1108 fi0 ri1007 ql fs16 

fs36 midi_get_in_timer_port()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Get the timer service used by this MIDI device for input.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_server.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b midi_get_in_timer_port(b0 midi_rx_t i rx_porti0 , port_t *i timer_portb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i rx_porti0 :  MIDI receive or transmit port.
fs16 
fs28 i timer_porti0 :  Pointer to the timer port to use.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  midi_get_in_timer_port()b0  returns a pointer to the port representing the timer that'27s being used by the MIDI receive or transmit port (specified by i rx_porti0 ).  Currently, this must be the default timer implemented by the driver, which is also returned by b midi_get_out_timer_port()b0 .
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer port was returned.
fs16 
fs28 MIDI_BAD_PORT:  i Rxi0  i _porti0  is invalid.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 midi_get_out_timer_port()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Get the timer service implemented by this MIDI device.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_server.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b midi_get_out_timer_port(b0 midi_dev_t i device_porti0 , port_t *i timer_portb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i device_porti0 :  The MIDI device port.
fs16 
fs28 i timer_porti0 :  Pointer to the timer port implemented by this MIDI device.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  midi_get_out_timer_port()b0  returns a pointer to the timer port implemented by this MIDI device.  The ownership port isn'27t required to obtain this port as it can'27t be used to control MIDI itself.  It may be useful for other processes, which can synchronize themselves to MIDI input or output by using the same clock that'27s used by the device itself.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer port was returned.
fs16 
fs28 MIDI_NO_OWNER:  MIDI device does not have an owner.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 timer_direction()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Cause the timer to start incrementing in the specified direction.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_timer.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b timer_direction(b0 port_t i timer_porti0 , port_t i control_porti0 , boolean_t i forwardb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i timer_porti0 :  The timer port to use (obtainable by b midi_get_out_timer_port()b0 ).
fs16 
fs28 i control_porti0 :  Port controlling this timer.
fs16 
fs28 i forwardi0 :  Whether to run timer forwards instead of backwards.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  timer_direction()b0  causes the timer to start running in the direction specified by i forwardi0 .  Access to the timer i control_porti0  is required for this operation.  Any active requests will be sent timer events indicating that the time has changed.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer direction set.
fs16 
fs28 TIMER_BAD_CNTRL:  i control_porti0  is invalid.
fs16 
fs28 TIMER_UNSUP:  Operation is not supported.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 timer_quanta_req(), timer_timeval_req()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Request a timer event at some time in the future.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_timer.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b timer_quanta_req(b0 port_t i timer_porti0 , port_t i reply_porti0 , int i quantai0 , boolean_t i relative_timeb i0 )
b0 kern_return_t b timer_timeval_req(b0 port_t i timer_porti0 , port_t i reply_porti0 , timeval_t i timevali0 , boolean_t i relative_timeb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i timer_porti0 :  The timer port to use.
fs16 
fs28 i reply_porti0 :  Where to send timer events.
fs16 
fs28 i timevali0 :  Time of requested event, in seconds and microseconds.
fs16 
fs28 i quantai0 :  Time of requested event, specified in quanta.
fs16 
fs28 i relative_timei0 :  Whether the time in i timevali0  (or in i quantai0 ) is specified relative to the current time, instead of as an absolute time.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionsb  timer_timeval_req()b0  and b timer_quanta_req()b0  request that the timer issue an event when the requested time has arrived.  The two functions behave the same, except that b timer_timeval_req()b0  represents the requested time as a timeval structure (consisting of seconds and microseconds), whereas b timer_quanta_req()b0  represents time in arbitrary units called quanta.  (See b timer_set_quantum()b0 .)
fs16 
fs28 The i timer_porti0  parameter is the port representing the timer service.  This port should be obtained from the MIDI driver with b midi_get_out_timer_port()b0 .  The i timevali0  or i quantai0  parameter specifies the time of the requested notification (as implemented by the timer service).  The i relative_timei0  parameter, if true, indicates that the current timer service time should be used as an offset to add to the requested time (stored in i timevali0  or i quantai0 ).  Otherwise, the event will be delivered using the requested time as an absolute time.  The i reply_porti0  parameter specifies the port to which the timer event is to be delivered.  An event is delivered when any of the following conditions arises:
fs16 
fs28 pard s0 li3124 fs16 fs28 'b7	The timer expires.
fs16 
fs28 'b7	The timer changes from running to stopped.
fs16 
fs28 'b7	The timer starts running again.
fs16 
fs28 'b7	The timer changes direction (it was counting upwards but now is counting downwards, or vice versa).
fs16 
fs28 'b7	The value of the timer changes.
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 fs16 
fs28 Once the timer expires, the event is cleared and no further messages will be delivered on the registered i reply_porti0 .  Each i reply_porti0  can have only a single event scheduled.  Scheduling another event causes the existing event to be cleared.  Multiple events can be received by using distinct i reply_porti0 s.
fs16 
fs28 pard s18 li2116 fi-2015 ri1007 ql li2620 fi-2520 tx1108 tx2620 fs16 fs28 b 	Warning:	b0 The MIDI driver doesn'27t sort messages by time.  Thus, if the second of two calls to b timer_timeval_req()b0  or b timer_quanta_req()b0  requests an event whose time is earlier than that requested by the first call, the driver won'27t issue the second event until after the time requested by the first call.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer event now pending.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 timer_set()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Set the value of the timer.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_timer.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b timer_set(b0 port_t i timer_porti0 , port_t i control_porti0 , timeval_t i timevalb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i timer_porti0 :  The timer port to use (obtainable by b midi_get_out_timer_portb0 ).
fs16 
fs28 i control_porti0 :  Port controlling this timer.
fs16 
fs28 i timevali0 :  Time to set timer to.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  timer_set()b0  sets the time of the timer service to the time specified in the i timevali0  parameter.  Access to the timer i control_porti0  is required for this operation (for the MIDI driver'27s timer, the control port is the device'27s owner port).  Any active requests will be sent timer events indicating that the time has changed.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer value changed.
fs16 
fs28 TIMER_BAD_CNTRL:  i control_porti0  is invalid
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 timer_set_quantum()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Set the number of microseconds per timer quantum.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_timer.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b timer_set_quantum(b0 port_t i timer_porti0 , port_t i control_porti0 , u_int i quantumb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i timer_porti0 :  The timer port to use (obtainable by b midi_get_out_timer_portb0 ).
fs16 
fs28 i control_porti0 :  Port controlling this timer.
fs16 
fs28 i quantumi0 :  Specified number of microseconds per quantum.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  timer_set_quantum()b0  specifies the number of microseconds per quantum that is to be used by this timer.  The default value of a quantum is 1000 microseconds.  Access to the timer i control_porti0  is required for this operation.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer quantum set.
fs16 
fs28 TIMER_BAD_CNTRL:  i control_porti0  is invalid.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 timer_start()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Start the timer running.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_timer.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b timer_start(b0 port_t i timer_porti0 , port_t i control_portb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i timer_porti0 :  The timer port to use (obtainable by b midi_get_out_timer_portb0 ).
fs16 
fs28 i control_porti0 :  Port controlling this timer.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  timer_start()b0  causes the timer to resume execution.  Access to the timer i control_porti0  is required for this operation.  Any active requests will be sent timer events indicating that the time has changed.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer started.
fs16 
fs28 TIMER_BAD_CNTRL:  i control_porti0  is invalid.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 timer_stop()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Stop the timer from incrementing.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_timer.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b timer_stop(b0 port_t i timer_porti0 , port_t i control_portb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i timer_porti0 :  The timer port to use (obtainable by b midi_get_out_timer_portb0 ).
fs16 
fs28 i control_porti0 :  Port controlling this timer.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  timer_stop()b0  causes the timer to stop updating.  Access to the timer i control_porti0  is required for this operation.  Any active requests will be sent timer events indicating that the time has changed.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Timer stopped.
fs16 
fs28 TIMER_BAD_CNTRL:  i control_porti0  is invalid.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 timer_timeval_req f3 b0 'aef1 b  See timer_quanta_req
fs16 
fs36 pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b0 fs28 
fs16 
fs28 }

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.