Microchip® Advanced Software Framework

lorawan_reg_params.h File Reference

Data Structures

struct  _TxParams
 
struct  BandDrReq_t
 
struct  MinMaxDr_t
 
struct  NewFreeChannelReq_t
 
struct  NewTxChannelReq_t
 
struct  Rx1WindowParams_t
 
struct  Rx1WindowParamsReq_t
 
struct  UpdateChId_t
 
struct  UpdateDutyCycle_t
 
struct  UpdateDutyCycleTimer_t
 
struct  UpdateJoinDutyCycleTimer_t
 
struct  UpdateNewCh_t
 
struct  ValChId_t
 
struct  ValChMaskCntl_t
 
struct  ValUpdateDrange_t
 
struct  ValUpdateFreqTx_t
 

Macros

#define ADR_ACK_DELAY   32
 
#define ADR_ACK_LIMIT   64
 
#define AGGREGATEDTIME_10HR   20
 
#define AGGREGATEDTIME_1HR   2
 
#define ALL_CHANNELS   1
 
#define BACKOFF_BASE_TIME_IN_MS   1800000
 
#define FCNT_MAX   (UINT32_MAX)
 
#define JOIN_ACCEPT_DELAY1   5000UL
 
#define JOIN_ACCEPT_DELAY2   6000UL
 
#define JOIN_BACKOFF_PRESCALAR_10HR   1000
 
#define JOIN_BACKOFF_PRESCALAR_1HR   100
 
#define JOIN_BACKOFF_PRESCALAR_24HR   10000
 
#define NUMBER_CFLIST_FREQUENCIES   5
 
#define RECEIVE_DELAY1   (1000UL)
 
#define RECEIVE_DELAY2   2000UL
 
#define RETRANSMIT_TIMEOUT   1000+(rand()%2001)
 
#define SIZE_JOIN_ACCEPT_WITH_CFLIST   33
 
#define WITHOUT_DEFAULT_CHANNELS   0
 

Typedefs

typedef enum _LORAWAN_ERR_ATTR_e LorawanErrAttr_t
 
typedef enum
_LorawanRegionalAttributes 
LorawanRegionalAttributes_t
 
typedef struct _TxParams TxParams_t
 

Enumerations

enum  _LORAWAN_ERR_ATTR_e {
  UNSUPPORTED_BAND = -((CHMASK_CHCNTL) + 2),
  INVLD_ATTR_CHMASK_CHCNTL = -((CHMASK_CHCNTL) + 1),
  INVLD_ATTR_DEF_TX_PWR,
  INVLD_ATTR_REG_DEF_TX_DATARATE,
  INVLD_ATTR_REG_DEF_TX_POWER,
  INVLD_ATTR_TX_PARAMS,
  INVLD_ATTR_DL_FREQUENCY,
  INVLD_ATTR_MIN_LBT_CHANNEL_PAUSE_TIMER,
  INVLD_ATTR_DEFAULT_LBT_PARAMS,
  INVLD_ATTR_CURRENT_CHANNEL_INDEX,
  INVLD_ATTR_FREE_CHANNEL,
  INVLD_ATTR_NEW_TX_CHANNEL_CONFIG,
  INVLD_ATTR_MAC_ADR_ACK_LIMIT,
  INVLD_ATTR_MAC_ADR_ACK_DELAY,
  INVLD_ATTR_MAC_RETRANSMIT_TIMEOUT,
  INVLD_ATTR_MAC_JOIN_ACCEPT_DELAY2,
  INVLD_ATTR_MAC_JOIN_ACCEPT_DELAY1,
  INVLD_ATTR_MAC_RECEIVE_DELAY2,
  INVLD_ATTR_MAC_RECEIVE_DELAY1,
  INVLD_ATTR_MIN_DUTY_CYCLE_TIMER,
  INVLD_ATTR_SPREADING_FACTOR_ATTR,
  INVLD_ATTR_BANDWIDTH_ATTR,
  INVLD_ATTR_MODULATION_ATTR,
  INVLD_ATTR_LBT_TIMER,
  INVLD_ATTR_DUTY_CYCLE_TIMER,
  INVLD_ATTR_DUTY_CYCLE,
  INVLD_ATTR_TX_PWR,
  INVLD_ATTR_NEW_CHANNELS,
  INVLD_ATTR_CHANNEL_MASK_CNTL,
  INVLD_ATTR_CHANNEL_MASK,
  INVLD_ATTR_RX1_WINDOW_PARAMS,
  INVLD_ATTR_RX1_DATARATE_OFFSET,
  INVLD_ATTR_RX2_DATARATE,
  INVLD_ATTR_CHANNEL_ID_STATUS,
  INVLD_ATTR_CHANNEL_ID,
  INVLD_ATTR_MIN_MAX_DR,
  INVLD_ATTR_DATA_RANGE_CH_BAND,
  INVLD_ATTR_DATA_RANGE,
  INVLD_ATTR_SUPPORTED_DR,
  INVLD_ATTR_TX_DATARATE,
  INVLD_ATTR_RX_DATARATE,
  INVLD_ATTR_SUPPORTED_REGIONAL_FEATURES,
  INVLD_ATTR_DEF_DUTY_CYCLE_JOIN_REQUEST,
  INVLD_ATTR_DEF_DUTY_CYCLE_NEW_CH,
  INVLD_ATTR_DEF_DUTY_CYCLE,
  INVLD_ATTR_DEFAULT_RX2_FREQUENCY,
  INVLD_ATTR_DEFAULT_RX2_DATA_RATE,
  INVLD_ATTR_DEFAULT_RX1_DATA_RATE,
  INVLD_ATTR_MIN_NEW_CH_INDEX,
  INVLD_ATTR_MAX_CHANNELS,
  INVLD_ATTR_MAX_PAYLOAD_SIZE,
  INVLD_ATTR_RX_WINDOW_OFFSET,
  INVLD_ATTR_RX_WINDOW_SIZE,
  INVLD_ATTR_TX_FREQUENCY,
  INVLD_ATTR_RX_FREQUENCY,
  INVLD_ATTR_FREQUENCY
}
 
