* Clean up ohci_rh.cpp, following the style used in the others *hci_rh.cpp files
* Forgot to remove ohci_software in my previous patch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22532 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -25,20 +25,23 @@
|
|||||||
|
|
||||||
static usb_device_descriptor sOHCIRootHubDevice =
|
static usb_device_descriptor sOHCIRootHubDevice =
|
||||||
{
|
{
|
||||||
0x12, //Descriptor size
|
0x12, // Descriptor size
|
||||||
USB_DESCRIPTOR_DEVICE , //Type of descriptor
|
USB_DESCRIPTOR_DEVICE, // Type of descriptor
|
||||||
0x110, //USB 1.1
|
0x110, // USB 1.1
|
||||||
0x09 , //Hub type
|
0x09, // Hub type
|
||||||
0 , //Subclass
|
0, // Subclass
|
||||||
0 , //Protocol
|
0, // Protocol
|
||||||
64 , //Max packet size
|
64, // Max packet size
|
||||||
0 , //Vendor
|
0, // Vendor
|
||||||
0 , //Product
|
0, // Product
|
||||||
0x110 , //Version
|
0x110, // Version
|
||||||
1 , 2 , 0 , //Other data
|
1, // Index of manufacture string
|
||||||
1 //Number of configurations
|
2, // Index of product string
|
||||||
|
0, // Index of serial number string
|
||||||
|
1 // Number of configurations
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ohci_root_hub_configuration_s {
|
struct ohci_root_hub_configuration_s {
|
||||||
usb_configuration_descriptor configuration;
|
usb_configuration_descriptor configuration;
|
||||||
usb_interface_descriptor interface;
|
usb_interface_descriptor interface;
|
||||||
@@ -46,47 +49,50 @@ struct ohci_root_hub_configuration_s {
|
|||||||
usb_hub_descriptor hub;
|
usb_hub_descriptor hub;
|
||||||
} _PACKED;
|
} _PACKED;
|
||||||
|
|
||||||
static ohci_root_hub_configuration_s sOHCIRootHubConfig = {
|
|
||||||
|
static ohci_root_hub_configuration_s sOHCIRootHubConfig =
|
||||||
|
{
|
||||||
{ // configuration descriptor
|
{ // configuration descriptor
|
||||||
9, //Size
|
9, // Descriptor length
|
||||||
USB_DESCRIPTOR_CONFIGURATION,
|
USB_DESCRIPTOR_CONFIGURATION, // Descriptor type
|
||||||
34, //Total size of the configuration
|
34, // Total size of the configuration
|
||||||
1, //Number interfaces
|
1, // Number interfaces
|
||||||
1, //Value of configuration
|
1, // Value of configuration
|
||||||
0, //Number of configuration
|
0, // Number of configuration
|
||||||
0x40, //Self powered
|
0x40, // Self powered
|
||||||
0 //Max power (0, because of self power)
|
0 // Max power (0, because of self power)
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // interface descriptor
|
{ // interface descriptor
|
||||||
9, //Size
|
9, // Size
|
||||||
USB_DESCRIPTOR_INTERFACE,
|
USB_DESCRIPTOR_INTERFACE, // Type
|
||||||
0, //Interface number
|
0, // Interface number
|
||||||
0, //Alternate setting
|
0, // Alternate setting
|
||||||
1, //Num endpoints
|
1, // Num endpoints
|
||||||
0x09, //Interface class
|
0x09, // Interface class
|
||||||
0, //Interface subclass
|
0, // Interface subclass
|
||||||
0, //Interface protocol
|
0, // Interface protocol
|
||||||
0 //Interface
|
0 // Interface
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // endpoint descriptor
|
{ // endpoint descriptor
|
||||||
7, //Size
|
7, // Size
|
||||||
USB_DESCRIPTOR_ENDPOINT,
|
USB_DESCRIPTOR_ENDPOINT, // Type
|
||||||
USB_REQTYPE_DEVICE_IN | 1, //1 from freebsd driver
|
USB_REQTYPE_DEVICE_IN | 1, // Endpoint address (first in IN endpoint)
|
||||||
0x3, // Interrupt
|
0x03, // Attributes (0x03 = interrupt endpoint)
|
||||||
8, // Max packet size
|
8, // Max packet size
|
||||||
0xFF // Interval 256
|
0xFF // Interval 256
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ // hub descriptor
|
||||||
9, //Including deprecated powerctrlmask
|
9, // Lenght (including deprecated power
|
||||||
USB_DESCRIPTOR_HUB,
|
// control mask)
|
||||||
0, //Number of ports
|
USB_DESCRIPTOR_HUB, // Type
|
||||||
0x0000, //Hub characteristics FIXME
|
0, // Number of ports
|
||||||
50, //Power on to power good
|
0x0000, // Hub characteristics
|
||||||
|
50, // Power on to power good
|
||||||
0, // Current
|
0, // Current
|
||||||
0x00, //Both ports are removable
|
0x00, // Both ports are removable
|
||||||
0xff // Depricated power control mask
|
0xff // Depricated power control mask
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -128,44 +134,44 @@ static ohci_root_hub_string_s sOHCIRootHubStrings[3] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OHCIRootHub::OHCIRootHub(OHCI *ohci, int8 deviceAddress)
|
OHCIRootHub::OHCIRootHub(Object *rootObject, int8 deviceAddress)
|
||||||
: Hub(ohci->RootObject(), sOHCIRootHubDevice, deviceAddress , USB_SPEED_FULLSPEED )
|
: Hub(rootObject, sOHCIRootHubDevice, deviceAddress, USB_SPEED_FULLSPEED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
OHCIRootHub::ProcessTransfer(Transfer *t, OHCI *ohci)
|
OHCIRootHub::ProcessTransfer(OHCI *ohci, Transfer *transfer)
|
||||||
{
|
{
|
||||||
if ((t->TransferPipe()->Type() & USB_OBJECT_CONTROL_PIPE) == 0)
|
if ((transfer->TransferPipe()->Type() & USB_OBJECT_CONTROL_PIPE) == 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
usb_request_data *request = t->RequestData();
|
usb_request_data *request = transfer->RequestData();
|
||||||
TRACE(("OHCIRootHub::ProcessTransfer(): request: %d\n", request->Request));
|
|
||||||
|
|
||||||
uint32 status = B_TIMED_OUT;
|
TRACE(("usb_ohci_roothub(): request: %d\n", request->Request));
|
||||||
|
|
||||||
|
status_t status = B_TIMED_OUT;
|
||||||
size_t actualLength = 0;
|
size_t actualLength = 0;
|
||||||
switch (request->Request) {
|
switch (request->Request) {
|
||||||
case USB_REQUEST_GET_STATUS: {
|
case USB_REQUEST_GET_STATUS: {
|
||||||
if (request->Index == 0) {
|
if (request->Index == 0) {
|
||||||
// get hub status
|
// get hub status
|
||||||
actualLength = MIN(sizeof(usb_port_status),
|
actualLength = MIN(sizeof(usb_port_status),
|
||||||
t->DataLength());
|
transfer->DataLength());
|
||||||
// the hub reports whether the local power failed (bit 0)
|
// the hub reports whether the local power failed (bit 0)
|
||||||
// and if there is a over-current condition (bit 1).
|
// and if there is a over-current condition (bit 1).
|
||||||
// everything as 0 means all is ok.
|
// everything as 0 means all is ok.
|
||||||
// TODO (?) actually check for the value
|
// TODO (?) actually check for the value
|
||||||
memset(t->Data(), 0, actualLength);
|
memset(transfer->Data(), 0, actualLength);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_port_status portStatus;
|
usb_port_status portStatus;
|
||||||
if (ohci->GetPortStatus(request->Index, &portStatus) >= B_OK) {
|
if (ohci->GetPortStatus(request->Index - 1, &portStatus) >= B_OK) {
|
||||||
actualLength = MIN(sizeof(usb_port_status), t->DataLength());
|
actualLength = MIN(sizeof(usb_port_status), transfer->DataLength());
|
||||||
memcpy(t->Data(), (void *)&portStatus, actualLength);
|
memcpy(transfer->Data(), (void *)&portStatus, actualLength);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,30 +181,28 @@ OHCIRootHub::ProcessTransfer(Transfer *t, OHCI *ohci)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("OHCIRootHub::ProcessTransfer(): set address: %d\n", request->Value));
|
TRACE(("usb_ohci_roothub(): set address: %d\n", request->Value));
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_REQUEST_GET_DESCRIPTOR:
|
case USB_REQUEST_GET_DESCRIPTOR:
|
||||||
TRACE(("OHCIRootHub::ProcessTransfer(): get descriptor: %d\n", request->Value >> 8));
|
TRACE(("usb_ohci_roothub(): get descriptor: %d\n", request->Value >> 8));
|
||||||
|
|
||||||
switch (request->Value >> 8) {
|
switch (request->Value >> 8) {
|
||||||
case USB_DESCRIPTOR_DEVICE: {
|
case USB_DESCRIPTOR_DEVICE: {
|
||||||
actualLength = MIN(sizeof(usb_device_descriptor),
|
actualLength = MIN(sizeof(usb_device_descriptor),
|
||||||
t->DataLength());
|
transfer->DataLength());
|
||||||
memcpy(t->Data(), (void *)&sOHCIRootHubDevice,
|
memcpy(transfer->Data(), (void *)&sOHCIRootHubDevice,
|
||||||
actualLength);
|
actualLength);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case USB_DESCRIPTOR_CONFIGURATION: {
|
case USB_DESCRIPTOR_CONFIGURATION: {
|
||||||
//Make sure we have the correct number of ports
|
actualLength = MIN(sizeof(ohci_root_hub_configuration_s),
|
||||||
|
transfer->DataLength());
|
||||||
sOHCIRootHubConfig.hub.num_ports = ohci->PortCount();
|
sOHCIRootHubConfig.hub.num_ports = ohci->PortCount();
|
||||||
|
memcpy(transfer->Data(), (void *)&sOHCIRootHubConfig,
|
||||||
actualLength = MIN(sizeof(sOHCIRootHubConfig),
|
|
||||||
t->DataLength());
|
|
||||||
memcpy(t->Data(), (void *)&(sOHCIRootHubConfig),
|
|
||||||
actualLength);
|
actualLength);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
@@ -210,20 +214,18 @@ OHCIRootHub::ProcessTransfer(Transfer *t, OHCI *ohci)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
actualLength = MIN(sOHCIRootHubStrings[index].length,
|
actualLength = MIN(sOHCIRootHubStrings[index].length,
|
||||||
t->DataLength());
|
transfer->DataLength());
|
||||||
memcpy(t->Data(), (void *)&sOHCIRootHubStrings[index],
|
memcpy(transfer->Data(), (void *)&sOHCIRootHubStrings[index],
|
||||||
actualLength);
|
actualLength);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case USB_DESCRIPTOR_HUB: {
|
case USB_DESCRIPTOR_HUB: {
|
||||||
//Make sure we have the correct number of ports
|
|
||||||
sOHCIRootHubConfig.hub.num_ports = ohci->PortCount();
|
|
||||||
|
|
||||||
actualLength = MIN(sizeof(usb_hub_descriptor),
|
actualLength = MIN(sizeof(usb_hub_descriptor),
|
||||||
t->DataLength());
|
transfer->DataLength());
|
||||||
memcpy(t->Data(), (void *)&sOHCIRootHubConfig.hub,
|
sOHCIRootHubConfig.hub.num_ports = ohci->PortCount();
|
||||||
|
memcpy(transfer->Data(), (void *)&sOHCIRootHubConfig.hub,
|
||||||
actualLength);
|
actualLength);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
@@ -238,12 +240,12 @@ OHCIRootHub::ProcessTransfer(Transfer *t, OHCI *ohci)
|
|||||||
case USB_REQUEST_CLEAR_FEATURE: {
|
case USB_REQUEST_CLEAR_FEATURE: {
|
||||||
if (request->Index == 0) {
|
if (request->Index == 0) {
|
||||||
// we don't support any hub changes
|
// we don't support any hub changes
|
||||||
TRACE_ERROR(("OHCIRootHub::ProcessTransfer(): clear feature: no hub changes\n"));
|
TRACE_ERROR(("usb_ohci_roothub(): clear feature: no hub changes\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("OHCIRootHub::ProcessTransfer(): clear feature: %d\n", request->Value));
|
TRACE(("usb_ohci_roothub(): clear feature: %d\n", request->Value));
|
||||||
if (ohci->ClearPortFeature(request->Index, request->Value) >= B_OK)
|
if (ohci->ClearPortFeature(request->Index - 1, request->Value) >= B_OK)
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -251,19 +253,18 @@ OHCIRootHub::ProcessTransfer(Transfer *t, OHCI *ohci)
|
|||||||
case USB_REQUEST_SET_FEATURE: {
|
case USB_REQUEST_SET_FEATURE: {
|
||||||
if (request->Index == 0) {
|
if (request->Index == 0) {
|
||||||
// we don't support any hub changes
|
// we don't support any hub changes
|
||||||
TRACE_ERROR(("OHCIRootHub::ProcessTransfer(): set feature: no hub changes\n"));
|
TRACE_ERROR(("usb_ohci_roothub(): set feature: no hub changes\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("OHCIRootHub::ProcessTransfer(): set feature: %d\n", request->Value));
|
TRACE(("usb_ohci_roothub(): set feature: %d\n", request->Value));
|
||||||
if (ohci->SetPortFeature(request->Index, request->Value) >= B_OK)
|
if (ohci->SetPortFeature(request->Index - 1, request->Value) >= B_OK)
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t->Finished(status, actualLength);
|
transfer->Finished(status, actualLength);
|
||||||
delete t;
|
delete transfer;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2005, Jan-Rixt Van Hoye
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef OHCI_SOFT_H
|
|
||||||
#define OHCI_SOFT_H
|
|
||||||
|
|
||||||
// ---------------------------
|
|
||||||
// OHCI:: Includes
|
|
||||||
// ---------------------------
|
|
||||||
|
|
||||||
#include "usb_p.h"
|
|
||||||
#include "ohci_hardware.h"
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------
|
|
||||||
// OHCI:: Software isonchronous
|
|
||||||
// transfer descriptor
|
|
||||||
// --------------------------------------
|
|
||||||
typedef struct hcd_soft_itransfer
|
|
||||||
{
|
|
||||||
hc_itransfer_descriptor itd;
|
|
||||||
struct hcd_soft_itransfer *nextitd; // mirrors nexttd in ITD
|
|
||||||
struct hcd_soft_itransfer *dnext; // next in done list
|
|
||||||
addr_t physaddr; // physical address to the host controller isonchronous transfer
|
|
||||||
//LIST_ENTRY(hcd_soft_itransfer) hnext;
|
|
||||||
uint16 flags; // flags
|
|
||||||
#ifdef DIAGNOSTIC
|
|
||||||
char isdone; // is the transfer done?
|
|
||||||
#endif
|
|
||||||
}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_CHUNK 64
|
|
||||||
|
|
||||||
// ------------------------------------------
|
|
||||||
// OHCI:: Number of enpoint descriptors (63)
|
|
||||||
// ------------------------------------------
|
|
||||||
|
|
||||||
#define OHCI_NO_EDS (2*OHCI_NO_INTRS-1)
|
|
||||||
|
|
||||||
|
|
||||||
#endif // OHCI_SOFT
|
|
||||||
Reference in New Issue
Block a user