add rk3288 pinctrl dts code
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rkwifi / bcmdhd / include / bcmcdc.h
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 318308 2012-03-02 02:23:42Z $
10  */
11 #ifndef _bcmcdc_h_
12 #define _bcmcdc_h_
13 #include <proto/ethernet.h>
14
15 typedef struct cdc_ioctl {
16         uint32 cmd;      
17         uint32 len;      
18         uint32 flags;    
19         uint32 status;   
20 } cdc_ioctl_t;
21
22
23 #define CDC_MAX_MSG_SIZE   ETHER_MAX_LEN
24
25
26 #define CDCL_IOC_OUTLEN_MASK   0x0000FFFF  
27                                            
28 #define CDCL_IOC_OUTLEN_SHIFT  0
29 #define CDCL_IOC_INLEN_MASK    0xFFFF0000   
30 #define CDCL_IOC_INLEN_SHIFT   16
31
32
33 #define CDCF_IOC_ERROR          0x01    
34 #define CDCF_IOC_SET            0x02    
35 #define CDCF_IOC_OVL_IDX_MASK   0x3c    
36 #define CDCF_IOC_OVL_RSV        0x40    
37 #define CDCF_IOC_OVL            0x80    
38 #define CDCF_IOC_ACTION_MASK    0xfe    
39 #define CDCF_IOC_ACTION_SHIFT   1       
40 #define CDCF_IOC_IF_MASK        0xF000  
41 #define CDCF_IOC_IF_SHIFT       12
42 #define CDCF_IOC_ID_MASK        0xFFFF0000      
43 #define CDCF_IOC_ID_SHIFT       16              
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
55 struct bdc_header {
56         uint8   flags;                  
57         uint8   priority;               
58         uint8   flags2;
59         uint8   dataOffset;             
60 };
61
62 #define BDC_HEADER_LEN          4
63
64
65 #define BDC_FLAG_80211_PKT      0x01    
66 #define BDC_FLAG_SUM_GOOD       0x04    
67 #define BDC_FLAG_SUM_NEEDED     0x08    
68 #define BDC_FLAG_EVENT_MSG      0x08    
69 #define BDC_FLAG_VER_MASK       0xf0    
70 #define BDC_FLAG_VER_SHIFT      4       
71
72
73 #define BDC_PRIORITY_MASK       0x07
74 #define BDC_PRIORITY_FC_MASK    0xf0    
75 #define BDC_PRIORITY_FC_SHIFT   4       
76
77
78 #define BDC_FLAG2_IF_MASK       0x0f    
79 #define BDC_FLAG2_IF_SHIFT      0
80 #define BDC_FLAG2_FC_FLAG       0x10    
81                                         
82
83
84 #define BDC_PROTO_VER_1         1       
85 #define BDC_PROTO_VER           2       
86
87
88 #define BDC_GET_IF_IDX(hdr) \
89         ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
90 #define BDC_SET_IF_IDX(hdr, idx) \
91         ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | ((idx) << BDC_FLAG2_IF_SHIFT)))
92
93 #define BDC_FLAG2_PAD_MASK              0xf0
94 #define BDC_FLAG_PAD_MASK               0x03
95 #define BDC_FLAG2_PAD_SHIFT             2
96 #define BDC_FLAG_PAD_SHIFT              0
97 #define BDC_FLAG2_PAD_IDX               0x3c
98 #define BDC_FLAG_PAD_IDX                0x03
99 #define BDC_GET_PAD_LEN(hdr) \
100         ((int)(((((hdr)->flags2) & BDC_FLAG2_PAD_MASK) >> BDC_FLAG2_PAD_SHIFT) | \
101         ((((hdr)->flags) & BDC_FLAG_PAD_MASK) >> BDC_FLAG_PAD_SHIFT)))
102 #define BDC_SET_PAD_LEN(hdr, idx) \
103         ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_PAD_MASK) | \
104         (((idx) & BDC_FLAG2_PAD_IDX) << BDC_FLAG2_PAD_SHIFT))); \
105         ((hdr)->flags = (((hdr)->flags & ~BDC_FLAG_PAD_MASK) | \
106         (((idx) & BDC_FLAG_PAD_IDX) << BDC_FLAG_PAD_SHIFT)))
107
108 #endif