2
0

antdefines.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except in compliance
  4. with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2012
  6. All rights reserved.
  7. */
  8. #ifndef ANTDEFINES_H
  9. #define ANTDEFINES_H
  10. #include "types.h"
  11. //////////////////////////////////////////////
  12. // Clock Definition
  13. //////////////////////////////////////////////
  14. #define CLOCK_FREQUENCY ((ULONG)32768) // ANT system clock frequency
  15. //////////////////////////////////////////////
  16. // Radio TX Power Definitions
  17. //////////////////////////////////////////////
  18. #define RADIO_TX_POWER_MASK ((UCHAR)0x03)
  19. #define RADIO_TX_POWER_MINUS20DB ((UCHAR)0x00)
  20. #define RADIO_TX_POWER_MINUS10DB ((UCHAR)0x01)
  21. #define RADIO_TX_POWER_MINUS5DB ((UCHAR)0x02)
  22. #define RADIO_TX_POWER_0DB ((UCHAR)0x03)
  23. //////////////////////////////////////////////
  24. // Default System Definitions
  25. //////////////////////////////////////////////
  26. #define DEFAULT_CHANNEL_MESSAGE_FREQUENCY ((ULONG)4)
  27. #define DEFAULT_CHANNEL_MESSAGE_PERIOD ((USHORT)(CLOCK_FREQUENCY / DEFAULT_CHANNEL_MESSAGE_FREQUENCY)) // 8192
  28. #define DEFAULT_RADIO_TX_POWER RADIO_TX_POWER_0DB // ANT default RF power
  29. #define DEFAULT_RADIO_CHANNEL ((UCHAR)66) // 2400MHz + 1MHz * Channel Number = 2466MHz
  30. #define DEFAULT_RX_SEARCH_TIMEOUT ((UCHAR)12) // 12 * 2.5 seconds = 30 seconds
  31. //////////////////////////////////////////////
  32. // ID Definitions
  33. //////////////////////////////////////////////
  34. #define ANT_ID_SIZE ((UCHAR)4)
  35. #define ANT_ID_TRANS_TYPE_OFFSET ((UCHAR)3)
  36. #define ANT_ID_DEVICE_TYPE_OFFSET ((UCHAR)2)
  37. #define ANT_ID_DEVICE_NUMBER_HIGH_OFFSET ((UCHAR)1)
  38. #define ANT_ID_DEVICE_NUMBER_LOW_OFFSET ((UCHAR)0)
  39. #define ANT_ID_DEVICE_TYPE_PAIRING_FLAG ((UCHAR)0x80)
  40. //////////////////////////////////////////////
  41. // Assign Channel Parameters
  42. //////////////////////////////////////////////
  43. #define PARAMETER_RX_NOT_TX ((UCHAR)0x00)
  44. #define PARAMETER_TX_NOT_RX ((UCHAR)0x10)
  45. #define PARAMETER_SHARED_CHANNEL ((UCHAR)0x20)
  46. #define PARAMETER_NO_TX_GUARD_BAND ((UCHAR)0x40)
  47. #define PARAMETER_ALWAYS_RX_WILD_CARD_SEARCH_ID ((UCHAR)0x40)
  48. //////////////////////////////////////////////
  49. // Channel Status
  50. //////////////////////////////////////////////
  51. #define STATUS_CHANNEL_STATE_MASK ((UCHAR)0x03)
  52. #define STATUS_UNASSIGNED_CHANNEL ((UCHAR)0x00)
  53. #define STATUS_ASSIGNED_CHANNEL ((UCHAR)0x01)
  54. #define STATUS_SEARCHING_CHANNEL ((UCHAR)0x02)
  55. #define STATUS_TRACKING_CHANNEL ((UCHAR)0x03)
  56. //////////////////////////////////////////////
  57. // Standard capabilities defines
  58. //////////////////////////////////////////////
  59. #define CAPABILITIES_NO_RX_CHANNELS ((UCHAR)0x01)
  60. #define CAPABILITIES_NO_TX_CHANNELS ((UCHAR)0x02)
  61. #define CAPABILITIES_NO_RX_MESSAGES ((UCHAR)0x04)
  62. #define CAPABILITIES_NO_TX_MESSAGES ((UCHAR)0x08)
  63. #define CAPABILITIES_NO_ACKD_MESSAGES ((UCHAR)0x10)
  64. #define CAPABILITIES_NO_BURST_TRANSFER ((UCHAR)0x20)
  65. //////////////////////////////////////////////
  66. // Advanced capabilities defines
  67. //////////////////////////////////////////////
  68. #define CAPABILITIES_OVERUN_UNDERRUN ((UCHAR)0x01) // Support for this functionality has been dropped
  69. #define CAPABILITIES_NETWORK_ENABLED ((UCHAR)0x02)
  70. #define CAPABILITIES_AP1_VERSION_2 ((UCHAR)0x04) // This Version of the AP1 does not support transmit and only had a limited release
  71. #define CAPABILITIES_SERIAL_NUMBER_ENABLED ((UCHAR)0x08)
  72. #define CAPABILITIES_PER_CHANNEL_TX_POWER_ENABLED ((UCHAR)0x10)
  73. #define CAPABILITIES_LOW_PRIORITY_SEARCH_ENABLED ((UCHAR)0x20)
  74. #define CAPABILITIES_SENSRCORE_ENABLED ((UCHAR)0x40)
  75. #define CAPABILITIES_SEARCH_LIST_ENABLED ((UCHAR)0x80)
  76. //////////////////////////////////////////////
  77. // Advanced capabilities 2 defines
  78. //////////////////////////////////////////////
  79. #define CAPABILITIES_LED_ENABLED ((UCHAR)0x01)
  80. #define CAPABILITIES_EXT_MESSAGE_ENABLED ((UCHAR)0x02)
  81. #define CAPABILITIES_SCAN_CHANNEL_ENABLED ((UCHAR)0x04)
  82. #define CAPABILITIES_TX_SEARCH_CMD_ENABLED ((UCHAR)0x08)
  83. #define CAPABILITIES_PROX_SEARCH_ENABLED ((UCHAR)0x10)
  84. #define CAPABILITIES_EXT_ASSIGN_ENABLED ((UCHAR)0x20)
  85. #define CAPABILITIES_FS_ANTFS ((UCHAR)0x40)
  86. // bit 7 reserved
  87. //////////////////////////////////////////////
  88. // Burst Message Sequence
  89. //////////////////////////////////////////////
  90. #define CHANNEL_NUMBER_MASK ((UCHAR)0x1F)
  91. #define SEQUENCE_NUMBER_MASK ((UCHAR)0xE0)
  92. #define SEQUENCE_NUMBER_INC ((UCHAR)0x20)
  93. #define SEQUENCE_NUMBER_ROLLOVER ((UCHAR)0x60)
  94. #define SEQUENCE_LAST_MESSAGE ((UCHAR)0x80)
  95. //////////////////////////////////////////////
  96. // Response / Event Codes
  97. //////////////////////////////////////////////
  98. #define RESPONSE_NO_ERROR ((UCHAR)0x00)
  99. #define EVENT_RX_SEARCH_TIMEOUT ((UCHAR)0x01)
  100. #define EVENT_RX_FAIL ((UCHAR)0x02)
  101. #define EVENT_TX ((UCHAR)0x03)
  102. #define EVENT_TRANSFER_RX_FAILED ((UCHAR)0x04)
  103. #define EVENT_TRANSFER_TX_COMPLETED ((UCHAR)0x05)
  104. #define EVENT_TRANSFER_TX_FAILED ((UCHAR)0x06)
  105. #define EVENT_CHANNEL_CLOSED ((UCHAR)0x07)
  106. #define EVENT_RX_FAIL_GO_TO_SEARCH ((UCHAR)0x08)
  107. #define EVENT_CHANNEL_COLLISION ((UCHAR)0x09)
  108. #define EVENT_TRANSFER_TX_START ((UCHAR)0x0A) // a pending transmit transfer has begun
  109. #define EVENT_TRANSFER_TX_COMPLETED_RSSI ((UCHAR)0x10)
  110. #define CHANNEL_IN_WRONG_STATE ((UCHAR)0x15) // returned on attempt to perform an action from the wrong channel state
  111. #define CHANNEL_NOT_OPENED ((UCHAR)0x16) // returned on attempt to communicate on a channel that is not open
  112. #define CHANNEL_ID_NOT_SET ((UCHAR)0x18) // returned on attempt to open a channel without setting the channel ID
  113. #define CLOSE_ALL_CHANNELS ((UCHAR)0x19) // returned when attempting to start scanning mode, when channels are still open
  114. #define TRANSFER_IN_PROGRESS ((UCHAR)0x1F) // returned on attempt to communicate on a channel with a TX transfer in progress
  115. #define TRANSFER_SEQUENCE_NUMBER_ERROR ((UCHAR)0x20) // returned when sequence number is out of order on a Burst transfer
  116. #define TRANSFER_IN_ERROR ((UCHAR)0x21)
  117. #define TRANSFER_BUSY ((UCHAR)0x22)
  118. #define INVALID_MESSAGE ((UCHAR)0x28) // returned when the message has an invalid parameter
  119. #define INVALID_NETWORK_NUMBER ((UCHAR)0x29) // returned when an invalid network number is provided
  120. #define INVALID_LIST_ID ((UCHAR)0x30) // returned when the provided list ID or size exceeds the limit
  121. #define INVALID_SCAN_TX_CHANNEL ((UCHAR)0x31) // returned when attempting to transmit on channel 0 when in scan mode
  122. #define NVM_FULL_ERROR ((UCHAR)0x40) // error writing to NVM, memory is full
  123. #define NVM_WRITE_ERROR ((UCHAR)0x41) // error writing to NVM, bytes not written correctly
  124. #define NO_RESPONSE_MESSAGE ((UCHAR)0x50) // returned to the Command_SerialMessageProcess function, so no reply message is generated
  125. #define RETURN_TO_MFG ((UCHAR)0x51) // default return to any mesg when the module determines that the mfg procedure has not been fully completed
  126. //////////////////////////////////////////////
  127. // PC Application Event Codes
  128. //////////////////////////////////////////////
  129. //NOTE: These events are not generated by the embedded ANT module
  130. #define EVENT_RX_BROADCAST ((UCHAR)0x9A) // returned when module receives broadcast data
  131. #define EVENT_RX_ACKNOWLEDGED ((UCHAR)0x9B) // returned when module receives acknowledged data
  132. #define EVENT_RX_BURST_PACKET ((UCHAR)0x9C) // returned when module receives burst data
  133. #define EVENT_RX_EXT_BROADCAST ((UCHAR)0x9D) // returned when module receives broadcast data
  134. #define EVENT_RX_EXT_ACKNOWLEDGED ((UCHAR)0x9E) // returned when module receives acknowledged data
  135. #define EVENT_RX_EXT_BURST_PACKET ((UCHAR)0x9F) // returned when module receives burst data
  136. #define EVENT_RX_BTH_BROADCAST ((UCHAR)0xA3) // returned when module receives broadcast data
  137. #define EVENT_RX_BTH_ACKNOWLEDGED ((UCHAR)0xA4) // returned when module receives acknowledged data
  138. #define EVENT_RX_BTH_BURST_PACKET ((UCHAR)0xA5) // returned when module receives burst data
  139. #define EVENT_RX_BTH_EXT_BROADCAST ((UCHAR)0xA6) // returned when module receives broadcast data
  140. #define EVENT_RX_BTH_EXT_ACKNOWLEDGED ((UCHAR)0xA7) // returned when module receives acknowledged data
  141. #define EVENT_RX_BTH_EXT_BURST_PACKET ((UCHAR)0xA8) // returned when module receives burst data
  142. #define EVENT_COMMAND_TIMEOUT ((UCHAR)0xA9) // (PC Only)returned when no response is recieved from ANT module after a command has been sent
  143. #define EVENT_ACK_TIMEOUT ((UCHAR)0xAA) // (PC Only) returned if not response to an Ack command is recieved for a set period of time.
  144. //////////////////////////////////////////////
  145. // NVM Command Codes
  146. //////////////////////////////////////////////
  147. #define NVM_CMD_FORMAT ((UCHAR)0x00)
  148. #define NVM_CMD_DUMP ((UCHAR)0x01)
  149. #define NVM_CMD_SET_DEFAULT_SECTOR ((UCHAR)0x02)
  150. #define NVM_CMD_END_SECTOR ((UCHAR)0x03)
  151. #define NVM_CMD_END_DUMP ((UCHAR)0x04)
  152. #define NVM_CMD_LOCK_NVM ((UCHAR)0x05)
  153. #endif // !ANTDEFINES_H