blob: 02b97576d69e61bbedb56d2ed8fdac61df238282 [file] [log] [blame]
Dixon Petersonf2d449c2013-02-01 18:02:20 -08001/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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 Jainf50076b2012-02-15 19:27:01 -080016/* 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 Jainf50076b2012-02-15 19:27:01 -080024/* 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
Dixon Petersonbae1fe02013-05-07 19:42:55 -070032#define DIAG_CTRL_MSG_NUM_PRESETS 12
33#define DIAG_CTRL_MSG_SET_PRESET_ID 13
34#define DIAG_CTRL_MSG_LOG_MASK_WITH_PRESET_ID 14
35#define DIAG_CTRL_MSG_EVENT_MASK_WITH_PRESET_ID 15
36#define DIAG_CTRL_MSG_F3_MASK_WITH_PRESET_ID 16
37#define DIAG_CTRL_MSG_LAST DIAG_CTRL_MSG_F3_MASK_WITH_PRESET_ID
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070038
Dixon Peterson2a49ad22013-04-24 17:10:39 -070039/* Denotes that we support sending/receiving the feature mask */
Dixon Peterson3ff84ea2012-12-21 20:16:18 -080040#define F_DIAG_INT_FEATURE_MASK 0x01
41/* Denotes that we support responding to "Log on Demand" */
42#define F_DIAG_LOG_ON_DEMAND_RSP_ON_MASTER 0x04
43/*
44 * Supports dedicated main request/response on
45 * new Data Rx and DCI Rx channels
46 */
47#define F_DIAG_REQ_RSP_CHANNEL 0x10
48
49#define ENABLE_SEPARATE_CMDRSP 1
50#define DISABLE_SEPARATE_CMDRSP 0
Dixon Peterson2a49ad22013-04-24 17:10:39 -070051
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052struct cmd_code_range {
53 uint16_t cmd_code_lo;
54 uint16_t cmd_code_hi;
55 uint32_t data;
56};
57
58struct diag_ctrl_msg {
59 uint32_t version;
60 uint16_t cmd_code;
61 uint16_t subsysid;
62 uint16_t count_entries;
63 uint16_t port;
64};
65
Shalabh Jain321c8b52012-02-22 12:37:06 -080066struct diag_ctrl_event_mask {
67 uint32_t cmd_type;
68 uint32_t data_len;
69 uint8_t stream_id;
70 uint8_t status;
71 uint8_t event_config;
72 uint32_t event_mask_size;
73 /* Copy event mask here */
74} __packed;
75
76struct diag_ctrl_log_mask {
77 uint32_t cmd_type;
78 uint32_t data_len;
79 uint8_t stream_id;
80 uint8_t status;
81 uint8_t equip_id;
82 uint32_t num_items; /* Last log code for this equip_id */
83 uint32_t log_mask_size; /* Size of log mask stored in log_mask[] */
84 /* Copy log mask here */
85} __packed;
86
87struct diag_ctrl_msg_mask {
88 uint32_t cmd_type;
89 uint32_t data_len;
90 uint8_t stream_id;
91 uint8_t status;
92 uint8_t msg_mode;
93 uint16_t ssid_first; /* Start of range of supported SSIDs */
94 uint16_t ssid_last; /* Last SSID in range */
95 uint32_t msg_mask_size; /* ssid_last - ssid_first + 1 */
96 /* Copy msg mask here */
97} __packed;
98
Ravi Aravamudhand09f8772012-12-20 14:48:30 -080099struct diag_ctrl_feature_mask {
100 uint32_t ctrl_pkt_id;
101 uint32_t ctrl_pkt_data_len;
102 uint32_t feature_mask_len;
103 /* Copy feature mask here */
104} __packed;
105
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800106struct 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
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700120void diagfwd_cntl_init(void);
121void diagfwd_cntl_exit(void);
122void diag_read_smd_cntl_work_fn(struct work_struct *);
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800123void diag_notify_ctrl_update_fn(struct work_struct *work);
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800124void diag_clean_reg_fn(struct work_struct *work);
125int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf,
126 int total_recd);
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800127void diag_send_diag_mode_update(int real_time);
128void diag_send_diag_mode_update_by_smd(struct diag_smd_info *smd_info,
129 int real_time);
Dixon Peterson29aebee2012-04-06 12:44:08 -0700130
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700131#endif