nrf_gzll_constants.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. * $LastChangedRevision: 32956 $
  12. */
  13. /**
  14. * @file
  15. * @brief Gazell Link Layer constants and default values.
  16. *
  17. * NOTE! Changing values here has no effect. They are only provided as a reference.
  18. */
  19. #ifndef NRF_GZLL_CONSTANTS_H__
  20. #define NRF_GZLL_CONSTANTS_H__
  21. /**
  22. * @addtogroup gzll_02_api
  23. * @{
  24. */
  25. /*****************************************************************************/
  26. /** @name Hardware resources used by Gazell */
  27. /*****************************************************************************/
  28. #define NRF_GZLL_HIGH_IRQ_PRIORITY 0 ///< Interrupt priority the Gazell timer and the radio
  29. #define NRF_GZLL_LOW_IRQ_PRIORITY 1 ///< Interrupt priority for Gazell callback functions.
  30. #ifndef USE_SD_HW_RESOURCES
  31. #define NRF_GZLL_SWI_IRQn SWI0_IRQn ///< Software interrupt # used for callback functions.
  32. #define NRF_GZLL_SWI_IRQ_HANDLER SWI0_IRQHandler ///< Software interrupt handler used for callback functions.
  33. #define NRF_GZLL_TIMER NRF_TIMER2 ///< Timer to be used as flywheel timer.
  34. #define NRF_GZLL_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER2_Msk ///< PERPOWER mask for the timer.
  35. #define NRF_GZLL_TIMER_IRQn TIMER2_IRQn ///< Interrupt # for the timer.
  36. #define NRF_GZLL_TIMER_IRQ_HANDLER TIMER2_IRQHandler ///< Interrupt handler for the timer.
  37. // In addition, Gazell uses the radio peripheral and radio interrupts.
  38. /*
  39. * PPI configuration
  40. */
  41. #define NRF_GZLL_PPI_EEP0 (NRF_PPI -> CH0_EEP) ///< Gazell PPI event endpoint 0
  42. #define NRF_GZLL_PPI_TEP0 (NRF_PPI -> CH0_TEP) ///< Gazell PPI task endpoint 0
  43. #define NRF_GZLL_PPI_EEP1 (NRF_PPI -> CH1_EEP) ///< Gazell PPI event endpoint 1
  44. #define NRF_GZLL_PPI_TEP1 (NRF_PPI -> CH1_TEP) ///< Gazell PPI task endpoint 1
  45. #define NRF_GZLL_PPI_EEP2 (NRF_PPI -> CH2_EEP) ///< Gazell PPI event endpoint 2
  46. #define NRF_GZLL_PPI_TEP2 (NRF_PPI -> CH2_TEP) ///< Gazell PPI task endpoint 2
  47. #define NRF_GZLL_PPI_CHEN_MSK_0_AND_1 (0x03) ///< Channel enable/disable mask for PPI endpoint 0 and 1.
  48. #define NRF_GZLL_PPI_CHEN_MSK_2 (0x04) ///< Channel enable/disable mask for PPI endpoint 2.
  49. #else
  50. #define NRF_GZLL_SWI_IRQn SWI1_IRQn ///< Software interrupt # used for callback functions.
  51. #define NRF_GZLL_SWI_IRQ_HANDLER SWI1_IRQHandler ///< Software interrupt handler used for callback functions.
  52. #define NRF_GZLL_TIMER NRF_TIMER0 ///< Timer to be used as flywheel timer.
  53. #define NRF_GZLL_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER0_Msk ///< PERPOWER mask for the timer.
  54. #define NRF_GZLL_TIMER_IRQn TIMER0_IRQn ///< Interrupt # for the timer.
  55. #define NRF_GZLL_TIMER_IRQ_HANDLER TIMER0_IRQHandler ///< Interrupt handler for the timer.
  56. // In addition, Gazell uses the radio peripheral and radio interrupts.
  57. /*
  58. * PPI configuration
  59. */
  60. #define NRF_GZLL_PPI_EEP0 (NRF_PPI -> CH8_EEP) ///< Gazell PPI event endpoint 0
  61. #define NRF_GZLL_PPI_TEP0 (NRF_PPI -> CH8_TEP) ///< Gazell PPI task endpoint 0
  62. #define NRF_GZLL_PPI_EEP1 (NRF_PPI -> CH9_EEP) ///< Gazell PPI event endpoint 1
  63. #define NRF_GZLL_PPI_TEP1 (NRF_PPI -> CH9_TEP) ///< Gazell PPI task endpoint 1
  64. #define NRF_GZLL_PPI_EEP2 (NRF_PPI -> CH10_EEP) ///< Gazell PPI event endpoint 2
  65. #define NRF_GZLL_PPI_TEP2 (NRF_PPI -> CH10_TEP) ///< Gazell PPI task endpoint 2
  66. #define NRF_GZLL_PPI_CHEN_MSK_0_AND_1 (0x300) ///< Channel enable/disable mask for PPI endpoint 0 and 1.
  67. #define NRF_GZLL_PPI_CHEN_MSK_2 (0x400) ///< Channel enable/disable mask for PPI endpoint 2.
  68. #endif
  69. #define NRF_GZLL_CONST_PIPE_COUNT 8 ///< Number of TX pipes (at least one for each Device-Host pairs).
  70. #define NRF_GZLL_CONST_FIFO_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX FIFO.
  71. #define NRF_GZLL_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time.
  72. #define NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes.
  73. #define NRF_GZLL_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue.
  74. /** @} */
  75. /*****************************************************************************/
  76. /** @name Constant pipe and FIFO configuration */
  77. /*****************************************************************************/
  78. #define NRF_GZLL_CONST_PIPE_COUNT 8 ///< Number of TX pipes (at least one for each Device-Host pairs).
  79. #define NRF_GZLL_CONST_FIFO_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX FIFO.
  80. #define NRF_GZLL_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time.
  81. #define NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes.
  82. #define NRF_GZLL_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue.
  83. /** @} */
  84. /*****************************************************************************/
  85. /** @name Default radio configuration */
  86. /*****************************************************************************/
  87. #define NRF_GZLL_DEFAULT_TX_POWER NRF_GZLL_TX_POWER_0_DBM ///< Default TX power.
  88. #define NRF_GZLL_DEFAULT_DATARATE NRF_GZLL_DATARATE_2MBIT ///< Default data rate.
  89. #define NRF_GZLL_DEFAULT_CHANNEL_TABLE {4, 25, 42, 63, 77} ///< Default channel table.
  90. #define NRF_GZLL_DEFAULT_CHANNEL_TABLE_SIZE 5 ///< Default channel table size.
  91. #define NRF_GZLL_CONST_MAX_CHANNEL_TABLE_SIZE 16 ///< Maximum channel table size allowed by Gazell.
  92. /** @} */
  93. /*****************************************************************************/
  94. /** @name Default Address configuration */
  95. /*****************************************************************************/
  96. /*
  97. Corresponds to Legacy nRFgo SDK Gazell config:
  98. #define GZLL_DEFAULT_ADDRESS_PIPE0 {0x01, 0x04, 0x07, 0x0A, 0x0D} // {1, 4, 7, 10, 13}
  99. #define GZLL_DEFAULT_ADDRESS_PIPE1 {0x02, 0x05, 0x08, 0x0B, 0x0E} // {2, 5, 8, 11, 14}
  100. #define GZLL_DEFAULT_ADDRESS_PIPE2 3
  101. #define GZLL_DEFAULT_ADDRESS_PIPE3 4
  102. #define GZLL_DEFAULT_ADDRESS_PIPE4 5
  103. #define GZLL_DEFAULT_ADDRESS_PIPE5 6
  104. */
  105. #define NRF_GZLL_DEFAULT_FULL_ADDRESS_PIPE0 {0x01, 0x04, 0x07, 0x0A, 0x0D} ///< Corresponding legacy Gazell pipe 0 address.
  106. #define NRF_GZLL_DEFAULT_BASE_ADDRESS_0 0x0D0A0704 ///< Default base address 0.
  107. #define NRF_GZLL_DEFAULT_BASE_ADDRESS_1 0x0E0B0805 ///< Default base address 1.
  108. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_0 1 ///< Default prefix address pipe 0.
  109. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_1 2 ///< Default prefix address pipe 1.
  110. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_2 3 ///< Default prefix address pipe 2.
  111. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_3 4 ///< Default prefix address pipe 3.
  112. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_4 5 ///< Default prefix address pipe 4.
  113. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_5 6 ///< Default prefix address pipe 5.
  114. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_6 7 ///< Default prefix address pipe 6.
  115. #define NRF_GZLL_DEFAULT_PREFIX_BYTE_7 8 ///< Default prefix address pipe 7.
  116. #define NRF_GZLL_DEFAULT_BASE_ADDRESS_LENGTH NRF_GZLL_BASE_ADDRESS_LENGTH_4B ///< Default on-air base address length.
  117. #define NRF_GZLL_DEFAULT_RX_PIPES_ENABLED 0x000000FF ///< Enabled Rx pipes. See nrf_gzll_set_rx_pipes_enabled().
  118. /** @} */
  119. /*****************************************************************************/
  120. /** @name Default timeslot and synchronization configuration */
  121. /*****************************************************************************/
  122. #define NRF_GZLL_DEFAULT_TIMESLOT_PERIOD 600 ///< Default timeslot period.
  123. #define NRF_GZLL_DEFAULT_TIMESLOTS_PER_CHANNEL 2 ///< Timeslots use by the Host and by the Device when communication is in sync.
  124. #define NRF_GZLL_DEFAULT_TIMESLOTS_PER_CHANNEL_WHEN_DEVICE_OUT_OF_SYNC 15 ///< Timeslots use by the Device before communication is in sync.
  125. #define NRF_GZLL_DEFAULT_SYNC_LIFETIME (3*NRF_GZLL_DEFAULT_CHANNEL_TABLE_SIZE*NRF_GZLL_DEFAULT_TIMESLOTS_PER_CHANNEL) ///< Number of timeslots to keep the timer running so that communication remains synchronized.
  126. #define NRF_GZLL_DEFAULT_DEVICE_CHANNEL_SELECTION_POLICY NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_SUCCESSFUL ///< Default channel Gazell Device channel selection policy
  127. #define NRF_GZLL_DEFAULT_MAX_TX_ATTEMPTS 0 ///< Default maximum TX attempts for each packet. A value of zero implies maximum
  128. #define NRF_GZLL_DEFAULT_XOSC_CTL NRF_GZLL_XOSC_CTL_AUTO ///< Deafult setting for controlling the XOSC
  129. /** @} */
  130. /** @} */
  131. #endif