xref: /OK3568_Linux_fs/kernel/drivers/char/mwave/mwavedd.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun *
3*4882a593Smuzhiyun * mwavedd.h -- declarations for mwave device driver
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Written By: Mike Sullivan IBM Corporation
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * Copyright (C) 1999 IBM Corporation
9*4882a593Smuzhiyun *
10*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify
11*4882a593Smuzhiyun * it under the terms of the GNU General Public License as published by
12*4882a593Smuzhiyun * the Free Software Foundation; either version 2 of the License, or
13*4882a593Smuzhiyun * (at your option) any later version.
14*4882a593Smuzhiyun *
15*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful,
16*4882a593Smuzhiyun * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*4882a593Smuzhiyun * GNU General Public License for more details.
19*4882a593Smuzhiyun *
20*4882a593Smuzhiyun * NO WARRANTY
21*4882a593Smuzhiyun * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
22*4882a593Smuzhiyun * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
23*4882a593Smuzhiyun * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
24*4882a593Smuzhiyun * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
25*4882a593Smuzhiyun * solely responsible for determining the appropriateness of using and
26*4882a593Smuzhiyun * distributing the Program and assumes all risks associated with its
27*4882a593Smuzhiyun * exercise of rights under this Agreement, including but not limited to
28*4882a593Smuzhiyun * the risks and costs of program errors, damage to or loss of data,
29*4882a593Smuzhiyun * programs or equipment, and unavailability or interruption of operations.
30*4882a593Smuzhiyun *
31*4882a593Smuzhiyun * DISCLAIMER OF LIABILITY
32*4882a593Smuzhiyun * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
33*4882a593Smuzhiyun * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34*4882a593Smuzhiyun * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
35*4882a593Smuzhiyun * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36*4882a593Smuzhiyun * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37*4882a593Smuzhiyun * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
38*4882a593Smuzhiyun * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
39*4882a593Smuzhiyun *
40*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License
41*4882a593Smuzhiyun * along with this program; if not, write to the Free Software
42*4882a593Smuzhiyun * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
43*4882a593Smuzhiyun *
44*4882a593Smuzhiyun *
45*4882a593Smuzhiyun * 10/23/2000 - Alpha Release
46*4882a593Smuzhiyun *	First release to the public
47*4882a593Smuzhiyun */
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun #ifndef _LINUX_MWAVEDD_H
50*4882a593Smuzhiyun #define _LINUX_MWAVEDD_H
51*4882a593Smuzhiyun #include "3780i.h"
52*4882a593Smuzhiyun #include "tp3780i.h"
53*4882a593Smuzhiyun #include "smapi.h"
54*4882a593Smuzhiyun #include "mwavepub.h"
55*4882a593Smuzhiyun #include <linux/ioctl.h>
56*4882a593Smuzhiyun #include <linux/uaccess.h>
57*4882a593Smuzhiyun #include <linux/wait.h>
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun extern int mwave_debug;
60*4882a593Smuzhiyun extern int mwave_3780i_irq;
61*4882a593Smuzhiyun extern int mwave_3780i_io;
62*4882a593Smuzhiyun extern int mwave_uart_irq;
63*4882a593Smuzhiyun extern int mwave_uart_io;
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun #define PRINTK_ERROR printk
66*4882a593Smuzhiyun #define KERN_ERR_MWAVE KERN_ERR "mwave: "
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun #define TRACE_MWAVE     0x0001
69*4882a593Smuzhiyun #define TRACE_SMAPI     0x0002
70*4882a593Smuzhiyun #define TRACE_3780I     0x0004
71*4882a593Smuzhiyun #define TRACE_TP3780I   0x0008
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun #ifdef MW_TRACE
74*4882a593Smuzhiyun #define PRINTK_1(f,s)                       \
75*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
76*4882a593Smuzhiyun     printk(s);                              \
77*4882a593Smuzhiyun   }
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun #define PRINTK_2(f,s,v1)                    \
80*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
81*4882a593Smuzhiyun     printk(s,v1);                           \
82*4882a593Smuzhiyun   }
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun #define PRINTK_3(f,s,v1,v2)                 \
85*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
86*4882a593Smuzhiyun     printk(s,v1,v2);                        \
87*4882a593Smuzhiyun   }
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun #define PRINTK_4(f,s,v1,v2,v3)              \
90*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
91*4882a593Smuzhiyun     printk(s,v1,v2,v3);                     \
92*4882a593Smuzhiyun   }
93*4882a593Smuzhiyun 
94*4882a593Smuzhiyun #define PRINTK_5(f,s,v1,v2,v3,v4)           \
95*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
96*4882a593Smuzhiyun     printk(s,v1,v2,v3,v4);                  \
97*4882a593Smuzhiyun   }
98*4882a593Smuzhiyun 
99*4882a593Smuzhiyun #define PRINTK_6(f,s,v1,v2,v3,v4,v5)        \
100*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
101*4882a593Smuzhiyun     printk(s,v1,v2,v3,v4,v5);               \
102*4882a593Smuzhiyun   }
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun #define PRINTK_7(f,s,v1,v2,v3,v4,v5,v6)     \
105*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
106*4882a593Smuzhiyun     printk(s,v1,v2,v3,v4,v5,v6);            \
107*4882a593Smuzhiyun   }
108*4882a593Smuzhiyun 
109*4882a593Smuzhiyun #define PRINTK_8(f,s,v1,v2,v3,v4,v5,v6,v7)  \
110*4882a593Smuzhiyun   if (f & (mwave_debug)) {                  \
111*4882a593Smuzhiyun     printk(s,v1,v2,v3,v4,v5,v6,v7);         \
112*4882a593Smuzhiyun   }
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun #else
115*4882a593Smuzhiyun #define PRINTK_1(f,s)
116*4882a593Smuzhiyun #define PRINTK_2(f,s,v1)
117*4882a593Smuzhiyun #define PRINTK_3(f,s,v1,v2)
118*4882a593Smuzhiyun #define PRINTK_4(f,s,v1,v2,v3)
119*4882a593Smuzhiyun #define PRINTK_5(f,s,v1,v2,v3,v4)
120*4882a593Smuzhiyun #define PRINTK_6(f,s,v1,v2,v3,v4,v5)
121*4882a593Smuzhiyun #define PRINTK_7(f,s,v1,v2,v3,v4,v5,v6)
122*4882a593Smuzhiyun #define PRINTK_8(f,s,v1,v2,v3,v4,v5,v6,v7)
123*4882a593Smuzhiyun #endif
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun 
126*4882a593Smuzhiyun typedef struct _MWAVE_IPC {
127*4882a593Smuzhiyun 	unsigned short usIntCount;	/* 0=none, 1=first, 2=greater than 1st */
128*4882a593Smuzhiyun 	bool bIsEnabled;
129*4882a593Smuzhiyun 	bool bIsHere;
130*4882a593Smuzhiyun 	/* entry spin lock */
131*4882a593Smuzhiyun 	wait_queue_head_t ipc_wait_queue;
132*4882a593Smuzhiyun } MWAVE_IPC;
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun typedef struct _MWAVE_DEVICE_DATA {
135*4882a593Smuzhiyun 	THINKPAD_BD_DATA rBDData;	/* board driver's data area */
136*4882a593Smuzhiyun 	unsigned long ulIPCSource_ISR;	/* IPC source bits for recently processed intr, set during ISR processing */
137*4882a593Smuzhiyun 	unsigned long ulIPCSource_DPC;	/* IPC source bits for recently processed intr, set during DPC processing */
138*4882a593Smuzhiyun 	bool bBDInitialized;
139*4882a593Smuzhiyun 	bool bResourcesClaimed;
140*4882a593Smuzhiyun 	bool bDSPEnabled;
141*4882a593Smuzhiyun 	bool bDSPReset;
142*4882a593Smuzhiyun 	MWAVE_IPC IPCs[16];
143*4882a593Smuzhiyun 	bool bMwaveDevRegistered;
144*4882a593Smuzhiyun 	short sLine;
145*4882a593Smuzhiyun 	int nr_registered_attrs;
146*4882a593Smuzhiyun 	int device_registered;
147*4882a593Smuzhiyun 
148*4882a593Smuzhiyun } MWAVE_DEVICE_DATA, *pMWAVE_DEVICE_DATA;
149*4882a593Smuzhiyun 
150*4882a593Smuzhiyun extern MWAVE_DEVICE_DATA mwave_s_mdd;
151*4882a593Smuzhiyun 
152*4882a593Smuzhiyun #endif
153