1 /*---------------------------------------------------------------------------* 2 Project: NCD library 3 File: ncd.h 4 5 Copyright 2006 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 $Log: ncd.h,v $ 14 Revision 1.14 2008/01/22 09:28:15 seiki_masashi 15 Added the NCDHasEnabledNetworkConfig function. 16 17 Revision 1.13 2006/10/23 02:57:33 seiki_masashi 18 Added NCDRestoreConfig function. 19 20 Revision 1.12 2006/09/08 11:59:37 seiki_masashi 21 Added NCDGetCurrentConfig(). 22 23 Revision 1.11 2006/08/24 08:21:15 yasu 24 Split up functions for getting wireless MAC addresses in the console. 25 26 Revision 1.10 2006/08/10 08:11:22 yasu 27 Created nwc24cntl.h 28 29 Revision 1.9 2006/08/09 03:45:09 terui 30 Added the function NCDIsInterfaceDecided 31 32 Revision 1.8 2006/08/09 00:34:02 yasu 33 Added OSSleep* 34 35 Revision 1.7 2006/07/29 04:19:19 terui 36 Added the NCDSetNwc24Permission function definition 37 38 Revision 1.6 2006/07/24 04:42:20 terui 39 Moved the NCDLockWirelessDriver and NCDUnlockWirelessDriver prototype definitions from NCDPrivate.h 40 41 Revision 1.5 2006/07/22 11:53:22 terui 42 Deleted prototype declarations in step with the change of some of the APIs to private status 43 Added prototype declarations in step with the addition of a number of APIs 44 45 Revision 1.4 2006/06/26 09:19:06 terui 46 Added NCDSleep function prototype. 47 48 Revision 1.3 2006/06/16 07:37:57 terui 49 Revised code in line with changes to the network config definition header 50 51 Revision 1.2 2006/06/14 11:18:59 terui 52 Added NCDGetLinkStatus function definition. 53 Added NCDGetWirelessMacAddress function definition. 54 55 Revision 1.1 2006/05/30 07:06:01 terui 56 Initial upload. 57 58 59 $NoKeywords: $ 60 *---------------------------------------------------------------------------*/ 61 62 #ifndef REVOLUTION_NCD_H__ 63 #define REVOLUTION_NCD_H__ 64 65 #include <revolution/types.h> 66 #include <revolution/os.h> 67 #include <revolution/ncd/NCDConst.h> 68 #include <revolution/ncd/NCDTypes.h> 69 #include <revolution/ncd/NCDMisc.h> 70 71 #ifdef __cplusplus 72 extern "C" { 73 #endif 74 /*===========================================================================*/ 75 76 /*---------------------------------------------------------------------------* 77 Name : NCDReadConfig 78 Description : Load network configuration from NAND. 79 Arguments : config - Specifies the buffer for storing the information to be read. 80 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 81 *---------------------------------------------------------------------------*/ 82 s32 NCDReadConfig( NCDConfig* config ); 83 84 /*---------------------------------------------------------------------------* 85 Name : NCDWriteConfig 86 Description : Writes the network configuration to NAND. 87 Arguments : config - Specifies the buffer for storing the information to be written. 88 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 89 *---------------------------------------------------------------------------*/ 90 s32 NCDWriteConfig( const NCDConfig* config ); 91 92 /*---------------------------------------------------------------------------* 93 Name : NCDRestoreConfig 94 Description : Restores the current network setting to the value stored in NAND. 95 Arguments : None. 96 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 97 *---------------------------------------------------------------------------*/ 98 s32 NCDRestoreConfig( void ); 99 100 /*---------------------------------------------------------------------------* 101 Name : NCDGetLinkStatus 102 Description : Gets the current state within automatic state transition of the NCD. 103 Arguments : None. 104 Returns : s32 - Returns the state ID if the state was successfully gotten. 105 Returns a negative number if get failed. 106 *---------------------------------------------------------------------------*/ 107 s32 NCDGetLinkStatus( void ); 108 109 /*---------------------------------------------------------------------------* 110 Name : NCDIsInterfaceDecided 111 Description : Checks whether preparations have been made for the network interface to be established and communicate with the NCD automatic state transition. 112 113 Arguments : None. 114 Returns : BOOL - Returns TRUE if network interface has been established. 115 Returns FALSE if the network interface has not been established or if the function failed. 116 117 *---------------------------------------------------------------------------*/ 118 BOOL NCDIsInterfaceDecided( void ); 119 120 /*---------------------------------------------------------------------------* 121 Name : NCDLockWirelessDriver 122 Description : Gets wireless driver usage rights and exclusively locks the driver. 123 Arguments : None. 124 Returns : s32 - Returns the usage rights ID if successfully gotten. 125 Returns a negative number if get failed. 126 *---------------------------------------------------------------------------*/ 127 s32 NCDLockWirelessDriver( void ); 128 129 /*---------------------------------------------------------------------------* 130 Name : NCDUnlockWirelessDriver 131 Description : Releases the exclusive lock on the wireless driver and destroys the usage rights. 132 Arguments : lockId - Specifies the usage rights ID gotten when the driver was exclusively locked 133 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 134 *---------------------------------------------------------------------------*/ 135 s32 NCDUnlockWirelessDriver( s32 lockId ); 136 137 /*---------------------------------------------------------------------------* 138 Name : NCDSleep 139 Description : Puts the thread into sleep mode for the specified length of time. 140 Arguments : tick - Specifies the amount of time to sleep as an OSTime type variable. 141 Returns : None. 142 *---------------------------------------------------------------------------*/ 143 void NCDSleep( OSTime tick ); 144 #ifndef OSSleepSeconds 145 void OSSleepTicks( OSTime ticks ); 146 #define OSSleepSeconds( sec ) OSSleepTicks( OSSecondsToTicks(sec) ) 147 #define OSSleepMilliseconds( msec ) OSSleepTicks( OSMillisecondsToTicks(msec) ) 148 #define OSSleepMicroseconds( usec ) OSSleepTicks( OSMicrosecondsToTicks(usec) ) 149 #define OSSleepNanoseconds( nsec ) OSSleepTicks( OSNanosecondsToTicks(nsec) ) 150 #endif 151 152 /*---------------------------------------------------------------------------* 153 Name : NCDSetIfConfig 154 Description : Changes the settings relating to the network interface. 155 This does not get reflected in NAND. 156 Arguments : ifconfig - The pointer to the network interface settings structure. 157 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 158 *---------------------------------------------------------------------------*/ 159 s32 NCDSetIfConfig( const NCDIfConfig* ifconfig ); 160 161 /*---------------------------------------------------------------------------* 162 Name : NCDSetIpConfig 163 Description : Changes TCP/IP-related settings. 164 This does not get reflected in NAND. 165 Arguments : ifconfig - The pointer to the TCP/IP-related settings structure. 166 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 167 *---------------------------------------------------------------------------*/ 168 s32 NCDSetIpConfig( const NCDIpConfig* ipconfig ); 169 170 /*---------------------------------------------------------------------------* 171 Name : NCDGetCurrentConfig 172 Description : Gets the current network configuration. 173 Arguments : ifconfig - The pointer to the network interface settings structure. 174 ifconfig - The pointer to the TCP/IP-related settings structure. 175 profileIndex - Pointer to the address storing the profile number being used 176 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 177 *---------------------------------------------------------------------------*/ 178 s32 NCDGetCurrentConfig( NCDIfConfig* ifconfig, NCDIpConfig* ipconfig, 179 s32* profileIndex ); 180 181 /*---------------------------------------------------------------------------* 182 Name : NCDGetCurrentIfConfig 183 Description : Gets the network interface-related settings that are currently in use. 184 Arguments : ifconfig - The pointer to the network interface settings structure. 185 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 186 *---------------------------------------------------------------------------*/ 187 s32 NCDGetCurrentIfConfig( NCDIfConfig* ifconfig ); 188 189 /*---------------------------------------------------------------------------* 190 Name : NCDGetCurrentIpConfig 191 Description : Gets the TCP/IP-related settings that are currently in use. 192 Arguments : ifconfig - The pointer to the TCP/IP-related settings structure. 193 Returns : s32 - Returns the result of the processing. Returns a negative value if processing failed. 194 *---------------------------------------------------------------------------*/ 195 s32 NCDGetCurrentIpConfig( NCDIpConfig* ipconfig ); 196 197 /*---------------------------------------------------------------------------* 198 Name : NCDHasEnabledNetworkConfig 199 Description : Checks if currently enabled network settings exist. 200 Arguments : None. 201 Returns : BOOL - TRUE if it exists 202 *---------------------------------------------------------------------------*/ 203 BOOL NCDHasEnabledNetworkConfig( void ); 204 205 /*===========================================================================*/ 206 #ifdef __cplusplus 207 } 208 #endif 209 #endif /* REVOLUTION_NCD_H__ */ 210 211 /*---------------------------------------------------------------------------* 212 End of file 213 *---------------------------------------------------------------------------*/ 214