enum  _LorawanRegionalAttributes {
  FREQUENCY,
  RX_FREQUENCY,
  TX_FREQUENCY,
  RX_WINDOW_SIZE,
  RX_WINDOW_OFFSET,
  MAX_PAYLOAD_SIZE,
  MAX_CHANNELS,
  MIN_NEW_CH_INDEX,
  DEFAULT_RX1_DATA_RATE,
  DEFAULT_RX2_DATA_RATE,
  DEFAULT_RX2_FREQUENCY,
  DEF_DUTY_CYCLE,
  DEF_DUTY_CYCLE_NEW_CH,
  DEF_DUTY_CYCLE_JOIN_REQUEST,
  SUPPORTED_REGIONAL_FEATURES,
  RX_DATARATE,
  TX_DATARATE,
  SUPPORTED_DR,
  DATA_RANGE,
  DATA_RANGE_CH_BAND,
  MIN_MAX_DR,
  CHANNEL_ID,
  CHANNEL_ID_STATUS,
  RX2_DATARATE,
  RX1_DATARATE_OFFSET,
  RX1_WINDOW_PARAMS,
  CHANNEL_MASK,
  CHANNEL_MASK_CNTL,
  NEW_CHANNELS,
  TX_PWR,
  DUTY_CYCLE,
  DUTY_CYCLE_TIMER,
  JOIN_DUTY_CYCLE_TIMER,
  JOIN_BACK_OFF_TIMER,
  LBT_TIMER,
  MODULATION_ATTR,
  BANDWIDTH_ATTR,
  SPREADING_FACTOR_ATTR,
  MIN_DUTY_CYCLE_TIMER,
  MAC_RECEIVE_DELAY1,
  MAC_RECEIVE_DELAY2,
  MAC_JOIN_ACCEPT_DELAY1,
  MAC_JOIN_ACCEPT_DELAY2,
  MAC_RETRANSMIT_TIMEOUT,
  MAC_ADR_ACK_DELAY,
  MAC_ADR_ACK_LIMIT,
  NEW_TX_CHANNEL_CONFIG,
  FREE_CHANNEL,
  CURRENT_CHANNEL_INDEX,
  DEFAULT_LBT_PARAMS,
  MIN_LBT_CHANNEL_PAUSE_TIMER,
  DL_FREQUENCY,
  TX_PARAMS,
  REG_DEF_TX_POWER,
  REG_DEF_TX_DATARATE,
  CHMASK_CHCNTL,
  JOINBACKOFF_CNTL,
  REG_JOIN_SUCCESS,
  REG_JOIN_ENABLE_ALL,
  CHLIST_DEFAULTS,
  DEF_TX_PWR,
  REG_NUM_ATTRIBUTES
}
 

