# MACSW

RW-WLAN-nX root module. More...

Collaboration diagram for MACSW:

## Data Structures
struct | rwnx_env_tag
| Define global rwnx status. More...
## Modules
| LMAC

| Lower MAC SW module.
| UMAC

| Upper MAC SW module.
| COMMON

| Module grouping the general purpose SW tools.
| DEBUG

| Description of the Debug module.
| MAC

| Common MAC types, defines and utils functions.
| KERNEL

| Kernel modules.
| MACIF

| This define the interface used by MAC software to communicate with the controlling layer.
| PLATFORM

| Description of the RW reference FPGA platform.
## Defines
#define | NX_FULLY_HOSTED 0
| Build for fully hosted partitioning.
#define | NX_UMAC_PRESENT 1
| Whether UMAC is enable or not.
#define | NX_VERSION_MAJ 6
| Major version number.
#define | NX_VERSION_MIN 4
| Minor version number.
#define | NX_VERSION_REL 5
| Release number.
#define | NX_VERSION_PAT 0
| Patch number.
#define | NX_VERSION
| Version word.
#define | NX_VERSION_STR "v6.4.5.0"
| Macro for previous variable. Do not use!
## Functions
void | rwnxl_init (void)
| This function performs all the initializations of the MAC SW.
void | rwnxl_start (void)
| Start the MAC SW.
void | rwnxl_reset_evt (int dummy)
| NX reset event handler.
bool | rwnxl_cpu_can_sleep (void)
| This function checks if any kernel event is pending in the MAC SW.
void | rwnxl_sleep (void)
| This function performs the required checks prior to go to DOZE mode.
void | rwnxl_wakeup (void)
| This function performs the wake up from DOZE mode.
## Variables
static struct rwnx_env_tag | rwnx_env
| RWNX context.
const char | nx_version_str []
| Version string (global variable defined in src/build/build_version.c).
const char | nx_build_date []
| Date at which the system is built (defined in build_version.c).
const char | nx_build_fhost []
| Version of extra fhost component (defined in build_version.c).
## MAC HW version
#define | NX_MAC_HE (NX_MAC_VER >= 20)
| MAC version.
#define | NX_RX_RING (NX_MAC_VER >= 21)
| Flag indicating if the FW is compiled for a MAC HW implementing a RX ring buffer.
## General Configuration
Platform version
#define | NX_VIRT_DEV_MAX CFG_VIF_MAX
| Max number of virtual interfaces managed.
#define | NX_REMOTE_STA_MAX CFG_STA_MAX
| Max number of peer devices managed.
#define | NX_HEAP_SIZE (2048 + 2048 * NX_UMAC_PRESENT + 256 * NX_VIRT_DEV_MAX + 64 * NX_REMOTE_STA_MAX)
| Heap size.
#define | NX_EMB 1
| Code compiled for EMB platform.
## Beacon Configuration
#define | NX_BEACONING 1
| Beaconing support.
#define | NX_BCN_AUTONOMOUS_TX 1
| Autonomous beacon transmission support.
#define | NX_BCNFRAME_LEN 512
| Maximum size of a beacon frame.
## Power Save Configuration
#define | NX_UAPSD 1
| UAPSD support.
#define | NX_DPSM 1
| DPSM support.
#define | NX_POWERSAVE 1
| Legacy power save support.
## HE Configuration
#define | NX_HE 0
| HE Support.
## VHT Configuration
#define | NX_VHT 0
| VHT Support.
## A-MSDU Configuration
#define | NX_AMSDU_TX 1
| Define the A-MSDU option for TX.
#define | NX_TX_PAYLOAD_MAX 6
| Number of payloads per TX descriptor.
## A-MPDU Configuration
Maximum size of A-MSDU supported in reception
#define | NX_AMPDU_TX 1
| A-MPDU TX support.
#define | NX_MAX_BA_TX CFG_BATX
| Maximum number of TX Block Ack.
#define | NX_REORD CFG_BARX
| RX Packet Reordering support.
#define | NX_REORD_BUF_SIZE CFG_REORD_BUF
| RX Packet Reordering Buffer Size.
#define | NX_AMSDU_DEAGG 0
| A-MSDU de-aggregation support.
## BeamForming Configuration
#define | RW_BFMEE_EN 0
| Beamformee support.
#define | RW_BFMER_EN 0
| Beamformee support.
#define | RW_BFR_TXFRAME_CNT 0
| Beamformee support.
#define | RW_USER_MAX CFG_MU_CNT
| Number of users supported.
#define | RW_MUMIMO_TX_EN (RW_USER_MAX > 1)
| MU-MIMO TX support.
#define | RW_MUMIMO_SEC_USER1_EN (RW_USER_MAX > 1)
| Support for up to one secondary user.
#define | RW_MUMIMO_SEC_USER2_EN (RW_USER_MAX > 2)
| Support for up to two secondary users.
#define | RW_MUMIMO_SEC_USER3_EN (RW_USER_MAX > 3)
| Support for up to three secondary users.
#define | RW_MUMIMO_RX_EN 0
| MU-MIMO RX support.
## P2P Configuration
#define | NX_P2P 1
| P2P support.
#define | NX_P2P_VIF_MAX CFG_P2P
| Maximum number of simultaneous P2P connections.
#define | NX_P2P_GO 1
| P2P GO Support.
## MESH Configuration
#define | RW_MESH_EN (1)
| Wireless Mesh Networking support.
#define | RW_UMESH_EN (NX_UMAC_PRESENT)
| UMAC support for MESH.
#define | RW_MESH_VIF_NB (CFG_MESH_VIF)
| Maximum Number of.
#define | RW_MESH_LINK_NB (CFG_MESH_LINK)
| Maximum number of MESH link.
#define | RW_MESH_PATH_NB (CFG_MESH_PATH)
| Maximum number of MESH path.
#define | RW_MESH_PROXY_NB (CFG_MESH_PROXY)
| Maximum number of MESH proxy.
## TX Configuration
#define | NX_TX_MPDU_SPACING CFG_SPC
| Minimal MPDU spacing we support in TX.
#define | NX_TXQ_CNT (AC_MAX + NX_BEACONING)
| Number of TX queues in the LMAC.
#define | NX_TXDESC_CNT0 CFG_TXDESC0
| Number of TX descriptors available in the system (BK).
#define | NX_TXDESC_CNT1 CFG_TXDESC1
| Number of TX descriptors available in the system (BE).
#define | NX_TXDESC_CNT2 CFG_TXDESC2
| Number of TX descriptors available in the system (VI).
#define | NX_TXDESC_CNT3 CFG_TXDESC3
| Number of TX descriptors available in the system (VO).
#define | NX_TXDESC_CNT4 CFG_TXDESC4
| Number of TX descriptors available in the system (BCN).
#define | NX_TXFRAME_CNT (NX_VIRT_DEV_MAX + RW_BFR_TXFRAME_CNT)
| Number of TX frame descriptors and buffers available for frames generated internally.
#define | NX_TXFRAME_CNT 2
| Number of TX frame descriptors and buffers available for frames generated internally.
#define | NX_TXFRAME_LEN 384
| Maximum size of a TX frame generated internally.
#define | NX_DEFAULT_TX_CREDIT_CNT 4
| Number of TX flow control credits allocated by default per RA/TID (UMAC only).
## RX Configuration
#define | NX_RX_PAYLOAD_LEN 512
| RX Payload buffer size.
#define | NX_RX_LONG_MPDU_CNT 2
| Maximum number of the longest A-MSDUs that can be stored at the same time.
#define | NX_RX_PAYLOAD_DESC_CNT ((RWNX_MAX_AMSDU_RX / NX_RX_PAYLOAD_LEN) * NX_RX_LONG_MPDU_CNT + 1)
| Number of RX payload descriptors - defined to be n times the maximum A-MSDU size plus one extra one used for HW flow control.
#define | NX_RXDESC_CNT NX_RX_PAYLOAD_DESC_CNT
| Number of RX descriptors (SW and Header descriptors).
#define | NX_DMADESC_PER_RX_PDB_CNT 1
| Number of platform DMA descriptors in each RX payload descriptor.
## Radar Configuration
#define | NX_RADAR_DETECT 1
| Radar enable software define.
#define | RW_RADAR_EN 1
| Radar enable hardware define (i.e. used in registers file).
## Unsupported HT Frame Logging Configuration
#define | NX_UF_EN 0
## Monitor + Data interface Support
#define | NX_MON_DATA 0
## Debug Configuration
#define | NX_DEBUG_DUMP 0
| Debug dump forwarding.
#define | NX_DEBUG_DUMP_KEY 0
| Debug key RAM forwarding.
#define | NX_DEBUG CFG_DBG
| Debug support.
#define | NX_PRINT NX_PRINT_NONE
| Debug print output.
#define | NX_TRACE 1
| Trace Buffer Support.
#define | NX_PROFILING_ON 1
| Profiling support.
#define | NX_SYS_STAT 0
| System statistics support.
## Extra Configuration
#define | NX_RECOVERY 0
| Recovery support.
#define | NX_CONNECTION_MONITOR 1
| Connection monitoring support.
#define | NX_MULTI_ROLE 1
| Multi-role support (AP+STA, STA+STA).
#define | NX_HW_SCAN 1
| HW scan support.
#define | NX_MFP 1
| MFP support (for UMAC only).
#define | RW_WAPI_EN 1
| WAPI support.
#define | RW_WLAN_COEX_EN 0
| WLAN coexistence support.
#define | NX_KEY_RAM_CONFIG 0
| Compilation for a HW supporting Key RAM configuration.
#define | NX_TDLS 1
| TDLS support.
#define | NX_BW_LEN_ADAPT 1
| per-BW length adaptation support
#define | NX_BW_LEN_STEPS 4
| Number of steps for BW length adaptation.
#define | NX_HSU (CFG_HSU)
| HSU support.
#define | RW_HSU_SHA_EN 1
| Recovery support.
#define | NX_ANT_DIV 1
| Antenna Diversity support.
#define | NX_TG 0
| Traffic generator support.
#define | NX_FHOST_MONITOR 0
| Monitor mode support.
#define | NX_SMARTCONFIG 0
| Smartconfig support.
#define | NX_CRYPTOLIB 0
| External crypto lib compiled.
## Fw Features Configuration
Features automatically enabled if required by the selected configuration
#define | NX_CHNL_CTXT (NX_HW_SCAN || NX_P2P)
| Channel Contexts support.
#define | NX_CHAN_CTXT_CNT 3
| Maximum number of operating channel contexts.
#define | NX_GP_DMA (NX_CHNL_CTXT || NX_BCN_AUTONOMOUS_TX || NX_RADAR_DETECT || RW_BFMER_EN)
| General Purpose DMA module.
#define | NX_RX_FRAME_HANDLING (NX_POWERSAVE || NX_CONNECTION_MONITOR || NX_UMAC_PRESENT || RW_BFMER_EN)
| Internal handling of received frame.
#define | NX_TX_FRAME (NX_POWERSAVE || NX_CONNECTION_MONITOR || NX_CHNL_CTXT || NX_BCN_AUTONOMOUS_TX || RW_BFMER_EN)
| Internal frame generation support.
#define | NX_TD_STA (RW_BFMER_EN || NX_TDLS || NX_MAC_HE)
| Traffic Detection per STA support.
#define | NX_TD (NX_DPSM || NX_CHNL_CTXT || NX_P2P_GO || NX_TD_STA)
| Traffic Detection support.
#define | NX_MM_TIMER (NX_MULTI_ROLE || NX_CHNL_CTXT || NX_DPSM || NX_P2P || NX_UAPSD || RW_BFMER_EN | NX_BEACONING)
| MAC Management timer support.
## Misc
#define | NX_11AX_DRAFT_2_0 0
| Implement IEEE802.11ax-D2.0 (instead of D3.2).
#define | RW_NX_LDPC_DEC 1
| This macro appears in some generated header files, define it to avoid warning.
#define | RW_NX_AGC_SNR_EN 1
| This macro appears in some generated header files, define it to avoid warning.
#define | RW_NX_IQ_COMP_EN 1
| This macro appears in some generated header files, define it to avoid warning.
#define | RW_NX_FIQ_COMP_EN 1
| This macro appears in some generated header files, define it to avoid warning.
#define | RW_NX_DERIV_80211B 1
| This macro appears in some generated header files, define it to avoid warning.
#define | RW_KEY_EXTENDED 1
| This macro appears in some generated header files, define it to avoid warning.

