mci.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (c) 2010-2011 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef MCI_H
  17. #define MCI_H
  18. #include "ar9003_mci.h"
  19. #define ATH_MCI_SCHED_BUF_SIZE (16 * 16) /* 16 entries, 4 dword each */
  20. #define ATH_MCI_GPM_MAX_ENTRY 16
  21. #define ATH_MCI_GPM_BUF_SIZE (ATH_MCI_GPM_MAX_ENTRY * 16)
  22. #define ATH_MCI_DEF_BT_PERIOD 40
  23. #define ATH_MCI_BDR_DUTY_CYCLE 20
  24. #define ATH_MCI_MAX_DUTY_CYCLE 90
  25. #define ATH_MCI_DEF_AGGR_LIMIT 6 /* in 0.24 ms */
  26. #define ATH_MCI_MAX_ACL_PROFILE 7
  27. #define ATH_MCI_MAX_SCO_PROFILE 1
  28. #define ATH_MCI_MAX_PROFILE (ATH_MCI_MAX_ACL_PROFILE +\
  29. ATH_MCI_MAX_SCO_PROFILE)
  30. #define INC_PROF(_mci, _info) do { \
  31. switch (_info->type) { \
  32. case MCI_GPM_COEX_PROFILE_RFCOMM:\
  33. _mci->num_other_acl++; \
  34. break; \
  35. case MCI_GPM_COEX_PROFILE_A2DP: \
  36. _mci->num_a2dp++; \
  37. if (!_info->edr) \
  38. _mci->num_bdr++; \
  39. break; \
  40. case MCI_GPM_COEX_PROFILE_HID: \
  41. _mci->num_hid++; \
  42. break; \
  43. case MCI_GPM_COEX_PROFILE_BNEP: \
  44. _mci->num_pan++; \
  45. break; \
  46. case MCI_GPM_COEX_PROFILE_VOICE: \
  47. _mci->num_sco++; \
  48. break; \
  49. default: \
  50. break; \
  51. } \
  52. } while (0)
  53. #define DEC_PROF(_mci, _info) do { \
  54. switch (_info->type) { \
  55. case MCI_GPM_COEX_PROFILE_RFCOMM:\
  56. _mci->num_other_acl--; \
  57. break; \
  58. case MCI_GPM_COEX_PROFILE_A2DP: \
  59. _mci->num_a2dp--; \
  60. if (!_info->edr) \
  61. _mci->num_bdr--; \
  62. break; \
  63. case MCI_GPM_COEX_PROFILE_HID: \
  64. _mci->num_hid--; \
  65. break; \
  66. case MCI_GPM_COEX_PROFILE_BNEP: \
  67. _mci->num_pan--; \
  68. break; \
  69. case MCI_GPM_COEX_PROFILE_VOICE: \
  70. _mci->num_sco--; \
  71. break; \
  72. default: \
  73. break; \
  74. } \
  75. } while (0)
  76. #define NUM_PROF(_mci) (_mci->num_other_acl + _mci->num_a2dp + \
  77. _mci->num_hid + _mci->num_pan + _mci->num_sco)
  78. struct ath_mci_profile_info {
  79. u8 type;
  80. u8 conn_handle;
  81. bool start;
  82. bool master;
  83. bool edr;
  84. u8 voice_type;
  85. u16 T; /* Voice: Tvoice, HID: Tsniff, in slots */
  86. u8 W; /* Voice: Wvoice, HID: Sniff timeout, in slots */
  87. u8 A; /* HID: Sniff attempt, in slots */
  88. struct list_head list;
  89. };
  90. struct ath_mci_profile_status {
  91. bool is_critical;
  92. bool is_link;
  93. u8 conn_handle;
  94. };
  95. struct ath_mci_profile {
  96. struct list_head info;
  97. DECLARE_BITMAP(status, ATH_MCI_MAX_PROFILE);
  98. u16 aggr_limit;
  99. u8 num_mgmt;
  100. u8 num_sco;
  101. u8 num_a2dp;
  102. u8 num_hid;
  103. u8 num_pan;
  104. u8 num_other_acl;
  105. u8 num_bdr;
  106. };
  107. struct ath_mci_buf {
  108. void *bf_addr; /* virtual addr of desc */
  109. dma_addr_t bf_paddr; /* physical addr of buffer */
  110. u32 bf_len; /* len of data */
  111. };
  112. struct ath_mci_coex {
  113. struct ath_mci_buf sched_buf;
  114. struct ath_mci_buf gpm_buf;
  115. };
  116. void ath_mci_flush_profile(struct ath_mci_profile *mci);
  117. int ath_mci_setup(struct ath_softc *sc);
  118. void ath_mci_cleanup(struct ath_softc *sc);
  119. void ath_mci_intr(struct ath_softc *sc);
  120. #endif