LCOV - code coverage report
Current view: top level - zephyr/drivers/wifi/nrfwifi/off_raw_tx - off_raw_tx_api.h Hit Total Coverage
Test: new.info Lines: 22 28 78.6 %
Date: 2024-10-22 03:18:24

          Line data    Source code
       1           0 : /*
       2             :  * Copyright (c) 2024 Nordic Semiconductor ASA
       3             :  *
       4             :  * SPDX-License-Identifier: Apache-2.0
       5             :  */
       6             : /** @file
       7             :  *
       8             :  * @addtogroup nrf70_off_raw_tx_api nRF70 Offloaded raw TX API
       9             :  * @{
      10             :  *
      11             :  * @brief File containing API's for the Offloaded raw TX feature.
      12             :  */
      13             : 
      14             : #ifndef INCLUDE_ZEPHYR_DRIVERS_OFF_RAW_TX_API_H_
      15             : #define INCLUDE_ZEPHYR_DRIVERS_OFF_RAW_TX_API_H_
      16             : 
      17             : #include <stdbool.h>
      18             : #include <stdint.h>
      19             : #include "osal_api.h"
      20             : 
      21             : /*  Minimum frame size for raw packet transmission */
      22           0 : #define NRF_WIFI_OFF_RAW_TX_FRAME_SIZE_MIN 26
      23             : /*  Maximum frame size for raw packet transmission */
      24           0 : #define NRF_WIFI_OFF_RAW_TX_FRAME_SIZE_MAX 600
      25             : 
      26             : /**
      27             :  * @brief- Transmission rates
      28             :  * Rate to be used for transmitting a packet.
      29             :  */
      30           1 : enum nrf_wifi_off_raw_tx_rate {
      31             :         /** 1 Mbps */
      32             :         RATE_1M,
      33             :         /** 2 Mbps */
      34             :         RATE_2M,
      35             :         /** 5.5 Mbps */
      36             :         RATE_5_5M,
      37             :         /** 11 Mbps */
      38             :         RATE_11M,
      39             :         /** 6 Mbps */
      40             :         RATE_6M,
      41             :         /** 9 Mbps */
      42             :         RATE_9M,
      43             :         /** 12 Mbps */
      44             :         RATE_12M,
      45             :         /** 18 Mbps */
      46             :         RATE_18M,
      47             :         /** 24 Mbps */
      48             :         RATE_24M,
      49             :         /** 36 Mbps */
      50             :         RATE_36M,
      51             :         /** 48 Mbps */
      52             :         RATE_48M,
      53             :         /** 54 Mbps */
      54             :         RATE_54M,
      55             :         /** MCS 0 */
      56             :         RATE_MCS0,
      57             :         /** MCS 1 */
      58             :         RATE_MCS1,
      59             :         /** MCS 2 */
      60             :         RATE_MCS2,
      61             :         /** MCS 3 */
      62             :         RATE_MCS3,
      63             :         /** MCS 4 */
      64             :         RATE_MCS4,
      65             :         /** MCS 5 */
      66             :         RATE_MCS5,
      67             :         /** MCS 6 */
      68             :         RATE_MCS6,
      69             :         /** MCS 7 */
      70             :         RATE_MCS7,
      71             :         /** Invalid rate */
      72             :         RATE_MAX
      73             : };
      74             : 
      75             : 
      76             : /**
      77             :  * @brief- HE guard interval value
      78             :  * Value of the guard interval to be used between symbols when transmitting using HE.
      79             :  */
      80           1 : enum nrf_wifi_off_raw_tx_he_gi {
      81             :         /** 800 ns */
      82             :         HE_GI_800NS,
      83             :         /** 1600 ns */
      84             :         HE_GI_1600NS,
      85             :         /** 3200 ns */
      86             :         HE_GI_3200NS,
      87             :         /** Invalid value */
      88             :         HE_GI_MAX
      89             : };
      90             : 
      91             : 
      92             : /**
      93             :  * @brief- HE long training field duration
      94             :  * Value of the long training field duration to be used when transmitting using HE.
      95             :  */
      96           1 : enum nrf_wifi_off_raw_tx_he_ltf {
      97             :         /** 3.2us */
      98             :         HE_LTF_3200NS,
      99             :         /** 6.4us */
     100             :         HE_LTF_6400NS,
     101             :         /** 12.8us */
     102             :         HE_LTF_12800NS,
     103             :         /** Invalid value */
     104             :         HE_LTF_MAX
     105             : };
     106             : 
     107             : /**
     108             :  * @brief- Throughput mode
     109             :  * Throughput mode to be used for transmitting the packet.
     110             :  */
     111           1 : enum nrf_wifi_off_raw_tx_tput_mode {
     112             :         /** Legacy mode */
     113             :         TPUT_MODE_LEGACY,
     114             :         /** High Throughput mode (11n) */
     115             :         TPUT_MODE_HT,
     116             :         /** Very high throughput mode (11ac) */
     117             :         TPUT_MODE_VHT,
     118             :         /** HE SU mode */
     119             :         TPUT_MODE_HE_SU,
     120             :         /** HE ER SU mode */
     121             :         TPUT_MODE_HE_ER_SU,
     122             :         /** HE TB mode */
     123             :         TPUT_MODE_HE_TB,
     124             :         /** Highest throughput mode currently defined */
     125             :         TPUT_MODE_MAX
     126             : };
     127             : 
     128             : /**
     129             :  * @brief This structure defines the Offloaded raw tx debug statistics.
     130             :  *
     131             :  */
     132           1 : struct nrf_wifi_off_raw_tx_stats {
     133             :         /** Number of packets sent */
     134           1 :         unsigned int off_raw_tx_pkt_sent;
     135             : };
     136             : 
     137             : /**
     138             :  * @brief- Configuration parameters for offloaded raw TX
     139             :  * Parameters which can be used to configure the offloaded raw TX operation.
     140             :  */
     141           1 : struct nrf_wifi_off_raw_tx_conf {
     142             :         /** Time interval (in microseconds) between transmissions */
     143           1 :         unsigned int period_us;
     144             :         /** Transmit power in dBm (0 to 20) */
     145           1 :         unsigned int tx_pwr;
     146             :         /** Channel number on which to transmit */
     147           1 :         unsigned int chan;
     148             :         /** Set to TRUE to use short preamble for FALSE to disable short preamble */
     149           1 :         bool short_preamble;
     150             :         /* Number of times a packet should be retried at each possible rate */
     151           0 :         unsigned int num_retries;
     152             :         /** Throughput mode for packet transmittion. Refer &enum nrf_wifi_off_raw_tx_tput_mode */
     153           1 :         enum nrf_wifi_off_raw_tx_tput_mode tput_mode;
     154             :         /* Rate at which packet needs to be transmitted. Refer &enum nrf_wifi_off_raw_tx_rate */
     155           0 :         enum nrf_wifi_off_raw_tx_rate rate;
     156             :         /** HE GI. Refer &enum nrf_wifi_off_raw_tx_he_gi */
     157           1 :         enum nrf_wifi_off_raw_tx_he_gi he_gi;
     158             :         /** HE GI. Refer &enum nrf_wifi_off_raw_tx_he_ltf */
     159           1 :         enum nrf_wifi_off_raw_tx_he_ltf he_ltf;
     160             :         /* Pointer to packet to be transmitted */
     161           0 :         void *pkt;
     162             :         /** Packet length of the frame to be transmitted, (min 26 bytes and max 600 bytes) */
     163           1 :         unsigned int pkt_len;
     164             : };
     165             : 
     166             : 
     167             : /**
     168             :  * @brief Initialize the nRF70 for operating in the offloaded raw TX mode.
     169             :  * @param mac_addr MAC address to be used for the nRF70 device.
     170             :  *
     171             :  * This function is initializes the nRF70 device for offloaded raw TX mode by:
     172             :  *  - Powering it up,
     173             :  *  - Downloading a firmware patch (if any).
     174             :  *  - Initializing the firmware to accept further commands
     175             :  *
     176             :  * The mac_addr parameter is used to set the MAC address of the nRF70 device.
     177             :  * This address can be used to override the MAC addresses programmed in the OTP and
     178             :  * the value configured (if any) in CONFIG_WIFI_FIXED_MAC_ADDRESS.
     179             :  * The priority order in which the MAC address values for the nRF70 device are used is:
     180             :  * - If mac_addr is provided, the MAC address is set to the value provided.
     181             :  * - If CONFIG_WIFI_FIXED_MAC_ADDRESS is enabled, the MAC address uses the Kconfig value.
     182             :  * - If none of the above are provided, the MAC address is set to the value programmed in the OTP.
     183             :  *
     184             :  * @retval 0 If the operation was successful.
     185             :  * @retval -1 If the operation failed.
     186             :  */
     187           1 : int nrf70_off_raw_tx_init(uint8_t *mac_addr);
     188             : 
     189             : /**
     190             :  * @brief Initialize the nRF70 for operating in the offloaded raw TX mode.
     191             :  *
     192             :  * This function is deinitializes the nRF70 device.
     193             :  *
     194             :  */
     195           1 : void nrf70_off_raw_tx_deinit(void);
     196             : 
     197             : /**
     198             :  * @brief Update the configured offloaded raw TX parameters.
     199             :  * @param conf Configuration parameters to be updated for the offloaded raw TX operation.
     200             :  *
     201             :  * This function is used to update configured parameters for offloaded raw TX operation.
     202             :  * This function should be used to when the parameters need to be updated during an ongoing
     203             :  * raw TX operation without having to stop it.
     204             :  *
     205             :  * @retval 0 If the operation was successful.
     206             :  * @retval -1 If the operation failed.
     207             :  */
     208           1 : int nrf70_off_raw_tx_conf_update(struct nrf_wifi_off_raw_tx_conf *conf);
     209             : 
     210             : /**
     211             :  * @brief Start the offloaded raw TX.
     212             :  * @param conf Configuration parameters necessary for the offloaded raw TX operation.
     213             :  *
     214             :  * This function is used to start offloaded raw TX operation. When this function is invoked
     215             :  * the nRF70 device will start transmitting frames as per the configuration specified by @p conf.
     216             :  *
     217             :  * @retval 0 If the operation was successful.
     218             :  * @retval -1 If the operation failed.
     219             :  */
     220           1 : int nrf70_off_raw_tx_start(struct nrf_wifi_off_raw_tx_conf *conf);
     221             : 
     222             : /**
     223             :  * @brief Stop the offloaded raw TX.
     224             :  *
     225             :  * This function is used to stop offloaded raw TX operation. When this function is invoked
     226             :  * the nRF70 device will stop transmitting frames.
     227             :  *
     228             :  * @retval 0 If the operation was successful.
     229             :  * @retval -1 If the operation failed.
     230             :  */
     231           1 : int nrf70_off_raw_tx_stop(void);
     232             : 
     233             : /**
     234             :  * @brief Get the MAC address of the nRF70 device.
     235             :  * @param mac_addr Buffer to store the MAC address.
     236             :  *
     237             :  * This function is used to get the MAC address of the nRF70 device.
     238             :  * The MAC address is stored in the buffer pointed by mac_addr.
     239             :  * The MAC address is expected to be a 6 byte value.
     240             :  *
     241             :  * @retval 0 If the operation was successful.
     242             :  * @retval -1 If the operation failed.
     243             :  */
     244           1 : int nrf70_off_raw_tx_mac_addr_get(uint8_t *mac_addr);
     245             : 
     246             : /**
     247             :  * @brief Get statistics of the offloaded raw TX.
     248             :  * @param off_raw_tx_stats Statistics of the offloaded raw TX operation.
     249             :  *
     250             :  * This function is used to get statistics of offloaded raw TX operation. When this function
     251             :  * is invoked the nRF70 device will show statistics.
     252             :  *
     253             :  * @retval 0 If the operation was successful.
     254             :  * @retval -1 If the operation failed.
     255             :  */
     256           1 : int nrf70_off_raw_tx_stats(struct nrf_wifi_off_raw_tx_stats *off_raw_tx_stats);
     257             : /**
     258             :  * @}
     259             :  */
     260             : #endif /* INCLUDE_ZEPHYR_DRIVERS_OFF_RAW_TX_API_H_ */

Generated by: LCOV version 1.14