Transfer Ethernet frames by WiFi module. More...
Functions | |
int32_t | ARM_WIFI_BypassControl (uint32_t interface, uint32_t mode) |
Enable or disable bypass (pass-through) mode. Transmit and receive Ethernet frames (IP layer bypassed and WiFi/Ethernet translation). | |
int32_t | ARM_WIFI_EthSendFrame (uint32_t interface, const uint8_t *frame, uint32_t len) |
Send Ethernet frame (in bypass mode only). | |
int32_t | ARM_WIFI_EthReadFrame (uint32_t interface, uint8_t *frame, uint32_t len) |
Read data of received Ethernet frame (in bypass mode only). | |
uint32_t | ARM_WIFI_EthGetRxFrameSize (uint32_t interface) |
Get size of received Ethernet frame (in bypass mode only). | |
Transfer Ethernet frames by WiFi module.
The WiFi Bypass Mode functions are an optional interface and enable the transmission of Ethernet frames with WiFi modules. The use of this interface requires that the TCP/IP stack is running on the microcontroller (usually a third-party or open-source networking component). The internal TCP/IP stack of the WiFi module is therefore not used, and this usually means that the WiFi Socket functions can not be used.
int32_t ARM_WIFI_BypassControl | ( | uint32_t | interface, |
uint32_t | mode | ||
) |
Enable or disable bypass (pass-through) mode. Transmit and receive Ethernet frames (IP layer bypassed and WiFi/Ethernet translation).
[in] | interface | Interface (0 = Station, 1 = Access Point) |
[in] | mode |
|
The function ARM_WIFI_BypassControl enables or disables the WiFi bypass mode.
The WiFi Bypass mode can only be enabled, if there is a bypass mode supported in the WiFi driver. You can check this by checking the driver's capabilities.
The argument mode specifies the desired state of the WiFi Bypass mode, which is enabled or disabled.
Example:
int32_t ARM_WIFI_EthSendFrame | ( | uint32_t | interface, |
const uint8_t * | frame, | ||
uint32_t | len | ||
) |
Send Ethernet frame (in bypass mode only).
[in] | interface | Interface (0 = Station, 1 = Access Point) |
[in] | frame | Pointer to frame buffer with data to send |
[in] | len | Frame buffer length in bytes |
The function ARM_WIFI_EthSendFrame writes an Ethernet frame to the WiFi transmit buffer.
The WiFi bypass mode must be enabled by using the function ARM_WIFI_BypassControl before a call to this function.
The frame data addressed by frame starts with MAC destination and ends with the last Payload data byte. The frame data is copied into the transmit buffer of the WiFi interface.
The maximum value for len is implied by the size restrictions of the Ethernet frame but is not verified. Using an invalid value for len may generate unpredicted results.
Example:
int32_t ARM_WIFI_EthReadFrame | ( | uint32_t | interface, |
uint8_t * | frame, | ||
uint32_t | len | ||
) |
Read data of received Ethernet frame (in bypass mode only).
[in] | interface | Interface (0 = Station, 1 = Access Point) |
[in] | frame | Pointer to frame buffer for data to read into |
[in] | len | Frame buffer length in bytes |
The function ARM_WIFI_EthReadFrame reads an Ethernet frame from the WiFi interface in the bypass mode.
The len of the Ethernet frame can be checked using the function ARM_WIFI_EthGetRxFrameSize.
The frame data addressed by frame starts with MAC destination and ends with the last Payload data byte. The frame data is read from the receive buffer of the WiFi interface and the number of bytes written into the memory addressed by frame is returned. A negative return value indicates an error whereby the status code is defined with driver common return codes.
The function ARM_WIFI_EthReadFrame may be called with buf = NULL and len = 0 to discard or release a frame. This is useful when an incorrect frame has been received or no memory is available to hold the Ethernet frame.
Example:
uint32_t ARM_WIFI_EthGetRxFrameSize | ( | uint32_t | interface | ) |
Get size of received Ethernet frame (in bypass mode only).
[in] | interface | Interface (0 = Station, 1 = Access Point) |
The function ARM_WIFI_EthGetRxFrameSize returns the size of a received Ethernet frame in the bypass mode. This function can be called before ARM_WIFI_EthReadFrame and retrieves the value len.
The frame size includes MAC destination and ends with the last Payload data byte. Value 0 indicates that no Ethernet frame is available in the receive buffer. Values smaller than minimum size of Ethernet frame or larger than maximum size of Ethernet frame indicate an invalid frame which needs to be discarded by calling ARM_WIFI_EthReadFrame.
Example: