Style fixes, notably the pointer style and struct keyword used
iconsintently. Respect the 80 columns limit, update copyright, used calloc instead of malloc. No functional changes (hopefully) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40597 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#ifndef __MYDEBUG_H
|
#ifndef __MYDEBUG_H
|
||||||
#define __MYDEBUG_H
|
#define __MYDEBUG_H
|
||||||
|
|
||||||
#define ARGS (const char *, ...)
|
#define ARGS (const char*, ...)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define LOG(ARGS) dprintf ARGS
|
#define LOG(ARGS) dprintf ARGS
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2003-2005
|
/* Copyright (c) 2003-2011
|
||||||
* Stefano Ceccherini <[email protected]>. All rights reserved.
|
* Stefano Ceccherini <[email protected]>. All rights reserved.
|
||||||
* This file is released under the MIT license
|
* This file is released under the MIT license
|
||||||
*/
|
*/
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
@@ -17,21 +17,20 @@
|
|||||||
#include "wb840.h"
|
#include "wb840.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_CARDS 4
|
#define MAX_CARDS 4
|
||||||
|
|
||||||
extern char * gDevNameList[];
|
extern char* gDevNameList[];
|
||||||
extern pci_info *gDevList[];
|
extern pci_info* gDevList[];
|
||||||
|
|
||||||
static int32 sOpenMask = 0;
|
static int32 sOpenMask = 0;
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
wb840_open(const char *name, uint32 flags, void** cookie)
|
wb840_open(const char* name, uint32 flags, void** cookie)
|
||||||
{
|
{
|
||||||
char *deviceName = NULL;
|
char* deviceName = NULL;
|
||||||
int32 i;
|
int32 i;
|
||||||
int32 mask;
|
int32 mask;
|
||||||
struct wb_device *data;
|
struct wb_device* data;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
LOG((DEVICE_NAME ": open()\n"));
|
LOG((DEVICE_NAME ": open()\n"));
|
||||||
@@ -52,13 +51,11 @@ wb840_open(const char *name, uint32 flags, void** cookie)
|
|||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
|
|
||||||
// Allocate a wb_device structure
|
// Allocate a wb_device structure
|
||||||
if (!(data = (wb_device *)malloc(sizeof(wb_device)))) {
|
if (!(data = (wb_device*)calloc(1, sizeof(wb_device)))) {
|
||||||
sOpenMask &= ~(1L << i);
|
sOpenMask &= ~(1L << i);
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(data, 0, sizeof(wb_device));
|
|
||||||
|
|
||||||
*cookie = data;
|
*cookie = data;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -70,26 +67,27 @@ wb840_open(const char *name, uint32 flags, void** cookie)
|
|||||||
data->deviceName = gDevNameList[i];
|
data->deviceName = gDevNameList[i];
|
||||||
data->blockFlag = 0;
|
data->blockFlag = 0;
|
||||||
data->reg_base = data->pciInfo->u.h0.base_registers[0];
|
data->reg_base = data->pciInfo->u.h0.base_registers[0];
|
||||||
data->wb_cachesize = gPci->read_pci_config(data->pciInfo->bus, data->pciInfo->device,
|
data->wb_cachesize = gPci->read_pci_config(data->pciInfo->bus,
|
||||||
data->pciInfo->function, PCI_line_size, sizeof (PCI_line_size)) & 0xff;
|
data->pciInfo->device, data->pciInfo->function, PCI_line_size,
|
||||||
|
sizeof(PCI_line_size)) & 0xff;
|
||||||
|
|
||||||
wb_read_eeprom(data, &data->MAC_Address, 0, 3, false);
|
wb_read_eeprom(data, &data->MAC_Address, 0, 3, false);
|
||||||
|
|
||||||
status = wb_create_semaphores(data);
|
status = wb_create_semaphores(data);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
LOG((DEVICE_NAME ": Couldn't create semaphores\n"));
|
LOG((DEVICE_NAME": couldn't create semaphores\n"));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = wb_stop(data);
|
status = wb_stop(data);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
LOG((DEVICE_NAME": Can't stop device\n"));
|
LOG((DEVICE_NAME": can't stop device\n"));
|
||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = wb_initPHYs(data);
|
status = wb_initPHYs(data);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
LOG((DEVICE_NAME": Can't init PHYs\n"));
|
LOG((DEVICE_NAME": can't init PHYs\n"));
|
||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,11 +98,11 @@ wb840_open(const char *name, uint32 flags, void** cookie)
|
|||||||
status = install_io_interrupt_handler(data->irq, wb_interrupt, data, 0);
|
status = install_io_interrupt_handler(data->irq, wb_interrupt, data, 0);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
LOG((DEVICE_NAME
|
LOG((DEVICE_NAME
|
||||||
" can't install interrupt handler: %s\n", strerror(status)));
|
": can't install interrupt handler: %s\n", strerror(status)));
|
||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(("Interrupts installed at irq line %x\n", data->irq));
|
LOG((DEVICE_NAME ": interrupts installed at irq line %x\n", data->irq));
|
||||||
|
|
||||||
status = wb_create_rings(data);
|
status = wb_create_rings(data);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
@@ -139,9 +137,9 @@ err:
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
wb840_read(void* cookie, off_t position, void *buf, size_t* num_bytes)
|
wb840_read(void* cookie, off_t position, void* buf, size_t* num_bytes)
|
||||||
{
|
{
|
||||||
wb_device *device = (wb_device*)cookie;
|
wb_device* device = (wb_device*)cookie;
|
||||||
int16 current;
|
int16 current;
|
||||||
status_t status;
|
status_t status;
|
||||||
size_t size;
|
size_t size;
|
||||||
@@ -167,7 +165,8 @@ wb840_read(void* cookie, off_t position, void *buf, size_t* num_bytes)
|
|||||||
current = device->rxCurrent;
|
current = device->rxCurrent;
|
||||||
check = device->rxDescriptor[current].wb_status;
|
check = device->rxDescriptor[current].wb_status;
|
||||||
if (check & WB_RXSTAT_OWN) {
|
if (check & WB_RXSTAT_OWN) {
|
||||||
LOG(("ERROR: read: buffer %d still in use: %x\n", (int)current, (int)status));
|
LOG((DEVICE_NAME ":ERROR: read: buffer %d still in use: %x\n",
|
||||||
|
(int)current, (int)status));
|
||||||
atomic_and(&device->rxLock, 0);
|
atomic_and(&device->rxLock, 0);
|
||||||
*num_bytes = 0;
|
*num_bytes = 0;
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
@@ -185,7 +184,7 @@ wb840_read(void* cookie, off_t position, void *buf, size_t* num_bytes)
|
|||||||
size = *num_bytes;
|
size = *num_bytes;
|
||||||
}
|
}
|
||||||
*num_bytes = size;
|
*num_bytes = size;
|
||||||
memcpy(buf, (void *)device->rxBuffer[current], size);
|
memcpy(buf, (void*)device->rxBuffer[current], size);
|
||||||
}
|
}
|
||||||
|
|
||||||
device->rxCurrent = (current + 1) & WB_RX_CNT_MASK;
|
device->rxCurrent = (current + 1) & WB_RX_CNT_MASK;
|
||||||
@@ -211,7 +210,7 @@ wb840_read(void* cookie, off_t position, void *buf, size_t* num_bytes)
|
|||||||
static status_t
|
static status_t
|
||||||
wb840_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
wb840_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
||||||
{
|
{
|
||||||
wb_device *device = (wb_device*)cookie;
|
wb_device* device = (wb_device*)cookie;
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
uint16 frameSize;
|
uint16 frameSize;
|
||||||
int16 current;
|
int16 current;
|
||||||
@@ -231,7 +230,8 @@ wb840_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
|||||||
status = acquire_sem_etc(device->txSem, 1, B_TIMEOUT, ETHER_TRANSMIT_TIMEOUT);
|
status = acquire_sem_etc(device->txSem, 1, B_TIMEOUT, ETHER_TRANSMIT_TIMEOUT);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
write32(device->reg_base + WB_TXSTART, 0xFFFFFFFF);
|
write32(device->reg_base + WB_TXSTART, 0xFFFFFFFF);
|
||||||
LOG(("write: acquiring sem failed: %ld, %s\n", status, strerror(status)));
|
LOG((DEVICE_NAME": write: acquiring sem failed: %ld, %s\n",
|
||||||
|
status, strerror(status)));
|
||||||
atomic_add(&device->txLock, -1);
|
atomic_add(&device->txLock, -1);
|
||||||
*num_bytes = 0;
|
*num_bytes = 0;
|
||||||
return status;
|
return status;
|
||||||
@@ -247,7 +247,7 @@ wb840_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy data to tx buffer */
|
/* Copy data to tx buffer */
|
||||||
memcpy((void *)device->txBuffer[current], buffer, frameSize);
|
memcpy((void*)device->txBuffer[current], buffer, frameSize);
|
||||||
device->txCurrent = (current + 1) & WB_TX_CNT_MASK;
|
device->txCurrent = (current + 1) & WB_TX_CNT_MASK;
|
||||||
LOG((DEVICE_NAME ": %d bytes written\n", frameSize));
|
LOG((DEVICE_NAME ": %d bytes written\n", frameSize));
|
||||||
|
|
||||||
@@ -256,7 +256,8 @@ wb840_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
|||||||
acquire_spinlock(&device->txSpinlock);
|
acquire_spinlock(&device->txSpinlock);
|
||||||
|
|
||||||
device->txDescriptor[current].wb_ctl = WB_TXCTL_TLINK | frameSize;
|
device->txDescriptor[current].wb_ctl = WB_TXCTL_TLINK | frameSize;
|
||||||
device->txDescriptor[current].wb_ctl |= WB_TXCTL_FIRSTFRAG | WB_TXCTL_LASTFRAG;
|
device->txDescriptor[current].wb_ctl |= WB_TXCTL_FIRSTFRAG
|
||||||
|
| WB_TXCTL_LASTFRAG;
|
||||||
device->txDescriptor[current].wb_status = WB_TXSTAT_OWN;
|
device->txDescriptor[current].wb_status = WB_TXSTAT_OWN;
|
||||||
device->txSent++;
|
device->txSent++;
|
||||||
|
|
||||||
@@ -274,9 +275,9 @@ wb840_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
wb840_control (void *cookie, uint32 op, void *arg, size_t len)
|
wb840_control (void* cookie, uint32 op, void* arg, size_t len)
|
||||||
{
|
{
|
||||||
wb_device *data = (wb_device *)cookie;
|
wb_device* data = (wb_device*)cookie;
|
||||||
|
|
||||||
LOG((DEVICE_NAME ": control()\n"));
|
LOG((DEVICE_NAME ": control()\n"));
|
||||||
switch (op) {
|
switch (op) {
|
||||||
@@ -292,7 +293,7 @@ wb840_control (void *cookie, uint32 op, void *arg, size_t len)
|
|||||||
|
|
||||||
case ETHER_NONBLOCK:
|
case ETHER_NONBLOCK:
|
||||||
LOG(("ETHER_NON_BLOCK\n"));
|
LOG(("ETHER_NON_BLOCK\n"));
|
||||||
data->blockFlag = *(int32 *)arg ? B_TIMEOUT : 0;
|
data->blockFlag = *(int32*)arg ? B_TIMEOUT : 0;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case ETHER_GETFRAMESIZE:
|
case ETHER_GETFRAMESIZE:
|
||||||
@@ -338,7 +339,7 @@ wb840_control (void *cookie, uint32 op, void *arg, size_t len)
|
|||||||
static status_t
|
static status_t
|
||||||
wb840_close(void* cookie)
|
wb840_close(void* cookie)
|
||||||
{
|
{
|
||||||
wb_device *device = (wb_device *)cookie;
|
wb_device* device = (wb_device*)cookie;
|
||||||
|
|
||||||
LOG((DEVICE_NAME ": close()\n"));
|
LOG((DEVICE_NAME ": close()\n"));
|
||||||
|
|
||||||
@@ -362,7 +363,7 @@ wb840_close(void* cookie)
|
|||||||
static status_t
|
static status_t
|
||||||
wb840_free(void* cookie)
|
wb840_free(void* cookie)
|
||||||
{
|
{
|
||||||
wb_device *device = (wb_device *)cookie;
|
wb_device* device = (wb_device*)cookie;
|
||||||
|
|
||||||
LOG((DEVICE_NAME ": free()\n"));
|
LOG((DEVICE_NAME ": free()\n"));
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,6 @@
|
|||||||
# define write32(address,data) (*((volatile uint32 *)(address)) = (data))
|
# define write32(address,data) (*((volatile uint32 *)(address)) = (data))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern pci_module_info *gPci;
|
extern pci_module_info* gPci;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2003-2004
|
/* Copyright (c) 2003-2011
|
||||||
* Stefano Ceccherini <[email protected]>. All rights reserved.
|
* Stefano Ceccherini <[email protected]>. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
||||||
|
|
||||||
pci_module_info *gPci;
|
pci_module_info* gPci;
|
||||||
char* gDevNameList[MAX_CARDS + 1];
|
char* gDevNameList[MAX_CARDS + 1];
|
||||||
pci_info *gDevList[MAX_CARDS];
|
pci_info* gDevList[MAX_CARDS];
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
probe(pci_info *item)
|
probe(pci_info* item)
|
||||||
{
|
{
|
||||||
if ((item->vendor_id == WB_VENDORID && item->device_id == WB_DEVICEID_840F)
|
if ((item->vendor_id == WB_VENDORID && item->device_id == WB_DEVICEID_840F)
|
||||||
|| (item->vendor_id == CP_VENDORID && item->device_id == CP_DEVICEID_RL100))
|
|| (item->vendor_id == CP_VENDORID && item->device_id == CP_DEVICEID_RL100))
|
||||||
@@ -34,7 +34,7 @@ probe(pci_info *item)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
init_hardware (void)
|
init_hardware(void)
|
||||||
{
|
{
|
||||||
LOG((DEVICE_NAME ": init_hardware\n"));
|
LOG((DEVICE_NAME ": init_hardware\n"));
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -42,9 +42,9 @@ init_hardware (void)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
init_driver (void)
|
init_driver(void)
|
||||||
{
|
{
|
||||||
struct pci_info *item = NULL;
|
struct pci_info* item = NULL;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int card_found = 0;
|
int card_found = 0;
|
||||||
char devName[64];
|
char devName[64];
|
||||||
@@ -56,11 +56,11 @@ init_driver (void)
|
|||||||
set_dprintf_enabled(true);
|
set_dprintf_enabled(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status = get_module(B_PCI_MODULE_NAME, (module_info **)&gPci);
|
status = get_module(B_PCI_MODULE_NAME, (module_info**)&gPci);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
item = (pci_info *)malloc(sizeof(pci_info));
|
item = (pci_info*)malloc(sizeof(pci_info));
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
put_module(B_PCI_MODULE_NAME);
|
put_module(B_PCI_MODULE_NAME);
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
@@ -128,7 +128,7 @@ device_hooks*
|
|||||||
find_device(const char* name)
|
find_device(const char* name)
|
||||||
{
|
{
|
||||||
int32 i;
|
int32 i;
|
||||||
char *item;
|
char* item;
|
||||||
|
|
||||||
LOG((DEVICE_NAME ": find_device()\n"));
|
LOG((DEVICE_NAME ": find_device()\n"));
|
||||||
// Find device name
|
// Find device name
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2003-2005
|
/* Copyright (c) 2003-2011
|
||||||
* Stefano Ceccherini <[email protected]>. All rights reserved.
|
* Stefano Ceccherini <[email protected]>. All rights reserved.
|
||||||
* This file is released under the MIT license
|
* This file is released under the MIT license
|
||||||
*/
|
*/
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
@@ -26,8 +26,9 @@
|
|||||||
|
|
||||||
struct mii_chip_info
|
struct mii_chip_info
|
||||||
{
|
{
|
||||||
const char *name;
|
const char* name;
|
||||||
uint16 id0, id1;
|
uint16 id0;
|
||||||
|
uint16 id1;
|
||||||
uint8 types;
|
uint8 types;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,12 +36,12 @@ struct mii_chip_info
|
|||||||
const static struct mii_chip_info
|
const static struct mii_chip_info
|
||||||
gMIIChips[] = {
|
gMIIChips[] = {
|
||||||
{"DAVICOM_DM9101", PHY_ID0_DAVICOM_DM9101, PHY_ID1_DAVICOM_DM9101, MII_LAN},
|
{"DAVICOM_DM9101", PHY_ID0_DAVICOM_DM9101, PHY_ID1_DAVICOM_DM9101, MII_LAN},
|
||||||
{NULL,0,0,0}
|
{NULL, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mii_readstatus(wb_device *device)
|
mii_readstatus(wb_device* device)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int status;
|
int status;
|
||||||
@@ -54,7 +55,7 @@ mii_readstatus(wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
static phys_addr_t
|
static phys_addr_t
|
||||||
physicalAddress(volatile void *addr, uint32 length)
|
physicalAddress(volatile void* addr, uint32 length)
|
||||||
{
|
{
|
||||||
physical_entry table;
|
physical_entry table;
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ physicalAddress(volatile void *addr, uint32 length)
|
|||||||
|
|
||||||
// Prepares a RX descriptor to be used by the chip
|
// Prepares a RX descriptor to be used by the chip
|
||||||
void
|
void
|
||||||
wb_put_rx_descriptor(volatile wb_desc *descriptor)
|
wb_put_rx_descriptor(volatile wb_desc* descriptor)
|
||||||
{
|
{
|
||||||
descriptor->wb_status = WB_RXSTAT_OWN;
|
descriptor->wb_status = WB_RXSTAT_OWN;
|
||||||
descriptor->wb_ctl |= WB_MAX_FRAMELEN | WB_RXCTL_RLINK;
|
descriptor->wb_ctl |= WB_MAX_FRAMELEN | WB_RXCTL_RLINK;
|
||||||
@@ -74,7 +75,7 @@ wb_put_rx_descriptor(volatile wb_desc *descriptor)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wb_enable_interrupts(struct wb_device *device)
|
wb_enable_interrupts(wb_device* device)
|
||||||
{
|
{
|
||||||
write32(device->reg_base + WB_IMR, WB_INTRS);
|
write32(device->reg_base + WB_IMR, WB_INTRS);
|
||||||
write32(device->reg_base + WB_ISR, 0xFFFFFFFF);
|
write32(device->reg_base + WB_ISR, 0xFFFFFFFF);
|
||||||
@@ -82,7 +83,7 @@ wb_enable_interrupts(struct wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wb_disable_interrupts(struct wb_device *device)
|
wb_disable_interrupts(wb_device* device)
|
||||||
{
|
{
|
||||||
write32(device->reg_base + WB_IMR, 0L);
|
write32(device->reg_base + WB_IMR, 0L);
|
||||||
write32(device->reg_base + WB_ISR, 0L);
|
write32(device->reg_base + WB_ISR, 0L);
|
||||||
@@ -90,7 +91,7 @@ wb_disable_interrupts(struct wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wb_selectPHY(wb_device *device)
|
wb_selectPHY(wb_device* device)
|
||||||
{
|
{
|
||||||
uint16 status;
|
uint16 status;
|
||||||
|
|
||||||
@@ -107,12 +108,12 @@ wb_selectPHY(wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
wb_initPHYs(wb_device *device)
|
wb_initPHYs(wb_device* device)
|
||||||
{
|
{
|
||||||
uint16 phy;
|
uint16 phy;
|
||||||
// search for total of 32 possible MII PHY addresses
|
// search for total of 32 possible MII PHY addresses
|
||||||
for (phy = 0; phy < 32; phy++) {
|
for (phy = 0; phy < 32; phy++) {
|
||||||
struct mii_phy *mii;
|
struct mii_phy* mii;
|
||||||
uint16 status;
|
uint16 status;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ wb_initPHYs(wb_device *device)
|
|||||||
// this MII is not accessable
|
// this MII is not accessable
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mii = (struct mii_phy *)malloc(sizeof(struct mii_phy));
|
mii = (struct mii_phy*)calloc(1, sizeof(struct mii_phy));
|
||||||
if (mii == NULL)
|
if (mii == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
@@ -135,15 +136,18 @@ wb_initPHYs(wb_device *device)
|
|||||||
device->firstPHY = mii;
|
device->firstPHY = mii;
|
||||||
|
|
||||||
while (gMIIChips[i].name != NULL) {
|
while (gMIIChips[i].name != NULL) {
|
||||||
if (gMIIChips[i].id0 == mii->id0 && gMIIChips[i].id1 == (mii->id1 & 0xfff0)) {
|
if (gMIIChips[i].id0 == mii->id0
|
||||||
|
&& gMIIChips[i].id1 == (mii->id1 & 0xfff0)) {
|
||||||
dprintf("Found MII PHY: %s\n", gMIIChips[i].name);
|
dprintf("Found MII PHY: %s\n", gMIIChips[i].name);
|
||||||
mii->types = gMIIChips[i].types;
|
mii->types = gMIIChips[i].types;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (gMIIChips[i].name == NULL)
|
if (gMIIChips[i].name == NULL) {
|
||||||
dprintf("Unknown MII PHY transceiver: id = (%x, %x).\n",mii->id0, mii->id1);
|
dprintf("Unknown MII PHY transceiver: id = (%x, %x).\n",
|
||||||
|
mii->id0, mii->id1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->firstPHY == NULL) {
|
if (device->firstPHY == NULL) {
|
||||||
@@ -159,7 +163,7 @@ wb_initPHYs(wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wb_init(wb_device *device)
|
wb_init(wb_device* device)
|
||||||
{
|
{
|
||||||
LOG((DEVICE_NAME": init()\n"));
|
LOG((DEVICE_NAME": init()\n"));
|
||||||
|
|
||||||
@@ -183,14 +187,16 @@ wb_init(wb_device *device)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
write32(device->reg_base + WB_BUSCTL, WB_BUSCTL_MUSTBEONE|WB_BUSCTL_ARBITRATION);
|
write32(device->reg_base + WB_BUSCTL,
|
||||||
|
WB_BUSCTL_MUSTBEONE | WB_BUSCTL_ARBITRATION);
|
||||||
WB_SETBIT(device->reg_base + WB_BUSCTL, WB_BURSTLEN_16LONG);
|
WB_SETBIT(device->reg_base + WB_BUSCTL, WB_BURSTLEN_16LONG);
|
||||||
|
|
||||||
write32(device->reg_base + WB_BUSCTL_SKIPLEN, WB_SKIPLEN_4LONG);
|
write32(device->reg_base + WB_BUSCTL_SKIPLEN, WB_SKIPLEN_4LONG);
|
||||||
|
|
||||||
// Disable early TX/RX interrupt, as we can't take advantage
|
// Disable early TX/RX interrupt, as we can't take advantage
|
||||||
// from them, at least for now.
|
// from them, at least for now.
|
||||||
WB_CLRBIT(device->reg_base + WB_NETCFG, (WB_NETCFG_TX_EARLY_ON|WB_NETCFG_RX_EARLY_ON));
|
WB_CLRBIT(device->reg_base + WB_NETCFG,
|
||||||
|
(WB_NETCFG_TX_EARLY_ON | WB_NETCFG_RX_EARLY_ON));
|
||||||
|
|
||||||
wb_set_rx_filter(device);
|
wb_set_rx_filter(device);
|
||||||
}
|
}
|
||||||
@@ -225,13 +231,13 @@ wb_reset(wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
wb_stop(wb_device *device)
|
wb_stop(wb_device* device)
|
||||||
{
|
{
|
||||||
uint32 cfgAddress = (uint32)device->reg_base + WB_NETCFG;
|
uint32 cfgAddress = (uint32)device->reg_base + WB_NETCFG;
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
|
|
||||||
if (read32(cfgAddress) & (WB_NETCFG_TX_ON|WB_NETCFG_RX_ON)) {
|
if (read32(cfgAddress) & (WB_NETCFG_TX_ON | WB_NETCFG_RX_ON)) {
|
||||||
WB_CLRBIT(cfgAddress, (WB_NETCFG_TX_ON|WB_NETCFG_RX_ON));
|
WB_CLRBIT(cfgAddress, (WB_NETCFG_TX_ON | WB_NETCFG_RX_ON));
|
||||||
|
|
||||||
for (i = 0; i < WB_TIMEOUT; i++) {
|
for (i = 0; i < WB_TIMEOUT; i++) {
|
||||||
if ((read32(device->reg_base + WB_ISR) & WB_ISR_TX_IDLE) &&
|
if ((read32(device->reg_base + WB_ISR) & WB_ISR_TX_IDLE) &&
|
||||||
@@ -248,7 +254,7 @@ wb_stop(wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wb_updateLink(struct wb_device *device)
|
wb_updateLink(wb_device* device)
|
||||||
{
|
{
|
||||||
if (!device->autoNegotiationComplete) {
|
if (!device->autoNegotiationComplete) {
|
||||||
int32 mode = wb_read_mode(device);
|
int32 mode = wb_read_mode(device);
|
||||||
@@ -277,9 +283,9 @@ wb_updateLink(struct wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
wb_tick(timer *arg)
|
wb_tick(timer* arg)
|
||||||
{
|
{
|
||||||
struct wb_device *device = (wb_device*)arg;
|
wb_device* device = (wb_device*)arg;
|
||||||
|
|
||||||
wb_updateLink(device);
|
wb_updateLink(device);
|
||||||
|
|
||||||
@@ -291,7 +297,7 @@ wb_tick(timer *arg)
|
|||||||
* Program the rx filter.
|
* Program the rx filter.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
wb_set_rx_filter(wb_device *device)
|
wb_set_rx_filter(wb_device* device)
|
||||||
{
|
{
|
||||||
// TODO: Basically we just config the filter to accept broadcasts
|
// TODO: Basically we just config the filter to accept broadcasts
|
||||||
// packets. We'll need also to configure it to multicast.
|
// packets. We'll need also to configure it to multicast.
|
||||||
@@ -301,7 +307,7 @@ wb_set_rx_filter(wb_device *device)
|
|||||||
|
|
||||||
/***************** Interrupt handling ******************************/
|
/***************** Interrupt handling ******************************/
|
||||||
static status_t
|
static status_t
|
||||||
wb_rxok(struct wb_device *device)
|
wb_rxok(wb_device* device)
|
||||||
{
|
{
|
||||||
uint32 releaseRxSem = 0;
|
uint32 releaseRxSem = 0;
|
||||||
int16 limit;
|
int16 limit;
|
||||||
@@ -309,12 +315,14 @@ wb_rxok(struct wb_device *device)
|
|||||||
acquire_spinlock(&device->rxSpinlock);
|
acquire_spinlock(&device->rxSpinlock);
|
||||||
|
|
||||||
for (limit = device->rxFree; limit > 0; limit--) {
|
for (limit = device->rxFree; limit > 0; limit--) {
|
||||||
if (device->rxDescriptor[device->rxInterruptIndex].wb_status & WB_RXSTAT_OWN) {
|
if (device->rxDescriptor[device->rxInterruptIndex].wb_status
|
||||||
|
& WB_RXSTAT_OWN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
releaseRxSem++;
|
releaseRxSem++;
|
||||||
device->rxInterruptIndex = (device->rxInterruptIndex + 1) & WB_RX_CNT_MASK;
|
device->rxInterruptIndex = (device->rxInterruptIndex + 1)
|
||||||
|
& WB_RX_CNT_MASK;
|
||||||
device->rxFree--;
|
device->rxFree--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +341,7 @@ wb_rxok(struct wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
wb_tx_nobuf(struct wb_device *info)
|
wb_tx_nobuf(wb_device* info)
|
||||||
{
|
{
|
||||||
int16 releaseTxSem = 0;
|
int16 releaseTxSem = 0;
|
||||||
int16 limit;
|
int16 limit;
|
||||||
@@ -377,9 +385,9 @@ wb_tx_nobuf(struct wb_device *info)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
wb_interrupt(void *arg)
|
wb_interrupt(void* arg)
|
||||||
{
|
{
|
||||||
struct wb_device *device = (wb_device*)arg;
|
wb_device* device = (wb_device*)arg;
|
||||||
int32 retval = B_UNHANDLED_INTERRUPT;
|
int32 retval = B_UNHANDLED_INTERRUPT;
|
||||||
uint32 status;
|
uint32 status;
|
||||||
|
|
||||||
@@ -469,21 +477,21 @@ wb_interrupt(void *arg)
|
|||||||
* Print an ethernet address
|
* Print an ethernet address
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
print_address(ether_address_t *addr)
|
print_address(ether_address_t* addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char buf[3 * 6 + 1];
|
char buf[3 * 6 + 1];
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
sprintf(&buf[3*i], "%02x:", addr->ebyte[i]);
|
sprintf(&buf[3 * i], "%02x:", addr->ebyte[i]);
|
||||||
}
|
}
|
||||||
sprintf(&buf[3*5], "%02x", addr->ebyte[5]);
|
sprintf(&buf[3 * 5], "%02x", addr->ebyte[5]);
|
||||||
dprintf("%s\n", buf);
|
dprintf("%s\n", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
wb_create_semaphores(struct wb_device *device)
|
wb_create_semaphores(wb_device* device)
|
||||||
{
|
{
|
||||||
device->rxSem = create_sem(0, "wb840 receive");
|
device->rxSem = create_sem(0, "wb840 receive");
|
||||||
if (device->rxSem < B_OK) {
|
if (device->rxSem < B_OK) {
|
||||||
@@ -509,7 +517,7 @@ wb_create_semaphores(struct wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wb_delete_semaphores(wb_device *device)
|
wb_delete_semaphores(wb_device* device)
|
||||||
{
|
{
|
||||||
if (device->rxSem >= 0)
|
if (device->rxSem >= 0)
|
||||||
delete_sem(device->rxSem);
|
delete_sem(device->rxSem);
|
||||||
@@ -519,46 +527,57 @@ wb_delete_semaphores(wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
wb_create_rings(struct wb_device *device)
|
wb_create_rings(wb_device* device)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
device->rxArea = create_area("wb840 rx buffer", (void **)&device->rxBuffer[0],
|
device->rxArea = create_area("wb840 rx buffer",
|
||||||
B_ANY_KERNEL_ADDRESS, ROUND_TO_PAGE_SIZE(WB_BUFBYTES * WB_RX_LIST_CNT),
|
(void**)&device->rxBuffer[0], B_ANY_KERNEL_ADDRESS,
|
||||||
B_32_BIT_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
ROUND_TO_PAGE_SIZE(WB_BUFBYTES * WB_RX_LIST_CNT),
|
||||||
|
B_32_BIT_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (device->rxArea < B_OK)
|
if (device->rxArea < B_OK)
|
||||||
return device->rxArea;
|
return device->rxArea;
|
||||||
|
|
||||||
for (i = 1; i < WB_RX_LIST_CNT; i++)
|
for (i = 1; i < WB_RX_LIST_CNT; i++) {
|
||||||
device->rxBuffer[i] = (void *)(((uint32)device->rxBuffer[0]) + (i * WB_BUFBYTES));
|
device->rxBuffer[i] = (void*)(((uint32)device->rxBuffer[0])
|
||||||
|
+ (i * WB_BUFBYTES));
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < WB_RX_LIST_CNT; i++) {
|
for (i = 0; i < WB_RX_LIST_CNT; i++) {
|
||||||
device->rxDescriptor[i].wb_status = 0;
|
device->rxDescriptor[i].wb_status = 0;
|
||||||
device->rxDescriptor[i].wb_ctl = WB_RXCTL_RLINK;
|
device->rxDescriptor[i].wb_ctl = WB_RXCTL_RLINK;
|
||||||
wb_put_rx_descriptor(&device->rxDescriptor[i]);
|
wb_put_rx_descriptor(&device->rxDescriptor[i]);
|
||||||
device->rxDescriptor[i].wb_data = physicalAddress(device->rxBuffer[i], WB_BUFBYTES);
|
device->rxDescriptor[i].wb_data = physicalAddress(
|
||||||
device->rxDescriptor[i].wb_next = physicalAddress(&device->rxDescriptor[(i + 1) & WB_RX_CNT_MASK],
|
device->rxBuffer[i], WB_BUFBYTES);
|
||||||
|
device->rxDescriptor[i].wb_next = physicalAddress(
|
||||||
|
&device->rxDescriptor[(i + 1) & WB_RX_CNT_MASK],
|
||||||
sizeof(struct wb_desc));
|
sizeof(struct wb_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
device->rxFree = WB_RX_LIST_CNT;
|
device->rxFree = WB_RX_LIST_CNT;
|
||||||
|
|
||||||
device->txArea = create_area("wb840 tx buffer", (void **)&device->txBuffer[0],
|
device->txArea = create_area("wb840 tx buffer",
|
||||||
B_ANY_KERNEL_ADDRESS, ROUND_TO_PAGE_SIZE(WB_BUFBYTES * WB_TX_LIST_CNT),
|
(void**)&device->txBuffer[0], B_ANY_KERNEL_ADDRESS,
|
||||||
B_32_BIT_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
ROUND_TO_PAGE_SIZE(WB_BUFBYTES * WB_TX_LIST_CNT),
|
||||||
|
B_32_BIT_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
|
|
||||||
if (device->txArea < B_OK) {
|
if (device->txArea < B_OK) {
|
||||||
delete_area(device->rxArea);
|
delete_area(device->rxArea);
|
||||||
return device->txArea;
|
return device->txArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < WB_TX_LIST_CNT; i++)
|
for (i = 1; i < WB_TX_LIST_CNT; i++) {
|
||||||
device->txBuffer[i] = (void *)(((uint32)device->txBuffer[0]) + (i * WB_BUFBYTES));
|
device->txBuffer[i] = (void*)(((uint32)device->txBuffer[0])
|
||||||
|
+ (i * WB_BUFBYTES));
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < WB_TX_LIST_CNT; i++) {
|
for (i = 0; i < WB_TX_LIST_CNT; i++) {
|
||||||
device->txDescriptor[i].wb_status = 0;
|
device->txDescriptor[i].wb_status = 0;
|
||||||
device->txDescriptor[i].wb_ctl = WB_TXCTL_TLINK;
|
device->txDescriptor[i].wb_ctl = WB_TXCTL_TLINK;
|
||||||
device->txDescriptor[i].wb_data = physicalAddress(device->txBuffer[i], WB_BUFBYTES);
|
device->txDescriptor[i].wb_data = physicalAddress(
|
||||||
device->txDescriptor[i].wb_next = physicalAddress(&device->txDescriptor[(i + 1) & WB_TX_CNT_MASK],
|
device->txBuffer[i], WB_BUFBYTES);
|
||||||
|
device->txDescriptor[i].wb_next = physicalAddress(
|
||||||
|
&device->txDescriptor[(i + 1) & WB_TX_CNT_MASK],
|
||||||
sizeof(struct wb_desc));
|
sizeof(struct wb_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,7 +593,7 @@ wb_create_rings(struct wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wb_delete_rings(struct wb_device *device)
|
wb_delete_rings(wb_device* device)
|
||||||
{
|
{
|
||||||
delete_area(device->rxArea);
|
delete_area(device->rxArea);
|
||||||
delete_area(device->txArea);
|
delete_area(device->txArea);
|
||||||
@@ -582,10 +601,12 @@ wb_delete_rings(struct wb_device *device)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
wb_read_mode(wb_device *info)
|
wb_read_mode(wb_device* info)
|
||||||
{
|
{
|
||||||
uint16 autoAdv, autoLinkPartner;
|
uint16 autoAdv;
|
||||||
int32 speed, duplex;
|
uint16 autoLinkPartner;
|
||||||
|
int32 speed;
|
||||||
|
int32 duplex;
|
||||||
|
|
||||||
uint16 status = mii_readstatus(info);
|
uint16 status = mii_readstatus(info);
|
||||||
if (!(status & MII_STATUS_LINK)) {
|
if (!(status & MII_STATUS_LINK)) {
|
||||||
@@ -595,11 +616,14 @@ wb_read_mode(wb_device *info)
|
|||||||
|
|
||||||
// auto negotiation completed
|
// auto negotiation completed
|
||||||
autoAdv = wb_miibus_readreg(info, info->phy, MII_AUTONEG_ADV);
|
autoAdv = wb_miibus_readreg(info, info->phy, MII_AUTONEG_ADV);
|
||||||
autoLinkPartner = wb_miibus_readreg(info, info->phy, MII_AUTONEG_LINK_PARTNER);
|
autoLinkPartner = wb_miibus_readreg(info, info->phy,
|
||||||
|
MII_AUTONEG_LINK_PARTNER);
|
||||||
status = autoAdv & autoLinkPartner;
|
status = autoAdv & autoLinkPartner;
|
||||||
|
|
||||||
speed = status & (MII_NWAY_TX | MII_NWAY_TX_FDX) ? LINK_SPEED_100_MBIT : LINK_SPEED_10_MBIT;
|
speed = status & (MII_NWAY_TX | MII_NWAY_TX_FDX)
|
||||||
duplex = status & (MII_NWAY_TX_FDX | MII_NWAY_T_FDX) ? LINK_FULL_DUPLEX : LINK_HALF_DUPLEX;
|
? LINK_SPEED_100_MBIT : LINK_SPEED_10_MBIT;
|
||||||
|
duplex = status & (MII_NWAY_TX_FDX | MII_NWAY_T_FDX)
|
||||||
|
? LINK_FULL_DUPLEX : LINK_HALF_DUPLEX;
|
||||||
|
|
||||||
info->autoNegotiationComplete = true;
|
info->autoNegotiationComplete = true;
|
||||||
|
|
||||||
@@ -612,7 +636,7 @@ wb_read_mode(wb_device *info)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wb_set_mode(wb_device *info, int mode)
|
wb_set_mode(wb_device* info, int mode)
|
||||||
{
|
{
|
||||||
uint32 cfgAddress = (uint32)info->reg_base + WB_NETCFG;
|
uint32 cfgAddress = (uint32)info->reg_base + WB_NETCFG;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2004 Stefano Ceccherini ([email protected])
|
* Copyright (c) 2003-2004 Stefano Ceccherini ([email protected])
|
||||||
* Copyright (c) 1997, 1998
|
* Copyright (c) 1997, 1998
|
||||||
* Bill Paul <[email protected]>. All rights reserved.
|
* Bill Paul <[email protected]>. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -342,7 +342,7 @@ struct wb_device {
|
|||||||
|
|
||||||
// rx data
|
// rx data
|
||||||
volatile wb_desc rxDescriptor[WB_RX_LIST_CNT];
|
volatile wb_desc rxDescriptor[WB_RX_LIST_CNT];
|
||||||
volatile void *rxBuffer[WB_RX_LIST_CNT];
|
volatile void* rxBuffer[WB_RX_LIST_CNT];
|
||||||
int32 rxLock;
|
int32 rxLock;
|
||||||
sem_id rxSem;
|
sem_id rxSem;
|
||||||
spinlock rxSpinlock;
|
spinlock rxSpinlock;
|
||||||
@@ -353,7 +353,7 @@ struct wb_device {
|
|||||||
|
|
||||||
//tx data
|
//tx data
|
||||||
volatile wb_desc txDescriptor[WB_TX_LIST_CNT];
|
volatile wb_desc txDescriptor[WB_TX_LIST_CNT];
|
||||||
volatile char *txBuffer[WB_TX_LIST_CNT];
|
volatile char* txBuffer[WB_TX_LIST_CNT];
|
||||||
int32 txLock;
|
int32 txLock;
|
||||||
sem_id txSem;
|
sem_id txSem;
|
||||||
spinlock txSpinlock;
|
spinlock txSpinlock;
|
||||||
@@ -362,8 +362,8 @@ struct wb_device {
|
|||||||
int16 txInterruptIndex;
|
int16 txInterruptIndex;
|
||||||
int16 txSent;
|
int16 txSent;
|
||||||
|
|
||||||
struct mii_phy *firstPHY;
|
struct mii_phy* firstPHY;
|
||||||
struct mii_phy *currentPHY;
|
struct mii_phy* currentPHY;
|
||||||
uint16 phy;
|
uint16 phy;
|
||||||
bool autoNegotiationComplete;
|
bool autoNegotiationComplete;
|
||||||
bool link;
|
bool link;
|
||||||
@@ -480,35 +480,38 @@ enum link_modes {
|
|||||||
#define CP_VENDORID 0x11F6
|
#define CP_VENDORID 0x11F6
|
||||||
#define CP_DEVICEID_RL100 0x2011
|
#define CP_DEVICEID_RL100 0x2011
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Utility Macros
|
||||||
|
*/
|
||||||
#define WB_SETBIT(reg, x) write32(reg, read32(reg) | x)
|
#define WB_SETBIT(reg, x) write32(reg, read32(reg) | x)
|
||||||
#define WB_CLRBIT(reg, x) write32(reg, read32(reg) & ~x)
|
#define WB_CLRBIT(reg, x) write32(reg, read32(reg) & ~x)
|
||||||
|
|
||||||
// Prototypes
|
// Prototypes
|
||||||
extern int32 wb_interrupt(void *arg);
|
extern int32 wb_interrupt(void* arg);
|
||||||
|
|
||||||
extern status_t wb_create_semaphores(wb_device *device);
|
extern status_t wb_create_semaphores(wb_device* device);
|
||||||
extern void wb_delete_semaphores(wb_device *device);
|
extern void wb_delete_semaphores(wb_device* device);
|
||||||
|
|
||||||
extern status_t wb_create_rings(wb_device *device);
|
extern status_t wb_create_rings(wb_device* device);
|
||||||
extern void wb_delete_rings(wb_device *device);
|
extern void wb_delete_rings(wb_device* device);
|
||||||
|
|
||||||
extern void wb_init(wb_device *device);
|
extern void wb_init(wb_device* device);
|
||||||
extern void wb_reset(wb_device *device);
|
extern void wb_reset(wb_device* device);
|
||||||
extern status_t wb_stop(wb_device *device);
|
extern status_t wb_stop(wb_device* device);
|
||||||
|
|
||||||
extern status_t wb_initPHYs(wb_device *device);
|
extern status_t wb_initPHYs(wb_device* device);
|
||||||
|
|
||||||
extern void wb_disable_interrupts(wb_device *device);
|
extern void wb_disable_interrupts(wb_device* device);
|
||||||
extern void wb_enable_interrupts(wb_device *device);
|
extern void wb_enable_interrupts(wb_device* device);
|
||||||
|
|
||||||
extern void wb_set_mode(wb_device *device, int mode);
|
extern void wb_set_mode(wb_device* device, int mode);
|
||||||
extern int32 wb_read_mode(wb_device *device);
|
extern int32 wb_read_mode(wb_device* device);
|
||||||
|
|
||||||
extern void wb_set_rx_filter(wb_device *device);
|
extern void wb_set_rx_filter(wb_device* device);
|
||||||
|
|
||||||
extern int32 wb_tick(timer *arg);
|
extern int32 wb_tick(timer* arg);
|
||||||
extern void wb_put_rx_descriptor(volatile wb_desc *desc);
|
extern void wb_put_rx_descriptor(volatile wb_desc* desc);
|
||||||
|
|
||||||
extern void print_address(ether_address_t *addr);
|
extern void print_address(ether_address_t* addr);
|
||||||
|
|
||||||
#endif //__WB840_H
|
#endif //__WB840_H
|
||||||
|
|||||||
Reference in New Issue
Block a user