shm.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. #ifndef SHARED_MEMORY_H_
  2. #define SHARED_MEMORY_H_
  3. /* SHM (Shared Memory) offsets */
  4. /* Host-side routing values for the SHM.
  5. * This is only useful for the initvals */
  6. #define HOST_SHM_UCODE 0
  7. #define HOST_SHM_SHARED 1
  8. #define HOST_SHM_SCRATCH 2
  9. #define HOST_SHM_IHR 3
  10. #define HOST_SHM_RCMTA 4
  11. /* Macro to convert a host-SHM-address to a microcode-SHM-address.
  12. * This also asserts that the address is word aligned. */
  13. #define SHM(address) (((address) / 2) + \
  14. (%assert((address & 1) == 0)))
  15. /* Macro to convert a byte-offset into a microcode-SHM-word-offset.
  16. * This does the same as SHM(), but is used to mark offsets that are not
  17. * based on absolute zero, but relative. */
  18. #define SHM_OFFSET(offset) SHM(offset)
  19. /* BEGIN ABI: Start of the driver ABI definitions */
  20. /* Misc variables */
  21. #define SHM_WLCOREREV SHM(0x016) /* 802.11 core revision */
  22. #define SHM_PCTLWDPOS SHM(0x008)
  23. #define SHM_RXPADOFF SHM(0x034) /* RX Padding data offset (PIO only) */
  24. #define SHM_PHYVER SHM(0x050) /* PHY version */
  25. #define SHM_PHYTYPE SHM(0x052) /* PHY type */
  26. #define SHM_ANTSWAP SHM(0x05C) /* Antenna swap threshold */
  27. // New SHM addresses; Source: d11.h 578947 2015-08-13 04:46:06Z
  28. // http://github.com/tuapuikia/asuswrt-phantom/blob/master/release/src-rt-7.14.114.x/src/include/d11.h
  29. /* Host flags to turn on ucode options */
  30. #define SHM_HOST_FLAGS1 SHM(0x05E)
  31. #define SHM_HOST_FLAGS1_ANTDIVHELP 0 /* bit0: ucode antenna div helper */
  32. #define SHM_HOST_FLAGS1_SYMW 1 /* bit1: G-PHY SYM workaround */
  33. #define SHM_HOST_FLAGS1_RXPULLW 2 /* bit2: RX pullup workaround */
  34. #define SHM_HOST_FLAGS1_CCKBOOST 3 /* bit3: 4dB CCK power boost (exclusive with OFDM boost) */
  35. #define SHM_HOST_FLAGS1_BTCOEX 4 /* bit4: Bluetooth coexistence */
  36. #define SHM_HOST_FLAGS1_GDCW 5 /* bit5: G-PHY DC canceller filter bw workaround */
  37. #define SHM_HOST_FLAGS1_OFDMPABOOST 6 /* bit6: Enable PA gain boost for OFDM */
  38. #define SHM_HOST_FLAGS1_ACPR 7 /* bit7: Disable for Japan, channel 14 */
  39. #define SHM_HOST_FLAGS1_EDCF 8 /* bit8: on if WME and MAC suspended */
  40. #define SHM_HOST_FLAGS1_TSSIRPSMW 9 /* bit9: TSSI reset PSM ucode workaround */
  41. #define SHM_HOST_FLAGS1_20IN40IQW 9 /* bit9: 20 in 40 MHz I/Q workaround (rev >= 13 only) */
  42. #define SHM_HOST_FLAGS1_DSCRQ 10 /* bit10: Disable slow clock request in ucode */
  43. #define SHM_HOST_FLAGS1_ACIW 11 /* bit11: ACI workaround: shift bits by 2 on PHY CRS */
  44. #define SHM_HOST_FLAGS1_2060W 12 /* bit12: 2060 radio workaround */
  45. #define SHM_HOST_FLAGS1_RADARW 13 /* bit13: Radar workaround */
  46. #define SHM_HOST_FLAGS1_USEDEFKEYS 14 /* bit14: Enable use of default keys */
  47. #define SHM_HOST_FLAGS1_AFTERBURNER 15 /* bit15: Afterburner enabled */
  48. #define SHM_HOST_FLAGS2 SHM(0x060)
  49. #define SHM_HOST_FLAGS2_BT4PRIOCOEX 0 /* bit0: Bluetooth 4-priority coexistence */
  50. #define SHM_HOST_FLAGS2_FWKUP 1 /* bit1: Fast wake-up ucode */
  51. #define SHM_HOST_FLAGS2_VCORECALC 2 /* bit2: Force VCO recalculation when powering up synthpu */
  52. #define SHM_HOST_FLAGS2_PCISCW 3 /* bit3: PCI slow clock workaround */
  53. #define SHM_HOST_FLAGS2_4318TSSI 5 /* bit5: 4318 TSSI */
  54. #define SHM_HOST_FLAGS2_FBCMCFIFO 6 /* bit6: Flush bcast/mcast FIFO immediately */
  55. #define SHM_HOST_FLAGS2_HWPCTL 7 /* bit7: Enable hardware power control */
  56. #define SHM_HOST_FLAGS2_BTCOEXALT 8 /* bit8: Bluetooth coexistence in alternate pins */
  57. #define SHM_HOST_FLAGS2_TXBTCHECK 9 /* bit9: Bluetooth check during transmission */
  58. #define SHM_HOST_FLAGS2_SKCFPUP 10 /* bit10: Skip CFP update */
  59. #define SHM_HOST_FLAGS2_N40W 11 /* bit11: N PHY 40 MHz workaround (rev >= 13 only) */
  60. #define SHM_HOST_FLAGS2_ANTSEL 13 /* bit13: Antenna selection (for testing antenna div.) */
  61. #define SHM_HOST_FLAGS2_BT3COEXT 13 /* bit13: Bluetooth 3-wire coexistence (rev >= 13 only) */
  62. #define SHM_HOST_FLAGS2_BTCANT 14 /* bit14: Bluetooth coexistence (antenna mode) (rev >= 13 only) */
  63. #define SHM_HOST_FLAGS3 SHM(0x062)
  64. #define SHM_HOST_FLAGS3_ANTSELEN 0 /* bit0: Antenna selection enabled (rev >= 13 only) */
  65. #define SHM_HOST_FLAGS3_ANTSELMODE 1 /* bit1: Antenna selection mode (rev >= 13 only) */
  66. #define SHM_HOST_FLAGS3_MLADVW 4 /* bit4: N PHY ML ADV workaround (rev >= 13 only) */
  67. #define SHM_HOST_FLAGS3_PR45960W 11 /* bit11: PR 45960 workaround (rev >= 13 only) */
  68. #define SHM_HOST_FLAGS4 SHM(0x078)
  69. #define SHM_HOST_FLAGS5 SHM(0x0D4)
  70. #define SHM_RFATT SHM(0x064) /* Current radio attenuation value */
  71. #define SHM_RADAR SHM(0x066) /* Radar register */
  72. #define SHM_PHYTXNOI SHM(0x06E) /* PHY noise directly after TX (lower 8bit only) */
  73. #define SHM_RFRXSP1 SHM(0x072) /* RF RX SP Register 1 */
  74. #define SHM_CHAN SHM(0x0A0) /* Current channel (low 8bit only) */
  75. #define SHM_GCLASSCTL SHM(0x0A6) /* Value for the G-PHY classify control register */
  76. #define SHM_BCMCFIFOID SHM(0x108) /* Last posted cookie to the bcast/mcast FIFO */
  77. /* TSSI information */
  78. #define SHM_TSSI_CCK_LO SHM(0x058) /* TSSI for the last 4 CCK frames (low) */
  79. #define SHM_TSSI_CCK_HI SHM(0x05A) /* TSSI for the last 4 CCK frames (high) */
  80. #define SHM_TSSI_OFDM_A_LO SHM(0x068) /* TSSI for the last 4 OFDM (A) frames (low) */
  81. #define SHM_TSSI_OFDM_A_HI SHM(0x06A) /* TSSI for the last 4 OFDM (A) frames (high) */
  82. #define SHM_TSSI_OFDM_G_LO SHM(0x070) /* TSSI for the last 4 OFDM (G) frames (low) */
  83. #define SHM_TSSI_OFDM_G_HI SHM(0x072) /* TSSI for the last 4 OFDM (G) frames (high) */
  84. /* TX FIFO variables */
  85. #define SHM_TXFIFO_SIZE01 SHM(0x098) /* TX FIFO size for FIFO 0 (low) and 1 (high) */
  86. #define SHM_TXFIFO_SIZE23 SHM(0x09A) /* TX FIFO size for FIFO 2 and 3 */
  87. #define SHM_TXFIFO_SIZE45 SHM(0x09C) /* TX FIFO size for FIFO 4 and 5 */
  88. #define SHM_TXFIFO_SIZE67 SHM(0x09E) /* TX FIFO size for FIFO 6 and 7 */
  89. /* Background noise */
  90. #define SHM_JSSI0 SHM(0x088) /* Measure JSSI 0 */
  91. #define SHM_JSSI1 SHM(0x08A) /* Measure JSSI 1 */
  92. #define SHM_JSSIAUX SHM(0x08C) /* Measure JSSI AUX */
  93. /* Crypto engine */
  94. #define SHM_DEFAULTIV SHM(0x03C) /* Default IV location */
  95. #define SHM_NRRXTRANS SHM(0x03E) /* # of soft RX transmitter addresses (max 8) */
  96. #define SHM_KTP SHM(0x056) /* Key table pointer */
  97. #define SHM_TKIP_P1KEYS SHM(0x2E0) /* TKIP Phase 1 keys. */
  98. #define SHM_KEYIDXBLOCK SHM(0x5D4) /* Key index/algorithm block. */
  99. /* WME variables */
  100. #define SHM_EDCFSTAT SHM(0x00E) /* EDCF status */
  101. #define SHM_TXFCUR SHM(0x030) /* TXF current index */
  102. #define SHM_EDCFQ SHM(0x240) /* EDCF Q info */
  103. /* Powersave mode related variables */
  104. #define SHM_SLOTT SHM(0x010) /* Slot time */
  105. #define SHM_DTIMPER SHM(0x012) /* DTIM period */
  106. #define SHM_NOSLPZNATDTIM SHM(0x04C) /* NOSLPZNAT DTIM */
  107. /* Beacon/AP variables */
  108. #define SHM_BTL0 SHM(0x018) /* Beacon template length 0 */
  109. #define SHM_BTL1 SHM(0x01A) /* Beacon template length 1 */
  110. #define SHM_BTSFOFF SHM(0x01C) /* Beacon TSF offset */
  111. #define SHM_TIMBPOS SHM(0x01E) /* TIM B position in beacon */
  112. #define SHM_DTIMP SHM(0x012) /* DTIP period */
  113. #define SHM_MCASTCOOKIE SHM(0x0A8) /* Last bcast/mcast frame ID */
  114. #define SHM_SFFBLIM SHM(0x044) /* Short frame fallback retry limit */
  115. #define SHM_LFFBLIM SHM(0x046) /* Long frame fallback retry limit */
  116. #define SHM_BEACPHYCTL SHM(0x054) /* Beacon PHY TX control word (see PHY TX control) */
  117. #define SHM_EXTNPHYCTL SHM(0x0B0) /* Extended bytes for beacon PHY control (N) */
  118. /* ACK/CTS control */
  119. #define SHM_ACKCTSPHYCTL SHM(0x022) /* ACK/CTS PHY control word (see PHY TX control) */
  120. /* Probe response variables */
  121. #define SHM_PRSSID SHM(0x160) /* Probe Response SSID */
  122. #define SHM_PRSSIDLEN SHM(0x048) /* Probe Response SSID length */
  123. #define SHM_PRTLEN SHM(0x04A) /* Probe Response template length */
  124. #define SHM_PRMAXTIME SHM(0x074) /* Probe Response max time */
  125. #define SHM_PRPHYCTL SHM(0x188) /* Probe Response PHY TX control word */
  126. /* Rate tables */
  127. #define SHM_OFDMDIRECT SHM(0x1C0) /* Pointer to OFDM direct map */
  128. #define SHM_OFDMBASIC SHM(0x1E0) /* Pointer to OFDM basic rate map */
  129. #define SHM_CCKDIRECT SHM(0x200) /* Pointer to CCK direct map */
  130. #define SHM_CCKBASIC SHM(0x220) /* Pointer to CCK basic rate map */
  131. /* Microcode soft registers */
  132. #define SHM_UCODEREV SHM(0x000) /* Microcode revision */
  133. #define SHM_UCODEPATCH SHM(0x002) /* Microcode patchlevel */
  134. #define SHM_UCODEDATE SHM(0x004) /* Microcode date */
  135. #define SHM_UCODETIME SHM(0x006) /* Microcode time */
  136. #define SHM_UCODESTAT SHM(0x040) /* Microcode debug status code */
  137. #define SHM_UCODESTAT_INVALID 0
  138. #define SHM_UCODESTAT_INIT 1
  139. #define SHM_UCODESTAT_ACTIVE 2
  140. #define SHM_UCODESTAT_SUSP 3 /* suspended */
  141. #define SHM_UCODESTAT_SLEEP 4 /* asleep (PS) */
  142. #define SHM_MAXBFRAMES SHM(0x080) /* Maximum number of frames in a burst */
  143. #define SHM_SPUWKUP SHM(0x094) /* pre-wakeup for synth PU in us */
  144. #define SHM_PRETBTT SHM(0x096) /* pre-TBTT in us */
  145. /* TX header WORD(!) offsets. These are used as offsets into the TX header
  146. * information fields in SHM for each FIFO via offset register pointer. */
  147. #define TXHDR_MACLO SHM_OFFSET(0x00) /* MAC control lo */
  148. #define TXHDR_MACLO_DFCS 6 /* bit6: Do not generate FCS */
  149. #define TXHDR_MACHI SHM_OFFSET(0x02) /* MAC control hi */
  150. #define TXHDR_FCTL SHM_OFFSET(0x04) /* Frame Control field copy */
  151. #define TXHDR_FES SHM_OFFSET(0x06) /* TX FES Time Normal */
  152. #define TXHDR_PHYCTL SHM_OFFSET(0x08) /* PHY control word */
  153. #define TXHDR_PHYCTL1 SHM_OFFSET(0x0A) /* PHY control word 1 */
  154. #define TXHDR_PHYCTL1FB SHM_OFFSET(0x0C) /* PHY control word 1 for fallback */
  155. #define TXHDR_PHYCTL1RTS SHM_OFFSET(0x0E) /* PHY control word 1 RTS */
  156. #define TXHDR_PHYCTL1RTSFB SHM_OFFSET(0x10) /* PHY control word 1 RTS for fallback */
  157. #define TXHDR_PHYRATES SHM_OFFSET(0x12) /* PHY rates */
  158. #define TXHDR_EFT SHM_OFFSET(0x14) /* Extra Frame Types */
  159. #define TXHDR_IV SHM_OFFSET(0x16) /* IV / crypto field */
  160. #define TXHDR_RA SHM_OFFSET(0x26) /* Frame receiver address */
  161. #define TXHDR_FESFB SHM_OFFSET(0x2C) /* TX FES Time fallback */
  162. #define TXHDR_RTSPLCPFB SHM_OFFSET(0x2E) /* RTS PLCP fallback */
  163. #define TXHDR_RTSDURFB SHM_OFFSET(0x34) /* RTS duration fallback */
  164. #define TXHDR_PLCPFB SHM_OFFSET(0x36) /* PLCP fallback */
  165. #define TXHDR_DURFB SHM_OFFSET(0x3C) /* Duration fallback */
  166. #define TXHDR_MIMOML SHM_OFFSET(0x3E) /* MIMO mode length */
  167. #define TXHDR_MIMOFBRL SHM_OFFSET(0x40) /* MIMO fallback rate length */
  168. #define TXHDR_TOLO SHM_OFFSET(0x42) /* Timeout low */
  169. #define TXHDR_TOHI SHM_OFFSET(0x44) /* Timeout high */
  170. #define TXHDR_MIMOAS SHM_OFFSET(0x46) /* MIMO antenna select */
  171. #define TXHDR_PRELSZ SHM_OFFSET(0x48) /* Preload size */
  172. #define TXHDR_UNUSED1 SHM_OFFSET(0x4A) /* Unused padding */
  173. #define TXHDR_COOKIE SHM_OFFSET(0x4C) /* Frame ID */
  174. #define TXHDR_STAT SHM_OFFSET(0x4E) /* Status */
  175. #define TXHDR_RTSPLCP SHM_OFFSET(0x50) /* RTS PLCP header */
  176. #define TXHDR_RTS SHM_OFFSET(0x56) /* RTS frame */
  177. #define TXHDR_UNUSED2 SHM_OFFSET(0x66) /* Unused padding */
  178. #define TXHDR_WSIZE (104 / 2) /* Header size, in words */
  179. #define TXHDR_NR_COPY_BYTES (TXHDR_RTSPLCP * 2) /* We copy everything up to the RTS header to SHM */
  180. /* END ABI: End of the driver ABI definitions */
  181. #endif /* SHARED_MEMORY_H_ */
  182. // vim: syntax=b43 ts=8