Пример #1
0
APTR
AHIAllocVec( ULONG byteSize, ULONG requirements )
{
    switch( MixBackend )
    {
    case MB_NATIVE:
    case MB_MORPHOS:
        return AllocVec( byteSize, requirements );

    case MB_WARPUP:
    {
        APTR v;

        v = AllocVec32( byteSize, requirements );
        CacheClearU();
        return v;
    }
    }

    Req( "Internal error: Unknown MixBackend in AHIAllocVec()." );
    return NULL;
}
Пример #2
0
void EventLoop(void) {
  ULONG signal  = NULL, rc;
  WORD  code;
  BOOL  running = TRUE;

  GetAttr( WINDOW_SigMask, WO_Window, &signal );
  if(signal) {
    do {
      if(Wait(signal | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C ) {
        running=FALSE;
      }

      while (( rc = CA_HandleInput( WO_Window, &code)) != WMHI_LASTMSG) {

        switch(rc & WMHI_CLASSMASK) {

          case WMHI_CLOSEWINDOW:
            running=FALSE;
            break;

          case WMHI_GADGETUP:
          case WMHI_MENUPICK:
          {

            if((rc & WMHI_CLASSMASK) == WMHI_MENUPICK) {
              struct MenuItem *mi;
              
              mi = ItemAddress(Menu, rc & WMHI_MENUMASK);
              
              if(mi) {
                rc = (ULONG) GTMENUITEM_USERDATA(mi);
              }
            }


            switch( rc & WMHI_GADGETMASK) {

#if 0
              case ACTID_OPEN:
              {
                if(DoMethod( openreq, FRM_DOREQUEST ) == FRQ_OK) {
                  char *file = NULL;
    
                  GetAttr( FRQ_Path, openreq, (ULONG *) &file);
                  NewSettings(file);
                  GUINewSettings();
                }
                break;
              }
    
              case ACTID_SAVEAS:
              {
                FillUnit();
                if(DoMethod( savereq, FRM_DOREQUEST ) == FRQ_OK) {
                  char *file = NULL;
    
                  GetAttr( FRQ_Path, savereq, (ULONG *) &file);
                  SaveSettings(file, UnitList);
                  if(SaveIcons) {
                    WriteIcon(file);
                  }
                }
                break;
              
              }
              
#endif
              case ACTID_ABOUT:
                Req( (char *) msgButtonOK,
                    (char *) msgTextCopyright,
                    "",(char *) msgTextProgramName,
                    "1996-2003 Martin Blom" );
                break;

              case ACTID_SAVE:
                FillUnit();
                SaveSettings(ENVFILE, UnitList);
                SaveSettings(ENVARCFILE, UnitList);
                running=FALSE;
                break;
    
              case ACTID_USE:
                FillUnit();
                SaveSettings(ENVFILE, UnitList);
                running=FALSE;
                break;
    
              case ACTID_QUIT:
                running=FALSE;
                break;
    
              case ACTID_DEFAULT:
                SetAttrs( WO_Window, WA_BusyPointer, TRUE, TAG_DONE);
                NewSettings(NULL);    // This is VERY slow!!
                SetAttrs( WO_Window, WA_BusyPointer, FALSE, TAG_DONE);
                GUINewSettings();
                break;
    
              case ACTID_LASTSAVED:
                NewSettings(ENVARCFILE);
                GUINewSettings();
                break;
    
              case ACTID_RESTORE:
                NewSettings(args.from);
                GUINewSettings();
                break;

              case ACTID_ICONS:
              {
                struct MenuItem *item;
    
                item = FindMenuItem(ACTID_ICONS);
    
                if(item) {
                  if(item->Flags & CHECKED)
                    SaveIcons = TRUE;
                  else
                    SaveIcons = FALSE;
                }
                break;
              }

#if 0
    
              case ACTID_HELP: {
                APTR lock = BGUI_LockWindow(Window);
                if(!BGUI_Help( Window, HELPFILE, "AHI", NULL)) {
                  Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
                }
                BGUI_UnlockWindow(lock);
                break;
              }
    
              case ACTID_GUIDE: {
                APTR lock = BGUI_LockWindow(Window);
                if(!BGUI_Help( Window, HELPFILE, NULL, NULL)) {
                  Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
                }
                BGUI_UnlockWindow(lock);
                break;
              }
    
              case ACTID_HELPINDEX: {
                APTR lock = BGUI_LockWindow(Window);
                if(!BGUI_Help( Window, HELPFILE, "Concept Index", 0)) {
                  Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
                }
                BGUI_UnlockWindow(lock);
                break;
              }
#endif
    
              case ACTID_UNIT: {
                FillUnit();
                NewUnit(code);
                GUINewUnit();
                break;
              }
    
              case ACTID_MODE: {
                FillUnit();
                NewMode(code);
                GUINewMode();
                break;
              }

              case ACTID_DEBUG:
              case ACTID_SURROUND:
              case ACTID_ECHO:
              case ACTID_CPULIMIT:
              case ACTID_CLIPMV:
              {
                ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;
                ULONG clip = FALSE;
    
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_DEBUG],    &debug);
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_SURROUND], &surround);
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_ECHO],     &echo);
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_CLIPMV],   &clip);
                GetAttr( INTEGER_Number, Window_Objs[ACTID_CPULIMIT], &cpu);
    
                globalprefs.ahigp_DebugLevel      = debug;
                globalprefs.ahigp_DisableSurround = surround;
                globalprefs.ahigp_DisableEcho     = (echo == 2);
                globalprefs.ahigp_FastEcho        = (echo == 1);
                globalprefs.ahigp_MaxCPU = (cpu << 16) / 100;
                globalprefs.ahigp_ClipMasterVolume= clip;
    
                break;
              }
            } /* switch(GADGETMASK) */
          }
        } /* switch(CLASSMASK) */
      } /* HandleInput */
    } while(running);
  }
}
Пример #3
0
ULONG ASMCALL
DevOpen ( REG(d0, ULONG unit),
          REG(d1, ULONG flags),
          REG(a1, struct AHIRequest *ioreq),
          REG(a6, struct AHIBase *AHIBase) )
{
  ULONG rc = 0;
  BOOL  error = FALSE;
  struct AHIDevUnit *iounit=NULL;

  if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)
  {
    KPrintF("OpenDevice(%ld, 0x%08lx, %ld)", unit, ioreq, flags);
  }

