[comp.dcom.lans] Telling ENet cards apart

alawlor@dit.ie (Aengus Lawlor) (02/09/90)

Some time back, I asked for help in getting the Ethernet address from a board
(so that I could distinguish between boards, and load the correct driver)
The following is a Turbo Pascal (I can easily rewrite in C if anybody needs it)
program that distinguishes between WD8003E, 3C501, and DE-001 (NE-1000 clones).
The tests aren't foolproof and I would be happy to hear from people with ideas 
for improvingthe tests, or extending the boards it can test for.
The program sets the ERRORLEVEL, and a sample Batch job to test this is also
included

Aengus.
-----------------------------------------------------
{ Turbo Pascal 4.0 and above }
var
  i, j : integer;
  check : longint;

begin

  check := 0;
  for i:=$288 to $28f do             (* WD8003E EtherCard             *)
  begin                              (* Addr at locations $288 - $28D *)
    j := port[i];                    (* Type at $28E. C/Sum at $28F   *)
    check := check + j;
  end;
  if ((check mod 256) = $ff) and (port[$28e] = 3) then
  begin                              (* It's a WD8003E so             *)
    halt(3);
  end;

  check := 0;
  for i :=0 to 2 do                  (* 3C501 EtherCard               *)
  begin                              (* Get first 3 digits            *)
    port[$308] := i;
    j := port[$30C];
    check := check * 256 + j;
  end;                               (* all my 3C501's have addresses *)
  if check = $02608C then            (* of the form $02608CXXXXXX     *)
  begin                              (* It's a 3C501 so               *)
    halt(2);                         (* set ERRORLEVEL 2              *)
  end;
                                     (* D-link DE-001                 *)
{
  check := 0;
  port[$300] := $21;                 (* possible timing problems      *)
  port[$307] := $ff;                 (* this code is actually for a   *)
  port[$308] := $0;                  (* NE-1000. It sometimes works   *)
  port[$309] := $0;                  (* with a D-link, and sometimes  *)
  port[$30a] := $6;                  (* returns garbage.              *)
  port[$30b] := $0;                  (* For my own purposes, I assume *)
  port[$300] := $a;                  (* any card that fails the first *)
  for i:=1 to 6 do                   (* 2 tests is a D-Link           *)
  begin
    j := port[$310];
    check := check * 256 + j;
  end;
}
  halt(1)                            (* Not WD or 3C so it must be DL *)
end.

-----------------------------------------
{BATch file to use ETHTST.EXE}
@echo off
ethtst
if errorlevel 3 if not errorlevel 4 echo WD8003
if errorlevel 2 if not errorlevel 3 echo 3C501
if errorlevel 1 if not errorlevel 2 echo I suppose it must be a D-Link!

-- 
Aengus Lawlor    Dept of Computer Science.           Time flies like an arrow,
ALAWLOR@DIT.IE   Dublin Institute of Technology.     Fruit-flies like a banana
                 Kevin Street. Dublin 8. Ireland.   

alawlor@dit.ie (Aengus Lawlor) (02/20/90)

I posted this last week, but we had some failures here, so it may not have gone
out. Apologies if you have already seen it.

Some time back, I asked for help in getting the Ethernet address from a board
(so that I could distinguish between boards, and load the correct driver)
The following is a Turbo Pascal (I can easily rewrite in C if anybody needs it)
program that distinguishes between WD8003E, 3C501, and DE-001 (NE-1000 clones).
The tests aren't foolproof and I would be happy to hear from people with ideas 
for improvingthe tests, or extending the boards it can test for.
The program sets the ERRORLEVEL, and a sample Batch job to test this is also
included
Particular thanks to Mike Murphy  (mrm@Sceard.COM) (NE-1000 / D-Link)
and Doug McCallum (dougm@ICO.ISC.COM) (WD8003E)

Aengus.
-----------------------------------------------------
{ Turbo Pascal 4.0 and above }
var
  i, j : integer;
  check : longint;

begin

  check := 0;
  for i:=$288 to $28f do             (* WD8003E EtherCard             *)
  begin                              (* Addr at locations $288 - $28D *)
    j := port[i];                    (* Type at $28E. C/Sum at $28F   *)
    check := check + j;
  end;
  if ((check mod 256) = $ff) and (port[$28e] = 3) then
  begin                              (* It's a WD8003E so             *)
    halt(3);
  end;

  check := 0;
  for i :=0 to 2 do                  (* 3C501 EtherCard               *)
  begin                              (* Get first 3 digits            *)
    port[$308] := i;
    j := port[$30C];
    check := check * 256 + j;
  end;                               (* all my 3C501's have addresses *)
  if check = $02608C then            (* of the form $02608CXXXXXX     *)
  begin                              (* It's a 3C501 so               *)
    halt(2);                         (* set ERRORLEVEL 2              *)
  end;

{                                    (* D-link DE-001                 *)
  check := 0;
  port[$300] := $21;                 (* possible timing problems      *)
  port[$307] := $ff;                 (* this code is actually for a   *)
  port[$308] := $0;                  (* NE-1000. It sometimes works   *)
  port[$309] := $0;                  (* with a D-link, and sometimes  *)
  port[$30a] := $6;                  (* returns garbage.              *)
  port[$30b] := $0;                  (* For my own purposes, I assume *)
  port[$300] := $a;                  (* any card that fails the first *)
  for i:=1 to 6 do                   (* 2 tests is a D-Link           *)
  begin
    j := port[$310];
    check := check * 256 + j;
  end;
}
  halt(1)                            (* Not WD or 3C so it must be DL *)
end.

-----------------------------------------
{BATch file to use ETHTST.EXE}
@echo off
ethtst
if errorlevel 3 if not errorlevel 4 echo WD8003
if errorlevel 2 if not errorlevel 3 echo 3C501
if errorlevel 1 if not errorlevel 2 echo I suppose it must be a D-Link!

-- 
Aengus Lawlor    Dept of Computer Science.           Time flies like an arrow,
ALAWLOR@DIT.IE   Dublin Institute of Technology.     Fruit-flies like a banana
                 Kevin Street. Dublin 8. Ireland.   
-- 
Aengus Lawlor    Dept of Computer Science.           Time flies like an arrow,
ALAWLOR@DIT.IE   Dublin Institute of Technology.     Fruit-flies like a banana
                 Kevin Street. Dublin 8. Ireland.   

hood@col.hp.com (John Hood) (03/17/90)

/ col:comp.dcom.lans / alawlor@dit.ie (Aengus Lawlor) /  4:17 am  Feb 20, 1990 /
I posted this last week, but we had some failures here, so it may not have gone
out. Apologies if you have already seen it.

Some time back, I asked for help in getting the Ethernet address from a board
(so that I could distinguish between boards, and load the correct driver)
The following is a Turbo Pascal (I can easily rewrite in C if anybody needs it)
program that distinguishes between WD8003E, 3C501, and DE-001 (NE-1000 clones).
The tests aren't foolproof and I would be happy to hear from people with ideas 
for improvingthe tests, or extending the boards it can test for.
The program sets the ERRORLEVEL, and a sample Batch job to test this is also
included
Particular thanks to Mike Murphy  (mrm@Sceard.COM) (NE-1000 / D-Link)
and Doug McCallum (dougm@ICO.ISC.COM) (WD8003E)

Aengus.
-----------------------------------------------------
{ Turbo Pascal 4.0 and above }
var
  i, j : integer;
  check : longint;

begin

  check := 0;
  for i:=$288 to $28f do             (* WD8003E EtherCard             *)
  begin                              (* Addr at locations $288 - $28D *)
    j := port[i];                    (* Type at $28E. C/Sum at $28F   *)
    check := check + j;
  end;
  if ((check mod 256) = $ff) and (port[$28e] = 3) then
  begin                              (* It's a WD8003E so             *)
    halt(3);
  end;

  check := 0;
  for i :=0 to 2 do                  (* 3C501 EtherCard               *)
  begin                              (* Get first 3 digits            *)
    port[$308] := i;
    j := port[$30C];
    check := check * 256 + j;
  end;                               (* all my 3C501's have addresses *)
  if check = $02608C then            (* of the form $02608CXXXXXX     *)
  begin                              (* It's a 3C501 so               *)
    halt(2);                         (* set ERRORLEVEL 2              *)
  end;

{                                    (* D-link DE-001                 *)
  check := 0;
  port[$300] := $21;                 (* possible timing problems      *)
  port[$307] := $ff;                 (* this code is actually for a   *)
  port[$308] := $0;                  (* NE-1000. It sometimes works   *)
  port[$309] := $0;                  (* with a D-link, and sometimes  *)
  port[$30a] := $6;                  (* returns garbage.              *)
  port[$30b] := $0;                  (* For my own purposes, I assume *)
  port[$300] := $a;                  (* any card that fails the first *)
  for i:=1 to 6 do                   (* 2 tests is a D-Link           *)
  begin
    j := port[$310];
    check := check * 256 + j;
  end;
}
  halt(1)                            (* Not WD or 3C so it must be DL *)
end.

-----------------------------------------
{BATch file to use ETHTST.EXE}
@echo off
ethtst
if errorlevel 3 if not errorlevel 4 echo WD8003
if errorlevel 2 if not errorlevel 3 echo 3C501
if errorlevel 1 if not errorlevel 2 echo I suppose it must be a D-Link!

-- 
Aengus Lawlor    Dept of Computer Science.           Time flies like an arrow,
ALAWLOR@DIT.IE   Dublin Institute of Technology.     Fruit-flies like a banana
                 Kevin Street. Dublin 8. Ireland.   
-- 
Aengus Lawlor    Dept of Computer Science.           Time flies like an arrow,
ALAWLOR@DIT.IE   Dublin Institute of Technology.     Fruit-flies like a banana
                 Kevin Street. Dublin 8. Ireland.   
----------