From 8e4397968c8f2f404a765fbd770ee3e19eb32da4 Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Sat, 26 Dec 2020 11:40:24 +0000 Subject: [PATCH] net/ & esp32/wlan: Fix some typos and nxstyle issues. Signed-off-by: Abdelatif Guettouche --- arch/xtensa/src/esp32/esp32_wifi_adapter.c | 31 ++++++----- arch/xtensa/src/esp32/esp32_wlan.c | 26 ++++----- net/devif/devif_poll.c | 62 ++++++++++++++-------- net/tcp/tcp_close.c | 4 +- 4 files changed, 69 insertions(+), 54 deletions(-) diff --git a/arch/xtensa/src/esp32/esp32_wifi_adapter.c b/arch/xtensa/src/esp32/esp32_wifi_adapter.c index 938e02f4bb..cda5d937be 100644 --- a/arch/xtensa/src/esp32/esp32_wifi_adapter.c +++ b/arch/xtensa/src/esp32/esp32_wifi_adapter.c @@ -698,7 +698,7 @@ static void esp32_ints_on(uint32_t mask) } /**************************************************************************** - * Name: esp32_ints_on + * Name: esp32_ints_off * * Description: * Disable WiFi interrupt @@ -800,8 +800,8 @@ static void esp_spin_lock_delete(void *lock) * Name: esp_wifi_int_disable * * Description: - * Enter critical by disable interrup, and take spin lock if - * in SMP mode + * Enter critical section by disabling interrupts and taking the spin lock + * if in SMP mode. * * Input Parameters: * 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 * * Description: - * Exit from critical by enable interrup, and release spin - * lock if in SMP mode + * Exit from critical section by enabling interrupts and releasing the spin + * lock if in SMP mode. * * Input Parameters: * 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) { - /** - * 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 * 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: * 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: * 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: * 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: * 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: * 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: * 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: * 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: * 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 ****************************************************************************/ /**************************************************************************** diff --git a/arch/xtensa/src/esp32/esp32_wlan.c b/arch/xtensa/src/esp32/esp32_wlan.c index d60b038916..fe2b906ce4 100644 --- a/arch/xtensa/src/esp32/esp32_wlan.c +++ b/arch/xtensa/src/esp32/esp32_wlan.c @@ -53,8 +53,7 @@ #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 */ @@ -64,12 +63,11 @@ #define WLAN_TXTOUT (60 * CLK_TCK) -/* Low-priority workqueue processes RX/TX */ +/* Low-priority work queue processes RX/TX */ #define WLAN_WORK LPWORK -/** - * Ethernet frame: +/* Ethernet frame: * Resource address : 6 bytes * Destination address: 6 bytes * Type : 2 bytes @@ -85,9 +83,8 @@ #define WLAN_RXBUF_NUM (CONFIG_ESP32_WLAN_RXBUF_NUM) -/** - * Receive threshold which let the receive function to trigger a sheduler - * to active application if possible. +/* Receive threshold which allows the receive function to trigger a scheduler + * to activate the application if possible. */ #ifdef CONFIG_MM_IOB @@ -137,7 +134,7 @@ struct wlan_priv_s 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; @@ -209,8 +206,7 @@ static int esp32_net_initialize(unsigned int devno); * Private Functions ****************************************************************************/ -/** - * Note: +/* Note: * All TX done/RX done/Error trigger functions are not called from * interrupts, this is much different from ethernet driver, including: * * wlan_rx_done @@ -294,7 +290,7 @@ static inline struct wlan_rxbuf *wlan_alloc_buffer(struct wlan_priv_s *priv) * Function: wlan_free_buffer * * Description: - * Insert a free Rx buffer into free queue + * Insert a free Rx buffer into the free queue * * Input Parameters: * 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 * * Description: - * Check if WiFi can send data. This function will re-send rest data - * which was sent failed. + * Check if WiFi can send data. This function will re-send the rest of the + * data that we failed to send. * * Input Parameters: * 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); if (ret) { - ninfo("ERROR: Failed to transmit rest frame\n"); + ninfo("ERROR: Failed to transmit the rest of the frame\n"); return false; } else diff --git a/net/devif/devif_poll.c b/net/devif/devif_poll.c index e0eb068d88..15c42c728e 100644 --- a/net/devif/devif_poll.c +++ b/net/devif/devif_poll.c @@ -167,20 +167,24 @@ static void devif_packet_conversion(FAR struct net_driver_s *dev, 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); } else { - nerr("ERROR: ICMPv6 protocol error: %u... Packet dropped\n", + nerr("ERROR: ICMPv6 protocol error: %u..." + " Packet dropped\n", ipv6->proto); } } else #endif { - nerr("ERROR: Unhandled packet dropped. pkttype=%u protocol=%u\n", + nerr("ERROR: Unhandled packet dropped." + " pkttype=%u protocol=%u\n", 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; 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))) { @@ -290,7 +296,9 @@ static int devif_poll_bluetooth_connections(FAR struct net_driver_s *dev, FAR struct bluetooth_conn_s *bluetooth_conn = NULL; 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))) { @@ -326,7 +334,9 @@ static int devif_poll_ieee802154_connections(FAR struct net_driver_s *dev, FAR struct ieee802154_conn_s *ieee802154_conn = NULL; 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))) { @@ -358,7 +368,9 @@ static inline int devif_poll_icmp(FAR struct net_driver_s *dev, FAR struct icmp_conn_s *conn = NULL; 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) { @@ -394,14 +406,16 @@ static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev, FAR struct icmpv6_conn_s *conn = NULL; 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 { /* Perform the ICMPV6 poll - * Note: conn equal NULL in the first iteration means poll dev's callback list - * since icmpv6_autoconfig and icmpv6_neighbor still append it's callback into - * this list. + * Note: conn equal NULL in the first iteration means poll dev's + * callback list since icmpv6_autoconfig and icmpv6_neighbor still + * append it's callback into this list. */ 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; 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))) { @@ -610,7 +626,9 @@ static inline int devif_poll_tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn = NULL; 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))) { @@ -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). * * 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 - * is set to a value larger than zero. The device driver should then send - * out the packet. + * waiting for service in the device packet buffer, and if so the d_len + * field is set to a value larger than zero. The device driver should then + * send out the packet. * * Assumptions: * 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 #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); } @@ -790,7 +810,7 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback) * Name: devif_timer * * 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 * 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). * * 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 - * is set to a value larger than zero. The device driver should then send - * out the packet. + * waiting for service in the device packet buffer, and if so the d_len + * field is set to a value larger than zero. The device driver should then + * send out the packet. * * Assumptions: * This function is called from the MAC device driver with the network diff --git a/net/tcp/tcp_close.c b/net/tcp/tcp_close.c index 15927a60f2..4889186943 100644 --- a/net/tcp/tcp_close.c +++ b/net/tcp/tcp_close.c @@ -175,8 +175,8 @@ end_wait: * Name: tcp_close_txnotify * * Description: - * Notify the appropriate device driver that we are have data ready to - * be send (TCP) + * Notify the appropriate device driver that we have data ready to + * be sent (TCP) * * Input Parameters: * psock - Socket state structure