AppleUSBOHCIMemoryBlocks.h [plain text]
#ifndef _APPLEUSBOHCIMEMORYBLOCKS_H_
#define _APPLEUSBOHCIMEMORYBLOCKS_H_
#include <IOKit/IOBufferMemoryDescriptor.h>
#include "AppleUSBOHCI.h"
#include "USBOHCI.h"
enum
{
kAppleUSBOHCIMemBlockGTD = ' gtd',
kAppleUSBOHCIMemBlockITD = ' itd'
};
class AppleUSBOHCIedMemoryBlock : public OSObject
{
OSDeclareDefaultStructors(AppleUSBOHCIedMemoryBlock);
#define EDsPerBlock (kOHCIPageSize / sizeof(OHCIEndpointDescriptorShared))
private:
IOPhysicalAddress _sharedPhysical;
OHCIEndpointDescriptorSharedPtr _sharedLogical;
AppleUSBOHCIedMemoryBlock *_nextBlock;
AppleOHCIEndpointDescriptor _eds[EDsPerBlock]; IOBufferMemoryDescriptor *_buffer;
public:
virtual void free();
static AppleUSBOHCIedMemoryBlock *NewMemoryBlock(void);
void SetNextBlock(AppleUSBOHCIedMemoryBlock *next);
AppleUSBOHCIedMemoryBlock *GetNextBlock(void);
UInt32 NumEDs(void);
IOPhysicalAddress GetSharedPhysicalPtr(UInt32 index);
OHCIEndpointDescriptorSharedPtr GetSharedLogicalPtr(UInt32 index);
AppleOHCIEndpointDescriptorPtr GetED(UInt32 index);
};
class AppleUSBOHCIgtdMemoryBlock : public OSObject
{
OSDeclareDefaultStructors(AppleUSBOHCIgtdMemoryBlock);
#define GTDsPerBlock ((kOHCIPageSize / sizeof(OHCIGeneralTransferDescriptorShared)) - 1)
private:
IOPhysicalAddress _sharedPhysical;
OHCIGeneralTransferDescriptorSharedPtr _sharedLogical;
AppleUSBOHCIgtdMemoryBlock *_nextBlock;
AppleOHCIGeneralTransferDescriptor _gtds[GTDsPerBlock]; IOBufferMemoryDescriptor *_buffer;
public:
virtual void free();
static AppleUSBOHCIgtdMemoryBlock *NewMemoryBlock(void);
static AppleOHCIGeneralTransferDescriptorPtr GetGTDFromPhysical(IOPhysicalAddress addr, UInt32 blockType = 0);
void SetNextBlock(AppleUSBOHCIgtdMemoryBlock *next);
AppleUSBOHCIgtdMemoryBlock *GetNextBlock(void);
UInt32 NumGTDs(void);
IOPhysicalAddress GetSharedPhysicalPtr(UInt32 index);
OHCIGeneralTransferDescriptorSharedPtr GetSharedLogicalPtr(UInt32 index);
AppleOHCIGeneralTransferDescriptorPtr GetGTD(UInt32 index);
};
class AppleUSBOHCIitdMemoryBlock : public OSObject
{
OSDeclareDefaultStructors(AppleUSBOHCIitdMemoryBlock);
#define ITDsPerBlock ((kOHCIPageSize / sizeof(OHCIIsochTransferDescriptorShared)) - 1)
private:
IOPhysicalAddress _sharedPhysical;
OHCIIsochTransferDescriptorSharedPtr _sharedLogical;
AppleUSBOHCIitdMemoryBlock *_nextBlock;
AppleOHCIIsochTransferDescriptor _itds[ITDsPerBlock]; IOBufferMemoryDescriptor *_buffer;
public:
virtual void free();
static AppleUSBOHCIitdMemoryBlock *NewMemoryBlock(void);
static AppleOHCIIsochTransferDescriptorPtr GetITDFromPhysical(IOPhysicalAddress addr, UInt32 blockType = 0);
void SetNextBlock(AppleUSBOHCIitdMemoryBlock *next);
AppleUSBOHCIitdMemoryBlock *GetNextBlock(void);
UInt32 NumITDs(void);
IOPhysicalAddress GetSharedPhysicalPtr(UInt32 index);
OHCIIsochTransferDescriptorSharedPtr GetSharedLogicalPtr(UInt32 index);
AppleOHCIIsochTransferDescriptorPtr GetITD(UInt32 index);
};
#endif