We have a enet driver for a LAN911x chip. This chip is nice, as it has
several low power mode states. We have no issues with run state and the
suspend state (NDIS D3), but I've been trying to use a NDIS D2 state. The
chip is being programmed to a power state that will automatically wake up if
it detects a connection. My goal is to have a application that polls for the
LAN connection, if none found, it tells NDIS to go into D2 state.

When I try using the API functions to set NDIS into D2, I can see that the
chip does this, but then right away comes out of it, even with no cable
connected. Almost as if I need to UnBind the adaptor to make sure nothing
tries to talk to the driver so as to not for a wakeup from the lower power
state. I can easily use the SetPowerState() and BIND/UNBIND APIs to totally
power and power up the chip, but I want it to wake on it's own, if a
connection is detected. (The chip handles the wake-up of D2 state to D0
state)

The sample NDIS Power driver and NDIS UI is nice to look at for an example,
but they don't use any of the other power states of NDIS, like D1 and D2.
Only off and on.

Has anyone had any luck with this type of scenario? It's a really nice
feature, if possible since Enet chips typically require a good amount of
power in an embedded device.

Thanks for any comments or suggestions.
-Mike

RE: NDIS power management - D2, D1 states by MikeA

MikeA
Wed Jul 09 16:44:00 PDT 2008

For more info, I'm using these steps to get into D3 and D0 NDIS power states:

//(D3 NDIS state translates to D4 of WinCE power manager state
SetDevicePower(TEXT("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\SMSC_LAN911X1"),POWER_NAME,D4);
UnBindIP(hWndOwner, TEXT("SMSC_LAN911X1"));

//and back to D
SetDevicePower(TEXT("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\SMSC_LAN911X1"),POWER_NAME,D0);
BindIP(hWndOwner, TEXT("SMSC_LAN911X1"));


This works great. In order to call into NDIS D2 state though, I use
something like this, which I can see puts it into a lower power state, for
about 2 seconds. I'm not including all the code here, I also make a call to
'IOCTL_NPW_SAVE_POWER_STATE' before calling set power. This is all right out
of the example public code.

ndis_power_state = NdisDeviceStateD2;
NdisUioSetOid.SetOid.Oid = OID_PNP_SET_POWER;
NdisUioSetOid.SetOid.ptcDeviceName = pszAdapter;//L"SMSC_LAN911X1";
memcpy(&NdisUioSetOid.SetOid.Data, &ndis_power_state,
sizeof(NDIS_DEVICE_POWER_STATE));

DeviceIoControl(
h, //from CreateFile on
NDISUIO_DEVICE_NAME
IOCTL_NDISUIO_SET_OID_VALUE,
&NdisUioSetOid,
sizeof(NdisUioSetOid),
NULL,
0,
&dwWritten,
NULL);

I'm not sure if I should 'unbind' after calling this, as I believe that
would not allow me to connect properly once the LAN connection was made.

Thanks,
-Mike


Re: NDIS power management - D2, D1 states by Bradley

Bradley
Wed Jul 09 17:39:35 PDT 2008

On Jul 9, 4:44 pm, MikeA <Mi...@discussions.microsoft.com> wrote:
> This works great. In order to call into NDIS D2 state though, I use
> something like this, which I can see puts it into a lower power state, for
> about 2 seconds.

Here are three things that I would check up on.

1. Is your driver being told to do a reset via NDIS?
2. Does the CheckForHang logic get called just before it wakes up?
Could this be the culprit?
3. Are there any calls going into your driver while the MAC is in it's
D2 state?

Brad.

Re: NDIS power management - D2, D1 states by MikeA

MikeA
Wed Jul 09 18:30:01 PDT 2008

Bradley,
Thanks for the response. I think you have good points here. My next goal
was to capture any debug info from the driver when in the D2 state, as I
think you are correct in that something is talking to the driver and forces a
wakeup of the chip.

Thanks,
-Mike