2 * Copyright (c) 2010 Broadcom Corporation
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.
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.
22 /* This marks the start of a packed structure section. */
23 #include <packed_section_start.h>
25 #define MSGTRACE_VERSION 1
27 /* Message trace header */
28 typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr {
31 u16 len; /* Len of the trace */
32 u32 seqnum; /* Sequence number of message. Useful
33 * if the messsage has been lost
34 * because of DMA error or a bus reset
37 u32 discarded_bytes; /* Number of discarded bytes because of
39 u32 discarded_printf; /* Number of discarded printf
40 because of trace overflow */
41 } BWL_POST_PACKED_STRUCT msgtrace_hdr_t;
43 #define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t)
45 /* The hbus driver generates traces when sending a trace message.
46 * This causes endless traces.
47 * This flag must be set to TRUE in any hbus traces.
48 * The flag is reset in the function msgtrace_put.
49 * This prevents endless traces but generates hasardous
50 * lost of traces only in bus device code.
51 * It is recommendat to set this flag in macro SD_TRACE
52 * but not in SD_ERROR for avoiding missing
53 * hbus error traces. hbus error trace should not generates endless traces.
55 extern bool msgtrace_hbus_trace;
57 typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, u8 *hdr,
61 extern void msgtrace_sent(void);
62 extern void msgtrace_put(char *buf, int count);
63 extern void msgtrace_init(void *hdl1, void *hdl2,
64 msgtrace_func_send_t func_send);
66 /* This marks the end of a packed structure section. */
67 #include <packed_section_end.h>
69 #endif /* _MSGTRACE_H */