CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/wl/include/bcmcdc.h
Views: 3959
1
/*
2
* CDC network driver ioctl/indication encoding
3
* Broadcom 802.11abg Networking Device Driver
4
*
5
* Definitions subject to change without notice.
6
*
7
* $Copyright Open Broadcom Corporation$
8
*
9
* $Id: bcmcdc.h 291086 2011-10-21 01:17:24Z linm $
10
*/
11
#ifndef _bcmcdc_h_
12
#define _bcmcdc_h_
13
#include <proto/ethernet.h>
14
15
typedef struct cdc_ioctl {
16
uint32 cmd; /* ioctl command value */
17
uint32 len; /* lower 16: output buflen; upper 16: input buflen (excludes header) */
18
uint32 flags; /* flag defns given below */
19
uint32 status; /* status code returned from the device */
20
} cdc_ioctl_t;
21
22
/* Max valid buffer size that can be sent to the dongle */
23
#define CDC_MAX_MSG_SIZE ETHER_MAX_LEN
24
25
/* len field is divided into input and output buffer lengths */
26
#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected response length, */
27
/* excluding IOCTL header */
28
#define CDCL_IOC_OUTLEN_SHIFT 0
29
#define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length, excluding IOCTL header */
30
#define CDCL_IOC_INLEN_SHIFT 16
31
32
/* CDC flag definitions */
33
#define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */
34
#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */
35
#define CDCF_IOC_OVL_IDX_MASK 0x3c /* overlay region index mask */
36
#define CDCF_IOC_OVL_RSV 0x40 /* 1=reserve this overlay region */
37
#define CDCF_IOC_OVL 0x80 /* 1=this ioctl corresponds to an overlay */
38
#define CDCF_IOC_ACTION_MASK 0xfe /* SET/GET, OVL_IDX, OVL_RSV, OVL mask */
39
#define CDCF_IOC_ACTION_SHIFT 1 /* SET/GET, OVL_IDX, OVL_RSV, OVL shift */
40
#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */
41
#define CDCF_IOC_IF_SHIFT 12
42
#define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl req/resp pairing */
43
#define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */
44
45
#define CDC_IOC_IF_IDX(flags) (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)
46
#define CDC_IOC_ID(flags) (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
47
48
#define CDC_GET_IF_IDX(hdr) \
49
((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT))
50
#define CDC_SET_IF_IDX(hdr, idx) \
51
((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | ((idx) << CDCF_IOC_IF_SHIFT)))
52
53
/*
54
* BDC header
55
*
56
* The BDC header is used on data packets to convey priority across USB.
57
*/
58
59
#define BDC_HEADER_LEN 4
60
61
#define BDC_PROTO_VER_1 1 /* Old Protocol version */
62
#define BDC_PROTO_VER 2 /* Protocol version */
63
64
#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */
65
#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */
66
67
#ifndef EXT_STA
68
#define BDC_FLAG__UNUSED 0x03 /* Unassigned */
69
#else
70
#define BDC_FLAG_EXEMPT 0x03 /* Vista/EXT_STA: use for encryption exemption */
71
#endif /* EXT_STA */
72
#define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good RX checksums */
73
#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */
74
75
#define BDC_PRIORITY_MASK 0x7
76
77
#define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */
78
/* FLOW CONTROL info only */
79
#define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */
80
81
#define BDC_FLAG2_IF_MASK 0x0f /* APSTA: interface on which the packet was received */
82
#define BDC_FLAG2_IF_SHIFT 0
83
/* XXX PR86912 WAR: host pads out to multiple of 64 bytes; device trims pad bytes */
84
#define BDC_FLAG2_PAD_MASK 0xf0
85
#define BDC_FLAG_PAD_MASK 0x03
86
#define BDC_FLAG2_PAD_SHIFT 2
87
#define BDC_FLAG_PAD_SHIFT 0
88
#define BDC_FLAG2_PAD_IDX 0x3c
89
#define BDC_FLAG_PAD_IDX 0x03
90
#define BDC_GET_PAD_LEN(hdr) \
91
((int)(((((hdr)->flags2) & BDC_FLAG2_PAD_MASK) >> BDC_FLAG2_PAD_SHIFT) | \
92
((((hdr)->flags) & BDC_FLAG_PAD_MASK) >> BDC_FLAG_PAD_SHIFT)))
93
#define BDC_SET_PAD_LEN(hdr, idx) \
94
((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_PAD_MASK) | \
95
(((idx) & BDC_FLAG2_PAD_IDX) << BDC_FLAG2_PAD_SHIFT))); \
96
((hdr)->flags = (((hdr)->flags & ~BDC_FLAG_PAD_MASK) | \
97
(((idx) & BDC_FLAG_PAD_IDX) << BDC_FLAG_PAD_SHIFT)))
98
/* XXX END PR86912 WAR */
99
100
#define BDC_GET_IF_IDX(hdr) \
101
((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
102
#define BDC_SET_IF_IDX(hdr, idx) \
103
((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | ((idx) << BDC_FLAG2_IF_SHIFT)))
104
105
struct bdc_header {
106
uint8 flags; /* Flags */
107
uint8 priority; /* 802.1d Priority 0:2 bits, 4:7 USB flow control info */
108
uint8 flags2;
109
uint8 dataOffset; /* Offset from end of BDC header to packet data, in
110
* 4-byte words. Leaves room for optional headers.
111
*/
112
};
113
114
/* XXX: Just to keep support for old twigs */
115
#define BDC_PROTO_VER_1 1 /* Old Protocol version */
116
117
#endif /* _bcmcdc_h_ */
118
119