mci.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. #define ATH_MCI_DEF_BT_PERIOD 40
  19. #define ATH_MCI_BDR_DUTY_CYCLE 20
  20. #define ATH_MCI_MAX_DUTY_CYCLE 90
  21. #define ATH_MCI_DEF_AGGR_LIMIT 6 /* in 0.24 ms */
  22. #define ATH_MCI_MAX_ACL_PROFILE 7
  23. #define ATH_MCI_MAX_SCO_PROFILE 1
  24. #define ATH_MCI_MAX_PROFILE (ATH_MCI_MAX_ACL_PROFILE +\
  25. ATH_MCI_MAX_SCO_PROFILE)
  26. #define INC_PROF(_mci, _info) do { \
  27. switch (_info->type) { \
  28. case MCI_GPM_COEX_PROFILE_RFCOMM:\
  29. _mci->num_other_acl++; \
  30. break; \
  31. case MCI_GPM_COEX_PROFILE_A2DP: \
  32. _mci->num_a2dp++; \
  33. if (!_info->edr) \
  34. _mci->num_bdr++; \
  35. break; \
  36. case MCI_GPM_COEX_PROFILE_HID: \
  37. _mci->num_hid++; \
  38. break; \
  39. case MCI_GPM_COEX_PROFILE_BNEP: \
  40. _mci->num_pan++; \
  41. break; \
  42. case MCI_GPM_COEX_PROFILE_VOICE: \
  43. _mci->num_sco++; \
  44. break; \
  45. default: \
  46. break; \
  47. } \
  48. } while (0)
  49. #define DEC_PROF(_mci, _info) do { \
  50. switch (_info->type) { \
  51. case MCI_GPM_COEX_PROFILE_RFCOMM:\
  52. _mci->num_other_acl--; \
  53. break; \
  54. case MCI_GPM_COEX_PROFILE_A2DP: \
  55. _mci->num_a2dp--; \
  56. if (!_info->edr) \
  57. _mci->num_bdr--; \
  58. break; \
  59. case MCI_GPM_COEX_PROFILE_HID: \
  60. _mci->num_hid--; \
  61. break; \
  62. case MCI_GPM_COEX_PROFILE_BNEP: \
  63. _mci->num_pan--; \
  64. break; \
  65. case MCI_GPM_COEX_PROFILE_VOICE: \
  66. _mci->num_sco--; \
  67. break; \
  68. default: \
  69. break; \
  70. } \
  71. } while (0)
  72. #define NUM_PROF(_mci) (_mci->num_other_acl + _mci->num_a2dp + \
  73. _mci->num_hid + _mci->num_pan + _mci->num_sco)
  74. struct ath_mci_profile_info {
  75. u8 type;
  76. u8 conn_handle;
  77. bool start;
  78. bool master;
  79. bool edr;
  80. u8 voice_type;
  81. u16 T; /* Voice: Tvoice, HID: Tsniff, in slots */
  82. u8 W; /* Voice: Wvoice, HID: Sniff timeout, in slots */
  83. u8 A; /* HID: Sniff attempt, in slots */
  84. struct list_head list;
  85. };
  86. struct ath_mci_profile_status {
  87. bool is_critical;
  88. bool is_link;
  89. u8 conn_handle;
  90. };
  91. struct ath_mci_profile {
  92. struct list_head info;
  93. DECLARE_BITMAP(status, ATH_MCI_MAX_PROFILE);
  94. u16 aggr_limit;
  95. u8 num_mgmt;
  96. u8 num_sco;
  97. u8 num_a2dp;
  98. u8 num_hid;
  99. u8 num_pan;
  100. u8 num_other_acl;
  101. u8 num_bdr;
  102. };
  103. void ath_mci_flush_profile(struct ath_mci_profile *mci);
  104. void ath_mci_process_profile(struct ath_softc *sc,
  105. struct ath_mci_profile_info *info);
  106. void ath_mci_process_status(struct ath_softc *sc,
  107. struct ath_mci_profile_status *status);
  108. #endif