blob: 47c85551cf27dae29334d817492684b44591c2eb [file] [log] [blame]
Sreelakshmi Gownipallicb8893d2016-10-19 16:02:34 -07001/* Copyright (c) 2008-2016, 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
13#ifndef DIAGFWD_H
14#define DIAGFWD_H
15
16/*
17 * The context applies to Diag SMD data buffers. It is used to identify the
18 * buffer once these buffers are writtent to USB.
19 */
20#define SET_BUF_CTXT(p, d, n) \
21 (((p & 0xFF) << 16) | ((d & 0xFF) << 8) | (n & 0xFF))
22#define GET_BUF_PERIPHERAL(p) ((p & 0xFF0000) >> 16)
23#define GET_BUF_TYPE(d) ((d & 0x00FF00) >> 8)
24#define GET_BUF_NUM(n) ((n & 0x0000FF))
25
26#define CHK_OVERFLOW(bufStart, start, end, length) \
27 ((((bufStart) <= (start)) && ((end) - (start) >= (length))) ? 1 : 0)
28
29int diagfwd_init(void);
30void diagfwd_exit(void);
31void diag_process_hdlc_pkt(void *data, unsigned int len,
32 struct diag_md_session_t *info);
33void diag_process_non_hdlc_pkt(unsigned char *data, int len,
34 struct diag_md_session_t *info);
35int chk_config_get_id(void);
36int chk_apps_only(void);
37int chk_apps_master(void);
38int chk_polling_response(void);
39int diag_cmd_log_on_demand(unsigned char *src_buf, int src_len,
40 unsigned char *dest_buf, int dest_len);
41int diag_cmd_get_mobile_id(unsigned char *src_buf, int src_len,
42 unsigned char *dest_buf, int dest_len);
43int diag_check_common_cmd(struct diag_pkt_header_t *header);
44void diag_update_userspace_clients(unsigned int type);
45void diag_update_sleeping_process(int process_id, int data_type);
46int diag_process_apps_pkt(unsigned char *buf, int len,
47 struct diag_md_session_t *info);
48void diag_send_error_rsp(unsigned char *buf, int len);
49void diag_update_pkt_buffer(unsigned char *buf, uint32_t len, int type);
50int diag_process_stm_cmd(unsigned char *buf, unsigned char *dest_buf);
51void diag_md_hdlc_reset_timer_func(unsigned long pid);
52void diag_update_md_clients(unsigned int type);
53#endif