Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I get the MAC address using vxWorks API?

1,979 views
Skip to first unread message

Anil Dadlani

unread,
Feb 26, 2001, 11:24:20 AM2/26/01
to
> Hi,
>
> I need to read the MAC address of a Ethernet chip. How do I get this
using
> vxWorks APIs?
> We do have a lower level BSP API which stores this 6 byte address into the
> driver control structure (etherEndDevice)
> I found:
> ifunit ("ln0") function which returns the ifnet structure. Which field
has
> the MAC address?
>
>
> Thanks
>
> Anil
>
>

Newbie

unread,
Feb 26, 2001, 1:31:16 PM2/26/01
to
Hi Anil,

I believe (struct arpcom *) ifPtr)->ac_enaddr is the Mac address you wants (it
has 6 bytes), ifPtr = ifunit("ln0").

Jim Way

unread,
Feb 26, 2001, 1:59:40 PM2/26/01
to
Here's how I do it:

UINT8 macBuffer[8];
sysCpmEnetAddrGet(0, macBuffer);
MacAddr = nlprintf("0x%02X%02X%02X%02X%02X%02X",
macBuffer[0],
macBuffer[1],
macBuffer[2],
macBuffer[3],
macBuffer[4],
macBuffer[5]);

Jim
-----------------------------------------
Jim Way, Software Engineer
Datum Austin (Austron Inc.)
voice: 512.721.4170
fax : 512.990.9712
email: jwayATdatumDOTcom (no spam please)
-----------------------------------------
vxWorks Tornado II

Brown, Matthew

unread,
Feb 28, 2001, 10:47:04 AM2/28/01
to
VxWorks
I couldn't find any kind of direct call in the vxWorks API to get it, so I
used the arpcom struct. Use a memcpy and copy the MAC from the ac_enaddr
into a 6 byte buffer.

Something like this :

char macAddr [6];
pIf = ifunit ("ln0");
struct arpcom *pArpcom;
pArpcom = (struct arpcom*) pIf;
memcpy (macaddr, (pArpcom->ac_ecaddr),6);


==========================
Matt Brown
Lockheed Martin - Software
Baltimore, MD

> ----------
> From: vxwe...@lbl.gov[SMTP:vxwe...@lbl.gov]
> Sent: Monday, February 26, 2001 11:32 AM
> To: vxwork...@csg.lbl.gov
> Subject: How do I get the MAC address using vxWorks API?
>
> Submitted-by vxwexp...@csg.lbl.gov Mon Feb 26 08:26:07 2001
> Submitted-by: "Anil Dadlani" <anil.d...@c-cube.com>


>
> > Hi,
> >
> > I need to read the MAC address of a Ethernet chip. How do I get this
> using
> > vxWorks APIs?
> > We do have a lower level BSP API which stores this 6 byte address into
> the
> > driver control structure (etherEndDevice)
> > I found:
> > ifunit ("ln0") function which returns the ifnet structure. Which field
> has
> > the MAC address?
> >
> >
> > Thanks
> >
> > Anil
> >
> >
>
>

> **********
>
>

Baris Dundar

unread,
Feb 28, 2001, 12:01:11 PM2/28/01
to
Matthew,

"Brown, Matthew" wrote:
>
> I couldn't find any kind of direct call in the vxWorks API to get it

Actually there is one if you are using MUX:

char mData[6];
muxIoctl(pCookie, EIOCGADDR, mData);

will return the MAC address in mData.

Baris

davew...@gmail.com

unread,
Feb 23, 2015, 11:12:35 AM2/23/15
to
On Monday, February 26, 2001 at 12:21:36 PM UTC-5, Anil Dadlani wrote:
> > Hi,
> >
> > I need to read the MAC address of a Ethernet chip. How do I get this
> using
> > vxWorks APIs?

I use the muxIoctl approach as well. To get the cookie, use muxTkCookieGet and pass the device name and unit.

muxCookie = muxTkCookieGet ("gem", 1);
status = muxIoctl (muxCookie, EIOCGADDR, (void*) macData);

dshi...@gmail.com

unread,
Apr 2, 2020, 8:17:26 PM4/2/20
to
Thank you man!! :) works like a charm.
0 new messages