DSWifi
|
Macros | |
#define | INIT_ONLY false |
Init library only, don't try to connect to AP. Used by Wifi_InitDefault(). | |
#define | WFC_CONNECT true |
Init library and try to connect to firmware AP. Used by Wifi_InitDefault(). | |
Typedefs | |
typedef void(* | WifiSyncHandler) (void) |
Wifi Sync Handler function. | |
Enumerations | |
enum | WIFIGETDATA { WIFIGETDATA_MACADDRESS , WIFIGETDATA_NUMWFCAPS , WIFIGETDATA_RSSI , MAX_WIFIGETDATA } |
User code uses members of the WIFIGETDATA structure in calling Wifi_GetData() to retreive miscellaneous odd information. More... | |
Functions | |
int | Wifi_CheckInit (void) |
Verifies when the ARM7 has been successfully initialized. | |
void | Wifi_DisableWifi (void) |
Instructs the ARM7 to disengage wireless and stop receiving or transmitting. | |
void | Wifi_EnableWifi (void) |
Instructs the ARM7 to go into a basic "active" mode. | |
int | Wifi_GetData (int datatype, int bufferlen, unsigned char *buffer) |
Retrieve an arbitrary or misc. piece of data from the WiFi hardware. | |
u32 | Wifi_GetStats (int statnum) |
Retreive an element of the WiFi statistics gathered. | |
void | Wifi_IdleMode (void) |
Sets the WiFI hardware in "active" mode. | |
u32 | Wifi_Init (int initflags) |
Initializes the WiFi library (ARM9 side) and the sgIP library. | |
bool | Wifi_InitDefault (bool useFirmwareSettings) |
Initializes WiFi library. | |
bool | Wifi_LibraryModeReady (void) |
Checks whether a library mode change has finished or not. | |
void | Wifi_SetChannel (int channel) |
If the WiFi system is not connected or connecting to an access point, instruct the chipset to change channel. | |
void | Wifi_SetPromiscuousMode (int enable) |
Allows the DS to enter or leave a "promsicuous" mode. | |
void | Wifi_SetSyncHandler (WifiSyncHandler sh) |
Call this function to request notification of when the ARM7-side Wifi_Sync() function should be called. | |
void | Wifi_Sync (void) |
Call this function when requested to sync by the ARM7 side of the WiFi lib. | |
void | Wifi_Timer (int num_ms) |
This function should be called in a periodic interrupt. | |
void | Wifi_Update (void) |
Checks for new data from the ARM7 and initiates routing if data is available. | |
typedef void(* WifiSyncHandler) (void) |
Wifi Sync Handler function.
Callback function that is called when the ARM7 needs to be told to synchronize with new fifo data. If this callback is used (see Wifi_SetSyncHandler()), it should send a message via the fifo to the ARM7, which will call Wifi_Sync() on ARM7.
enum WIFIGETDATA |
User code uses members of the WIFIGETDATA structure in calling Wifi_GetData() to retreive miscellaneous odd information.
int Wifi_CheckInit | ( | void | ) |
Verifies when the ARM7 has been successfully initialized.
void Wifi_EnableWifi | ( | void | ) |
Instructs the ARM7 to go into a basic "active" mode.
The hardware is powered on, but not associated or doing anything useful. It can still receive and transmit packets.
int Wifi_GetData | ( | int | datatype, |
int | bufferlen, | ||
unsigned char * | buffer | ||
) |
Retrieve an arbitrary or misc. piece of data from the WiFi hardware.
See the WIFIGETDATA enum.
datatype | Element from the WIFIGETDATA enum specifing what kind of data to get. |
bufferlen | Length of the buffer to copy data to (not always used) |
buffer | Buffer to copy element data to (not always used) |
u32 Wifi_GetStats | ( | int | statnum | ) |
Retreive an element of the WiFi statistics gathered.
statnum | Element from the WIFI_STATS enum, indicating what statistic to return. |
void Wifi_IdleMode | ( | void | ) |
Sets the WiFI hardware in "active" mode.
The hardware is powered on, but not associated or doing anything useful. It can still receive and transmit packets.
u32 Wifi_Init | ( | int | initflags | ) |
Initializes the WiFi library (ARM9 side) and the sgIP library.
initflags | Set up some optional things, like controlling the LED blinking (WIFIINIT_OPTION_USELED) and the size of the sgIP heap (WIFIINIT_OPTION_USEHEAP_xxx). |
bool Wifi_InitDefault | ( | bool | useFirmwareSettings | ) |
Initializes WiFi library.
It initializes the WiFi hardware, sets up a FIFO handler to communicate with the ARM7 side of the library, and it sets up timer 3 to be used by the DSWifi. It will start in Internet mode.
useFirmwareSettings | If true, this function will initialize the hardware and try to connect to the Access Points stored in the firmware. If false, it will only initialize the library. You can use WFC_CONNECT and INIT_ONLY. |
bool Wifi_LibraryModeReady | ( | void | ) |
Checks whether a library mode change has finished or not.
Use this function after calling Wifi_MultiplayerHostMode(), Wifi_MultiplayerClientMode() or Wifi_InternetMode() to verify that the library is ready.
void Wifi_SetChannel | ( | int | channel | ) |
If the WiFi system is not connected or connecting to an access point, instruct the chipset to change channel.
The WiFi system must be in "active" mode for this to work as expected. If it is in scanning mode, it will change channel automatically every second or so.
channel | The channel to change to, in the range of 1-13. |
void Wifi_SetPromiscuousMode | ( | int | enable | ) |
Allows the DS to enter or leave a "promsicuous" mode.
In this mode all data that can be received is forwarded to the ARM9 for user processing. Best used with Wifi_RawSetPacketHandler, to allow user code to use the data (well, the lib won't use 'em, so they're just wasting CPU otherwise.)
enable | 0 to disable promiscuous mode, nonzero to engage. |
void Wifi_SetSyncHandler | ( | WifiSyncHandler | sh | ) |
Call this function to request notification of when the ARM7-side Wifi_Sync() function should be called.
sh | Pointer to the function to be called for notification. |
void Wifi_Timer | ( | int | num_ms | ) |
This function should be called in a periodic interrupt.
It serves as the basis for all updating in the sgIP library, all retransmits, timeouts, and etc are based on this function being called. It's not timing critical but it is rather essential.
num_ms | The number of milliseconds since the last time this function was called. |