blob: c6e1273dc585c4bca99eb1cf3f6fd064fc23debc [file] [log] [blame]
Mohit Aggarwal3aa45862013-03-05 18:37:58 +05301/* Copyright (c) 2008-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_H
14#define DIAGFWD_H
15
16#define NO_PROCESS 0
17#define NON_APPS_PROC -1
18
Dixon Peterson3ff84ea2012-12-21 20:16:18 -080019#define RESET_AND_NO_QUEUE 0
20#define RESET_AND_QUEUE 1
21
Dixon Petersond6a20a92012-09-27 15:58:50 -070022#define CHK_OVERFLOW(bufStart, start, end, length) \
23 ((((bufStart) <= (start)) && ((end) - (start) >= (length))) ? 1 : 0)
24
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025void diagfwd_init(void);
26void diagfwd_exit(void);
27void diag_process_hdlc(void *data, unsigned len);
Dixon Peterson66fb11b2012-12-04 20:30:54 -080028void diag_smd_send_req(struct diag_smd_info *smd_info);
Dixon Petersonf2d449c2013-02-01 18:02:20 -080029void process_lock_enabling(struct diag_nrt_wake_lock *lock, int real_time);
30void process_lock_on_notify(struct diag_nrt_wake_lock *lock);
31void process_lock_on_read(struct diag_nrt_wake_lock *lock, int pkt_len);
32void process_lock_on_copy(struct diag_nrt_wake_lock *lock);
33void process_lock_on_copy_complete(struct diag_nrt_wake_lock *lock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034void diag_usb_legacy_notifier(void *, unsigned, struct diag_request *);
35long diagchar_ioctl(struct file *, unsigned int, unsigned long);
36int diag_device_write(void *, int, struct diag_request *);
37int mask_request_validate(unsigned char mask_buf[]);
Shalabh Jainc2ec8292011-10-14 12:34:55 -070038void diag_clear_reg(int);
Dixon Peterson29aebee2012-04-06 12:44:08 -070039int chk_config_get_id(void);
Shalabh Jainfb8e3c12011-10-19 17:29:42 -070040int chk_apps_only(void);
Dixon Peterson29aebee2012-04-06 12:44:08 -070041int chk_apps_master(void);
42int chk_polling_response(void);
Dixon Petersond6a20a92012-09-27 15:58:50 -070043void diag_update_userspace_clients(unsigned int type);
Shalabh Jain1c99e4c2012-03-26 18:47:59 -070044void diag_update_sleeping_process(int process_id, int data_type);
Dixon Petersond6a20a92012-09-27 15:58:50 -070045void encode_rsp_and_send(int buf_length);
Dixon Peterson66fb11b2012-12-04 20:30:54 -080046void diag_smd_notify(void *ctxt, unsigned event);
47int diag_smd_constructor(struct diag_smd_info *smd_info, int peripheral,
Dixon Petersoneecbadb2012-12-10 21:59:28 -080048 int type);
Dixon Peterson66fb11b2012-12-04 20:30:54 -080049void diag_smd_destructor(struct diag_smd_info *smd_info);
Mohit Aggarwal3aa45862013-03-05 18:37:58 +053050int diag_switch_logging(unsigned long);
51int diag_command_reg(unsigned long);
52void diag_cmp_logging_modes_sdio_pipe(int old_mode, int new_mode);
53void diag_cmp_logging_modes_diagfwd_bridge(int old_mode, int new_mode);
Ravi Aravamudhan72c55282013-03-20 19:29:01 -070054int diag_process_apps_pkt(unsigned char *buf, int len);
Dixon Peterson3ff84ea2012-12-21 20:16:18 -080055void diag_reset_smd_data(int queue);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056/* State for diag forwarding */
57#ifdef CONFIG_DIAG_OVER_USB
58int diagfwd_connect(void);
59int diagfwd_disconnect(void);
60#endif
61extern int diag_debug_buf_idx;
62extern unsigned char diag_debug_buf[1024];
Shalabh Jain1c99e4c2012-03-26 18:47:59 -070063extern struct platform_driver msm_diag_dci_driver;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#endif