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