1 /*- 2 * Copyright (c) 2006,2007 3 * Damien Bergamini <damien.bergamini@free.fr> 4 * Benjamin Close <Benjamin.Close@clearchain.com> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * $FreeBSD$ 19 */ 20 21 #ifndef __IF_WPI_DEBUG_H__ 22 #define __IF_WPI_DEBUG_H__ 23 24 #ifdef WPI_DEBUG 25 enum { 26 WPI_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ 27 WPI_DEBUG_RECV = 0x00000002, /* basic recv operation */ 28 WPI_DEBUG_STATE = 0x00000004, /* 802.11 state transitions */ 29 WPI_DEBUG_HW = 0x00000008, /* Stage 1 (eeprom) debugging */ 30 WPI_DEBUG_RESET = 0x00000010, /* reset processing */ 31 WPI_DEBUG_FIRMWARE = 0x00000020, /* firmware(9) loading debug */ 32 WPI_DEBUG_BEACON = 0x00000040, /* beacon handling */ 33 WPI_DEBUG_WATCHDOG = 0x00000080, /* watchdog timeout */ 34 WPI_DEBUG_INTR = 0x00000100, /* ISR */ 35 WPI_DEBUG_SCAN = 0x00000200, /* Scan related operations */ 36 WPI_DEBUG_NOTIFY = 0x00000400, /* State 2 Notif intr debug */ 37 WPI_DEBUG_TEMP = 0x00000800, /* TXPower/Temp Calibration */ 38 WPI_DEBUG_CMD = 0x00001000, /* cmd submission */ 39 WPI_DEBUG_TRACE = 0x00002000, /* Print begin and start driver function */ 40 WPI_DEBUG_PWRSAVE = 0x00004000, /* Power save operations */ 41 WPI_DEBUG_EEPROM = 0x00008000, /* EEPROM info */ 42 WPI_DEBUG_KEY = 0x00010000, /* node key management */ 43 WPI_DEBUG_EDCA = 0x00020000, /* WME info */ 44 WPI_DEBUG_ANY = 0xffffffff 45 }; 46 47 #define DPRINTF(sc, m, ...) do { \ 48 if (sc->sc_debug & (m)) \ 49 printf(__VA_ARGS__); \ 50 } while (0) 51 52 #define TRACE_STR_BEGIN "->%s: begin\n" 53 #define TRACE_STR_DOING "->Doing %s\n" 54 #define TRACE_STR_END "->%s: end\n" 55 #define TRACE_STR_END_ERR "->%s: end in error\n" 56 57 static const char *wpi_cmd_str(int cmd) 58 { 59 switch (cmd) { 60 /* Notifications */ 61 case WPI_UC_READY: return "UC_READY"; 62 case WPI_RX_DONE: return "RX_DONE"; 63 case WPI_START_SCAN: return "START_SCAN"; 64 case WPI_SCAN_RESULTS: return "SCAN_RESULTS"; 65 case WPI_STOP_SCAN: return "STOP_SCAN"; 66 case WPI_BEACON_SENT: return "BEACON_SENT"; 67 case WPI_RX_STATISTICS: return "RX_STATS"; 68 case WPI_BEACON_STATISTICS: return "BEACON_STATS"; 69 case WPI_STATE_CHANGED: return "STATE_CHANGED"; 70 case WPI_BEACON_MISSED: return "BEACON_MISSED"; 71 72 /* Command notifications */ 73 case WPI_CMD_RXON: return "WPI_CMD_RXON"; 74 case WPI_CMD_RXON_ASSOC: return "WPI_CMD_RXON_ASSOC"; 75 case WPI_CMD_EDCA_PARAMS: return "WPI_CMD_EDCA_PARAMS"; 76 case WPI_CMD_TIMING: return "WPI_CMD_TIMING"; 77 case WPI_CMD_ADD_NODE: return "WPI_CMD_ADD_NODE"; 78 case WPI_CMD_DEL_NODE: return "WPI_CMD_DEL_NODE"; 79 case WPI_CMD_TX_DATA: return "WPI_CMD_TX_DATA"; 80 case WPI_CMD_MRR_SETUP: return "WPI_CMD_MRR_SETUP"; 81 case WPI_CMD_SET_LED: return "WPI_CMD_SET_LED"; 82 case WPI_CMD_SET_POWER_MODE: return "WPI_CMD_SET_POWER_MODE"; 83 case WPI_CMD_SCAN: return "WPI_CMD_SCAN"; 84 case WPI_CMD_SET_BEACON: return "WPI_CMD_SET_BEACON"; 85 case WPI_CMD_TXPOWER: return "WPI_CMD_TXPOWER"; 86 case WPI_CMD_BT_COEX: return "WPI_CMD_BT_COEX"; 87 88 default: 89 KASSERT(1, ("Unknown Command: %d\n", cmd)); 90 return "UNKNOWN CMD"; 91 } 92 } 93 94 #else 95 #define DPRINTF(sc, m, ...) do { (void) sc; } while (0) 96 #endif 97 98 #endif /* __IF_WPI_DEBUG_H__ */ 99