All Forums
 Microsoft Windows CE
 CE Sample Applications and Utilities
 SetMacAddress.exe
 Forum Locked  Topic Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

ctacke

877 Posts

Posted - 16 Dec 2004 :  15:45:42  Show Profile  Email Poster
SetMacAddress.exe

SetMacAddress.exe is a sample program that shows how to program the MAC address of the SMSC 91C111 ethernet chip on ADS PXA255 based devices.

USAGE

There are three ways to use SetMacAddress: Command line, ADSLOAD.MAC file, or interactively.

  1. Command Line:
    Example: setmacaddress 11-22-33-44-55-66
    If a valid MAC address is provided on the command line in the form shown above, it will be written to the chip. If an invalid parameter is given, the program will exit and print an error message on the debug port.

  2. ADSLOAD.MAC:
    If no command line parameter is given, SetMacAddress will look for the file "ADSLOAD.MAC" in the current directory. If it is found, the next MAC address, as well as the lower and upper bound addresses will be read from the file. If the MAC address is valid and within the given constraints, it will be written to the chip, If an error occurs, the program will terminate and print an error message on the debug port. Otherwise, the current MAC address will be incremented by one and written back to the chip as the next MAC address to write.

    File format:

    11-22-33-00-cc-50
    11-22-33-00-aa-00
    11-22-33-00-ff-ff

    Line 1 contains the next MAC address to be assigned.
    Line 2 contains the lower bound of the range of valid MAC addresses.
    Line 3 contains the upper bound of the range of valid MAC addresses.

  3. Interactive:
    If no command line parameter is given and ADSLOAD.MAC cannot be found, SetMacAddress will prompt the user to enter a MAC address. Once a valid MAC address has been entered, the user will have the option of writing it to the chip or quitting without writing.

Key APIs Used


Virtual Alloc
VirtualFree
_wfopen
fgets

Lines of Code: ~200


Source Download
Rev 1 - {Dec 16, 2004} (18k zip).
  Topic  
 Forum Locked  Topic Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.02 seconds. Snitz Forums 2000