1 /* Driver for Realtek RTS51xx USB card reader
4 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
20 * wwang (wei_wang@realsil.com.cn)
21 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
23 * Edwin Rong (edwin_rong@realsil.com.cn)
24 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
27 #ifndef __RTS51X_TRACE_H
28 #define __RTS51X_TRACE_H
35 static inline char *filename(char *path
)
44 while (*ptr
!= '\0') {
45 if ((*ptr
== '\\') || (*ptr
== '/'))
53 #define TRACE_RET(chip, ret) \
55 char *_file = filename((char *)__FILE__); \
56 RTS51X_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
57 (chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
58 strncpy((chip)->trace_msg[(chip)->msg_idx].func, \
59 __func__, MSG_FUNC_LEN-1); \
60 strncpy((chip)->trace_msg[(chip)->msg_idx].file, \
61 _file, MSG_FILE_LEN-1); \
62 get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf,\
64 (chip)->trace_msg[(chip)->msg_idx].valid = 1; \
66 if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \
67 (chip)->msg_idx = 0; \
72 #define TRACE_GOTO(chip, label) \
74 char *_file = filename((char *)__FILE__); \
75 RTS51X_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
76 (chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
77 strncpy((chip)->trace_msg[(chip)->msg_idx].func, \
78 __func__, MSG_FUNC_LEN-1); \
79 strncpy((chip)->trace_msg[(chip)->msg_idx].file, \
80 _file, MSG_FILE_LEN-1); \
81 get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf,\
83 (chip)->trace_msg[(chip)->msg_idx].valid = 1; \
85 if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \
86 (chip)->msg_idx = 0; \
91 #define TRACE_RET(chip, ret) return (ret)
92 #define TRACE_GOTO(chip, label) goto label
95 #ifdef CONFIG_RTS5139_DEBUG
96 #define RTS51X_DUMP(buf, buf_len) \
97 print_hex_dump(KERN_DEBUG, RTS51X_TIP, DUMP_PREFIX_NONE, \
98 16, 1, (buf), (buf_len), false)
100 #define CATCH_TRIGGER(chip) \
102 rts51x_ep0_write_register((chip), 0xFC31, 0x01, 0x01); \
103 RTS51X_DEBUGP("Catch trigger!\n"); \
107 #define RTS51X_DUMP(buf, buf_len)
108 #define CATCH_TRIGGER(chip)
111 #endif /* __RTS51X_TRACE_H */