DSWifi
Loading...
Searching...
No Matches
Typedefs | Functions
Raw transfer/reception of packets.

Typedefs

typedef void(* WifiPacketHandler) (int, int)
 Handler of RAW packets received in this console.
 

Functions

void Wifi_RawSetPacketHandler (WifiPacketHandler wphfunc)
 Set a handler to process all raw incoming packets.
 
int Wifi_RawTxFrame (size_t data_size, u16 rate, const void *data_src)
 Send a raw 802.11 frame at a specified rate.
 
void Wifi_RxRawReadPacket (u32 address, u32 size, void *dst)
 Allows user code to read a packet from inside a WifiPacketHandler function.
 
const void * Wifi_RxRawReadPacketPointer (u32 address)
 Returns a pointer to read a packet from inside a WifiPacketHandler function.
 

Detailed Description

Typedef Documentation

◆ WifiPacketHandler

typedef void(* WifiPacketHandler) (int, int)

Handler of RAW packets received in this console.

The first parameter is the packet address. It is only valid while the called function is executing. The second parameter is packet length.

Call Wifi_RxRawReadPacket(address, length, buffer) while in the packet handler function to retreive the data to a local buffer.

From this handler The IEEE 802.11 header can be read, followed by the packet data.

Function Documentation

◆ Wifi_RawSetPacketHandler()

void Wifi_RawSetPacketHandler ( WifiPacketHandler  wphfunc)

Set a handler to process all raw incoming packets.

Parameters
wphfuncPointer to packet handler (see WifiPacketHandler for info).

◆ Wifi_RawTxFrame()

int Wifi_RawTxFrame ( size_t  data_size,
u16  rate,
const void *  data_src 
)

Send a raw 802.11 frame at a specified rate.

Warning
This function doesn't include the IEEE 802.11 frame header to your data, you need to make sure that your data is prefixed by a valid header before calling this function.
Parameters
data_sizeThe length in bytes of the frame to send from beginning of 802.11 header to end, but not including CRC.
rateThe rate to transmit at (WIFI_TRANSFER_RATE_1MBPS or WIFI_TRANSFER_RATE_2MBPS).
data_srcPointer to the data to send (should be halfword-aligned).
Returns
0 on success (not enough space in queue), -1 on error.

◆ Wifi_RxRawReadPacket()

void Wifi_RxRawReadPacket ( u32  address,
u32  size,
void *  dst 
)

Allows user code to read a packet from inside a WifiPacketHandler function.

You can also get a pointer to the data with Wifi_RxRawReadPacketPointer(). It's a pointer to uncached RAM, so using that function may not be as fast as copying the packet information to the stack with Wifi_RxRawReadPacket().

Parameters
addressThe base address of the packet in the internal buffer.
sizeNumber of bytes to read.
dstLocation for the data to be read into.

◆ Wifi_RxRawReadPacketPointer()

const void * Wifi_RxRawReadPacketPointer ( u32  address)

Returns a pointer to read a packet from inside a WifiPacketHandler function.

The returned pointer points to uncached RAM. Reading from this pointer can be slower than using Wifi_RxRawReadPacket() to copy the packet to a buffer in the stack, for example.

Warning
Don't convert this uncached pointer to a cached pointer. DSWiFi assumes that the buffer never requires cache management. Accessing this memory from a cached mirror can cause corruption when the cached data is written back to RAM without DSWiFi knowing about it.
Parameters
addressThe base address of the packet in the internal buffer.
Returns
It returns a pointer that can be used to access the data.