// Check if size includes the ahir_Version field

  if(ioreq->ahir_Std.io_Message.mn_Length < (sizeof(struct IOStdReq) + 2))
  {
    Req( "Bad parameters to OpenDevice()." );
    ioreq->ahir_Std.io_Error=IOERR_OPENFAIL;
    return IOERR_OPENFAIL;
  }

// One more check...

  if((unit != AHI_NO_UNIT) && (ioreq->ahir_Version >= Version))
  {
    if(ioreq->ahir_Std.io_Message.mn_Length < sizeof(struct AHIRequest))
    {
      Req( "Bad parameters to OpenDevice()." );
      ioreq->ahir_Std.io_Error=IOERR_OPENFAIL;
      return IOERR_OPENFAIL;
    }
  }

  AHIBase->ahib_Library.lib_OpenCnt++;
  ObtainSemaphore(&AHIBase->ahib_Lock);

  if( ! (flags & AHIDF_NOMODESCAN))
  {
    // Load database if not already loaded

    if(AHI_NextAudioID(AHI_INVALID_ID) == AHI_INVALID_ID)
    {
      AHI_LoadModeFile("DEVS:AudioModes");
    }
  }

  if( ioreq->ahir_Version > Version)
    error=TRUE;
  else
  {
    if(unit < AHI_UNITS)
    {
      iounit=InitUnit(unit,AHIBase);
      if(!iounit) 
        error=TRUE;
    }
    else if(unit == AHI_NO_UNIT)
      InitUnit(unit,AHIBase);
  }

  if(!error)
  {
    ioreq->ahir_Std.io_Unit=(struct Unit *) iounit;
    if(iounit)    // Is NULL for AHI_NO_UNIT
      iounit->Unit.unit_OpenCnt++;
    AHIBase->ahib_Library.lib_OpenCnt++;
    AHIBase->ahib_Library.lib_Flags &=~LIBF_DELEXP;
  }
  else
  {
    rc=IOERR_OPENFAIL;
    ioreq->ahir_Std.io_Error=IOERR_OPENFAIL;
    ioreq->ahir_Std.io_Device=(struct Device *) -1;
    ioreq->ahir_Std.io_Unit=(struct Unit *) -1;
  }
  ReleaseSemaphore(&AHIBase->ahib_Lock);
  AHIBase->ahib_Library.lib_OpenCnt--;

  if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)
  {
    KPrintF("=>%ld\n",rc);
  }

  return rc;
}
Пример #4
0
void EventLoop(void) {
  ULONG signal  = NULL, rc;
  BOOL  running = TRUE;

  GetAttr( WINDOW_SigMask, WO_Window, &signal );
  if(signal) {
    do {
      if(Wait(signal | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C ) {
        running=FALSE;
      }

      while (( rc = HandleEvent( WO_Window )) != WMHI_NOMORE ) {
        switch(rc) {

          case WMHI_CLOSEWINDOW:
            running=FALSE;
            break;

          case ACTID_OPEN:
          {
            if(DoMethod( openreq, FRM_DOREQUEST ) == FRQ_OK) {
              char *file = NULL;

              GetAttr( FRQ_Path, openreq, (ULONG *) &file);
              NewSettings(file);
              GUINewSettings();
            }
            break;
          }

          case ACTID_SAVEAS:
          {
            FillUnit();
            if(DoMethod( savereq, FRM_DOREQUEST ) == FRQ_OK) {
              char *file = NULL;

              GetAttr( FRQ_Path, savereq, (ULONG *) &file);
              SaveSettings(file, UnitList);
              if(SaveIcons) {
                WriteIcon(file);
              }
            }
            break;
          
          }
          
          case ACTID_ABOUT:
            Req( (char *) msgButtonOK,
                (char *) msgTextCopyright,
                ISEQ_C,  msgTextProgramName,
                "1996-2003 Martin Blom" );
            break;

          case ACTID_SAVE:
            FillUnit();
            SaveSettings(ENVFILE, UnitList);
            SaveSettings(ENVARCFILE, UnitList);
            running=FALSE;
            break;

          case ACTID_USE:
            FillUnit();
            SaveSettings(ENVFILE, UnitList);
            running=FALSE;
            break;

          case ACTID_QUIT:
            running=FALSE;
            break;

          case ACTID_DEFAULT:
            NewSettings(NULL);
            GUINewSettings();
            break;

          case ACTID_LASTSAVED:
            NewSettings(ENVARCFILE);
            GUINewSettings();
            break;

          case ACTID_RESTORE:
            NewSettings(args.from);
            GUINewSettings();
            break;

          case ACTID_ICONS:
          {
            struct MenuItem *item;

            item = FindMenuItem(ACTID_ICONS);

            if(item) {
              if(item->Flags & CHECKED)
                SaveIcons = TRUE;
              else
                SaveIcons = FALSE;
            }
            break;
          }

          case ACTID_HELP: {
            APTR lock = BGUI_LockWindow(window);
            if(!BGUI_Help( window, HELPFILE, "AHI", NULL)) {
              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
            }
            BGUI_UnlockWindow(lock);
            break;
          }

          case ACTID_GUIDE: {
            APTR lock = BGUI_LockWindow(window);
            if(!BGUI_Help( window, HELPFILE, NULL, NULL)) {
              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
            }
            BGUI_UnlockWindow(lock);
            break;
          }

          case ACTID_HELPINDEX: {
            APTR lock = BGUI_LockWindow(window);
            if(!BGUI_Help( window, HELPFILE, "Concept Index", 0)) {
              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
            }
            BGUI_UnlockWindow(lock);
            break;
          }

          case ACTID_UNIT: {
            ULONG unit;

            FillUnit();
            GetAttr( CYC_Active, Window_Objs[rc], &unit);
            NewUnit(unit);
            GUINewUnit();
            break;
          }

          case ACTID_MODE: {
            ULONG mode;

            FillUnit();
            GetAttr( LISTV_LastClickedNum, Window_Objs[rc], &mode);
            NewMode(mode);
            GUINewMode();
            break;
          }

          case ACTID_DEBUG:
          case ACTID_SURROUND:
          case ACTID_ECHO:
          case ACTID_CPULIMIT:
          case ACTID_CLIPMV:
          {
            ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;
            ULONG clip = FALSE;

            GetAttr( CYC_Active,   Window_Objs[ACTID_DEBUG],    &debug);
            GetAttr( CYC_Active,   Window_Objs[ACTID_SURROUND], &surround);
            GetAttr( CYC_Active,   Window_Objs[ACTID_ECHO],     &echo);
            GetAttr( CYC_Active,   Window_Objs[ACTID_CLIPMV],   &clip);
            GetAttr( SLIDER_Level, Window_Objs[ACTID_CPULIMIT], &cpu);

            globalprefs.ahigp_DebugLevel      = debug;
            globalprefs.ahigp_DisableSurround = surround;
            globalprefs.ahigp_DisableEcho     = (echo == 2);
            globalprefs.ahigp_FastEcho        = (echo == 1);
            globalprefs.ahigp_MaxCPU = (cpu << 16) / 100;
            globalprefs.ahigp_ClipMasterVolume= clip;

            break;
          }
        }
      }
    } while(running);
  }
}
Пример #5
0
struct ISAPNPBase* ASMCALL
initRoutine( REG( d0, struct ISAPNPBase* res ),
             REG( a0, APTR                    seglist ),
             REG( a6, struct ExecBase*        sysbase ) )
{
    D(bug("[ISAPNP] Init\n"));
/*  SysBase = sysbase;*/

    if(OpenLibs() )
    {
        // Set up the ISAPNPBase structure

        res->m_Library.lib_Node.ln_Type = NT_RESOURCE;
        res->m_Library.lib_Node.ln_Name = (STRPTR) ResName;
        res->m_Library.lib_Flags        = LIBF_SUMUSED | LIBF_CHANGED;
        res->m_Library.lib_Version      = VERSION;
        res->m_Library.lib_Revision     = REVISION;
        res->m_Library.lib_IdString     = (STRPTR) IDString;

        NewList( &res->m_Cards );

	/* Base address, on i386 we don't have any mapping
        res->m_Base        = NULL; */
        res->m_RegReadData = 0x0000;

        if( ! ISAPNP_ScanCards( res ) )
        {
              // No cards found

              Req( "No PnP ISA cards found." );
              FreeISAPNPBase( res );
        }
        else
        {
            if( ! PatchBrokenCards( res ) )
            {
                FreeISAPNPBase( res );
            }
            else
            {
                struct ISAPNP_Card* card;
  
                card = ISAPNP_AllocCard( res );
  
                if( card == NULL )
                {
                  Req( "Out of memory!" );
                  FreeISAPNPBase( res );
                }
                else
                {
                  static const char descr[] = "Non-PnP devices";
                  char*             d;                
                  
                  d = AllocVec( sizeof( descr ), MEMF_PUBLIC );
                  
                  if( d != NULL )
                  {
                    CopyMem( (void*) descr, d, sizeof( descr ) );
                    card->isapnpc_Node.ln_Name = d;
                  }
  
                  card->isapnpc_ID.isapnpid_Vendor[ 0 ] = '?';
                  card->isapnpc_ID.isapnpid_Vendor[ 1 ] = '?';
                  card->isapnpc_ID.isapnpid_Vendor[ 2 ] = '?';
                  card->isapnpc_SerialNumber = -1;
  
                  // Add *first*
                  AddHead( &res->m_Cards, (struct Node*) card );
  
                  // Let's see if we're to disable any cards or devices etc
/* TODO: We will start up early because we can have even ISA PnP video
         cards, disk controllers, etc. Because of this we can't load
	 any list of disabled devices. Think off what to do with them
	 is really a big TODO.
                  if( ! HandleToolTypes( current_binding.cb_ToolTypes, 
                                         card, res ) )
                  {
                    // Error requester already displayed.
                    FreeISAPNPBase( res );
                  }
                  else
                  {*/
                    if( ! ISAPNP_ConfigureCards( res ) )
                    {
                      // Unable to configure cards
  
                      Req( "Unable to configure the cards. This is most likely\n"
                           "because of an unresolvable hardware conflict.\n\n"
                           "Use the DISABLE_DEVICE tool type to disable one of\n"
                           "the devices in conflict." );
                      FreeISAPNPBase( res );
                    }
                    else
                      ISAPNPBase = res;
/*                }*/
                }
            }
        }
    }

    return ISAPNPBase;

}
Пример #6
0
BOOL
DriverInit( struct DriverBase* AHIsubBase )
{
  struct FilesaveBase* FilesaveBase = (struct FilesaveBase*) AHIsubBase;

  FilesaveBase->dosbase = OpenLibrary( DOSNAME, 37 );
  FilesaveBase->gfxbase = OpenLibrary( GRAPHICSNAME, 37 );
  FilesaveBase->aslbase = OpenLibrary( AslName, 37);
  FilesaveBase->dtsbase = OpenLibrary( "datatypes.library" ,39 );

  if( DOSBase == NULL )
  {
    Req( "Unable to open '" DOSNAME "' version 37.\n" );
    return FALSE;
  }

  if( GfxBase == NULL )
  {
    Req( "Unable to open '" GRAPHICSNAME "' version 37.\n" );
    return FALSE;
  }

// Don't fail if these ones don't open!

  if( AslBase == NULL )
  {
    Req( "Unable to open '" AslName "' version 37.\n" );
  }

#if 0
  if( DataTypesBase == NULL )
  {
    Req( "Unable to open 'datatypes.library' version 39.\n" );
  }
#endif

#ifdef __AMIGAOS4__
  DOSBase  = (struct DosLibrary*) OpenLibrary( DOSNAME, 37 );

  if( DOSBase == NULL )
  {
    Req( "Unable to open 'dos.library' version 37.\n" );
    return FALSE;
  }

  if ((IDOS = (struct DOSIFace *) GetInterface((struct Library *) DOSBase, "main", 1, NULL)) == NULL)
  {
       Req("Couldn't open IDOS interface!\n");
       return FALSE;
  }

  if ((IAHIsub = (struct AHIsubIFace *) GetInterface((struct Library *) AHIsubBase, "main", 1, NULL)) == NULL)
  {
       Req("Couldn't open IAHIsub interface!\n");
       return FALSE;
  }
  
  if ((IUtility = (struct UtilityIFace *) GetInterface((struct Library *) UtilityBase, "main", 1, NULL)) == NULL)
  {
       Req("Couldn't open IUtility interface!\n");
       return FALSE;
  }
  
  if ((IAsl = (struct AslIFace *) GetInterface((struct Library *) AslBase, "main", 1, NULL)) == NULL)
  {
      Req("Couldn't open IAsl interface!\n");
      return FALSE;
  }
  
  if ((IDataTypes = (struct DataTypesIFace *) GetInterface((struct Library *) DataTypesBase, "main", 1, NULL)) == NULL)
  {
      Req("Couldn't open IDataTypes interface!\n");
      return FALSE;
  }
#endif

  return TRUE;
}
Пример #7
0
struct EMU10kxData*
AllocDriverData( struct pci_dev*    dev,
		 struct DriverBase* AHIsubBase )
#endif
{
  struct EMU10kxBase* EMU10kxBase = (struct EMU10kxBase*) AHIsubBase;
  struct EMU10kxData* dd;
  UWORD               command_word;

  // FIXME: This should be non-cachable, DMA-able memory
  dd = AllocVec( sizeof( *dd ), MEMF_PUBLIC | MEMF_CLEAR );

  if( dd == NULL )
  {
    Req( "Unable to allocate driver structure." );
    return NULL;
  }


  dd->ahisubbase = AHIsubBase;

  dd->interrupt.is_Node.ln_Type = INTERRUPT_NODE_TYPE;
  dd->interrupt.is_Node.ln_Pri  = 0;
  dd->interrupt.is_Node.ln_Name = (STRPTR) LibName;
  dd->interrupt.is_Code         = (void(*)(void)) &emu10kxinterrupt;
  dd->interrupt.is_Data         = (APTR) dd;

  dd->playback_interrupt.is_Node.ln_Type = INTERRUPT_NODE_TYPE;
  dd->playback_interrupt.is_Node.ln_Pri  = 0;
  dd->playback_interrupt.is_Node.ln_Name = (STRPTR) LibName;
  dd->playback_interrupt.is_Code         = (void(*)(void)) &playbackinterrupt;
  dd->playback_interrupt.is_Data         = (APTR) dd;

  dd->record_interrupt.is_Node.ln_Type = INTERRUPT_NODE_TYPE;
  dd->record_interrupt.is_Node.ln_Pri  = 0;
  dd->record_interrupt.is_Node.ln_Name = (STRPTR) LibName;
  dd->record_interrupt.is_Code         = (void(*)(void)) &recordinterrupt;
  dd->record_interrupt.is_Data         = (APTR) dd;
  
  dd->card.pci_dev = dev;

//  if( pci_set_dma_mask(dd->card.pci_dev, EMU10K1_DMA_MASK) )
//  {
//    printf( "Unable to set DMA mask for card." );
//    goto error;
//  }

  #ifdef __AMIGAOS4__
  command_word = dev->ReadConfigWord( PCI_COMMAND );  
  command_word |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
  dev->WriteConfigWord( PCI_COMMAND, command_word );
  #else
  command_word = pci_read_config_word( PCI_COMMAND, dd->card.pci_dev );
  command_word |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
  pci_write_config_word( PCI_COMMAND, command_word, dd->card.pci_dev );
  #endif

  dd->pci_master_enabled = TRUE;

  // FIXME: How about latency/pcibios_set_master()??

  #ifdef __AMIGAOS4__
  dd->card.iobase  = dev->GetResourceRange(0)->BaseAddress;
  dd->card.length  = ~( dev->GetResourceRange(0)->Size & PCI_BASE_ADDRESS_IO_MASK );
  dd->card.irq     = dev->MapInterrupt();
  dd->card.chiprev = dev->ReadConfigByte( PCI_REVISION_ID);
  dd->card.model   = dev->ReadConfigWord( PCI_SUBSYSTEM_ID);
  dd->card.is_audigy = ( dev->ReadConfigWord( PCI_DEVICE_ID) == PCI_DEVICE_ID_CREATIVE_AUDIGY );
  dd->card.is_aps   = ( dev->ReadConfigLong( PCI_SUBSYSTEM_VENDOR_ID)
		       == EMU_APS_SUBID );

  dev->OutLong(dd->card.iobase + IPR, 0xffffffff);
  dev->OutLong(dd->card.iobase + INTE, 0);

  AddIntServer(dev->MapInterrupt(), &dd->interrupt );
  #else
  dd->card.iobase  = dev->base_address[ 0 ];
  dd->card.length  = ~( dev->base_size[ 0 ] & PCI_BASE_ADDRESS_IO_MASK );
  dd->card.irq     = dev->irq;
  dd->card.chiprev = pci_read_config_byte( PCI_REVISION_ID, dd->card.pci_dev );
  dd->card.model   = pci_read_config_word( PCI_SUBSYSTEM_ID, dd->card.pci_dev );
  dd->card.is_audigy = ( dev->device == PCI_DEVICE_ID_CREATIVE_AUDIGY );
  dd->card.is_aps   = ( pci_read_config_long( PCI_SUBSYSTEM_VENDOR_ID,
					     dd->card.pci_dev )
		       == EMU_APS_SUBID );

  pci_add_intserver( &dd->interrupt, dd->card.pci_dev );
  #endif

  dd->interrupt_added = TRUE;

  /* Initialize chip */
  if( emu10k1_init( &dd->card ) < 0 )
  {
    Req( "Unable to initialize EMU10kx subsystem.");
    return NULL;
  }

  dd->emu10k1_initialized = TRUE;

    
  /* Initialize mixer */

  emu10k1_writeac97( &dd->card, AC97_RESET, 0L);

  Delay( 1 );

  if (emu10k1_readac97( &dd->card, AC97_RESET ) & 0x8000) {
    Req( "ac97 codec not present.");
    return NULL;
  }


  dd->input          = 0;
  dd->output         = 0;
  dd->monitor_volume = Linear2MixerGain( 0, &dd->monitor_volume_bits );
  dd->input_gain     = Linear2RecordGain( 0x10000, &dd->input_gain_bits );
  dd->output_volume  = Linear2MixerGain( 0x10000, &dd->output_volume_bits );

  // No attenuation and natural tone for all outputs
  emu10k1_writeac97( &dd->card, AC97_MASTER_VOL_STEREO, 0x0000 );
  emu10k1_writeac97( &dd->card, AC97_HEADPHONE_VOL,     0x0000 );
  emu10k1_writeac97( &dd->card, AC97_MASTER_VOL_MONO,   0x0000 );
  emu10k1_writeac97( &dd->card, AC97_MASTER_TONE,       0x0f0f );

  emu10k1_writeac97( &dd->card, AC97_RECORD_GAIN,       0x0000 );
  emu10k1_writeac97( &dd->card, AC97_RECORD_SELECT,     InputBits[ 0 ] );

  emu10k1_writeac97( &dd->card, AC97_PCMOUT_VOL,        0x0808 );
  emu10k1_writeac97( &dd->card, AC97_PCBEEP_VOL,        0x0000 );

  emu10k1_writeac97( &dd->card, AC97_LINEIN_VOL,        0x0808 );
  emu10k1_writeac97( &dd->card, AC97_MIC_VOL,           AC97_MUTE | 0x0008 );
  emu10k1_writeac97( &dd->card, AC97_CD_VOL,            0x0808 );
  emu10k1_writeac97( &dd->card, AC97_AUX_VOL,           0x0808 );
  emu10k1_writeac97( &dd->card, AC97_PHONE_VOL,         0x0008 );
  emu10k1_writeac97( &dd->card, AC97_VIDEO_VOL,         0x0808 );


  if (emu10k1_readac97( &dd->card, AC97_EXTENDED_ID ) & 0x0080 )
  {
    sblive_writeptr( &dd->card, AC97SLOT, 0, AC97SLOT_CNTR | AC97SLOT_LFE);
    emu10k1_writeac97( &dd->card, AC97_SURROUND_MASTER, 0x0 );
  }
  
  return dd;
}
Пример #8
0
// ---------------------------------------------------------------------------
// CxaTM_RMMessage::link
// Purpose : Call to BMSG_LINK_.
// This function will retry any retriable errors such as FENOLCB (30).
// Parameters:
//  pv_maxretries - maximum retries for retriable errors.
//  Returns error from BMSG_LINK_ call.
// ---------------------------------------------------------------------------
short CxaTM_RMMessage::link(int32 pv_maxretries)

{
    short lv_ret = 0;
    int32 lv_retries = 0;
    bool lv_exit = false;
    TM_Txid_Internal *lp_transid = (TM_Txid_Internal *) &xid()->data[0];

    XATrace(XATM_TraceExit, ("CxaTM_RMMessage::link ENTRY : ID (%d,%d), linker "
            "tag(rmid) %d.\n", lp_transid->iv_node, lp_transid->iv_seq_num, 
            ip_RM->getRmid()));

    do {
         lv_ret = BMSG_LINK_(ip_RM->getRmPhandle(),     // phandle, 
                           &iv_msgid,                   // msgid
                           NULL,                        // reqctrl
                           0,                           // reqctrlsize
                           NULL,                        // replyctrl
                           0,                           // replyctrlmax
                           (char *) Req(),              // reqdata
                           ReqLen(),                    // reqdatasize
                           (char *) Rsp(),              // replydata
                           RspLen(),                    // replydatamax
                           ip_RM->getRmid(),            // linkertag
                           TSE_LINK_PRIORITY,           // pri
                           0,                           // xmitclass
                           BMSG_LINK_LDONEQ);           // linkopts

       lv_retries++;
       if (lv_ret == FENOLCB && 
          //((pv_maxretries == -1 && (lv_retries % TM_LINKRETRY_RETRIES == 0)) ||
          (pv_maxretries == -1 ||
           (pv_maxretries > 0 && (lv_retries <= pv_maxretries))))
       {  // Message Descriptor depletion.  This means we ran out of MDs.
          // This is retriable, and we want to slow down the TM to allow
          // some of the outstanding requests to complete.
          XATrace(XATM_TraceError, ("CxaTM_RMMessage::link BMSG_LINK_ error %d, "
                       "linker tag(rmid) %d, retires %d/%d - Pausing thread for "
                       "%dms before retrying.\n", lv_ret, ip_RM->getRmid(), 
                       lv_retries, pv_maxretries, TM_LINKRETRY_PAUSE));
          tm_log_event(DTM_TM_LINK_PAUSED, SQ_LOG_WARNING, "DTM_TM_LINK_PAUSED", 
                   lv_ret, -1, lp_transid->iv_node, lp_transid->iv_seq_num, -1, -1, -1, -1, lv_retries, 
                   -1, -1, -1, -1, TM_LINKRETRY_PAUSE /*pause in ms*/, ip_RM->getRmid());
          SB_Thread::Sthr::sleep(TM_LINKRETRY_PAUSE); // in msec
       }
       if (lv_ret != FENOLCB)
          lv_exit = true;
       else
          if (pv_maxretries > 0 && lv_retries >= pv_maxretries)
             lv_exit = true;

    } while (!lv_exit);

    if (lv_ret)
    {
       XATrace(XATM_TraceExit, ("CxaTM_RMMessage::link EXIT : returning error %d.\n", lv_ret));
    }
    else
    {
       XATrace(XATM_TraceExit, ("CxaTM_RMMessage::link EXIT : returning msgid %d.\n", iv_msgid));
    }
    return lv_ret;
} //CxaTM_RMMessage::link
Пример #9
0
ULONG
_DevOpen ( struct AHIRequest* ioreq,
           ULONG              unit,
           ULONG              flags,
           struct AHIBase*    AHIBase )
{
    ULONG rc = 0;
    BOOL  error = FALSE;
    struct AHIDevUnit *iounit=NULL;

    if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)
    {
        KPrintF("OpenDevice(%ld, 0x%08lx, %ld)", unit, (ULONG) ioreq, flags);
    }

// Check if size includes the ahir_Version field

    if(ioreq->ahir_Std.io_Message.mn_Length < (sizeof(struct IOStdReq) + 2))
    {
        Req( "Bad parameters to OpenDevice()." );
        ioreq->ahir_Std.io_Error=IOERR_OPENFAIL;
        return IOERR_OPENFAIL;
    }

// One more check...

    if((unit != AHI_NO_UNIT) && (ioreq->ahir_Version >= 4))
    {
        if(ioreq->ahir_Std.io_Message.mn_Length < sizeof(struct AHIRequest))
        {
            Req( "Bad parameters to OpenDevice()." );
            ioreq->ahir_Std.io_Error=IOERR_OPENFAIL;
            return IOERR_OPENFAIL;
        }
        else
        {
            /*       KPrintF( "Tagging %08lx on task %08lx\n", ioreq, FindTask(0)); */
            ioreq->ahir_Private[1] = (ULONG) ioreq;
        }
    }

    AHIBase->ahib_Library.lib_OpenCnt++;

    ObtainSemaphore(&AHIBase->ahib_Lock);

    if( ! (flags & AHIDF_NOMODESCAN))
    {
        // Load database if not already loaded

        if(AHI_NextAudioID(AHI_INVALID_ID) == (ULONG) AHI_INVALID_ID)
        {
            AHI_LoadModeFile("DEVS:AudioModes");

            // Be quiet here. - Piru
            if (IS_MORPHOS)
            {
                APTR *windowptr = &((struct Process *) FindTask(NULL))->pr_WindowPtr;
                APTR oldwindowptr = *windowptr;
                *windowptr = (APTR) -1;

                AHI_LoadModeFile("MOSSYS:DEVS/AudioModes");

                *windowptr = oldwindowptr;
            }
        }
    }

    if( ioreq->ahir_Version > AHIBase->ahib_Library.lib_Version)
        error=TRUE;
    else
    {
        if(unit < AHI_UNITS)
        {
            iounit=InitUnit(unit,AHIBase);
            if(!iounit)
                error=TRUE;
        }
        else if(unit == AHI_NO_UNIT)
            InitUnit(unit,AHIBase);
    }

    if(!error)
    {
        ioreq->ahir_Std.io_Unit=(struct Unit *) iounit;
        if(iounit)    // Is NULL for AHI_NO_UNIT
            iounit->Unit.unit_OpenCnt++;
        AHIBase->ahib_Library.lib_OpenCnt++;
        AHIBase->ahib_Library.lib_Flags &=~LIBF_DELEXP;
    }
    else
    {
        rc=IOERR_OPENFAIL;
        ioreq->ahir_Std.io_Error=IOERR_OPENFAIL;
        ioreq->ahir_Std.io_Device=(struct Device *) -1;
        ioreq->ahir_Std.io_Unit=(struct Unit *) -1;
    }

    ReleaseSemaphore(&AHIBase->ahib_Lock);

    AHIBase->ahib_Library.lib_OpenCnt--;

    if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)
    {
        KPrintF("=>%ld\n",rc);
    }

    return rc;
}
Пример #10
0
/*
 * DD_InitDGLDriver
 *  Returns true if no required functions are missing.
 *  All exported DGL functions should have the DG_ prefix (Driver/Graphics).
 */
