sipc_v2.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (C) 2012-2019 Spreadtrum Communications Inc.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __SIPC_H
  14. #define __SIPC_H
  15. #include <string.h>
  16. #include "drv_md_ipc.h"
  17. /* SMSG interfaces */
  18. /* sipc processor ID definition */
  19. enum
  20. {
  21. SIPC_ID_AP = 0, /* Application Processor */
  22. SIPC_ID_MINIAP, /* mini AP processor */
  23. SIPC_ID_CPW, /* WCDMA processor */
  24. SIPC_ID_WCN, /* Wireless Connectivity */
  25. SIPC_ID_GNSS, /* Gps processor(gnss) */
  26. SIPC_ID_PSCP, /* Protocol stack processor */
  27. SIPC_ID_PM_SYS, /* Power management processor */
  28. SIPC_ID_NR_PHY, /* New Radio PHY processor */
  29. SIPC_ID_V3_PHY, /* MODEM v3 PHY processor */
  30. SIPC_ID_NR, /* Max processor number */
  31. };
  32. /* smsg channel definition */
  33. enum
  34. {
  35. SMSG_CH_CTRL = 0, /* some emergency control */
  36. SMSG_CH_COMM, /* general communication channel */
  37. SMSG_CH_IMSBR_DATA, /* ims bridge data channel */
  38. SMSG_CH_IMSBR_CTRL, /* ims bridge control channel */
  39. SMSG_CH_PIPE, /* general pipe channel */
  40. SMSG_CH_PLOG, /* pipe for debug log/dump */
  41. SMSG_CH_TTY, /* virtual serial for telephony */
  42. SMSG_CH_DATA0, /* 2G/3G wirleless data */
  43. SMSG_CH_DATA1, /* 2G/3G wirleless data */
  44. SMSG_CH_DATA2, /* 2G/3G wirleless data */
  45. SMSG_CH_VBC, /* audio conrol channel */
  46. SMSG_CH_PLAYBACK, /* audio playback channel */
  47. SMSG_CH_CAPTURE, /* audio capture channel */
  48. SMSG_CH_MONITOR_AUDIO, /* audio monitor channel */
  49. SMSG_CH_CTRL_VOIP, /* audio voip conrol channel */
  50. SMSG_CH_PLAYBACK_VOIP, /* audio voip playback channel */
  51. SMSG_CH_CAPTURE_VOIP, /* audio voip capture channel */
  52. SMSG_CH_MONITOR_VOIP, /* audio voip monitor channel */
  53. SMSG_CH_DATA3, /* 2G/3G wirleless data */
  54. SMSG_CH_DATA4, /* 2G/3G wirleless data */
  55. SMSG_CH_DATA5, /* 2G/3G wirleless data */
  56. SMSG_CH_DIAG, /* pipe for debug log/dump */
  57. SMSG_CH_PM_CTRL, /* power management control */
  58. SMSG_CH_DUAL_SIM_PLUG, /* dual sim plug channel */
  59. SMSG_CH_END /* will not allow add channel in here */
  60. };
  61. typedef struct
  62. {
  63. int32 ch_id;
  64. int32 ch_stat;
  65. struct smd_ch *ch;
  66. } GNSS_SIPC;
  67. /* ****************************************************************** */
  68. /* SPIPE interfaces */
  69. /**
  70. * spipe_open -- open a spipe device
  71. *
  72. * @dst: dest processor ID
  73. * @channel: channel ID
  74. * @bufid: ringbuf ID
  75. * @return: spipe device handle on success, NULL on failure
  76. * NOTE: this api only be called at follow situation:
  77. * (1) client mode
  78. * (2) host mode with the device that configured by
  79. * mem_sipc_cfg
  80. *
  81. */
  82. void *spipe_open(uint8 dst, uint8 channel, uint8 bufid);
  83. /**
  84. * spipe_read -- read data from specified ringbuf
  85. *
  86. * @spipe_ptr: handle of spipe device
  87. * @buf: buffer addr of read
  88. * @count: request data lenth
  89. * @return: valid data lenth of read,<0 on failure
  90. */
  91. int spipe_read(void *spipe_ptr,
  92. char *buf, size_t count, int timeout);
  93. /**
  94. * spipe_write -- write data to specified ringbuf
  95. *
  96. * @spipe_ptr: handle of spipe device
  97. * @buf: buffer addr of write
  98. * @count: request data lenth
  99. * @return: valid data lenth of wrtie,<0 on failure
  100. */
  101. int spipe_write(void *spipe_ptr,
  102. const char *buf, size_t count, int timeout);
  103. /**
  104. * spipe_close -- release a spipe device
  105. *
  106. * @spipe_ptr: handle of spipe device
  107. * @return: 0 on success, <0 on failure
  108. */
  109. int spipe_close(void *spipe_ptr);
  110. #endif //__SIPC_H