Topic : TOS - The Operating System Author : Version : tos.hyp (December 19, 2008) Subject : Programmieren/Atari Nodes : 3010 Index Size : 93790 HCP-Version : 5 Compiled on : Atari @charset : atarist @lang : @default : Title @help : @options : +g -i -s +x +zz -t4 @width : 70 View Ref-File11.5.16.39.26 mxk_evnt_IO TOS Name: »evnt_IO« Parameters: d0 = long ticks_50hz a0 = void *unsel Description: mxk_evnt_IO makes it possible to wait for one external event. The external event in question is either an interrupt or another application (which perhaps writes to a pipe for awakening). The function is used for the creation of device drivers: Procedure (see DEV_LPT1 as an example): 1. Block interrupts. 2. Inquire whether the event (in the case of DEV_LPT1 the event is called: 'Centronics busy off') has arrived. 3. If so, free interrupts and perform the action (in the case of DEV_LPT1: print character). 4. If not, set up interrupt routine (in the case of DEV_LPT1: MFP-I0, i.e. 'Activate Centronics busy interrupt') and make available to it the current application (act_appl) and also a LONGword address into which the interrupt routine can write return messages. This address should have written to it the address of a routine that deinstalls the interrupt again, and can be followed by some user requirements. i.e. some further data. The unselect routine later gets a pointer to all this data and can evaluate the optional parameters for instance. The whole mechanism is required to guarantee a corrrect deinitialization of the interrupt in each case. 5. Release interrupts. 6. Call evnt_IO. In d0.w specify the number of 50Hz ticks for the timeout; 0 means 'no timeout'. In a0 give the address of the LONGword containing the address of the clean-up routine that deinstalls the interrupt again (which is followed by optional further parameters, provided the unselect routine understands these). In the case of incorporation of device drivers for Fselect, only one optional LONGword is possible. On arrival of the interrupt, the interrupt routine writes a status < 0L (error) or 1L (OK) in place of the deinitialization routine into the status LONGword (which previously contained its own start address). Following this the routine will deinstall itself or make sure that no actions are performed on following interrupts. Finally the interrupt routine awakens the application assigned to the interrupt, using the call appl_IOcomplete with the application as parameter. 7. evnt_IO returns either the value 0L (timeout, the interrupt has not arrived) or < 0 (the interrupt has written an error-code to the status LONGword) or 1L (the interrupt has written a 1L into the status LONGword). Deinstallation of the interrupt is no longer required as the kernel has taken care of this if the interrupt routine did not do this itself on arrival of the interrupt. Group: Kernel functions See also: -