diagfwd_smd.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (c) 2015, 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_SMD_H
  13. #define DIAGFWD_SMD_H
  14. #define DIAG_SMD_NAME_SZ 24
  15. #define SMD_DRAIN_BUF_SIZE 4096
  16. struct diag_smd_info {
  17. uint8_t peripheral;
  18. uint8_t type;
  19. uint8_t inited;
  20. atomic_t opened;
  21. atomic_t diag_state;
  22. uint32_t fifo_size;
  23. smd_channel_t *hdl;
  24. char name[DIAG_SMD_NAME_SZ];
  25. struct mutex lock;
  26. wait_queue_head_t read_wait_q;
  27. struct workqueue_struct *wq;
  28. struct work_struct open_work;
  29. struct work_struct close_work;
  30. struct work_struct read_work;
  31. struct work_struct late_init_work;
  32. struct diagfwd_info *fwd_ctxt;
  33. };
  34. extern struct diag_smd_info smd_data[NUM_PERIPHERALS];
  35. extern struct diag_smd_info smd_cntl[NUM_PERIPHERALS];
  36. extern struct diag_smd_info smd_dci[NUM_PERIPHERALS];
  37. extern struct diag_smd_info smd_cmd[NUM_PERIPHERALS];
  38. extern struct diag_smd_info smd_dci_cmd[NUM_PERIPHERALS];
  39. int diag_smd_init_peripheral(uint8_t peripheral);
  40. void diag_smd_exit(void);
  41. int diag_smd_init(void);
  42. void diag_smd_early_exit(void);
  43. void diag_smd_invalidate(void *ctxt, struct diagfwd_info *fwd_ctxt);
  44. int diag_smd_check_state(void *ctxt);
  45. #ifndef CONFIG_DIAG_USES_SMD
  46. #define _diag_smd_exit(void)
  47. #define _diag_smd_init(void)
  48. #else
  49. #define _diag_smd_exit(void) diag_smd_exit(void)
  50. #define _diag_smd_init(void) diag_smd_init(void)
  51. #endif
  52. #endif