/************************************************************************12AudioScience HPI driver3Copyright (C) 1997-2010 AudioScience Inc. <[email protected]>45This program is free software; you can redistribute it and/or modify6it under the terms of version 2 of the GNU General Public License as7published by the Free Software Foundation;89This program is distributed in the hope that it will be useful,10but WITHOUT ANY WARRANTY; without even the implied warranty of11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12GNU General Public License for more details.1314You should have received a copy of the GNU General Public License15along with this program; if not, write to the Free Software16Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA1718Debug macro translation.1920************************************************************************/2122#include "hpi_internal.h"23#include "hpidebug.h"2425/* Debug level; 0 quiet; 1 informative, 2 debug, 3 verbose debug. */26int hpi_debug_level = HPI_DEBUG_LEVEL_DEFAULT;2728void hpi_debug_init(void)29{30printk(KERN_INFO "debug start\n");31}3233int hpi_debug_level_set(int level)34{35int old_level;3637old_level = hpi_debug_level;38hpi_debug_level = level;39return old_level;40}4142int hpi_debug_level_get(void)43{44return hpi_debug_level;45}4647void hpi_debug_message(struct hpi_message *phm, char *sz_fileline)48{49if (phm) {50printk(KERN_DEBUG "HPI_MSG%d,%d,%d,%d,%d\n", phm->version,51phm->adapter_index, phm->obj_index, phm->function,52phm->u.c.attribute);53}5455}5657void hpi_debug_data(u16 *pdata, u32 len)58{59u32 i;60int j;61int k;62int lines;63int cols = 8;6465lines = (len + cols - 1) / cols;66if (lines > 8)67lines = 8;6869for (i = 0, j = 0; j < lines; j++) {70printk(KERN_DEBUG "%p:", (pdata + i));7172for (k = 0; k < cols && i < len; i++, k++)73printk("%s%04x", k == 0 ? "" : " ", pdata[i]);7475printk("\n");76}77}787980