Previous Next Contents

4. Driver support functions

These functions are used to manage which card is in use by which driver. A driver can provide a means by which a call-back function can be called from another driver to deactivate this driver. This is necessary for the first driver to unhook from interrupt chains etc., before the new driver can take over.

4.1 Get|Set card used flag


get_card_used:
Input:
  D0.L      device handle
  A0.L      pointer to longword where call-back address is stored
Output:
  D0.L      error code or status

The returned status is either 0 (the card is free), 1 (the card is in use), 2 (the card is in use, but the driver can be uninstalled) or 3 (the card is in use, but can be taken over without further actions).

Case 3 means that the driver which brought the card to this state may not hook into interrupt chains or other system resources which need to be unhooked when another driver takes over the card.

If the return code is 2, the call-back function entry of the driver is returned in the memory pointed to by A0.


set_card_used:
Input:
  D0.L      device handle
  A0.L      address of call-back entry (not pointer to address!) 
            or 0L, 1L or 3L
Output:
  D0.L      error code

If the call-back entry is 0L, 1L or 3L, the card status is set to that value. Only a driver which 'owns' the card may use this.

If any other value is passed, it is assumed to be a pointer to the drivers call back entry point, and the card status is set to 2 (in use, can be uninstalled).

4.2 Call-back handlers

Call-back functions are invoked by calling the call-back entry point, they return with RTS. Call-back functions may only modify those registers which are used to pass arguments or results.

Call-back functions must be called in supervisor mode with at least 1024 bytes stack available.

The call-back function number is passed in D0.L.

If the driver supports call-back functions, the following functions are mandatory:

Call-back 0: Get Driver ID


call_back0:
Input:
  D0.L      call-back function number, ie. 0
Output:
  D0.L      driver ID (same as the driver's XBRA ID)

Call-back 1: Try to remove driver

The driver tries to uninstall. If it succeeds, it returns 0 in D0.L and sets the card status to 'free', otherwise, it returns 1.


call_back1:
Input:
  D0.L      call-back function number, ie. 1
Output:
  D0.L      result code: 0=success (card is free), 1 = can't uninstall


Previous Next Contents