msm_smd.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* linux/include/asm-arm/arch-msm/msm_smd.h
  2. *
  3. * Copyright (C) 2007 Google, Inc.
  4. * Author: Brian Swetland <swetland@google.com>
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef __ASM_ARCH_MSM_SMD_H
  17. #define __ASM_ARCH_MSM_SMD_H
  18. typedef struct smd_channel smd_channel_t;
  19. extern int (*msm_check_for_modem_crash)(void);
  20. /* warning: notify() may be called before open returns */
  21. int smd_open(const char *name, smd_channel_t **ch, void *priv,
  22. void (*notify)(void *priv, unsigned event));
  23. #define SMD_EVENT_DATA 1
  24. #define SMD_EVENT_OPEN 2
  25. #define SMD_EVENT_CLOSE 3
  26. int smd_close(smd_channel_t *ch);
  27. /* passing a null pointer for data reads and discards */
  28. int smd_read(smd_channel_t *ch, void *data, int len);
  29. /* Write to stream channels may do a partial write and return
  30. ** the length actually written.
  31. ** Write to packet channels will never do a partial write --
  32. ** it will return the requested length written or an error.
  33. */
  34. int smd_write(smd_channel_t *ch, const void *data, int len);
  35. int smd_write_atomic(smd_channel_t *ch, const void *data, int len);
  36. int smd_write_avail(smd_channel_t *ch);
  37. int smd_read_avail(smd_channel_t *ch);
  38. /* Returns the total size of the current packet being read.
  39. ** Returns 0 if no packets available or a stream channel.
  40. */
  41. int smd_cur_packet_size(smd_channel_t *ch);
  42. /* used for tty unthrottling and the like -- causes the notify()
  43. ** callback to be called from the same lock context as is used
  44. ** when it is called from channel updates
  45. */
  46. void smd_kick(smd_channel_t *ch);
  47. #if 0
  48. /* these are interruptable waits which will block you until the specified
  49. ** number of bytes are readable or writable.
  50. */
  51. int smd_wait_until_readable(smd_channel_t *ch, int bytes);
  52. int smd_wait_until_writable(smd_channel_t *ch, int bytes);
  53. #endif
  54. typedef enum {
  55. SMD_PORT_DS = 0,
  56. SMD_PORT_DIAG,
  57. SMD_PORT_RPC_CALL,
  58. SMD_PORT_RPC_REPLY,
  59. SMD_PORT_BT,
  60. SMD_PORT_CONTROL,
  61. SMD_PORT_MEMCPY_SPARE1,
  62. SMD_PORT_DATA1,
  63. SMD_PORT_DATA2,
  64. SMD_PORT_DATA3,
  65. SMD_PORT_DATA4,
  66. SMD_PORT_DATA5,
  67. SMD_PORT_DATA6,
  68. SMD_PORT_DATA7,
  69. SMD_PORT_DATA8,
  70. SMD_PORT_DATA9,
  71. SMD_PORT_DATA10,
  72. SMD_PORT_DATA11,
  73. SMD_PORT_DATA12,
  74. SMD_PORT_DATA13,
  75. SMD_PORT_DATA14,
  76. SMD_PORT_DATA15,
  77. SMD_PORT_DATA16,
  78. SMD_PORT_DATA17,
  79. SMD_PORT_DATA18,
  80. SMD_PORT_DATA19,
  81. SMD_PORT_DATA20,
  82. SMD_PORT_GPS_NMEA,
  83. SMD_PORT_BRIDGE_1,
  84. SMD_PORT_BRIDGE_2,
  85. SMD_PORT_BRIDGE_3,
  86. SMD_PORT_BRIDGE_4,
  87. SMD_PORT_BRIDGE_5,
  88. SMD_PORT_LOOPBACK,
  89. SMD_PORT_CS_APPS_MODEM,
  90. SMD_PORT_CS_APPS_DSP,
  91. SMD_PORT_CS_MODEM_DSP,
  92. SMD_NUM_PORTS,
  93. } smd_port_id_type;
  94. #endif