Author: Rodolfo KohnDate: 2009-09-11 02:27 UTC To: Mailing list for the VIA dongle driver hackathonSubject: [Kernel-hackathon] [patch] TX running: probe, authentication,
association and data frames
Configuration modified to set base type calling mac_set_bb_type (as CARDvSetBSSMode is called). Other configuration added.
vt6656_probe/start modified for executing initial configuration.
Tx modified to create tx descriptor and send probe, authentication,
association frames.Data frames also possible and ping has been tested.
Rx printk modified to print selected frames for debugging purposes.
Makefile modified to compile multiple source files.
New files added: vt6656_descriptor.[ch]
diff --git a/Makefile b/Makefile
index 73942a9..421f8e9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,2 @@
-obj-m += vt6656_mod.o
-
-vt6656_mod-objs += vt6656.o vt6656_descriptor.o
-
-clean:
- rm *.o
- rm *.ko
-
-
+obj-m += vt6656.o
diff --git a/vt6656.c b/vt6656.c
index 30ab69e..5f370e6 100644
--- a/vt6656.c
+++ b/vt6656.c
@@ -1,3 +1,4 @@
+
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
@@ -23,20 +24,7 @@
#define IS_80211b 1
-extern int vt6656_fill_desc(struct ieee80211_hw *hw,
- struct tx_desc *tx_hw_head,
- u16 tx_rate_hw_value,
- u8 bNeedACK,
- struct sk_buff* skb);
-
-extern int vt6656_fill_desc_ctrl(struct ieee80211_hw *hw,
- struct tx_desc *tx_hw_head,
- u16 tx_rate_hw_value,
- u8 bNeedACK,
- struct sk_buff* skb);
-
static int mac_set_multicast(struct usb_device *udev, uint8_t index, u8 mask);
-static void initialize2(struct vt6656_dev *vt);
/**
* vt6656_ctrl_read - Reads data from a ctrl endpoint
@@ -201,31 +189,25 @@ static int set_short_slot_time(struct vt6656_dev *vt, int short_slotime_flag)
/*
* Equivalent of BBvSetVGAGainOffset
* FIXME: Document when it is better understood.
- * Change prototype to
- * static int vt6656_baseband_set_gain_offset(struct vt6656_dev *vt,
- * uint8_t data,
- * int short_slot_time)
- *
*/
-static int vt6656_baseband_set_gain_offset(struct vt6656_dev *vt)
+static int vt6656_baseband_set_gain_offset(struct vt6656_dev *vt,
+ uint8_t data,
+ int short_slot_time)
{
int error;
- u8 data1 = 0x1C;
struct usb_device *udev = vt->udev;
error = vt6656_ctrl_writeb(udev, MESSAGE_REQUEST_BBREG,
- 0xE7, data1);
+ 0xE7, data);
if (error < 0)
return error;
-/* TODO: Learn more about this an uncomment, so far data must be 2A as
- vt->baseband_rx_conf is initialized.
if (short_slot_time) {
- // Unset 3rd bit: 1101 1111
+ /* Unset 3rd bit: 1101 1111 */
vt->baseband_rx_conf &= 0xDF;
} else {
- // Set 3rd bit: 0010 0000
+ /* Set 3rd bit: 0010 0000 */
vt->baseband_rx_conf |= 0x20;
- } */
+ }
error = vt6656_ctrl_writeb(udev, MESSAGE_REQUEST_BBREG,
0x0A, vt->baseband_rx_conf);
if (error < 0)
@@ -262,10 +244,10 @@ static void vt6656_usb_rx_completed(struct urb *urb)
case -ENOENT:
case -ECONNRESET:
case -EPIPE:
-/* vt6656_info(vt,
+ vt6656_info(vt,
"We lost contact with the dongle at %s!!. "
"Error number: %d\n",
- __func__, urb->status); */
+ __func__, urb->status);
return;
default:
vt6656_info(vt,
@@ -275,7 +257,7 @@ static void vt6656_usb_rx_completed(struct urb *urb)
break;
}
-/* vt6656_info(vt, "PACKET RECEIVED!!!\n"); */
+ vt6656_info(vt, "PACKET RECEIVED!!!\n");
rx_head = urb->transfer_buffer;
payload = urb->transfer_buffer + sizeof(struct rx_desc);
@@ -315,63 +297,13 @@ static void vt6656_usb_rx_completed(struct urb *urb)
#if WeDontknowWhatThoseFirstPacketsWere
{
int i;
- int j = 0;
- if (((unsigned char *)payload)[0] == 0x80) /* Beacon frame */
- {
- j = 1;
-/* printk(KERN_INFO "BEACON FRAME- len: %d\n", payload_len); */
- }
- if (((unsigned char *)payload)[0] == 0x40) /* Probe request frame */
- {
- j = 1;
-/* printk(KERN_INFO "PROBE REQUEST FRAME- len: %d\n", payload_len);
- for (i = 0; i < payload_len; i++) {
- printk(KERN_INFO "%.02X", ((unsigned char *)payload)[i]);
- }
- printk(KERN_INFO "\n");*/
- }
- if (((unsigned char *)payload)[0] == 0x50) /* Probe Response frame */
- {
- j = 1;
- printk(KERN_INFO "PROBE RESPONSE FRAME- len: %d\n",
- payload_len);
- for (i = 0; i < payload_len; i++) {
- printk(KERN_INFO "%.02X", ((unsigned char *)payload)[i]);
- }
- printk(KERN_INFO "\n");
- }
- /* Association Response frame */
- if (((unsigned char *)payload)[0] == 0x10)
- {
- j = 1;
- printk(KERN_INFO "ASSOCIATION RESPONSE FRAME- len: %d\n",
- payload_len);
- for (i = 0; i < payload_len; i++) {
- printk(KERN_INFO "%.02X", ((unsigned char *)payload)[i]);
- }
- printk(KERN_INFO "\n");
+ for (i = 0; i < padded_payload_len; i++) {
+ if (!(i%10))
+ printk(KERN_INFO "\n%08x: ", i);
+ printk(KERN_INFO "%02x.",
+ ((unsigned char *)payload)[i]);
}
- /* reassoc Response frame */
- if (((unsigned char *)payload)[0] == 0x30)
- {
- j = 1;
- printk(KERN_INFO "REASSOCIATION RESPONSE FRAME- len: %d\n",
- payload_len);
- for (i = 0; i < payload_len; i++) {
- printk(KERN_INFO "%.02X", ((unsigned char *)payload)[i]);
- }
- printk(KERN_INFO "\n");
- }
- if (j == 0 && ((unsigned char *)payload)[0] != 0x08) {
- printk(KERN_INFO "OTHER FRAME- len: %d - Type: %.02X\n",
- payload_len, ((unsigned char *)payload)[0]);
- for (i = 0; i < payload_len; i++) {
- printk(KERN_INFO "%.02X", ((unsigned char *)payload)[i]);
- }
- printk(KERN_INFO "\n");
- }
- payload_len -= FCS_LEN; /* TODO: Is this really necessary? Investigate! */
-
+ printk(KERN_INFO "\n");
}
#endif
/*
@@ -502,15 +434,11 @@ out:
*/
static void vt6656_usb_tx_complete(struct urb *urb)
{
- struct vt6656_tx_ctx *tx_context = (struct vt6656_tx_ctx *)urb->context;
- struct vt6656_dev *vt = tx_context->vt;
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_context->skb);
+ struct vt6656_dev *vt = (struct vt6656_dev *)urb->context;
vt6656_info(vt, "Entering.. %s\n", __func__);
-
+
switch (urb->status) {
case 0:
- /* success */
- info->flags |= IEEE80211_TX_STAT_ACK;
break;
case -ESHUTDOWN:
case -EINVAL:
@@ -557,15 +485,6 @@ static void vt6656_usb_tx_complete(struct urb *urb)
}
vt6656_info(vt, "Everything OK in %s.\n", __func__);
- memset(&info->status, 0, sizeof(info->status));
-
- ieee80211_tx_status_irqsafe(vt->hw, tx_context->skb);
-
- kfree(tx_context);
-
- ieee80211_wake_queues(vt->hw);
-
-
out:
/*
* The urb was automagically unanchored from the submited_anchor
@@ -667,8 +586,6 @@ out:
return error;
}
-#define MAX_DESCRIPTOR_SIZE 80
-#define DESCR_PREFIX_LEN 4
/**
* vt6656_tx - This will get an unused TX urb from the free anchor, refill it,
@@ -683,23 +600,19 @@ static int vt6656_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
struct vt6656_dev *vt = hw->priv;
struct urb *urb;
int error;
+ u32 len = skb->len + sizeof(struct tx_desc);
struct tx_desc tx_hw_head;
- struct tx_desc *hw_desc;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *machdr = (struct ieee80211_hdr *)skb->data;
- struct ieee80211_rate *tx_rates;
+ u16 tx_rate_hw_value;
__le16 macfc = machdr->frame_control;
u16 fragmentation = VT6656_FRAG_CTL_NONFRAG;
u8 need_ack = 0;
u16 sc;
u16 mpdu_seq_num;
- int i;
- int desc_len;
- struct vt6656_tx_ctx *tx_context;
+ vt6656_dbg(vt, "Entering.. %s\n", __func__);
- vt6656_info(vt, "Entering.. %s\n", __func__);
-
/*
* Take the oldest unused urb from the free anchor.
* This will unanchor it and get the ownership over the urb.
@@ -713,26 +626,19 @@ static int vt6656_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
error = -EAGAIN;
goto out;
}
-
- printk(KERN_INFO "Tx to send frame:\n");
- for(i=0; i < skb->len; i++) {
- printk(KERN_INFO "%.02X", skb->data[i]);
- }
- printk(KERN_INFO "\n");
+
/*
* Copy the data to our already allocated buffer
*/
- if ((skb->len + MAX_DESCRIPTOR_SIZE) > TX_DESC_SIZE) {
+ if (len > urb->transfer_buffer_length) {
error = -EMSGSIZE;
goto out;
}
memset(&tx_hw_head, 0, sizeof(struct tx_desc));
- tx_rates = ieee80211_get_tx_rate(hw, info);
-
- printk(KERN_INFO "HW VALUE: %X\n", tx_rates->hw_value);
- if (tx_rates->hw_value <= WIRELESS_TX_RATE_80211B_MAX_VALUE) {
+ tx_rate_hw_value = ieee80211_get_tx_rate(hw, info)->hw_value;
+ if (tx_rate_hw_value <= WIRELESS_TX_RATE_80211B_MAX_VALUE) {
tx_hw_head.FIFOCtl |= cpu_to_le16(FIFOCTL_11B);
} else { /* 802.11 G */
tx_hw_head.FIFOCtl |= cpu_to_le16(FIFOCTL_11GB);
@@ -788,58 +694,25 @@ static int vt6656_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
/* TODO: check this assignation so that it is done
* equal to old driver. 54Mbits should translate to 0x000B
*/
- tx_hw_head.reserved = cpu_to_le16(tx_rates->hw_value);
-
-
- memcpy(urb->transfer_buffer, &tx_hw_head, sizeof(struct tx_desc));
- if (ieee80211_is_data(macfc)) {
- desc_len = vt6656_fill_desc(hw, (struct tx_desc *)(urb->transfer_buffer), tx_rates->hw_value, need_ack, skb);
- } else {
- if (ieee80211_is_ctl(macfc)) {
- desc_len = vt6656_fill_desc_ctrl(hw, (struct tx_desc *)(urb->transfer_buffer), tx_rates->hw_value, need_ack, skb);
- }
- else {
- desc_len = vt6656_fill_desc_ctrl(hw, (struct tx_desc *)(urb->transfer_buffer), tx_rates->hw_value, need_ack, skb);
- }
- }
+ tx_hw_head.reserved = cpu_to_le16(tx_rate_hw_value);
+ tx_hw_head.TxByteCount = cpu_to_le16(sizeof(struct tx_desc) - 4 +
+ skb->len);
- hw_desc = (struct tx_desc *)urb->transfer_buffer;
sc = le16_to_cpu(machdr->seq_ctrl);
mpdu_seq_num = (sc & IEEE80211_SCTL_SEQ) >> 4;
if (!ieee80211_has_morefrags(macfc))
mpdu_seq_num = ((mpdu_seq_num + 1) & 0x0FFF);
- hw_desc->PKTNO = (u8) (((tx_rates->hw_value<<4) & 0x00F0) |
+ tx_hw_head.PKTNO = (u8) (((tx_rate_hw_value<<4) & 0x00F0) |
((mpdu_seq_num - 1) & 0x000F));
- hw_desc->Type = 0;
+ tx_hw_head.Type = 0;
- hw_desc->TxByteCount = cpu_to_le16(desc_len + skb->len);
-
- printk(KERN_INFO "DESCRIPTOR LENGTH (- 4): %d\n", desc_len);
- memcpy(urb->transfer_buffer + desc_len + DESCR_PREFIX_LEN, skb->data,
+ memcpy(urb->transfer_buffer, &tx_hw_head, sizeof(struct tx_desc));
+ memcpy(urb->transfer_buffer + sizeof(struct tx_desc), skb->data,
skb->len);
- urb->transfer_buffer_length = desc_len + DESCR_PREFIX_LEN + skb->len;
- tx_context = kmalloc(sizeof(tx_context), GFP_KERNEL);
- if (!tx_context) {
- dev_err(&vt->udev->dev,
- "%s - Error: could not allocate memory for context.\n",
- __func__);
- error = -ENOMEM;
- goto out;
- }
-
- tx_context->vt = vt;
- tx_context->skb = skb;
-
- urb->context = (void *) tx_context;
-
- printk(KERN_INFO "COMPLETE PDU:\n");
- for(i = 0; i < urb->transfer_buffer_length; i++) {
- printk(KERN_INFO "%.02X", ((u8 *)urb->transfer_buffer)[i]);
- }
- printk(KERN_INFO "\n");
+ urb->transfer_buffer_length = len;
#if 0
/*
* Refill the urb with the new values
@@ -894,8 +767,6 @@ out:
return NETDEV_TX_BUSY;
}
-
-
static int vt6656_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
{
@@ -1068,34 +939,17 @@ static int mac_set_multicast(struct usb_device *udev, uint8_t index, u8 mask)
/**
* mac_set_bb_type - set baseband type
- * This function is essential at initialization time
- * to be able to transmit
*
- * @vt: pointer private vt6656_dev data
+ * @udev: pointer to the usb device
* @type: baseband type value
*/
-static int mac_set_bb_type(struct vt6656_dev *vt, u8 type)
+static int mac_set_bb_type(struct usb_device *udev, u8 type)
{
u8 data[2] = { type, CFG_BB_TYPE_MASK };
- int error;
- struct usb_device *udev = vt->udev;
- error = vt6656_ctrl_write(udev, MESSAGE_TYPE_WRITE_MASK,
+ return vt6656_ctrl_write(udev, MESSAGE_TYPE_WRITE_MASK,
MAC_REG_ENCFG0, MESSAGE_REQUEST_MACREG,
&data, sizeof(data));
- if (error < 0) {
- dev_err(&udev->dev, "%s: ctrl write failed.\n", __func__);
- return error;
- }
-
- /* TODO: In the old driver from this function the rest of
- initialization is done. This must be fixed.
- However, Tx works without this
- initialization
- */
- initialize2(vt);
-
- return error;
}
/**
@@ -1564,13 +1418,10 @@ static int vt6656_start(struct ieee80211_hw *hw)
if (error < 0)
goto out;
- if (vt->hardware_radio_off) {
+ if (vt->hardware_radio_off)
error = vt6656_radio_power_off(vt);
- } else {
+ else
error = vt6656_radio_power_on(vt);
- }
-/* initialize3(vt->udev);*/
- /* TODO: I don't know where but should we use KeyvInitTable */
if (error < 0)
goto out;
@@ -1911,73 +1762,6 @@ static int vt6656_fw_verify(struct usb_device *udev)
dev_info(&udev->dev, "current firmware found.\n");
return 0;
}
-
-
-
-/*
-static void initialize1(struct vt6656_dev *vt)
-{
- u8 data1[] = {0x01,0x01};
- u8 data2[] = {0x00,0x80};
- u8 data3[] = {0xB9,0x19,0x07,0x04};
- u8 data4[] = {0xB9,0xA4,0x05,0x00};
- u8 data5[] = {0x86};
- u8 data6[] = {0x2A};
- struct usb_device *dev = vt->udev;
-
- vt6656_info(vt, "Entering.. %s\n", __func__);
-
-
- my_vt6656_ctrl_write(dev, 0x000004, 0x000055, 0x000003, data1,0x000002);
-
- my_vt6656_ctrl_write(dev, 0x000004, 0x00006D, 0x000003, data2,0x000002);
-
- my_vt6656_ctrl_write(dev, 0x00000C, 0x000003, 0x000000, NULL,0x000000);
- my_vt6656_ctrl_write(dev, 0x000011, 0x000000, 0x000000, data3,0x000004);
-
- my_vt6656_ctrl_write(dev, 0x000011, 0x000000, 0x000000, data4,0x000004);
-
- my_vt6656_ctrl_write(dev, 0x000000, 0x00006D, 0x000003, data5,0x000001);
-
- my_vt6656_ctrl_write(dev, 0x000000, 0x00000A, 0x000002, data6,0x000001);
-
-}
-*/
-
-/*
- * TODO: This initialization is not essential for Tx but
- * it needs investigation
- */
-static void initialize2(struct vt6656_dev *vt)
-{
- u8 data1[] = {0x08};
- u8 data2[] = {0x0A,0x32,0x50,0x14};
- u8 data3[] = {0xA5};
- u8 data4[] = {
- 0x70, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x70,
- 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x8B, 0x1E,
- 0x8F, 0x16, 0x8A, 0x12, 0x8E, 0x0E, 0x89, 0x0E, 0x89,
- 0x0E,0x89,0x0E,0x89,0x0E,0x89,0x0E
- };
- struct usb_device *dev = vt->udev;
-
- vt6656_info(vt, "Entering.. %s\n", __func__);
-
- vt6656_ctrl_write(dev, 0x000000, 0x000088, 0x000002, data1,0x000001);
- /* vUpdateIFS */
- {
- vt6656_ctrl_write(dev, 0x000000, 0x000022, 0x000003, data2,0x000004);
-
- vt6656_ctrl_write(dev, 0x000000, MAC_REG_CWMAXMIN0, 0x000003, data3,0x000001);
- /* MAC_REG_CWMAXMIN0 = 0x28 */
- }
- /* CARDvSetRSPINF - card.c */
- vt6656_ctrl_write(dev, 0x000000, MAC_REG_RSPINF_B_1, 0x000003, data4,0x000022);
- /* MAC_REG_RSPINF_B_1 = 0xDC */
-}
-
-
-
static int vt6656_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -1998,7 +1782,6 @@ static int vt6656_probe(struct usb_interface *intf,
}
vt = hw->priv;
vt->udev = udev;
- vt->hw = hw;
/*
* Initialize the mutex.
@@ -2080,11 +1863,6 @@ static int vt6656_probe(struct usb_interface *intf,
dev_info(&udev->dev, "%s up and running!\n", vt->eeprom.string_id);
- /* initialize1(vt); */
- mac_set_bb_type(vt, 2);
- /* This initialization is necessary for Tx */
- vt6656_baseband_set_gain_offset(vt);
-
return 0;
diff --git a/vt6656.h b/vt6656.h
index a83f249..4418ba3 100644
--- a/vt6656.h
+++ b/vt6656.h
@@ -1,8 +1,5 @@
-#ifndef _VT6656_H
-#define _VT6656_H
#define VT6656_CTL_TIMEOUT 500 /* ms */
-#define FCS_LEN 4
#define VT6656_FIRMWARE_FILE "vt6656.fw"
#define VT6656_FIRMWARE_VERSION 0x133
@@ -346,17 +343,10 @@ struct vt6656_dev {
int mc_count;
int multicast_limit;
u8 rx_mode;
- struct ieee80211_hw *hw;
};
typedef int (*usb_fill_urb_t)(struct vt6656_dev *, struct urb *);
-struct vt6656_tx_ctx {
- struct vt6656_dev *vt;
- struct sk_buff *skb;
-};
-
-
/*
* Registers in the MAC
*/
@@ -561,4 +551,3 @@ struct vt6656_tx_ctx {
#define VT6656_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS | FIF_ALLMULTI)
-#endif
diff --git a/vt6656_descriptor.c b/vt6656_descriptor.c
deleted file mode 100644
index b08358c..0000000
--- a/vt6656_descriptor.c
+++ /dev/null
@@ -1,1767 +0,0 @@
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/usb.h>
-#include <linux/etherdevice.h>
-#include <linux/firmware.h>
-#include <net/mac80211.h>
-
-#include "vt6656.h"
-#include "vt6656_descriptor.h"
-
-/*
-#define vt6656_info(vt, format, arg ...) \
- dev_info(&(vt)->udev->dev, format, ##arg)
-#define vt6656_err(vt, format, arg ...) \
- dev_err(&(vt)->udev->dev, format, ##arg)
-#define vt6656_dbg(vt, format, arg ...) \
- dev_dbg(&(vt)->udev->dev, format, ##arg)
-
-*/
-
-
-/*****************************************************************************************
- tx support functions for tx descriptor
-*****************************************************************************************/
-
-static const u16 wTimeStampOff[2][MAX_RATE] = {
- {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble
- {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble
- };
-
-static const u16 wFB_Opt0[2][5] = {
- {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, // fallback_rate0
- {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, // fallback_rate1
- };
-static const u16 wFB_Opt1[2][5] = {
- {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, // fallback_rate0
- {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1
- };
-
-
-
-static u32 s_uGetDataDuration (
- u8 byDurType,
- u32 cbFrameLength,
- u8 standard,
- s16 wRate,
- u8 bNeedAck,
- u32 uFragIdx,
- u32 cbLastFragmentSize,
- u32 uMACfragNum,
- u16 autofallback,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u8 preamble,
- u32 sifs
- );
-static void BBvCaculateParameter (
- u32 cbFrameLength,
- s16 wRate,
- u16 standard,
- u8 preamble,
- u8 setCCKModulation,
- s16 *pwPhyLen,
- u8 *pbyPhySrv,
- u8 *pbyPhySgn
- );
-
-static u32 s_uGetRTSCTSDuration (
- u8 byDurType,
- u32 cbFrameLength,
- u8 standard,
- s16 wRate,
- u8 bNeedAck,
- u16 autofallback,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u8 preamble,
- u32 sifs
- );
-static void s_vFillCTSHead (
- u32 uDMAIdx,
- u8 standard,
- void *pvCTS,
- u32 cbFrameLength,
- u8 bNeedAck,
- u8 bDisCRC,
- s16 tx_rate_hw_value,
- u8 autofallback,
- u8 topCCKBasicRate, u8 topOFDMBasicRate,
- u8 preamble,
- u8 setCCKModulation,
- u32 sifs,
- struct sk_buff *skb,
- u8 *currentMACAddr
- );
-static void s_vFillRTSHead (
- u16 standard,
- void *pvRTS,
- u32 frame_len,
- u8 bNeedAck,
- u8 bDisCRC,
- u16 tx_rate_hw_value,
- u16 autofallback,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u8 preamble,
- u8 setCCKModulation,
- u32 sifs,
- struct sk_buff *skb,
- struct vt6656_dev *vt
- );
-
-static u32 BBuGetFrameTime (
- u8 preamble,
- u16 standard,
- u32 frame_len,
- u16 tx_rate_hw_value
- );
-
-static u32 s_uGetRTSCTSRsvTime (
- u16 byRTSRsvType,
- u8 standard,
- u32 frame_len,
- u16 tx_rate_hw_value,
- u8 preamble,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u32 sifs
- );
-static u32 s_uGetTxRsvTime (
- u8 standard,
- u32 cbFrameLength,
- s16 wRate,
- u8 bNeedAck,
- u8 preamble,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u32 sifs
- );
-static u32 s_uFillDataHead (
- u16 standard,
- s16 currentRate,
- void *pTxDataHead,
- u32 frame_len,
- u32 uDMAIdx,
- u8 bNeedAck,
- u32 uFragIdx,
- u32 cbLastFragmentSize,
- u32 uMACfragNum,
- u16 autofallback
- );
-
-static void complete_data_frame_tx_desc(u32 machdr_len,
- u16 standard,
- u16 tx_rate_hw_value,
- u16 autofallback,
- u32 frame_len,
- void *pvRrvTime,
- void *pvRTS,
- void *pvCTS,
- void *pvTxDataHd,
- u8 bNeedACK,
- u32 uDMAIdx,
- struct sk_buff *skb,
- u8 *currentMACAddr,
- struct vt6656_dev *vt
- );
-
-int vt6656_fill_desc_ctrl(struct ieee80211_hw *hw,
- struct tx_desc *tx_hw_head,
- u16 tx_rate_hw_value,
- u8 bNeedACK,
- struct sk_buff* skb)
-{
- u16 standard = (le16_to_cpu(tx_hw_head->FIFOCtl) & FIFOCTL_11B) ? VT6656_80211B : VT6656_80211G;
- u16 autofallback = (le16_to_cpu(tx_hw_head->FIFOCtl) & FIFOCTL_AUTO_FB_0);
- u8 *pbyTxBufferAddr;
- void *pvRTS;
- PSCTS pCTS;
- void *pvTxDataHd; /*TODO: This variable is not used anywhere!!!!!!*/
- u32 uDuration;
- u32 cbReqCount;
- u32 cbHeaderSize;
- u32 framebody_size = 0; /* cbFrameBodySize in the old driver */
- u32 frame_len = 0; /* cbFrameSize */
-/* u32 cbIVlen = 0;
- u32 cbICVlen = 0;
- u32 cbMIClen = 0;
- u32 cbFCSlen = 4;
- u32 uPadding = 0; */
- s16 wTxBufSize;
- void *pvRrvTime;
- void *pMICHDR;
- /* u8 aes = 0; //Set FRAGCTL_WEPTYP */
- u8 uDMAIdx = TYPE_TXDMA0;
- u16 fcs_len = FCS_LEN;
- u8 ctrlRate;
- u32 machdr_len = 0; /* cbMACHdLen in old driver TODO: check the values of this */
- u8 currentMACAddr[ETH_ALEN];
- struct vt6656_dev *vt = hw->priv;
-/* PS802_11Header pMACHeader; */
-/* PSMgmtObject pMgmt = &(pDevice->sMgmtObj); */
-/* PSTxBufHead pTxBufHead; */
-/* PTX_BUFFER pTX_Buffer; */
-/* s16 wCurrentRate = RATE_1M; */
-
- struct ieee80211_hdr *machdr = (struct ieee80211_hdr *)skb->data;
- __le16 macfc = machdr->frame_control;
- memcpy(currentMACAddr, hw->wiphy->perm_addr, ETH_ALEN);
-
- machdr_len = ieee80211_get_hdrlen_from_skb(skb);
- /* TODO: check this */
- framebody_size = skb->len - machdr_len; /* - fcs_len; */
-
- /* TODO: we are not considering encryption
- * cbIVlen, cbMIClen, cbICVlen are 0 because of this.
- * Anyway, in anycase it is already included in the frame size
- * Original calculation:
- * cbFrameSize = cbMacHdLen + cbFrameBodySize + cbIVlen + cbMIClen + cbICVlen + cbFCSlen;
- * For us it is just cbFrameSize = skb->len;
- */
-
- frame_len = skb->len + fcs_len;
-
-
-
- if (VT6656_80211A == standard) {//802.11a packet
- ctrlRate = RATE_6M;
- } else {
- ctrlRate = RATE_1M;
- }
-
-/* TODO: check this
-
- // SetPower will cause error power TX state for OFDM Date packet in TX buffer.
- // 2004.11.11 Kyle -- Using OFDM power to tx MngPkt will decrease the connection capability.
- // And cmd timer will wait data pkt TX finish before scanning so it's OK
- // to set power here.
- if (pMgmt->eScanState != WMAC_NO_SCANNING) {
- RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh);
- } else {
- RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
- }
-
-*/
- // Notes:
- // Although spec says MMPDU can be fragmented; In most case,
- // no one will send a MMPDU under fragmentation. With RTS may occur.
-
- if (ieee80211_has_protected(macfc)) {
-/* if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) {
- cbIVlen = 4;
- cbICVlen = 4;
- pTxBufHead->wFragCtl |= FRAGCTL_LEGACY;
- }
- else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
- cbIVlen = 8;//IV+ExtIV
- cbMIClen = 8;
- cbICVlen = 4;
- pTxBufHead->wFragCtl |= FRAGCTL_TKIP;
- //We need to get seed here for filling TxKey entry.
- //TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
- // pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG);
- }
- else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
- cbIVlen = 8;//RSN Header
- cbICVlen = 8;//MIC
- pTxBufHead->wFragCtl |= FRAGCTL_AES;
- pDevice->bAES = TRUE;
- }
- //MAC Header should be padding 0 to DW alignment.
- uPadding = 4 - (cbMacHdLen%4);
- uPadding %= 4; */
- }
-
-
-
- //Set FIFOCTL_GrpAckPolicy
- /* if (pDevice->bGrpAckPolicy == TRUE) {//0000 0100 0000 0000
- pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK;
- } */
- //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter()
- pbyTxBufferAddr = (u8 *) &(tx_hw_head->adwTxKey[0]);
- wTxBufSize = sizeof(struct tx_desc) - 4;
-
- //Set RrvTime/RTS/CTS Buffer
- if (VT6656_80211G == standard) {//802.11g packet
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = NULL;
- pvRTS = NULL;
- pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS) + sizeof(STxDataHead_g);
- }
- else { // 802.11a/b packet
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = NULL;
- pvRTS = NULL;
- pCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + sizeof(STxDataHead_ab);
- }
-
- memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize));
-
- //Fill FIFO,RrvTime,RTS,and CTS
-/* s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS,
- cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader);*/
- complete_data_frame_tx_desc(machdr_len, standard, tx_rate_hw_value, autofallback, frame_len,
- pvRrvTime, pvRTS, pCTS, pvTxDataHd, bNeedACK, uDMAIdx, skb, currentMACAddr, vt);
-
- //Fill DataHead
- uDuration = s_uFillDataHead(standard, ctrlRate, pvTxDataHd, frame_len, TYPE_TXDMA0, bNeedACK,
- 0, 0, 1, autofallback);
-
- /* pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); */
-
- cbReqCount = cbHeaderSize + frame_len; /* + cbMacHdLen + uPadding + cbIVlen + framebody_size; */
-
- if (ieee80211_has_protected(macfc)) {
-/* u8 * pbyIVHead;
- u8 * pbyPayloadHead;
- u8 * pbyBSSID;
- PSKeyItem pTransmitKey = NULL;
-
- pbyIVHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding);
- pbyPayloadHead = (u8 *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen);
- do {
- if ((pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) &&
- (pDevice->bLinkPass == TRUE)) {
- pbyBSSID = pDevice->abyBSSID;
- // get pairwise key
- if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == FALSE) {
- // get group key
- if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == TRUE) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n");
- break;
- }
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get PTK.\n");
- break;
- }
- }
- // get group key
- pbyBSSID = pDevice->abyBroadcastAddr;
- if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == FALSE) {
- pTransmitKey = NULL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KEY is NULL. OP Mode[%d]\n", pDevice->eOPMode);
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n");
- }
- } while(FALSE);
- //Fill TXKEY
- s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
- (u8 *)pMACHeader, (s16)cbFrameBodySize, NULL);
-
- MEMvCopy(pMACHeader, pPacket->p80211Header, cbMacHdLen);
- MEMvCopy(pbyPayloadHead, ((u8 *)(pPacket->p80211Header) + cbMacHdLen),
- cbFrameBodySize); */
- }
- else {
- // Copy the Packet into a tx Buffer
-/* memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); */
- }
-
-/* pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4);
- pDevice->wSeqCounter++ ;
- if (pDevice->wSeqCounter > 0x0fff)
- pDevice->wSeqCounter = 0; */
-
- if (ieee80211_is_pspoll(macfc)) {
- // The MAC will automatically replace the Duration-field of MAC header by Duration-field
- // of FIFO control header.
- // This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is
- // in the same place of other packet's Duration-field).
- // And it will cause Cisco-AP to issue Disassociation-packet
- if (VT6656_80211G == standard) {//802.11g packet
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = le16_to_cpu(machdr->duration_id);
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = le16_to_cpu(machdr->duration_id);
- } else {
- ((PSTxDataHead_ab)pvTxDataHd)->wDuration = le16_to_cpu(machdr->duration_id);
- }
- }
-
- return cbHeaderSize;
-
-}
-
-
-
-static u32 s_uFillDataHead (
- u16 standard,
- s16 currentRate,
- void *pTxDataHead,
- u32 frame_len,
- u32 uDMAIdx,
- u8 bNeedAck,
- u32 uFragIdx,
- u32 cbLastFragmentSize,
- u32 uMACfragNum,
- u16 autofallback
- )
-{
-/* u32 uRTSFrameLen = 20; */
- u8 topCCKBasicRate = RATE_1M;
- u8 topOFDMBasicRate = RATE_24M;
- u32 sifs;
- u8 preamble = PREAMBLE_LONG; /*TODO: check when you have to set PREAMBLE_SHORT */
- u8 setCCKModulation = 1;
-/* u8 bDisCRC = 0; */
-
- if (pTxDataHead == NULL) {
- return 0;
- }
-
- /* SIFS For 802.11B and G it is the same - it is different for A */
- sifs = C_SIFS_BG;
-
- if (VT6656_80211G == standard) {//802.11g packet
- if((uDMAIdx==TYPE_ATIMDMA)||(uDMAIdx==TYPE_BEACONDMA)) {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(frame_len, currentRate, standard, preamble, setCCKModulation,
- (s16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-/* BBvCaculateParameter(pDevice, cbFrameLength, currentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField) */
- );
- //Get Duration and TimeStampOff
- pBuf->wDuration = (s16)s_uGetDataDuration(DATADUR_A, frame_len, standard,
- currentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- autofallback, topCCKBasicRate,
- topOFDMBasicRate, preamble, sifs); //1: 2.4GHz
- if(uDMAIdx!=TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[preamble%2][currentRate%MAX_RATE];
- }
- return (pBuf->wDuration);
- }
- else { // DATA & MANAGE Frame
- if (autofallback == 0) {
- PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(frame_len, currentRate, standard, preamble, setCCKModulation,
- (s16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- BBvCaculateParameter(frame_len, topCCKBasicRate, VT6656_80211B, preamble, setCCKModulation,
- (s16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- //Get Duration and TimeStamp
- pBuf->wDuration_a = (s16)s_uGetDataDuration(DATADUR_A, frame_len,
- standard, currentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- autofallback, topCCKBasicRate,
- topOFDMBasicRate, preamble, sifs); //1: 2.4GHz
- pBuf->wDuration_b = (s16)s_uGetDataDuration(DATADUR_B, frame_len,
- VT6656_80211B, topCCKBasicRate,
- bNeedAck, uFragIdx, cbLastFragmentSize,
- uMACfragNum, autofallback, topCCKBasicRate,
- topOFDMBasicRate, preamble, sifs); //1: 2.4GHz
-
- pBuf->wTimeStampOff_a = wTimeStampOff[preamble%2][currentRate%MAX_RATE];
- pBuf->wTimeStampOff_b = wTimeStampOff[preamble%2][topCCKBasicRate%MAX_RATE];
- return (pBuf->wDuration_a);
- } else {
- // Auto Fallback
- PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(frame_len, currentRate, standard, preamble, setCCKModulation,
- (s16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- BBvCaculateParameter(frame_len, topCCKBasicRate, VT6656_80211B, preamble, setCCKModulation,
- (s16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- //Get Duration and TimeStamp
- pBuf->wDuration_a = (s16)s_uGetDataDuration(DATADUR_A, frame_len, standard,
- currentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //1: 2.4GHz
- pBuf->wDuration_b = (s16)s_uGetDataDuration(DATADUR_B, frame_len, VT6656_80211B,
- topCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //1: 2.4GHz
- pBuf->wDuration_a_f0 = (s16)s_uGetDataDuration(DATADUR_A_F0, frame_len, standard,
- currentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //1: 2.4GHz
- pBuf->wDuration_a_f1 = (s16)s_uGetDataDuration(DATADUR_A_F1, frame_len, standard,
- currentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //1: 2.4GHz
- pBuf->wTimeStampOff_a = wTimeStampOff[preamble%2][currentRate%MAX_RATE];
- pBuf->wTimeStampOff_b = wTimeStampOff[preamble%2][topCCKBasicRate%MAX_RATE];
- return (pBuf->wDuration_a);
- } //if (autofallback == AUTO_FB_NONE)
- }
- }
- /* else if (byPktType == PK_TYPE_11A) { TODO: 11A
- if ((autofallback != 0) && (uDMAIdx != TYPE_ATIMDMA) && (uDMAIdx != TYPE_BEACONDMA)) {
- // Auto Fallback
- PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(pDevice, frame_len, currentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- //Get Duration and TimeStampOff
- pBuf->wDuration = (u16)s_uGetDataDuration(DATADUR_A, frame_len, byPktType,
- currentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //0: 5GHz
- pBuf->wDuration_f0 = (u16)s_uGetDataDuration(DATADUR_A_F0, frame_len, byPktType,
- currentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //0: 5GHz
- pBuf->wDuration_f1 = (u16)s_uGetDataDuration(DATADUR_A_F1, frame_len, byPktType,
- currentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //0: 5GHz
- if(uDMAIdx!=TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[preamble%2][currentRate%MAX_RATE];
- }
- return (pBuf->wDuration);
- } else {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(pDevice, frame_len, currentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- //Get Duration and TimeStampOff
- pBuf->wDuration = (u16)s_uGetDataDuration(DATADUR_A, frame_len, byPktType,
- currentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs);
-
- if(uDMAIdx!=TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[preamble%2][currentRate%MAX_RATE];
- }
- return (pBuf->wDuration);
- }
- } */
- else if (VT6656_80211B == standard) {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(frame_len, currentRate, standard, preamble, setCCKModulation,
- (s16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- //Get Duration and TimeStampOff
- pBuf->wDuration = (s16)s_uGetDataDuration(DATADUR_B, frame_len, standard,
- currentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs);
- if (uDMAIdx != TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[preamble%2][currentRate%MAX_RATE];
- }
- return (pBuf->wDuration);
- }
- return 0;
-}
-
-
-
-
-//byFreqType 0: 5GHz, 1:2.4Ghz
-static u32 s_uGetDataDuration (
- u8 byDurType,
- u32 cbFrameLength,
- u8 standard,
- s16 wRate,
- u8 bNeedAck,
- u32 uFragIdx,
- u32 cbLastFragmentSize,
- u32 uMACfragNum,
- u16 autofallback,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u8 preamble,
- u32 sifs
- )
-{
- u8 bLastFrag = 0;
- u32 uAckTime =0, uNextPktTime = 0;
-
-
- if (uFragIdx == (uMACfragNum-1)) {
- bLastFrag = 1;
- }
-
- switch (byDurType) {
-
- case DATADUR_B: //DATADUR_B
- if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag
- if (bNeedAck) {
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- return (sifs + uAckTime);
- } else {
- return 0;
- }
- }
- else {//First Frag or Mid Frag
- if (uFragIdx == (uMACfragNum-2)) {
- uNextPktTime = s_uGetTxRsvTime(standard, cbLastFragmentSize, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else {
- uNextPktTime = s_uGetTxRsvTime(standard, cbFrameLength, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- }
- if (bNeedAck) {
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- return (sifs + uAckTime + uNextPktTime);
- } else {
- return (sifs + uNextPktTime);
- }
- }
- break;
-
-
- case DATADUR_A: //DATADUR_A
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- return (sifs + uAckTime);
- } else {
- return 0;
- }
- }
- else {//First Frag or Mid Frag
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(standard, cbLastFragmentSize, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else {
- uNextPktTime = s_uGetTxRsvTime(standard, cbFrameLength, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- }
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- return (sifs + uAckTime + uNextPktTime);
- } else {
- return (sifs + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A_F0: //DATADUR_A_F0
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- return (sifs + uAckTime);
- } else {
- return 0;
- }
- }
- else { //First Frag or Mid Frag
- if (autofallback == 1) {
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(standard, cbLastFragmentSize, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else {
- uNextPktTime = s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- }
- } else { // (autofallback == 2)
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(standard, cbLastFragmentSize, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else {
- uNextPktTime = s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- }
- }
-
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- return (sifs + uAckTime + uNextPktTime);
- } else {
- return (sifs + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A_F1: //DATADUR_A_F1
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- return (sifs + uAckTime);
- } else {
- return 0;
- }
- }
- else { //First Frag or Mid Frag
- if (autofallback == 1) {
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(standard, cbLastFragmentSize, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else {
- uNextPktTime = s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- }
-
- } else { // (autofallback == 2)
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(standard, cbLastFragmentSize, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else {
- uNextPktTime = s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- }
- }
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- return (sifs + uAckTime + uNextPktTime);
- } else {
- return (sifs + uNextPktTime);
- }
- }
- break;
-
- default:
- break;
- }
-
- ASSERT(FALSE);
- return 0;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* Fill FIFO,RrvTime,RTS,and CTS */
-
-int vt6656_fill_desc(struct ieee80211_hw *hw, struct tx_desc *tx_hw_head, u16 tx_rate_hw_value, u8 bNeedACK, struct sk_buff* skb)
-{
- u16 standard = (le16_to_cpu(tx_hw_head->FIFOCtl) & FIFOCTL_11B) ? VT6656_80211B : VT6656_80211G;
- u16 autofallback = (le16_to_cpu(tx_hw_head->FIFOCtl) & FIFOCTL_AUTO_FB_0);
- u8 rts = 0; /* for now we always clear it */
- u32 cbHeaderLength= 0;
- u32 cbMICHDR = 0;
- u32 uPadding = 0;
- void *pvRrvTime;
- PSMICHDRHead pMICHDR;
- void *pvRTS;
- void *pvCTS;
- void *pvTxDataHd;
- u8 *pbyMacHdr;
- u8 *pbyIVHead;
- u8 *pbyPayloadHead;
- u8 *pbyTxBufferAddr;
- u32 wTxBufSize;
- u32 machdr_len = 0; /* cbMACHdLen in old driver TODO: check the values of this */
- u32 framebody_size = 0; /* cbFrameBodySize in the old driver */
- u32 frame_len = 0; /* cbFrameSize */
- u32 cbIVlen=0;
- u16 fcs_len = FCS_LEN;
- u8 uDMAIdx = TYPE_AC0DMA;
- /* ,cbICVlen=0,cbMIClen=0,cbFCSlen=4; */
- struct ieee80211_hdr *machdr = (struct ieee80211_hdr *)skb->data;
- __le16 macfc = machdr->frame_control;
- struct vt6656_dev *vt = hw->priv;
- u8 currentMACAddr[ETH_ALEN];
- u32 uDuration;
-
-
- memcpy(currentMACAddr, hw->wiphy->perm_addr, ETH_ALEN);
- machdr_len = ieee80211_get_hdrlen_from_skb(skb);
- pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
- printk(KERN_INFO "CTRL FIFO %.04X\n", tx_hw_head->FIFOCtl);
- if (ieee80211_is_data(macfc))
- uDMAIdx = TYPE_AC0DMA;
- else
- uDMAIdx = TYPE_TXDMA0;
-
- /* TODO:
- * In the original drivder it adds 8 for cb802_1_H_len -
- * This probably corresponds to a last address plus type added in the frame right
- * after the header.
- * Probably it refers to the last address (AA-AA-03-00-00-00)
- * plus the payload type that are added in the frame right after the 802.11 hdr
- * in the old driver.
- * I assume all this has already been solved in the 802.11 stack
- * (ie it is included).
- * We need to check it!!!!
- * In the old driver, cbFrameBodySize does NOT include encryption
- * specific data. In skb->len surely it is included
- * This is not a problem now because we are not considering
- * encryption. But we must evaluate it when encryption comes to play
- * Encryption must consider the follwoing values to subtract
- * from skb->len: cbIVlen + cbMIClen + cbICVlen
- * FCS: does skb->len include FCS? I think NOOOO
- * I assume yes, then we must subtract cbFCSlen from skb->len
- * Otherwise, we must remove fcs_len from calculation.
- * Note: In the old driver, cbFrameBodySize is used for encryption
- * calculations only.
- */
- framebody_size = skb->len - machdr_len; /* - fcs_len; */
-
- /* TODO: we are not considering encryption
- * cbIVlen, cbMIClen, cbICVlen are 0 because of this.
- * Anyway, in anycase it is already included in the frame size
- * Original calculation:
- * cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen)
- * + cbICVlen + cbFCSlen;
- * For us it is just cbFrameSize = skb->len;
- */
-
- frame_len = skb->len + fcs_len;
-
-
-
- /*
- * TODO: check how to add this code:
- if ( (bNeedACK == FALSE) ||(cbFrameSize < pDevice->wRTSThreshold) ) {
- bRTS = FALSE;
- } else {
- bRTS = TRUE;
- pTxBufHead->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY);
- }
- */
- pbyTxBufferAddr = (u8 *) &(tx_hw_head->adwTxKey[0]);
- wTxBufSize = sizeof(struct tx_desc) - 4;
-
-
-
- if (VT6656_80211G == standard) {//802.11g packet
- if (0 == autofallback) {
- if (rts == 1) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
- }
- else { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
- }
- } else {
- // Auto Fall Back
- if (rts == 1) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
- }
- else { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB);
- }
- } // Auto Fall Back
- }
- else {//802.11a/b packet
- if (0 == autofallback) {
- if (rts == 1) {//RTS_need
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
- }
- else { //RTS_needless, no MICHDR
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
- printk(KERN_INFO "A VER: %d - %d - %d\n", wTxBufSize, sizeof(SRrvTime_ab), sizeof(STxDataHead_ab));
- }
- } else {
- // Auto Fall Back
- if (rts == 1) {//RTS_need
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
- }
- else { //RTS_needless
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_a_FB);
- }
- } // Auto Fall Back
- }
-
- pbyMacHdr = (u8 *)(pbyTxBufferAddr + cbHeaderLength);
- pbyIVHead = (u8 *)(pbyMacHdr + machdr_len + uPadding);
- pbyPayloadHead = (u8 *)(pbyMacHdr + machdr_len + uPadding + cbIVlen);
-
-
- complete_data_frame_tx_desc(machdr_len, standard, tx_rate_hw_value, autofallback, frame_len,
- pvRrvTime, pvRTS, pvCTS, pvTxDataHd, bNeedACK, uDMAIdx, skb, currentMACAddr, vt);
-
- //Fill DataHead
- uDuration = s_uFillDataHead(standard, tx_rate_hw_value, pvTxDataHd, frame_len, uDMAIdx, bNeedACK,
- 0, 0, 1, autofallback);
-
- return cbHeaderLength;
-}
-
-
-static void complete_data_frame_tx_desc(u32 machdr_len,
- u16 standard,
- u16 tx_rate_hw_value,
- u16 autofallback,
- u32 frame_len,
- void *pvRrvTime,
- void *pvRTS,
- void *pvCTS,
- void *pvTxDataHd,
- u8 bNeedACK,
- u32 uDMAIdx,
- struct sk_buff *skb,
- u8 *currentMACAddr,
- struct vt6656_dev *vt
- )
-{
- /* TODO: Check whether these values are all right */
- u8 topCCKBasicRate = RATE_1M;
- u8 topOFDMBasicRate = RATE_24M;
- u32 sifs;
-/* struct ieee80211_hdr *machdr = (struct ieee80211_hdr *)skb->data; */
- u8 preamble = PREAMBLE_LONG; /*TODO: check when you have to set PREAMBLE_SHORT */
- u8 setCCKModulation = 1;
- u8 bDisCRC = 0;
-
- /* SIFS For 802.11B and G it is the same - it is different for A */
- sifs = C_SIFS_BG;
-
-/* TODO: Check, I think this is not necessary:
- pFifoHead->wReserved = wCurrentRate; */
-
- if (VT6656_80211G == standard) { /* 802.11g packet */
- if (pvRTS != NULL) { //RTS_need
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime;
- pBuf->wRTSTxRrvTime_aa = (s16)s_uGetRTSCTSRsvTime(2, standard, frame_len, tx_rate_hw_value, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//2:RTSTxRrvTime_aa, 1:2.4GHz /* TODO: Endianship*/
- pBuf->wRTSTxRrvTime_ba = (s16)s_uGetRTSCTSRsvTime(1, standard, frame_len, tx_rate_hw_value, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//1:RTSTxRrvTime_ba, 1:2.4GHz /* TODO: Endianship*/
- pBuf->wRTSTxRrvTime_bb = (s16)s_uGetRTSCTSRsvTime(0, standard, frame_len, tx_rate_hw_value, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//0:RTSTxRrvTime_bb, 1:2.4GHz /* TODO: Endianship*/
- pBuf->wTxRrvTime_a = (s16) s_uGetTxRsvTime(standard, frame_len, tx_rate_hw_value, bNeedACK, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//2.4G OFDM /* TODO: Endianship*/
- pBuf->wTxRrvTime_b = (s16) s_uGetTxRsvTime(VT6656_80211B, frame_len, topCCKBasicRate, bNeedACK, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//1:CCK /* TODO: Endianship*/
- }
- //Fill RTS
- s_vFillRTSHead(standard, pvRTS, frame_len, bNeedACK, FALSE, tx_rate_hw_value, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, setCCKModulation, sifs, skb, vt);
- }
- else {//RTS_needless, PCF mode
-
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime;
- pBuf->wTxRrvTime_a = (s16)s_uGetTxRsvTime(standard, frame_len, tx_rate_hw_value, bNeedACK, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//2.4G OFDM /* TODO: Endianship*/
- pBuf->wTxRrvTime_b = (s16)s_uGetTxRsvTime(VT6656_80211B, frame_len, topCCKBasicRate, bNeedACK, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//1:CCK /* TODO: Endianship*/
- pBuf->wCTSTxRrvTime_ba = (s16)s_uGetRTSCTSRsvTime(3, standard, frame_len, tx_rate_hw_value, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//3:CTSTxRrvTime_Ba, 1:2.4GHz /* TODO: Endianship*/
- }
- //Fill CTS
- s_vFillCTSHead(uDMAIdx, standard, pvCTS, frame_len, bNeedACK, FALSE, tx_rate_hw_value, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, setCCKModulation, sifs, skb, currentMACAddr);
- }
- } else { /* Assume 802.11B - not considering 802.11A */
- if ((pvRTS != NULL)) {//RTS_need, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wRTSTxRrvTime = (s16)s_uGetRTSCTSRsvTime(0, standard, frame_len, tx_rate_hw_value, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//0:RTSTxRrvTime_bb, 1:2.4GHz /* TODO: Endianship*/
- pBuf->wTxRrvTime = (s16)s_uGetTxRsvTime(VT6656_80211B, frame_len, tx_rate_hw_value, bNeedACK, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);//1:CCK /* TODO: Endianship*/
- }
- //Fill RTS
- s_vFillRTSHead(standard, pvRTS, frame_len, bNeedACK, bDisCRC, tx_rate_hw_value, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, setCCKModulation, sifs, skb, vt);
- } else { //RTS_needless, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wTxRrvTime = (s16)s_uGetTxRsvTime(VT6656_80211B, frame_len, tx_rate_hw_value, bNeedACK, preamble, topCCKBasicRate, topOFDMBasicRate, sifs); //1:CCK /* TODO: Endianship*/
- }
- }
- }
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter END.\n");
-/* TODO: Add the corresponding case for 802.11A */
-
-}
-
-
-/*
-our station is NOT in current mode WMAC_MODE_ESS_AP or WMAC_MODE_IBSS_STA
- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) ||
- (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ) {
-
-*/
-/* Only for WMAC_MODE_ESS_AP and AD_HOC MODE we set preamble to PREAMBLE_SHORT
- The rest of the time it is PREAMBLE_LONG (0)
- */
-
-
-
-static u32 s_uGetTxRsvTime (
- u8 standard,
- u32 cbFrameLength,
- s16 wRate,
- u8 bNeedAck,
- u8 preamble,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u32 sifs
- )
-{
- u32 uDataTime, uAckTime;
-
- uDataTime = BBuGetFrameTime(preamble, standard, cbFrameLength, wRate);
- if (standard == VT6656_80211B) {//llb,CCK mode
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- } else {//11g 2.4G OFDM mode & 11a 5G OFDM mode
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- }
-
- if (bNeedAck) {
- return (uDataTime + sifs + uAckTime);
- }
- else {
- return uDataTime;
- }
-}
-
-
-static u32 s_uGetRTSCTSRsvTime (
- u16 byRTSRsvType,
- u8 standard,
- u32 frame_len,
- u16 tx_rate_hw_value,
- u8 preamble,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u32 sifs
- )
-{
- u32 uRrvTime , uRTSTime, uCTSTime, uAckTime, uDataTime;
-
- uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0;
-
-
- uDataTime = BBuGetFrameTime(preamble, standard, frame_len, tx_rate_hw_value);
- if (byRTSRsvType == 0) { //RTSTxRrvTime_bb
- uRTSTime = BBuGetFrameTime(preamble, standard, 20, topCCKBasicRate);
- uCTSTime = uAckTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- }
- else if (byRTSRsvType == 1){ //RTSTxRrvTime_ba, only in 2.4GHZ
- uRTSTime = BBuGetFrameTime(preamble, standard, 20, topCCKBasicRate);
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- }
- else if (byRTSRsvType == 2) { //RTSTxRrvTime_aa
- uRTSTime = BBuGetFrameTime(preamble, standard, 20, topOFDMBasicRate);
- uCTSTime = uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- }
- else if (byRTSRsvType == 3) { //CTSTxRrvTime_ba, only in 2.4GHZ
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- uAckTime = BBuGetFrameTime(preamble, standard, 14, topOFDMBasicRate);
- uRrvTime = uCTSTime + uAckTime + uDataTime + 2*sifs;
- return uRrvTime;
- }
-
- //RTSRrvTime
- uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*sifs;
- return uRrvTime;
-}
-
-/* TODO: Check when CARDbAddBasicRate.
- * This will affect byTopCCKBasicRate and byTopOFDMBasicRate
- */
-/* TODO: Check:
- * sifs is set in vUpdateIFS in the old driver
- */
-
-/*
- * Description: Calculate data frame transmitting time
- *
- * Parameters:
- * In:
- * preamble - Preamble Type
- * standard - 802.11A, B, GB, GA
- * frame_len - Baseband Type
- * tx_rate_hw_value - Tx Rate
- * Out:
- *
- * Return Value: FrameTime
- *
- */
-static u32 BBuGetFrameTime (
- u8 preamble,
- u16 standard,
- u32 frame_len,
- u16 tx_rate_hw_value
- )
-{
- u32 uFrameTime;
- u32 uPreamble;
- u32 uTmp;
- u32 uRateIdx = (u32)tx_rate_hw_value;
- u32 uRate = 0;
-
-
- if (uRateIdx > RATE_54M) {
-/* ASSERT(0);*/
- return 0;
- }
-
- uRate = (u32)awcFrameTime[uRateIdx];
-
- if (uRateIdx <= 3) { //CCK mode
-
- if (preamble == PREAMBLE_SHORT) {//Short
- uPreamble = 96;
- } else {
- uPreamble = 192;
- }
- uFrameTime = (frame_len * 80) / uRate;
- uTmp = (uFrameTime * uRate) / 80;
- if (frame_len != uTmp) {
- uFrameTime ++;
- }
-
- return (uPreamble + uFrameTime);
- }
- else {
- uFrameTime = (frame_len * 8 + 22) / uRate;
- uTmp = ((uFrameTime * uRate) - 22) / 8;
- if(frame_len != uTmp) {
- uFrameTime ++;
- }
- uFrameTime = uFrameTime * 4;
- uFrameTime += 6;
- /* TODO: For 802.11A We don't add 6 to uFrameTime.
- * This decision is based on standard*/
- return (20 + uFrameTime);
- }
-}
-
-
-static void s_vFillRTSHead (
- u16 standard,
- void *pvRTS,
- u32 frame_len,
- u8 bNeedAck,
- u8 bDisCRC,
- u16 tx_rate_hw_value,
- u16 autofallback,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u8 preamble,
- u8 setCCKModulation,
- u32 sifs,
- struct sk_buff *skb,
- struct vt6656_dev *vt
- )
-{
- u32 uRTSFrameLen = 20;
- s16 wLen = 0x0000;
- struct ieee80211_hdr *machdr = (struct ieee80211_hdr *)skb->data;
-
- if (pvRTS == NULL)
- return;
-/*
- if (bDisCRC) {
- // When CRCDIS bit is on, H/W forgot to generate FCS for RTS frame,
- // in this case we need to decrease its length by 4.
- uRTSFrameLen -= 4;
- }
-*/
- // Note: So far RTSHead dosen't appear in ATIM & Beacom DMA, so we don't need to take them into account.
- // Otherwise, we need to modified codes for them.
- if (VT6656_80211G == standard) {//802.11g packet
- if (0 == autofallback) {
- PSRTS_g pBuf = (PSRTS_g)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(uRTSFrameLen, topCCKBasicRate, VT6656_80211B, preamble, setCCKModulation,
- &(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b));
- pBuf->wTransmitLength_b = wLen; /* TODO: Endianship*/
- BBvCaculateParameter(uRTSFrameLen, topOFDMBasicRate, standard, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = wLen; /* TODO: Endianship*/
- //Get Duration
- pBuf->wDuration_bb = (s16)s_uGetRTSCTSDuration(RTSDUR_BB, frame_len, VT6656_80211B, topCCKBasicRate, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //0:RTSDuration_bb, 1:2.4G, 1:CCKData /* TODO: Endianship*/
- pBuf->wDuration_aa = (s16)s_uGetRTSCTSDuration(RTSDUR_AA, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData /* TODO: Endianship*/
- pBuf->wDuration_ba = (s16)s_uGetRTSCTSDuration(RTSDUR_BA, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data /* TODO: Endianship*/
-
- pBuf->Data.wDurationID = pBuf->wDuration_aa;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
-
-/* We are not considering ADHOC OR AP
-
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
-
-So we get:
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
-
- */
-
-/* TODO: THIS MUST BE BSSID ADDRESS */
- memcpy(&(pBuf->Data.abyRA[0]), vt->bssid, ETH_ALEN);
-
-/* NOT AP
- if (pDevice->eOPMode == OP_MODE_AP) {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN);
- }
-
-So we use:
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN);
-
- */
-
- memcpy(&(pBuf->Data.abyTA[0]), ieee80211_get_SA(machdr), ETH_ALEN);
- }
- else {
- PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(uRTSFrameLen, topCCKBasicRate, VT6656_80211B, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = wLen; /* TODO: Endianship*/
- BBvCaculateParameter(uRTSFrameLen, topOFDMBasicRate, standard, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = wLen; /* TODO: Endianship*/
- //Get Duration
- pBuf->wDuration_bb = (s16)s_uGetRTSCTSDuration(RTSDUR_BB, frame_len, VT6656_80211B, topCCKBasicRate, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //0:RTSDuration_bb, 1:2.4G, 1:CCKData /* TODO: Endianship*/
- pBuf->wDuration_aa = (s16)s_uGetRTSCTSDuration(RTSDUR_AA, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData /* TODO: Endianship*/
- pBuf->wDuration_ba = (s16)s_uGetRTSCTSDuration(RTSDUR_BA, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData /* TODO: Endianship*/
- pBuf->wRTSDuration_ba_f0 = (s16)s_uGetRTSCTSDuration(RTSDUR_BA_F0, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData /* TODO: Endianship*/
- pBuf->wRTSDuration_aa_f0 = (s16)s_uGetRTSCTSDuration(RTSDUR_AA_F0, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData /* TODO: Endianship*/
- pBuf->wRTSDuration_ba_f1 = (s16)s_uGetRTSCTSDuration(RTSDUR_BA_F1, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData /* TODO: Endianship*/
- pBuf->wRTSDuration_aa_f1 = (s16)s_uGetRTSCTSDuration(RTSDUR_AA_F1, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData /* TODO: Endianship*/
- pBuf->Data.wDurationID = pBuf->wDuration_aa;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
-
-/* We don't use adhoc or ap
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
-so we use: MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
-
- */
-
-/* TODO: Fix this!!! */
- memcpy(&(pBuf->Data.abyRA[0]), vt->bssid, ETH_ALEN);
-
-/* no AP
- if (pDevice->eOPMode == OP_MODE_AP) {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN);
- }
-*/
- memcpy(&(pBuf->Data.abyTA[0]), ieee80211_get_SA(machdr), ETH_ALEN);
-
-
- } // if (byFBOption == AUTO_FB_NONE)
- }
-/* TODO: else if (standard == PK_TYPE_11A) {
- if (byFBOption == AUTO_FB_NONE) {
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(uRTSFrameLen, topOFDMBasicRate, standard, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((s16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, frame_len, standard, tx_rate_hw_value, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
---
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
---
-
-******************************************COPY THE BSSID Address!
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
-
---
- if (pDevice->eOPMode == OP_MODE_AP) {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN);
- }
---
- memcpy(&(pBuf->Data.abyTA[0]), ieee80211_get_SA(machdr), ETH_ALEN);
- }
- else {
- PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(uRTSFrameLen, topOFDMBasicRate, standard, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((s16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, frame_len, standard, tx_rate_hw_value, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
- pBuf->wRTSDuration_f0 = cpu_to_le16((s16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, frame_len, standard, tx_rate_hw_value, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData
- pBuf->wRTSDuration_f1 = cpu_to_le16((s16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, frame_len, standard, tx_rate_hw_value, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0:
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
---
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
---
-******************************************COPY THE BSSID Address!
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
-
---
- if (pDevice->eOPMode == OP_MODE_AP) {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN);
- }
---
- memcpy(&(pBuf->Data.abyTA[0]), ieee80211_get_SA(machdr), ETH_ALEN);
- }
- }*/
- else if (VT6656_80211B == standard) {//802.11B packet
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(uRTSFrameLen, topCCKBasicRate, VT6656_80211B, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = wLen; /* TODO: Endianship*/
- //Get Duration
- pBuf->wDuration = (s16)s_uGetRTSCTSDuration(RTSDUR_BB, frame_len, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //0:RTSDuration_bb, 1:2.4G, 1:CCKData /* TODO: Endianship*/
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
-/*
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
-*/
- memcpy(&(pBuf->Data.abyRA[0]), vt->bssid, ETH_ALEN);
-
-/* if (pDevice->eOPMode == OP_MODE_AP) {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN);
- }
- else {
- MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN);
- }
-*/
- memcpy(&(pBuf->Data.abyTA[0]), ieee80211_get_SA(machdr), ETH_ALEN);
- } else {
- printk(KERN_ERR "ERROR unknown standard\n");
- }
-}
-
-static void s_vFillCTSHead (
- u32 uDMAIdx,
- u8 standard,
- void *pvCTS,
- u32 cbFrameLength,
- u8 bNeedAck,
- u8 bDisCRC,
- s16 tx_rate_hw_value,
- u8 autofallback,
- u8 topCCKBasicRate, u8 topOFDMBasicRate,
- u8 preamble,
- u8 setCCKModulation,
- u32 sifs,
- struct sk_buff *skb,
- u8 *currentMACAddr
- )
-{
- u32 uCTSFrameLen = 14;
- s16 wLen = 0x0000;
- s16 wCTSDuration = 0;
-
- if (pvCTS == NULL) {
- return;
- }
-
- if (bDisCRC) {
- // When CRCDIS bit is on, H/W forgot to generate FCS for CTS frame,
- // in this case we need to decrease its length by 4.
- uCTSFrameLen -= 4;
- }
-
- if (VT6656_80211G == standard) {//802.11g packet
- if (autofallback != 0 && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) {
- // Auto Fall back
- PSCTS_FB pBuf = (PSCTS_FB)pvCTS;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(uCTSFrameLen, topCCKBasicRate, VT6656_80211B, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = wLen; /* TODO: Endianship*/
- pBuf->wDuration_ba = (s16)s_uGetRTSCTSDuration(CTSDUR_BA, cbFrameLength, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wDuration_ba += wCTSDuration;
- pBuf->wDuration_ba = pBuf->wDuration_ba; /* TODO: Endianship*/
- //Get CTSDuration_ba_f0
- pBuf->wCTSDuration_ba_f0 = (s16)s_uGetRTSCTSDuration(CTSDUR_BA_F0, cbFrameLength, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wCTSDuration_ba_f0 += wCTSDuration;
- pBuf->wCTSDuration_ba_f0 = pBuf->wCTSDuration_ba_f0; /* TODO: Endianship*/
- //Get CTSDuration_ba_f1
- pBuf->wCTSDuration_ba_f1 = (s16)s_uGetRTSCTSDuration(CTSDUR_BA_F1, cbFrameLength, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wCTSDuration_ba_f1 += wCTSDuration;
- pBuf->wCTSDuration_ba_f1 = pBuf->wCTSDuration_ba_f1; /* TODO: Endianship*/
- //Get CTS Frame body
- pBuf->Data.wDurationID = pBuf->wDuration_ba;
- pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
- pBuf->Data.wReserved = 0x0000;
- /* TODO: Check what this is and do it well */
- memcpy(&(pBuf->Data.abyRA[0]), currentMACAddr, ETH_ALEN);
- } else { //if (autofallback != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
- PSCTS pBuf = (PSCTS)pvCTS;
- //Get SignalField,ServiceField,Length
- BBvCaculateParameter(uCTSFrameLen, topCCKBasicRate, VT6656_80211B, preamble, setCCKModulation,
- (s16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = wLen; /* TODO: Endianship*/
- //Get CTSDuration_ba
- pBuf->wDuration_ba = (s16)s_uGetRTSCTSDuration(CTSDUR_BA, cbFrameLength, standard, tx_rate_hw_value, bNeedAck, autofallback, topCCKBasicRate, topOFDMBasicRate, preamble, sifs); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data /* TODO: Endianship*/
- pBuf->wDuration_ba += wCTSDuration;
- pBuf->wDuration_ba = pBuf->wDuration_ba; /* TODO: Endianship*/
-
- //Get CTS Frame body
- pBuf->Data.wDurationID = pBuf->wDuration_ba;
- pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
- pBuf->Data.wReserved = 0x0000;
- memcpy(&(pBuf->Data.abyRA[0]), currentMACAddr, ETH_ALEN);
- }
- }
-}
-
-static u32 s_uGetRTSCTSDuration (
- u8 byDurType,
- u32 cbFrameLength,
- u8 standard,
- s16 wRate,
- u8 bNeedAck,
- u16 autofallback,
- u8 topCCKBasicRate,
- u8 topOFDMBasicRate,
- u8 preamble,
- u32 sifs
- )
-{
- u32 uCTSTime = 0, uDurTime = 0;
-
-
- switch (byDurType) {
-
- case RTSDUR_BB: //RTSDuration_bb
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- break;
-
- case RTSDUR_BA: //RTSDuration_ba
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- break;
-
- case RTSDUR_AA: //RTSDuration_aa
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- break;
-
- case CTSDUR_BA: //CTSDuration_ba
- uDurTime = sifs + s_uGetTxRsvTime(standard, cbFrameLength, wRate, bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- break;
-
- case RTSDUR_BA_F0: //RTSDuration_ba_f0
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- /* TODO
- if ((1 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else if ((2 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } */
- break;
-
- case RTSDUR_AA_F0: //RTSDuration_aa_f0
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- /* TODO
- if ((1 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else if ((2 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } */
- break;
-
- case RTSDUR_BA_F1: //RTSDuration_ba_f1
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
- /* TODO
- if ((1 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else if ((2 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } */
- break;
-
- case RTSDUR_AA_F1: //RTSDuration_aa_f1
- uCTSTime = BBuGetFrameTime(preamble, standard, 14, topCCKBasicRate);
-/* TODO
- if ((1 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else if ((2 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } */
- break;
-
- case CTSDUR_BA_F0: //CTSDuration_ba_f0
- /* TODO
- if ((1 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else if ((2 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } */
- break;
-
- case CTSDUR_BA_F1: //CTSDuration_ba_f1
-/* TODO
- if ((1 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } else if ((2 == autofallback) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = sifs + s_uGetTxRsvTime(standard, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck, preamble, topCCKBasicRate, topOFDMBasicRate, sifs);
- } */
- break;
-
- default:
- break;
- }
-
- return uDurTime;
-
-}
-
-
-
-
-
-/*
- * Description: Caculate Length, Service, and Signal fields of Phy for Tx
- *
- * Parameters:
- * In:
- * pDevice - Device Structure
- * cbFrameLength - Tx Frame Length
- * wRate - Tx Rate
- * Out:
- * pwPhyLen - pointer to Phy Length field
- * pbyPhySrv - pointer to Phy Service field
- * pbyPhySgn - pointer to Phy Signal field
- *
- * Return Value: none
- *
- */
-
-static void BBvCaculateParameter (
- u32 cbFrameLength,
- s16 wRate,
- u16 standard,
- u8 preamble,
- u8 setCCKModulation,
- s16 *pwPhyLen,
- u8 *pbyPhySrv,
- u8 *pbyPhySgn
- )
-{
- u32 cbBitCount;
- u32 cbUsCount = 0;
- u32 cbTmp;
- u8 bExtBit;
- u8 byPreambleType = preamble;
- u8 bCCK = setCCKModulation;
-
- cbBitCount = cbFrameLength * 8;
- bExtBit = FALSE;
-
- switch (wRate) {
- case RATE_1M :
- cbUsCount = cbBitCount;
- *pbyPhySgn = 0x00;
- break;
-
- case RATE_2M :
- cbUsCount = cbBitCount / 2;
- if (byPreambleType == 1)
- *pbyPhySgn = 0x09;
- else // long preamble
- *pbyPhySgn = 0x01;
- break;
-
- case RATE_5M :
- if (bCCK == 0)
- cbBitCount ++;
- cbUsCount = (cbBitCount * 10) / 55;
- cbTmp = (cbUsCount * 55) / 10;
- if (cbTmp != cbBitCount)
- cbUsCount ++;
- if (byPreambleType == 1)
- *pbyPhySgn = 0x0a;
- else // long preamble
- *pbyPhySgn = 0x02;
- break;
-
- case RATE_11M :
-
- if (bCCK == 0)
- cbBitCount ++;
- cbUsCount = cbBitCount / 11;
- cbTmp = cbUsCount * 11;
- if (cbTmp != cbBitCount) {
- cbUsCount ++;
- if ((cbBitCount - cbTmp) <= 3)
- bExtBit = TRUE;
- }
- if (byPreambleType == 1)
- *pbyPhySgn = 0x0b;
- else // long preamble
- *pbyPhySgn = 0x03;
- break;
-
- case RATE_6M :
- if(VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x9B; //1001 1011
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8B; //1000 1011
- }
- break;
-
- case RATE_9M :
- if(VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x9F; //1001 1111
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8F; //1000 1111
- }
- break;
-
- case RATE_12M :
- if(VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x9A; //1001 1010
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8A; //1000 1010
- }
- break;
-
- case RATE_18M :
- if(VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x9E; //1001 1110
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8E; //1000 1110
- }
- break;
-
- case RATE_24M :
- if(VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x99; //1001 1001
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x89; //1000 1001
- }
- break;
-
- case RATE_36M :
- if(VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x9D; //1001 1101
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8D; //1000 1101
- }
- break;
-
- case RATE_48M :
- if(VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x98; //1001 1000
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x88; //1000 1000
- }
- break;
-
- case RATE_54M :
- if (VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x9C; //1001 1100
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8C; //1000 1100
- }
- break;
-
- default :
- if (VT6656_80211A == standard) {//11a, 5GHZ
- *pbyPhySgn = 0x9C; //1001 1100
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8C; //1000 1100
- }
- break;
- }
-
- if (VT6656_80211B == standard) {
- *pbyPhySrv = 0x00;
- if (bExtBit)
- *pbyPhySrv = *pbyPhySrv | 0x80;
- *pwPhyLen = (s16) cbUsCount;
- }
- else {
- *pbyPhySrv = 0x00;
- *pwPhyLen = (s16)cbFrameLength;
- }
-}
-
diff --git a/vt6656_descriptor.h b/vt6656_descriptor.h
deleted file mode 100644
index fdcc2db..0000000
--- a/vt6656_descriptor.h
+++ /dev/null
@@ -1,313 +0,0 @@
-#ifndef _VT6656_DESCRIPTOR_DECL_H
-#define _VT6656_DESCRIPTOR_DECL_H
-
-/*TODO: check endianship */
-#define TYPE_CTL_RTS 0xb400 /*00b4 */
-#define TYPE_CTL_CTS 0xc400 /* 00c4 */
-
-
-#define FB_RATE0 0
-#define FB_RATE1 1
-
-#define TYPE_TXDMA0 0
-#define TYPE_AC0DMA 1
-#define TYPE_ATIMDMA 2
-#define TYPE_SYNCDMA 3
-#define TYPE_MAXTD 2
-
-#define TYPE_BEACONDMA 4
-
-#define TYPE_RXDMA0 0
-#define TYPE_RXDMA1 1
-#define TYPE_MAXRD 2
-
-
-#define RTSDUR_BB 0
-#define RTSDUR_BA 1
-#define RTSDUR_AA 2
-#define CTSDUR_BA 3
-#define RTSDUR_BA_F0 4
-#define RTSDUR_AA_F0 5
-#define RTSDUR_BA_F1 6
-#define RTSDUR_AA_F1 7
-#define CTSDUR_BA_F0 8
-#define CTSDUR_BA_F1 9
-#define DATADUR_B 10
-#define DATADUR_A 11
-#define DATADUR_A_F0 12
-#define DATADUR_A_F1 13
-
-#define TRUE 1
-#define FALSE 0
-
-#define VT6656_80211A 0
-#define VT6656_80211B 1
-#define VT6656_80211G 2
-
-#define PREAMBLE_LONG 0
-#define PREAMBLE_SHORT 1
-
-#define FCS_LEN 4
-
-
-
-
-#define ASSERT(x) { \
- if (!(x)) { \
- printk(KERN_ERR "assertion %s failed: file %s line %d\n", #x,\
- __FUNCTION__, __LINE__);\
- *(int*) 0=0;\
- }\
-}
-
-static const u16 awcFrameTime[MAX_RATE] =
-{10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216};
-
-
-
-//
-// Registers in the BASEBAND
-//
-#define BB_MAX_CONTEXT_SIZE 256
-
-#define C_SIFS_A 16 // micro sec.
-#define C_SIFS_BG 10
-
-#define C_EIFS 80 // micro sec.
-
-
-#define C_SLOT_SHORT 9 // micro sec.
-#define C_SLOT_LONG 20
-
-#define C_CWMIN_A 15 // slot time
-#define C_CWMIN_B 31
-
-#define C_CWMAX 1023 // slot time
-
-//
-// RsvTime buffer header
-//
-typedef struct tagSRrvTime_gRTS {
- u16 wRTSTxRrvTime_ba;
- u16 wRTSTxRrvTime_aa;
- u16 wRTSTxRrvTime_bb;
- u16 wReserved;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-}__attribute__ ((__packed__))
-SRrvTime_gRTS, * PSRrvTime_gRTS;
-typedef const SRrvTime_gRTS * PCSRrvTime_gRTS;
-
-typedef struct tagSRrvTime_gCTS {
- u16 wCTSTxRrvTime_ba;
- u16 wReserved;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-}__attribute__ ((__packed__))
-SRrvTime_gCTS, * PSRrvTime_gCTS;
-typedef const SRrvTime_gCTS * PCSRrvTime_gCTS;
-
-typedef struct tagSRrvTime_ab {
- u16 wRTSTxRrvTime;
- u16 wTxRrvTime;
-}__attribute__ ((__packed__))
-SRrvTime_ab, * PSRrvTime_ab;
-typedef const SRrvTime_ab * PCSRrvTime_ab;
-
-typedef struct tagSRrvTime_atim {
- u16 wCTSTxRrvTime_ba;
- u16 wTxRrvTime_a;
-}__attribute__ ((__packed__))
-SRrvTime_atim, * PSRrvTime_atim;
-typedef const SRrvTime_atim * PCSRrvTime_atim;
-
-//
-// RTS buffer header
-//
-typedef struct tagSRTSData {
- u16 wFrameControl;
- u16 wDurationID;
- u8 abyRA[ETH_ALEN];
- u8 abyTA[ETH_ALEN];
-}__attribute__ ((__packed__))
-SRTSData, * PSRTSData;
-typedef const SRTSData * PCSRTSData;
-
-typedef struct tagSRTS_g {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_ba;
- u16 wDuration_aa;
- u16 wDuration_bb;
- u16 wReserved;
- SRTSData Data;
-}__attribute__ ((__packed__))
-SRTS_g, * PSRTS_g;
-typedef const SRTS_g * PCSRTS_g;
-
-
-typedef struct tagSRTS_g_FB {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_ba;
- u16 wDuration_aa;
- u16 wDuration_bb;
- u16 wReserved;
- u16 wRTSDuration_ba_f0;
- u16 wRTSDuration_aa_f0;
- u16 wRTSDuration_ba_f1;
- u16 wRTSDuration_aa_f1;
- SRTSData Data;
-}__attribute__ ((__packed__))
-SRTS_g_FB, * PSRTS_g_FB;
-typedef const SRTS_g_FB * PCSRTS_g_FB;
-
-
-typedef struct tagSRTS_ab {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wReserved;
- SRTSData Data;
-}__attribute__ ((__packed__))
-SRTS_ab, * PSRTS_ab;
-typedef const SRTS_ab * PCSRTS_ab;
-
-
-typedef struct tagSRTS_a_FB {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wReserved;
- u16 wRTSDuration_f0;
- u16 wRTSDuration_f1;
- SRTSData Data;
-}__attribute__ ((__packed__))
-SRTS_a_FB, * PSRTS_a_FB;
-typedef const SRTS_a_FB * PCSRTS_a_FB;
-
-
-//
-// CTS buffer header
-//
-typedef struct tagSCTSData {
- u16 wFrameControl;
- u16 wDurationID;
- u8 abyRA[ETH_ALEN];
- u16 wReserved;
-}__attribute__ ((__packed__))
-SCTSData, * PSCTSData;
-
-typedef struct tagSCTS {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u16 wDuration_ba;
- u16 wReserved;
- SCTSData Data;
-}__attribute__ ((__packed__))
-SCTS, * PSCTS;
-typedef const SCTS * PCSCTS;
-
-typedef struct tagSCTS_FB {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u16 wDuration_ba;
- u16 wReserved;
- u16 wCTSDuration_ba_f0;
- u16 wCTSDuration_ba_f1;
- SCTSData Data;
-}__attribute__ ((__packed__))
-SCTS_FB, * PSCTS_FB;
-typedef const SCTS_FB * PCSCTS_FB;
-
-
-
-
-
-
-
-
-//
-// Tx data header
-//
-typedef struct tagSTxDataHead_g {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-}__attribute__ ((__packed__))
-STxDataHead_g, * PSTxDataHead_g;
-typedef const STxDataHead_g * PCSTxDataHead_g;
-
-typedef struct tagSTxDataHead_g_FB {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-}__attribute__ ((__packed__))
-STxDataHead_g_FB, * PSTxDataHead_g_FB;
-typedef const STxDataHead_g_FB * PCSTxDataHead_g_FB;
-
-
-typedef struct tagSTxDataHead_ab {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wTimeStampOff;
-}__attribute__ ((__packed__))
-STxDataHead_ab, * PSTxDataHead_ab;
-typedef const STxDataHead_ab * PCSTxDataHead_ab;
-
-
-typedef struct tagSTxDataHead_a_FB {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wTimeStampOff;
- u16 wDuration_f0;
- u16 wDuration_f1;
-}__attribute__ ((__packed__))
-STxDataHead_a_FB, * PSTxDataHead_a_FB;
-typedef const STxDataHead_a_FB * PCSTxDataHead_a_FB;
-
-//
-// MICHDR data header
-//
-typedef struct tagSMICHDRHead {
- u32 adwHDR0[4];
- u32 adwHDR1[4];
- u32 adwHDR2[4];
-}__attribute__ ((__packed__))
-SMICHDRHead, * PSMICHDRHead;
-typedef const SMICHDRHead * PCSMICHDRHead;
-
-
-#endif