Input: sprd_eic_keys: remove event log
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / sipc / sblock.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 __SBLOCK_H
15 #define __SBLOCK_H
16
17 /* flag for CMD/DONE msg type */
18 #define SMSG_CMD_SBLOCK_INIT            0x0001
19 #define SMSG_DONE_SBLOCK_INIT           0x0002
20
21 /* flag for EVENT msg type */
22 #define SMSG_EVENT_SBLOCK_SEND          0x0001
23 #define SMSG_EVENT_SBLOCK_RELEASE       0x0002
24
25 #define SBLOCK_STATE_IDLE               0
26 #define SBLOCK_STATE_READY              1
27
28 #define SBLOCK_BLK_STATE_DONE           0
29 #define SBLOCK_BLK_STATE_PENDING        1
30
31 struct sblock_blks {
32         uint32_t                addr; /*phy address*/
33         uint32_t                length;
34 };
35
36 /* ring block header */
37 struct sblock_ring_header {
38         /* get|send-block info */
39         uint32_t                txblk_addr;
40         uint32_t                txblk_count;
41         uint32_t                txblk_size;
42         uint32_t                txblk_blks;
43         uint32_t                txblk_rdptr;
44         uint32_t                txblk_wrptr;
45
46         /* release|recv-block info */
47         uint32_t                rxblk_addr;
48         uint32_t                rxblk_count;
49         uint32_t                rxblk_size;
50         uint32_t                rxblk_blks;
51         uint32_t                rxblk_rdptr;
52         uint32_t                rxblk_wrptr;
53 };
54
55 struct sblock_header {
56         struct sblock_ring_header ring;
57         struct sblock_ring_header pool;
58 };
59
60 struct sblock_ring {
61         struct sblock_header    *header;
62         void                    *txblk_virt; /* virt of header->txblk_addr */
63         void                    *rxblk_virt; /* virt of header->rxblk_addr */
64
65         struct sblock_blks      *r_txblks;     /* virt of header->ring->txblk_blks */
66         struct sblock_blks      *r_rxblks;     /* virt of header->ring->rxblk_blks */
67         struct sblock_blks      *p_txblks;     /* virt of header->pool->txblk_blks */
68         struct sblock_blks      *p_rxblks;     /* virt of header->pool->rxblk_blks */
69
70         int                     *txrecord; /* record the state of every txblk */
71         int                     *rxrecord; /* record the state of every rxblk */
72         int                     yell; /* need to notify cp */
73         spinlock_t              r_txlock; /* send */
74         spinlock_t              r_rxlock; /* recv */
75         spinlock_t              p_txlock; /* get */
76         spinlock_t              p_rxlock; /* release */
77
78         wait_queue_head_t       getwait;
79         wait_queue_head_t       recvwait;
80 };
81
82 struct sblock_mgr {
83         uint8_t                 dst;
84         uint8_t                 channel;
85         uint32_t                state;
86
87         void                    *smem_virt;
88         uint32_t                smem_addr;
89         uint32_t                smem_size;
90
91         uint32_t                txblksz;
92         uint32_t                rxblksz;
93         uint32_t                txblknum;
94         uint32_t                rxblknum;
95
96         struct sblock_ring      *ring;
97         struct task_struct      *thread;
98
99         void                    (*handler)(int event, void *data);
100         void                    *data;
101 };
102
103 #endif