mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 21:57:57 +03:00

Added DMA channels 0 and 8. Added VU0 stuff. Major tweakage of UNPACK in VPU. git-svn-id: http://svn.purei.org/purei/trunk@342 b36208d7-6611-0410-8bec-b1987f11c4a2
76 lines
2.6 KiB
C++
76 lines
2.6 KiB
C++
#ifndef _MEMORYMAP_H_
|
|
#define _MEMORYMAP_H_
|
|
|
|
#include "Types.h"
|
|
#include <functional>
|
|
#include <map>
|
|
|
|
enum MEMORYMAP_ENDIANESS
|
|
{
|
|
MEMORYMAP_ENDIAN_LSBF,
|
|
MEMORYMAP_ENDIAN_MSBF,
|
|
};
|
|
|
|
class CMemoryMap
|
|
{
|
|
public:
|
|
typedef std::tr1::function<void (uint32)> WriteNotifyHandlerType;
|
|
typedef std::tr1::function<uint32 (uint32, uint32)> MemoryMapHandlerType;
|
|
|
|
virtual ~CMemoryMap();
|
|
uint8 GetByte(uint32);
|
|
virtual uint16 GetHalf(uint32) = 0;
|
|
virtual uint32 GetWord(uint32) = 0;
|
|
virtual uint32 GetInstruction(uint32) = 0;
|
|
virtual void SetByte(uint32, uint8);
|
|
virtual void SetHalf(uint32, uint16) = 0;
|
|
virtual void SetWord(uint32, uint32) = 0;
|
|
void InsertReadMap(uint32, uint32, void*, unsigned char);
|
|
void InsertReadMap(uint32, uint32, const MemoryMapHandlerType&, unsigned char);
|
|
void InsertWriteMap(uint32, uint32, void*, unsigned char);
|
|
void InsertWriteMap(uint32, uint32, const MemoryMapHandlerType&, unsigned char);
|
|
void InsertInstructionMap(uint32, uint32, void*, unsigned char);
|
|
void SetWriteNotifyHandler(WriteNotifyHandlerType);
|
|
|
|
protected:
|
|
enum MEMORYMAP_TYPE
|
|
{
|
|
MEMORYMAP_TYPE_MEMORY,
|
|
MEMORYMAP_TYPE_FUNCTION
|
|
};
|
|
|
|
struct MEMORYMAPELEMENT
|
|
{
|
|
uint32 nStart;
|
|
uint32 nEnd;
|
|
void* pPointer;
|
|
MemoryMapHandlerType handler;
|
|
MEMORYMAP_TYPE nType;
|
|
};
|
|
|
|
typedef std::map<unsigned char, MEMORYMAPELEMENT> MemoryMapListType;
|
|
|
|
WriteNotifyHandlerType m_WriteNotifyHandler;
|
|
static MEMORYMAPELEMENT* GetMap(MemoryMapListType&, uint32);
|
|
|
|
MemoryMapListType m_instructionMap;
|
|
MemoryMapListType m_readMap;
|
|
MemoryMapListType m_writeMap;
|
|
|
|
private:
|
|
static void InsertMap(MemoryMapListType&, uint32, uint32, void*, unsigned char);
|
|
static void InsertMap(MemoryMapListType&, uint32, uint32, const MemoryMapHandlerType&, unsigned char);
|
|
static void DeleteMap(MemoryMapListType&);
|
|
};
|
|
|
|
class CMemoryMap_LSBF : public CMemoryMap
|
|
{
|
|
public:
|
|
uint16 GetHalf(uint32);
|
|
uint32 GetWord(uint32);
|
|
uint32 GetInstruction(uint32);
|
|
void SetHalf(uint32, uint16);
|
|
void SetWord(uint32, uint32);
|
|
};
|
|
|
|
#endif
|