[kismac] [binaervarianz] r227 - in branches/usb-drivers/Sources: Core Driver/USBJack
- From: svn@xxxxxxxxxxxxxxxx
- To: kismac@xxxxxxxxxxxxx
- Date: Sun, 18 Feb 2007 07:20:48 +0100
Author: gkruse
Date: 2007-02-18 07:20:44 +0100 (Sun, 18 Feb 2007)
New Revision: 227
Modified:
branches/usb-drivers/Sources/Core/80211b.h
branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm
branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm
branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm
Log:
slighly better introspection maybe
Modified: branches/usb-drivers/Sources/Core/80211b.h
===================================================================
--- branches/usb-drivers/Sources/Core/80211b.h 2007-02-17 17:45:50 UTC (rev
226)
+++ branches/usb-drivers/Sources/Core/80211b.h 2007-02-18 06:20:44 UTC (rev
227)
@@ -81,6 +81,7 @@
UInt8 address3[6];
UInt16 sequenceControl;
UInt8 address4[6];
+ UInt16 dataLen;
} __attribute__((packed)) WLIEEEFrame;
Modified: branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm 2007-02-17
17:45:50 UTC (rev 226)
+++ branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm 2007-02-18
06:20:44 UTC (rev 227)
@@ -190,10 +190,10 @@
}
int IntersilJack::WriteTxDescriptor(WLFrame * theFrame){
+ theFrame->txControl=NSSwapHostShortToLittle(0x08 | _TX_RETRYSTRAT_SET(3)|
_TX_CFPOLL_SET(1) | _TX_TXEX_SET(0) | _TX_TXOK_SET(0) | _TX_MACPORT_SET(0));
theFrame->rate = 0x6e; //11 MBit/s
theFrame->tx_rate = 0x6e; //11 MBit/s
- //where does this come from? sizeof(WLFrame)?
- return 0x3C;
+ return sizeof(WLPrismHeader);
}
IntersilJack::IntersilJack() {
Modified: branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm 2007-02-17
17:45:50 UTC (rev 226)
+++ branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm 2007-02-18
06:20:44 UTC (rev 227)
@@ -1056,9 +1056,9 @@
pTxD->MoreFrag = false;
pTxD->ACK = false;
pTxD->Timestamp = false;
- //pTxD->newseq = new_seq;
+ pTxD->newseq = true; //?
//pTxD->IFS = Ifs;
- pTxD->DataByteCnt = theFrame->length;
+ pTxD->DataByteCnt = theFrame->dataLen;
pTxD->Cipher = false;
pTxD->KeyID = 0;
pTxD->CWmin = 2^5-1;// = 31
@@ -1067,87 +1067,6 @@
//maybe?
pTxD->Ofdm = 1;
-
-/*
- Fragment, //false
- IN UCHAR RetryLimit, 0
- IN BOOLEAN Ack, //false
- IN BOOLEAN InsTimestamp, //false
- IN BOOLEAN new_seq, //true
- IN UCHAR Ifs, //IFS_BACKOFF
- IN UINT Length, //length of
packet
- IN BOOLEAN Cipher, //false
- IN UCHAR KeyID, //0
- IN UCHAR CWMin, // CW_MIN_IN_BITS
- IN UCHAR CWMax, //CW_MAX_IN_BITS
- IN UINT PLCPLength, //len + 4
- IN UINT Rate, //tx rate
- IN UCHAR Service, //4
- IN USHORT TxPreamble) //preamble
- UINT Residual;
-
- pTxD->RetryLimit = RetryLimit;
- pTxD->MoreFrag = Fragment;
- pTxD->ACK = Ack;
- pTxD->Timestamp = InsTimestamp;
- pTxD->newseq = new_seq;
- pTxD->IFS = Ifs;
- pTxD->DataByteCnt = Length;
- pTxD->Cipher = Cipher;
- pTxD->KeyID = KeyID;
- pTxD->CWmin = CWMin; // 2^5-1 = 31
- pTxD->CWmax = CWMax; // 2^10 -1 = 1023
- pTxD->Aifs = 2; // TC0: SIFS + 2*Slot +
Random(CWmin,CWmax)*Slot
-
- if (Rate < RATE_FIRST_OFDM_RATE)
- pTxD->Ofdm = 0;
- else
- pTxD->Ofdm = 1;
-
- // fill up PLCP SIGNAL field
- pTxD->PlcpSignal = PlcpSignal[Rate];
- if (((Rate == RATE_2) || (Rate == RATE_5_5) || (Rate == RATE_11)) &&
(TxPreamble == Rt802_11PreambleShort)) // no short preamble for RATE_1
- {
- pTxD->PlcpSignal |= 0x0008;
- }
-
- // fill up PLCP SERVICE field, not used for OFDM rates
- pTxD->PlcpService = Service;
-
- // file up PLCP LENGTH_LOW and LENGTH_HIGH fields
- if (Rate < RATE_FIRST_OFDM_RATE) // 11b - RATE_1, RATE_2, RATE_5_5,
RATE_11
- {
- if ((Rate == RATE_1) || ( Rate == RATE_2))
- {
- PLCPLength = PLCPLength * 8 / (Rate + 1);
- }
- else
- {
- Residual = ((PLCPLength * 16) % (11 * (1 + Rate -
RATE_5_5)));
- PLCPLength = PLCPLength * 16 / (11 * (1 + Rate -
RATE_5_5));
- if (Residual != 0)
- {
- PLCPLength++;
- }
- if (Rate == RATE_11)
- {
- if ((Residual <= (3 * (1 + Rate - RATE_5_5))) && (Residual !=
0))
- {
- pTxD->PlcpService |= 0x80; // 11b's PLCP Length extension
bit
- }
- }
- }
-
- pTxD->PlcpLengthHigh = PLCPLength / 256;
- pTxD->PlcpLengthLow = PLCPLength % 256;
- }
- else // OFDM - RATE_6, RATE_9, RATE_12, RATE_18, RATE_24, RATE_36,
RATE_48, RATE_54
- {
- pTxD->PlcpLengthHigh = PLCPLength / 64; // high 6-bit of total
byte count
- pTxD->PlcpLengthLow = PLCPLength % 64; // low 6-bit of total
byte count
- }
-}
-*/
//now copy the txd_struc over the old wlframe
memcpy(theFrame, tempFrame, sizeof(TXD_STRUC));
Modified: branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm 2007-02-17
17:45:50 UTC (rev 226)
+++ branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm 2007-02-18
06:20:44 UTC (rev 227)
@@ -178,36 +178,42 @@
UInt8 aData[2364];
IOByteCount pktsize;
int descriptorLength;
+ WLIEEEFrame * wifiFrame;
- //copy the wl frame to the tx buff
+ //we have an inFrame and an outFrame
+ //this function is a transformation between the two
+ //copy the wlframe to the tx buff
+ //we will redo part off_t this //todo fixme!!
memcpy(aData, data, sizeof(WLFrame));
- //modify the frame descriptor in the txbuff
+
+ //set pointers to sectons of frame
frameDescriptor = (WLFrame*)aData;
- switch(frameDescriptor->frameControl & 0x0c) {
+ pktsize = frameDescriptor->dataLen + sizeof(WLFrame) -
sizeof(WLPrismHeader);
+
+ //convert prism header into device specific header
+ //returns the length of the device specific header
+ //note frame descriptor = txbuff
+ descriptorLength = WriteTxDescriptor(frameDescriptor);
+
+ //copy the 802.11 frame to the right place
+ memcpy(aData + descriptorLength, data + sizeof(WLPrismHeader), pktsize);
+ wifiFrame = (WLIEEEFrame*)(aData + descriptorLength);
+
+ switch(wifiFrame->frameControl & 0x0c) {
case 0x08:
case 0x00:
- pktsize = frameDescriptor->dataLen;
- if ((pktsize + sizeof(WLFrame)) > 2364) return
kIOReturnBadArgument;
-
frameDescriptor->dataLen=NSSwapHostShortToLittle(frameDescriptor->dataLen);
+ pktsize = wifiFrame->dataLen;
+ if ((pktsize + descriptorLength) > 2364) return
kIOReturnBadArgument;
+ wifiFrame->dataLen=NSSwapHostShortToLittle(wifiFrame->dataLen);
break;
case 0x04:
pktsize = 0;
- frameDescriptor->dataLen = 0;
+ wifiFrame->dataLen = 0;
break;
default:
return kIOReturnBadArgument;
}
-
- frameDescriptor->txControl=NSSwapHostShortToLittle(0x08 |
_TX_RETRYSTRAT_SET(3)| _TX_CFPOLL_SET(1) | _TX_TXEX_SET(0) | _TX_TXOK_SET(0) |
_TX_MACPORT_SET(0));
-
- //write the device dependant descriptor and return the length to copy
- //note frame descriptor = txbuff
- descriptorLength = WriteTxDescriptor(frameDescriptor);
- //copy the packet data to the end of the descriptor
- //this is 0x3c on prismII
- //todo fixme!! we need to make sure the buffer is long enough!
- memcpy(aData + descriptorLength, data + sizeof(WLFrame), pktsize);
-
+
//send the frame
if (_sendFrame(aData, pktsize + descriptorLength) != kIOReturnSuccess)
return NO;
Other related posts:
- » [kismac] [binaervarianz] r227 - in branches/usb-drivers/Sources: Core Driver/USBJack