1 /*---------------------------------------------------------------------------*
2   Project:  RevolutionSDK Extension - netdemo
3   File:     macaddr.c
4 
5   Copyright 2007 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   Company Ltd., and are protected by Federal copyright law.  They may
14   not be disclosed to third parties or copied or duplicated in any form,
15   in whole or in part, without the prior written consent of Nintendo.
16 
17   $Log: macaddr.c,v $
18   Revision 1.1  2007/01/31 02:57:20  okubata_ryoma
19   Moved from ncdmiscdemo
20 
21 
22   $NoKeywords: $
23  *---------------------------------------------------------------------------*/
24 #include <demo.h>
25 #include <revolution/net.h>
26 #include <string.h>
27 
28 #define RESULT_SUCCESS      0
29 
30 //
31 //  Sample code to get mac address in wireless connection hardware
32 //
main(void)33 void main(void)
34 {
35     s32  ret;
36 
37     // mac address in wireless connection hardware
38     u8   wl_mac[NET_MACADDRESS_LENGTH]; // 6 bytes
39 
40     OSInit();
41     VIInit();
42 
43     for (;;)
44     {
45         ret = NETGetWirelessMacAddress(wl_mac);
46 
47         if(ret >= RESULT_SUCCESS)
48         {
49             // OK!! go ahead.
50             goto signal_green;
51         }
52         else
53         {
54             // error!!
55             OSHalt("Error!!");
56             break;
57         }
58 
59         // wait a moment or do other jobs
60         VIWaitForRetrace();
61     }
62 signal_green:
63 
64     OSReport("Wireless hardware mac address = %02x:%02x:%02x:%02x:%02x:%02x\n",
65              wl_mac[0],wl_mac[1],wl_mac[2],wl_mac[3],wl_mac[4],wl_mac[5]);
66 
67     while (1)
68     {
69         VIWaitForRetrace();
70     }
71 }
72