* Removed endpoint and descriptor wrappers, everything is in the related structure like it's done in the uhci driver.
* Clean up continues git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22733 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
662e5c8ce4
commit
9d211eb104
@ -18,9 +18,6 @@ struct pci_info;
|
|||||||
struct pci_module_info;
|
struct pci_module_info;
|
||||||
class OHCIRootHub;
|
class OHCIRootHub;
|
||||||
|
|
||||||
struct Endpoint;
|
|
||||||
struct TransferDescriptor;
|
|
||||||
|
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
// OHCI:: Software isonchronous
|
// OHCI:: Software isonchronous
|
||||||
// transfer descriptor
|
// transfer descriptor
|
||||||
@ -38,45 +35,10 @@ typedef struct hcd_soft_itransfer
|
|||||||
#endif
|
#endif
|
||||||
}hcd_soft_itransfer;
|
}hcd_soft_itransfer;
|
||||||
|
|
||||||
#define OHCI_SITD_SIZE ((sizeof (struct hcd_soft_itransfer) + OHCI_ITD_ALIGN - 1) / OHCI_ITD_ALIGN * OHCI_ITD_ALIGN)
|
#define OHCI_SITD_SIZE ((sizeof (struct hcd_soft_itransfer) + OHCI_ITD_ALIGN - 1) / OHCI_ITD_ALIGN * OHCI_ITD_ALIGN)
|
||||||
#define OHCI_SITD_CHUNK 64
|
#define OHCI_SITD_CHUNK 64
|
||||||
|
|
||||||
// ------------------------------------------
|
#define OHCI_NUMBER_OF_ENDPOINTS (2 * OHCI_NUMBER_OF_INTERRUPTS - 1)
|
||||||
// OHCI:: Number of enpoint descriptors (63)
|
|
||||||
// ------------------------------------------
|
|
||||||
|
|
||||||
#define OHCI_NO_EDS (2 * OHCI_NUMBER_OF_INTERRUPTS - 1)
|
|
||||||
|
|
||||||
//
|
|
||||||
// Endpoint: wrapper around the hardware endpoints
|
|
||||||
//
|
|
||||||
|
|
||||||
struct Endpoint
|
|
||||||
{
|
|
||||||
addr_t physical_address;//Point to the physical address
|
|
||||||
ohci_endpoint_descriptor *ed; //Logical 'endpoint'
|
|
||||||
Endpoint *next; //Pointer to the 'next' endpoint
|
|
||||||
TransferDescriptor *head, *tail; //Pointers to the 'head' and 'tail' transfer descriptors
|
|
||||||
|
|
||||||
//Utility functions
|
|
||||||
void SetNext(Endpoint *end) {
|
|
||||||
next = end;
|
|
||||||
if (end == 0)
|
|
||||||
ed->next_endpoint = 0;
|
|
||||||
else
|
|
||||||
ed->next_endpoint = end->physical_address;
|
|
||||||
};
|
|
||||||
|
|
||||||
//Constructor (or better: initialiser)
|
|
||||||
Endpoint() : physical_address(0), ed(0), next(0), head(0), tail(0) {};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct TransferDescriptor
|
|
||||||
{
|
|
||||||
addr_t physical_address;
|
|
||||||
ohci_general_transfer_descriptor *td;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class OHCI : public BusManager
|
class OHCI : public BusManager
|
||||||
@ -104,8 +66,8 @@ static status_t AddTo(Stack *stack);
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Register functions
|
// Register functions
|
||||||
inline void WriteReg(uint32 reg, uint32 value);
|
inline void _WriteReg(uint32 reg, uint32 value);
|
||||||
inline uint32 ReadReg(uint32 reg);
|
inline uint32 _ReadReg(uint32 reg);
|
||||||
|
|
||||||
// Global
|
// Global
|
||||||
static pci_module_info *sPCIModule;
|
static pci_module_info *sPCIModule;
|
||||||
@ -116,22 +78,23 @@ static pci_module_info *sPCIModule;
|
|||||||
|
|
||||||
area_id fRegisterArea;
|
area_id fRegisterArea;
|
||||||
|
|
||||||
// HCCA
|
// Host Controller Communication Area related stuff
|
||||||
area_id fHccaArea;
|
area_id fHccaArea;
|
||||||
struct ohci_hcca *fHcca;
|
struct ohci_hcca *fHcca;
|
||||||
Endpoint *fInterruptEndpoints[OHCI_NO_EDS];
|
Endpoint *fInterruptEndpoints[OHCI_NUMBER_OF_ENDPOINTS];
|
||||||
|
|
||||||
// Dummy endpoints
|
// Dummy endpoints
|
||||||
Endpoint *fDummyControl;
|
Endpoint *fDummyControl;
|
||||||
Endpoint *fDummyBulk;
|
Endpoint *fDummyBulk;
|
||||||
Endpoint *fDummyIsochronous;
|
Endpoint *fDummyIsochronous;
|
||||||
// functions
|
|
||||||
|
// Endpoint related methods
|
||||||
Endpoint *_AllocateEndpoint();
|
Endpoint *_AllocateEndpoint();
|
||||||
void _FreeEndpoint(Endpoint *end);
|
void _FreeEndpoint(Endpoint *end);
|
||||||
TransferDescriptor *_AllocateTransfer();
|
TransferDescriptor *_AllocateTransfer();
|
||||||
void _FreeTransfer(TransferDescriptor *trans);
|
void _FreeTransfer(TransferDescriptor *trans);
|
||||||
|
|
||||||
status_t _InsertEndpointForPipe(Pipe *p);
|
status_t _InsertEndpointForPipe(Pipe *p);
|
||||||
|
void _SetNext(ohci_endpoint_descriptor *endpoint);
|
||||||
|
|
||||||
// Root Hub
|
// Root Hub
|
||||||
OHCIRootHub *fRootHub;
|
OHCIRootHub *fRootHub;
|
||||||
|
@ -297,10 +297,16 @@ typedef struct ohci_hcca
|
|||||||
|
|
||||||
typedef struct ohci_endpoint_descriptor
|
typedef struct ohci_endpoint_descriptor
|
||||||
{
|
{
|
||||||
uint32 flags;
|
// Hardware part
|
||||||
uint32 tail_pointer; // Queue tail pointer
|
uint32 flags; // Flags field
|
||||||
uint32 head_pointer; // Queue head pointer
|
uint32 tail_physical_descriptor; // Queue tail physical pointer
|
||||||
uint32 next_endpoint; // Next endpoint in the list
|
uint32 head_physical_descriptor; // Queue head physical pointer
|
||||||
|
uint32 next_physical_endpoint; // Physical pointer to the next endpoint
|
||||||
|
// Software part
|
||||||
|
addr_t this_physical; // Physical pointer to this address
|
||||||
|
void *tail_logical_descriptor; // Queue tail logical pointer
|
||||||
|
void *head_logical_descriptor; // Queue head logical pointer
|
||||||
|
void *next_logical_endpoint; // Logical pointer to the next endpoint
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OHCI_ENDPOINT_ADDRESS_MASK 0x0000007f
|
#define OHCI_ENDPOINT_ADDRESS_MASK 0x0000007f
|
||||||
@ -330,10 +336,16 @@ typedef struct ohci_endpoint_descriptor
|
|||||||
|
|
||||||
typedef struct ohci_general_transfer_descriptor
|
typedef struct ohci_general_transfer_descriptor
|
||||||
{
|
{
|
||||||
uint32 flags;
|
// Hardware part
|
||||||
uint32 buffer_phy; // Physical buffer pointer
|
uint32 flags; // Flags field
|
||||||
uint32 next_descriptor; // Next transfer descriptor
|
uint32 buffer_physical; // Physical buffer pointer
|
||||||
uint32 last_byte_address; // Physical buffer end
|
uint32 next_physical_descriptor; // Physical pointer next descriptor
|
||||||
|
uint32 last_physical_byte_address; // Physical pointer to buffer end
|
||||||
|
// Software part
|
||||||
|
addr_t this_physical; // Physical pointer to this address
|
||||||
|
void *buffer_logical; // Logical pointer to the buffer
|
||||||
|
void *next_logical_descriptor; // Logical pointer next descriptor
|
||||||
|
void *last_logical_byte_address; // Logical pointer buffer end
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OHCI_BUFFER_ROUNDING 0x00040000
|
#define OHCI_BUFFER_ROUNDING 0x00040000
|
||||||
|
Loading…
Reference in New Issue
Block a user