int DD_InitDGLDriver(void)
{
	Req(Init);
	Req(Shutdown);

	// Viewport.
	Req(Clear);
	Req(Show);
	Req(Viewport);
	Req(Scissor);

	// State.
	Req(GetInteger);
	Req(GetIntegerv);
	Req(SetInteger);
	Req(SetFloatv);
	Req(GetString);
	Req(Enable);
	Req(Disable);
	Req(EnableArrays);
	Req(DisableArrays);
	Req(Arrays);
	Req(UnlockArrays);
	Req(Func);

	// Textures.
	Req(NewTexture);
	Req(DeleteTextures);
	Req(TexImage);
	Req(TexParameter);
	Req(GetTexParameterv);
	Req(Palette);
	Req(Bind);

	// Matrix operations.
	Req(MatrixMode);
	Req(PushMatrix);
	Req(PopMatrix);
	Req(LoadIdentity);
	Req(Translatef);
	Req(Rotatef);
	Req(Scalef);
	Req(Ortho);
	Req(Perspective);

	// Colors.
	Req(Color3ub);
	Req(Color3ubv);
	Req(Color4ub);
	Req(Color4ubv);
	Req(Color3f);
	Req(Color3fv);
	Req(Color4f);
	Req(Color4fv);

	// Drawing.
	Req(Begin);
	Req(End);
	Req(Vertex2f);
	Req(Vertex2fv);
	Req(Vertex3f);
	Req(Vertex3fv);
	Req(TexCoord2f);
	Req(TexCoord2fv);
	Req(MultiTexCoord2f);
	Req(MultiTexCoord2fv);
	Req(Vertices2ftv);
	Req(Vertices3ftv);
	Req(Vertices3fctv);
	Req(Arrays);
	Req(UnlockArrays);
	Req(ArrayElement);
	Req(DrawElements);

	// Miscellaneous.
	Req(Grab);
	Req(Fog);
	Req(Fogv);
	Req(Project);
	Req(ReadPixels);

	// All was OK.
	return true;
}
Пример #11
0
BOOL
DriverInit( struct DriverBase* ahisubbase )
{
  struct EMU10kxBase* EMU10kxBase = (struct EMU10kxBase*) ahisubbase;
  struct pci_dev*     dev;
  int                 card_no;

  /*** Libraries etc. ********************************************************/

  AHIsubBase = ahisubbase;
  
  DOSBase  = (struct DosLibrary*) OpenLibrary( DOSNAME, 37 );
  OpenPciBase = OpenLibrary( "openpci.library", 1 );

  if( DOSBase == NULL )
  {
    Req( "Unable to open 'dos.library' version 37.\n" );
    return FALSE;
  }

  if( OpenPciBase == NULL )
  {
    Req( "Unable to open 'openpci.library' version 1.\n" );
    return FALSE;
  }

  InitSemaphore( &EMU10kxBase->semaphore );


  /*** Count cards ***********************************************************/

  EMU10kxBase->cards_found = 0;
  dev = NULL;

  while( ( dev = pci_find_device( PCI_VENDOR_ID_CREATIVE,
				  PCI_DEVICE_ID_CREATIVE_EMU10K1,
				  dev ) ) != NULL )
  {
    ++EMU10kxBase->cards_found;
  }
  
  // Fail if no hardware (prevents the audio modes form being added to
  // the database if the driver cannot be used).

  if( EMU10kxBase->cards_found == 0 )
  {
    Req( "No SoundBlaster Live! card present.\n" );
    return FALSE;
  }

  /*** CAMD ******************************************************************/
  
  InitSemaphore( &EMU10kxBase->camd.Semaphore );
  EMU10kxBase->camd.Semaphore.ss_Link.ln_Pri  = 0;
  EMU10kxBase->camd.Semaphore.ss_Link.ln_Name = EMU10KX_CAMD_SEMAPHORE;
  AddSemaphore( &EMU10kxBase->camd.Semaphore );
  
  EMU10kxBase->camd.Cards    = EMU10kxBase->cards_found;
  EMU10kxBase->camd.Version  = VERSION;
  EMU10kxBase->camd.Revision = REVISION;

  EMU10kxBase->camd.OpenPortFunc.h_Entry    = HookEntry;
  EMU10kxBase->camd.OpenPortFunc.h_SubEntry = OpenCAMDPort;
  EMU10kxBase->camd.OpenPortFunc.h_Data     = NULL;

  EMU10kxBase->camd.ClosePortFunc.h_Entry    = HookEntry;
  EMU10kxBase->camd.ClosePortFunc.h_SubEntry = (HOOKFUNC) CloseCAMDPort;
  EMU10kxBase->camd.ClosePortFunc.h_Data     = NULL;

  EMU10kxBase->camd.ActivateXmitFunc.h_Entry    = HookEntry;
  EMU10kxBase->camd.ActivateXmitFunc.h_SubEntry = (HOOKFUNC) ActivateCAMDXmit;
  EMU10kxBase->camd.ActivateXmitFunc.h_Data     = NULL;

  
  /*** Allocate and init all cards *******************************************/

  EMU10kxBase->driverdatas = AllocVec( sizeof( *EMU10kxBase->driverdatas ) *
				       EMU10kxBase->cards_found,
				       MEMF_PUBLIC );

  if( EMU10kxBase->driverdatas == NULL )
  {
    Req( "Out of memory." );
    return FALSE;
  }

  card_no = 0;

  while( ( dev = pci_find_device( PCI_VENDOR_ID_CREATIVE,
				  PCI_DEVICE_ID_CREATIVE_EMU10K1,
				  dev ) ) != NULL )
  {
    EMU10kxBase->driverdatas[ card_no ] = AllocDriverData( dev, AHIsubBase );
    ++card_no;
  }

  return TRUE;
}
Пример #12
0
static BOOL
HandleToolTypes( UBYTE**             tool_types, 
                 struct ISAPNP_Card* card,
                 struct ISAPNPBase*  res )
{
  while( *tool_types )
  {
    if( Strnicmp( *tool_types, "DISABLE_CARD=", 13 ) == 0 )
    {
      LONG manufacturer;
      WORD product;
      BYTE revision;
      LONG serial;

      if( ParseID( *tool_types + 13, 
                   &manufacturer, &product, &revision, &serial ) )
      {
        struct ISAPNP_Card* card = NULL;

        while( ( card = ISAPNP_FindCard( card,
                                         manufacturer,
                                         product,
                                         revision,
                                         serial,
                                         res ) ) != NULL )
        {
          card->isapnpc_Disabled = TRUE;
        }
      }
      else
      {
        Req( "Illegal tool type: %s\n", (ULONG) *tool_types );
        return FALSE;
      }
    }
    else if( Strnicmp( *tool_types, "DISABLE_DEVICE=", 15 ) == 0 )
    {
      LONG manufacturer;
      WORD product;
      BYTE revision;

      if( ParseID( *tool_types + 15, 
                   &manufacturer, &product, &revision, NULL ) )
      {
        struct ISAPNP_Device* dev = NULL;

        while( ( dev = ISAPNP_FindDevice( dev,
                                          manufacturer,
                                          product,
                                          revision,
                                          res ) ) != NULL )
        {
          dev->isapnpd_Disabled = TRUE;
        }
      }
      else
      {
        Req( "Illegal tool type value: %s\n", (ULONG) *tool_types );
        return FALSE;
      }
    }
    else if( Strnicmp( *tool_types, "LEGACY_DEVICE=", 14 ) == 0 )
    {
      UBYTE* str;
      int    conv;
      LONG   manufacturer;
      WORD   product;
      BYTE   revision;
      UWORD  dev_num = 0;

      str  = *tool_types + 14;
      conv = ParseID( str,  &manufacturer, &product, &revision, NULL );

      str += conv;

      if( conv != 0 )
      {
        struct ISAPNP_Device*     dev;
        struct ISAPNP_Identifier* id;

        dev = ISAPNP_AllocDevice( res );

        if( dev == NULL )
        {
          Req( "Out of memory!" );
          return FALSE;
        }

        dev->isapnpd_Card = card;
        
        id  = AllocVec( sizeof( *id ), MEMF_PUBLIC | MEMF_CLEAR );
        
        if( id == NULL )
        {
          Req( "Out of memory!" );
          ISAPNP_FreeDevice( dev, res );
          return FALSE;
        }

        id->isapnpid_Vendor[ 0 ]  = ( manufacturer >> 24 ) & 0xff;
        id->isapnpid_Vendor[ 1 ]  = ( manufacturer >> 16 ) & 0xff;
        id->isapnpid_Vendor[ 2 ]  = ( manufacturer >>  8 ) & 0xff;
        id->isapnpid_Vendor[ 3 ]  = 0;

        id->isapnpid_ProductID    = product;
        id->isapnpid_Revision     = revision;
        
        AddTail( (struct List*) &dev->isapnpd_IDs, (struct Node*) id );
        
        if( card->isapnpc_Devices.lh_Head->ln_Succ != NULL )
        {
          dev_num = ( (struct ISAPNP_Device*) 
                      card->isapnpc_Devices.lh_TailPred )->isapnpd_DeviceNumber;
          ++dev_num;
        }
        
        dev->isapnpd_DeviceNumber = dev_num;

        AddTail( &card->isapnpc_Devices, (struct Node*) dev );
        
        while( *str != 0 )
        {
          if( *str != ' ' )
          {
            if( Strnicmp( str, "IRQ=", 4 ) == 0 )
            {
              int irq;
            
              irq = strtol( str + 4, (char**) &str, 0 );
            
              if( irq <= 0 || irq >= 16 )
              {
                Req( "Invalid IRQ value '%ld' in tooltype line\n"
                     "'%s'",
                     irq,
                     (ULONG) *tool_types );
                return FALSE;
              }
              else
              {
                struct ISAPNP_IRQResource* r;
        
                r = (struct ISAPNP_IRQResource*) 
                    ISAPNP_AllocResource( ISAPNP_NT_IRQ_RESOURCE, res );
            
                if( r == NULL )
                {
                  Req( "Out of memory!" );
                  return FALSE;
                }

                r->isapnpirqr_IRQMask = 1 << irq;
                r->isapnpirqr_IRQType = ISAPNP_IRQRESOURCE_ITF_HIGH_EDGE;
          
                AddTail( (struct List*) &dev->isapnpd_Options->isapnprg_Resources,
                         (struct Node*) r );
              }
            }
            else if( Strnicmp( str, "DMA=", 4 ) == 0 )
            {
              int dma;
            
              dma = strtol( str + 4, (char**) &str, 0 );
            
              if( dma <= 0 || dma >= 8 )
              {
                Req( "Invalid DMA value '%ld' in tooltype line\n"
                     "'%s'",
                     dma,
                     (ULONG) *tool_types );
                return FALSE;
              }
              else
              {
                struct ISAPNP_DMAResource* r;
        
                r = (struct ISAPNP_DMAResource*) 
                    ISAPNP_AllocResource( ISAPNP_NT_DMA_RESOURCE, res );
            
                if( r == NULL )
                {
                  Req( "Out of memory!" );
                  return FALSE;
                }

                r->isapnpdmar_ChannelMask = 1 << dma;
                r->isapnpdmar_Flags       = 0;
          
                AddTail( (struct List*) &dev->isapnpd_Options->isapnprg_Resources,
                         (struct Node*) r );
              }
            }
            else if( Strnicmp( str, "IO=", 3 ) == 0 )
            {
              int base;
              int length;

              struct ISAPNP_IOResource* r;
            
              base = strtol( str + 3, (char**) &str, 0 );

              if( *str != '/' )
              {
                Req( "Length missing from IO value in tooltype line\n"
                     "'%s'",
                     (ULONG) *tool_types );
                return FALSE;
              }

              ++str;

              length = strtol( str, (char**) &str, 0 );

              if( base <= 0 || base >= 0xffff )
              {
                Req( "Invalid IO base value '%ld' in tooltype line\n"
                     "'%s'",
                     base,
                     (ULONG) *tool_types );
                return FALSE;
              }

              if( length <= 0 || length >= 0xffff )
              {
                Req( "Invalid IO length value '%ld' in tooltype line\n"
                     "'%s'",
                     length,
                     (ULONG) *tool_types );
                return FALSE;
              }

              r = (struct ISAPNP_IOResource*) 
                  ISAPNP_AllocResource( ISAPNP_NT_IO_RESOURCE, res );
            
              if( r == NULL )
              {
                Req( "Out of memory!" );
                return FALSE;
              }

              r->isapnpior_MinBase   = base;
              r->isapnpior_MaxBase   = base;
              r->isapnpior_Length    = length;
              r->isapnpior_Alignment = 1;
          
              AddTail( (struct List*) &dev->isapnpd_Options->isapnprg_Resources,
                       (struct Node*) r );
            }
            else
            {
              Req( "Parse error near '%s'\n"
                   "in tooltype line\n"
                   "'%s'",
                   (ULONG) str,
                   (ULONG) *tool_types );
              return FALSE;
            }
          }
          
          if( *str )
          {
            ++str;
          }
        }
      }
      else
      {
        Req( "Illegal tool type: '%s'\n", (ULONG) *tool_types );
        return FALSE;
      }
    }
Пример #13
0
struct ISAPNPBase* ASMCALL
initRoutine( REG( d0, struct ISAPNPBase* res ),
             REG( a0, APTR                    seglist ),
             REG( a6, struct ExecBase*        sysbase ) )
{
  SysBase = sysbase;

  if( ! OpenLibs() )
  {
    // No libraries?

    Req( "Failed to open required libraries." );
  }
  else
  {
    ULONG                 actual;
    struct CurrentBinding current_binding;

    actual = GetCurrentBinding( &current_binding, 
                                sizeof( current_binding ) );

    if( actual < sizeof( current_binding ) )
    {
      // No legal CurrentBinding structure

      Req( "No legal CurrentBinding structure found." );

    }
    else
    {
      struct ConfigDev* cd = current_binding.cb_ConfigDev;

      if( cd == NULL )
      {
        // No card found

        Req( "No bridge card found." );
      }
      else
      {
        if( cd->cd_Rom.er_Manufacturer != 2150 ||
            cd->cd_Rom.er_Product      != 1 )
        {
          // Unsupported ISA bridge

          Req( "Unsupported ISA bridge: %ld/%ld.\n"
               "Only the GG2 Bus+ card is supported.", 
               cd->cd_Rom.er_Manufacturer, 
               cd->cd_Rom.er_Product );
        }
        else
        {
          if( cd->cd_BoardAddr == NULL )
          {
            // No board address?

            Req( "No board address?" );
          }
          else
          {
            // Set up the ISAPNPBase structure

            res->m_Library.lib_Node.ln_Type = NT_RESOURCE;
            res->m_Library.lib_Node.ln_Name = (STRPTR) ResName;
            res->m_Library.lib_Flags        = LIBF_SUMUSED | LIBF_CHANGED;
            res->m_Library.lib_Version      = VERSION;
            res->m_Library.lib_Revision     = REVISION;
            res->m_Library.lib_IdString     = (STRPTR) IDString;

            NewList( &res->m_Cards );

            res->m_Base        = cd->cd_BoardAddr;
            res->m_RegReadData = 0x0000;

            res->m_ConfigDev   = cd;

            if( ! ISAPNP_ScanCards( res ) )
            {
              // No cards found

              Req( "No PnP ISA cards found." );
              FreeISAPNPBase( res );
            }
            else
            {
              struct ISAPNP_Card* card;

              card = ISAPNP_AllocCard( res );

              if( card == NULL )
              {
                Req( "Out of memory!" );
                FreeISAPNPBase( res );
              }
              else
              {
                static const char descr[] = "Non-PnP devices";
                char*             d;                
                
                d = AllocVec( sizeof( descr ), MEMF_PUBLIC );
                
                if( d != NULL )
                {
                  CopyMem( (void*) descr, d, sizeof( descr ) );
                  card->isapnpc_Node.ln_Name = d;
                }

                card->isapnpc_ID.isapnpid_Vendor[ 0 ] = '?';
                card->isapnpc_ID.isapnpid_Vendor[ 1 ] = '?';
                card->isapnpc_ID.isapnpid_Vendor[ 2 ] = '?';
                card->isapnpc_SerialNumber = -1;

                // Add *first*
                AddHead( &res->m_Cards, (struct Node*) card );

                // Let's see if we're to disable any cards or devices etc

                if( ! HandleToolTypes( current_binding.cb_ToolTypes, 
                                       card, res ) )
                {
                  // Error requester already displayed.
                  FreeISAPNPBase( res );
                }
                else
                {
                  if( ! ISAPNP_ConfigureCards( res ) )
                  {
                    // Unable to configure cards

                    Req( "Unable to configure the cards. This is most likely\n"
                         "because of an unresolvable hardware conflict.\n\n"
                         "Use the DISABLE_DEVICE tool type to disable one of\n"
                         "the devices in conflict." );
                    FreeISAPNPBase( res );
                  }
                  else
                  {
                    cd->cd_Flags  &= ~CDF_CONFIGME;
                    cd->cd_Driver  = res;

                    ISAPNPBase = res;
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  return ISAPNPBase;
}