EMILE/second/driver.c

57 lines
1.1 KiB
C
Raw Normal View History

/*
*
* (c) 2005 Laurent Vivier <LaurentVivier@wanadoo.fr>
*
*/
2005-10-10 21:42:58 +00:00
#include <stdio.h>
#include <unistd.h>
#include <string.h>
2005-11-08 02:06:40 +00:00
#include <macos/lowmem.h>
#include <macos/devices.h>
#include <macos/video.h>
2005-11-08 02:06:40 +00:00
#include "misc.h"
2005-10-06 21:06:20 +00:00
2005-10-10 21:42:58 +00:00
void turn_off_interrupts()
2005-10-06 21:06:20 +00:00
{
int i;
short count;
DCtlHandle *currentHandle;
DCtlPtr currentPtr;
DriverHeader *driverPtr, **driverHandle;
short refnum;
2005-11-08 02:06:40 +00:00
volatile OSErr err; /* because -O2 remove call to PBControlSync() otherwise... */
2005-10-10 21:42:58 +00:00
VDParamBlock pb;
VDFlagRec flag;
2005-10-06 21:06:20 +00:00
count = LMGetUnitTableEntryCount();
currentHandle = (DCtlEntry ***) LMGetUTableBase();
for (i = 0; i < count; i++)
{
if (!currentHandle[i])
continue;
currentPtr = *(currentHandle[i]);
if (currentPtr->dCtlFlags & dRAMBasedMask)
{
driverHandle = (void*)(currentPtr->dCtlDriver);
if (!driverHandle)
continue;
driverPtr = *driverHandle;
}
else
driverPtr = (void*)(currentPtr->dCtlDriver);
2005-10-10 21:42:58 +00:00
err = OpenDriver(driverPtr->drvrName, &refnum);
if (err != noErr)
continue;
pb.ioRefNum = refnum;
pb.csCode = 7; /* SetInterrupt */
flag.flag = 1;
pb.csParam = &flag;
err = PBControlSync((ParmBlkPtr) &pb);
2005-10-06 21:06:20 +00:00
}
}