Functions

StackRetStatus_t LORAREG_EnableallChannels (IsmBand_t ismBand)
 
StackRetStatus_t LORAREG_GetAttr (LorawanRegionalAttributes_t attrType, void *attrInput, void *attrOutput)
 This API provides read access to all the supported Regional Attributes. More...
 
StackRetStatus_t LORAREG_Init (IsmBand_t ismBand)
 This function initializes the LoRaWAN Regional Parameters Module All the resources handled by the regional module eg Channels will be initialized. More...
 
StackRetStatus_t LORAREG_SetAttr (LorawanRegionalAttributes_t attrType, void *attrInput)
 This API is used to Update the parameters to the regional parameter data base. More...
 
StackRetStatus_t LORAREG_SupportedBands (uint16_t *bands)
 This function returns the supported bands in the LoRaWAN stack ( a compile time feature) More...
 
StackRetStatus_t LORAREG_UnInit (void)
 This API is used to un-initialize the regional band parameters and stop the associated timers. More...
 
StackRetStatus_t LORAREG_ValidateAttr (LorawanRegionalAttributes_t attrType, void *attrInput)
 This API is used to validate if the parameter is according to the specification defined for that band. More...
 
StackRetStatus_t setDefaultTxPower (IsmBand_t ismBand)
 

#define ADR_ACK_DELAY   32
#define ADR_ACK_LIMIT   64
#define AGGREGATEDTIME_10HR   20

Referenced by setJoinDutyCycleTimer().

#define AGGREGATEDTIME_1HR   2

Referenced by setJoinDutyCycleTimer().

#define BACKOFF_BASE_TIME_IN_MS   1800000
#define FCNT_MAX   (UINT32_MAX)
#define JOIN_ACCEPT_DELAY1   5000UL
#define JOIN_ACCEPT_DELAY2   6000UL
#define JOIN_BACKOFF_PRESCALAR_10HR   1000

Referenced by setJoinDutyCycleTimer().

#define JOIN_BACKOFF_PRESCALAR_1HR   100

Referenced by setJoinDutyCycleTimer().

#define JOIN_BACKOFF_PRESCALAR_24HR   10000

Referenced by setJoinDutyCycleTimer().

#define NUMBER_CFLIST_FREQUENCIES   5
#define RECEIVE_DELAY1   (1000UL)
#define RECEIVE_DELAY2   2000UL
#define RETRANSMIT_TIMEOUT   1000+(rand()%2001)
#define SIZE_JOIN_ACCEPT_WITH_CFLIST   33
#define WITHOUT_DEFAULT_CHANNELS   0

typedef struct _TxParams TxParams_t

