2 * Copyright (C) 2012 Spreadtrum Communications Inc.
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.
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.
17 /* flag for CMD/DONE msg type */
18 #define SMSG_CMD_SBUF_INIT 0x0001
19 #define SMSG_DONE_SBUF_INIT 0x0002
21 /* flag for EVENT msg type */
22 #define SMSG_EVENT_SBUF_WRPTR 0x0001
23 #define SMSG_EVENT_SBUF_RDPTR 0x0002
26 struct sbuf_ring_header {
27 /* send-buffer info */
33 /* recv-buffer info */
40 /* sbuf_mem is the structure of smem for rings */
41 struct sbuf_smem_header {
44 struct sbuf_ring_header headers[0];
48 /* tx/rx buffer info */
49 volatile struct sbuf_ring_header *header;
54 /* send/recv wait queue */
55 wait_queue_head_t txwait;
56 wait_queue_head_t rxwait;
62 void (*handler)(int event, void *data);
66 #define SBUF_STATE_IDLE 0
67 #define SBUF_STATE_READY 1
78 struct sbuf_ring *rings;
79 struct task_struct *thread;