## Detailed Description

RW-WLAN-nX root module.

Versioning.

The CFG_xxx macros should be added on the compilation command line by the SCons scripts.

Because it has been not implemented yet, any undefined option fall back on the default behavior.

## Define Documentation

#define NX_HSU (CFG_HSU)

HSU support.

Possible values are:

- 0: Don't use HSU, use software implementation.
- 1: Use HSU and fallback to software implementation if not available.
- 2: Only use HSU. (runtime error is generated if HSU is not available)

Definition at line 734 of file rwnx_config.h.

#define NX_MAC_HE (NX_MAC_VER >= 20)

MAC version.

Flag indicating if the FW is compiled for a MAC HW supporting HE

Definition at line 97 of file rwnx_config.h.

#define NX_VERSION

Value:

    ((NX_VERSION_MAJ << 24) | (NX_VERSION_MIN << 16) |             \
                               (NX_VERSION_REL << 8) | NX_VERSION_PAT)

Version word.

Definition at line 40 of file version.h.

Referenced by mm_version_req_handler().

#define NX_VIRT_DEV_MAX CFG_VIF_MAX

Max number of virtual interfaces managed.

MAC HW is limited to 6, but the LMAC assumes that this number is a power of 2, thus only 1, 2 or 4 are allowed

Definition at line 151 of file rwnx_config.h.

Referenced by chan_reset_tbtt_list(), chan_start_p2pgo_noa(), mm_remove_if_req_handler(), mm_set_p2p_noa_req_handler(), mm_set_p2p_oppps_req_handler(), mm_version_req_handler(), rxu_cntrl_spurious_check(), and tpc_set_vif_tx_power().

## Function Documentation

bool rwnxl_cpu_can_sleep | ( | void |  | ) |

This function checks if any kernel event is pending in the MAC SW.

If no event is pending, the CPU clock could be gated.

Returns:
  true if the CPU can be put in sleep, false otherwise.

void rwnxl_reset_evt | ( | int | dummy | ) |

NX reset event handler.

This function is part of the recovery mechanism invoked upon an error detection in the LMAC. It performs the full LMAC reset, and restarts the operation.

Parameters:

  `[in]` | dummy | Parameter not used but required to follow the kernel event callback format

void rwnxl_sleep | ( | void |  | ) |

This function performs the required checks prior to go to DOZE mode.

If all these checks pass, then the MAC HW is put in DOZE mode.

void rwnxl_start | ( | void |  | ) |

Start the MAC SW.

Start processing wifi event in an endless loop (or the RTOS scheduler). It doesn't returns.

Referenced by main().