nrfxlib API 2.7.99
Loading...
Searching...
No Matches
nrf_gzll.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
12#ifndef NRF_GZLL_H__
13#define NRF_GZLL_H__
14
15#include <stdbool.h>
16#include "nrf.h"
17#include "nrf_gzll_constants.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23
34typedef enum
35{
40
46typedef enum
47{
51
56typedef enum
57{
71#ifdef NRF51
72 NRF_GZLL_TX_POWER_N30_DBM
73#else
75#endif
77
82typedef enum
83{
84#ifdef NRF51
85 NRF_GZLL_DATARATE_250KBIT = 0,
86#endif
92
99typedef enum
100{
104
109typedef enum
110{
130
136typedef struct
137{
141 int8_t rssi;
142 uint8_t rf_channel;
144
145
151typedef struct
152{
154 int8_t rssi;
155 uint8_t rf_channel;
157
158
159typedef struct
160{
161 uint32_t packets_num;
162 uint32_t timeouts_num;
163 uint32_t channel_timeouts[NRF_GZLL_CONST_MAX_CHANNEL_TABLE_SIZE];
164 uint32_t channel_packets[NRF_GZLL_CONST_MAX_CHANNEL_TABLE_SIZE];
166
167
169typedef void (*nrf_gzll_tx_timeout_callback)(uint32_t pipe, uint8_t rf_channel);
170
171
173typedef void (*nrf_gzll_crc_failure_callback)(uint32_t pipe, uint8_t rf_channel);
174
175
178
179
180#if defined(NRF52_SERIES) || defined(__SDK_DOXYGEN__)
185typedef struct
186{
187 bool pa_enabled;
188 bool pa_active_high;
189 uint8_t pa_gpio_pin;
190 uint8_t pa_gpiote_channel;
191 bool lna_enabled;
192 bool lna_active_high;
193 uint8_t lna_gpio_pin;
194 uint8_t lna_gpiote_channel;
195 NRF_TIMER_Type * timer;
196 uint8_t ppi_channels[NRF_GZLL_PA_LNA_PPI_CHANNELS_NUM];
197 uint8_t ramp_up_time;
198} nrf_gzll_pa_lna_cfg_t;
199#endif
200
201/******************************************************************************/
204/******************************************************************************/
205
215
226
240
247
250/******************************************************************************/
253/******************************************************************************/
254
267
280
283/******************************************************************************/
286/******************************************************************************/
287
298
301/******************************************************************************/
304/******************************************************************************/
305
314
322
325/******************************************************************************/
328/******************************************************************************/
329
344bool nrf_gzll_add_packet_to_tx_fifo(uint32_t pipe, uint8_t const * p_payload, uint32_t length);
345
357bool nrf_gzll_fetch_packet_from_rx_fifo(uint32_t pipe, uint8_t * p_payload, uint32_t * p_length);
358
368
377
387
400
414bool nrf_gzll_flush_tx_fifo(uint32_t pipe);
415
426bool nrf_gzll_flush_rx_fifo(uint32_t pipe);
427
436
441
450bool nrf_gzll_get_channel_timeouts(uint8_t channel_index, uint32_t *p_timeouts);
451
456
459/******************************************************************************/
468/******************************************************************************/
469
474
475
480
481
496
503
522bool nrf_gzll_set_base_address_0(uint32_t base_address);
523
530
541bool nrf_gzll_set_base_address_1(uint32_t base_address);
542
549
565bool nrf_gzll_set_address_prefix_byte(uint32_t pipe, uint8_t address_prefix_byte);
566
579bool nrf_gzll_get_address_prefix_byte(uint32_t pipe, uint8_t * p_out_address_prefix_byte);
580
594bool nrf_gzll_set_rx_pipes_enabled(uint32_t pipes);
595
602
620bool nrf_gzll_set_timeslot_period(uint32_t period_us);
621
628
652
659
679bool nrf_gzll_set_timeslots_per_channel(uint32_t timeslots);
680
687
708
716
728bool nrf_gzll_set_sync_lifetime(uint32_t lifetime);
729
736
748void nrf_gzll_set_max_tx_attempts(uint16_t max_tx_attempts);
749
756
772bool nrf_gzll_set_channel_table(uint8_t * p_channel_table, uint32_t size);
773
786bool nrf_gzll_get_channel_table(uint8_t * p_channel_table, uint32_t * p_size);
787
794
804
811
821
828
849
856
863void nrf_gzll_set_auto_disable(uint32_t num_ticks);
864
865#if defined(NRF52_SERIES) || defined(__SDK_DOXYGEN__)
871bool nrf_gzll_set_pa_lna_cfg(nrf_gzll_pa_lna_cfg_t const * p_pa_lna_cfg);
872#endif
873
882
889
900
903/******************************************************************************/
906/******************************************************************************/
907
914
915
922
927#ifdef __cplusplus
928}
929#endif
930
931#endif
void nrf_gzll_device_tx_failed(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
Transmission failed callback (Device mode only).
void nrf_gzll_host_rx_data_ready(uint32_t pipe, nrf_gzll_host_rx_info_t rx_info)
Data packet received callback (Host mode only).
uint32_t nrf_gzll_get_timeslots_per_channel_when_device_out_of_sync(void)
Get function counterpart to nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync().
bool nrf_gzll_get_channel_timeouts(uint8_t channel_index, uint32_t *p_timeouts)
Function for obtaining number of transmission timeouts for specific channel.
bool nrf_gzll_set_xosc_ctl(nrf_gzll_xosc_ctl_t xosc_ctl)
Set whether start/stop of external oscillator (XOSC) shall be handled automatically inside Gazell or ...
bool nrf_gzll_set_sync_lifetime(uint32_t lifetime)
Set the number of timeslots after a successful reception of a Device or Host packet that the Gazell L...
void nrf_gzll_disable(void)
Disable Gazell.
nrf_gzll_mode_t
Enumerator used for selecting Gazell mode.
Definition: nrf_gzll.h:35
@ NRF_GZLL_MODE_SUSPEND
Suspend mode ("disabled with timer running")
Definition: nrf_gzll.h:38
@ NRF_GZLL_MODE_HOST
Host mode.
Definition: nrf_gzll.h:37
@ NRF_GZLL_MODE_DEVICE
Device mode.
Definition: nrf_gzll.h:36
bool nrf_gzll_set_channel_table(uint8_t *p_channel_table, uint32_t size)
Set the table of Radio Frequency (RF) channels.
void nrf_gzll_reset_tx_statistics(void)
Function for clearing transmission statistic structure.
bool nrf_gzll_set_datarate(nrf_gzll_datarate_t data_rate)
Set the radio datarate.
bool nrf_gzll_set_timeslot_period(uint32_t period_us)
Set the timeslot period.
uint32_t nrf_gzll_get_base_address_1(void)
Get function counterpart to nrf_gzll_set_base_address_1().
void nrf_gzll_set_auto_disable(uint32_t num_ticks)
Set Gazell to disable automatically after a certain number of timeslot ticks.
nrf_gzll_tx_power_t nrf_gzll_get_tx_power(void)
Get function counterpart to nrf_gzll_set_tx_power().
void nrf_gzll_mode_changed(void)
Mode changed callback.
uint32_t nrf_gzll_get_timeslot_period(void)
Get function counterpart to nrf_gzll_get_timeslot_period().
nrf_gzll_xosc_ctl_t
Enumerator used for specifying whether switching the external high frequency oscillator on/off shall ...
Definition: nrf_gzll.h:100
@ NRF_GZLL_XOSC_CTL_AUTO
Switch XOSC on/off automatically.
Definition: nrf_gzll.h:101
@ NRF_GZLL_XOSC_CTL_MANUAL
Switch XOSC on/off manually.
Definition: nrf_gzll.h:102
bool nrf_gzll_set_tx_power(nrf_gzll_tx_power_t tx_power)
Set the radio TX power.
void nrf_gzll_crc_failure_callback_register(nrf_gzll_crc_failure_callback callback)
Function for registering callback to be called on the packet CRC failure.
bool nrf_gzll_set_device_channel_selection_policy(nrf_gzll_device_channel_selection_policy_t policy)
Set the Device channel selection policy.
bool nrf_gzll_ok_to_add_packet_to_tx_fifo(uint32_t pipe)
Check if adding a packet to a pipe's TX FIFO should be successful.
void nrf_gzll_disabled(void)
Disabled callback.
uint32_t nrf_gzll_get_total_allocated_packet_count(void)
Get the total number of packets residing in all TX and RX FIFOs.
void nrf_gzll_clear_tick_count(void)
Clear the internal timeslot tick count variable that is read by nrf_gzll_get_tick_count().
bool nrf_gzll_set_rx_pipes_enabled(uint32_t pipes)
Set which pipes shall listen for packets in Host mode.
uint32_t nrf_gzll_get_timeslots_per_channel(void)
Get function counterpart to nrf_gzll_set_timeslots_per_channel().
nrf_gzll_device_channel_selection_policy_t nrf_gzll_get_device_channel_selection_policy(void)
Get function counterpart to nrf_gzll_set_device_channel_selection_policy().
nrf_gzll_tx_power_t
Enumerator used for selecting the transmit (TX) power.
Definition: nrf_gzll.h:57
@ NRF_GZLL_TX_POWER_N8_DBM
-8 dBm transmit power.
Definition: nrf_gzll.h:67
@ NRF_GZLL_TX_POWER_N20_DBM
-20 dBm transmit power.
Definition: nrf_gzll.h:70
@ NRF_GZLL_TX_POWER_4_DBM
4 dBm transmit power.
Definition: nrf_gzll.h:62
@ NRF_GZLL_TX_POWER_5_DBM
5 dBm transmit power.
Definition: nrf_gzll.h:61
@ NRF_GZLL_TX_POWER_0_DBM
0 dBm transmit power.
Definition: nrf_gzll.h:65
@ NRF_GZLL_TX_POWER_3_DBM
3 dBm transmit power.
Definition: nrf_gzll.h:63
@ NRF_GZLL_TX_POWER_8_DBM
8 dBm transmit power.
Definition: nrf_gzll.h:58
@ NRF_GZLL_TX_POWER_6_DBM
6 dBm transmit power.
Definition: nrf_gzll.h:60
@ NRF_GZLL_TX_POWER_7_DBM
7 dBm transmit power.
Definition: nrf_gzll.h:59
@ NRF_GZLL_TX_POWER_N16_DBM
-16 dBm transmit power.
Definition: nrf_gzll.h:69
@ NRF_GZLL_TX_POWER_N12_DBM
-12 dBm transmit power.
Definition: nrf_gzll.h:68
@ NRF_GZLL_TX_POWER_2_DBM
2 dBm transmit power.
Definition: nrf_gzll.h:64
@ NRF_GZLL_TX_POWER_N40_DBM
-40 dBm transmit power.
Definition: nrf_gzll.h:74
@ NRF_GZLL_TX_POWER_N4_DBM
-4 dBm transmit power.
Definition: nrf_gzll.h:66
bool nrf_gzll_flush_tx_fifo(uint32_t pipe)
Flush the RX FIFO for a specific pipe.
bool nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync(uint32_t timeslots)
Set the number of timeslots that a Gazell shall reside on a single channel before switching to anothe...
void(* nrf_gzll_tick_timer_expired_callback)(void)
Definition: nrf_gzll.h:177
bool nrf_gzll_set_address_prefix_byte(uint32_t pipe, uint8_t address_prefix_byte)
Set the address prefix byte for a specific pipe.
void nrf_gzll_tx_statistics_disable(void)
Function for disabling transmission statistics.
nrf_gzll_xosc_ctl_t nrf_gzll_get_xosc_ctl(void)
nrf_gzll_error_code_t
Enumerator used for error codes for Gazell API functions.
Definition: nrf_gzll.h:110
@ NRF_GZLL_ERROR_CODE_INTERNAL_ASSERT_OCCURRED
An internal assert occurred.
Definition: nrf_gzll.h:125
@ NRF_GZLL_ERROR_CODE_CALLBACK_NOT_IMPLEMENTED
A callback was called but not implemented by the application.
Definition: nrf_gzll.h:126
@ NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_CONFIGURE_WHEN_ENABLED
A call to a configuration 'set' function was made while Gazell was enabled.
Definition: nrf_gzll.h:113
@ NRF_GZLL_ERROR_CODE_FAILED_TO_INITIALIZE
The function NRF_GZLL_init failed.
Definition: nrf_gzll.h:112
@ NRF_GZLL_ERROR_CODE_INVALID_MODE
An invalid value for the nrf_gzll_mode_t enumerator was given as input to a function.
Definition: nrf_gzll.h:116
@ NRF_GZLL_ERROR_CODE_NO_SPACE_IN_RX_FIFO_FOR_ACK
There is insufficient space in the RX FIFO for the ACK.
Definition: nrf_gzll.h:121
@ NRF_GZLL_ERROR_CODE_INSUFFICIENT_PACKETS_AVAILABLE
There are insufficient packets in the Gazell memory pool to successfully execute the operation.
Definition: nrf_gzll.h:119
@ NRF_GZLL_ERROR_CODE_INVALID_PAYLOAD_LENGTH
An invalid payload length was given as an input to a function.
Definition: nrf_gzll.h:117
@ NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_ADD_TO_FULL_FIFO
There is insufficient space in the TX FIFO for the data packet.
Definition: nrf_gzll.h:120
@ NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_FETCH_FROM_EMPTY_FIFO
Attempted to fetch a packet from an empty FIFO. Use the functions nrf_gzll_get_tx_fifo_packet_count()...
Definition: nrf_gzll.h:122
@ NRF_GZLL_ERROR_CODE_INVALID_PIPE
An invalid pipe number was given as an input to a function.
Definition: nrf_gzll.h:115
@ NRF_GZLL_ERROR_CODE_INVALID_CHANNEL_TABLE_SIZE
An invalid channel table size was given as an input to a function.
Definition: nrf_gzll.h:118
@ NRF_GZLL_ERROR_CODE_NO_ERROR
No error has been detected.
Definition: nrf_gzll.h:111
@ NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_FLUSH_WHEN_ENABLED
Attempted to fetch a packet from an empty FIFO. Use the functions nrf_gzll_get_tx_fifo_packet_count()...
Definition: nrf_gzll.h:123
@ NRF_GZLL_ERROR_CODE_NUMBER_OF_ERROR_CODES
Number of possible error codes.
Definition: nrf_gzll.h:128
@ NRF_GZLL_ERROR_CODE_POINTER_IS_NULL
A null pointer was given as an input to a function.
Definition: nrf_gzll.h:114
@ NRF_GZLL_ERROR_CODE_INVALID_ADDRESS
Invalid pipe 0 address detected, see Anomaly 107 at nRF52832 errata document.
Definition: nrf_gzll.h:127
@ NRF_GZLL_ERROR_CODE_INVALID_PARAMETER
Attempted to set a variable which was not valid.
Definition: nrf_gzll.h:124
uint32_t nrf_gzll_get_tick_count(void)
Get the number of timeslot ticks that have occurred since nrf_gzll_init() was called.
bool nrf_gzll_get_channel_table(uint8_t *p_channel_table, uint32_t *p_size)
Get the table of Radio Frequency (RF) channels.
bool nrf_gzll_set_mode(nrf_gzll_mode_t mode)
Set the mode.
int32_t nrf_gzll_get_tx_fifo_packet_count(uint32_t pipe)
Get the number of packets in the TX FIFO on a specific pipe.
uint32_t nrf_gzll_get_base_address_0(void)
Get function counterpart to nrf_gzll_set_base_address_0().
bool nrf_gzll_is_enabled(void)
nrf_gzll_error_code_t nrf_gzll_get_error_code(void)
Gets the Gazell error code.
void(* nrf_gzll_tx_timeout_callback)(uint32_t pipe, uint8_t rf_channel)
Definition: nrf_gzll.h:169
bool nrf_gzll_add_packet_to_tx_fifo(uint32_t pipe, uint8_t const *p_payload, uint32_t length)
Add a packet to the tail of the TX FIFO.
nrf_gzll_datarate_t
Enumerator used for selecting the radio datarate.
Definition: nrf_gzll.h:83
@ NRF_GZLL_DATARATE_1MBIT
1 Mbps datarate.
Definition: nrf_gzll.h:87
@ NRF_GZLL_DATARATE_2MBIT
2 Mbps datarate.
Definition: nrf_gzll.h:88
@ NRF_GZLL_DATARATE_2MBIT_BLE
2 Mbps datarate. BLE.
Definition: nrf_gzll.h:90
@ NRF_GZLL_DATARATE_1MBIT_BLE
1 Mbps datarate. BLE.
Definition: nrf_gzll.h:89
uint32_t nrf_gzll_get_sync_lifetime(void)
Get function counterpart to nrf_gzll_set_sync_lifetime().
void nrf_gzll_device_tx_success(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
ACK received callback (Device mode only).
uint32_t nrf_gzll_get_rx_pipes_enabled(void)
Get function counterpart to nrf_gzll_set_rx_pipes_enabled().
bool nrf_gzll_tx_statistics_enable(nrf_gzll_tx_statistics_t *p_statistics)
Function for enabling transmission statistics.
void nrf_gzll_tx_timeout_callback_register(nrf_gzll_tx_timeout_callback callback)
Function for registering callback to be called on the transmission timeout.
nrf_gzll_datarate_t nrf_gzll_get_datarate(void)
Get function counterpart to nrf_gzll_set_datarate().
bool nrf_gzll_init(nrf_gzll_mode_t mode)
Initialize Gazell.
nrf_gzll_device_channel_selection_policy_t
Enumerator used for selecting Gazell Device channel selection policy.
Definition: nrf_gzll.h:47
@ NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_SUCCESSFUL
Start on previous successful channel.
Definition: nrf_gzll.h:48
@ NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_CURRENT
Start on channel currently monitored by Host.
Definition: nrf_gzll.h:49
uint32_t nrf_gzll_get_channel_table_size(void)
Get the current channel table size.
bool nrf_gzll_set_base_address_0(uint32_t base_address)
Set the base address for pipe 0.
bool nrf_gzll_fetch_packet_from_rx_fifo(uint32_t pipe, uint8_t *p_payload, uint32_t *p_length)
Fetch a packet from the head of the RX FIFO.
int32_t nrf_gzll_get_rx_fifo_packet_count(uint32_t pipe)
Get the number of packets in the RX FIFO on a specific pipe.
void(* nrf_gzll_crc_failure_callback)(uint32_t pipe, uint8_t rf_channel)
Definition: nrf_gzll.h:173
bool nrf_gzll_enable(void)
Enable Gazell.
bool nrf_gzll_get_address_prefix_byte(uint32_t pipe, uint8_t *p_out_address_prefix_byte)
Get function counterpart to nrf_gzll_set_address_prefix_byte().
void nrf_gzll_reset_error_code(void)
Reset the Gazell error code.
nrf_gzll_mode_t nrf_gzll_get_mode(void)
Get function counterpart to nrf_gzll_set_mode().
void nrf_gzll_set_max_tx_attempts(uint16_t max_tx_attempts)
Set the maximum number of TX attempts that can be used for a single packet.
bool nrf_gzll_flush_rx_fifo(uint32_t pipe)
Flush the RX FIFO for a specific pipe.
bool nrf_gzll_set_timeslots_per_channel(uint32_t timeslots)
Set the number of timeslots that Gazell shall reside on a single channel before switching to another ...
uint16_t nrf_gzll_get_max_tx_attempts(void)
Get function counterpart to nrf_gzll_set_max_tx_attempts().
bool nrf_gzll_set_base_address_1(uint32_t base_address)
Set the base address for pipes 1-7.
bool nrf_gzll_set_tick_timer(uint32_t num_ticks, nrf_gzll_tick_timer_expired_callback callback)
Set a timeslot tick timer.
#define NRF_GZLL_CONST_MAX_CHANNEL_TABLE_SIZE
Maximum channel table size allowed by Gazell.
Definition: nrf_gzll_constants.h:87
#define NRF_GZLL_PA_LNA_PPI_CHANNELS_NUM
Number of PPI channels used for front end control.
Definition: nrf_gzll_constants.h:134
Gazell Link Layer constants and default values.
int8_t rssi
Received signal strength indicator in dBm.
Definition: nrf_gzll.h:141
uint16_t num_channel_switches
Number of channel switches needed during previous packet transmission.
Definition: nrf_gzll.h:140
uint16_t num_tx_attempts
Number of attempts used on previous Device packet transmission.
Definition: nrf_gzll.h:139
bool payload_received_in_ack
A payload was received in the ACK.
Definition: nrf_gzll.h:138
uint8_t rf_channel
Channel on which packet has been transmitted.
Definition: nrf_gzll.h:142
Data structure containing information about the last packet transmission.
Definition: nrf_gzll.h:137
bool packet_removed_from_tx_fifo
A payload was received in the ACK.
Definition: nrf_gzll.h:153
int8_t rssi
Received signal strength indicator in dBm.
Definition: nrf_gzll.h:154
uint8_t rf_channel
Channel on which packet has been received.
Definition: nrf_gzll.h:155
Data structure containing information about the last packet received.
Definition: nrf_gzll.h:152
uint32_t packets_num
Number of succesfully transmitted packets.
Definition: nrf_gzll.h:161
uint32_t timeouts_num
Total timeouts number.
Definition: nrf_gzll.h:162
Definition: nrf_gzll.h:160