xiaoxiang781216 commented on code in PR #11617:
URL: https://github.com/apache/nuttx/pull/11617#discussion_r1493750691


##########
arch/arm/src/nrf52/nrf52_ieee802154_trace.c:
##########
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * arch/arm/src/nrf52/nrf52_ieee802154_trace.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <arch/board/board.h>
+
+#include "nrf52_ieee802154_trace.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This must match enum radio_trace_type_e */
+
+const static char *g_radio_trace_str[] =

Review Comment:
   static const



##########
arch/arm/src/nrf52/CMakeLists.txt:
##########
@@ -1,22 +1,22 @@
-############################################################################
+# 
##############################################################################

Review Comment:
   why add space after first #



##########
arch/arm/src/nrf52/nrf52_ieee802154_radio.c:
##########
@@ -0,0 +1,2116 @@
+/****************************************************************************
+ * arch/arm/src/nrf52/nrf52_ieee802154_radio.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/param.h>
+
+#include <nuttx/wqueue.h>
+#include <nuttx/mm/iob.h>
+
+#include "nrf52_ieee802154_radio.h"
+#include "nrf52_ieee802154_trace.h"
+
+#include "nrf52_ieee802154_priv.h"
+
+#include "hardware/nrf52_utils.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Constant from NRF52 manual */
+
+#define NRF52_ED_RSSISCALE            (4)
+
+/* ED configuration:
+ *   - IRQ on EDEND event (sampling of energy detection complete)
+ *   - shortcut between READY and EDSTART
+ *   - shortcut between EDEND and DISABLE
+ *
+ * Set in nrf52_radioi8_energydetect() reset in nrf52_radioi8_isr_radio().
+ *
+ * EDSTART task set in nrf52_radioi8_energydetect().
+ */
+
+#define IEEE802154_ED_INT             (RADIO_INT_EDEND)
+#define IEEE802154_ED_SHORTS          (RADIO_SHORTS_READY_EDSTART | \
+                                       RADIO_SHORTS_EDEND_DISABLE)
+
+/* RX configuration:
+ *   - IRQ on END event (packet recveived)
+ *   - shortcut between RXREADY and START
+ *   - shortcut between END and DISABLE
+ *
+ * Set in nrf52_radioi8_rxenable() reset in nrf52_radioi8_rxenable().
+ *
+ * RXEN task set in nrf52_radioi8_rxenable() and
+ * nrf52_radioi8_isr_radio() after RX handled and no pending ACKTX.
+ */
+
+#define IEEE802154_RX_INT              (RADIO_INT_END)
+#define IEEE802154_RX_SHORTS           (RADIO_SHORTS_RXREADY_START |  \
+                                        RADIO_SHORTS_END_DISABLE)
+
+/* NOTE: for TX we trigger interrupts on PHYEND event, not END! */
+
+/* TX CCA un-slotted configuration:
+ *   - IRQ on PHYEND event
+ *   - IRQ on CCABUSY event
+ *   - shortcut between TXREADY and START
+ *   - shortcut between PHYEND and DISABLE
+ *   - shortcut between RXREADY and CCASTART
+ *   - shortcut between CCAIDLE and STOP
+ *   - shortcut between CCAIDLE and TXEN
+ *
+ * Set in nrf52_radioi8_radio_norm_setup() reset in
+ * nrf52_radioi8_isr_radio().
+ *
+ * CCASTART task set in nrf52_radioi8_isr_tim() when CCA transfer.
+ */
+
+#define IEEE802154_TXCCAUNSLT_INT      (RADIO_INT_PHYEND |              \
+                                        RADIO_INT_CCABUSY)
+#define IEEE802154_TXCCAUNSLT_SHORTS   (RADIO_SHORTS_TXREADY_START |    \
+                                        RADIO_SHORTS_PHYEND_DISABLE |   \
+                                        RADIO_SHORTS_RXREADY_CCASTART | \
+                                        RADIO_SHORTS_CCAIDLE_STOP |     \
+                                        RADIO_SHORTS_CCAIDLE_TXEN)
+
+/* TX CCA slotted configuration:
+ *   - IRQ on PHYEND event
+ *   - IRQ on CCABUSY event
+ *   - IRQ on CCAIDLE event
+ *   - shortcut between TXREADY and START
+ *   - shortcut between PHYEND and DISABLE
+ *
+ * Set in nrf52_radioi8_radio_norm_setup() reset in
+ * nrf52_radioi8_isr_radio().
+ *
+ * CCASTART task set in nrf52_radioi8_isr_tim() when CCA transfer.
+ */
+
+#define IEEE802154_TXCCASLT_INT        (RADIO_INT_PHYEND |              \
+                                        RADIO_INT_CCAIDLE |             \
+                                        RADIO_INT_CCABUSY)
+#define IEEE802154_TXCCASLT_SHORTS     (RADIO_SHORTS_TXREADY_START |    \
+                                        RADIO_SHORTS_PHYEND_DISABLE |   \
+                                        RADIO_SHORTS_RXREADY_CCASTART)
+
+/* TX no-CCA configuration:
+ *   - IRQ on PHYEND event
+ *   - shortcut between TXREADY and START
+ *   - shortcut between PHYEND and DISABLE
+ *
+ * Set in nrf52_radioi8_radio_norm_setup() reset in
+ * nrf52_radioi8_isr_radio().
+ *
+ * TXEN task set in nrf52_radioi8_radio_norm_trigger() when non-CCA
+ * transfer or in nrf52_radioi8_isr_tim() for TXDELAY.
+ */
+
+#define IEEE802154_TX_INT              (RADIO_INT_PHYEND)
+#define IEEE802154_TX_SHORTS           (RADIO_SHORTS_TXREADY_START |  \
+                                        RADIO_SHORTS_PHYEND_DISABLE)
+
+/* ACK configuration:
+ *   - IRQ on PHYEND event
+ *   - shortcut between PHYEND and DISABLE
+ *
+ * Set in nrf52_radioi8_ack_transmit reset in nrf52_radioi8_isr_radio().
+ *
+ * TXEN task set in nrf52_radioi8_ack_transmit().
+ * START task set in nrf52_radioi8_isr_tim().
+ */
+
+#define IEEE802154_ACKTX_INT            (RADIO_INT_PHYEND)
+#define IEEE802154_ACKTX_SHORTS         (RADIO_SHORTS_PHYEND_DISABLE)
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static void nrf52_radioi8_rx_parse(struct nrf52_radioi8_dev_s *dev,
+                                   uint8_t *ftype, uint8_t *cmdtype);
+static void nrf52_radioi8_ack_transmit(struct nrf52_radioi8_dev_s *dev);
+static bool nrf52_radioi8_filter(struct nrf52_radioi8_dev_s *dev);
+#if NRF52_GTS_SLOTS > 0
+static void nrf52_radioi8_gts_setup(struct nrf52_radioi8_dev_s *dev,
+                                    uint8_t fifo, struct iob_s *frame);
+#endif
+
+/* Ops */
+
+static void nrf52_radioi8_txstart(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_ccastart(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_notify_noack(struct nrf52_radioi8_dev_s *dev);
+static int nrf52_radioi8_rxenable(struct nrf52_radioi8_dev_s *dev,
+                                  bool enable);
+static int nrf52_radioi8_energydetect(struct nrf52_radioi8_dev_s *dev,
+                                      uint32_t nsymbols);
+static int nrf52_radioi8_setchannel(struct nrf52_radioi8_dev_s *dev,
+                                    uint8_t chan);
+static int nrf52_radioi8_setcca(struct nrf52_radioi8_dev_s *dev,
+                                struct ieee802154_cca_s *cca);
+static void nrf52_radioi8_norm_setup_buf(struct nrf52_radioi8_dev_s *dev,
+                                         uint8_t *buf, bool csma);
+static void nrf52_radioi8_norm_setup(struct nrf52_radioi8_dev_s *dev,
+                                     struct iob_s *frame, bool csma);
+static void nrf52_radioi8_norm_trigger(struct nrf52_radioi8_dev_s *dev);
+#ifdef CONFIG_NRF52_RADIO_IEEE802154_SUPERFRAME
+static void nrf52_radioi8_beacon_setup(struct nrf52_radioi8_dev_s *dev,
+                                       uint8_t *data, uint8_t len);
+static void nrf52_radioi8_beacon_tx(struct nrf52_radioi8_dev_s *dev);
+#endif
+static int nrf52_radioi8_reset(struct nrf52_radioi8_radio_s *dev);
+static int nrf52_radioi8_csmapoll(struct nrf52_radioi8_dev_s *dev);
+static int nrf52_radioi8_gtspoll(struct nrf52_radioi8_dev_s *dev);
+
+/* Interrupts logic */
+
+static void nrf52_radioi8_work_noack(void *arg);
+static void nrf52_radioi8_work_rx(void *arg);
+static void nrf52_radioi8_work_tx(void *arg);
+static void nrf52_radioi8_work_busy(void *arg);
+static void nrf52_radioi8_work_ed(void *arg);
+static void nrf52_radioi8_state_rx(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_state_tx(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_state_acktx(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_state_ed(struct nrf52_radioi8_dev_s *dev);
+static int nrf52_radioi8_isr_radio(int irq, void *context, void *arg);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Packet buffers - must be byte aligned in RAM.
+ *
+ * NOTE: The first byte is PHR, the last byte is LQI.
+ */
+
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_rxbuf[IEEE802154_MAX_PHY_PACKET_SIZE + 2];
+
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_txbuf[IEEE802154_MAX_PHY_PACKET_SIZE + 2];
+
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_ackbuf[IEEE802154_ACK_FRAME_SIZE + 1];
+
+#ifdef CONFIG_NRF52_RADIO_IEEE802154_SUPERFRAME
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_beaconbuf[IEEE802154_MAX_PHY_PACKET_SIZE + 2];
+#endif
+
+/* Radio ops */
+
+struct nrf52_radioi8_radio_ops_s g_radioi8_radio_ops =
+{
+  .txstart      = nrf52_radioi8_txstart,
+  .ccastart     = nrf52_radioi8_ccastart,
+  .notify_noack = nrf52_radioi8_notify_noack,
+  .rxenable     = nrf52_radioi8_rxenable,
+  .energydetect = nrf52_radioi8_energydetect,
+  .setchannel   = nrf52_radioi8_setchannel,
+  .setcca       = nrf52_radioi8_setcca,
+  .norm_setup   = nrf52_radioi8_norm_setup,
+  .norm_trigger = nrf52_radioi8_norm_trigger,
+#ifdef CONFIG_NRF52_RADIO_IEEE802154_SUPERFRAME
+  .beacon_setup = nrf52_radioi8_beacon_setup,
+  .beacon_tx    = nrf52_radioi8_beacon_tx,
+#endif
+  .reset        = nrf52_radioi8_reset,
+  .csma_poll    = nrf52_radioi8_csmapoll,
+  .gts_poll     = nrf52_radioi8_gtspoll
+};
+
+/* Radio interface */
+
+struct nrf52_radioi8_radio_s g_radioi8_radio;

Review Comment:
   add static



##########
arch/arm/src/nrf52/nrf52_ieee802154_trace.c:
##########
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * arch/arm/src/nrf52/nrf52_ieee802154_trace.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <arch/board/board.h>
+
+#include "nrf52_ieee802154_trace.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This must match enum radio_trace_type_e */
+
+const static char *g_radio_trace_str[] =
+{
+  "RADIO IRQ",
+  "RADIO IRQ: RX DONE",
+  "RADIO IRQ: TX DONE",
+  "RADIO IRQ: ACK TX",
+  "RADIO IRQ: WAIT ACK",
+  "RADIO IRQ: RX ACK DONE",
+  "RADIO IRQ: TX CCA BUSY",
+
+  "TIM IRQ: TIM ACK TX",
+  "TIM IRQ; TIM TX DELAY",
+  "TIM IRQ: TIM WAIT ACK",
+  "TIM IRQ: TIM CSMA DELAY",
+  "RTC IRQ: RTC SD",
+  "RTC IRQ: RTC CAP",
+  "RTC IRQ: RTC TIMESLOT",
+  "RTC IRQ: RTC BI",
+
+  "WORK: RX",
+  "WORK: TX",
+  "WORK: BUSY",
+  "WORK: ED",
+  "WORK: NO ACK",
+
+  "ACKTX",
+  "TIMSTART",
+  "RXENABLE",
+  "RXDISABLE",
+  "CSMASETUP",
+  "CSMATRIGGER",
+  "NOCSMATRIGGER",
+  "NOACK",
+  "DROPFRAME",
+  "TXTRYAGAIN",
+};
+
+/* Trace data */
+
+volatile static size_t g_radio_trace_cntr = 0;
+volatile static struct radio_trace_s

Review Comment:
   ditto



##########
arch/arm/src/nrf52/nrf52_ieee802154_trace.c:
##########
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * arch/arm/src/nrf52/nrf52_ieee802154_trace.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <arch/board/board.h>
+
+#include "nrf52_ieee802154_trace.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This must match enum radio_trace_type_e */
+
+const static char *g_radio_trace_str[] =
+{
+  "RADIO IRQ",
+  "RADIO IRQ: RX DONE",
+  "RADIO IRQ: TX DONE",
+  "RADIO IRQ: ACK TX",
+  "RADIO IRQ: WAIT ACK",
+  "RADIO IRQ: RX ACK DONE",
+  "RADIO IRQ: TX CCA BUSY",
+
+  "TIM IRQ: TIM ACK TX",
+  "TIM IRQ; TIM TX DELAY",
+  "TIM IRQ: TIM WAIT ACK",
+  "TIM IRQ: TIM CSMA DELAY",
+  "RTC IRQ: RTC SD",
+  "RTC IRQ: RTC CAP",
+  "RTC IRQ: RTC TIMESLOT",
+  "RTC IRQ: RTC BI",
+
+  "WORK: RX",
+  "WORK: TX",
+  "WORK: BUSY",
+  "WORK: ED",
+  "WORK: NO ACK",
+
+  "ACKTX",
+  "TIMSTART",
+  "RXENABLE",
+  "RXDISABLE",
+  "CSMASETUP",
+  "CSMATRIGGER",
+  "NOCSMATRIGGER",
+  "NOACK",
+  "DROPFRAME",
+  "TXTRYAGAIN",
+};
+
+/* Trace data */
+
+volatile static size_t g_radio_trace_cntr = 0;

Review Comment:
   static volatile 



##########
arch/arm/src/nrf52/nrf52_ieee802154_radio.c:
##########
@@ -0,0 +1,2116 @@
+/****************************************************************************
+ * arch/arm/src/nrf52/nrf52_ieee802154_radio.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/param.h>
+
+#include <nuttx/wqueue.h>
+#include <nuttx/mm/iob.h>
+
+#include "nrf52_ieee802154_radio.h"
+#include "nrf52_ieee802154_trace.h"
+
+#include "nrf52_ieee802154_priv.h"
+
+#include "hardware/nrf52_utils.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Constant from NRF52 manual */
+
+#define NRF52_ED_RSSISCALE            (4)
+
+/* ED configuration:
+ *   - IRQ on EDEND event (sampling of energy detection complete)
+ *   - shortcut between READY and EDSTART
+ *   - shortcut between EDEND and DISABLE
+ *
+ * Set in nrf52_radioi8_energydetect() reset in nrf52_radioi8_isr_radio().
+ *
+ * EDSTART task set in nrf52_radioi8_energydetect().
+ */
+
+#define IEEE802154_ED_INT             (RADIO_INT_EDEND)
+#define IEEE802154_ED_SHORTS          (RADIO_SHORTS_READY_EDSTART | \
+                                       RADIO_SHORTS_EDEND_DISABLE)
+
+/* RX configuration:
+ *   - IRQ on END event (packet recveived)
+ *   - shortcut between RXREADY and START
+ *   - shortcut between END and DISABLE
+ *
+ * Set in nrf52_radioi8_rxenable() reset in nrf52_radioi8_rxenable().
+ *
+ * RXEN task set in nrf52_radioi8_rxenable() and
+ * nrf52_radioi8_isr_radio() after RX handled and no pending ACKTX.
+ */
+
+#define IEEE802154_RX_INT              (RADIO_INT_END)
+#define IEEE802154_RX_SHORTS           (RADIO_SHORTS_RXREADY_START |  \
+                                        RADIO_SHORTS_END_DISABLE)
+
+/* NOTE: for TX we trigger interrupts on PHYEND event, not END! */
+
+/* TX CCA un-slotted configuration:
+ *   - IRQ on PHYEND event
+ *   - IRQ on CCABUSY event
+ *   - shortcut between TXREADY and START
+ *   - shortcut between PHYEND and DISABLE
+ *   - shortcut between RXREADY and CCASTART
+ *   - shortcut between CCAIDLE and STOP
+ *   - shortcut between CCAIDLE and TXEN
+ *
+ * Set in nrf52_radioi8_radio_norm_setup() reset in
+ * nrf52_radioi8_isr_radio().
+ *
+ * CCASTART task set in nrf52_radioi8_isr_tim() when CCA transfer.
+ */
+
+#define IEEE802154_TXCCAUNSLT_INT      (RADIO_INT_PHYEND |              \
+                                        RADIO_INT_CCABUSY)
+#define IEEE802154_TXCCAUNSLT_SHORTS   (RADIO_SHORTS_TXREADY_START |    \
+                                        RADIO_SHORTS_PHYEND_DISABLE |   \
+                                        RADIO_SHORTS_RXREADY_CCASTART | \
+                                        RADIO_SHORTS_CCAIDLE_STOP |     \
+                                        RADIO_SHORTS_CCAIDLE_TXEN)
+
+/* TX CCA slotted configuration:
+ *   - IRQ on PHYEND event
+ *   - IRQ on CCABUSY event
+ *   - IRQ on CCAIDLE event
+ *   - shortcut between TXREADY and START
+ *   - shortcut between PHYEND and DISABLE
+ *
+ * Set in nrf52_radioi8_radio_norm_setup() reset in
+ * nrf52_radioi8_isr_radio().
+ *
+ * CCASTART task set in nrf52_radioi8_isr_tim() when CCA transfer.
+ */
+
+#define IEEE802154_TXCCASLT_INT        (RADIO_INT_PHYEND |              \
+                                        RADIO_INT_CCAIDLE |             \
+                                        RADIO_INT_CCABUSY)
+#define IEEE802154_TXCCASLT_SHORTS     (RADIO_SHORTS_TXREADY_START |    \
+                                        RADIO_SHORTS_PHYEND_DISABLE |   \
+                                        RADIO_SHORTS_RXREADY_CCASTART)
+
+/* TX no-CCA configuration:
+ *   - IRQ on PHYEND event
+ *   - shortcut between TXREADY and START
+ *   - shortcut between PHYEND and DISABLE
+ *
+ * Set in nrf52_radioi8_radio_norm_setup() reset in
+ * nrf52_radioi8_isr_radio().
+ *
+ * TXEN task set in nrf52_radioi8_radio_norm_trigger() when non-CCA
+ * transfer or in nrf52_radioi8_isr_tim() for TXDELAY.
+ */
+
+#define IEEE802154_TX_INT              (RADIO_INT_PHYEND)
+#define IEEE802154_TX_SHORTS           (RADIO_SHORTS_TXREADY_START |  \
+                                        RADIO_SHORTS_PHYEND_DISABLE)
+
+/* ACK configuration:
+ *   - IRQ on PHYEND event
+ *   - shortcut between PHYEND and DISABLE
+ *
+ * Set in nrf52_radioi8_ack_transmit reset in nrf52_radioi8_isr_radio().
+ *
+ * TXEN task set in nrf52_radioi8_ack_transmit().
+ * START task set in nrf52_radioi8_isr_tim().
+ */
+
+#define IEEE802154_ACKTX_INT            (RADIO_INT_PHYEND)
+#define IEEE802154_ACKTX_SHORTS         (RADIO_SHORTS_PHYEND_DISABLE)
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static void nrf52_radioi8_rx_parse(struct nrf52_radioi8_dev_s *dev,
+                                   uint8_t *ftype, uint8_t *cmdtype);
+static void nrf52_radioi8_ack_transmit(struct nrf52_radioi8_dev_s *dev);
+static bool nrf52_radioi8_filter(struct nrf52_radioi8_dev_s *dev);
+#if NRF52_GTS_SLOTS > 0
+static void nrf52_radioi8_gts_setup(struct nrf52_radioi8_dev_s *dev,
+                                    uint8_t fifo, struct iob_s *frame);
+#endif
+
+/* Ops */
+
+static void nrf52_radioi8_txstart(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_ccastart(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_notify_noack(struct nrf52_radioi8_dev_s *dev);
+static int nrf52_radioi8_rxenable(struct nrf52_radioi8_dev_s *dev,
+                                  bool enable);
+static int nrf52_radioi8_energydetect(struct nrf52_radioi8_dev_s *dev,
+                                      uint32_t nsymbols);
+static int nrf52_radioi8_setchannel(struct nrf52_radioi8_dev_s *dev,
+                                    uint8_t chan);
+static int nrf52_radioi8_setcca(struct nrf52_radioi8_dev_s *dev,
+                                struct ieee802154_cca_s *cca);
+static void nrf52_radioi8_norm_setup_buf(struct nrf52_radioi8_dev_s *dev,
+                                         uint8_t *buf, bool csma);
+static void nrf52_radioi8_norm_setup(struct nrf52_radioi8_dev_s *dev,
+                                     struct iob_s *frame, bool csma);
+static void nrf52_radioi8_norm_trigger(struct nrf52_radioi8_dev_s *dev);
+#ifdef CONFIG_NRF52_RADIO_IEEE802154_SUPERFRAME
+static void nrf52_radioi8_beacon_setup(struct nrf52_radioi8_dev_s *dev,
+                                       uint8_t *data, uint8_t len);
+static void nrf52_radioi8_beacon_tx(struct nrf52_radioi8_dev_s *dev);
+#endif
+static int nrf52_radioi8_reset(struct nrf52_radioi8_radio_s *dev);
+static int nrf52_radioi8_csmapoll(struct nrf52_radioi8_dev_s *dev);
+static int nrf52_radioi8_gtspoll(struct nrf52_radioi8_dev_s *dev);
+
+/* Interrupts logic */
+
+static void nrf52_radioi8_work_noack(void *arg);
+static void nrf52_radioi8_work_rx(void *arg);
+static void nrf52_radioi8_work_tx(void *arg);
+static void nrf52_radioi8_work_busy(void *arg);
+static void nrf52_radioi8_work_ed(void *arg);
+static void nrf52_radioi8_state_rx(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_state_tx(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_state_acktx(struct nrf52_radioi8_dev_s *dev);
+static void nrf52_radioi8_state_ed(struct nrf52_radioi8_dev_s *dev);
+static int nrf52_radioi8_isr_radio(int irq, void *context, void *arg);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Packet buffers - must be byte aligned in RAM.
+ *
+ * NOTE: The first byte is PHR, the last byte is LQI.
+ */
+
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_rxbuf[IEEE802154_MAX_PHY_PACKET_SIZE + 2];
+
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_txbuf[IEEE802154_MAX_PHY_PACKET_SIZE + 2];
+
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_ackbuf[IEEE802154_ACK_FRAME_SIZE + 1];
+
+#ifdef CONFIG_NRF52_RADIO_IEEE802154_SUPERFRAME
+static uint8_t aligned_data(8)
+  g_nrf52_radioi8_beaconbuf[IEEE802154_MAX_PHY_PACKET_SIZE + 2];
+#endif
+
+/* Radio ops */
+
+struct nrf52_radioi8_radio_ops_s g_radioi8_radio_ops =

Review Comment:
   add static



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to