home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / util / cdity / yak / src / clickdrive.c < prev    next >
C/C++ Source or Header  |  1994-02-27  |  1KB  |  55 lines

  1. #include <exec/types.h>
  2. #include <devices/trackdisk.h>
  3. #include <clib/alib_protos.h>
  4. #include <proto/exec.h>
  5.  
  6. #include "code.h"
  7. #include "yak.h"
  8.  
  9.  
  10. /*
  11.  * Set drive click off if toggle is TRUE
  12.  * Set drive click on otherwise
  13.  *
  14.  */
  15. __regargs void 
  16. SetClickDrive (BOOL toggle)
  17. {
  18.    struct IOExtTD *td;
  19.    struct MsgPort *po;
  20.    struct TDU_PublicUnit *tpu;
  21.    long unit;
  22.  
  23.    if (po = CreatePort (NULL, 0))
  24.    {
  25.       for (unit = 0; unit < 4; unit++)
  26.       {
  27.           if (td = (struct IOExtTD *) CreateExtIO (po, sizeof (struct IOExtTD)))
  28.           {
  29.               if (!(OpenDevice ("trackdisk.device", unit, (struct IORequest *) td, 0L)))
  30.               {
  31.                   tpu = (struct TDU_PublicUnit *) td->iotd_Req.io_Unit;
  32.                   if (toggle==TRUE)     
  33.                   {   
  34.                       /* Stop clicking ! */
  35.                       tpu->tdu_PubFlags |= TDPF_NOCLICK;
  36.                   }
  37.                   else
  38.                   {
  39.                       /* Keep on clicking ! */
  40.                       tpu->tdu_PubFlags &= ~TDPF_NOCLICK;
  41.                   }
  42.                   CloseDevice ((struct IORequest *) td);
  43.                   DeleteExtIO ((struct IORequest *) td);
  44.               }
  45.           }
  46.       }
  47.       DeletePort (po);
  48.    }
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.