Add linux-next specific files for 20110831
[linux-2.6/next.git] / sound / pci / asihpi / hpidebug.c
blobb52baf62791ed3bf96bab2515bfaaf62383e3597
1 /************************************************************************
3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as
8 published by the Free Software Foundation;
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 Debug macro translation.
21 ************************************************************************/
23 #include "hpi_internal.h"
24 #include "hpidebug.h"
26 /* Debug level; 0 quiet; 1 informative, 2 debug, 3 verbose debug. */
27 int hpi_debug_level = HPI_DEBUG_LEVEL_DEFAULT;
29 void hpi_debug_init(void)
31 printk(KERN_INFO "debug start\n");
34 int hpi_debug_level_set(int level)
36 int old_level;
38 old_level = hpi_debug_level;
39 hpi_debug_level = level;
40 return old_level;
43 int hpi_debug_level_get(void)
45 return hpi_debug_level;
48 void hpi_debug_message(struct hpi_message *phm, char *sz_fileline)
50 if (phm) {
51 printk(KERN_DEBUG "HPI_MSG%d,%d,%d,%d,%d\n", phm->version,
52 phm->adapter_index, phm->obj_index, phm->function,
53 phm->u.c.attribute);
58 void hpi_debug_data(u16 *pdata, u32 len)
60 u32 i;
61 int j;
62 int k;
63 int lines;
64 int cols = 8;
66 lines = (len + cols - 1) / cols;
67 if (lines > 8)
68 lines = 8;
70 for (i = 0, j = 0; j < lines; j++) {
71 printk(KERN_DEBUG "%p:", (pdata + i));
73 for (k = 0; k < cols && i < len; i++, k++)
74 printk("%s%04x", k == 0 ? "" : " ", pdata[i]);
76 printk("\n");