cfae9a69a6512530e5ee9f034e4e70b4a313a108
[deliverable/linux.git] / drivers / staging / brcm80211 / include / msgtrace.h
1 /*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef _MSGTRACE_H
18 #define _MSGTRACE_H
19
20 #ifndef _TYPEDEFS_H_
21 #include <typedefs.h>
22 #endif
23
24 /* This marks the start of a packed structure section. */
25 #include <packed_section_start.h>
26
27 #define MSGTRACE_VERSION 1
28
29 /* Message trace header */
30 typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr {
31 uint8 version;
32 uint8 spare;
33 uint16 len; /* Len of the trace */
34 uint32 seqnum; /* Sequence number of message. Useful
35 * if the messsage has been lost
36 * because of DMA error or a bus reset
37 * (ex: SDIO Func2)
38 */
39 uint32 discarded_bytes; /* Number of discarded bytes because of
40 trace overflow */
41 uint32 discarded_printf; /* Number of discarded printf
42 because of trace overflow */
43 } BWL_POST_PACKED_STRUCT msgtrace_hdr_t;
44
45 #define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t)
46
47 /* The hbus driver generates traces when sending a trace message.
48 * This causes endless traces.
49 * This flag must be set to TRUE in any hbus traces.
50 * The flag is reset in the function msgtrace_put.
51 * This prevents endless traces but generates hasardous
52 * lost of traces only in bus device code.
53 * It is recommendat to set this flag in macro SD_TRACE
54 * but not in SD_ERROR for avoiding missing
55 * hbus error traces. hbus error trace should not generates endless traces.
56 */
57 extern bool msgtrace_hbus_trace;
58
59 typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, uint8 *hdr,
60 uint16 hdrlen, uint8 *buf,
61 uint16 buflen);
62
63 extern void msgtrace_sent(void);
64 extern void msgtrace_put(char *buf, int count);
65 extern void msgtrace_init(void *hdl1, void *hdl2,
66 msgtrace_func_send_t func_send);
67
68 /* This marks the end of a packed structure section. */
69 #include <packed_section_end.h>
70
71 #endif /* _MSGTRACE_H */
This page took 0.068614 seconds and 4 git commands to generate.