mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
net/ & esp32/wlan: Fix some typos and nxstyle issues.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
committed by
Xiang Xiao
parent
c11413a258
commit
8e4397968c
@@ -698,7 +698,7 @@ static void esp32_ints_on(uint32_t mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp32_ints_on
|
* Name: esp32_ints_off
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Disable WiFi interrupt
|
* Disable WiFi interrupt
|
||||||
@@ -800,8 +800,8 @@ static void esp_spin_lock_delete(void *lock)
|
|||||||
* Name: esp_wifi_int_disable
|
* Name: esp_wifi_int_disable
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enter critical by disable interrup, and take spin lock if
|
* Enter critical section by disabling interrupts and taking the spin lock
|
||||||
* in SMP mode
|
* if in SMP mode.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* wifi_int_mux - Spin lock data pointer
|
* wifi_int_mux - Spin lock data pointer
|
||||||
@@ -828,8 +828,8 @@ static uint32_t IRAM_ATTR esp_wifi_int_disable(void *wifi_int_mux)
|
|||||||
* Name: esp_wifi_int_restore
|
* Name: esp_wifi_int_restore
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Exit from critical by enable interrup, and release spin
|
* Exit from critical section by enabling interrupts and releasing the spin
|
||||||
* lock if in SMP mode
|
* lock if in SMP mode.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* wifi_int_mux - Spin lock data pointer
|
* wifi_int_mux - Spin lock data pointer
|
||||||
@@ -1336,8 +1336,7 @@ static int32_t esp_queue_send_generic(void *queue, void *item,
|
|||||||
|
|
||||||
if (ticks == OSI_FUNCS_TIME_BLOCKING || ticks == 0)
|
if (ticks == OSI_FUNCS_TIME_BLOCKING || ticks == 0)
|
||||||
{
|
{
|
||||||
/**
|
/* WiFi interrupt function will call this adapter function to send
|
||||||
* WiFi interrupt function will call this adapter function to send
|
|
||||||
* message to message queue, so here we should call kernel API
|
* message to message queue, so here we should call kernel API
|
||||||
* instead of application API
|
* instead of application API
|
||||||
*/
|
*/
|
||||||
@@ -1446,7 +1445,7 @@ static int32_t esp_queue_send_to_back(void *queue, void *item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_queue_send_from_isr
|
* Name: esp_queue_send_from_to_front
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send message of high priority to queue within a certain period of time
|
* Send message of high priority to queue within a certain period of time
|
||||||
@@ -1808,7 +1807,7 @@ static void *esp_task_get_current_task(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_task_get_current_task
|
* Name: esp_task_get_max_priority
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get OS task maxium priority
|
* Get OS task maxium priority
|
||||||
@@ -1827,7 +1826,7 @@ static int32_t esp_task_get_max_priority(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_malloc_internal
|
* Name: esp_malloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a block of memory
|
* Allocate a block of memory
|
||||||
@@ -2107,7 +2106,7 @@ int32_t esp_event_post(esp_event_base_t event_base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_task_get_current_task
|
* Name: esp_get_free_heap_size
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get free heap size by byte
|
* Get free heap size by byte
|
||||||
@@ -3489,7 +3488,7 @@ static void *esp_zalloc_internal(size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_malloc_internal
|
* Name: esp_wifi_malloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Applications allocate a block of memory
|
* Applications allocate a block of memory
|
||||||
@@ -3508,7 +3507,7 @@ static void *esp_wifi_malloc(size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_realloc_internal
|
* Name: esp_wifi_realloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Applications allocate a block of memory by old memory block
|
* Applications allocate a block of memory by old memory block
|
||||||
@@ -3528,7 +3527,7 @@ static void *esp_wifi_realloc(void *ptr, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_calloc_internal
|
* Name: esp_wifi_calloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Applications allocate some continuous blocks of memory
|
* Applications allocate some continuous blocks of memory
|
||||||
@@ -3548,7 +3547,7 @@ static void *esp_wifi_calloc(size_t n, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_zalloc_internal
|
* Name: esp_wifi_zalloc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Applications allocate a block of memory and clear it with 0
|
* Applications allocate a block of memory and clear it with 0
|
||||||
@@ -4008,7 +4007,7 @@ int net80211_printf(const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Functions needed by libnet80211.a
|
* Functions needed by libmesh.a
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -53,8 +53,7 @@
|
|||||||
|
|
||||||
#define WLAN_STA_DEVNO (0)
|
#define WLAN_STA_DEVNO (0)
|
||||||
|
|
||||||
/**
|
/* TX poll delay = 1 seconds.
|
||||||
* TX poll delay = 1 seconds.
|
|
||||||
* CLK_TCK is the number of clock ticks per second
|
* CLK_TCK is the number of clock ticks per second
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -64,12 +63,11 @@
|
|||||||
|
|
||||||
#define WLAN_TXTOUT (60 * CLK_TCK)
|
#define WLAN_TXTOUT (60 * CLK_TCK)
|
||||||
|
|
||||||
/* Low-priority workqueue processes RX/TX */
|
/* Low-priority work queue processes RX/TX */
|
||||||
|
|
||||||
#define WLAN_WORK LPWORK
|
#define WLAN_WORK LPWORK
|
||||||
|
|
||||||
/**
|
/* Ethernet frame:
|
||||||
* Ethernet frame:
|
|
||||||
* Resource address : 6 bytes
|
* Resource address : 6 bytes
|
||||||
* Destination address: 6 bytes
|
* Destination address: 6 bytes
|
||||||
* Type : 2 bytes
|
* Type : 2 bytes
|
||||||
@@ -85,9 +83,8 @@
|
|||||||
|
|
||||||
#define WLAN_RXBUF_NUM (CONFIG_ESP32_WLAN_RXBUF_NUM)
|
#define WLAN_RXBUF_NUM (CONFIG_ESP32_WLAN_RXBUF_NUM)
|
||||||
|
|
||||||
/**
|
/* Receive threshold which allows the receive function to trigger a scheduler
|
||||||
* Receive threshold which let the receive function to trigger a sheduler
|
* to activate the application if possible.
|
||||||
* to active application if possible.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_IOB
|
#ifdef CONFIG_MM_IOB
|
||||||
@@ -137,7 +134,7 @@ struct wlan_priv_s
|
|||||||
|
|
||||||
uint8_t txbuf[WLAN_BUF_SIZE];
|
uint8_t txbuf[WLAN_BUF_SIZE];
|
||||||
|
|
||||||
/* Rest data in TX buffer which needs being sent */
|
/* Rest of the data in the TX buffer that need to be sent */
|
||||||
|
|
||||||
uint8_t txrst;
|
uint8_t txrst;
|
||||||
|
|
||||||
@@ -209,8 +206,7 @@ static int esp32_net_initialize(unsigned int devno);
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/**
|
/* Note:
|
||||||
* Note:
|
|
||||||
* All TX done/RX done/Error trigger functions are not called from
|
* All TX done/RX done/Error trigger functions are not called from
|
||||||
* interrupts, this is much different from ethernet driver, including:
|
* interrupts, this is much different from ethernet driver, including:
|
||||||
* * wlan_rx_done
|
* * wlan_rx_done
|
||||||
@@ -294,7 +290,7 @@ static inline struct wlan_rxbuf *wlan_alloc_buffer(struct wlan_priv_s *priv)
|
|||||||
* Function: wlan_free_buffer
|
* Function: wlan_free_buffer
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Insert a free Rx buffer into free queue
|
* Insert a free Rx buffer into the free queue
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* priv - Reference to the driver state structure
|
* priv - Reference to the driver state structure
|
||||||
@@ -323,8 +319,8 @@ static inline void wlan_free_buffer(struct wlan_priv_s *priv,
|
|||||||
* Name: wifi_tx_available
|
* Name: wifi_tx_available
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Check if WiFi can send data. This function will re-send rest data
|
* Check if WiFi can send data. This function will re-send the rest of the
|
||||||
* which was sent failed.
|
* data that we failed to send.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* priv - Reference to the driver state structure
|
* priv - Reference to the driver state structure
|
||||||
@@ -343,7 +339,7 @@ static bool wifi_tx_available(FAR struct wlan_priv_s *priv)
|
|||||||
ret = esp_wifi_sta_send_data(priv->txbuf, priv->txrst);
|
ret = esp_wifi_sta_send_data(priv->txbuf, priv->txrst);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
ninfo("ERROR: Failed to transmit rest frame\n");
|
ninfo("ERROR: Failed to transmit the rest of the frame\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+41
-21
@@ -167,20 +167,24 @@ static void devif_packet_conversion(FAR struct net_driver_s *dev,
|
|||||||
|
|
||||||
if (ipv6->proto == IP_PROTO_ICMP6)
|
if (ipv6->proto == IP_PROTO_ICMP6)
|
||||||
{
|
{
|
||||||
/* Let 6LoWPAN convert IPv6 ICMPv6 output into radio frames. */
|
/* Let 6LoWPAN convert IPv6 ICMPv6 output into radio
|
||||||
|
* frames.
|
||||||
|
*/
|
||||||
|
|
||||||
sixlowpan_icmpv6_send(dev, dev, ipv6);
|
sixlowpan_icmpv6_send(dev, dev, ipv6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nerr("ERROR: ICMPv6 protocol error: %u... Packet dropped\n",
|
nerr("ERROR: ICMPv6 protocol error: %u..."
|
||||||
|
" Packet dropped\n",
|
||||||
ipv6->proto);
|
ipv6->proto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
nerr("ERROR: Unhandled packet dropped. pkttype=%u protocol=%u\n",
|
nerr("ERROR: Unhandled packet dropped."
|
||||||
|
" pkttype=%u protocol=%u\n",
|
||||||
pkttype, ipv6->proto);
|
pkttype, ipv6->proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +216,9 @@ static int devif_poll_pkt_connections(FAR struct net_driver_s *dev,
|
|||||||
FAR struct pkt_conn_s *pkt_conn = NULL;
|
FAR struct pkt_conn_s *pkt_conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the allocated packet connections and perform the poll action */
|
/* Traverse all of the allocated packet connections and perform the poll
|
||||||
|
* action.
|
||||||
|
*/
|
||||||
|
|
||||||
while (!bstop && (pkt_conn = pkt_nextconn(pkt_conn)))
|
while (!bstop && (pkt_conn = pkt_nextconn(pkt_conn)))
|
||||||
{
|
{
|
||||||
@@ -290,7 +296,9 @@ static int devif_poll_bluetooth_connections(FAR struct net_driver_s *dev,
|
|||||||
FAR struct bluetooth_conn_s *bluetooth_conn = NULL;
|
FAR struct bluetooth_conn_s *bluetooth_conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the allocated packet connections and perform the poll action */
|
/* Traverse all of the allocated packet connections and perform the poll
|
||||||
|
* action.
|
||||||
|
*/
|
||||||
|
|
||||||
while (!bstop && (bluetooth_conn = bluetooth_conn_next(bluetooth_conn)))
|
while (!bstop && (bluetooth_conn = bluetooth_conn_next(bluetooth_conn)))
|
||||||
{
|
{
|
||||||
@@ -326,7 +334,9 @@ static int devif_poll_ieee802154_connections(FAR struct net_driver_s *dev,
|
|||||||
FAR struct ieee802154_conn_s *ieee802154_conn = NULL;
|
FAR struct ieee802154_conn_s *ieee802154_conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the allocated packet connections and perform the poll action */
|
/* Traverse all of the allocated packet connections and perform the poll
|
||||||
|
* action.
|
||||||
|
*/
|
||||||
|
|
||||||
while (!bstop && (ieee802154_conn = ieee802154_conn_next(ieee802154_conn)))
|
while (!bstop && (ieee802154_conn = ieee802154_conn_next(ieee802154_conn)))
|
||||||
{
|
{
|
||||||
@@ -358,7 +368,9 @@ static inline int devif_poll_icmp(FAR struct net_driver_s *dev,
|
|||||||
FAR struct icmp_conn_s *conn = NULL;
|
FAR struct icmp_conn_s *conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the allocated ICMP connections and perform the poll action */
|
/* Traverse all of the allocated ICMP connections and perform the poll
|
||||||
|
* action.
|
||||||
|
*/
|
||||||
|
|
||||||
while (!bstop && (conn = icmp_nextconn(conn)) != NULL)
|
while (!bstop && (conn = icmp_nextconn(conn)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -394,14 +406,16 @@ static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev,
|
|||||||
FAR struct icmpv6_conn_s *conn = NULL;
|
FAR struct icmpv6_conn_s *conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the allocated ICMPV6 connections and perform the poll action */
|
/* Traverse all of the allocated ICMPV6 connections and perform the poll
|
||||||
|
* action.
|
||||||
|
*/
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Perform the ICMPV6 poll
|
/* Perform the ICMPV6 poll
|
||||||
* Note: conn equal NULL in the first iteration means poll dev's callback list
|
* Note: conn equal NULL in the first iteration means poll dev's
|
||||||
* since icmpv6_autoconfig and icmpv6_neighbor still append it's callback into
|
* callback list since icmpv6_autoconfig and icmpv6_neighbor still
|
||||||
* this list.
|
* append it's callback into this list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
icmpv6_poll(dev, conn);
|
icmpv6_poll(dev, conn);
|
||||||
@@ -526,7 +540,9 @@ static int devif_poll_udp_connections(FAR struct net_driver_s *dev,
|
|||||||
FAR struct udp_conn_s *conn = NULL;
|
FAR struct udp_conn_s *conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the allocated UDP connections and perform the poll action */
|
/* Traverse all of the allocated UDP connections and perform the poll
|
||||||
|
* action.
|
||||||
|
*/
|
||||||
|
|
||||||
while (!bstop && (conn = udp_nextconn(conn)))
|
while (!bstop && (conn = udp_nextconn(conn)))
|
||||||
{
|
{
|
||||||
@@ -610,7 +626,9 @@ static inline int devif_poll_tcp_timer(FAR struct net_driver_s *dev,
|
|||||||
FAR struct tcp_conn_s *conn = NULL;
|
FAR struct tcp_conn_s *conn = NULL;
|
||||||
int bstop = 0;
|
int bstop = 0;
|
||||||
|
|
||||||
/* Traverse all of the active TCP connections and perform the poll action. */
|
/* Traverse all of the active TCP connections and perform the poll
|
||||||
|
* action.
|
||||||
|
*/
|
||||||
|
|
||||||
while (!bstop && (conn = tcp_nextconn(conn)))
|
while (!bstop && (conn = tcp_nextconn(conn)))
|
||||||
{
|
{
|
||||||
@@ -652,9 +670,9 @@ static inline int devif_poll_tcp_timer(FAR struct net_driver_s *dev,
|
|||||||
* should do only if it cannot accept further write data).
|
* should do only if it cannot accept further write data).
|
||||||
*
|
*
|
||||||
* When the callback function is called, there may be an outbound packet
|
* When the callback function is called, there may be an outbound packet
|
||||||
* waiting for service in the device packet buffer, and if so the d_len field
|
* waiting for service in the device packet buffer, and if so the d_len
|
||||||
* is set to a value larger than zero. The device driver should then send
|
* field is set to a value larger than zero. The device driver should then
|
||||||
* out the packet.
|
* send out the packet.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from the MAC device driver with the network
|
* This function is called from the MAC device driver with the network
|
||||||
@@ -772,7 +790,9 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_NET_IPFORWARD
|
#ifdef CONFIG_NET_IPFORWARD
|
||||||
{
|
{
|
||||||
/* Traverse all of the tasks waiting to forward a packet to this device. */
|
/* Traverse all of the tasks waiting to forward a packet to this
|
||||||
|
* device.
|
||||||
|
*/
|
||||||
|
|
||||||
bstop = devif_poll_forward(dev, callback);
|
bstop = devif_poll_forward(dev, callback);
|
||||||
}
|
}
|
||||||
@@ -790,7 +810,7 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
|||||||
* Name: devif_timer
|
* Name: devif_timer
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* These function will traverse each active network connection structure and
|
* This function will traverse each active network connection structure and
|
||||||
* perform network timer operations. The Ethernet driver MUST implement
|
* perform network timer operations. The Ethernet driver MUST implement
|
||||||
* logic to periodically call devif_timer().
|
* logic to periodically call devif_timer().
|
||||||
*
|
*
|
||||||
@@ -800,9 +820,9 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
|||||||
* should do only if it cannot accept further write data).
|
* should do only if it cannot accept further write data).
|
||||||
*
|
*
|
||||||
* When the callback function is called, there may be an outbound packet
|
* When the callback function is called, there may be an outbound packet
|
||||||
* waiting for service in the device packet buffer, and if so the d_len field
|
* waiting for service in the device packet buffer, and if so the d_len
|
||||||
* is set to a value larger than zero. The device driver should then send
|
* field is set to a value larger than zero. The device driver should then
|
||||||
* out the packet.
|
* send out the packet.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from the MAC device driver with the network
|
* This function is called from the MAC device driver with the network
|
||||||
|
|||||||
+2
-2
@@ -175,8 +175,8 @@ end_wait:
|
|||||||
* Name: tcp_close_txnotify
|
* Name: tcp_close_txnotify
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Notify the appropriate device driver that we are have data ready to
|
* Notify the appropriate device driver that we have data ready to
|
||||||
* be send (TCP)
|
* be sent (TCP)
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* psock - Socket state structure
|
* psock - Socket state structure
|
||||||
|
|||||||
Reference in New Issue
Block a user