git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30713 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-05-11 23:56:26 +00:00
parent 9bc8951dc9
commit aaf7738499
3 changed files with 77 additions and 79 deletions

View File

@ -5,7 +5,6 @@
* Authors:
* Michael Lotz <mmlr@mlotz.ch>
*/
#ifndef EHCI_H
#define EHCI_H
@ -18,13 +17,13 @@ struct pci_module_info;
class EHCIRootHub;
typedef struct transfer_data_s {
Transfer *transfer;
ehci_qh *queue_head;
ehci_qtd *data_descriptor;
typedef struct transfer_data {
Transfer * transfer;
ehci_qh * queue_head;
ehci_qtd * data_descriptor;
bool incoming;
bool canceled;
transfer_data_s *link;
transfer_data * link;
} transfer_data;
@ -75,7 +74,7 @@ static int32 CleanupThread(void *data);
void Cleanup();
// Queue Head functions
ehci_qh *CreateQueueHead();
ehci_qh * CreateQueueHead();
status_t InitQueueHead(ehci_qh *queueHead,
Pipe *pipe);
void FreeQueueHead(ehci_qh *queueHead);
@ -97,7 +96,8 @@ static int32 CleanupThread(void *data);
bool *directionIn);
// Descriptor functions
ehci_qtd *CreateDescriptor(size_t bufferSizeToAllocate,
ehci_qtd * CreateDescriptor(
size_t bufferSizeToAllocate,
uint8 pid);
status_t CreateDescriptorChain(Pipe *pipe,
ehci_qtd **firstDescriptor,
@ -112,7 +112,8 @@ static int32 CleanupThread(void *data);
void LinkDescriptors(ehci_qtd *first,
ehci_qtd *last, ehci_qtd *alt);
size_t WriteDescriptorChain(ehci_qtd *topDescriptor,
size_t WriteDescriptorChain(
ehci_qtd *topDescriptor,
iovec *vector, size_t vectorCount);
size_t ReadDescriptorChain(ehci_qtd *topDescriptor,
iovec *vector, size_t vectorCount,
@ -129,36 +130,36 @@ inline uint8 ReadCapReg8(uint32 reg);
inline uint16 ReadCapReg16(uint32 reg);
inline uint32 ReadCapReg32(uint32 reg);
static pci_module_info *sPCIModule;
static pci_module_info * sPCIModule;
uint8 *fCapabilityRegisters;
uint8 *fOperationalRegisters;
uint8 * fCapabilityRegisters;
uint8 * fOperationalRegisters;
area_id fRegisterArea;
pci_info *fPCIInfo;
Stack *fStack;
pci_info * fPCIInfo;
Stack * fStack;
uint32 fEnabledInterrupts;
// Periodic transfer framelist and interrupt entries
area_id fPeriodicFrameListArea;
addr_t *fPeriodicFrameList;
interrupt_entry *fInterruptEntries;
addr_t * fPeriodicFrameList;
interrupt_entry * fInterruptEntries;
// Async transfer queue management
ehci_qh *fAsyncQueueHead;
ehci_qh * fAsyncQueueHead;
sem_id fAsyncAdvanceSem;
// Maintain a linked list of transfers
transfer_data *fFirstTransfer;
transfer_data *fLastTransfer;
transfer_data * fFirstTransfer;
transfer_data * fLastTransfer;
sem_id fFinishTransfersSem;
thread_id fFinishThread;
sem_id fCleanupSem;
thread_id fCleanupThread;
bool fStopThreads;
ehci_qh *fFreeListHead;
ehci_qh * fFreeListHead;
// Root Hub
EHCIRootHub *fRootHub;
EHCIRootHub * fRootHub;
uint8 fRootHubAddress;
// Port management

View File

@ -7,7 +7,6 @@
* Salvatore Benedetto <salvatore.benedetto@gmail.com>
* Michael Lotz <mmlr@mlotz.ch>
*/
#ifndef OHCI_H
#define OHCI_H
@ -19,15 +18,15 @@ struct pci_info;
struct pci_module_info;
class OHCIRootHub;
typedef struct transfer_data_s {
Transfer *transfer;
ohci_endpoint_descriptor *endpoint;
ohci_general_td *first_descriptor;
ohci_general_td *data_descriptor;
ohci_general_td *last_descriptor;
typedef struct transfer_data {
Transfer * transfer;
ohci_endpoint_descriptor * endpoint;
ohci_general_td * first_descriptor;
ohci_general_td * data_descriptor;
ohci_general_td * last_descriptor;
bool incoming;
bool canceled;
transfer_data_s *link;
transfer_data * link;
} transfer_data;
@ -89,15 +88,15 @@ static int32 _FinishThread(void *data);
transfer_data *transfer);
// Endpoint related methods
ohci_endpoint_descriptor *_AllocateEndpoint();
ohci_endpoint_descriptor * _AllocateEndpoint();
void _FreeEndpoint(
ohci_endpoint_descriptor *endpoint);
status_t _InsertEndpointForPipe(Pipe *pipe);
status_t _RemoveEndpointForPipe(Pipe *pipe);
ohci_endpoint_descriptor *_FindInterruptEndpoint(uint8 interval);
ohci_endpoint_descriptor * _FindInterruptEndpoint(uint8 interval);
// Transfer descriptor related methods
ohci_general_td *_CreateGeneralDescriptor(
ohci_general_td * _CreateGeneralDescriptor(
size_t bufferSize);
void _FreeGeneralDescriptor(
ohci_general_td *descriptor);
@ -122,7 +121,7 @@ static int32 _FinishThread(void *data);
void _LinkDescriptors(ohci_general_td *first,
ohci_general_td *second);
ohci_isochronous_td *_CreateIsochronousDescriptor();
ohci_isochronous_td * _CreateIsochronousDescriptor();
void _FreeIsochronousDescriptor(
ohci_isochronous_td *descriptor);
@ -140,33 +139,33 @@ inline uint32 _ReadReg(uint32 reg);
void _PrintDescriptorChain(
ohci_general_td *topDescriptor);
static pci_module_info *sPCIModule;
pci_info *fPCIInfo;
Stack *fStack;
static pci_module_info * sPCIModule;
pci_info * fPCIInfo;
Stack * fStack;
uint8 *fOperationalRegisters;
uint8 * fOperationalRegisters;
area_id fRegisterArea;
// Host Controller Communication Area related stuff
area_id fHccaArea;
ohci_hcca *fHcca;
ohci_endpoint_descriptor **fInterruptEndpoints;
ohci_hcca * fHcca;
ohci_endpoint_descriptor ** fInterruptEndpoints;
// Endpoint management
mutex fEndpointLock;
ohci_endpoint_descriptor *fDummyControl;
ohci_endpoint_descriptor *fDummyBulk;
ohci_endpoint_descriptor *fDummyIsochronous;
ohci_endpoint_descriptor * fDummyControl;
ohci_endpoint_descriptor * fDummyBulk;
ohci_endpoint_descriptor * fDummyIsochronous;
// Maintain a linked list of transfer
transfer_data *fFirstTransfer;
transfer_data *fLastTransfer;
transfer_data * fFirstTransfer;
transfer_data * fLastTransfer;
sem_id fFinishTransfersSem;
thread_id fFinishThread;
bool fStopFinishThread;
// Root Hub
OHCIRootHub *fRootHub;
OHCIRootHub * fRootHub;
uint8 fRootHubAddress;
// Port management

View File

@ -7,7 +7,6 @@
* Niels S. Reedijk
* Salvatore Benedetto <salvatore.benedetto@gmail.com>
*/
#ifndef UHCI_H
#define UHCI_H
@ -54,39 +53,39 @@ public:
private:
status_t fStatus;
Stack *fStack;
uhci_qh *fQueueHead;
uhci_td *fStrayDescriptor;
uhci_qh *fQueueTop;
Stack * fStack;
uhci_qh * fQueueHead;
uhci_td * fStrayDescriptor;
uhci_qh * fQueueTop;
mutex fLock;
};
typedef struct transfer_data_s {
Transfer *transfer;
Queue *queue;
uhci_qh *transfer_queue;
uhci_td *first_descriptor;
uhci_td *data_descriptor;
typedef struct transfer_data {
Transfer * transfer;
Queue * queue;
uhci_qh * transfer_queue;
uhci_td * first_descriptor;
uhci_td * data_descriptor;
bool incoming;
bool canceled;
transfer_data_s *link;
transfer_data * link;
} transfer_data;
// This structure is used to create a list of
// descriptors per isochronous transfer
typedef struct isochronous_transfer_data_s {
Transfer *transfer;
typedef struct isochronous_transfer_data {
Transfer * transfer;
// The next field is used to keep track
// of every isochronous descriptor as they are NOT
// linked to each other in a queue like in every other
// transfer type
uhci_td **descriptors;
uhci_td ** descriptors;
uint16 last_to_process;
bool incoming;
bool is_active;
isochronous_transfer_data_s *link;
isochronous_transfer_data * link;
} isochronous_transfer_data;
@ -145,22 +144,22 @@ static int32 FinishThread(void *data);
// Isochronous transfer functions
static int32 FinishIsochronousThread(void *data);
void FinishIsochronousTransfers();
isochronous_transfer_data *FindIsochronousTransfer(uhci_td *descriptor);
isochronous_transfer_data * FindIsochronousTransfer(uhci_td *descriptor);
status_t LinkIsochronousDescriptor(
uhci_td *descriptor,
uint16 frame);
uhci_td *UnlinkIsochronousDescriptor(uint16 frame);
uhci_td * UnlinkIsochronousDescriptor(uint16 frame);
// Transfer queue functions
uhci_qh *CreateTransferQueue(uhci_td *descriptor);
uhci_qh * CreateTransferQueue(uhci_td *descriptor);
void FreeTransferQueue(uhci_qh *queueHead);
bool LockIsochronous();
void UnlockIsochronous();
// Descriptor functions
uhci_td *CreateDescriptor(Pipe *pipe,
uhci_td * CreateDescriptor(Pipe *pipe,
uint8 direction,
size_t bufferSizeToAllocate);
status_t CreateDescriptorChain(Pipe *pipe,
@ -198,51 +197,50 @@ inline uint8 ReadReg8(uint32 reg);
inline uint16 ReadReg16(uint32 reg);
inline uint32 ReadReg32(uint32 reg);
static pci_module_info *sPCIModule;
static pci_module_info * sPCIModule;
uint32 fRegisterBase;
pci_info *fPCIInfo;
Stack *fStack;
pci_info * fPCIInfo;
Stack * fStack;
uint32 fEnabledInterrupts;
// Frame list memory
area_id fFrameArea;
uint32 *fFrameList;
uint32 * fFrameList;
// fFrameBandwidth[n] holds the available bandwidth
// of the nth frame in microseconds
uint16 *fFrameBandwidth;
uint16 * fFrameBandwidth;
// fFirstIsochronousTransfer[n] and fLastIsochronousDescriptor[n]
// keeps track of the first and last isochronous transfer descriptor
// in the nth frame
uhci_td **fFirstIsochronousDescriptor;
uhci_td **fLastIsochronousDescriptor;
uhci_td ** fFirstIsochronousDescriptor;
uhci_td ** fLastIsochronousDescriptor;
// Queues
int32 fQueueCount;
Queue **fQueues;
Queue ** fQueues;
// Maintain a linked list of transfers
transfer_data *fFirstTransfer;
transfer_data *fLastTransfer;
transfer_data * fFirstTransfer;
transfer_data * fLastTransfer;
sem_id fFinishTransfersSem;
thread_id fFinishThread;
bool fStopFinishThread;
// Maintain a linked list of isochronous transfers
isochronous_transfer_data *fFirstIsochronousTransfer;
isochronous_transfer_data *fLastIsochronousTransfer;
isochronous_transfer_data * fFirstIsochronousTransfer;
isochronous_transfer_data * fLastIsochronousTransfer;
sem_id fFinishIsochronousTransfersSem;
thread_id fFinishIsochronousThread;
mutex fIsochronousLock;
bool fStopFinishIsochronousThread;
// Root hub
UHCIRootHub *fRootHub;
UHCIRootHub * fRootHub;
uint8 fRootHubAddress;
uint8 fPortResetChange;
};