wps_def.h

Wireless Protocol Stack definitions used by multiple modules.

Copyright

Copyright (C) 2020 SPARK Microsystems International Inc. All rights reserved.

License

This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.

Author

SPARK FW Team.

Defines

WPS_RADIO_COUNT 1

WPS radio count

WPS_RADIO_FIFO_SIZE 128

WPS radio FIFO size

WPS_RADIO_HEADER_SIZE sizeof(wps_mac_frame_header_t)

WPS radio header size

WPS_PHASES_SYNC_HEADER 3

WPS Header size when ranging is activated

WPS_AUTO_REPLY_PHASES_HEADER 5

WPS Auto reply connection header size when ranging is activated

WPS_MAX_PAYLOAD_SIZE WPS_RADIO_FIFO_SIZE - WPS_RADIO_HEADER_SIZE - 1

WPS MAX supported payload size

WPS_NB_RF_CHANNEL 5

Number of RF channels

WPS_CONNECTION_THROTTLE_GRANULARITY 20

WPS throttle ratio granularity (100 / value)

WPS_REQUEST_MEMORY_SIZE 5

WPS request queue size

Typedefs

typedef struct wps_connection wps_connection_t

WPS Connection.

typedef struct wps_stats wps_stats_t

WPS statistics function.

typedef enum wps_role wps_role_t

WPS role enumeration.

typedef struct wps_radio wps_radio_t

Wireless Protocol Stack radio.

Note

This is the parameter to setup one radio instance.

typedef struct node wps_node_t

WPS Node definition.

Note

This is the parameters used to setup on node instance. One node can contains multiple radio.

typedef struct rx_frame wps_rx_frame

Received frame.

typedef struct wps_internal_connection_cfg wps_internal_connection_cfg_t

L2 internal connection config structure.

Note

As of right now, only one protocol (RDO) is activated in the internal connection. The buffer size should be set to at least 2.

typedef enum wps_request wps_request_t

WPS request type enumeration.

typedef struct wps_schedule_ratio_cfg wps_schedule_ratio_cfg_t

WPS schedule request configuration.

typedef struct wps_write_request_info wps_write_request_info_t

WPS write register request info structure.

typedef struct wps_read_request_info wps_read_request_info_t

WPS read register request info structure.

typedef struct wps_request_info wps_request_info_t

WPS request structure configuration.

Note

Available choice for configuration structure are

  • wps_schedule_ratio_cfg_t

  • wps_write_request_info_t

  • wps_read_request_info_t

typedef void (*wps_callback_t)(wps_connection_t *connection)

WPS events callback.

Enums

enum wps_role

WPS role enumeration.

Values:

enumerator NETWORK_COORDINATOR = 0

Coordinator dictate the time to the whole network

enumerator NETWORK_NODE

Node re-adjust its timer to stay in sync

enum wps_request

WPS request type enumeration.

Values:

enumerator REQUEST_NONE = 0

No request

enumerator REQUEST_MAC_CHANGE_SCHEDULE_RATIO

Request allowing application to change active timeslot ratio

enumerator REQUEST_PHY_WRITE_REG

Request allowing application to write to a register

enumerator REQUEST_PHY_READ_REG

Request allowing application to read a register

struct wps_stats
#include <wps_def.h>

WPS statistics function.

Public Members

uint32_t tx_sent

Number of payload sent

uint32_t tx_byte_sent

Number of byte sent

uint32_t tx_dropped

Number of payload dropped

uint32_t rx_received

Number of payload received

uint32_t rx_byte_received

Number of byte received

uint32_t rx_overrun

Number of payload dropped because of an RX buffer overrun

uint32_t cca_pass

Number of CCA TX abort

uint32_t cca_fail

Number of CCA TX anyway

struct wps_connection
#include <wps_def.h>

WPS Connection.

Public Members

uint16_t source_address

Source address

uint16_t destination_address

Destination address

bool fixed_payload_size_enable

Fixed payload size enable flag (necessary for Frames lager than RX FIFO)

uint8_t fixed_payload_size

Frame size (only used if fixed frame size mode is enabled)

wps_error_t wps_error

WPS error

bool phases_exchange

Send phases data in the header to other device

bool ack_enable

Ack received frame or expect ack when sending frame

bool auto_sync_enable

Auto sync mode enable flag

bool internal_connection

Enable/disable L2 internal connection.

uint8_t header_size

Header size in bytes

Internal connection protocol

Internal connection Random Datarate Offset (RDO) instances.

saw_arq_t stop_and_wait_arq

Stop and Wait (SaW) and Automatic Repeat Query (ARQ)

link_cca_t cca

Clear Channel Assessment

lqi_t lqi

Link quality indicator

lqi_t used_frame_lqi

WPS frames Link quality indicator (Excludes unused or sync timeslots)

lqi_t channel_lqi[WPS_NB_RF_CHANNEL]