Enumerator
UNSUPPORTED_BAND 
INVLD_ATTR_CHMASK_CHCNTL 
INVLD_ATTR_DEF_TX_PWR 
INVLD_ATTR_REG_DEF_TX_DATARATE 
INVLD_ATTR_REG_DEF_TX_POWER 
INVLD_ATTR_TX_PARAMS 
INVLD_ATTR_DL_FREQUENCY 
INVLD_ATTR_MIN_LBT_CHANNEL_PAUSE_TIMER 
INVLD_ATTR_DEFAULT_LBT_PARAMS 
INVLD_ATTR_CURRENT_CHANNEL_INDEX 
INVLD_ATTR_FREE_CHANNEL 
INVLD_ATTR_NEW_TX_CHANNEL_CONFIG 
INVLD_ATTR_MAC_ADR_ACK_LIMIT 
INVLD_ATTR_MAC_ADR_ACK_DELAY 
INVLD_ATTR_MAC_RETRANSMIT_TIMEOUT 
INVLD_ATTR_MAC_JOIN_ACCEPT_DELAY2 
INVLD_ATTR_MAC_JOIN_ACCEPT_DELAY1 
INVLD_ATTR_MAC_RECEIVE_DELAY2 
INVLD_ATTR_MAC_RECEIVE_DELAY1 
INVLD_ATTR_MIN_DUTY_CYCLE_TIMER 
INVLD_ATTR_SPREADING_FACTOR_ATTR 
INVLD_ATTR_BANDWIDTH_ATTR 
INVLD_ATTR_MODULATION_ATTR 
INVLD_ATTR_LBT_TIMER 
INVLD_ATTR_DUTY_CYCLE_TIMER 
INVLD_ATTR_DUTY_CYCLE 
INVLD_ATTR_TX_PWR 
INVLD_ATTR_NEW_CHANNELS 
INVLD_ATTR_CHANNEL_MASK_CNTL 
INVLD_ATTR_CHANNEL_MASK 
INVLD_ATTR_RX1_WINDOW_PARAMS 
INVLD_ATTR_RX1_DATARATE_OFFSET 
INVLD_ATTR_RX2_DATARATE 
INVLD_ATTR_CHANNEL_ID_STATUS 
INVLD_ATTR_CHANNEL_ID 
INVLD_ATTR_MIN_MAX_DR 
INVLD_ATTR_DATA_RANGE_CH_BAND 
INVLD_ATTR_DATA_RANGE 
INVLD_ATTR_SUPPORTED_DR 
INVLD_ATTR_TX_DATARATE 
INVLD_ATTR_RX_DATARATE 
INVLD_ATTR_SUPPORTED_REGIONAL_FEATURES 
INVLD_ATTR_DEF_DUTY_CYCLE_JOIN_REQUEST 
INVLD_ATTR_DEF_DUTY_CYCLE_NEW_CH 
INVLD_ATTR_DEF_DUTY_CYCLE 
INVLD_ATTR_DEFAULT_RX2_FREQUENCY 
INVLD_ATTR_DEFAULT_RX2_DATA_RATE 
INVLD_ATTR_DEFAULT_RX1_DATA_RATE 
INVLD_ATTR_MIN_NEW_CH_INDEX 
INVLD_ATTR_MAX_CHANNELS 
INVLD_ATTR_MAX_PAYLOAD_SIZE 
INVLD_ATTR_RX_WINDOW_OFFSET 
INVLD_ATTR_RX_WINDOW_SIZE 
INVLD_ATTR_TX_FREQUENCY 
INVLD_ATTR_RX_FREQUENCY 
INVLD_ATTR_FREQUENCY 
Enumerator
FREQUENCY 
RX_FREQUENCY 
TX_FREQUENCY 
RX_WINDOW_SIZE 
RX_WINDOW_OFFSET 
MAX_PAYLOAD_SIZE 
MAX_CHANNELS 
MIN_NEW_CH_INDEX 
DEFAULT_RX1_DATA_RATE 
DEFAULT_RX2_DATA_RATE 
DEFAULT_RX2_FREQUENCY 
DEF_DUTY_CYCLE 
DEF_DUTY_CYCLE_NEW_CH 
DEF_DUTY_CYCLE_JOIN_REQUEST 
SUPPORTED_REGIONAL_FEATURES 
RX_DATARATE 
TX_DATARATE 
SUPPORTED_DR 
DATA_RANGE 
DATA_RANGE_CH_BAND 
MIN_MAX_DR 
CHANNEL_ID 
CHANNEL_ID_STATUS 
RX2_DATARATE 
RX1_DATARATE_OFFSET 
RX1_WINDOW_PARAMS 
CHANNEL_MASK 
CHANNEL_MASK_CNTL 
NEW_CHANNELS 
TX_PWR 
DUTY_CYCLE 
DUTY_CYCLE_TIMER 
JOIN_DUTY_CYCLE_TIMER 
JOIN_BACK_OFF_TIMER 
LBT_TIMER 
MODULATION_ATTR 
BANDWIDTH_ATTR 
SPREADING_FACTOR_ATTR 
MIN_DUTY_CYCLE_TIMER 
MAC_RECEIVE_DELAY1 
MAC_RECEIVE_DELAY2 
MAC_JOIN_ACCEPT_DELAY1 
MAC_JOIN_ACCEPT_DELAY2 
MAC_RETRANSMIT_TIMEOUT 
MAC_ADR_ACK_DELAY 
MAC_ADR_ACK_LIMIT 
NEW_TX_CHANNEL_CONFIG 
FREE_CHANNEL 
CURRENT_CHANNEL_INDEX 
DEFAULT_LBT_PARAMS 
MIN_LBT_CHANNEL_PAUSE_TIMER 
DL_FREQUENCY 
TX_PARAMS 
REG_DEF_TX_POWER 
REG_DEF_TX_DATARATE 
CHMASK_CHCNTL 
JOINBACKOFF_CNTL 
REG_JOIN_SUCCESS 
REG_JOIN_ENABLE_ALL 
CHLIST_DEFAULTS 
DEF_TX_PWR 
REG_NUM_ATTRIBUTES 

