DSWifi
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
General state of the library.

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.
 

Detailed Description

Typedef Documentation

◆ WifiSyncHandler

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.

Enumeration Type Documentation

◆ WIFIGETDATA

User code uses members of the WIFIGETDATA structure in calling Wifi_GetData() to retreive miscellaneous odd information.

Enumerator
WIFIGETDATA_MACADDRESS 

MACADDRESS: returns data in the buffer, requires at least 6 bytes.

WIFIGETDATA_NUMWFCAPS 

NUM WFC APS: returns number between 0 and 3, doesn't use buffer.

WIFIGETDATA_RSSI 

RSSI: returns number between 0 and 255, doesn't use buffer.

Function Documentation

◆ Wifi_CheckInit()

int Wifi_CheckInit ( void  )

Verifies when the ARM7 has been successfully initialized.

Returns
1 if the ARM7 is ready for WiFi, 0 otherwise

◆ Wifi_EnableWifi()

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.

◆ Wifi_GetData()

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.

Parameters
datatypeElement from the WIFIGETDATA enum specifing what kind of data to get.
bufferlenLength of the buffer to copy data to (not always used)
bufferBuffer to copy element data to (not always used)
Returns
-1 for failure, the number of bytes written to the buffer, or the value requested if the buffer isn't used.

◆ Wifi_GetStats()

u32 Wifi_GetStats ( int  statnum)

Retreive an element of the WiFi statistics gathered.

Parameters
statnumElement from the WIFI_STATS enum, indicating what statistic to return.
Returns
The requested stat, or 0 for failure.

◆ Wifi_IdleMode()

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.

◆ Wifi_Init()

u32 Wifi_Init ( int  initflags)

Initializes the WiFi library (ARM9 side) and the sgIP library.

Warning
This function requires some manual handling of the returned value to fully initialize the library. Use Wifi_InitDefault(INIT_ONLY) instead.
Parameters
initflagsSet up some optional things, like controlling the LED blinking (WIFIINIT_OPTION_USELED) and the size of the sgIP heap (WIFIINIT_OPTION_USEHEAP_xxx).
Returns
A 32bit value that must be passed to the ARM7 side of the library.

◆ Wifi_InitDefault()

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.

Parameters
useFirmwareSettingsIf 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.
Returns
It returns true on success, false on failure.

◆ Wifi_LibraryModeReady()

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.

Returns
It returns true if the mode change has finished, false otherwise.

◆ Wifi_SetChannel()

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.

Parameters
channelThe channel to change to, in the range of 1-13.

◆ Wifi_SetPromiscuousMode()

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.)

Parameters
enable0 to disable promiscuous mode, nonzero to engage.

◆ Wifi_SetSyncHandler()

void Wifi_SetSyncHandler ( WifiSyncHandler  sh)

Call this function to request notification of when the ARM7-side Wifi_Sync() function should be called.

Parameters
shPointer to the function to be called for notification.

◆ Wifi_Timer()

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.

Parameters
num_msThe number of milliseconds since the last time this function was called.