📄 pcihal.h
字号:
/* DATA STRUCTURES */
#define USE_TMMAN
typedef struct _TM_HW
{
DWORD dwInterrupt;/* Interrupt vector on PCI bus */
#ifndef USE_TMMAN
TMMAN_CONFIG_INFO Config; /* configuration information from VxD */
HANDLE hDevice; /* handle to the ring 0 device driver */
#else
TMMAN_DSP_CAPS DSPCaps; /* DSP capabilities */
DWORD DSPHandle;
#endif
} TM_HW, *PTM_HW;
/* FUCNTIONS */
/*
FUNC halValidateAddress
Validates the given address against the limits of the SDRAM and limits
of the MMIO registers. It return a flag indicating whether the given
address lies in SDRAM range or MMIO range.
ENTRY
pTMHW Pointer to the TriMedia hardware object
dwAddress PCI Physical Address to be validated.
pfSDRAM Address of the flag where the range information is stored.
TRUE in SDRAM range.
FALSE in MMIO range.
RETURN
TRUE Valid TriMedia address
FALSE Invalid address.
*/
BOOL halValidateAddress ( PTM_HW ptmHW, DWORD dwAddress, BOOL *pfSDRAM );
/*
FUNC halValidateLength
Validates if the address and the length are crossing TriMedia MMIO or SDRAM
boundaries.
ENTRY
pTMHW Pointer to the TriMedia hardware object
dwAddress PCI Physical Address to be validated
dwLength Length in bytes to be validated
RETURN
TRUE Address + Length are valid
FALSE Address + Length are crossing TriMedia SDRAM or MMIO limits
*/
BOOL halValidateLength ( PTM_HW pTMHW, DWORD dwAddress, DWORD dwLength );
/*
FUNC halInit
Initialize the hardware abstraction layer
ENTRY
pTMHW Pointer to the TriMedia hardware object
dwSDRAMLength Size of physical SDRAM present on TriMedia
fTriMEdia Flag indicating the use of actual hardware
or emulation using PC memory.
RETURN
TRUE Hardware Abstraction layer is initialized and usable
FALSE HArdware Abstraction layer could not be initialized
*/
BOOL halInit ( PTM_HW pTMHW ); //, DWORD dwSDRAMLength, BOOL fTriMedia );
/*
FUNC halExit
Shuts down the hardware abstraction layer and releases all the resources
ENTRY
pTMHW Pointer to the TriMedia hardware object
RETURN
NONE
*/
VOID halExit ( PTM_HW pTMHW );
/*
FUNC halMemoryReadX
Read a byte/word from TriMedia SDRAM address space. HAL clients
should not try to access SDRAM or MMIO directly, they should be using these
functions to perform any memory accesses.
ENTRY
pTMHW Pointer to the TriMedia hardware object
dwAddress Address to read from.
RETURN
Value read from the given address
*/
BYTE halMemoryReadB ( PTM_HW pTMHW, DWORD dwAddress );
WORD halMemoryReadW ( PTM_HW pTMHW, DWORD dwAddress );
/*
FUNC halMemoryReadD
Read a DWORD from SDRAM or MMIO address space.
ENTRY
pTMHW Pointer to the TriMedia hardware object
dwAddress Address to read from.
RETURN
Value read from the given address.
*/
DWORD halMemoryReadD ( PTM_HW pTMHW, DWORD dwAddress );
/*
FUNC halMemoryWriteX
Write a byte/word to TriMedia SDRAM address space. HAL clients
should not try to access SDRAM or MMIO directly, they should be using these
functions to perform any memory accesses.
ENTRY
pTMHW Pointer to the TriMedia hardware object
dwAddress Address to write to
XValue Byte/Word to write
RETURN
NONE
*/
VOID halMemoryWriteB ( PTM_HW pTMHW, DWORD dwAddress, BYTE bValue );
VOID halMemoryWriteW ( PTM_HW pTMHW, DWORD dwAddress, WORD wValue );
/*
FUNC halMemoryWriteD
Write a DWORD to SDRAM or MMIO address space.
ENTRY
pTMHW Pointer to the TriMedia hardware object
dwAddress Address to write to.
dwValue Value to be written
RETURN
NONE
*/
VOID halMemoryWriteD ( PTM_HW pTMHW, DWORD dwAddress, DWORD dwValue );
/*
FUNC halRegisterRead
Reads the value of a TriMedia CPU register
This function currently has no PCI implementation.
ENTRY
pTMHW Pointer to the TriMedia hardware object
wRegister Register Number to read from.
RETURN
Value read from the requried register
*/
DWORD halRegisterRead ( PTM_HW pTMHW, WORD wRegister );
/*
FUNC halRegisterRead
Writes a value into the TriMedia CPU register
This fucntion currently has no PCI implementation.
ENTRY
pTMHW Pointer to the TriMedia hardware object
wRegister Register Number to read from
dwValue Value to write into the register
RETURN
NONE
*/
VOID halRegisterWrite ( PTM_HW pTMHW, WORD wRegister, DWORD dwValue );
/*
FUNC halGetXXX
Retrieves the members from the hal object
DWORD halGetXXX ( PTM_HW pTMHW );
ENTRY
pTMHW Pointer to the TriMedia hardware object
RETURN
Private data member of hal object
*/
#ifdef USE_TMMAN
#define halGetMMIOBase(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.MMIO.dwPhysical )
#define halGetMMIOLin(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.MMIO.dwLinear )
#define halGetSDRAMBase(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.SDRAM.dwPhysical )
#define halGetSDRAMEnd(pTMHW) ( \
((PTM_HW)(pTMHW))->DSPCaps.SDRAM.dwPhysical + \
((PTM_HW)(pTMHW))->DSPCaps.SDRAM.dwSize - 1 )
#define halGetSDRAMLin(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.SDRAM.dwLinear )
#define halGetSDRAMLen(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.SDRAM.dwSize )
#define halGetDMABase(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.User.dwPhysical )
#define halGetDMALin(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.User.dwLinear )
#define halGetDMALen(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.User.dwSize )
#define halGetSystemBase(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.User.dwPhysical - (11* 1024) )
#define halGetSystemLen(pTMHW) ( 11 * 1024 )
#define halGetSystemLin(pTMHW) ( ((PTM_HW)(pTMHW))->DSPCaps.User.dwLinear - ( 11* 1024 ) )
#define halSDRAMGetMappedAddress( pTMHW, dwAddress ) \
( ( (dwAddress - ((PTM_HW)(pTMHW))->DSPCaps.SDRAM.dwPhysical ) ) + ((PTM_HW)(pTMHW))->Condig.SDRAM.dwLinear )
#else
#define halGetMMIOBase(pTMHW) ( ((PTM_HW)(pTMHW))->Config.MMIO.dwPhysical )
#define halGetMMIOLin(pTMHW) ( ((PTM_HW)(pTMHW))->Config.MMIO.dwLinear )
#define halGetSDRAMBase(pTMHW) ( ((PTM_HW)(pTMHW))->Config.SDRAM.dwPhysical )
#define halGetSDRAMEnd(pTMHW) ( \
((PTM_HW)(pTMHW))->Config.SDRAM.dwPhysical + \
((PTM_HW)(pTMHW))->Config.SDRAM.dwSize - 1 )
#define halGetSDRAMLin(pTMHW) ( ((PTM_HW)(pTMHW))->Config.SDRAM.dwLinear )
#define halGetSDRAMLen(pTMHW) ( ((PTM_HW)(pTMHW))->Config.SDRAM.dwSize )
#define halGetDMABase(pTMHW) ( ((PTM_HW)(pTMHW))->Config.User.dwPhysical )
#define halGetDMALin(pTMHW) ( ((PTM_HW)(pTMHW))->Config.User.dwLinear )
#define halGetDMALen(pTMHW) ( ((PTM_HW)(pTMHW))->Config.User.dwSize )
#define halGetCRTBase(pTMHW) ( ((PTM_HW)(pTMHW))->Config.CRT.dwPhysical )
#define halGetCRTLen(pTMHW) ( ((PTM_HW)(pTMHW))->Config.CRT.dwSize )
#define halGetCRTLin(pTMHW) ( ((PTM_HW)(pTMHW))->Config.CRT.dwLinear )
#define halGetSystemBase(pTMHW) ( ((PTM_HW)(pTMHW))->Config.System.dwPhysical )
#define halGetSystemLen(pTMHW) ( ((PTM_HW)(pTMHW))->Config.System.dwSize )
#define halGetSystemLin(pTMHW) ( ((PTM_HW)(pTMHW))->Config.System.dwLinear )
#define halSDRAMGetMappedAddress( pTMHW, dwAddress ) \
( ( (dwAddress - ((PTM_HW)(pTMHW))->Config.SDRAM.dwPhysical ) ) + ((PTM_HW)(pTMHW))->Condig.SDRAM.dwLinear )
#endif
BOOL halSDRAMMemCopy ( PTM_HW pTMHW, PVOID pvSource, DWORD dwDestAddress,
DWORD dwLength );
BOOL halGetVersion ( PTM_HW pTMHW, PVOID pVersion );
BOOL halExecutableStart ( PTM_HW pTMHW );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -