summaryrefslogtreecommitdiff
path: root/drivers/staging/brcm80211/brcmfmac/msgtrace.h
blob: d654671a5a30e0cf4e169b65606ee9553932b69c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * Copyright (c) 2010 Broadcom Corporation
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef	_MSGTRACE_H
#define	_MSGTRACE_H

#define MSGTRACE_VERSION 1

/* Message trace header */
typedef struct msgtrace_hdr {
	u8 version;
	u8 spare;
	u16 len;		/* Len of the trace */
	u32 seqnum;		/* Sequence number of message. Useful
				 * if the messsage has been lost
				 * because of DMA error or a bus reset
				 * (ex: SDIO Func2)
				 */
	u32 discarded_bytes;	/* Number of discarded bytes because of
				 trace overflow  */
	u32 discarded_printf;	/* Number of discarded printf
				 because of trace overflow */
} __attribute__((packed)) msgtrace_hdr_t;

#define MSGTRACE_HDRLEN		sizeof(msgtrace_hdr_t)

/* The hbus driver generates traces when sending a trace message.
 * This causes endless traces.
 * This flag must be set to true in any hbus traces.
 * The flag is reset in the function msgtrace_put.
 * This prevents endless traces but generates hasardous
 * lost of traces only in bus device code.
 * It is recommendat to set this flag in macro SD_TRACE
 * but not in SD_ERROR for avoiding missing
 * hbus error traces. hbus error trace should not generates endless traces.
 */
extern bool msgtrace_hbus_trace;

typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, u8 *hdr,
				      u16 hdrlen, u8 *buf,
				      u16 buflen);

extern void msgtrace_sent(void);
extern void msgtrace_put(char *buf, int count);
extern void msgtrace_init(void *hdl1, void *hdl2,
			  msgtrace_func_send_t func_send);

#endif				/* _MSGTRACE_H */