2022-02-05 15:32:44 +01:00
|
|
|
|
#include "NuBusFPGADrvr.h"
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
7.1:
|
|
|
|
|
2 Debug: 0x00000009
|
|
|
|
|
1 <EFBFBD>Debug: 0x00000009
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7.5.3:
|
|
|
|
|
6 Debug: 0x00000008
|
|
|
|
|
112 Debug: 0x0000000a
|
|
|
|
|
32 Debug: 0x0000000c
|
|
|
|
|
14 Debug: 0x0000000d
|
|
|
|
|
3 Debug: 0x0000000e
|
|
|
|
|
4 Debug: 0x00000010
|
|
|
|
|
2 Debug: 0x00000011
|
|
|
|
|
78 Debug: 0x00000012
|
|
|
|
|
1 Debug: 0x00000014
|
|
|
|
|
1 <EFBFBD>Debug: 0x0000000a
|
|
|
|
|
|
|
|
|
|
8.1:
|
|
|
|
|
9 Debug: 0x00000008
|
|
|
|
|
273 Debug: 0x0000000a
|
|
|
|
|
156 Debug: 0x0000000c
|
|
|
|
|
16 Debug: 0x0000000d
|
|
|
|
|
3 Debug: 0x00000010
|
|
|
|
|
3 Debug: 0x00000011
|
|
|
|
|
157 Debug: 0x00000012
|
|
|
|
|
1 Debug: 0x00000014
|
|
|
|
|
2 Debug: 0x00000018
|
|
|
|
|
10 Debug: 0x0000001c
|
|
|
|
|
1 <EFBFBD>Debug: 0x0000000c
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OSErr cNuBusFPGAStatus(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
|
|
|
|
|
{
|
|
|
|
|
NuBusFPGADriverGlobalsHdl dStoreHdl = (NuBusFPGADriverGlobalsHdl)dce->dCtlStorage;
|
|
|
|
|
NuBusFPGADriverGlobalsPtr dStore = *dStoreHdl;
|
|
|
|
|
short ret = -1;
|
2022-04-18 17:04:32 +02:00
|
|
|
|
|
2022-04-19 22:31:31 +01:00
|
|
|
|
/* write_reg(dce, GOBOFB_DEBUG, 0xBEEF0002); */
|
|
|
|
|
/* write_reg(dce, GOBOFB_DEBUG, pb->csCode); */
|
2022-04-18 17:04:32 +02:00
|
|
|
|
|
2022-02-05 15:32:44 +01:00
|
|
|
|
#if 1
|
|
|
|
|
switch (pb->csCode)
|
|
|
|
|
{
|
|
|
|
|
case -1:
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
ret = statusErr;
|
|
|
|
|
break;
|
|
|
|
|
/* case 1: */
|
|
|
|
|
/* break; */
|
|
|
|
|
case cscGetMode: /* 2 */
|
|
|
|
|
{
|
|
|
|
|
VDPageInfo *vPInfo = (VDPageInfo *)*(long *)pb->csParam;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vPInfo->csMode = dStore->curMode; /* checkme: PCI says depth, 7.5+ doesn't call anyway? */
|
2022-02-05 15:32:44 +01:00
|
|
|
|
vPInfo->csPage = 0;
|
|
|
|
|
vPInfo->csBaseAddr = 0;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case cscGetEntries: /* 3 */
|
|
|
|
|
/* FIXME: TODO */
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
ret = noErr;
|
|
|
|
|
break;
|
|
|
|
|
case cscGetPageCnt: /* 4 == cscGetPages */
|
|
|
|
|
{
|
|
|
|
|
VDPageInfo *vPInfo = (VDPageInfo *)*(long *)pb->csParam;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
switch (vPInfo->csMode) {
|
|
|
|
|
case firstVidMode:
|
|
|
|
|
break;
|
|
|
|
|
case secondVidMode:
|
|
|
|
|
break;
|
2022-04-18 14:10:17 +02:00
|
|
|
|
case thirdVidMode:
|
|
|
|
|
break;
|
|
|
|
|
case fourthVidMode:
|
|
|
|
|
break;
|
2022-04-18 17:04:32 +02:00
|
|
|
|
case fifthVidMode:
|
|
|
|
|
break;
|
2022-04-22 22:00:25 +01:00
|
|
|
|
case sixthVidMode:
|
|
|
|
|
break;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
default:
|
2022-02-05 15:32:44 +01:00
|
|
|
|
return paramErr;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
}
|
2022-02-05 15:32:44 +01:00
|
|
|
|
vPInfo->csPage = 0;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
ret = noErr;
|
|
|
|
|
break;
|
|
|
|
|
case cscGetPageBase: /* 5 == cscGetBaseAddr */
|
|
|
|
|
{
|
|
|
|
|
VDPageInfo *vPInfo = (VDPageInfo *)*(long *)pb->csParam;
|
|
|
|
|
if (vPInfo->csPage != 0)
|
|
|
|
|
return paramErr;
|
|
|
|
|
vPInfo->csBaseAddr = 0;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
ret = noErr;
|
|
|
|
|
break;
|
|
|
|
|
case cscGetGray: /* 6 */
|
|
|
|
|
{
|
|
|
|
|
VDGrayRecord *vGInfo = (VDGrayRecord *)*(long *)pb->csParam;
|
|
|
|
|
vGInfo->csMode = dStore->gray;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
break;
|
|
|
|
|
case cscGetInterrupt: /* 7 */
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
{
|
|
|
|
|
VDFlagRecord *vdflag = (VDFlagRecord *)*(long *)pb->csParam;
|
|
|
|
|
vdflag->csMode = 1 - dStore->irqen;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case cscGetGamma: /* 8 */
|
|
|
|
|
{
|
|
|
|
|
VDGammaRecord *vdgamma = (VDGammaRecord *)*(long *)pb->csParam;
|
|
|
|
|
vdgamma->csGTable = (Ptr)&dStore->gamma;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case cscGetDefaultMode: /* 9 */
|
2022-04-18 11:51:07 +02:00
|
|
|
|
{ /* obsolete in PCI, not called >= 7.5 */
|
2022-02-05 15:32:44 +01:00
|
|
|
|
VDDefMode *vddefm = (VDDefMode *)*(long *)pb->csParam;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vddefm->csID = firstVidMode;
|
2022-02-05 15:32:44 +01:00
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetCurMode: /* 0xa */
|
|
|
|
|
{
|
|
|
|
|
VDSwitchInfoRec *vdswitch = *(VDSwitchInfoRec **)(long *)pb->csParam;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vdswitch->csMode = dStore->curDepth;
|
|
|
|
|
vdswitch->csData = dStore->curMode;
|
2022-02-05 15:32:44 +01:00
|
|
|
|
vdswitch->csPage = 0;
|
|
|
|
|
vdswitch->csBaseAddr = 0;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetSync: /* 0xb */
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
ret = statusErr;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetConnection: /* 0xc */
|
|
|
|
|
{
|
|
|
|
|
VDDisplayConnectInfoRec *vdconn = *(VDDisplayConnectInfoRec **)(long *)pb->csParam;
|
|
|
|
|
vdconn->csDisplayType = kGenericLCD;
|
|
|
|
|
vdconn->csConnectTaggedType = 0;
|
|
|
|
|
vdconn->csConnectTaggedData = 0;
|
|
|
|
|
vdconn->csConnectFlags = (1<<kTaggingInfoNonStandard) | (1<<kIsMonoDev) | (1<<kAllModesSafe) | (1<<kAllModesValid);
|
|
|
|
|
vdconn->csDisplayComponent = 0;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetModeTiming: /* 0xd */
|
|
|
|
|
{
|
|
|
|
|
VDTimingInfoRec *vdtim = *(VDTimingInfoRec **)(long *)pb->csParam;
|
|
|
|
|
ret = noErr;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
if ((vdtim->csTimingMode != firstVidMode) &&
|
2022-02-05 15:32:44 +01:00
|
|
|
|
(vdtim->csTimingMode != kDisplayModeIDFindFirstResolution) &&
|
|
|
|
|
(vdtim->csTimingMode != kDisplayModeIDCurrent))
|
|
|
|
|
return paramErr;
|
|
|
|
|
vdtim->csTimingFormat = kDeclROMtables;
|
|
|
|
|
vdtim->csTimingData = 0;
|
|
|
|
|
vdtim->csTimingFlags = kModeDefault;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetModeBaseAddress: /* 0xe */
|
|
|
|
|
/* undocumented ??? */
|
2022-04-18 11:51:07 +02:00
|
|
|
|
{
|
|
|
|
|
VDBaseAddressInfoRec *vdbase = *(VDBaseAddressInfoRec **)(long *)pb->csParam;
|
|
|
|
|
vdbase->csDevBase = 0;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
ret = noErr;
|
2022-02-05 15:32:44 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetPreferredConfiguration: /* 0x10 */
|
|
|
|
|
{
|
|
|
|
|
VDSwitchInfoRec *vdswitch = *(VDSwitchInfoRec **)(long *)pb->csParam;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vdswitch->csMode = kDepthMode1; //dStore->curDepth; /* fixme: prefered not current / default */
|
|
|
|
|
vdswitch->csData = firstVidMode; //dStore->curMode;
|
2022-02-05 15:32:44 +01:00
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetNextResolution: /* 0x11 */
|
|
|
|
|
{
|
|
|
|
|
VDResolutionInfoRec *vdres = *(VDResolutionInfoRec **)(long *)pb->csParam;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vdres->csHorizontalPixels = HRES;
|
|
|
|
|
vdres->csVerticalLines = VRES;
|
|
|
|
|
vdres->csRefreshRate = 60 << 16; /* Fixed 16+16 */
|
2022-02-05 15:32:44 +01:00
|
|
|
|
switch (vdres->csPreviousDisplayModeID)
|
|
|
|
|
{
|
2022-04-18 11:51:07 +02:00
|
|
|
|
case firstVidMode:
|
2022-02-05 15:32:44 +01:00
|
|
|
|
vdres->csDisplayModeID = kDisplayModeIDNoMoreResolutions;
|
|
|
|
|
break;
|
|
|
|
|
case kDisplayModeIDFindFirstResolution:
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vdres->csDisplayModeID = firstVidMode;
|
2022-04-22 22:00:25 +01:00
|
|
|
|
vdres->csMaxDepthMode = kDepthMode6;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
break;
|
2022-02-05 15:32:44 +01:00
|
|
|
|
case kDisplayModeIDCurrent:
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vdres->csDisplayModeID = firstVidMode;
|
2022-04-22 22:00:25 +01:00
|
|
|
|
vdres->csMaxDepthMode = kDepthMode6;
|
2022-02-05 15:32:44 +01:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return paramErr;
|
|
|
|
|
}
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetVideoParameters: /* 0x12 */
|
|
|
|
|
{
|
|
|
|
|
VDVideoParametersInfoRec *vdparam = *(VDVideoParametersInfoRec **)(long *)pb->csParam;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
if ((vdparam->csDisplayModeID != firstVidMode) &&
|
2022-02-05 15:32:44 +01:00
|
|
|
|
(vdparam->csDisplayModeID != kDisplayModeIDFindFirstResolution) &&
|
|
|
|
|
(vdparam->csDisplayModeID != kDisplayModeIDCurrent))
|
|
|
|
|
return paramErr;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
if ((vdparam->csDepthMode != kDepthMode1) &&
|
2022-04-18 14:10:17 +02:00
|
|
|
|
(vdparam->csDepthMode != kDepthMode2) &&
|
|
|
|
|
(vdparam->csDepthMode != kDepthMode3) &&
|
2022-04-18 17:04:32 +02:00
|
|
|
|
(vdparam->csDepthMode != kDepthMode4) &&
|
2022-04-22 22:00:25 +01:00
|
|
|
|
(vdparam->csDepthMode != kDepthMode5) &&
|
|
|
|
|
(vdparam->csDepthMode != kDepthMode6))
|
2022-02-05 15:32:44 +01:00
|
|
|
|
return paramErr;
|
|
|
|
|
VPBlock* vpblock = vdparam->csVPBlockPtr;
|
|
|
|
|
/* basically the same as the EBVParms ? */
|
|
|
|
|
vdparam->csPageCount = 0;
|
|
|
|
|
vpblock->vpBaseOffset = 0;
|
|
|
|
|
vpblock->vpBounds.left = 0;
|
|
|
|
|
vpblock->vpBounds.top = 0;
|
|
|
|
|
vpblock->vpBounds.right = HRES;
|
|
|
|
|
vpblock->vpBounds.bottom = VRES;
|
|
|
|
|
vpblock->vpVersion = 0;
|
|
|
|
|
vpblock->vpPackType = 0;
|
|
|
|
|
vpblock->vpPackSize = 0;
|
|
|
|
|
vpblock->vpHRes = 0x480000;
|
|
|
|
|
vpblock->vpVRes = 0x480000;
|
2022-04-18 17:04:32 +02:00
|
|
|
|
vpblock->vpPixelType = chunky; // checkme?
|
2022-04-18 11:51:07 +02:00
|
|
|
|
if (vdparam->csDepthMode == kDepthMode1) {
|
2022-04-18 17:04:32 +02:00
|
|
|
|
vpblock->vpRowBytes = HRES;
|
|
|
|
|
vdparam->csDeviceType = clutType;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vpblock->vpPixelSize = 8;
|
|
|
|
|
vpblock->vpCmpCount = 1;
|
|
|
|
|
vpblock->vpCmpSize = 8;
|
|
|
|
|
} else if (vdparam->csDepthMode == kDepthMode2) {
|
2022-04-18 17:04:32 +02:00
|
|
|
|
vpblock->vpRowBytes = HRES/2;
|
|
|
|
|
vdparam->csDeviceType = clutType;
|
2022-04-18 14:10:17 +02:00
|
|
|
|
vpblock->vpPixelSize = 4;
|
|
|
|
|
vpblock->vpCmpCount = 1;
|
|
|
|
|
vpblock->vpCmpSize = 4;
|
|
|
|
|
} else if (vdparam->csDepthMode == kDepthMode3) {
|
2022-04-18 17:04:32 +02:00
|
|
|
|
vpblock->vpRowBytes = HRES/4;
|
|
|
|
|
vdparam->csDeviceType = clutType;
|
2022-04-18 14:10:17 +02:00
|
|
|
|
vpblock->vpPixelSize = 2;
|
|
|
|
|
vpblock->vpCmpCount = 1;
|
|
|
|
|
vpblock->vpCmpSize = 2;
|
|
|
|
|
} else if (vdparam->csDepthMode == kDepthMode4) {
|
2022-04-18 17:04:32 +02:00
|
|
|
|
vpblock->vpRowBytes = HRES/8;
|
|
|
|
|
vdparam->csDeviceType = clutType;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
vpblock->vpPixelSize = 1;
|
|
|
|
|
vpblock->vpCmpCount = 1;
|
|
|
|
|
vpblock->vpCmpSize = 1;
|
2022-04-18 17:04:32 +02:00
|
|
|
|
} else if (vdparam->csDepthMode == kDepthMode5) {
|
|
|
|
|
vpblock->vpRowBytes = HRES*4;
|
|
|
|
|
vdparam->csDeviceType = directType;
|
|
|
|
|
vpblock->vpPixelSize = 32;
|
|
|
|
|
vpblock->vpCmpCount = 3;
|
|
|
|
|
vpblock->vpCmpSize = 8;
|
2022-04-22 22:00:25 +01:00
|
|
|
|
} else if (vdparam->csDepthMode == kDepthMode6) {
|
|
|
|
|
vpblock->vpRowBytes = HRES*2;
|
|
|
|
|
vdparam->csDeviceType = directType;
|
|
|
|
|
vpblock->vpPixelSize = 16;
|
|
|
|
|
vpblock->vpCmpCount = 3;
|
|
|
|
|
vpblock->vpCmpSize = 5;
|
2022-04-18 11:51:07 +02:00
|
|
|
|
}
|
2022-02-05 15:32:44 +01:00
|
|
|
|
vpblock->vpPlaneBytes = 0;
|
|
|
|
|
ret = noErr;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-18 11:51:07 +02:00
|
|
|
|
/* 0x13 */ /* nothing */
|
|
|
|
|
|
2022-02-05 15:32:44 +01:00
|
|
|
|
case cscGetGammaInfoList: /* 0x14 */
|
|
|
|
|
ret = statusErr;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscRetrieveGammaTable: /* 0x17 */
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
ret = statusErr;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetConvolution: /* 0x18 */
|
|
|
|
|
ret = statusErr;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cscGetMultiConnect: /* 0x1c */
|
|
|
|
|
ret = statusErr;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default: /* always return statusErr for unknown csCode */
|
|
|
|
|
asm volatile(".word 0xfe16\n");
|
|
|
|
|
ret = statusErr;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return ret;
|
|
|
|
|
}
|