1 #ifndef BCM43xx_XMIT_H_
2 #define BCM43xx_XMIT_H_
4 #include "bcm43xx_main.h"
7 #define _bcm43xx_declare_plcp_hdr(size) \
8 struct bcm43xx_plcp_hdr##size { \
12 } __attribute__((__packed__)); \
13 } __attribute__((__packed__))
15 /* struct bcm43xx_plcp_hdr4 */
16 _bcm43xx_declare_plcp_hdr(4);
17 /* struct bcm43xx_plcp_hdr6 */
18 _bcm43xx_declare_plcp_hdr(6);
20 #undef _bcm43xx_declare_plcp_hdr
22 /* Device specific TX header. To be prepended to TX frames. */
23 struct bcm43xx_txhdr {
32 u8 unknown_wsec_tkip_data[3]; //FIXME
36 struct bcm43xx_plcp_hdr4 rts_cts_fallback_plcp;
37 __le16 rts_cts_dur_fallback;
38 struct bcm43xx_plcp_hdr4 fallback_plcp;
39 __le16 fallback_dur_id;
42 __le16 unknown_scb_stuff; //FIXME
43 struct bcm43xx_plcp_hdr6 rts_cts_plcp;
44 __le16 rts_cts_frame_control;
49 struct bcm43xx_plcp_hdr6 plcp;
50 } __attribute__((__packed__));
52 } __attribute__((__packed__));
53 } __attribute__((__packed__));
55 /* Values/Masks for the device TX header */
56 #define BCM43xx_TXHDRFLAG_EXPECTACK 0x0001
57 #define BCM43xx_TXHDRFLAG_RTSCTS 0x0002
58 #define BCM43xx_TXHDRFLAG_RTS 0x0004
59 #define BCM43xx_TXHDRFLAG_FIRSTFRAGMENT 0x0008
60 #define BCM43xx_TXHDRFLAG_DESTPSMODE 0x0020
61 #define BCM43xx_TXHDRFLAG_RTSCTS_OFDM 0x0080
62 #define BCM43xx_TXHDRFLAG_FALLBACKOFDM 0x0100
63 #define BCM43xx_TXHDRFLAG_RTSCTSFALLBACK_OFDM 0x0200
64 #define BCM43xx_TXHDRFLAG_CTS 0x0400
65 #define BCM43xx_TXHDRFLAG_FRAMEBURST 0x0800
67 #define BCM43xx_TXHDRCTL_OFDM 0x0001
68 #define BCM43xx_TXHDRCTL_SHORT_PREAMBLE 0x0010
69 #define BCM43xx_TXHDRCTL_ANTENNADIV_MASK 0x0030
70 #define BCM43xx_TXHDRCTL_ANTENNADIV_SHIFT 8
72 #define BCM43xx_TXHDR_RATE_MASK 0x0F00
73 #define BCM43xx_TXHDR_RATE_SHIFT 8
74 #define BCM43xx_TXHDR_RTSRATE_MASK 0xF000
75 #define BCM43xx_TXHDR_RTSRATE_SHIFT 12
76 #define BCM43xx_TXHDR_WSEC_KEYINDEX_MASK 0x00F0
77 #define BCM43xx_TXHDR_WSEC_KEYINDEX_SHIFT 4
78 #define BCM43xx_TXHDR_WSEC_ALGO_MASK 0x0003
79 #define BCM43xx_TXHDR_WSEC_ALGO_SHIFT 0
81 void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
82 struct bcm43xx_txhdr *txhdr,
83 const unsigned char *fragment_data,
84 const unsigned int fragment_len,
85 const int is_first_fragment,
88 /* RX header as received from the hardware. */
89 struct bcm43xx_rxhdr {
90 /* Frame Length. Must be generated explicitely in PIO mode. */
102 /* Lower 16bits of the TSF at the time the frame started. */
105 } __attribute__((__packed__));
107 #define BCM43xx_RXHDR_FLAGS1_OFDM (1 << 0)
108 /*#define BCM43xx_RXHDR_FLAGS1_SIGNAL??? (1 << 3) FIXME */
109 #define BCM43xx_RXHDR_FLAGS1_SHORTPREAMBLE (1 << 7)
110 #define BCM43xx_RXHDR_FLAGS1_2053RSSIADJ (1 << 14)
112 #define BCM43xx_RXHDR_FLAGS2_INVALIDFRAME (1 << 0)
113 #define BCM43xx_RXHDR_FLAGS2_TYPE2FRAME (1 << 2)
114 /*FIXME: WEP related flags */
116 #define BCM43xx_RXHDR_FLAGS3_2050RSSIADJ (1 << 10)
118 /* Transmit Status as received from the hardware. */
119 struct bcm43xx_hwxmitstatus {
127 __le16 unknown; //FIXME
128 } __attribute__((__packed__));
130 /* Transmit Status in CPU byteorder. */
131 struct bcm43xx_xmitstatus {
140 #define BCM43xx_TXSTAT_FLAG_ACK 0x01
141 //TODO #define BCM43xx_TXSTAT_FLAG_??? 0x02
142 //TODO #define BCM43xx_TXSTAT_FLAG_??? 0x04
143 //TODO #define BCM43xx_TXSTAT_FLAG_??? 0x08
144 //TODO #define BCM43xx_TXSTAT_FLAG_??? 0x10
145 #define BCM43xx_TXSTAT_FLAG_IGNORE 0x20
146 //TODO #define BCM43xx_TXSTAT_FLAG_??? 0x40
147 //TODO #define BCM43xx_TXSTAT_FLAG_??? 0x80
149 u8 bcm43xx_plcp_get_ratecode_cck(const u8 bitrate);
150 u8 bcm43xx_plcp_get_ratecode_ofdm(const u8 bitrate);
152 int bcm43xx_rx(struct bcm43xx_private *bcm,
154 struct bcm43xx_rxhdr *rxhdr);
156 #endif /* BCM43xx_XMIT_H_ */