aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/lmc/lmc_debug.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/net/wan/lmc/lmc_debug.c
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/net/wan/lmc/lmc_debug.c')
-rw-r--r--drivers/net/wan/lmc/lmc_debug.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/drivers/net/wan/lmc/lmc_debug.c b/drivers/net/wan/lmc/lmc_debug.c
new file mode 100644
index 000000000000..9dccd9546a17
--- /dev/null
+++ b/drivers/net/wan/lmc/lmc_debug.c
@@ -0,0 +1,85 @@
1
2#include <linux/types.h>
3#include <linux/netdevice.h>
4#include <linux/interrupt.h>
5
6#include "lmc_debug.h"
7
8/*
9 * Prints out len, max to 80 octets using printk, 20 per line
10 */
11void lmcConsoleLog(char *type, unsigned char *ucData, int iLen)
12{
13#ifdef DEBUG
14#ifdef LMC_PACKET_LOG
15 int iNewLine = 1;
16 char str[80], *pstr;
17
18 sprintf(str, KERN_DEBUG "lmc: %s: ", type);
19 pstr = str+strlen(str);
20
21 if(iLen > 240){
22 printk(KERN_DEBUG "lmc: Printing 240 chars... out of: %d\n", iLen);
23 iLen = 240;
24 }
25 else{
26 printk(KERN_DEBUG "lmc: Printing %d chars\n", iLen);
27 }
28
29 while(iLen > 0)
30 {
31 sprintf(pstr, "%02x ", *ucData);
32 pstr+=3;
33 ucData++;
34 if( !(iNewLine % 20))
35 {
36 sprintf(pstr, "\n");
37 printk(str);
38 sprintf(str, KERN_DEBUG "lmc: %s: ", type);
39 pstr=str+strlen(str);
40 }
41 iNewLine++;
42 iLen--;
43 }
44 sprintf(pstr, "\n");
45 printk(str);
46#endif
47#endif
48}
49
50#ifdef DEBUG
51u_int32_t lmcEventLogIndex = 0;
52u_int32_t lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS];
53#endif
54
55void lmcEventLog (u_int32_t EventNum, u_int32_t arg2, u_int32_t arg3)
56{
57#ifdef DEBUG
58 lmcEventLogBuf[lmcEventLogIndex++] = EventNum;
59 lmcEventLogBuf[lmcEventLogIndex++] = arg2;
60 lmcEventLogBuf[lmcEventLogIndex++] = arg3;
61 lmcEventLogBuf[lmcEventLogIndex++] = jiffies;
62
63 lmcEventLogIndex &= (LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS) - 1;
64#endif
65}
66
67void lmc_trace(struct net_device *dev, char *msg){
68#ifdef LMC_TRACE
69 unsigned long j = jiffies + 3; /* Wait for 50 ms */
70
71 if(in_interrupt()){
72 printk("%s: * %s\n", dev->name, msg);
73// while(time_before(jiffies, j+10))
74// ;
75 }
76 else {
77 printk("%s: %s\n", dev->name, msg);
78 while(time_before(jiffies, j))
79 schedule();
80 }
81#endif
82}
83
84
85/* --------------------------- end if_lmc_linux.c ------------------------ */