Input: sprd_eic_keys: remove event log
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / sipc / sbuf.h
1 /*
2  * Copyright (C) 2012 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
14 #ifndef __SBUF_H
15 #define __SBUF_H
16
17 /* flag for CMD/DONE msg type */
18 #define SMSG_CMD_SBUF_INIT      0x0001
19 #define SMSG_DONE_SBUF_INIT     0x0002
20
21 /* flag for EVENT msg type */
22 #define SMSG_EVENT_SBUF_WRPTR   0x0001
23 #define SMSG_EVENT_SBUF_RDPTR   0x0002
24
25 /* ring buf header */
26 struct sbuf_ring_header {
27         /* send-buffer info */
28         uint32_t                txbuf_addr;
29         uint32_t                txbuf_size;
30         uint32_t                txbuf_rdptr;
31         uint32_t                txbuf_wrptr;
32
33         /* recv-buffer info */
34         uint32_t                rxbuf_addr;
35         uint32_t                rxbuf_size;
36         uint32_t                rxbuf_rdptr;
37         uint32_t                rxbuf_wrptr;
38 };
39
40 /* sbuf_mem is the structure of smem for rings */
41 struct sbuf_smem_header {
42         uint32_t                ringnr;
43
44         struct sbuf_ring_header headers[0];
45 };
46
47 struct sbuf_ring {
48         /* tx/rx buffer info */
49         volatile struct sbuf_ring_header        *header;
50
51         void                    *txbuf_virt;
52         void                    *rxbuf_virt;
53
54         /* send/recv wait queue */
55         wait_queue_head_t       txwait;
56         wait_queue_head_t       rxwait;
57
58         /* send/recv mutex */
59         struct mutex            txlock;
60         struct mutex            rxlock;
61
62         void                    (*handler)(int event, void *data);
63         void                    *data;
64 };
65
66 #define SBUF_STATE_IDLE         0
67 #define SBUF_STATE_READY        1
68
69 struct sbuf_mgr {
70         uint8_t                 dst;
71         uint8_t                 channel;
72         uint32_t                state;
73
74         void                    *smem_virt;
75         uint32_t                smem_addr;
76         uint32_t                smem_size;
77         uint32_t                ringnr;
78         struct sbuf_ring        *rings;
79         struct task_struct      *thread;
80 };
81
82 #endif