diagfwd.h 2.3 KB

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