style cleanup; tab fixes; no functional change
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40363 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "Driver.h"
|
#include "Driver.h"
|
||||||
|
|
||||||
|
|
||||||
BeceemCPU::BeceemCPU()
|
BeceemCPU::BeceemCPU()
|
||||||
{
|
{
|
||||||
TRACE("Debug: Load CPU handler\n");
|
TRACE("Debug: Load CPU handler\n");
|
||||||
@@ -32,9 +33,9 @@ BeceemCPU::CPUInit(WIMAX_DEVICE* swmxdevice)
|
|||||||
status_t
|
status_t
|
||||||
BeceemCPU::CPURun()
|
BeceemCPU::CPURun()
|
||||||
{
|
{
|
||||||
unsigned int value = 0;
|
unsigned int clkReg = 0;
|
||||||
|
|
||||||
if (BizarroReadRegister(CLOCK_RESET_CNTRL_REG_1, sizeof(value), &value)
|
if (BizarroReadRegister(CLOCK_RESET_CNTRL_REG_1, sizeof(clkReg), &clkReg)
|
||||||
!= B_OK) {
|
!= B_OK) {
|
||||||
|
|
||||||
TRACE_ALWAYS("Error: Read of clock reset reg failure\n");
|
TRACE_ALWAYS("Error: Read of clock reset reg failure\n");
|
||||||
@@ -42,12 +43,12 @@ BeceemCPU::CPURun()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pwmxdevice->CPUFlashBoot) {
|
if (pwmxdevice->CPUFlashBoot) {
|
||||||
value&=(~(1<<30));
|
clkReg &= (~(1<<30));
|
||||||
} else {
|
} else {
|
||||||
value |=(1<<30);
|
clkReg |= (1<<30);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BizarroWriteRegister(CLOCK_RESET_CNTRL_REG_1, sizeof(value), &value)
|
if (BizarroWriteRegister(CLOCK_RESET_CNTRL_REG_1, sizeof(clkReg), &clkReg)
|
||||||
!= B_OK) {
|
!= B_OK) {
|
||||||
|
|
||||||
TRACE_ALWAYS("Error: Write of clock reset reg failure\n");
|
TRACE_ALWAYS("Error: Write of clock reset reg failure\n");
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
mutex gUSBLock;
|
mutex gUSBLock;
|
||||||
|
|
||||||
|
|
||||||
// auto-release helper class
|
// auto-release helper class
|
||||||
class USBSmartLock {
|
class USBSmartLock {
|
||||||
public:
|
public:
|
||||||
@@ -375,7 +376,8 @@ BeceemDevice::Read(uint8 *buffer, size_t *numBytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Safely tidy up after a major device hiccup
|
// Safely tidy up after a major device hiccup
|
||||||
if (fStatusRead != B_OK && fStatusRead != B_CANCELED && !pwmxdevice->driverHalt) {
|
if (fStatusRead != B_OK && fStatusRead != B_CANCELED
|
||||||
|
&& !pwmxdevice->driverHalt) {
|
||||||
TRACE_ALWAYS("Error: Device status error:%#010x\n", fStatusRead);
|
TRACE_ALWAYS("Error: Device status error:%#010x\n", fStatusRead);
|
||||||
result = gUSBModule->clear_feature(fReadEndpoint,
|
result = gUSBModule->clear_feature(fReadEndpoint,
|
||||||
USB_FEATURE_ENDPOINT_HALT);
|
USB_FEATURE_ENDPOINT_HALT);
|
||||||
@@ -431,13 +433,15 @@ BeceemDevice::Write(const uint8 *buffer, size_t *numBytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fHasConnection) {
|
if (!fHasConnection) {
|
||||||
TRACE_ALWAYS("Error writing %d bytes to device while WiMAX connection down.\n",
|
TRACE_ALWAYS("Error writing %d bytes to device"
|
||||||
|
" while WiMAX connection down.\n",
|
||||||
numBytesToWrite);
|
numBytesToWrite);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fTXBufferFull) {
|
if (fTXBufferFull) {
|
||||||
TRACE_ALWAYS("Error writing %d bytes to device while TX buffer full.\n",
|
TRACE_ALWAYS("Error writing %d bytes to device"
|
||||||
|
" while TX buffer full.\n",
|
||||||
numBytesToWrite);
|
numBytesToWrite);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -476,7 +480,8 @@ BeceemDevice::Write(const uint8 *buffer, size_t *numBytes)
|
|||||||
USB_FEATURE_ENDPOINT_HALT);
|
USB_FEATURE_ENDPOINT_HALT);
|
||||||
|
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
TRACE_ALWAYS("Error during clearing of HALT state:%#010x\n", result);
|
TRACE_ALWAYS("Error during clearing of HALT state:"
|
||||||
|
" %#010x\n", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -652,7 +657,7 @@ BeceemDevice::SetupDevice(bool deviceReplugged)
|
|||||||
{
|
{
|
||||||
BizarroReadRegister(SYS_CFG, sizeof(value), &value);
|
BizarroReadRegister(SYS_CFG, sizeof(value), &value);
|
||||||
pwmxdevice->syscfgBefFw = value;
|
pwmxdevice->syscfgBefFw = value;
|
||||||
if((value & 0x60)== 0)
|
if ((value & 0x60)== 0)
|
||||||
{
|
{
|
||||||
TRACE("Debug: CPU is FlashBoot\n");
|
TRACE("Debug: CPU is FlashBoot\n");
|
||||||
pwmxdevice->CPUFlashBoot = true;
|
pwmxdevice->CPUFlashBoot = true;
|
||||||
@@ -683,18 +688,21 @@ BeceemDevice::SetupDevice(bool deviceReplugged)
|
|||||||
// Each bcm chip has a custom binary config
|
// Each bcm chip has a custom binary config
|
||||||
// telling the device about itself (how it was designed)
|
// telling the device about itself (how it was designed)
|
||||||
if (PushConfig(CONF_BEGIN_ADDR) != B_OK) {
|
if (PushConfig(CONF_BEGIN_ADDR) != B_OK) {
|
||||||
TRACE_ALWAYS("Vendor configuration push failed, aborting device setup.\n");
|
TRACE_ALWAYS("Vendor configuration push failed."
|
||||||
|
" Aborting device setup.\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up GPIO (nvmVer 5+ is double sized)
|
// Set up GPIO (nvmVer 5+ is double sized)
|
||||||
if (pwmxdevice->nvmVerMajor < 5) {
|
if (pwmxdevice->nvmVerMajor < 5) {
|
||||||
TRACE("Debug: VerMajor < 5 PARAM pointer\n");
|
TRACE("Debug: VerMajor < 5 PARAM pointer\n");
|
||||||
NVMRead(GPIO_PARAM_POINTER, 2, (unsigned int*)&pwmxdevice->hwParamPtr);
|
NVMRead(GPIO_PARAM_POINTER, 2,
|
||||||
|
(unsigned int*)&pwmxdevice->hwParamPtr);
|
||||||
pwmxdevice->hwParamPtr = ntohs(pwmxdevice->hwParamPtr);
|
pwmxdevice->hwParamPtr = ntohs(pwmxdevice->hwParamPtr);
|
||||||
} else {
|
} else {
|
||||||
TRACE("Debug: VerMajor 5+ PARAM pointer\n");
|
TRACE("Debug: VerMajor 5+ PARAM pointer\n");
|
||||||
NVMRead(GPIO_PARAM_POINTER_MAP5, 4, (unsigned int*)&pwmxdevice->hwParamPtr);
|
NVMRead(GPIO_PARAM_POINTER_MAP5, 4,
|
||||||
|
(unsigned int*)&pwmxdevice->hwParamPtr);
|
||||||
// TODO : NVM : validate v5+ nvm params a-la ValidateDSDParamsChecksum
|
// TODO : NVM : validate v5+ nvm params a-la ValidateDSDParamsChecksum
|
||||||
pwmxdevice->hwParamPtr = ntohl(pwmxdevice->hwParamPtr);
|
pwmxdevice->hwParamPtr = ntohl(pwmxdevice->hwParamPtr);
|
||||||
}
|
}
|
||||||
@@ -749,13 +757,14 @@ BeceemDevice::SetupDevice(bool deviceReplugged)
|
|||||||
address.ebyte[3], address.ebyte[4], address.ebyte[5]);
|
address.ebyte[3], address.ebyte[4], address.ebyte[5]);
|
||||||
|
|
||||||
if (deviceReplugged) {
|
if (deviceReplugged) {
|
||||||
// this might be the same device that was replugged - read the MAC address
|
// this might be the same device that was replugged - read the
|
||||||
// (which should be at the same index) to make sure
|
// mac address (which should be at the same index) to make sure
|
||||||
if (memcmp(&address, &fMACAddress, sizeof(address)) != 0) {
|
if (memcmp(&address, &fMACAddress, sizeof(address)) != 0) {
|
||||||
TRACE_ALWAYS("Cannot replace device with MAC address:"
|
TRACE_ALWAYS("Cannot replace device with MAC address:"
|
||||||
"%02x:%02x:%02x:%02x:%02x:%02x\n",
|
"%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
fMACAddress.ebyte[0], fMACAddress.ebyte[1], fMACAddress.ebyte[2],
|
fMACAddress.ebyte[0], fMACAddress.ebyte[1],
|
||||||
fMACAddress.ebyte[3], fMACAddress.ebyte[4], fMACAddress.ebyte[5]);
|
fMACAddress.ebyte[2], fMACAddress.ebyte[3],
|
||||||
|
fMACAddress.ebyte[4], fMACAddress.ebyte[5]);
|
||||||
return B_BAD_VALUE; // is not the same
|
return B_BAD_VALUE; // is not the same
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -769,8 +778,9 @@ BeceemDevice::SetupDevice(bool deviceReplugged)
|
|||||||
|
|
||||||
|
|
||||||
// TODO : Preserve stability
|
// TODO : Preserve stability
|
||||||
// Things will break past this point until things are more complete
|
// Things will break past this point until the ethernet interface is more
|
||||||
// Prevent completion of device initilization to preseve system stability.
|
// complete. Prevent completion of device initilization to preseve system
|
||||||
|
// and network stack stability.
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
TRACE_ALWAYS("A Beceem WiMax device was attached, "
|
TRACE_ALWAYS("A Beceem WiMax device was attached, "
|
||||||
@@ -833,12 +843,14 @@ BeceemDevice::_SetupEndpoints()
|
|||||||
= gUSBModule->get_nth_configuration(fDevice, 0);
|
= gUSBModule->get_nth_configuration(fDevice, 0);
|
||||||
|
|
||||||
if (config == NULL) {
|
if (config == NULL) {
|
||||||
TRACE_ALWAYS("Error: Failed to get USB device configuration.\n");
|
TRACE_ALWAYS("Error: Failed to get USB"
|
||||||
|
" device configuration.\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->interface_count <= 0) {
|
if (config->interface_count <= 0) {
|
||||||
TRACE_ALWAYS("Error: No interfaces found in USB device configuration\n");
|
TRACE_ALWAYS("Error: No interfaces found"
|
||||||
|
" in USB device configuration\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,8 +883,8 @@ BeceemDevice::_SetupEndpoints()
|
|||||||
== USB_ENDPOINT_ADDR_DIR_OUT)
|
== USB_ENDPOINT_ADDR_DIR_OUT)
|
||||||
writeEndpoint = ep;
|
writeEndpoint = ep;
|
||||||
else
|
else
|
||||||
TRACE_ALWAYS("Warning: BULK USB Endpoint %d (%#04x) is unknown.\n",
|
TRACE_ALWAYS("Warning: BULK USB Endpoint"
|
||||||
ep, epd->attributes);
|
" %d (%#04x) is unknown.\n", ep, epd->attributes);
|
||||||
} else if ((epd->attributes & USB_ENDPOINT_ATTR_MASK)
|
} else if ((epd->attributes & USB_ENDPOINT_ATTR_MASK)
|
||||||
== USB_ENDPOINT_ATTR_ISOCHRONOUS) {
|
== USB_ENDPOINT_ATTR_ISOCHRONOUS) {
|
||||||
// Isochronous endpoint
|
// Isochronous endpoint
|
||||||
@@ -968,11 +980,12 @@ BeceemDevice::_NotifyCallback(void *cookie, int32 status, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
TRACE_ALWAYS("Device status error:%#010x\n", status);
|
TRACE_ALWAYS("Device status error :%#010x\n", status);
|
||||||
status_t result = gUSBModule->clear_feature(device->fNotifyEndpoint,
|
status_t result = gUSBModule->clear_feature(device->fNotifyEndpoint,
|
||||||
USB_FEATURE_ENDPOINT_HALT);
|
USB_FEATURE_ENDPOINT_HALT);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
TRACE_ALWAYS("Error during clearing of HALT state:%#010x.\n", result);
|
TRACE_ALWAYS("Error during clearing of HALT state:"
|
||||||
|
" %#010x.\n", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse data in overriden class
|
// parse data in overriden class
|
||||||
@@ -1029,42 +1042,19 @@ BeceemDevice::LoadConfig()
|
|||||||
|
|
||||||
if (file_size != sizeof(VENDORCFG))
|
if (file_size != sizeof(VENDORCFG))
|
||||||
{
|
{
|
||||||
TRACE_ALWAYS("Error: Size mismatch in vendor configuration structure!\n");
|
TRACE_ALWAYS("Error: Size mismatch in vendor configuration struct!\n");
|
||||||
close(fh);
|
close(fh);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
} else {
|
} else {
|
||||||
TRACE_ALWAYS("Info: Found valid vendor configuration %ld bytes long.\n", file_size);
|
TRACE_ALWAYS("Info: Found valid vendor configuration"
|
||||||
|
" %ld bytes long.\n", file_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we copy the configuration into our fancy struct to know what the device knows
|
// we copy the configuration into our struct to know what the device knows
|
||||||
memcpy(&pwmxdevice->vendorcfg, buffer, sizeof(VENDORCFG));
|
memcpy(&pwmxdevice->vendorcfg, buffer, sizeof(VENDORCFG));
|
||||||
|
|
||||||
TRACE("Debug: Vendor Config: Config File Version is 0x%x\n", pwmxdevice->vendorcfg.m_u32CfgVersion);
|
DumpConfig();
|
||||||
TRACE("Debug: Vendor Config: Center Frequency is 0x%x\n", pwmxdevice->vendorcfg.m_u32CenterFrequency);
|
|
||||||
TRACE("Debug: Vendor Config: Band A Scan = 0x%x\n", pwmxdevice->vendorcfg.m_u32BandAScan);
|
|
||||||
TRACE("Debug: Vendor Config: Band B Scan = 0x%x\n", pwmxdevice->vendorcfg.m_u32BandBScan);
|
|
||||||
TRACE("Debug: Vendor Config: Band C Scan = 0x%x\n", pwmxdevice->vendorcfg.m_u32BandCScan);
|
|
||||||
TRACE("Debug: Vendor Config: PHS Enable = 0x%x\n", pwmxdevice->vendorcfg.m_u32PHSEnable);
|
|
||||||
TRACE("Debug: Vendor Config: Handoff Enable = 0x%x\n", pwmxdevice->vendorcfg.m_u32HoEnable);
|
|
||||||
TRACE("Debug: Vendor Config: HO Reserved1 = 0x%x\n", pwmxdevice->vendorcfg.m_u32HoReserved1);
|
|
||||||
TRACE("Debug: Vendor Config: HO Reserved2 = 0x%x\n", pwmxdevice->vendorcfg.m_u32HoReserved2);
|
|
||||||
TRACE("Debug: Vendor Config: MIMO Enable = 0x%x\n", pwmxdevice->vendorcfg.m_u32MimoEnable);
|
|
||||||
TRACE("Debug: Vendor Config: PKMv2 Enable = 0x%x\n", pwmxdevice->vendorcfg.m_u32SecurityEnable);
|
|
||||||
TRACE("Debug: Vendor Config: Power Saving Modes Enable = 0x%x\n", pwmxdevice->vendorcfg.m_u32PowerSavingModesEnable);
|
|
||||||
TRACE("Debug: Vendor Config: Power Saving Mode Options = 0x%x\n", pwmxdevice->vendorcfg.m_u32PowerSavingModeOptions);
|
|
||||||
TRACE("Debug: Vendor Config: ARQ Enable = 0x%x\n", pwmxdevice->vendorcfg.m_u32ArqEnable);
|
|
||||||
TRACE("Debug: Vendor Config: Harq Enable = 0x%x\n", pwmxdevice->vendorcfg.m_u32HarqEnable);
|
|
||||||
TRACE("Debug: Vendor Config: EEPROM Flag = 0x%x\n", pwmxdevice->vendorcfg.m_u32EEPROMFlag);
|
|
||||||
TRACE("Debug: Vendor Config: Customize = 0x%x\n", pwmxdevice->vendorcfg.m_u32Customize);
|
|
||||||
TRACE("Debug: Vendor Config: Bandwidth = 0x%x\n", pwmxdevice->vendorcfg.m_u32ConfigBW);
|
|
||||||
TRACE("Debug: Vendor Config: RadioParameter = 0x%x\n", pwmxdevice->vendorcfg.m_u32RadioParameter);
|
|
||||||
TRACE("Debug: Vendor Config: HostDrvrConfig1 is 0x%x\n", pwmxdevice->vendorcfg.HostDrvrConfig1);
|
|
||||||
TRACE("Debug: Vendor Config: HostDrvrConfig2 is 0x%x\n", pwmxdevice->vendorcfg.HostDrvrConfig2);
|
|
||||||
TRACE("Debug: Vendor Config: HostDrvrConfig3 is 0x%x\n", pwmxdevice->vendorcfg.HostDrvrConfig3);
|
|
||||||
TRACE("Debug: Vendor Config: HostDrvrConfig4 is 0x%x\n", pwmxdevice->vendorcfg.HostDrvrConfig4);
|
|
||||||
TRACE("Debug: Vendor Config: HostDrvrConfig5 is 0x%x\n", pwmxdevice->vendorcfg.HostDrvrConfig5);
|
|
||||||
TRACE("Debug: Vendor Config: HostDrvrConfig6 is 0x%x\n", pwmxdevice->vendorcfg.HostDrvrConfig6);
|
|
||||||
|
|
||||||
close(fh);
|
close(fh);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
@@ -1073,6 +1063,62 @@ BeceemDevice::LoadConfig()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BeceemDevice::DumpConfig()
|
||||||
|
{
|
||||||
|
TRACE("Debug: Vendor Config: Config File Version is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32CfgVersion);
|
||||||
|
TRACE("Debug: Vendor Config: Center Frequency is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32CenterFrequency);
|
||||||
|
TRACE("Debug: Vendor Config: Band A Scan = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32BandAScan);
|
||||||
|
TRACE("Debug: Vendor Config: Band B Scan = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32BandBScan);
|
||||||
|
TRACE("Debug: Vendor Config: Band C Scan = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32BandCScan);
|
||||||
|
TRACE("Debug: Vendor Config: PHS Enable = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32PHSEnable);
|
||||||
|
TRACE("Debug: Vendor Config: Handoff Enable = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32HoEnable);
|
||||||
|
TRACE("Debug: Vendor Config: HO Reserved1 = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32HoReserved1);
|
||||||
|
TRACE("Debug: Vendor Config: HO Reserved2 = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32HoReserved2);
|
||||||
|
TRACE("Debug: Vendor Config: MIMO Enable = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32MimoEnable);
|
||||||
|
TRACE("Debug: Vendor Config: PKMv2 Enable = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32SecurityEnable);
|
||||||
|
TRACE("Debug: Vendor Config: Power Saving Modes Enable = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32PowerSavingModesEnable);
|
||||||
|
TRACE("Debug: Vendor Config: Power Saving Mode Options = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32PowerSavingModeOptions);
|
||||||
|
TRACE("Debug: Vendor Config: ARQ Enable = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32ArqEnable);
|
||||||
|
TRACE("Debug: Vendor Config: Harq Enable = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32HarqEnable);
|
||||||
|
TRACE("Debug: Vendor Config: EEPROM Flag = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32EEPROMFlag);
|
||||||
|
TRACE("Debug: Vendor Config: Customize = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32Customize);
|
||||||
|
TRACE("Debug: Vendor Config: Bandwidth = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32ConfigBW);
|
||||||
|
TRACE("Debug: Vendor Config: RadioParameter = 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.m_u32RadioParameter);
|
||||||
|
TRACE("Debug: Vendor Config: HostDrvrConfig1 is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.HostDrvrConfig1);
|
||||||
|
TRACE("Debug: Vendor Config: HostDrvrConfig2 is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.HostDrvrConfig2);
|
||||||
|
TRACE("Debug: Vendor Config: HostDrvrConfig3 is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.HostDrvrConfig3);
|
||||||
|
TRACE("Debug: Vendor Config: HostDrvrConfig4 is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.HostDrvrConfig4);
|
||||||
|
TRACE("Debug: Vendor Config: HostDrvrConfig5 is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.HostDrvrConfig5);
|
||||||
|
TRACE("Debug: Vendor Config: HostDrvrConfig6 is 0x%x\n",
|
||||||
|
pwmxdevice->vendorcfg.HostDrvrConfig6);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BeceemDevice::PushConfig(unsigned int loc)
|
BeceemDevice::PushConfig(unsigned int loc)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
* Beceem WiMax USB Driver.
|
* Beceem WiMax USB Driver.
|
||||||
* Copyright (c) 2010 Alexander von Gluck <[email protected]>
|
* Copyright (c) 2010 Alexander von Gluck <[email protected]>
|
||||||
* Distributed under the terms of the GNU General Public License.
|
* Distributed under the terms of the GNU General Public License.
|
||||||
*
|
*
|
||||||
* Based on GPL code developed by: Beceem Communications Pvt. Ltd
|
* Based on GPL code developed by: Beceem Communications Pvt. Ltd
|
||||||
*
|
*
|
||||||
* Driver for USB Ethernet Control Model devices
|
* Driver for USB Ethernet Control Model devices
|
||||||
* Copyright (C) 2008 Michael Lotz <[email protected]>
|
* Copyright (C) 2008 Michael Lotz <[email protected]>
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Description: Wrangle Beceem wimax usb device
|
* Description: Wrangle Beceem wimax usb device
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
#define MAX_USB_IO_RETRIES 1
|
#define MAX_USB_IO_RETRIES 1
|
||||||
#define MAX_USB_TRANSFER 255
|
#define MAX_USB_TRANSFER 255
|
||||||
|
|
||||||
class BeceemDevice
|
|
||||||
|
class BeceemDevice
|
||||||
:
|
:
|
||||||
public BeceemNVM,
|
public BeceemNVM,
|
||||||
public BeceemDDR,
|
public BeceemDDR,
|
||||||
@@ -38,95 +39,100 @@ class BeceemDevice
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BeceemDevice(usb_device device, const char *description);
|
BeceemDevice(usb_device device,
|
||||||
virtual ~BeceemDevice();
|
const char *description);
|
||||||
|
virtual ~BeceemDevice();
|
||||||
|
|
||||||
status_t InitCheck() { return fStatus; };
|
status_t InitCheck() { return fStatus; };
|
||||||
|
|
||||||
status_t Open(uint32 flags);
|
status_t Open(uint32 flags);
|
||||||
bool IsOpen() { return fOpen; };
|
bool IsOpen() { return fOpen; };
|
||||||
|
|
||||||
status_t Close();
|
status_t Close();
|
||||||
status_t Free();
|
status_t Free();
|
||||||
|
|
||||||
status_t Read(uint8 *buffer, size_t *numBytes);
|
status_t Read(uint8 *buffer, size_t *numBytes);
|
||||||
status_t Write(const uint8 *buffer, size_t *numBytes);
|
status_t Write(const uint8 *buffer, size_t *numBytes);
|
||||||
status_t Control(uint32 op, void *buffer, size_t length);
|
status_t Control(uint32 op, void *buffer, size_t length);
|
||||||
status_t LoadConfig();
|
status_t LoadConfig();
|
||||||
status_t PushConfig(unsigned int loc);
|
void DumpConfig();
|
||||||
status_t PushFirmware(unsigned int loc);
|
status_t PushConfig(unsigned int loc);
|
||||||
|
status_t PushFirmware(unsigned int loc);
|
||||||
|
|
||||||
void Removed();
|
void Removed();
|
||||||
|
|
||||||
status_t CompareAndReattach(usb_device device);
|
status_t CompareAndReattach(usb_device device);
|
||||||
virtual status_t SetupDevice(bool deviceReplugged);
|
virtual status_t SetupDevice(bool deviceReplugged);
|
||||||
|
|
||||||
status_t ReadRegister(unsigned int reg, size_t size, uint32_t* buffer);
|
status_t ReadRegister(unsigned int reg,
|
||||||
status_t WriteRegister(unsigned int reg, size_t size, uint32_t* buffer);
|
size_t size, uint32_t* buffer);
|
||||||
status_t BizarroReadRegister(unsigned int reg, size_t size, uint32_t* buffer);
|
status_t WriteRegister(unsigned int reg,
|
||||||
status_t BizarroWriteRegister(unsigned int reg, size_t size, uint32_t* buffer);
|
size_t size, uint32_t* buffer);
|
||||||
|
status_t BizarroReadRegister(unsigned int reg,
|
||||||
|
size_t size, uint32_t* buffer);
|
||||||
|
status_t BizarroWriteRegister(unsigned int reg,
|
||||||
|
size_t size, uint32_t* buffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void _ReadCallback(void *cookie, int32 status,
|
static void _ReadCallback(void *cookie, int32 status,
|
||||||
void *data, uint32 actualLength);
|
void *data, uint32 actualLength);
|
||||||
static void _WriteCallback(void *cookie, int32 status,
|
static void _WriteCallback(void *cookie, int32 status,
|
||||||
void *data, uint32 actualLength);
|
void *data, uint32 actualLength);
|
||||||
static void _NotifyCallback(void *cookie, int32 status,
|
static void _NotifyCallback(void *cookie, int32 status,
|
||||||
void *data, uint32 actualLength);
|
void *data, uint32 actualLength);
|
||||||
|
|
||||||
status_t _SetupEndpoints();
|
status_t _SetupEndpoints();
|
||||||
|
|
||||||
status_t IdentifyChipset();
|
status_t IdentifyChipset();
|
||||||
|
|
||||||
static const int kFrameSize = 1518;
|
static const int kFrameSize = 1518;
|
||||||
static const uint8 kRXHeaderSize = 3;
|
static const uint8 kRXHeaderSize = 3;
|
||||||
static const uint8 kTXHeaderSize = 2;
|
static const uint8 kTXHeaderSize = 2;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* overrides */
|
virtual status_t StartDevice() ;
|
||||||
virtual status_t StartDevice() ;
|
virtual status_t StopDevice();
|
||||||
virtual status_t StopDevice();
|
virtual status_t OnNotify(uint32 actualLength) ;
|
||||||
virtual status_t OnNotify(uint32 actualLength) ;
|
virtual status_t GetLinkState(ether_link_state *state) ;
|
||||||
virtual status_t GetLinkState(ether_link_state *state) ;
|
virtual status_t SetPromiscuousMode(bool bOn);
|
||||||
virtual status_t SetPromiscuousMode(bool bOn);
|
virtual status_t ModifyMulticastTable(bool add, uint8 address);
|
||||||
virtual status_t ModifyMulticastTable(bool add, uint8 address);
|
|
||||||
|
|
||||||
|
|
||||||
// state tracking
|
|
||||||
status_t fStatus;
|
|
||||||
bool fOpen;
|
|
||||||
vint32 fInsideNotify;
|
|
||||||
usb_device fDevice;
|
|
||||||
uint16 fVendorID;
|
|
||||||
uint16 fProductID;
|
|
||||||
const char * fDescription;
|
|
||||||
bool fNonBlocking;
|
|
||||||
|
|
||||||
// Our driver device struct
|
// state tracking
|
||||||
struct WIMAX_DEVICE *pwmxdevice;
|
status_t fStatus;
|
||||||
|
bool fOpen;
|
||||||
|
vint32 fInsideNotify;
|
||||||
|
usb_device fDevice;
|
||||||
|
uint16 fVendorID;
|
||||||
|
uint16 fProductID;
|
||||||
|
const char * fDescription;
|
||||||
|
bool fNonBlocking;
|
||||||
|
|
||||||
// pipes for notifications and data io
|
struct WIMAX_DEVICE *pwmxdevice;
|
||||||
usb_pipe fNotifyEndpoint;
|
// Our driver device struct
|
||||||
usb_pipe fReadEndpoint;
|
|
||||||
usb_pipe fWriteEndpoint;
|
|
||||||
|
|
||||||
// data stores for async usb transfers
|
// pipes for notifications and data io
|
||||||
uint32 fActualLengthRead;
|
usb_pipe fNotifyEndpoint;
|
||||||
uint32 fActualLengthWrite;
|
usb_pipe fReadEndpoint;
|
||||||
int32 fStatusRead;
|
usb_pipe fWriteEndpoint;
|
||||||
int32 fStatusWrite;
|
|
||||||
sem_id fNotifyReadSem;
|
|
||||||
sem_id fNotifyWriteSem;
|
|
||||||
|
|
||||||
uint8 * fNotifyBuffer;
|
// data stores for async usb transfers
|
||||||
uint32 fNotifyBufferLength;
|
uint32 fActualLengthRead;
|
||||||
|
uint32 fActualLengthWrite;
|
||||||
|
int32 fStatusRead;
|
||||||
|
int32 fStatusWrite;
|
||||||
|
sem_id fNotifyReadSem;
|
||||||
|
sem_id fNotifyWriteSem;
|
||||||
|
|
||||||
// connection data
|
uint8 * fNotifyBuffer;
|
||||||
sem_id fLinkStateChangeSem;
|
uint32 fNotifyBufferLength;
|
||||||
ether_address_t fMACAddress;
|
|
||||||
bool fHasConnection;
|
// connection data
|
||||||
bool fTXBufferFull;
|
sem_id fLinkStateChangeSem;
|
||||||
|
ether_address_t fMACAddress;
|
||||||
|
bool fHasConnection;
|
||||||
|
bool fTXBufferFull;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_USB_BECEEM_DEVICE_H_
|
#endif /*_USB_BECEEM_DEVICE_H_*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user