xref: /linux/drivers/char/mwave/mwavedd.h (revision 7c0f6ba6)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds *
31da177e4SLinus Torvalds * mwavedd.h -- declarations for mwave device driver
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds *
61da177e4SLinus Torvalds * Written By: Mike Sullivan IBM Corporation
71da177e4SLinus Torvalds *
81da177e4SLinus Torvalds * Copyright (C) 1999 IBM Corporation
91da177e4SLinus Torvalds *
101da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify
111da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by
121da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or
131da177e4SLinus Torvalds * (at your option) any later version.
141da177e4SLinus Torvalds *
151da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful,
161da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of
171da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
181da177e4SLinus Torvalds * GNU General Public License for more details.
191da177e4SLinus Torvalds *
201da177e4SLinus Torvalds * NO WARRANTY
211da177e4SLinus Torvalds * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
221da177e4SLinus Torvalds * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
231da177e4SLinus Torvalds * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
241da177e4SLinus Torvalds * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
251da177e4SLinus Torvalds * solely responsible for determining the appropriateness of using and
261da177e4SLinus Torvalds * distributing the Program and assumes all risks associated with its
271da177e4SLinus Torvalds * exercise of rights under this Agreement, including but not limited to
281da177e4SLinus Torvalds * the risks and costs of program errors, damage to or loss of data,
291da177e4SLinus Torvalds * programs or equipment, and unavailability or interruption of operations.
301da177e4SLinus Torvalds *
311da177e4SLinus Torvalds * DISCLAIMER OF LIABILITY
321da177e4SLinus Torvalds * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
331da177e4SLinus Torvalds * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
341da177e4SLinus Torvalds * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
351da177e4SLinus Torvalds * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
361da177e4SLinus Torvalds * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
371da177e4SLinus Torvalds * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
381da177e4SLinus Torvalds * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
391da177e4SLinus Torvalds *
401da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License
411da177e4SLinus Torvalds * along with this program; if not, write to the Free Software
421da177e4SLinus Torvalds * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
431da177e4SLinus Torvalds *
441da177e4SLinus Torvalds *
451da177e4SLinus Torvalds * 10/23/2000 - Alpha Release
461da177e4SLinus Torvalds *	First release to the public
471da177e4SLinus Torvalds */
481da177e4SLinus Torvalds 
491da177e4SLinus Torvalds #ifndef _LINUX_MWAVEDD_H
501da177e4SLinus Torvalds #define _LINUX_MWAVEDD_H
511da177e4SLinus Torvalds #include "3780i.h"
521da177e4SLinus Torvalds #include "tp3780i.h"
531da177e4SLinus Torvalds #include "smapi.h"
541da177e4SLinus Torvalds #include "mwavepub.h"
551da177e4SLinus Torvalds #include <linux/ioctl.h>
56*7c0f6ba6SLinus Torvalds #include <linux/uaccess.h>
571da177e4SLinus Torvalds #include <linux/wait.h>
581da177e4SLinus Torvalds 
591da177e4SLinus Torvalds extern int mwave_debug;
601da177e4SLinus Torvalds extern int mwave_3780i_irq;
611da177e4SLinus Torvalds extern int mwave_3780i_io;
621da177e4SLinus Torvalds extern int mwave_uart_irq;
631da177e4SLinus Torvalds extern int mwave_uart_io;
641da177e4SLinus Torvalds 
651da177e4SLinus Torvalds #define PRINTK_ERROR printk
661da177e4SLinus Torvalds #define KERN_ERR_MWAVE KERN_ERR "mwave: "
671da177e4SLinus Torvalds 
681da177e4SLinus Torvalds #define TRACE_MWAVE     0x0001
691da177e4SLinus Torvalds #define TRACE_SMAPI     0x0002
701da177e4SLinus Torvalds #define TRACE_3780I     0x0004
711da177e4SLinus Torvalds #define TRACE_TP3780I   0x0008
721da177e4SLinus Torvalds 
731da177e4SLinus Torvalds #ifdef MW_TRACE
741da177e4SLinus Torvalds #define PRINTK_1(f,s)                       \
751da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
761da177e4SLinus Torvalds     printk(s);                              \
771da177e4SLinus Torvalds   }
781da177e4SLinus Torvalds 
791da177e4SLinus Torvalds #define PRINTK_2(f,s,v1)                    \
801da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
811da177e4SLinus Torvalds     printk(s,v1);                           \
821da177e4SLinus Torvalds   }
831da177e4SLinus Torvalds 
841da177e4SLinus Torvalds #define PRINTK_3(f,s,v1,v2)                 \
851da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
861da177e4SLinus Torvalds     printk(s,v1,v2);                        \
871da177e4SLinus Torvalds   }
881da177e4SLinus Torvalds 
891da177e4SLinus Torvalds #define PRINTK_4(f,s,v1,v2,v3)              \
901da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
911da177e4SLinus Torvalds     printk(s,v1,v2,v3);                     \
921da177e4SLinus Torvalds   }
931da177e4SLinus Torvalds 
941da177e4SLinus Torvalds #define PRINTK_5(f,s,v1,v2,v3,v4)           \
951da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
961da177e4SLinus Torvalds     printk(s,v1,v2,v3,v4);                  \
971da177e4SLinus Torvalds   }
981da177e4SLinus Torvalds 
991da177e4SLinus Torvalds #define PRINTK_6(f,s,v1,v2,v3,v4,v5)        \
1001da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
1011da177e4SLinus Torvalds     printk(s,v1,v2,v3,v4,v5);               \
1021da177e4SLinus Torvalds   }
1031da177e4SLinus Torvalds 
1041da177e4SLinus Torvalds #define PRINTK_7(f,s,v1,v2,v3,v4,v5,v6)     \
1051da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
1061da177e4SLinus Torvalds     printk(s,v1,v2,v3,v4,v5,v6);            \
1071da177e4SLinus Torvalds   }
1081da177e4SLinus Torvalds 
1091da177e4SLinus Torvalds #define PRINTK_8(f,s,v1,v2,v3,v4,v5,v6,v7)  \
1101da177e4SLinus Torvalds   if (f & (mwave_debug)) {                  \
1111da177e4SLinus Torvalds     printk(s,v1,v2,v3,v4,v5,v6,v7);         \
1121da177e4SLinus Torvalds   }
1131da177e4SLinus Torvalds 
1141da177e4SLinus Torvalds #else
1151da177e4SLinus Torvalds #define PRINTK_1(f,s)
1161da177e4SLinus Torvalds #define PRINTK_2(f,s,v1)
1171da177e4SLinus Torvalds #define PRINTK_3(f,s,v1,v2)
1181da177e4SLinus Torvalds #define PRINTK_4(f,s,v1,v2,v3)
1191da177e4SLinus Torvalds #define PRINTK_5(f,s,v1,v2,v3,v4)
1201da177e4SLinus Torvalds #define PRINTK_6(f,s,v1,v2,v3,v4,v5)
1211da177e4SLinus Torvalds #define PRINTK_7(f,s,v1,v2,v3,v4,v5,v6)
1221da177e4SLinus Torvalds #define PRINTK_8(f,s,v1,v2,v3,v4,v5,v6,v7)
1231da177e4SLinus Torvalds #endif
1241da177e4SLinus Torvalds 
1251da177e4SLinus Torvalds 
1261da177e4SLinus Torvalds typedef struct _MWAVE_IPC {
1271da177e4SLinus Torvalds 	unsigned short usIntCount;	/* 0=none, 1=first, 2=greater than 1st */
12826ec99b1SArnd Bergmann 	bool bIsEnabled;
12926ec99b1SArnd Bergmann 	bool bIsHere;
1301da177e4SLinus Torvalds 	/* entry spin lock */
1311da177e4SLinus Torvalds 	wait_queue_head_t ipc_wait_queue;
1321da177e4SLinus Torvalds } MWAVE_IPC;
1331da177e4SLinus Torvalds 
1341da177e4SLinus Torvalds typedef struct _MWAVE_DEVICE_DATA {
1351da177e4SLinus Torvalds 	THINKPAD_BD_DATA rBDData;	/* board driver's data area */
1361da177e4SLinus Torvalds 	unsigned long ulIPCSource_ISR;	/* IPC source bits for recently processed intr, set during ISR processing */
1371da177e4SLinus Torvalds 	unsigned long ulIPCSource_DPC;	/* IPC source bits for recently processed intr, set during DPC processing */
13826ec99b1SArnd Bergmann 	bool bBDInitialized;
13926ec99b1SArnd Bergmann 	bool bResourcesClaimed;
14026ec99b1SArnd Bergmann 	bool bDSPEnabled;
14126ec99b1SArnd Bergmann 	bool bDSPReset;
1421da177e4SLinus Torvalds 	MWAVE_IPC IPCs[16];
14326ec99b1SArnd Bergmann 	bool bMwaveDevRegistered;
1441da177e4SLinus Torvalds 	short sLine;
1451da177e4SLinus Torvalds 	int nr_registered_attrs;
1461da177e4SLinus Torvalds 	int device_registered;
1471da177e4SLinus Torvalds 
1481da177e4SLinus Torvalds } MWAVE_DEVICE_DATA, *pMWAVE_DEVICE_DATA;
1491da177e4SLinus Torvalds 
1508d1e120fSAdrian Bunk extern MWAVE_DEVICE_DATA mwave_s_mdd;
1518d1e120fSAdrian Bunk 
1521da177e4SLinus Torvalds #endif
153