StackRetStatus_t LORAREG_GetAttr ( LorawanRegionalAttributes_t  attrType,
void *  attrInput,
void *  attrOutput 
)

This API provides read access to all the supported Regional Attributes.

The LoRaWAN mac needs to access the regional database via this API.

Parameters
[in]attrTypeType of Attribute to get from the regional module
[in]attrInputInput used to get the attribute value
[out]Resultof the GET operation
Return values
LORAWAN_SUCCESS: If GET is successful LORAWAN_INVALID_PARAMETER if the input attribute or the attribute type is invalid

References LORAWAN_INVALID_PARAMETER, pGetAttr, REG_NUM_ATTRIBUTES, and result.

StackRetStatus_t LORAREG_Init ( IsmBand_t  ismBand)

This function initializes the LoRaWAN Regional Parameters Module All the resources handled by the regional module eg Channels will be initialized.

Parameters
ismBandThe Regional band which is initialized,This is used to validate if the band is supported by the module and also initializes the module corresponding to the band
Return values
LORAWAN_SUCCESS: If initialization is successful LORAWAN_INVALID_PARAMETER if Initialization is failed

References CreateAllRegSoftwareTimers(), i, InValidAttr(), InValidGetAttr(), ISM_AU915, ISM_BRN923, ISM_EU433, ISM_EU868, ISM_IND865, ISM_JPN923, ISM_KR920, ISM_NA915, ISM_VTM923, LORAReg_InitAS(), LORAReg_InitAU(), LORAReg_InitEU(), LORAReg_InitIN(), LORAReg_InitJP(), LORAReg_InitKR(), LORAReg_InitNA(), LORAWAN_RESOURCE_UNAVAILABLE, LORAWAN_SUCCESS, pGetAttr, pSetAttr, pValidateAttr, REG_NUM_ATTRIBUTES, result, and StopAllRegSoftwareTimers().

StackRetStatus_t LORAREG_SetAttr ( LorawanRegionalAttributes_t  attrType,
void *  attrInput 
)

This API is used to Update the parameters to the regional parameter data base.

Parameters
[in]attrTypeType of Attribute to update in the regional module
[in]attrInputInput used to update the attribute value
Return values
LORAWAN_SUCCESS: If Update is successful LORAWAN_INVALID_PARAMETER if the input attribute or the attribute type is invalid

References LORAWAN_INVALID_PARAMETER, pSetAttr, REG_NUM_ATTRIBUTES, and result.

StackRetStatus_t LORAREG_SupportedBands ( uint16_t *  bands)

This function returns the supported bands in the LoRaWAN stack ( a compile time feature)

Parameters
ismBandThe Regional bands supported is updated in this parameter
Return values
LORAWAN_SUCCESS: If initialization is successful LORAWAN_INVALID_PARAMETER if Initialization is failed

References ISM_ASBAND, ISM_AU915, ISM_EUBAND, ISM_IND865, ISM_JPN923, ISM_KR920, ISM_NA915, and LORAWAN_SUCCESS.

StackRetStatus_t LORAREG_UnInit ( void  )

This API is used to un-initialize the regional band parameters and stop the associated timers.

LORAWAN_INVALID_PARAMETER if the input attribute or the attribute type is invalid

References _RegParams::band, _RegPdsItems::fileid, ISM_EU868, LORAWAN_INVALID_PARAMETER, PDS_FILE_REG_EU868_12_IDX, PDS_UnRegFile(), _RegParams::regParamItems, result, and StopAllRegSoftwareTimers().

StackRetStatus_t LORAREG_ValidateAttr ( LorawanRegionalAttributes_t  attrType,
void *  attrInput 
)

This API is used to validate if the parameter is according to the specification defined for that band.

Parameters
[in]attrTypeType of Attribute to validate in the regional module
[in]attrInputInput used to validate the attribute value
Return values
LORAWAN_SUCCESS: If Validate is successful LORAWAN_INVALID_PARAMETER if the input attribute or the attribute type is invalid

References LORAWAN_INVALID_PARAMETER, pValidateAttr, REG_NUM_ATTRIBUTES, and result.

Referenced by setNewChannel().