1
0
mirror of https://github.com/preble/libpinproc synced 2026-02-24 18:25:23 +01:00

Added kPRMachineTypeWPCAlphanumeric to differentiate between WPC machines needing an Aux port for alphanumeric control versus those using a DMD. Also added default driver code to configure the FPGA's Manager Config register.

This commit is contained in:
gstellenberg
2010-04-10 23:17:55 -05:00
parent 2be7223089
commit 25c4fe2d0b
7 changed files with 79 additions and 9 deletions

View File

@@ -65,11 +65,16 @@ PRDevice* PRDevice::Create(PRMachineType machineType)
if (machineType != kPRMachineCustom &&
// Don't accept if requested type is WPC/WPC95 but read machine is not.
( ((machineType == kPRMachineWPC) || (machineType == kPRMachineWPC95)) &&
( (((machineType == kPRMachineWPC) ||
(machineType == kPRMachineWPC95) ||
(machineType == kPRMachineWPCAlphanumeric)) &&
(readMachineType != kPRMachineWPC &&
readMachineType != kPRMachineWPC95) ||
readMachineType != kPRMachineWPC95 &&
readMachineType != kPRMachineWPCAlphanumeric)) ||
// Also don't accept if the requested is not WPC/WPC95 but the P-ROC is.
(machineType != kPRMachineWPC && machineType != kPRMachineWPC95 &&
(machineType != kPRMachineWPC &&
machineType != kPRMachineWPC95 &&
machineType != kPRMachineWPCAlphanumeric &&
readMachineType == kPRMachineWPC) ) )
{
dev->Close();
@@ -189,6 +194,17 @@ int PRDevice::GetEvents(PREvent *events, int maxEvents)
return i;
}
PRResult PRDevice::ManagerUpdateConfig(PRManagerConfig *managerConfig)
{
const int burstWords = 2;
uint32_t burst[burstWords];
int32_t rc;
DEBUG(PRLog(kPRLogInfo, "Setting Manager Config Register\n"));
this->managerConfig = *managerConfig;
rc = CreateManagerUpdateConfigBurst(burst, managerConfig);
return PrepareWriteData(burst, burstWords);
}
PRResult PRDevice::DriverUpdateGlobalConfig(PRDriverGlobalConfig *driverGlobalConfig)
{
const int burstWords = 4;
@@ -245,7 +261,8 @@ PRResult PRDevice::DriverUpdateState(PRDriverState *driverState)
// TODO: Create some constants that are used both here and in DriverLoadMachineTypeDefaults.
switch (readMachineType) {
kPRMachineWPC:
kPRMachineWPC95: {
kPRMachineWPC95:
kPRMachineWPCAlphanumeric:{
if ((driverState->driverNum >= 40 && driverState->driverNum <= 47) ||
(driverState->driverNum == 32) ||
(driverState->driverNum == 34) ||
@@ -321,6 +338,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
{
case kPRMachineWPC:
case kPRMachineWPC95:
case kPRMachineWPCAlphanumeric:
{
memcpy(mappedDriverGroupEnableIndex,mappedWPCDriverGroupEnableIndex,
sizeof(mappedDriverGroupEnableIndex));
@@ -485,6 +503,13 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
else
driverGlobalConfig = globals;
// If WPCAlphanumeric, select Aux functionality for the dual-purpose Aux/DMD
// pins.
managerConfig.reuse_dmd_data_for_aux = (machineType == kPRMachineWPCAlphanumeric);
managerConfig.invert_dipswitch_1 = false;
ManagerUpdateConfig(&managerConfig);
return res;
}