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_SBLOCK_INIT 0x0001
19 #define SMSG_DONE_SBLOCK_INIT 0x0002
21 /* flag for EVENT msg type */
22 #define SMSG_EVENT_SBLOCK_SEND 0x0001
23 #define SMSG_EVENT_SBLOCK_RELEASE 0x0002
25 #define SBLOCK_STATE_IDLE 0
26 #define SBLOCK_STATE_READY 1
28 #define SBLOCK_BLK_STATE_DONE 0
29 #define SBLOCK_BLK_STATE_PENDING 1
32 uint32_t addr; /*phy address*/
36 /* ring block header */
37 struct sblock_ring_header {
38 /* get|send-block info */
46 /* release|recv-block info */
55 struct sblock_header {
56 struct sblock_ring_header ring;
57 struct sblock_ring_header pool;
61 struct sblock_header *header;
62 void *txblk_virt; /* virt of header->txblk_addr */
63 void *rxblk_virt; /* virt of header->rxblk_addr */
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 */
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 */
78 wait_queue_head_t getwait;
79 wait_queue_head_t recvwait;
96 struct sblock_ring *ring;
97 struct task_struct *thread;
99 void (*handler)(int event, void *data);