* ignore WEP frames if WEP is off
* implement RX_LEN_CROP
This commit is contained in:
parent
621af5f535
commit
3368221aa7
35
src/Wifi.cpp
35
src/Wifi.cpp
|
@ -1140,6 +1140,15 @@ void FinishRX()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reject the frame if it's a WEP frame and WEP is off
|
||||||
|
// TODO: check if sending WEP frames with WEP off works at all?
|
||||||
|
|
||||||
|
if (framectl & (1<<14))
|
||||||
|
{
|
||||||
|
if (!(IOPORT(W_WEPCnt) & (1<<15)))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// apply RX filtering
|
// apply RX filtering
|
||||||
// TODO:
|
// TODO:
|
||||||
// * RXFILTER bits 0, 9, 10, 12 not fully understood
|
// * RXFILTER bits 0, 9, 10, 12 not fully understood
|
||||||
|
@ -1315,7 +1324,7 @@ void FinishRX()
|
||||||
|
|
||||||
// build the RX header
|
// build the RX header
|
||||||
|
|
||||||
u16 headeraddr = IOPORT(W_RXBufWriteCursor) << 1; u16 zorp = headeraddr;
|
u16 headeraddr = IOPORT(W_RXBufWriteCursor) << 1;
|
||||||
*(u16*)&RAM[headeraddr] = rxflags;
|
*(u16*)&RAM[headeraddr] = rxflags;
|
||||||
IncrementRXAddr(headeraddr);
|
IncrementRXAddr(headeraddr);
|
||||||
*(u16*)&RAM[headeraddr] = 0x0040; // ???
|
*(u16*)&RAM[headeraddr] = 0x0040; // ???
|
||||||
|
@ -1381,15 +1390,23 @@ void MPClientReplyRX(int client)
|
||||||
if (IOPORT(W_RXBufBegin) == IOPORT(W_RXBufEnd))
|
if (IOPORT(W_RXBufBegin) == IOPORT(W_RXBufEnd))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u16 framelen;
|
int framelen;
|
||||||
u8 txrate;
|
u8 txrate;
|
||||||
|
|
||||||
u8* reply = &MPClientReplies[(client-1)*1024];
|
u8* reply = &MPClientReplies[(client-1)*1024];
|
||||||
framelen = *(u16*)&reply[10];
|
framelen = *(u16*)&reply[10];
|
||||||
framelen -= 4;
|
|
||||||
|
|
||||||
txrate = reply[8];
|
txrate = reply[8];
|
||||||
|
|
||||||
|
// TODO: what are the maximum crop values?
|
||||||
|
u16 framectl = *(u16*)&reply[12];
|
||||||
|
if (framectl & (1<<14))
|
||||||
|
framelen -= (IOPORT(W_RXLenCrop) >> 7) & 0x1FE;
|
||||||
|
else
|
||||||
|
framelen -= (IOPORT(W_RXLenCrop) << 1) & 0x1FE;
|
||||||
|
|
||||||
|
if (framelen < 0) framelen = 0;
|
||||||
|
|
||||||
// TODO rework RX system so we don't need this (by reading directly into MPClientReplies)
|
// TODO rework RX system so we don't need this (by reading directly into MPClientReplies)
|
||||||
memcpy(RXBuffer, reply, 12+framelen);
|
memcpy(RXBuffer, reply, 12+framelen);
|
||||||
|
|
||||||
|
@ -1412,7 +1429,7 @@ bool CheckRX(int type) // 0=regular 1=MP replies 2=MP host frames
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int rxlen;
|
int rxlen;
|
||||||
u16 framelen;
|
int framelen;
|
||||||
u16 framectl;
|
u16 framectl;
|
||||||
u8 txrate;
|
u8 txrate;
|
||||||
u64 timestamp;
|
u64 timestamp;
|
||||||
|
@ -1447,10 +1464,18 @@ bool CheckRX(int type) // 0=regular 1=MP replies 2=MP host frames
|
||||||
printf("bad frame length %d/%d\n", framelen, rxlen-12);
|
printf("bad frame length %d/%d\n", framelen, rxlen-12);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
framelen -= 4;
|
|
||||||
|
|
||||||
framectl = *(u16*)&RXBuffer[12+0];
|
framectl = *(u16*)&RXBuffer[12+0];
|
||||||
txrate = RXBuffer[8];
|
txrate = RXBuffer[8];
|
||||||
|
|
||||||
|
// TODO: what are the maximum crop values?
|
||||||
|
if (framectl & (1<<14))
|
||||||
|
framelen -= (IOPORT(W_RXLenCrop) >> 7) & 0x1FE;
|
||||||
|
else
|
||||||
|
framelen -= (IOPORT(W_RXLenCrop) << 1) & 0x1FE;
|
||||||
|
|
||||||
|
if (framelen < 0) framelen = 0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ enum
|
||||||
W_CmdTotalTime = 0x0C0,
|
W_CmdTotalTime = 0x0C0,
|
||||||
W_CmdReplyTime = 0x0C4,
|
W_CmdReplyTime = 0x0C4,
|
||||||
W_RXFilter = 0x0D0,
|
W_RXFilter = 0x0D0,
|
||||||
|
W_RXLenCrop = 0x0DA,
|
||||||
W_RXFilter2 = 0x0E0,
|
W_RXFilter2 = 0x0E0,
|
||||||
|
|
||||||
W_USCountCnt = 0x0E8,
|
W_USCountCnt = 0x0E8,
|
||||||
|
|
Loading…
Reference in New Issue