1
0
Fork 0

add PCI framework

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3723
This commit is contained in:
Sebastian Strohhäcker 2011-06-18 13:39:31 +00:00
parent 1828977d5c
commit 6bc4e41458
10 changed files with 682 additions and 4 deletions

View file

@ -24,6 +24,7 @@ mixer.h \
modules.h \
mouse.h \
paging.h \
pci_bus.h \
pic.h \
programs.h \
render.h \

View file

@ -27,6 +27,7 @@ enum LOG_TYPES {
LOG_PIT,LOG_KEYBOARD,LOG_PIC,
LOG_MOUSE,LOG_BIOS,LOG_GUI,LOG_MISC,
LOG_IO,
LOG_PCI,
LOG_MAX
};
@ -65,6 +66,10 @@ struct LOG
void operator()(char const* , double , double , double ) { }
void operator()(char const* , double , double , double , double ) { }
void operator()(char const* , double , double , double , double , double ) { }
void operator()(char const* , double , double , double , double , double , double ) { }
void operator()(char const* , double , double , double , double , double , double , double) { }
void operator()(char const* , char const* ) { }
void operator()(char const* , char const* , double ) { }
@ -73,7 +78,7 @@ struct LOG
void operator()(char const* , double , double, char const* ) { }
void operator()(char const* , char const*, char const*) { }
void operator()(char const* , double , double , double , char const* ) { }
}; //add missing operators to here
//try to avoid anything smaller than bit32...
void GFX_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2));

85
include/pci_bus.h Normal file
View file

@ -0,0 +1,85 @@
/*
* Copyright (C) 2002-2011 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef DOSBOX_PCI_H
#define DOSBOX_PCI_H
//#define PCI_FUNCTIONALITY_ENABLED 0
#if defined PCI_FUNCTIONALITY_ENABLED
#define PCI_MAX_PCIDEVICES 10
#define PCI_MAX_PCIFUNCTIONS 8
class PCI_Device {
private:
Bits pci_id, pci_subfunction;
Bit16u vendor_id, device_id;
// subdevices declarations, they will respond to pci functions 1 to 7
// (main device is attached to function 0)
Bitu num_subdevices;
PCI_Device* subdevices[PCI_MAX_PCIFUNCTIONS-1];
public:
PCI_Device(Bit16u vendor, Bit16u device);
Bits PCIId(void) {
return pci_id;
}
Bits PCISubfunction(void) {
return pci_subfunction;
}
Bit16u VendorID(void) {
return vendor_id;
}
Bit16u DeviceID(void) {
return device_id;
}
void SetPCIId(Bitu number, Bits subfct);
bool AddSubdevice(PCI_Device* dev);
void RemoveSubdevice(Bits subfct);
PCI_Device* GetSubdevice(Bits subfct);
Bit16u NumSubdevices(void) {
if (num_subdevices>PCI_MAX_PCIFUNCTIONS-1) return PCI_MAX_PCIFUNCTIONS-1;
return num_subdevices;
}
Bits GetNextSubdeviceNumber(void) {
if (num_subdevices>=PCI_MAX_PCIFUNCTIONS-1) return -1;
return num_subdevices+1;
}
virtual Bits ParseReadRegister(Bit8u regnum)=0;
virtual Bits ParseWriteRegister(Bit8u regnum,Bit8u value)=0;
virtual bool InitializeRegisters(Bit8u registers[256])=0;
};
bool PCI_IsInitialized();
RealPt PCI_GetPModeInterface(void);
#endif
#endif