Channel frames Link quality indicator

wps_stats_t wps_stats

Wireless protocol stack statistics

uint8_t pattern_count

Current pattern array index count

uint8_t active_ratio

Active timeslot ratio, in percent

uint8_t pattern_total_count

Total pattern array count based on reduced ratio fraction

bool *pattern

Pattern array pointer, need to be allocated by application and initialized to 1

gain_loop_t gain_loop[WPS_NB_RF_CHANNEL][WPS_RADIO_COUNT]

Gain loop

circular_queue_t xlayer_queue

Cross layer queue

frame_cfg_t frame_cfg

Connection frame config

sleep_lvl_t sleep_lvl

Connection sleep level

rf_channel_t channel[WPS_NB_RF_CHANNEL][WPS_RADIO_COUNT]

RF Channel information

packet_cfg_t packet_cfg

Packet configuration

void (*send_ack_callback_t)(wps_connection_t *connection)

Function called by the wps to indicate the frame has been acknowledged

void (*send_nack_callback_t)(wps_connection_t *connection)

Function called by the wps to indicate the frame has NOT been acknowledged

void (*receive_callback_t)(wps_connection_t *connection)

Function called by the wps to indicate the frame has been received

void (*error_callback_t)(wps_connection_t *connection)

Function called by the wps to indicate that an error has occurs

uint64_t (*get_tick_quarter_ms)(void)

Get free running timer tick in quarter ms

struct wps_radio
#include <wps_def.h>

Wireless Protocol Stack radio.

Note

This is the parameter to setup one radio instance.

Public Members

radio_t radio

Radio instance

radio_hal_t radio_hal

Radio HAL instance

calib_vars_t *spectral_calib_vars

Calibration variables

nvm_t *nvm

NVM variables

uint8_t *spi_rx_buffer

SPI TX transfer buffer

uint8_t *spi_tx_buffer

SPI TX transfer buffer

uint8_t spi_buffer_size

Radio TX/RX SPI buffer size, for SPI transfer queue

struct node
#include <wps_def.h>

WPS Node definition.

Note

This is the parameters used to setup on node instance. One node can contains multiple radio.

Public Members

wps_radio_t *radio

Wireless Protocol Stack radio

wps_role_t role

WPS role, Node or Coordinator

uint16_t local_address

Node address

syncword_cfg_t syncword_cfg

Radio(s) configuration syncword

uint32_t preamble_len

Radio(s) preamble lenght

uint8_t preamble_detection

Radio(s) preamble detection setting

uint8_t rx_gain

Radio(s) default rx gain

sleep_lvl_t sleep_lvl

Radio(s) sleep level

uint32_t crc_polynomial

Radio(s) crc polynomial

isi_mitig_t isi_mitig

Radio(s) ISI mitigation level

bool phase_offset_stats_enable

Phase offset enable flag

chip_rate_cfg_t chip_rate

Chip rate (SR1120 only)

struct rx_frame
#include <wps_def.h>

Received frame.

Public Members

uint8_t *payload

Pointer to payload

uint8_t size

Size of payload

struct wps_internal_connection_cfg
#include <wps_def.h>

L2 internal connection config structure.

Note

As of right now, only one protocol (RDO) is activated in the internal connection. The buffer size should be set to at least 2.

Public Members

uint8_t *buffer

Internal connection RX/TX buffer

uint8_t buffer_size

Internal connection buffer size

link_rdo_t *rdo_inst

Internal connection link rdo instance

bool *rdo_enable

Enable random datarate offset

uint16_t *rdo_rollover_value

Random datarate offset rollover value, u16

uint8_t rdo_num

Number of RDO use

struct wps_schedule_ratio_cfg
#include <wps_def.h>

WPS schedule request configuration.

Public Members

uint8_t active_ratio

Target connection current active ratio

uint8_t pattern_total_count

Target connection total pattern array size

uint8_t pattern_current_count

Target connection pattern index count

wps_connection_t *target_conn

Connection to change active timeslot ratio

circular_queue_t *pattern_queue

Pattern buffer queue

struct wps_write_request_info
#include <wps_def.h>

WPS write register request info structure.

Public Members

uint8_t target_register

Target register to write data

uint8_t data

Data to send to the radio register

bool pending_request

Flag to notify that a request is pending

struct wps_read_request_info
#include <wps_def.h>

WPS read register request info structure.

Public Members

uint8_t target_register

Target register to read.

uint8_t *rx_buffer

RX buffer containing register value

bool pending_request

Flag to notify that a request is pending

bool *xfer_cmplt

Bool to notify that read register is complete

struct wps_request_info
#include <wps_def.h>

WPS request structure configuration.

Note

Available choice for configuration structure are

  • wps_schedule_ratio_cfg_t

  • wps_write_request_info_t

  • wps_read_request_info_t

Public Members

void *config

WPS request structure configuration.

wps_request_t type

WPS request type enumeration