no functional change; header copyright correction; more spacing/line-length cleanup, yes there a lot more to go

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40551 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-02-18 20:30:05 +00:00
parent 7f08510a9a
commit 1b53751478
10 changed files with 225 additions and 139 deletions

View File

@ -8,14 +8,17 @@
* Description: Wrangle Beceem volatile DDR memory.
*/
#include "Settings.h"
#include "BeceemDDR.h"
BeceemDDR::BeceemDDR()
{
TRACE("Debug: Load DDR handler\n");
}
status_t
BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice)
{

View File

@ -1,18 +1,24 @@
/*
* Beceem WiMax USB Driver.
* Beceem WiMax USB Driver
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* 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
* Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
* Distributed under the terms of the MIT license.
* Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
*
* Partially using:
* USB Ethernet Control Model devices
* (c) 2008 by Michael Lotz, <mmlr@mlotz.ch>
* ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver
* (c) 2008 by S.Zharski, <imker@gmx.li>
*
* This code is the entry point for the operating system to
* Beceem device communications.
*/
#include <sys/ioctl.h>
#include <unistd.h>
@ -24,10 +30,10 @@
#include "BeOSCompatibility.h" // for pseudo mutex
#endif
#include "BeceemDevice.h"
#include "Driver.h"
#include "Settings.h"
#include "BeceemDevice.h"
mutex gUSBLock;

View File

@ -1,17 +1,19 @@
/*
* Beceem WiMax USB Driver.
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* Distributed under the terms of the GNU General Public License.
*
* Based on GPL code developed by: Beceem Communications Pvt. Ltd
*
* Driver for USB Ethernet Control Model devices
* Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
* Beceem WiMax USB Driver
* Copyright 2010-2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Description: Wrangle Beceem wimax usb device
* Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
*
* Partially using:
* USB Ethernet Control Model devices
* (c) 2008 by Michael Lotz, <mmlr@mlotz.ch>
* ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver
* (c) 2008 by S.Zharski, <imker@gmx.li>
*/
#ifndef _USB_BECEEM_DEVICE_H_
#define _USB_BECEEM_DEVICE_H_

View File

@ -1,42 +1,52 @@
/*
* Beceem WiMax USB Driver.
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* Beceem WiMax USB Driver
* Copyright 2010-2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
*/
#ifndef _USB_BECEEM_LED_H_
#define _USB_BECEEM_LED_H_
#include <ByteOrder.h>
#include <ByteOrder.h>
#include "DeviceStruct.h"
class BeceemLED
{
public:
BeceemLED();
status_t LEDInit(WIMAX_DEVICE* wmxdevice);
status_t LEDThreadTerminate();
status_t LEDOff(unsigned int index);
status_t LEDOn(unsigned int index);
status_t LightsOut();
static status_t LEDThread(void *cookie);
BeceemLED();
status_t LEDInit(WIMAX_DEVICE* wmxdevice);
status_t LEDThreadTerminate();
status_t LEDOff(unsigned int index);
status_t LEDOn(unsigned int index);
status_t LightsOut();
static status_t LEDThread(void *cookie);
WIMAX_DEVICE* pwmxdevice;
WIMAX_DEVICE* pwmxdevice;
// yuck. These are in a parent class
virtual status_t ReadRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
virtual status_t WriteRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
virtual status_t BizarroReadRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
virtual status_t BizarroWriteRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
// yuck. These are in a parent class
virtual status_t ReadRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
virtual status_t WriteRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
virtual status_t BizarroReadRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
virtual status_t BizarroWriteRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
private:
status_t GPIOReset();
};
typedef enum _LEDColors{
RED_LED = 1,
BLUE_LED = 2,
@ -44,5 +54,6 @@ typedef enum _LEDColors{
GREEN_LED = 4
} LEDColors;
#endif // _USB_BECEEM_LED_H

View File

@ -20,6 +20,7 @@
#include "BeceemDevice.h"
#include "BeceemNVM.h"
BeceemNVM::BeceemNVM()
{
TRACE("Debug: Load non-volatile memory handler\n");
@ -84,7 +85,7 @@ BeceemNVM::NVMDetect()
EEPROMBulkRead(0x0, 4, &uiData);
if (uiData == BECM)
{
TRACE_ALWAYS("Info: EEPROM non-volatile memory detected.\n");
TRACE_ALWAYS("Info: EEPROM nvm detected.\n");
pwmxdevice->nvmType = NVM_EEPROM;
pwmxdevice->nvmDSDSize = EEPROMGetSize();
return B_OK;
@ -95,9 +96,9 @@ BeceemNVM::NVMDetect()
return B_ERROR;
FlashBulkRead(0x0 + pwmxdevice->nvmFlashCalStart, 4, &uiData);
if(uiData == BECM)
if (uiData == BECM)
{
TRACE_ALWAYS("Info: Flash non-volatile memory detected.\n");
TRACE_ALWAYS("Info: Flash nvm detected.\n");
pwmxdevice->nvmType = NVM_FLASH;
pwmxdevice->nvmDSDSize = FlashGetSize();
return B_OK;
@ -105,7 +106,7 @@ BeceemNVM::NVMDetect()
pwmxdevice->nvmType = NVM_UNKNOWN;
TRACE_ALWAYS("Error: Couldn't detect non-volatile storage method, found 0x%X\n",
TRACE_ALWAYS("Error: Couldn't detect nvm storage method, found 0x%X\n",
uiData);
return B_ERROR;
}
@ -125,7 +126,8 @@ BeceemNVM::NVMChipSelect(unsigned int offset)
if (bSelectedChip == ChipIndex)
return B_OK;
TRACE("Debug: Selecting chip %d for transaction at 0x%x\n", ChipIndex, offset);
TRACE("Debug: Selecting chip %d for transaction at 0x%x\n",
ChipIndex, offset);
// Migrate selected chip to new selection
bSelectedChip = ChipIndex;
@ -136,7 +138,7 @@ BeceemNVM::NVMChipSelect(unsigned int offset)
// TRACE("Reading GPIO config 0x%x\n", &GPIOConfig);
// TRACE("Reading Flash config 0x%x\n", &FlashConfig);
switch(ChipIndex)
switch (ChipIndex)
{
case 0:
PartNum = 0;
@ -190,7 +192,7 @@ BeceemNVM::NVMRead(unsigned int offset, unsigned int size, unsigned int* buffer)
// Increase offset by FlashCalibratedStart
myOffset = offset + pwmxdevice->nvmFlashCalStart;
TRACE("Debug: Performing read of non-volatile flash memory at 0x%x (%d)\n",
TRACE("Debug: Performing read of flash nvm at 0x%x (%d)\n",
myOffset, size);
// If firmware was already pushed, Beceem notes a hardware bug here.
@ -257,16 +259,21 @@ int
BeceemNVM::FlashGetBaseAddr()
{
if (pwmxdevice->driverDDRinit == true) {
if (pwmxdevice->nvmFlashCSDone == true && pwmxdevice->nvmFlashRaw == false &&
!((pwmxdevice->nvmFlashMajor == 1) && (pwmxdevice->nvmFlashMinor == 1)) ) {
if (pwmxdevice->nvmFlashCSDone == true
&& pwmxdevice->nvmFlashRaw == false
&& !((pwmxdevice->nvmFlashMajor == 1)
&& (pwmxdevice->nvmFlashMinor == 1))) {
return pwmxdevice->nvmFlashBaseAddr;
} else {
return FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT;
}
} else {
if (pwmxdevice->nvmFlashCSDone == true && pwmxdevice->nvmFlashRaw == false &&
!((pwmxdevice->nvmFlashMajor == 1) && (pwmxdevice->nvmFlashMinor == 1)) ) {
return pwmxdevice->nvmFlashBaseAddr | FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT;
if (pwmxdevice->nvmFlashCSDone == true
&& pwmxdevice->nvmFlashRaw == false
&& !((pwmxdevice->nvmFlashMajor == 1)
&& (pwmxdevice->nvmFlashMinor == 1))) {
return pwmxdevice->nvmFlashBaseAddr
| FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT;
} else {
return FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT;
}
@ -298,7 +305,8 @@ BeceemNVM::FlashReadID()
// Read SPI READQ Register, The output will be 4 bytes long
// The ID is the first 3 bytes.
BizarroReadRegister(FLASH_SPI_READQ_REG, sizeof(RDID), (unsigned int*)&RDID);
BizarroReadRegister(FLASH_SPI_READQ_REG, sizeof(RDID),
(unsigned int*)&RDID);
return (RDID >>8);
}
@ -325,16 +333,21 @@ BeceemNVM::FlashReadCS()
}
// CS Signature(4), Minor(2), Major(2)
FlashBulkRead(pwmxdevice->nvmFlashCSStart, 8, (unsigned int*)pwmxdevice->nvmFlashCSInfo);
pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion = ntohl(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion);
FlashBulkRead(pwmxdevice->nvmFlashCSStart, 8,
(unsigned int*)pwmxdevice->nvmFlashCSInfo);
pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion
= ntohl(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion);
TRACE_ALWAYS("Info: Flash CS Version/Signature: 0x%X/0x%X\n",
(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion),
ntohl(pwmxdevice->nvmFlashCSInfo->MagicNumber));
if ( ntohl(pwmxdevice->nvmFlashCSInfo->MagicNumber) == FLASH_CS_SIGNATURE ) {
pwmxdevice->nvmFlashMajor = MAJOR_VERSION(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion);
pwmxdevice->nvmFlashMinor = MINOR_VERSION(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion);
if (ntohl(pwmxdevice->nvmFlashCSInfo->MagicNumber) == FLASH_CS_SIGNATURE) {
pwmxdevice->nvmFlashMajor
= MAJOR_VERSION(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion);
pwmxdevice->nvmFlashMinor
= MINOR_VERSION(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion);
} else {
TRACE_ALWAYS("Error: Unknown flash magic signature!\n");
pwmxdevice->nvmFlashMajor = 0;
@ -345,16 +358,20 @@ BeceemNVM::FlashReadCS()
if (pwmxdevice->nvmFlashMajor == 0x1)
{
// device is older flash map
FlashBulkRead(pwmxdevice->nvmFlashCSStart, sizeof(FLASH_CS_INFO), (unsigned int*)pwmxdevice->nvmFlashCSInfo);
FlashBulkRead(pwmxdevice->nvmFlashCSStart, sizeof(FLASH_CS_INFO),
(unsigned int*)pwmxdevice->nvmFlashCSInfo);
snooze(100);
FlashCSFlip(pwmxdevice->nvmFlashCSInfo);
FlashCSDump(pwmxdevice->nvmFlashCSInfo);
pwmxdevice->nvmFlashCalStart = (pwmxdevice->nvmFlashCSInfo->OffsetFromZeroForCalibrationStart);
pwmxdevice->nvmFlashCalStart
= (pwmxdevice->nvmFlashCSInfo->OffsetFromZeroForCalibrationStart);
if(!((pwmxdevice->nvmFlashMajor == 1) && (pwmxdevice->nvmFlashMinor == 1)))
if (!((pwmxdevice->nvmFlashMajor == 1)
&& (pwmxdevice->nvmFlashMinor == 1)))
{
pwmxdevice->nvmFlashCSStart = (pwmxdevice->nvmFlashCSInfo->OffsetFromZeroForControlSectionStart);
pwmxdevice->nvmFlashCSStart
= (pwmxdevice->nvmFlashCSInfo->OffsetFromZeroForControlSectionStart);
}
// TODO : Flash Write sizes.. no write support atm
@ -373,12 +390,13 @@ BeceemNVM::FlashReadCS()
pwmxdevice->fpFlashWriteWithStatusCheck = flashWriteStatus;
}
*/
//BcmGetFlashSectorSize(Adapter, (Adapter->psFlashCSInfo->FlashSectorSizeSig),
// (Adapter->psFlashCSInfo->FlashSectorSize));
#endif
pwmxdevice->nvmFlashBaseAddr = pwmxdevice->nvmFlashCSInfo->FlashBaseAddr & 0xFCFFFFFF;
pwmxdevice->nvmFlashBaseAddr = pwmxdevice->nvmFlashCSInfo->FlashBaseAddr
& 0xFCFFFFFF;
} else {
// device is newer flash map layout
@ -604,11 +622,12 @@ BeceemNVM::FlashBulkWrite(unsigned int offset, unsigned int size, unsigned int*
if (NumSectTobeRead > 1)
{
memcpy(&TempBuffer[CurrSectOffsetAddr], ucBuffer, SectBoundary-(SectAlignAddr+CurrSectOffsetAddr));
memcpy(&TempBuffer[CurrSectOffsetAddr], ucBuffer,
SectBoundary - (SectAlignAddr + CurrSectOffsetAddr));
ucBuffer += ((SectBoundary-(SectAlignAddr + CurrSectOffsetAddr)));
size -= (SectBoundary-(SectAlignAddr + CurrSectOffsetAddr));
} else {
memcpy(&TempBuffer[CurrSectOffsetAddr],ucBuffer, size);
memcpy(&TempBuffer[CurrSectOffsetAddr], ucBuffer, size);
}
// TODO : SaveHeaderIfPresent if IsFlash2x?
@ -668,7 +687,7 @@ BeceemNVM::FlashBulkWrite(unsigned int offset, unsigned int size, unsigned int*
}
#endif
if(BPStatus)
if (BPStatus)
{
RestoreBlockProtect(BPStatus);
BPStatus = 0;
@ -773,15 +792,15 @@ BeceemNVM::EEPROMGetSize()
unsigned int uiIndex = 0;
// To find the EEPROM size read the possible boundaries of the
// EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will
// result in wrap around. So when we get the End of the EEPROM we will
// EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will
// result in wrap around. So when we get the End of the EEPROM we will
// get 'BECM' string which is indeed at offset 0.
EEPROMBulkRead(0x0, 4, &uiData);
if (ntohl(uiData) == BECM)
{
// If EEPROM is present ,it will have 'BECM' string at 0th offset.
// If EEPROM is present, it will have 'BECM' string at 0th offset.
for (uiIndex = 1 ; uiIndex <= 256; uiIndex *= 2)
{
@ -854,7 +873,8 @@ BeceemNVM::EEPROMRead(unsigned int offset, unsigned int *pdwData)
return B_ERROR;
}
BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, sizeof(unsigned int), &Value);
BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, sizeof(unsigned int),
&Value);
}
BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(unsigned int), &Value);

View File

@ -2,10 +2,9 @@
* Beceem WiMax USB Driver.
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* Distributed under the terms of the GNU General Public License.
*
*
* Based on GPL code developed by: Beceem Communications Pvt. Ltd
*/
#ifndef _USB_BECEEM_NVM_H_
#define _USB_BECEEM_NVM_H_
@ -26,19 +25,23 @@
#define FLASH_PART_SIZE (16 * 1024 * 1024)
#define FLASH_CONFIG_REG 0xAF003050
#define FLASH_GPIO_CONFIG_REG 0xAF000030
#define FLASH_CS_INFO_START_ADDR 0xFF0000 // Location for Flash calibration info
// Locations for Flash calibration info
#define FLASH_CS_INFO_START_ADDR 0xFF0000
#define FLASH_AUTO_INIT_BASE_ADDR 0xF00000
#define FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT 0x1F000000 // Flash base before DDR Init
#define FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT 0x1C000000 // Flash base after DDR Init
// NVM Flash addresses before and after DDR Init
#define FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT 0x1F000000
#define FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT 0x1C000000
#define FLASH_SPI_CMDQ_REG 0xAF003040
#define FLASH_SPI_WRITEQ_REG 0xAF003044
#define FLASH_SPI_READQ_REG 0xAF003048
#define FLASH_SIZE_ADDR 0xFFFFEC // Location of Flash memory size
#define FLASH_SIZE_ADDR 0xFFFFEC
#define FLASH_CMD_STATUS_REG_WRITE 0x01
#define FLASH_CMD_STATUS_REG_READ 0x05
#define FLASH_CMD_WRITE_ENABLE 0x06
#define FLASH_CMD_READ_ID 0x9F // Command to read the flash chip ID
#define FLASH_CS_SIGNATURE 0xBECEF1A5 // Beceem FLAS(H) (get it?)
#define FLASH_CMD_READ_ID 0x9F
#define FLASH_CS_SIGNATURE 0xBECEF1A5
// Our EEPROM addresses
#define EEPROM_SPI_Q_STATUS_REG 0x0F003008
@ -57,9 +60,9 @@
#define NVM_VERSION_OFFSET 0x020E
#define NVM_SECTOR_SIZE 0x10000
#define NVM_READ_DATA_AVAIL 0x00000020 // was EEPROM_READ_DATA_AVAIL
#define NVM_SPI_Q_STATUS1_REG 0x0F003004 // was EEPROM_SPI_Q_STATUS1_REG
#define NVM_ALL_QUEUE_FLUSH 0x0000000f // was EEPROM_ALL_QUEUE_FLUSH
#define NVM_READ_DATA_AVAIL 0x00000020 // was EEPROM_READ_DATA_AVAIL
#define NVM_SPI_Q_STATUS1_REG 0x0F003004 // was EEPROM_SPI_Q_STATUS1_REG
#define NVM_ALL_QUEUE_FLUSH 0x0000000f // was EEPROM_ALL_QUEUE_FLUSH
#define SCSI_FIRMWARE_MINOR_VERSION 0x5
@ -70,50 +73,68 @@
#define MAJOR_VERSION(x) (x & 0xFFFF)
#define MINOR_VERSION(x) ((x >>16) & 0xFFFF)
class BeceemNVM
{
int bSelectedChip; // selected chip
public:
BeceemNVM();
status_t NVMInit(WIMAX_DEVICE* swmxdevice);
status_t ReadMACFromNVM(ether_address *address);
status_t ValidateDSD(unsigned long hwParam);
BeceemNVM();
status_t NVMInit(WIMAX_DEVICE* swmxdevice);
status_t ReadMACFromNVM(ether_address *address);
status_t ValidateDSD(unsigned long hwParam);
int NVMRead(unsigned int offset, unsigned int size, unsigned int* buffer);
int NVMWrite(unsigned int offset, unsigned int size, unsigned int* buffer);
int NVMRead(unsigned int offset, unsigned int size,
unsigned int* buffer);
int NVMWrite(unsigned int offset, unsigned int size,
unsigned int* buffer);
// yuck. These are in a child class class
virtual status_t ReadRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
virtual status_t WriteRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
virtual status_t BizarroReadRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
virtual status_t BizarroWriteRegister(unsigned int reg, size_t size, uint32_t* buffer){ return NULL; };
virtual status_t ReadRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
virtual status_t WriteRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
virtual status_t BizarroReadRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
virtual status_t BizarroWriteRegister(unsigned int reg,
size_t size, uint32_t* buffer)
{ return NULL; };
int bSelectedChip; // selected chip
private:
WIMAX_DEVICE* pwmxdevice;
WIMAX_DEVICE* pwmxdevice;
status_t NVMDetect();
status_t NVMFlush();
status_t NVMChipSelect(unsigned int offset);
status_t RestoreBlockProtect(unsigned long writestatus);
unsigned long DisableBlockProtect(unsigned int offset, size_t size);
status_t NVMDetect();
status_t NVMFlush();
status_t NVMChipSelect(unsigned int offset);
status_t RestoreBlockProtect(unsigned long writestatus);
unsigned long DisableBlockProtect(unsigned int offset,
size_t size);
int FlashGetBaseAddr();
unsigned long FlashReadID();
status_t FlashReadCS();
status_t FlashSectorErase(unsigned int addr, unsigned int numOfSectors);
status_t FlashBulkRead(unsigned int offset, unsigned int size, unsigned int* buffer);
status_t FlashBulkWrite(unsigned int offset, unsigned int size, unsigned int* buffer);
status_t FlashCSFlip(PFLASH_CS_INFO FlashCSInfo);
status_t FlashCSDump(PFLASH_CS_INFO FlashCSInfo);
int FlashGetBaseAddr();
unsigned long FlashReadID();
status_t FlashReadCS();
status_t FlashSectorErase(unsigned int addr,
unsigned int numOfSectors);
status_t FlashBulkRead(unsigned int offset,
unsigned int size, unsigned int* buffer);
status_t FlashBulkWrite(unsigned int offset,
unsigned int size, unsigned int* buffer);
status_t FlashCSFlip(PFLASH_CS_INFO FlashCSInfo);
status_t FlashCSDump(PFLASH_CS_INFO FlashCSInfo);
unsigned int EEPROMGetSize();
unsigned int FlashGetSize();
unsigned int EEPROMGetSize();
unsigned int FlashGetSize();
status_t EEPROMRead(unsigned int offset, unsigned int *pdwData);
status_t EEPROMBulkRead( unsigned int offset, size_t numBytes, unsigned int* buffer);
status_t EEPROMRead(unsigned int offset,
unsigned int *pdwData);
status_t EEPROMBulkRead( unsigned int offset,
size_t numBytes, unsigned int* buffer);
};
#endif // _USB_BECEEM_NVM_H

View File

@ -1,19 +1,19 @@
/*
* Beceem WiMax USB Driver.
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* Distributed under the terms of the MIT license.
*
* Heavily based on code of :
* Driver for USB Ethernet Control Model devices
* Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
* Beceem WiMax USB Driver
* Copyright 2010-2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* The Beceem chipset can be used via multiple interfaces
* such as PCMCIA, MII, PCI, SDIO, and Serial. However I have
* only found it implemented commercially for PC use as USB.
* Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
*
* Partially using:
* USB Ethernet Control Model devices
* (c) 2008 by Michael Lotz, <mmlr@mlotz.ch>
* ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver
* (c) 2008 by S.Zharski, <imker@gmx.li>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -28,12 +28,14 @@
#include "Driver.h"
#include "Settings.h"
int32 api_version = B_CUR_DRIVER_API_VERSION;
static const char *sDeviceBaseName = "net/usb_beceemwmx/";
BeceemDevice *gBeceemDevices[MAX_DEVICES];
char *gDeviceNames[MAX_DEVICES + 1];
usb_module_info *gUSBModule = NULL;
usb_support_descriptor gSupportedDevices[] = {
{ 0, 0, 0, 0x0489, 0xe016},
// "Ubee WiMAX Mobile USB - PXU1900 (Clear)"
@ -47,8 +49,10 @@ usb_support_descriptor gSupportedDevices[] = {
// "ZTE TU25 WiMAX Adapter [Beceem BCS200]"
};
mutex gDriverLock;
// auto-release helper class
class DriverSmartLock {
public:
@ -56,6 +60,7 @@ public:
~DriverSmartLock() { mutex_unlock(&gDriverLock); }
};
BeceemDevice *
create_beceem_device(usb_device device)
{

View File

@ -1,18 +1,21 @@
/*
* Beceem WiMax USB Driver.
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* Beceem WiMax USB Driver
* Copyright 2010-2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Heavily based on code of :
* Driver for USB Ethernet Control Model devices
* Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
* Distributed under the terms of the MIT license.
* Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
*
* Partially using:
* USB Ethernet Control Model devices
* (c) 2008 by Michael Lotz, <mmlr@mlotz.ch>
* ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver
* (c) 2008 by S.Zharski, <imker@gmx.li>
*/
#ifndef _USB_BECEEM_DRIVER_H_
#define _USB_BECEEM_DRIVER_H_
#include <OS.h>
#include <KernelExport.h>
#include <Drivers.h>
@ -25,6 +28,7 @@
#include <util/kernel_cpp.h>
#define DRIVER_NAME "usb_beceemwmx"
#define MAX_DEVICES 8
@ -101,6 +105,7 @@ const char* const kVersion = "ver.5.2.45.1";
extern usb_module_info *gUSBModule;
extern "C" {
status_t usb_beceem_device_added(usb_device device, void **cookie);
status_t usb_beceem_device_removed(void *cookie);
@ -112,5 +117,6 @@ const char **publish_devices();
device_hooks *find_device(const char *name);
}
#endif //_USB_BECEEM_DRIVER_H_

View File

@ -1,19 +1,24 @@
/*
* Beceem WiMax USB Driver.
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* Distributed under the terms of the MIT license.
*
* Heavily based on code of :
* Driver for USB Ethernet Control Model devices
* Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
* Beceem WiMax USB Driver
* Copyright 2010-2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
*
* Partially using:
* USB Ethernet Control Model devices
* (c) 2008 by Michael Lotz, <mmlr@mlotz.ch>
* ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver
* (c) 2008 by S.Zharski, <imker@gmx.li>
*/
#include <lock.h> // for mutex
#include "Settings.h"
bool gTraceOn = false;
bool gTruncateLogFile = false;
bool gAddTimeStamp = true;
@ -21,6 +26,7 @@ bool gTraceFlow = false;
static char *gLogFilePath = NULL;
mutex gLogLock;
static
void create_log()
{
@ -33,6 +39,7 @@ void create_log()
mutex_init(&gLogLock, DRIVER_NAME"-logging");
}
void load_settings()
{
void *handle = load_driver_settings(DRIVER_NAME);
@ -56,6 +63,7 @@ void load_settings()
create_log();
}
void release_settings()
{
if(gLogFilePath != NULL) {
@ -64,6 +72,7 @@ void release_settings()
}
}
void usb_beceem_trace(bool force, const char* func, const char *fmt, ...)
{
if(!(force || gTraceOn)) {

View File

@ -1,22 +1,25 @@
/*
* Ubee WiMax USB Driver.
* Copyright (c) 2010 Alexander von Gluck <kallisti5@unixzen.com>
* Distributed under the terms of the MIT license.
*
* Heavily based on code of :
* Driver for USB Ethernet Control Model devices
* Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
* Beceem WiMax USB Driver
* Copyright 2010-2011 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
*
* Partially using:
* USB Ethernet Control Model devices
* (c) 2008 by Michael Lotz, <mmlr@mlotz.ch>
* ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver
* (c) 2008 by S.Zharski, <imker@gmx.li>
*/
#ifndef _USB_BECEEM_SETTINGS_H_
#define _USB_BECEEM_SETTINGS_H_
#include <driver_settings.h>
#include <driver_settings.h>
#include "Driver.h"
void load_settings();
void release_settings();