ASoC: wm2000: Correct register size
[linux-2.6/btrfs-unstable.git] / drivers / staging / csr / unifi_dbg.c
blob38d57085a26a9dfa17e916ba70fd2dacfa1cf107
1 /*
2 * ***************************************************************************
3 * FILE: unifi_dbg.c
5 * PURPOSE:
6 * Handle debug signals received from UniFi.
8 * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd.
10 * Refer to LICENSE.txt included with this source code for details on
11 * the license terms.
13 * ***************************************************************************
15 #include "unifi_priv.h"
18 * ---------------------------------------------------------------------------
19 * debug_string_indication
20 * debug_word16_indication
22 * Handlers for debug indications.
24 * Arguments:
25 * priv Pointer to private context structure.
27 * Returns:
28 * None.
29 * ---------------------------------------------------------------------------
31 void
32 debug_string_indication(unifi_priv_t *priv, const unsigned char *extra, unsigned int extralen)
34 const unsigned int maxlen = sizeof(priv->last_debug_string) - 1;
36 if (extralen > maxlen) {
37 extralen = maxlen;
40 strncpy(priv->last_debug_string, extra, extralen);
42 /* Make sure the string is terminated */
43 priv->last_debug_string[extralen] = '\0';
45 unifi_info(priv, "unifi debug: %s\n", priv->last_debug_string);
47 } /* debug_string_indication() */
51 void
52 debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr)
54 int i;
56 if (priv == NULL) {
57 unifi_info(priv, "Priv is NULL\n");
58 return;
61 for (i = 0; i < 16; i++) {
62 priv->last_debug_word16[i] =
63 sigptr->u.DebugWord16Indication.DebugWords[i];
66 if (priv->last_debug_word16[0] == 0xFA11) {
67 unsigned long ts;
68 ts = (priv->last_debug_word16[6] << 16) | priv->last_debug_word16[5];
69 unifi_info(priv, " %10lu: %s fault %04x, arg %04x (x%d)\n",
70 ts,
71 priv->last_debug_word16[3] == 0x8000 ? "MAC" :
72 priv->last_debug_word16[3] == 0x4000 ? "PHY" :
73 "???",
74 priv->last_debug_word16[1],
75 priv->last_debug_word16[2],
76 priv->last_debug_word16[4]);
78 else if (priv->last_debug_word16[0] != 0xDBAC)
79 /* suppress SDL Trace output (note: still available to unicli). */
81 unifi_info(priv, "unifi debug: %04X %04X %04X %04X %04X %04X %04X %04X\n",
82 priv->last_debug_word16[0], priv->last_debug_word16[1],
83 priv->last_debug_word16[2], priv->last_debug_word16[3],
84 priv->last_debug_word16[4], priv->last_debug_word16[5],
85 priv->last_debug_word16[6], priv->last_debug_word16[7]);
86 unifi_info(priv, " %04X %04X %04X %04X %04X %04X %04X %04X\n",
87 priv->last_debug_word16[8], priv->last_debug_word16[9],
88 priv->last_debug_word16[10], priv->last_debug_word16[11],
89 priv->last_debug_word16[12], priv->last_debug_word16[13],
90 priv->last_debug_word16[14], priv->last_debug_word16[15]);
93 } /* debug_word16_indication() */
96 void
97 debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr)
99 unifi_info(priv, "debug: %04X %04X %04X %04X %04X %04X %04X %04X\n",
100 sigptr->u.DebugGenericIndication.DebugWords[0],
101 sigptr->u.DebugGenericIndication.DebugWords[1],
102 sigptr->u.DebugGenericIndication.DebugWords[2],
103 sigptr->u.DebugGenericIndication.DebugWords[3],
104 sigptr->u.DebugGenericIndication.DebugWords[4],
105 sigptr->u.DebugGenericIndication.DebugWords[5],
106 sigptr->u.DebugGenericIndication.DebugWords[6],
107 sigptr->u.DebugGenericIndication.DebugWords[7]);
109 } /* debug_generic_indication() */