Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30713 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
* Authors:
|
* Authors:
|
||||||
* Michael Lotz <[email protected]>
|
* Michael Lotz <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EHCI_H
|
#ifndef EHCI_H
|
||||||
#define EHCI_H
|
#define EHCI_H
|
||||||
|
|
||||||
@@ -18,13 +17,13 @@ struct pci_module_info;
|
|||||||
class EHCIRootHub;
|
class EHCIRootHub;
|
||||||
|
|
||||||
|
|
||||||
typedef struct transfer_data_s {
|
typedef struct transfer_data {
|
||||||
Transfer *transfer;
|
Transfer * transfer;
|
||||||
ehci_qh *queue_head;
|
ehci_qh * queue_head;
|
||||||
ehci_qtd *data_descriptor;
|
ehci_qtd * data_descriptor;
|
||||||
bool incoming;
|
bool incoming;
|
||||||
bool canceled;
|
bool canceled;
|
||||||
transfer_data_s *link;
|
transfer_data * link;
|
||||||
} transfer_data;
|
} transfer_data;
|
||||||
|
|
||||||
|
|
||||||
@@ -75,7 +74,7 @@ static int32 CleanupThread(void *data);
|
|||||||
void Cleanup();
|
void Cleanup();
|
||||||
|
|
||||||
// Queue Head functions
|
// Queue Head functions
|
||||||
ehci_qh *CreateQueueHead();
|
ehci_qh * CreateQueueHead();
|
||||||
status_t InitQueueHead(ehci_qh *queueHead,
|
status_t InitQueueHead(ehci_qh *queueHead,
|
||||||
Pipe *pipe);
|
Pipe *pipe);
|
||||||
void FreeQueueHead(ehci_qh *queueHead);
|
void FreeQueueHead(ehci_qh *queueHead);
|
||||||
@@ -97,7 +96,8 @@ static int32 CleanupThread(void *data);
|
|||||||
bool *directionIn);
|
bool *directionIn);
|
||||||
|
|
||||||
// Descriptor functions
|
// Descriptor functions
|
||||||
ehci_qtd *CreateDescriptor(size_t bufferSizeToAllocate,
|
ehci_qtd * CreateDescriptor(
|
||||||
|
size_t bufferSizeToAllocate,
|
||||||
uint8 pid);
|
uint8 pid);
|
||||||
status_t CreateDescriptorChain(Pipe *pipe,
|
status_t CreateDescriptorChain(Pipe *pipe,
|
||||||
ehci_qtd **firstDescriptor,
|
ehci_qtd **firstDescriptor,
|
||||||
@@ -112,7 +112,8 @@ static int32 CleanupThread(void *data);
|
|||||||
void LinkDescriptors(ehci_qtd *first,
|
void LinkDescriptors(ehci_qtd *first,
|
||||||
ehci_qtd *last, ehci_qtd *alt);
|
ehci_qtd *last, ehci_qtd *alt);
|
||||||
|
|
||||||
size_t WriteDescriptorChain(ehci_qtd *topDescriptor,
|
size_t WriteDescriptorChain(
|
||||||
|
ehci_qtd *topDescriptor,
|
||||||
iovec *vector, size_t vectorCount);
|
iovec *vector, size_t vectorCount);
|
||||||
size_t ReadDescriptorChain(ehci_qtd *topDescriptor,
|
size_t ReadDescriptorChain(ehci_qtd *topDescriptor,
|
||||||
iovec *vector, size_t vectorCount,
|
iovec *vector, size_t vectorCount,
|
||||||
@@ -129,36 +130,36 @@ inline uint8 ReadCapReg8(uint32 reg);
|
|||||||
inline uint16 ReadCapReg16(uint32 reg);
|
inline uint16 ReadCapReg16(uint32 reg);
|
||||||
inline uint32 ReadCapReg32(uint32 reg);
|
inline uint32 ReadCapReg32(uint32 reg);
|
||||||
|
|
||||||
static pci_module_info *sPCIModule;
|
static pci_module_info * sPCIModule;
|
||||||
|
|
||||||
uint8 *fCapabilityRegisters;
|
uint8 * fCapabilityRegisters;
|
||||||
uint8 *fOperationalRegisters;
|
uint8 * fOperationalRegisters;
|
||||||
area_id fRegisterArea;
|
area_id fRegisterArea;
|
||||||
pci_info *fPCIInfo;
|
pci_info * fPCIInfo;
|
||||||
Stack *fStack;
|
Stack * fStack;
|
||||||
uint32 fEnabledInterrupts;
|
uint32 fEnabledInterrupts;
|
||||||
|
|
||||||
// Periodic transfer framelist and interrupt entries
|
// Periodic transfer framelist and interrupt entries
|
||||||
area_id fPeriodicFrameListArea;
|
area_id fPeriodicFrameListArea;
|
||||||
addr_t *fPeriodicFrameList;
|
addr_t * fPeriodicFrameList;
|
||||||
interrupt_entry *fInterruptEntries;
|
interrupt_entry * fInterruptEntries;
|
||||||
|
|
||||||
// Async transfer queue management
|
// Async transfer queue management
|
||||||
ehci_qh *fAsyncQueueHead;
|
ehci_qh * fAsyncQueueHead;
|
||||||
sem_id fAsyncAdvanceSem;
|
sem_id fAsyncAdvanceSem;
|
||||||
|
|
||||||
// Maintain a linked list of transfers
|
// Maintain a linked list of transfers
|
||||||
transfer_data *fFirstTransfer;
|
transfer_data * fFirstTransfer;
|
||||||
transfer_data *fLastTransfer;
|
transfer_data * fLastTransfer;
|
||||||
sem_id fFinishTransfersSem;
|
sem_id fFinishTransfersSem;
|
||||||
thread_id fFinishThread;
|
thread_id fFinishThread;
|
||||||
sem_id fCleanupSem;
|
sem_id fCleanupSem;
|
||||||
thread_id fCleanupThread;
|
thread_id fCleanupThread;
|
||||||
bool fStopThreads;
|
bool fStopThreads;
|
||||||
ehci_qh *fFreeListHead;
|
ehci_qh * fFreeListHead;
|
||||||
|
|
||||||
// Root Hub
|
// Root Hub
|
||||||
EHCIRootHub *fRootHub;
|
EHCIRootHub * fRootHub;
|
||||||
uint8 fRootHubAddress;
|
uint8 fRootHubAddress;
|
||||||
|
|
||||||
// Port management
|
// Port management
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
* Salvatore Benedetto <[email protected]>
|
* Salvatore Benedetto <[email protected]>
|
||||||
* Michael Lotz <[email protected]>
|
* Michael Lotz <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OHCI_H
|
#ifndef OHCI_H
|
||||||
#define OHCI_H
|
#define OHCI_H
|
||||||
|
|
||||||
@@ -19,15 +18,15 @@ struct pci_info;
|
|||||||
struct pci_module_info;
|
struct pci_module_info;
|
||||||
class OHCIRootHub;
|
class OHCIRootHub;
|
||||||
|
|
||||||
typedef struct transfer_data_s {
|
typedef struct transfer_data {
|
||||||
Transfer *transfer;
|
Transfer * transfer;
|
||||||
ohci_endpoint_descriptor *endpoint;
|
ohci_endpoint_descriptor * endpoint;
|
||||||
ohci_general_td *first_descriptor;
|
ohci_general_td * first_descriptor;
|
||||||
ohci_general_td *data_descriptor;
|
ohci_general_td * data_descriptor;
|
||||||
ohci_general_td *last_descriptor;
|
ohci_general_td * last_descriptor;
|
||||||
bool incoming;
|
bool incoming;
|
||||||
bool canceled;
|
bool canceled;
|
||||||
transfer_data_s *link;
|
transfer_data * link;
|
||||||
} transfer_data;
|
} transfer_data;
|
||||||
|
|
||||||
|
|
||||||
@@ -89,15 +88,15 @@ static int32 _FinishThread(void *data);
|
|||||||
transfer_data *transfer);
|
transfer_data *transfer);
|
||||||
|
|
||||||
// Endpoint related methods
|
// Endpoint related methods
|
||||||
ohci_endpoint_descriptor *_AllocateEndpoint();
|
ohci_endpoint_descriptor * _AllocateEndpoint();
|
||||||
void _FreeEndpoint(
|
void _FreeEndpoint(
|
||||||
ohci_endpoint_descriptor *endpoint);
|
ohci_endpoint_descriptor *endpoint);
|
||||||
status_t _InsertEndpointForPipe(Pipe *pipe);
|
status_t _InsertEndpointForPipe(Pipe *pipe);
|
||||||
status_t _RemoveEndpointForPipe(Pipe *pipe);
|
status_t _RemoveEndpointForPipe(Pipe *pipe);
|
||||||
ohci_endpoint_descriptor *_FindInterruptEndpoint(uint8 interval);
|
ohci_endpoint_descriptor * _FindInterruptEndpoint(uint8 interval);
|
||||||
|
|
||||||
// Transfer descriptor related methods
|
// Transfer descriptor related methods
|
||||||
ohci_general_td *_CreateGeneralDescriptor(
|
ohci_general_td * _CreateGeneralDescriptor(
|
||||||
size_t bufferSize);
|
size_t bufferSize);
|
||||||
void _FreeGeneralDescriptor(
|
void _FreeGeneralDescriptor(
|
||||||
ohci_general_td *descriptor);
|
ohci_general_td *descriptor);
|
||||||
@@ -122,7 +121,7 @@ static int32 _FinishThread(void *data);
|
|||||||
void _LinkDescriptors(ohci_general_td *first,
|
void _LinkDescriptors(ohci_general_td *first,
|
||||||
ohci_general_td *second);
|
ohci_general_td *second);
|
||||||
|
|
||||||
ohci_isochronous_td *_CreateIsochronousDescriptor();
|
ohci_isochronous_td * _CreateIsochronousDescriptor();
|
||||||
void _FreeIsochronousDescriptor(
|
void _FreeIsochronousDescriptor(
|
||||||
ohci_isochronous_td *descriptor);
|
ohci_isochronous_td *descriptor);
|
||||||
|
|
||||||
@@ -140,33 +139,33 @@ inline uint32 _ReadReg(uint32 reg);
|
|||||||
void _PrintDescriptorChain(
|
void _PrintDescriptorChain(
|
||||||
ohci_general_td *topDescriptor);
|
ohci_general_td *topDescriptor);
|
||||||
|
|
||||||
static pci_module_info *sPCIModule;
|
static pci_module_info * sPCIModule;
|
||||||
pci_info *fPCIInfo;
|
pci_info * fPCIInfo;
|
||||||
Stack *fStack;
|
Stack * fStack;
|
||||||
|
|
||||||
uint8 *fOperationalRegisters;
|
uint8 * fOperationalRegisters;
|
||||||
area_id fRegisterArea;
|
area_id fRegisterArea;
|
||||||
|
|
||||||
// Host Controller Communication Area related stuff
|
// Host Controller Communication Area related stuff
|
||||||
area_id fHccaArea;
|
area_id fHccaArea;
|
||||||
ohci_hcca *fHcca;
|
ohci_hcca * fHcca;
|
||||||
ohci_endpoint_descriptor **fInterruptEndpoints;
|
ohci_endpoint_descriptor ** fInterruptEndpoints;
|
||||||
|
|
||||||
// Endpoint management
|
// Endpoint management
|
||||||
mutex fEndpointLock;
|
mutex fEndpointLock;
|
||||||
ohci_endpoint_descriptor *fDummyControl;
|
ohci_endpoint_descriptor * fDummyControl;
|
||||||
ohci_endpoint_descriptor *fDummyBulk;
|
ohci_endpoint_descriptor * fDummyBulk;
|
||||||
ohci_endpoint_descriptor *fDummyIsochronous;
|
ohci_endpoint_descriptor * fDummyIsochronous;
|
||||||
|
|
||||||
// Maintain a linked list of transfer
|
// Maintain a linked list of transfer
|
||||||
transfer_data *fFirstTransfer;
|
transfer_data * fFirstTransfer;
|
||||||
transfer_data *fLastTransfer;
|
transfer_data * fLastTransfer;
|
||||||
sem_id fFinishTransfersSem;
|
sem_id fFinishTransfersSem;
|
||||||
thread_id fFinishThread;
|
thread_id fFinishThread;
|
||||||
bool fStopFinishThread;
|
bool fStopFinishThread;
|
||||||
|
|
||||||
// Root Hub
|
// Root Hub
|
||||||
OHCIRootHub *fRootHub;
|
OHCIRootHub * fRootHub;
|
||||||
uint8 fRootHubAddress;
|
uint8 fRootHubAddress;
|
||||||
|
|
||||||
// Port management
|
// Port management
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
* Niels S. Reedijk
|
* Niels S. Reedijk
|
||||||
* Salvatore Benedetto <[email protected]>
|
* Salvatore Benedetto <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef UHCI_H
|
#ifndef UHCI_H
|
||||||
#define UHCI_H
|
#define UHCI_H
|
||||||
|
|
||||||
@@ -54,39 +53,39 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
status_t fStatus;
|
status_t fStatus;
|
||||||
Stack *fStack;
|
Stack * fStack;
|
||||||
uhci_qh *fQueueHead;
|
uhci_qh * fQueueHead;
|
||||||
uhci_td *fStrayDescriptor;
|
uhci_td * fStrayDescriptor;
|
||||||
uhci_qh *fQueueTop;
|
uhci_qh * fQueueTop;
|
||||||
mutex fLock;
|
mutex fLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct transfer_data_s {
|
typedef struct transfer_data {
|
||||||
Transfer *transfer;
|
Transfer * transfer;
|
||||||
Queue *queue;
|
Queue * queue;
|
||||||
uhci_qh *transfer_queue;
|
uhci_qh * transfer_queue;
|
||||||
uhci_td *first_descriptor;
|
uhci_td * first_descriptor;
|
||||||
uhci_td *data_descriptor;
|
uhci_td * data_descriptor;
|
||||||
bool incoming;
|
bool incoming;
|
||||||
bool canceled;
|
bool canceled;
|
||||||
transfer_data_s *link;
|
transfer_data * link;
|
||||||
} transfer_data;
|
} transfer_data;
|
||||||
|
|
||||||
|
|
||||||
// This structure is used to create a list of
|
// This structure is used to create a list of
|
||||||
// descriptors per isochronous transfer
|
// descriptors per isochronous transfer
|
||||||
typedef struct isochronous_transfer_data_s {
|
typedef struct isochronous_transfer_data {
|
||||||
Transfer *transfer;
|
Transfer * transfer;
|
||||||
// The next field is used to keep track
|
// The next field is used to keep track
|
||||||
// of every isochronous descriptor as they are NOT
|
// of every isochronous descriptor as they are NOT
|
||||||
// linked to each other in a queue like in every other
|
// linked to each other in a queue like in every other
|
||||||
// transfer type
|
// transfer type
|
||||||
uhci_td **descriptors;
|
uhci_td ** descriptors;
|
||||||
uint16 last_to_process;
|
uint16 last_to_process;
|
||||||
bool incoming;
|
bool incoming;
|
||||||
bool is_active;
|
bool is_active;
|
||||||
isochronous_transfer_data_s *link;
|
isochronous_transfer_data * link;
|
||||||
} isochronous_transfer_data;
|
} isochronous_transfer_data;
|
||||||
|
|
||||||
|
|
||||||
@@ -145,22 +144,22 @@ static int32 FinishThread(void *data);
|
|||||||
// Isochronous transfer functions
|
// Isochronous transfer functions
|
||||||
static int32 FinishIsochronousThread(void *data);
|
static int32 FinishIsochronousThread(void *data);
|
||||||
void FinishIsochronousTransfers();
|
void FinishIsochronousTransfers();
|
||||||
isochronous_transfer_data *FindIsochronousTransfer(uhci_td *descriptor);
|
isochronous_transfer_data * FindIsochronousTransfer(uhci_td *descriptor);
|
||||||
|
|
||||||
status_t LinkIsochronousDescriptor(
|
status_t LinkIsochronousDescriptor(
|
||||||
uhci_td *descriptor,
|
uhci_td *descriptor,
|
||||||
uint16 frame);
|
uint16 frame);
|
||||||
uhci_td *UnlinkIsochronousDescriptor(uint16 frame);
|
uhci_td * UnlinkIsochronousDescriptor(uint16 frame);
|
||||||
|
|
||||||
// Transfer queue functions
|
// Transfer queue functions
|
||||||
uhci_qh *CreateTransferQueue(uhci_td *descriptor);
|
uhci_qh * CreateTransferQueue(uhci_td *descriptor);
|
||||||
void FreeTransferQueue(uhci_qh *queueHead);
|
void FreeTransferQueue(uhci_qh *queueHead);
|
||||||
|
|
||||||
bool LockIsochronous();
|
bool LockIsochronous();
|
||||||
void UnlockIsochronous();
|
void UnlockIsochronous();
|
||||||
|
|
||||||
// Descriptor functions
|
// Descriptor functions
|
||||||
uhci_td *CreateDescriptor(Pipe *pipe,
|
uhci_td * CreateDescriptor(Pipe *pipe,
|
||||||
uint8 direction,
|
uint8 direction,
|
||||||
size_t bufferSizeToAllocate);
|
size_t bufferSizeToAllocate);
|
||||||
status_t CreateDescriptorChain(Pipe *pipe,
|
status_t CreateDescriptorChain(Pipe *pipe,
|
||||||
@@ -198,51 +197,50 @@ inline uint8 ReadReg8(uint32 reg);
|
|||||||
inline uint16 ReadReg16(uint32 reg);
|
inline uint16 ReadReg16(uint32 reg);
|
||||||
inline uint32 ReadReg32(uint32 reg);
|
inline uint32 ReadReg32(uint32 reg);
|
||||||
|
|
||||||
static pci_module_info *sPCIModule;
|
static pci_module_info * sPCIModule;
|
||||||
|
|
||||||
uint32 fRegisterBase;
|
uint32 fRegisterBase;
|
||||||
pci_info *fPCIInfo;
|
pci_info * fPCIInfo;
|
||||||
Stack *fStack;
|
Stack * fStack;
|
||||||
uint32 fEnabledInterrupts;
|
uint32 fEnabledInterrupts;
|
||||||
|
|
||||||
// Frame list memory
|
// Frame list memory
|
||||||
area_id fFrameArea;
|
area_id fFrameArea;
|
||||||
uint32 *fFrameList;
|
uint32 * fFrameList;
|
||||||
|
|
||||||
// fFrameBandwidth[n] holds the available bandwidth
|
// fFrameBandwidth[n] holds the available bandwidth
|
||||||
// of the nth frame in microseconds
|
// of the nth frame in microseconds
|
||||||
uint16 *fFrameBandwidth;
|
uint16 * fFrameBandwidth;
|
||||||
|
|
||||||
// fFirstIsochronousTransfer[n] and fLastIsochronousDescriptor[n]
|
// fFirstIsochronousTransfer[n] and fLastIsochronousDescriptor[n]
|
||||||
// keeps track of the first and last isochronous transfer descriptor
|
// keeps track of the first and last isochronous transfer descriptor
|
||||||
// in the nth frame
|
// in the nth frame
|
||||||
uhci_td **fFirstIsochronousDescriptor;
|
uhci_td ** fFirstIsochronousDescriptor;
|
||||||
uhci_td **fLastIsochronousDescriptor;
|
uhci_td ** fLastIsochronousDescriptor;
|
||||||
|
|
||||||
// Queues
|
// Queues
|
||||||
int32 fQueueCount;
|
int32 fQueueCount;
|
||||||
Queue **fQueues;
|
Queue ** fQueues;
|
||||||
|
|
||||||
// Maintain a linked list of transfers
|
// Maintain a linked list of transfers
|
||||||
transfer_data *fFirstTransfer;
|
transfer_data * fFirstTransfer;
|
||||||
transfer_data *fLastTransfer;
|
transfer_data * fLastTransfer;
|
||||||
sem_id fFinishTransfersSem;
|
sem_id fFinishTransfersSem;
|
||||||
thread_id fFinishThread;
|
thread_id fFinishThread;
|
||||||
bool fStopFinishThread;
|
bool fStopFinishThread;
|
||||||
|
|
||||||
// Maintain a linked list of isochronous transfers
|
// Maintain a linked list of isochronous transfers
|
||||||
isochronous_transfer_data *fFirstIsochronousTransfer;
|
isochronous_transfer_data * fFirstIsochronousTransfer;
|
||||||
isochronous_transfer_data *fLastIsochronousTransfer;
|
isochronous_transfer_data * fLastIsochronousTransfer;
|
||||||
sem_id fFinishIsochronousTransfersSem;
|
sem_id fFinishIsochronousTransfersSem;
|
||||||
thread_id fFinishIsochronousThread;
|
thread_id fFinishIsochronousThread;
|
||||||
mutex fIsochronousLock;
|
mutex fIsochronousLock;
|
||||||
bool fStopFinishIsochronousThread;
|
bool fStopFinishIsochronousThread;
|
||||||
|
|
||||||
// Root hub
|
// Root hub
|
||||||
UHCIRootHub *fRootHub;
|
UHCIRootHub * fRootHub;
|
||||||
uint8 fRootHubAddress;
|
uint8 fRootHubAddress;
|
||||||
uint8 fPortResetChange;
|
uint8 fPortResetChange;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user