-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
beceem: cleanup debug level infrastructure
Add module parameter to control debug level and do code cleanup The whole debug stuff should eventually be removed. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
- Loading branch information
Stephen Hemminger
committed
Oct 30, 2010
1 parent
047a5f2
commit 2564a14
Showing
3 changed files
with
61 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
#include "headers.h" | ||
|
||
static UINT current_debug_level=BCM_SCREAM; | ||
|
||
int bcm_print_buffer( UINT debug_level, const char *function_name, | ||
char *file_name, int line_number, unsigned char *buffer, int bufferlen, enum _BASE_TYPE base) | ||
void bcm_print_buffer(UINT debug_level, const char *function_name, | ||
const char *file_name, int line_number, | ||
const unsigned char *buffer, int bufferlen, | ||
BASE_TYPE base) | ||
{ | ||
int i; | ||
static const char * const buff_dump_base[] = { | ||
"DEC", "HEX", "OCT", "BIN" | ||
}; | ||
if(debug_level>=current_debug_level) | ||
{ | ||
int i=0; | ||
printk("\n%s:%s:%d:Buffer dump of size 0x%x in the %s:\n", file_name, function_name, line_number, bufferlen, buff_dump_base[1]); | ||
for(;i<bufferlen;i++) | ||
{ | ||
if(i && !(i%16) ) | ||
printk("\n"); | ||
switch(base) | ||
{ | ||
case BCM_BASE_TYPE_DEC: | ||
printk("%03d ", buffer[i]); | ||
break; | ||
case BCM_BASE_TYPE_OCT: | ||
printk("%0x03o ", buffer[i]); | ||
break; | ||
case BCM_BASE_TYPE_BIN: | ||
printk("%02x ", buffer[i]); | ||
break; | ||
case BCM_BASE_TYPE_HEX: | ||
default: | ||
printk("%02X ", buffer[i]); | ||
break; | ||
} | ||
|
||
if(debug_level < BCM_SCREAM) | ||
return; | ||
|
||
printk("\n" KERN_DEBUG "%s:%s:%d:Buffer dump of size 0x%x in the %s:\n", | ||
file_name, function_name, line_number, bufferlen, buff_dump_base[1]); | ||
|
||
for(i = 0; i < bufferlen;i++) { | ||
if(i && !(i%16) ) | ||
printk("\n"); | ||
switch(base) { | ||
case BCM_BASE_TYPE_DEC: | ||
printk("%03d ", buffer[i]); | ||
break; | ||
case BCM_BASE_TYPE_OCT: | ||
printk("%0x03o ", buffer[i]); | ||
break; | ||
case BCM_BASE_TYPE_BIN: | ||
printk("%02x ", buffer[i]); | ||
break; | ||
case BCM_BASE_TYPE_HEX: | ||
default: | ||
printk("%02X ", buffer[i]); | ||
break; | ||
} | ||
printk("\n"); | ||
} | ||
return 0; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters