Winbond 840 NIC driver: implemented link status api (tested)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40594 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,12 +8,16 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "device.h"
|
||||
#include "driver.h"
|
||||
#include "interface.h"
|
||||
#include "wb840.h"
|
||||
|
||||
|
||||
|
||||
#define MAX_CARDS 4
|
||||
|
||||
extern char * gDevNameList[];
|
||||
@@ -296,6 +300,20 @@ wb840_control (void *cookie, uint32 op, void *arg, size_t len)
|
||||
*(uint32 *)arg = WB_MAX_FRAMELEN;
|
||||
return B_OK;
|
||||
|
||||
case ETHER_GET_LINK_STATE:
|
||||
{
|
||||
ether_link_state_t state;
|
||||
LOG(("ETHER_GET_LINK_STATE"));
|
||||
|
||||
state.media = (data->link ? IFM_ACTIVE : 0) | IFM_ETHER
|
||||
| (data->full_duplex ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX)
|
||||
| (data->speed == LINK_SPEED_100_MBIT ? IFM_100_TX : IFM_10_T);
|
||||
state.speed = data->speed == LINK_SPEED_100_MBIT ? 100000000 : 10000;
|
||||
state.quality = 1000;
|
||||
|
||||
return user_memcpy(arg, &state, sizeof(ether_link_state_t));
|
||||
}
|
||||
|
||||
case ETHER_ADDMULTI:
|
||||
LOG(("ETHER_ADDMULTI\n"));
|
||||
break;
|
||||
|
||||
@@ -615,16 +615,19 @@ void
|
||||
wb_set_mode(wb_device *info, int mode)
|
||||
{
|
||||
uint32 cfgAddress = (uint32)info->reg_base + WB_NETCFG;
|
||||
int32 speed = mode & LINK_SPEED_MASK;
|
||||
|
||||
uint32 configFlags = 0;
|
||||
status_t status;
|
||||
|
||||
info->speed = mode & LINK_SPEED_MASK;
|
||||
info->full_duplex = mode & LINK_DUPLEX_MASK;
|
||||
|
||||
status = wb_stop(info);
|
||||
|
||||
if ((mode & LINK_DUPLEX_MASK) == LINK_FULL_DUPLEX)
|
||||
configFlags |= WB_NETCFG_FULLDUPLEX;
|
||||
|
||||
if (speed == LINK_SPEED_100_MBIT)
|
||||
if (info->speed == LINK_SPEED_100_MBIT)
|
||||
configFlags |= WB_NETCFG_100MBPS;
|
||||
|
||||
write32(cfgAddress, configFlags);
|
||||
|
||||
@@ -367,6 +367,8 @@ struct wb_device {
|
||||
uint16 phy;
|
||||
bool autoNegotiationComplete;
|
||||
bool link;
|
||||
bool full_duplex;
|
||||
uint16 speed;
|
||||
uint16 fixedMode;
|
||||
|
||||
volatile int32 blockFlag;
|
||||
|
||||
Reference in New Issue
Block a user