diagfwd_cntl.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef DIAGFWD_CNTL_H
  13. #define DIAGFWD_CNTL_H
  14. /* Message registration commands */
  15. #define DIAG_CTRL_MSG_REG 1
  16. /* Message passing for DTR events */
  17. #define DIAG_CTRL_MSG_DTR 2
  18. /* Control Diag sleep vote, buffering etc */
  19. #define DIAG_CTRL_MSG_DIAGMODE 3
  20. /* Diag data based on "light" diag mask */
  21. #define DIAG_CTRL_MSG_DIAGDATA 4
  22. /* Send diag internal feature mask 'diag_int_feature_mask' */
  23. #define DIAG_CTRL_MSG_FEATURE 8
  24. /* Send Diag log mask for a particular equip id */
  25. #define DIAG_CTRL_MSG_EQUIP_LOG_MASK 9
  26. /* Send Diag event mask */
  27. #define DIAG_CTRL_MSG_EVENT_MASK_V2 10
  28. /* Send Diag F3 mask */
  29. #define DIAG_CTRL_MSG_F3_MASK_V2 11
  30. #define DIAG_CTRL_MSG_NUM_PRESETS 12
  31. #define DIAG_CTRL_MSG_SET_PRESET_ID 13
  32. #define DIAG_CTRL_MSG_LOG_MASK_WITH_PRESET_ID 14
  33. #define DIAG_CTRL_MSG_EVENT_MASK_WITH_PRESET_ID 15
  34. #define DIAG_CTRL_MSG_F3_MASK_WITH_PRESET_ID 16
  35. #define DIAG_CTRL_MSG_LAST DIAG_CTRL_MSG_F3_MASK_WITH_PRESET_ID
  36. /* Denotes that we support sending/receiving the feature mask */
  37. #define F_DIAG_INT_FEATURE_MASK 0x01
  38. /* Denotes that we support responding to "Log on Demand" */
  39. #define F_DIAG_LOG_ON_DEMAND_RSP_ON_MASTER 0x04
  40. /*
  41. * Supports dedicated main request/response on
  42. * new Data Rx and DCI Rx channels
  43. */
  44. #define F_DIAG_REQ_RSP_CHANNEL 0x10
  45. /* Denotes we support diag over stm */
  46. #define F_DIAG_OVER_STM 0x02
  47. /* Perform hdlc encoding of data coming from smd channel */
  48. #define F_DIAG_HDLC_ENCODE_IN_APPS_MASK 0x40
  49. #define ENABLE_SEPARATE_CMDRSP 1
  50. #define DISABLE_SEPARATE_CMDRSP 0
  51. #define DISABLE_STM 0
  52. #define ENABLE_STM 1
  53. #define STATUS_STM 2
  54. #define UPDATE_PERIPHERAL_STM_STATE 1
  55. #define CLEAR_PERIPHERAL_STM_STATE 2
  56. #define ENABLE_APPS_HDLC_ENCODING 1
  57. #define DISABLE_APPS_HDLC_ENCODING 0
  58. struct cmd_code_range {
  59. uint16_t cmd_code_lo;
  60. uint16_t cmd_code_hi;
  61. uint32_t data;
  62. };
  63. struct diag_ctrl_msg {
  64. uint32_t version;
  65. uint16_t cmd_code;
  66. uint16_t subsysid;
  67. uint16_t count_entries;
  68. uint16_t port;
  69. };
  70. struct diag_ctrl_event_mask {
  71. uint32_t cmd_type;
  72. uint32_t data_len;
  73. uint8_t stream_id;
  74. uint8_t status;
  75. uint8_t event_config;
  76. uint32_t event_mask_size;
  77. /* Copy event mask here */
  78. } __packed;
  79. struct diag_ctrl_log_mask {
  80. uint32_t cmd_type;
  81. uint32_t data_len;
  82. uint8_t stream_id;
  83. uint8_t status;
  84. uint8_t equip_id;
  85. uint32_t num_items; /* Last log code for this equip_id */
  86. uint32_t log_mask_size; /* Size of log mask stored in log_mask[] */
  87. /* Copy log mask here */
  88. } __packed;
  89. struct diag_ctrl_msg_mask {
  90. uint32_t cmd_type;
  91. uint32_t data_len;
  92. uint8_t stream_id;
  93. uint8_t status;
  94. uint8_t msg_mode;
  95. uint16_t ssid_first; /* Start of range of supported SSIDs */
  96. uint16_t ssid_last; /* Last SSID in range */
  97. uint32_t msg_mask_size; /* ssid_last - ssid_first + 1 */
  98. /* Copy msg mask here */
  99. } __packed;
  100. struct diag_ctrl_feature_mask {
  101. uint32_t ctrl_pkt_id;
  102. uint32_t ctrl_pkt_data_len;
  103. uint32_t feature_mask_len;
  104. /* Copy feature mask here */
  105. } __packed;
  106. struct diag_ctrl_msg_diagmode {
  107. uint32_t ctrl_pkt_id;
  108. uint32_t ctrl_pkt_data_len;
  109. uint32_t version;
  110. uint32_t sleep_vote;
  111. uint32_t real_time;
  112. uint32_t use_nrt_values;
  113. uint32_t commit_threshold;
  114. uint32_t sleep_threshold;
  115. uint32_t sleep_time;
  116. uint32_t drain_timer_val;
  117. uint32_t event_stale_timer_val;
  118. } __packed;
  119. struct diag_ctrl_msg_stm {
  120. uint32_t ctrl_pkt_id;
  121. uint32_t ctrl_pkt_data_len;
  122. uint32_t version;
  123. uint8_t control_data;
  124. } __packed;
  125. void diagfwd_cntl_init(void);
  126. void diagfwd_cntl_exit(void);
  127. void diag_read_smd_cntl_work_fn(struct work_struct *);
  128. void diag_notify_ctrl_update_fn(struct work_struct *work);
  129. void diag_clean_reg_fn(struct work_struct *work);
  130. void diag_cntl_smd_work_fn(struct work_struct *work);
  131. int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf,
  132. int total_recd);
  133. void diag_send_diag_mode_update_by_smd(struct diag_smd_info *smd_info,
  134. int real_time);
  135. void diag_update_proc_vote(uint16_t proc, uint8_t vote);
  136. void diag_update_real_time_vote(uint16_t proc, uint8_t real_time);
  137. void diag_real_time_work_fn(struct work_struct *work);
  138. int diag_send_stm_state(struct diag_smd_info *smd_info,
  139. uint8_t stm_control_data);
  140. void diag_cntl_stm_notify(struct diag_smd_info *smd_info, int action);
  141. #endif