Commit aed387c7 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6656: baseband.c BBvCalculateParameter create structure for...

staging: vt6656: baseband.c BBvCalculateParameter create structure for pwPhyLen, pbyPhySrv and pbyPhySgn

Create single packed structure vnt_phy_field for rxtx.h structures.

In card.c CARDvSetRSPINF a vnt_phy_field replaces abyServ,
abySignal, awLen variables.

In rxtx.c point BBvCalculateParameter to relevant field.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4ac306e0
...@@ -723,16 +723,16 @@ BBuGetFrameTime( ...@@ -723,16 +723,16 @@ BBuGetFrameTime(
* cbFrameLength - Tx Frame Length * cbFrameLength - Tx Frame Length
* wRate - Tx Rate * wRate - Tx Rate
* Out: * Out:
* pwPhyLen - pointer to Phy Length field * struct vnt_phy_field *phy
* pbyPhySrv - pointer to Phy Service field * - pointer to Phy Length field
* pbyPhySgn - pointer to Phy Signal field * - pointer to Phy Service field
* - pointer to Phy Signal field
* *
* Return Value: none * Return Value: none
* *
*/ */
void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv, u16 wRate, u8 byPacketType, struct vnt_phy_field *phy)
u8 *pbyPhySgn)
{ {
u32 cbBitCount; u32 cbBitCount;
u32 cbUsCount = 0; u32 cbUsCount = 0;
...@@ -747,15 +747,15 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, ...@@ -747,15 +747,15 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
switch (wRate) { switch (wRate) {
case RATE_1M : case RATE_1M :
cbUsCount = cbBitCount; cbUsCount = cbBitCount;
*pbyPhySgn = 0x00; phy->signal = 0x00;
break; break;
case RATE_2M : case RATE_2M :
cbUsCount = cbBitCount / 2; cbUsCount = cbBitCount / 2;
if (byPreambleType == 1) if (byPreambleType == 1)
*pbyPhySgn = 0x09; phy->signal = 0x09;
else // long preamble else // long preamble
*pbyPhySgn = 0x01; phy->signal = 0x01;
break; break;
case RATE_5M : case RATE_5M :
...@@ -766,9 +766,9 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, ...@@ -766,9 +766,9 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
if (cbTmp != cbBitCount) if (cbTmp != cbBitCount)
cbUsCount ++; cbUsCount ++;
if (byPreambleType == 1) if (byPreambleType == 1)
*pbyPhySgn = 0x0a; phy->signal = 0x0a;
else // long preamble else // long preamble
*pbyPhySgn = 0x02; phy->signal = 0x02;
break; break;
case RATE_11M : case RATE_11M :
...@@ -783,101 +783,101 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, ...@@ -783,101 +783,101 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
bExtBit = true; bExtBit = true;
} }
if (byPreambleType == 1) if (byPreambleType == 1)
*pbyPhySgn = 0x0b; phy->signal = 0x0b;
else // long preamble else // long preamble
*pbyPhySgn = 0x03; phy->signal = 0x03;
break; break;
case RATE_6M : case RATE_6M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9B; //1001 1011 phy->signal = 0x9b;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x8B; //1000 1011 phy->signal = 0x8b;
} }
break; break;
case RATE_9M : case RATE_9M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9F; //1001 1111 phy->signal = 0x9f;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x8F; //1000 1111 phy->signal = 0x8f;
} }
break; break;
case RATE_12M : case RATE_12M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9A; //1001 1010 phy->signal = 0x9a;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x8A; //1000 1010 phy->signal = 0x8a;
} }
break; break;
case RATE_18M : case RATE_18M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9E; //1001 1110 phy->signal = 0x9e;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x8E; //1000 1110 phy->signal = 0x8e;
} }
break; break;
case RATE_24M : case RATE_24M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x99; //1001 1001 phy->signal = 0x99;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x89; //1000 1001 phy->signal = 0x89;
} }
break; break;
case RATE_36M : case RATE_36M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9D; //1001 1101 phy->signal = 0x9d;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x8D; //1000 1101 phy->signal = 0x8d;
} }
break; break;
case RATE_48M : case RATE_48M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x98; //1001 1000 phy->signal = 0x98;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x88; //1000 1000 phy->signal = 0x88;
} }
break; break;
case RATE_54M : case RATE_54M :
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9C; //1001 1100 phy->signal = 0x9c;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x8C; //1000 1100 phy->signal = 0x8c;
} }
break; break;
default : default :
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9C; //1001 1100 phy->signal = 0x9c;
} }
else {//11g, 2.4GHZ else {//11g, 2.4GHZ
*pbyPhySgn = 0x8C; //1000 1100 phy->signal = 0x8c;
} }
break; break;
} }
if (byPacketType == PK_TYPE_11B) { if (byPacketType == PK_TYPE_11B) {
*pbyPhySrv = 0x00; phy->service = 0x00;
if (bExtBit) if (bExtBit)
*pbyPhySrv = *pbyPhySrv | 0x80; phy->service |= 0x80;
*pwPhyLen = cpu_to_le16((u16)cbUsCount); phy->len = cpu_to_le16((u16)cbUsCount);
} else { } else {
*pbyPhySrv = 0x00; phy->service = 0x00;
*pwPhyLen = cpu_to_le16((u16)cbFrameLength); phy->len = cpu_to_le16((u16)cbFrameLength);
} }
} }
......
...@@ -81,6 +81,13 @@ ...@@ -81,6 +81,13 @@
#define TOP_RATE_2M 0x00200000 #define TOP_RATE_2M 0x00200000
#define TOP_RATE_1M 0x00100000 #define TOP_RATE_1M 0x00100000
/* Length, Service, and Signal fields of Phy for Tx */
struct vnt_phy_field {
u8 signal;
u8 service;
u16 len;
} __packed;
unsigned int unsigned int
BBuGetFrameTime( BBuGetFrameTime(
u8 byPreambleType, u8 byPreambleType,
...@@ -90,8 +97,7 @@ BBuGetFrameTime( ...@@ -90,8 +97,7 @@ BBuGetFrameTime(
); );
void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength, void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength,
u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv, u16 wRate, u8 byPacketType, struct vnt_phy_field *);
u8 *pbyPhySgn);
/* timer for antenna diversity */ /* timer for antenna diversity */
......
...@@ -319,53 +319,27 @@ CARDvCalculateOFDMRParameter ( ...@@ -319,53 +319,27 @@ CARDvCalculateOFDMRParameter (
*/ */
void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType) void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
{ {
u8 abyServ[4] = {0, 0, 0, 0}; /* For CCK */ struct vnt_phy_field phy[4];
u8 abySignal[4] = {0, 0, 0, 0};
u16 awLen[4] = {0, 0, 0, 0};
u8 abyTxRate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */ u8 abyTxRate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */
u8 abyRsvTime[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; u8 abyRsvTime[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
u8 abyData[34]; u8 abyData[34];
int i; int i;
//RSPINF_b_1 //RSPINF_b_1
BBvCalculateParameter(pDevice, BBvCalculateParameter(pDevice, 14,
14, swGetCCKControlRate(pDevice, RATE_1M), PK_TYPE_11B, &phy[0]);
swGetCCKControlRate(pDevice, RATE_1M),
PK_TYPE_11B,
&awLen[0],
&abyServ[0],
&abySignal[0]
);
///RSPINF_b_2 ///RSPINF_b_2
BBvCalculateParameter(pDevice, BBvCalculateParameter(pDevice, 14,
14, swGetCCKControlRate(pDevice, RATE_2M), PK_TYPE_11B, &phy[1]);
swGetCCKControlRate(pDevice, RATE_2M),
PK_TYPE_11B,
&awLen[1],
&abyServ[1],
&abySignal[1]
);
//RSPINF_b_5 //RSPINF_b_5
BBvCalculateParameter(pDevice, BBvCalculateParameter(pDevice, 14,
14, swGetCCKControlRate(pDevice, RATE_5M), PK_TYPE_11B, &phy[2]);
swGetCCKControlRate(pDevice, RATE_5M),
PK_TYPE_11B,
&awLen[2],
&abyServ[2],
&abySignal[2]
);
//RSPINF_b_11 //RSPINF_b_11
BBvCalculateParameter(pDevice, BBvCalculateParameter(pDevice, 14,
14, swGetCCKControlRate(pDevice, RATE_11M), PK_TYPE_11B, &phy[3]);
swGetCCKControlRate(pDevice, RATE_11M),
PK_TYPE_11B,
&awLen[3],
&abyServ[3],
&abySignal[3]
);
//RSPINF_a_6 //RSPINF_a_6
CARDvCalculateOFDMRParameter (RATE_6M, CARDvCalculateOFDMRParameter (RATE_6M,
...@@ -421,21 +395,21 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType) ...@@ -421,21 +395,21 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
&abyTxRate[8], &abyTxRate[8],
&abyRsvTime[8]); &abyRsvTime[8]);
put_unaligned(awLen[0], (u16 *)&abyData[0]); put_unaligned(phy[0].len, (u16 *)&abyData[0]);
abyData[2] = abySignal[0]; abyData[2] = phy[0].signal;
abyData[3] = abyServ[0]; abyData[3] = phy[0].service;
put_unaligned(awLen[1], (u16 *)&abyData[4]); put_unaligned(phy[1].len, (u16 *)&abyData[4]);
abyData[6] = abySignal[1]; abyData[6] = phy[1].signal;
abyData[7] = abyServ[1]; abyData[7] = phy[1].service;
put_unaligned(awLen[2], (u16 *)&abyData[8]); put_unaligned(phy[2].len, (u16 *)&abyData[8]);
abyData[10] = abySignal[2]; abyData[10] = phy[2].signal;
abyData[11] = abyServ[2]; abyData[11] = phy[2].service;
put_unaligned(awLen[3], (u16 *)&abyData[12]); put_unaligned(phy[3].len, (u16 *)&abyData[12]);
abyData[14] = abySignal[3]; abyData[14] = phy[3].signal;
abyData[15] = abyServ[3]; abyData[15] = phy[3].service;
for (i = 0; i < 9; i++) { for (i = 0; i < 9; i++) {
abyData[16+i*2] = abyTxRate[i]; abyData[16+i*2] = abyTxRate[i];
......
This diff is collapsed.
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "device.h" #include "device.h"
#include "wcmd.h" #include "wcmd.h"
#include "baseband.h"
/* RsvTime buffer header */ /* RsvTime buffer header */
struct vnt_rrv_time_rts { struct vnt_rrv_time_rts {
...@@ -56,12 +57,8 @@ struct vnt_rrv_time_ab { ...@@ -56,12 +57,8 @@ struct vnt_rrv_time_ab {
/* TX data header */ /* TX data header */
struct vnt_tx_datahead_g { struct vnt_tx_datahead_g {
u8 bySignalField_b; struct vnt_phy_field b;
u8 byServiceField_b; struct vnt_phy_field a;
u16 wTransmitLength_b;
u8 bySignalField_a;
u8 byServiceField_a;
u16 wTransmitLength_a;
u16 wDuration_b; u16 wDuration_b;
u16 wDuration_a; u16 wDuration_a;
u16 wTimeStampOff_b; u16 wTimeStampOff_b;
...@@ -69,12 +66,8 @@ struct vnt_tx_datahead_g { ...@@ -69,12 +66,8 @@ struct vnt_tx_datahead_g {
} __packed; } __packed;
struct vnt_tx_datahead_g_fb { struct vnt_tx_datahead_g_fb {
u8 bySignalField_b; struct vnt_phy_field b;
u8 byServiceField_b; struct vnt_phy_field a;
u16 wTransmitLength_b;
u8 bySignalField_a;
u8 byServiceField_a;
u16 wTransmitLength_a;
u16 wDuration_b; u16 wDuration_b;
u16 wDuration_a; u16 wDuration_a;
u16 wDuration_a_f0; u16 wDuration_a_f0;
...@@ -84,17 +77,13 @@ struct vnt_tx_datahead_g_fb { ...@@ -84,17 +77,13 @@ struct vnt_tx_datahead_g_fb {
} __packed; } __packed;
struct vnt_tx_datahead_ab { struct vnt_tx_datahead_ab {
u8 bySignalField; struct vnt_phy_field ab;
u8 byServiceField;
u16 wTransmitLength;
u16 wDuration; u16 wDuration;
u16 wTimeStampOff; u16 wTimeStampOff;
} __packed; } __packed;
struct vnt_tx_datahead_a_fb { struct vnt_tx_datahead_a_fb {
u8 bySignalField; struct vnt_phy_field a;
u8 byServiceField;
u16 wTransmitLength;
u16 wDuration; u16 wDuration;
u16 wTimeStampOff; u16 wTimeStampOff;
u16 wDuration_f0; u16 wDuration_f0;
...@@ -103,12 +92,8 @@ struct vnt_tx_datahead_a_fb { ...@@ -103,12 +92,8 @@ struct vnt_tx_datahead_a_fb {
/* RTS buffer header */ /* RTS buffer header */
struct vnt_rts_g { struct vnt_rts_g {
u8 bySignalField_b; struct vnt_phy_field b;
u8 byServiceField_b; struct vnt_phy_field a;
u16 wTransmitLength_b;
u8 bySignalField_a;
u8 byServiceField_a;
u16 wTransmitLength_a;
u16 wDuration_ba; u16 wDuration_ba;
u16 wDuration_aa; u16 wDuration_aa;
u16 wDuration_bb; u16 wDuration_bb;
...@@ -117,12 +102,8 @@ struct vnt_rts_g { ...@@ -117,12 +102,8 @@ struct vnt_rts_g {
} __packed; } __packed;
struct vnt_rts_g_fb { struct vnt_rts_g_fb {
u8 bySignalField_b; struct vnt_phy_field b;
u8 byServiceField_b; struct vnt_phy_field a;
u16 wTransmitLength_b;
u8 bySignalField_a;
u8 byServiceField_a;
u16 wTransmitLength_a;
u16 wDuration_ba; u16 wDuration_ba;
u16 wDuration_aa; u16 wDuration_aa;
u16 wDuration_bb; u16 wDuration_bb;
...@@ -135,18 +116,14 @@ struct vnt_rts_g_fb { ...@@ -135,18 +116,14 @@ struct vnt_rts_g_fb {
} __packed; } __packed;
struct vnt_rts_ab { struct vnt_rts_ab {
u8 bySignalField; struct vnt_phy_field ab;
u8 byServiceField;
u16 wTransmitLength;
u16 wDuration; u16 wDuration;
u16 wReserved; u16 wReserved;
struct ieee80211_rts data; struct ieee80211_rts data;
} __packed; } __packed;
struct vnt_rts_a_fb { struct vnt_rts_a_fb {
u8 bySignalField; struct vnt_phy_field a;
u8 byServiceField;
u16 wTransmitLength;
u16 wDuration; u16 wDuration;
u16 wReserved; u16 wReserved;
u16 wRTSDuration_f0; u16 wRTSDuration_f0;
...@@ -156,9 +133,7 @@ struct vnt_rts_a_fb { ...@@ -156,9 +133,7 @@ struct vnt_rts_a_fb {
/* CTS buffer header */ /* CTS buffer header */
struct vnt_cts { struct vnt_cts {
u8 bySignalField_b; struct vnt_phy_field b;
u8 byServiceField_b;
u16 wTransmitLength_b;
u16 wDuration_ba; u16 wDuration_ba;
u16 wReserved; u16 wReserved;
struct ieee80211_cts data; struct ieee80211_cts data;
...@@ -166,9 +141,7 @@ struct vnt_cts { ...@@ -166,9 +141,7 @@ struct vnt_cts {
} __packed; } __packed;
struct vnt_cts_fb { struct vnt_cts_fb {
u8 bySignalField_b; struct vnt_phy_field b;
u8 byServiceField_b;
u16 wTransmitLength_b;
u16 wDuration_ba; u16 wDuration_ba;
u16 wReserved; u16 wReserved;
u16 wCTSDuration_ba_f0; u16 wCTSDuration_ba_f0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment