Sreelakshmi Gownipalli | cb8893d | 2016-10-19 16:02:34 -0700 | [diff] [blame] | 1 | /* 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 | |
| 29 | int diagfwd_init(void); |
| 30 | void diagfwd_exit(void); |
| 31 | void diag_process_hdlc_pkt(void *data, unsigned int len, |
| 32 | struct diag_md_session_t *info); |
| 33 | void diag_process_non_hdlc_pkt(unsigned char *data, int len, |
| 34 | struct diag_md_session_t *info); |
| 35 | int chk_config_get_id(void); |
| 36 | int chk_apps_only(void); |
| 37 | int chk_apps_master(void); |
| 38 | int chk_polling_response(void); |
| 39 | int diag_cmd_log_on_demand(unsigned char *src_buf, int src_len, |
| 40 | unsigned char *dest_buf, int dest_len); |
| 41 | int diag_cmd_get_mobile_id(unsigned char *src_buf, int src_len, |
| 42 | unsigned char *dest_buf, int dest_len); |
| 43 | int diag_check_common_cmd(struct diag_pkt_header_t *header); |
| 44 | void diag_update_userspace_clients(unsigned int type); |
| 45 | void diag_update_sleeping_process(int process_id, int data_type); |
| 46 | int diag_process_apps_pkt(unsigned char *buf, int len, |
| 47 | struct diag_md_session_t *info); |
| 48 | void diag_send_error_rsp(unsigned char *buf, int len); |
| 49 | void diag_update_pkt_buffer(unsigned char *buf, uint32_t len, int type); |
| 50 | int diag_process_stm_cmd(unsigned char *buf, unsigned char *dest_buf); |
| 51 | void diag_md_hdlc_reset_timer_func(unsigned long pid); |
| 52 | void diag_update_md_clients(unsigned int type); |
| 53 | #endif |