1 /************************************************************************
3 AudioScience HPI driver
4 Copyright (C) 1997-2011 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"
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
)
38 old_level
= hpi_debug_level
;
39 hpi_debug_level
= 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
)
51 printk(KERN_DEBUG
"HPI_MSG%d,%d,%d,%d,%d\n", phm
->version
,
52 phm
->adapter_index
, phm
->obj_index
, phm
->function
,
58 void hpi_debug_data(u16
*pdata
, u32 len
)
66 lines
= (len
+ cols
- 1) / cols
;
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(KERN_CONT
"%s%04x", k
== 0 ? "" : " ", pdata
[i
]);
76 printk(KERN_CONT
"\n");