1 /* linux/include/asm-arm/arch-msm/msm_smd.h
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
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.
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.
17 #ifndef __ASM_ARCH_MSM_SMD_H
18 #define __ASM_ARCH_MSM_SMD_H
20 typedef struct smd_channel smd_channel_t
;
22 extern int (*msm_check_for_modem_crash
)(void);
24 /* warning: notify() may be called before open returns */
25 int smd_open(const char *name
, smd_channel_t
**ch
, void *priv
,
26 void (*notify
)(void *priv
, unsigned event
));
28 #define SMD_EVENT_DATA 1
29 #define SMD_EVENT_OPEN 2
30 #define SMD_EVENT_CLOSE 3
32 int smd_close(smd_channel_t
*ch
);
34 /* passing a null pointer for data reads and discards */
35 int smd_read(smd_channel_t
*ch
, void *data
, int len
);
37 /* Write to stream channels may do a partial write and return
38 ** the length actually written.
39 ** Write to packet channels will never do a partial write --
40 ** it will return the requested length written or an error.
42 int smd_write(smd_channel_t
*ch
, const void *data
, int len
);
43 int smd_write_atomic(smd_channel_t
*ch
, const void *data
, int len
);
45 int smd_write_avail(smd_channel_t
*ch
);
46 int smd_read_avail(smd_channel_t
*ch
);
48 /* Returns the total size of the current packet being read.
49 ** Returns 0 if no packets available or a stream channel.
51 int smd_cur_packet_size(smd_channel_t
*ch
);
53 /* used for tty unthrottling and the like -- causes the notify()
54 ** callback to be called from the same lock context as is used
55 ** when it is called from channel updates
57 void smd_kick(smd_channel_t
*ch
);
61 /* these are interruptable waits which will block you until the specified
62 ** number of bytes are readable or writable.
64 int smd_wait_until_readable(smd_channel_t
*ch
, int bytes
);
65 int smd_wait_until_writable(smd_channel_t
*ch
, int bytes
);
75 SMD_PORT_MEMCPY_SPARE1
,
103 SMD_PORT_CS_APPS_MODEM
,
104 SMD_PORT_CS_APPS_DSP
,
105 SMD_PORT_CS_MODEM_DSP
,