Dixon Peterson | f2d449c | 2013-02-01 18:02:20 -0800 | [diff] [blame^] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | |
| 13 | #ifndef DIAGFWD_CNTL_H |
| 14 | #define DIAGFWD_CNTL_H |
| 15 | |
Shalabh Jain | f50076b | 2012-02-15 19:27:01 -0800 | [diff] [blame] | 16 | /* Message registration commands */ |
| 17 | #define DIAG_CTRL_MSG_REG 1 |
| 18 | /* Message passing for DTR events */ |
| 19 | #define DIAG_CTRL_MSG_DTR 2 |
| 20 | /* Control Diag sleep vote, buffering etc */ |
| 21 | #define DIAG_CTRL_MSG_DIAGMODE 3 |
| 22 | /* Diag data based on "light" diag mask */ |
| 23 | #define DIAG_CTRL_MSG_DIAGDATA 4 |
Shalabh Jain | f50076b | 2012-02-15 19:27:01 -0800 | [diff] [blame] | 24 | /* Send diag internal feature mask 'diag_int_feature_mask' */ |
| 25 | #define DIAG_CTRL_MSG_FEATURE 8 |
| 26 | /* Send Diag log mask for a particular equip id */ |
| 27 | #define DIAG_CTRL_MSG_EQUIP_LOG_MASK 9 |
| 28 | /* Send Diag event mask */ |
| 29 | #define DIAG_CTRL_MSG_EVENT_MASK_V2 10 |
| 30 | /* Send Diag F3 mask */ |
| 31 | #define DIAG_CTRL_MSG_F3_MASK_V2 11 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 32 | |
| 33 | struct cmd_code_range { |
| 34 | uint16_t cmd_code_lo; |
| 35 | uint16_t cmd_code_hi; |
| 36 | uint32_t data; |
| 37 | }; |
| 38 | |
| 39 | struct diag_ctrl_msg { |
| 40 | uint32_t version; |
| 41 | uint16_t cmd_code; |
| 42 | uint16_t subsysid; |
| 43 | uint16_t count_entries; |
| 44 | uint16_t port; |
| 45 | }; |
| 46 | |
Shalabh Jain | 321c8b5 | 2012-02-22 12:37:06 -0800 | [diff] [blame] | 47 | struct diag_ctrl_event_mask { |
| 48 | uint32_t cmd_type; |
| 49 | uint32_t data_len; |
| 50 | uint8_t stream_id; |
| 51 | uint8_t status; |
| 52 | uint8_t event_config; |
| 53 | uint32_t event_mask_size; |
| 54 | /* Copy event mask here */ |
| 55 | } __packed; |
| 56 | |
| 57 | struct diag_ctrl_log_mask { |
| 58 | uint32_t cmd_type; |
| 59 | uint32_t data_len; |
| 60 | uint8_t stream_id; |
| 61 | uint8_t status; |
| 62 | uint8_t equip_id; |
| 63 | uint32_t num_items; /* Last log code for this equip_id */ |
| 64 | uint32_t log_mask_size; /* Size of log mask stored in log_mask[] */ |
| 65 | /* Copy log mask here */ |
| 66 | } __packed; |
| 67 | |
| 68 | struct diag_ctrl_msg_mask { |
| 69 | uint32_t cmd_type; |
| 70 | uint32_t data_len; |
| 71 | uint8_t stream_id; |
| 72 | uint8_t status; |
| 73 | uint8_t msg_mode; |
| 74 | uint16_t ssid_first; /* Start of range of supported SSIDs */ |
| 75 | uint16_t ssid_last; /* Last SSID in range */ |
| 76 | uint32_t msg_mask_size; /* ssid_last - ssid_first + 1 */ |
| 77 | /* Copy msg mask here */ |
| 78 | } __packed; |
| 79 | |
Ravi Aravamudhan | d09f877 | 2012-12-20 14:48:30 -0800 | [diff] [blame] | 80 | struct diag_ctrl_feature_mask { |
| 81 | uint32_t ctrl_pkt_id; |
| 82 | uint32_t ctrl_pkt_data_len; |
| 83 | uint32_t feature_mask_len; |
| 84 | /* Copy feature mask here */ |
| 85 | } __packed; |
| 86 | |
Dixon Peterson | f2d449c | 2013-02-01 18:02:20 -0800 | [diff] [blame^] | 87 | struct diag_ctrl_msg_diagmode { |
| 88 | uint32_t ctrl_pkt_id; |
| 89 | uint32_t ctrl_pkt_data_len; |
| 90 | uint32_t version; |
| 91 | uint32_t sleep_vote; |
| 92 | uint32_t real_time; |
| 93 | uint32_t use_nrt_values; |
| 94 | uint32_t commit_threshold; |
| 95 | uint32_t sleep_threshold; |
| 96 | uint32_t sleep_time; |
| 97 | uint32_t drain_timer_val; |
| 98 | uint32_t event_stale_timer_val; |
| 99 | } __packed; |
| 100 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 101 | void diagfwd_cntl_init(void); |
| 102 | void diagfwd_cntl_exit(void); |
| 103 | void diag_read_smd_cntl_work_fn(struct work_struct *); |
Dixon Peterson | 66fb11b | 2012-12-04 20:30:54 -0800 | [diff] [blame] | 104 | void diag_clean_reg_fn(struct work_struct *work); |
| 105 | int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf, |
| 106 | int total_recd); |
Dixon Peterson | f2d449c | 2013-02-01 18:02:20 -0800 | [diff] [blame^] | 107 | void diag_send_diag_mode_update(int real_time); |
| 108 | void diag_send_diag_mode_update_by_smd(struct diag_smd_info *smd_info, |
| 109 | int real_time); |
Dixon Peterson | 29aebee | 2012-04-06 12:44:08 -0700 | [diff] [blame] | 110 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 111 | #endif |