5 * Copyright (C) 2004 ZyDAS Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
10 * The contents of this file are subject to the Mozilla Public
11 * License Version 1.1 (the "License"); you may not use this file
12 * except in compliance with the License. You may obtain a copy of
13 * the License at http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS
16 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 * implied. See the License for the specific language governing
18 * rights and limitations under the License.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU Public License version 2 (the "GPL"), in which
22 * case the provisions of the GPL are applicable instead of the
23 * above. If you wish to allow the use of your version of this file
24 * only under the terms of the GPL and not to allow others to use
25 * your version of this file under the MPL, indicate your decision
26 * by deleting the provisions above and replace them with the notice
27 * and other provisions required by the GPL. If you do not delete
28 * the provisions above, a recipient may use your version of this
29 * file under either the MPL or the GPL.
31 * -------------------------------------------------------------------- */
41 extern zd_80211Obj_t dot11Obj
;
43 extern void zd1205_CollectHwTally(struct zd1205_private
*macp
);
44 //extern void zd1205_SoftwareReset(struct zd1205_private *macp);
46 /* In fact, these global variables should be avoided. The should be
47 * removed to the context of adapter.
50 //extern U8 IntValue[14];
51 int zdproduction_ioctl(struct zd1205_private
*macp
, struct zd_point
*p
)
57 printk(KERN_ERR
"zdproduction_ioctl, length: %d\n", p
->length
);
59 if (p
->length
< sizeof(oid_wrap_t
) || !p
->pointer
)
61 printk(KERN_ERR
"Something Wrong,%d,%d\n",p
->length
,sizeof(oid_wrap_t
));
65 param
= (oid_wrap_t
*) kmalloc(p
->length
, GFP_ATOMIC
);
69 printk(KERN_ERR
"Buf is NULL\n");
73 if (copy_from_user(param
, p
->pointer
, p
->length
))
75 printk(KERN_ERR
"copy_from_user error\n");
80 /* Dump the content */
85 u8
*pp
= (u8
*) param
;
87 for(ii
= 0; ii
< p
->length
;)
89 ZDPRODUCTDBG("0x%02x ", pp
[ii
]);
98 /* Dump the data structure of UDP request. */
99 ZDPRODUCTDBG("request: 0x%04x\n", le16_to_cpu(param
->request
));
100 ZDPRODUCTDBG("seq: 0x%04x\n", le16_to_cpu(param
->seq
));
101 ZDPRODUCTDBG("oid: 0x%08x\n", le32_to_cpu(param
->u
.info
.oid
));
102 ZDPRODUCTDBG("status: 0x%08x\n", le32_to_cpu(param
->u
.info
.status
));
103 ZDPRODUCTDBG("length: 0x%08x\n", le32_to_cpu(param
->u
.info
.length
));
106 if (le16_to_cpu(param
->request
) == CMD_QUERY_INFORMATION
)
108 NDIS_OID Oid
= le32_to_cpu(param
->u
.info
.oid
);
109 PVOID InformationBuffer
= param
->u
.info
.data
;
110 ULONG InformationBufferLength
= le32_to_cpu(param
->u
.info
.length
);
114 status
= ZD1205EM_Custom_QueryInformation((PVOID
) macp
,
117 InformationBufferLength
,
121 param
->u
.info
.status
= cpu_to_le32(status
);
122 if (status
== NDIS_STATUS_SUCCESS
)
124 /* Update information */
125 param
->u
.info
.length
= cpu_to_le32(BytesWritten
);
126 p
->length
= ZD_GENERIC_OID_HDR_LEN
+ BytesWritten
;
131 /* If the status is not NDIS_STATUS_SUCCESS,
132 we don't change the length field. */
133 p
->length
= ZD_GENERIC_OID_HDR_LEN
+ sizeof(ZD_RD_STRUCT
);
137 else if (le16_to_cpu(param
->request
) == CMD_SET_INFORMATION
)
139 NDIS_OID Oid
= le32_to_cpu(param
->u
.info
.oid
);
140 PVOID InformationBuffer
= param
->u
.info
.data
;
141 ULONG InformationBufferLength
= le32_to_cpu(param
->u
.info
.length
);
145 status
= ZD1205EM_Custom_SetInformation((PVOID
) macp
,
148 InformationBufferLength
,
152 param
->u
.info
.status
= cpu_to_le32(status
);
154 /* Update information */
155 p
->length
= ZD_GENERIC_OID_HDR_LEN
;
161 if (copy_to_user(p
->pointer
, param
, p
->length
))
175 #if 0 //Replace by SoftwareReset in zdmain.c
176 void SoftwareReset(zd1205_private_t
*macp
)
178 void *reg
= macp
->regp
;
181 acquire_ctrl_of_phy_req(reg
);
182 dot11Obj
.SetReg(reg
,ZD1205_PHY_END
, 0x8);
183 release_ctrl_of_phy_req(reg
);
185 tmpvalue
= dot11Obj
.GetReg(reg
, PS_Ctrl
);
186 dot11Obj
.SetReg(reg
, PS_Ctrl
, (tmpvalue
| BIT_5
));
188 acquire_ctrl_of_phy_req(reg
);
189 dot11Obj
.SetReg(reg
, ZD1205_PHY_END
, 0x0);
190 release_ctrl_of_phy_req(reg
);
192 /* Recycle Tx process */
193 ZD1205_recycle_tx(macp
);
195 /* Recycle Rx process */
196 ZD1205_recycle_rx(macp
);
201 UCHAR
Rate_Convert_to_MS(UCHAR rate_in_drv
)
252 UCHAR
Rate_Convert(UCHAR rate
)
256 case 2: return 0; // 1M
257 case 4: return 1; // 2M
258 case 11: return 2; // 5.5M
259 case 22: return 3; // 11M
260 case 12: return 4; // 6M
261 case 18: return 5; // 9M
262 case 24: return 6; // 12M
263 case 36: return 7; // 18M
264 case 48: return 8; // 24M
265 case 72: return 9; // 36M
266 case 96: return 0xa; // 48M
267 case 108: return 0xb; // 54M
268 default: return 0xb; // 54M
273 void Reset_Tally(zd1205_private_t
*macp
)
275 void *reg
= macp
->regp
;
277 macp
->txUnicastFrm
= 0;
278 macp
->txMulticastFrm
= 0;
279 macp
->txUnicastOctets
= 0;
280 macp
->txMulticastOctets
= 0;
281 macp
->retryFailCnt
= 0;
282 macp
->hwTotalTxFrm
= 0;
283 macp
->hwRetryCnt
= 0;
284 macp
->hwUnderrunCnt
= 0;
285 macp
->DriverRxFrmCnt
= 0;
286 macp
->rxUnicastFrm
= 0;
287 macp
->rxMulticastFrm
= 0;
289 macp
->rxUnicastOctets
= 0;
290 macp
->rxMulticastOctets
= 0;
291 macp
->invalid_frame_good_crc
= 0;
292 macp
->ErrShortFrmCnt
= 0;
293 macp
->ErrLongFrmCnt
= 0;
294 macp
->rxBroadcastFrm
= 0;
295 macp
->rxBroadcastOctets
= 0;
296 macp
->rx11bDataFrame
= 0;
297 macp
->rxOFDMDataFrame
= 0;
298 macp
->rxNeedFrag
= 0;
301 macp
->hwTotalRxFrm
= 0;
302 macp
->hwCRC16Cnt
= 0;
303 macp
->hwCRC32Cnt
= 0;
304 macp
->hwDecrypErr_UNI
= 0;
305 macp
->hwDecrypErr_Mul
= 0;
306 macp
->hwRxFIFOOverrun
= 0;
308 macp
->rxDiscardByNotPIBSS
= 0;
309 macp
->rxDiscardByAllocateBuf
= 0;
311 /* Read clear those hardware counters */
312 dot11Obj
.GetReg(reg
, TotalRxFrm
);
313 dot11Obj
.GetReg(reg
, CRC32Cnt
);
314 dot11Obj
.GetReg(reg
, CRC16Cnt
);
315 dot11Obj
.GetReg(reg
, DecrypErr_UNI
);
316 dot11Obj
.GetReg(reg
, DecrypErr_Mul
);
317 dot11Obj
.GetReg(reg
, RxFIFOOverrun
);
318 dot11Obj
.GetReg(reg
, TotalTxFrm
);
319 dot11Obj
.GetReg(reg
, UnderrunCnt
);
320 dot11Obj
.GetReg(reg
, RetryCnt
);
324 NDIS_STATUS
ZD1205EM_Custom_QueryInformation(
327 PVOID InformationBuffer
,
328 ULONG InformationBufferLength
,
337 //PVOID MoveSource = (PVOID) (&GenericUlong);
338 //ULONG MoveBytes = sizeof(GenericUlong);
340 zd1205_private_t
*macp
= (zd1205_private_t
*) NDIS_HANDLE
;
341 void *reg
= macp
->regp
;
343 NDIS_802_11_CONFIGURATION
*pConfiguration
;
344 ZD_CUSTOM_STRUCT
*pZDCustom
;
347 LOCAL_TALLY_STRUCT
*pLocalTally
;
352 ZDPRODUCTDBG("****** ZD1205EM_Custom_QueryInformation ******\r\n");
354 /* DUMP InformationBuffer */
358 UCHAR
*p
= (UCHAR
*) InformationBuffer
;
360 for(ii
= 0; ii
< InformationBufferLength
;)
362 ZDPRODUCTDBG("0x%02x ", p
[ii
]);
364 if ((++ii
% 16) == 0)
371 Status
= NDIS_STATUS_SUCCESS
;
375 case OID_GEN_MEDIA_CONNECT_STATUS
:
376 printk(KERN_ERR
"OID_GEN_MEDIA_CONNECT_STATUS\n");
377 //if (macp->adapterReady == TRUE)
378 GenericUlong
= cpu_to_le32(NdisMediaStateConnected
);
380 // GenericUlong = NdisMediaStateDisconnected;
382 memcpy(InformationBuffer
, &GenericUlong
, sizeof(GenericUlong
));
383 *BytesWritten
= sizeof(GenericUlong
);
385 Status
= NDIS_STATUS_SUCCESS
;
388 case OID_GEN_DRIVER_VERSION
:
389 ZDPRODUCTDBG("OID_GEN_DRIVER_VERSION\r\n");
391 GenericUlong
= cpu_to_le32(ZD1205_DRIVER_VERSION
);
392 memcpy(InformationBuffer
, &GenericUlong
, sizeof(GenericUlong
));
393 *BytesWritten
= sizeof(GenericUlong
);
395 Status
= NDIS_STATUS_SUCCESS
;
398 case OID_802_11_DESIRED_RATES
:
399 ZDPRODUCTDBG("OID_802_11_DESIRED_RATES\r\n");
401 if (InformationBuffer
== 0 || ((UINT
)InformationBufferLength
< macp
->AllowRateArrayCount
))
403 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
405 *BytesNeeded
= macp
->AllowRateArrayCount
;
409 ZDPRODUCTDBG("OID_802_11_DESIRED_RATES %d\r\n", macp
->cardSetting
.FixedRate
);
411 //for(i = 0; i < macp->AllowRateArrayCount; i++){
412 *((PUCHAR
)InformationBuffer
) = Rate_Convert_to_MS(macp
->cardSetting
.FixedRate
);
416 *BytesWritten
= macp
->AllowRateArrayCount
;
419 Status
= NDIS_STATUS_SUCCESS
;
422 case OID_802_11_CONFIGURATION
:
423 case OID_ZDX_802_11_CONFIGURATION
:
424 ZDPRODUCTDBG("OID_802_11_CONFIGURATION\r\n");
425 if (InformationBuffer
== NULL
||
426 (InformationBufferLength
< sizeof(NDIS_802_11_CONFIGURATION
)))
428 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
431 *BytesNeeded
= sizeof(NDIS_802_11_CONFIGURATION
);
435 pConfiguration
= (PNDIS_802_11_CONFIGURATION
)InformationBuffer
;
436 pConfiguration
->Length
= cpu_to_le32(sizeof(NDIS_802_11_CONFIGURATION
));
437 pConfiguration
->BeaconPeriod
= cpu_to_le32(macp
->cardSetting
.BeaconInterval
);
438 pConfiguration
->ATIMWindow
= cpu_to_le32(macp
->cardSetting
.ATIMWindow
);
439 pConfiguration
->DSConfig
= cpu_to_le32((2412+(macp
->cardSetting
.Channel
-1)*5)*1000);
441 if (macp
->cardSetting
.Channel
== 14)
442 pConfiguration
->DSConfig
= cpu_to_le32(2484000);
443 #ifdef ZDCONF_80211A_SUPPORT
444 if(mMacMode
== PURE_A_MODE
)
445 pConfiguration
->DSConfig
= channel_11A_to_Freq(macp
->cardSetting
.Channel
)*1000;
447 *BytesWritten
= sizeof(NDIS_802_11_CONFIGURATION
);
449 return NDIS_STATUS_SUCCESS
;
451 case OID_802_11_INFRASTRUCTURE_MODE
:
452 case OID_ZDX_802_11_INFRASTRUCTURE_MODE
:
453 ZDPRODUCTDBG("OID_802_11_INFRASTRUCTURE_MODE\r\n");
455 macmode
= macp
->cardSetting
.BssType
;
458 case INDEPENDENT_BSS
:
459 GenericUlong
= cpu_to_le32(Ndis802_11IBSS
);
462 case INFRASTRUCTURE_BSS
:
463 GenericUlong
= cpu_to_le32(Ndis802_11Infrastructure
);
467 GenericUlong
= cpu_to_le32(AP_BSS
);
471 GenericUlong
= cpu_to_le32(PSEUDO_IBSS
);
475 memcpy(InformationBuffer
, &GenericUlong
, sizeof(GenericUlong
));
476 *BytesWritten
= sizeof(GenericUlong
);
478 Status
= NDIS_STATUS_SUCCESS
;
481 case OID_ZDX_802_11_SSID
:
482 case OID_802_11_NETWORK_TYPE_IN_USE
:
483 ZDPRODUCTDBG("OID_ZDX_802_11_SSID\r\n");
486 GenericUlong
= cpu_to_le32(Ndis802_11OFDM24
);
488 memcpy(InformationBuffer
, &GenericUlong
, sizeof(GenericUlong
));
489 *BytesWritten
= sizeof(GenericUlong
);
491 Status
= NDIS_STATUS_SUCCESS
;
493 case OID_802_3_CURRENT_ADDRESS
:
494 ZDPRODUCTDBG("OID_802_3_CURRENT_ADDRESS\n");
495 GenericUlong
= zd_readl(E2P_MACADDR_P1
);
496 ((u8
*)InformationBuffer
)[0]= (u8
)GenericUlong
;
497 ((u8
*)InformationBuffer
)[1]= (u8
)(GenericUlong
>> 8);
498 ((u8
*)InformationBuffer
)[2]= (u8
)(GenericUlong
>> 16);
499 ((u8
*)InformationBuffer
)[3]= (u8
)(GenericUlong
>> 24);
501 GenericUlong
= zd_readl(E2P_MACADDR_P2
);
502 ((u8
*)InformationBuffer
)[4]= (u8
)GenericUlong
;
503 ((u8
*)InformationBuffer
)[5]= (u8
)(GenericUlong
>> 8);
505 *BytesWritten
= ETH_ALEN
;
507 Status
= NDIS_STATUS_SUCCESS
;
511 ZDPRODUCTDBG("OID_ZD_RD\r\n");
513 if (InformationBufferLength
< sizeof(ZD_RD_STRUCT
)-4)
515 ZDPRODUCTDBG("OID_ZD_RD: NDIS_STATUS_BUFFER_TOO_SHORT,%d,%d\r\n",InformationBufferLength
,sizeof(ZD_RD_STRUCT
));
516 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
518 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
522 pZDRD
= (PZD_RD_STRUCT
)InformationBuffer
;
524 switch (le32_to_cpu(pZDRD
->ZDRdFuncId
))
526 case ZDAccessPHYRegister1B
:
527 ZDPRODUCTDBG("ZDAccessPHYRegister1B\r\n");
529 if (le32_to_cpu(pZDRD
->ZDRdLength
) < sizeof(ZD_RD_STRUCT
))
531 ZDPRODUCTDBG("ZDAccessPHYRegister1B: NDIS_STATUS_BUFFER_TOO_SHORT\r\n");
532 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
533 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
535 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
539 // Write PHY registers
540 LockPhyReg(&dot11Obj
);
542 /* Remap some special PHY registers */
543 switch(le32_to_cpu(pZDRD
->Buffer
[0]))
564 IoAddress
= le32_to_cpu(pZDRD
->Buffer
[0]) << 2;
567 //if (!NeedReadProtection(Adapter, IoAddress, &(pZDRD->Buffer[1]))){
568 pZDRD
->Buffer
[1] = dot11Obj
.GetReg(reg
, IoAddress
);
571 pZDRD
->Buffer
[1] &= 0xFFFF;
572 ZDPRODUCTDBG("Read Phy Reg (0x%x) = %x\r\n", IoAddress
, pZDRD
->Buffer
[1]);
573 UnLockPhyReg(&dot11Obj
);
575 pZDRD
->Buffer
[1] = cpu_to_le32(pZDRD
->Buffer
[1]);
576 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
577 *BytesWritten
= sizeof(ZD_RD_STRUCT
);
579 Status
= NDIS_STATUS_SUCCESS
;
583 case ZDAccessMACRegister4B
:
584 ZDPRODUCTDBG("ZDAccessMACRegister4B\r\n");
586 if (le32_to_cpu(pZDRD
->ZDRdLength
) < (sizeof(ZD_RD_STRUCT
)))
588 ZDPRODUCTDBG("ZDAccessMACRegister4B: NDIS_STATUS_BUFFER_TOO_SHORT\r\n");
589 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
590 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
592 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
596 if (le32_to_cpu(pZDRD
->Buffer
[0]) < 0x1000)
598 pZDRD
->Buffer
[1] = cpu_to_le32(dot11Obj
.GetReg(reg
, le32_to_cpu(pZDRD
->Buffer
[0])));
600 //else if (!NeedReadProtection(Adapter, pZDRD->Buffer[0], &(pZDRD->Buffer[1]))){
601 //pZDRD->Buffer[1] = dot11Obj.GetReg(reg, pZDRD->Buffer[0]);
603 pZDRD
->Buffer
[1] = 0;
605 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
606 *BytesWritten
= sizeof(ZD_RD_STRUCT
);
608 Status
= NDIS_STATUS_SUCCESS
;
610 case ZDAccessROMData
:
612 ZDPRODUCTDBG("ZDAccessROM read\r\n");
614 if (le32_to_cpu(pZDRD
->ZDRdLength
) < (sizeof(ZD_RD_STRUCT
) + 4))
616 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
) + 4);
617 *BytesNeeded
= (sizeof(ZD_RD_STRUCT
) + 4);
619 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
624 int ReadLength
= le32_to_cpu(pZDRD
->Buffer
[1]);
625 //int ReadOffset = le32_to_cpu(pZDRD->Buffer[0]);
626 PUCHAR pDataPtr
= (PUCHAR
)(pZDRD
+1);
628 PUCHAR pTmpBuffer
= 0, pOldTmpBuffer
;
630 /* Update the total EEPROM content */
632 //RamAddr is 2nd argument, it differs from Win
633 HW_EEPROM_ACCESS(&dot11Obj
, cFIRMWARE_EEPROM_OFFSET
, cEPDATA_OFFSET
, (E2P_END
-E2P_SUBID
)/2, 0);
634 //ZD1205_WriteE2P(&dot11Obj);
636 pTmpBuffer
= kmalloc(E2P_END
- E2P_SUBID
+1, GFP_ATOMIC
);
640 Status
= NDIS_STATUS_RESOURCES
;
644 pOldTmpBuffer
= pTmpBuffer
;
646 for (i
= E2P_SUBID
; i
< E2P_END
; i
+= 4)
648 tmpULONG
= dot11Obj
.GetReg(reg
, i
);
649 *pTmpBuffer
= (UCHAR
)(tmpULONG
& 0xFF);
651 *pTmpBuffer
= (UCHAR
)((tmpULONG
>> 8) & 0xFF);
653 *pTmpBuffer
= (UCHAR
)((tmpULONG
>> 16) & 0xFF);
655 *pTmpBuffer
= (UCHAR
)((tmpULONG
>> 24) & 0xFF);
659 memcpy(pDataPtr
, pOldTmpBuffer
, (E2P_END
- E2P_SUBID
+ 1) );
660 kfree(pOldTmpBuffer
);
661 *BytesWritten
= sizeof(ZD_RD_STRUCT
) + ReadLength
;
663 Status
= NDIS_STATUS_SUCCESS
;
668 case ZDGetNICAdapterTally
:
669 ZDPRODUCTDBG("ZDGetNICAdapterTally\r\n");
671 //ZD_RD_STRUCT contain one ULONG
672 if (le32_to_cpu(pZDRD
->ZDRdLength
) < (sizeof(ZD_RD_STRUCT
) + sizeof(ULONG
)*36))
674 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
) + sizeof(ULONG
)*36);
675 *BytesNeeded
= (sizeof(ZD_RD_STRUCT
) + sizeof(ULONG
)*37);
677 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
678 ZDPRODUCTDBG("ZDGetNICAdapterTally BUFFER_TOO_SHORT\r\n");
682 zd1205_CollectHwTally(macp
);
685 pZDRD
->Buffer
[0] = cpu_to_le32(macp
->txUnicastFrm
);
687 pZDRD
->Buffer
[1] = cpu_to_le32(macp
->txMulticastFrm
);
688 //txUniOctets byte size
689 pZDRD
->Buffer
[2] = cpu_to_le32(macp
->txUnicastOctets
);
690 //txMultiOctets byte size
691 pZDRD
->Buffer
[3] = cpu_to_le32(macp
->txMulticastOctets
);
692 pZDRD
->Buffer
[4] = 0; //txFrmUpperNDIS
694 pZDRD
->Buffer
[5] = cpu_to_le32(macp
->txFrmDrvMgt
);
695 pZDRD
->Buffer
[6] = cpu_to_le32(macp
->retryFailCnt
);
696 //Hardware total Tx Frame
697 pZDRD
->Buffer
[7] = cpu_to_le32(macp
->hwTotalTxFrm
);
698 //txMultipleRetriesFrames
699 pZDRD
->Buffer
[8] = cpu_to_le32(macp
->hwRetryCnt
);
701 pZDRD
->Buffer
[9] = cpu_to_le32(macp
->hwUnderrunCnt
);
703 pZDRD
->Buffer
[10] = cpu_to_le32(macp
->DriverRxFrmCnt
);
705 pZDRD
->Buffer
[11] = cpu_to_le32(macp
->rxUnicastFrm
);
707 pZDRD
->Buffer
[12] = cpu_to_le32(macp
->rxMulticastFrm
);
709 pZDRD
->Buffer
[13] = cpu_to_le32(macp
->rxUnicastFrm
+macp
->rxMulticastFrm
);
711 pZDRD
->Buffer
[14] = cpu_to_le32(macp
->rxCnt
);
712 //rxUniOctets byte size
713 pZDRD
->Buffer
[15] = cpu_to_le32(macp
->rxUnicastOctets
);
714 //rxMultiOctets byte size
715 pZDRD
->Buffer
[16] = cpu_to_le32(macp
->rxMulticastOctets
);
716 // Discard by ValidateFrame
717 pZDRD
->Buffer
[17] = cpu_to_le32(macp
->invalid_frame_good_crc
);
719 pZDRD
->Buffer
[18] = cpu_to_le32(macp
->ErrShortFrmCnt
);
721 pZDRD
->Buffer
[19] = cpu_to_le32(macp
->ErrLongFrmCnt
);
722 pZDRD
->Buffer
[20] = 0; //DriverDiscardedFrmCauseByMulticastList
723 pZDRD
->Buffer
[21] = 0; //DriverDiscardedFrmCauseByFrmCtrl
725 pZDRD
->Buffer
[22] = cpu_to_le32(macp
->rxNeedFrag
);
727 pZDRD
->Buffer
[23] = cpu_to_le32(macp
->rxMgtFrm
);
728 //Receive broadcast frame count
729 pZDRD
->Buffer
[24] = cpu_to_le32(macp
->rxBroadcastFrm
);
730 //Receive broadcast frame byte size
731 pZDRD
->Buffer
[25] = cpu_to_le32(macp
->rxBroadcastOctets
);
732 //Measured quality 11b data frame count
733 pZDRD
->Buffer
[26] = cpu_to_le32(macp
->rx11bDataFrame
);
734 //Measured quality 11g data frame count
735 pZDRD
->Buffer
[27] = cpu_to_le32(macp
->rxOFDMDataFrame
);
738 pZDRD
->Buffer
[28] = cpu_to_le32(macp
->hwTotalRxFrm
);
740 pZDRD
->Buffer
[29] = cpu_to_le32(macp
->hwCRC16Cnt
);
742 pZDRD
->Buffer
[30] = cpu_to_le32(macp
->hwCRC32Cnt
);
744 pZDRD
->Buffer
[31] = cpu_to_le32(macp
->hwDecrypErr_UNI
);
746 pZDRD
->Buffer
[32] = cpu_to_le32(macp
->hwDecrypErr_Mul
);
748 pZDRD
->Buffer
[33] = cpu_to_le32(macp
->hwDecrypErr_UNI
+macp
->hwDecrypErr_Mul
);
750 pZDRD
->Buffer
[34] = cpu_to_le32(macp
->hwRxFIFOOverrun
);
751 pZDRD
->Buffer
[35] = 0; //LossAP
752 pZDRD
->Buffer
[36] = cpu_to_le32(macp
->rxDiscardByNotPIBSS
);
753 pZDRD
->Buffer
[37] = cpu_to_le32(macp
->rxDiscardByAllocateBuf
);;
755 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
) + sizeof(ULONG
)*36);
756 *BytesWritten
= sizeof(ZD_RD_STRUCT
) + sizeof(ULONG
)*36;
760 ZDPRODUCTDBG("ZDContinuousTx\r\n");
762 if (le32_to_cpu(pZDRD
->ZDRdLength
) < sizeof(ZD_RD_STRUCT
))
764 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
765 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
767 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
771 pZDRD
->Buffer
[0] = cpu_to_le32(macp
->bContinueTxMode
);
772 if(macp
->bContinueTx
== 1)
773 pZDRD
->Buffer
[1] = 0x00;
775 pZDRD
->Buffer
[1] = cpu_to_le32(0x01);
777 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
781 ZDPRODUCTDBG("Unknown FunctionID: 0x%08x\r\n", le32_to_cpu(pZDRD
->ZDRdFuncId
));
787 ZDPRODUCTDBG("OID_ZD_CUSTOM\r\n");
789 pZDCustom
= (ZD_CUSTOM_STRUCT
*) InformationBuffer
;
791 switch (le32_to_cpu(pZDCustom
->ZDFuncId
))
795 ZDPRODUCTDBG("ZDPreambleMode\r\n");
796 switch (macp
->cardSetting
.PreambleType
)
799 pZDCustom
->DataBuffer
[0] = cpu_to_le32(ZD_PreambleLong
);
803 pZDCustom
->DataBuffer
[0] = cpu_to_le32(ZD_PreambleShort
);
807 pZDCustom
->DataBuffer
[0] = cpu_to_le32(ZD_PreambleAuto
);
811 case ZDAdapterRegion
:
812 ZDPRODUCTDBG("ZDAdapterRegion 0x%x\r\n", macp
->RegionCode
);
813 pZDCustom
->DataBuffer
[0] = cpu_to_le32(macp
->RegionCode
);
814 *BytesWritten
= sizeof(macp
->RegionCode
);
817 case ZDAdapterSupportChannel
:
820 int AllowChannelCount
= 0;
821 ULONG tmpAllowChannel
= dot11Obj
.AllowedChannel
;
822 char *pChannelNumber
= (char *)(pZDCustom
->DataBuffer
);
824 printk(KERN_ERR
"ZDAdapterSupportChannel\n");
826 for (i
= 0; i
< 14; i
++)
828 if (tmpAllowChannel
& (1 << i
))
832 if (pZDCustom
->ZDCustomLength
< (AllowChannelCount
+ sizeof(ZD_RD_STRUCT
) - sizeof(ULONG
)))
834 pZDCustom
->ZDCustomLength
= (AllowChannelCount
+ sizeof(ZD_RD_STRUCT
) - sizeof(ULONG
));
836 *BytesNeeded
= pZDCustom
->ZDCustomLength
;
838 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
842 for (i
= 0; i
< 14; i
++)
844 if (tmpAllowChannel
& (1 << i
))
845 *(pChannelNumber
++) = i
+1;
848 pZDCustom
->ZDCustomLength
= (AllowChannelCount
+ sizeof(ZD_RD_STRUCT
) - sizeof(ULONG
));
849 *BytesWritten
= pZDCustom
->ZDCustomLength
;
858 ZDPRODUCTDBG("OID_ZD_GETRID\r\n");
859 rid_p
= (PRID_STRUCT
)InformationBuffer
;
861 switch(le16_to_cpu(rid_p
->rid
))
864 ZDPRODUCTDBG("RID_MONITOR\r\n");
866 zd1205_CollectHwTally(macp
);
868 rid_p
->data
[0] = (USHORT
)macp
->hwCRC32Cnt
;
869 rid_p
->data
[1] = (USHORT
)macp
->hwCRC16Cnt
;
870 rid_p
->data
[2] = (USHORT
)macp
->hwRetryCnt
;
871 rid_p
->data
[3] = (USHORT
)macp
->hwTotalRxFrm
;
872 rid_p
->data
[4] = (USHORT
)macp
->hwTotalTxFrm
;
880 *BytesWritten
= sizeof(RID_STRUCT
);
884 ZDPRODUCTDBG("Get UDP Port\r\n");
887 *BytesWritten
= sizeof(RID_STRUCT
);
890 ZDPRODUCTDBG("RID: 0x%04x not support\r\n", le16_to_cpu(rid_p
->rid
));
891 Status
= NDIS_STATUS_NOT_SUPPORTED
;
895 case OID_ZD_GET_TALLIES
:
896 ZDPRODUCTDBG("OID_ZD_GET_TALLIES\r\n");
898 pLocalTally
= (PLOCAL_TALLY_STRUCT
)InformationBuffer
;
900 /* Zero the buffer */
901 memset(pLocalTally
, 0, sizeof(LOCAL_TALLY_STRUCT
));
903 zd1205_CollectHwTally(macp
);
905 #if (defined(GCCK) && defined(OFDM))
906 pLocalTally
->reserved2_L
= cpu_to_le32(macp
->rx11bDataFrame
);
907 pLocalTally
->reserved3_L
= cpu_to_le32(macp
->rxOFDMDataFrame
);
909 //pLocalTally->reserved2 = 0;
910 //pLocalTally->reserved3 = 0;
913 pLocalTally
->reserved7_L
= cpu_to_le32(macp
->rxBroadcastFrm
);
914 pLocalTally
->reserved8_L
= cpu_to_le32(macp
->rxBroadcastOctets
);
915 pLocalTally
->rxCRC32ErrCnt_L
= cpu_to_le32(macp
->hwCRC32Cnt
);
916 pLocalTally
->rxDecrypFailCnt_L
= cpu_to_le32(macp
->hwDecrypErr_UNI
+macp
->hwDecrypErr_Mul
);
917 // macp->DriverDiscardedFrm
918 pLocalTally
->rxDiscardedCnt_L
= cpu_to_le32(macp
->invalid_frame_good_crc
);
919 pLocalTally
->rxMulticastFrames_L
= cpu_to_le32(macp
->rxMulticastFrm
);
920 pLocalTally
->rxMultiOctets_L
= cpu_to_le32(macp
->rxMulticastOctets
);
921 pLocalTally
->rxPLCPCRCErrCnt_L
= cpu_to_le32(macp
->hwCRC16Cnt
);
922 //(macp->rxMulticastFrm+macp->rxUnicastFrm)
923 pLocalTally
->rxTotalCnt_L
= cpu_to_le32(macp
->rxMulticastFrm
+macp
->rxUnicastFrm
);
925 pLocalTally
->rxUnicastFrames_L
= cpu_to_le32(macp
->rxUnicastFrm
);
926 // macp->rxUnicastOctets
927 pLocalTally
->rxUniOctets_L
= cpu_to_le32(macp
->rxUnicastOctets
);
928 //pLocalTally->txMulticastFrames = 0; // macp->txMulticastFrm
929 //pLocalTally->txMultiOctets = 0; // macp->txMulticastOctets
930 pLocalTally
->txMultipleRetriesFrames_L
= cpu_to_le32(macp
->hwRetryCnt
);
931 pLocalTally
->txRetryLimitExceeded_L
= cpu_to_le32(macp
->retryFailCnt
);
932 //pLocalTally->txUnicastFrames = 0; // macp->txUnicastFrm
933 //pLocalTally->txUniOctets = 0; // macp->txUnicastOctets
935 *BytesWritten
= sizeof(LOCAL_TALLY_STRUCT
);
939 ZDPRODUCTDBG("%s Unknown OID = 0x%08x\r\n", "ZD1205EM_Custom_QueryInfo", Oid
);
940 Status
= NDIS_STATUS_NOT_SUPPORTED
;
948 NDIS_STATUS
ZD1205EM_Custom_SetInformation(
951 PVOID InformationBuffer
,
952 ULONG InformationBufferLength
,
963 zd1205_private_t
*macp
= (zd1205_private_t
*) NDIS_HANDLE
;
964 void *reg
= macp
->regp
;
966 NDIS_802_11_CONFIGURATION
*pConfiguration
;
967 NDIS_802_11_SSID
*pSSID
;
968 ZD_CUSTOM_STRUCT
*pZDCustom
;
973 Status
= NDIS_STATUS_SUCCESS
;
975 ZDPRODUCTDBG("***** ZD1205EM_Custom_SetInformation ******\r\n");
978 case OID_802_11_DESIRED_RATES
:
979 ZDPRODUCTDBG("OID_802_11_DESIRED_RATES\r\n");
981 /* Fixed the Tx rate */
982 GenericUlong
= le32_to_cpu(*((ULONG
*) InformationBuffer
));
984 macp
->cardSetting
.FixedRate
= Rate_Convert((GenericUlong
& 0x7f));
985 macp
->bFixedRate
= 1;
986 ZDPRODUCTDBG("Rate: 0x%08x\r\n", macp
->cardSetting
.FixedRate
);
988 Status
= NDIS_STATUS_SUCCESS
;
991 case OID_802_11_CONFIGURATION
:
992 case OID_ZDX_802_11_CONFIGURATION
:
993 ZDPRODUCTDBG("OID_802_11_CONFIGURATION\r\n");
995 if (InformationBuffer
== NULL
||
996 (InformationBufferLength
< sizeof(NDIS_802_11_CONFIGURATION
)))
998 Status
= NDIS_STATUS_INVALID_LENGTH
;
1002 pConfiguration
= (PNDIS_802_11_CONFIGURATION
) InformationBuffer
;
1006 //U16 p = (U16) le32_to_cpu(pConfiguration->BeaconPeriod);
1007 //U8 BcnInterval[2];
1008 //U16 *p = (U16 *)&BcnInterval;
1010 //BcnInterval[0] = (U8)(pConfiguration->BeaconPeriod);
1011 //BcnInterval[1] = (U8)(pConfiguration->BeaconPeriod >> 8);
1013 //HW_UpdateBcnInterval(&dot11Obj, *p);
1015 /* Update ATIMWindow */
1017 //U16 p = (U16) le32_to_cpu(pConfiguration->ATIMWindow);
1019 //U16 *p = (U16 *)&ATIMWindow;
1021 //ATIMWindow[0] = (U8)(pConfiguration->ATIMWindow);
1022 //ATIMWindow[1] = (U8)(pConfiguration->ATIMWindow >> 8);
1024 //HW_UpdateATIMWindow(&dot11Obj, *p);
1026 /* Update Channel */
1029 UCHAR IntValue
= 0xFF;
1030 #ifdef ZDCONF_80211A_SUPPORT
1031 ChannelNo
= Freq_11A_to_channel(pConfiguration
->DSConfig
/1000);
1034 ChannelNo
=(le32_to_cpu(pConfiguration
->DSConfig
)/1000-2412)/5+1;
1036 /* If the desired channel is 14 */
1037 if (le32_to_cpu(pConfiguration
->DSConfig
) == 2484000)
1039 //macp->SaveChannel = 14;
1040 //Set_RF_Channel(Adapter, 14, (U8)dot11Obj.rfMode, 1);
1042 macp
->cardSetting
.Channel
= 14;
1043 HW_SwitchChannel(&dot11Obj
, 14, 1,1);
1047 //macp->SaveChannel = (U8) ChannelNo;
1048 macp
->cardSetting
.Channel
= ChannelNo
;
1049 if(pConfiguration
->DSConfig
/1000> 4000)
1051 if(mMacMode
!= PURE_A_MODE
)
1053 mMacMode
= PURE_A_MODE
;
1054 ChangeMacMode( PURE_A_MODE
, ChannelNo
);
1055 HW_SwitchChannel(&dot11Obj
, ChannelNo
, 1,PURE_A_MODE
);
1059 //For update iwconfig information only
1060 ChangeMacMode(PURE_A_MODE
, ChannelNo
);
1061 HW_SwitchChannel(&dot11Obj
, ChannelNo
, 1,PURE_A_MODE
);
1066 if(mMacMode
== PURE_A_MODE
)
1068 mMacMode
= MIXED_MODE
;
1069 ChangeMacMode(MIXED_MODE
, ChannelNo
);
1070 HW_SwitchChannel(&dot11Obj
, ChannelNo
, 1,MIXED_MODE
);
1074 //For update iwconfig information only
1075 ChangeMacMode(MIXED_MODE
, ChannelNo
);
1076 HW_SwitchChannel(&dot11Obj
, ChannelNo
, 1,MIXED_MODE
);
1080 /* Reset the Integration value */
1081 if(pConfiguration
->DSConfig
/1000 < 4000)
1082 IntValue
= dot11Obj
.IntValue
[ChannelNo
-1];
1083 #ifdef ZDCONF_80211A_SUPPORT
1084 if(pConfiguration
->DSConfig
/1000>4000)
1087 if(0xff == a_OSC_get_cal_int(ChannelNo
, RATE_1M
, &IntValue
, &useless
))
1088 printk("Read a_OSC_get_cal_int fail\n");;
1089 IntValue
=20; //When Initial value is too larget. The Pwr Meter will be down
1092 dot11Obj
.TxGainSetting
= IntValue
;
1093 dot11Obj
.TxGainSetting2
= IntValue
;
1095 LockPhyReg(&dot11Obj
);
1096 dot11Obj
.SetReg(reg
, IntValue
, ZD_CR31
);
1097 //reg->CR31 = IntValue[ChannelNo-1];
1098 UnLockPhyReg(&dot11Obj
);
1101 Status
= NDIS_STATUS_SUCCESS
;
1104 case OID_802_11_INFRASTRUCTURE_MODE
:
1105 case OID_ZDX_802_11_INFRASTRUCTURE_MODE
:
1106 ZDPRODUCTDBG("OID_802_11_INFRASTRUCTURE_MODE\r\n");
1108 if (InformationBuffer
== NULL
)
1110 Status
= (NDIS_STATUS_INVALID_LENGTH
);
1114 switch(le32_to_cpu(*(PULONG
)InformationBuffer
))
1116 case Ndis802_11IBSS
:
1117 ZDPRODUCTDBG("Ndis802_11IBSS\r\n");
1118 macp
->cardSetting
.BssType
= INDEPENDENT_BSS
;
1119 zd_writel(STA_RX_FILTER
, Rx_Filter
);
1121 case Ndis802_11Infrastructure
:
1122 case Ndis802_11AutoUnknown
:
1123 ZDPRODUCTDBG("Ndis802_11Infrastructure\r\n");
1124 macp
->cardSetting
.BssType
= INFRASTRUCTURE_BSS
;
1125 macp
->cardSetting
.AuthMode
= 0;
1126 zd_writel(STA_RX_FILTER
, Rx_Filter
);
1129 ZDPRODUCTDBG("AP_BSS\r\n");
1130 macp
->cardSetting
.BssType
= AP_BSS
;
1131 /* Set bssid = MacAddress */
1132 macp
->BSSID
[0] = macp
->macAdr
[0];
1133 macp
->BSSID
[1] = macp
->macAdr
[1];
1134 macp
->BSSID
[2] = macp
->macAdr
[2];
1135 macp
->BSSID
[3] = macp
->macAdr
[3];
1136 macp
->BSSID
[4] = macp
->macAdr
[4];
1137 macp
->BSSID
[5] = macp
->macAdr
[5];
1139 zd_writel(cpu_to_le32(*(u32
*)&macp
->macAdr
[0]), BSSID_P1
);
1140 zd_writel(cpu_to_le32(*(u32
*)&macp
->macAdr
[4]), BSSID_P2
);
1141 macp
->cardSetting
.AuthMode
= 2;//auto auth
1144 ZDPRODUCTDBG("PSEUDO_IBSS\r\n");
1145 macp
->cardSetting
.BssType
= PSEUDO_IBSS
;
1146 macp
->bPseudoIBSSMode
= 1;
1147 /* Disable beacon */
1148 //GenericUlong = reg->BCNInterval;
1149 GenericUlong
= dot11Obj
.GetReg(reg
, BCNInterval
);
1150 GenericUlong
&= ~BIT_24
;
1151 GenericUlong
&= ~BIT_25
;
1152 dot11Obj
.SetReg(reg
, GenericUlong
, BCNInterval
);
1153 dot11Obj
.SetReg(reg
, 0, Rx_Filter
);
1154 //reg->BCNInterval = GenericUlong;
1155 //zd_writel(STA_RX_FILTER, Rx_Filter);
1156 //reg->Rx_Filter = 0;
1160 zd_UpdateCardSetting(&macp
->cardSetting
);
1161 Status
= NDIS_STATUS_SUCCESS
;
1164 case OID_ZDX_802_11_SSID
:
1165 ZDPRODUCTDBG("OID_ZDX_802_11_SSID\r\n");
1167 if (InformationBufferLength
< sizeof(NDIS_802_11_SSID
))
1169 Status
= (NDIS_STATUS_INVALID_LENGTH
);
1173 pSSID
= (PNDIS_802_11_SSID
)InformationBuffer
;
1174 SSIDLen
= le32_to_cpu(pSSID
->SsidLength
);
1182 memcpy(&macp
->cardSetting
.Info_SSID
[2], pSSID
->Ssid
, SSIDLen
);
1183 macp
->cardSetting
.Info_SSID
[1] = SSIDLen
;
1184 zd1205_unlock(macp
);
1186 Status
= NDIS_STATUS_SUCCESS
;
1189 case OID_802_11_NETWORK_TYPE_IN_USE
:
1190 printk(KERN_ERR
"OID_802_11_NETWORK_TYPE_IN_USE\n");
1192 //Status = NDIS_STATUS_NOT_SUPPORTED;
1193 //Linux doesn't have NETWORK_TYPE_IN_USE variable
1194 //But we need to reture a success result to GoGo
1195 Status
= NDIS_STATUS_SUCCESS
;
1199 ZDPRODUCTDBG("OID_ZD_RD\r\n");
1201 if (le32_to_cpu(InformationBufferLength
) < sizeof(ZD_RD_STRUCT
)-4)
1203 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
1205 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
1209 pZDRD
= (PZD_RD_STRUCT
)InformationBuffer
;
1211 switch (le32_to_cpu(pZDRD
->ZDRdFuncId
))
1213 case ZDAccessPHYRegister1B
:
1214 ZDPRODUCTDBG("ZDAccessPHYRegister1B\r\n");
1216 if (le32_to_cpu(pZDRD
->ZDRdLength
) < sizeof(ZD_RD_STRUCT
))
1218 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
1219 *BytesNeeded
= (sizeof(ZD_RD_STRUCT
) + sizeof(ULONG
));
1221 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
1225 // Write PHY registers
1226 LockPhyReg(&dot11Obj
);
1228 switch(pZDRD
->Buffer
[0])
1249 IoAddress
= le32_to_cpu(pZDRD
->Buffer
[0]) << 2;
1252 //if (!NeedWriteProtection(Adapter, IoAddress, pZDRD->Buffer[1])){
1253 dot11Obj
.SetReg(reg
, IoAddress
, le32_to_cpu(pZDRD
->Buffer
[1]));
1256 ZDPRODUCTDBG("Write Phy Reg (%x) = %x\n", le32_to_cpu(IoAddress
), le32_to_cpu(pZDRD
->Buffer
[1]));
1257 UnLockPhyReg(&dot11Obj
);
1259 *BytesRead
= sizeof(ZD_RD_STRUCT
);
1263 case ZDAccessMACRegister4B
:
1264 ZDPRODUCTDBG("ZDAccessMACRegister4B\r\n");
1266 if (le32_to_cpu(pZDRD
->ZDRdLength
) < sizeof(ZD_RD_STRUCT
))
1268 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
1269 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
1271 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
1274 if (le32_to_cpu(pZDRD
->Buffer
[0]) < 0x1000)
1276 dot11Obj
.SetReg(reg
, le32_to_cpu(pZDRD
->Buffer
[0]), le32_to_cpu(pZDRD
->Buffer
[1]));
1278 //else if (!NeedWriteProtection(Adapter, pZDRD->Buffer[0], pZDRD->Buffer[1])){
1279 // dot11Obj.SetReg(reg, pZDRD->Buffer[0], (pZDRD->Buffer[1]));
1282 *BytesRead
= sizeof(ZD_RD_STRUCT
);
1284 case ZDAccessROMData
:
1285 ZDPRODUCTDBG("ZDAccessROM Write\r\n");
1287 if (le32_to_cpu(pZDRD
->ZDRdLength
) < (sizeof(ZD_RD_STRUCT
) + 4))
1289 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
) + 4);
1290 *BytesNeeded
= (sizeof(ZD_RD_STRUCT
) + 4);
1292 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
1297 int WriteLength
= le32_to_cpu(pZDRD
->Buffer
[1]);
1298 int WriteOffset
= le32_to_cpu(pZDRD
->Buffer
[0]);
1299 PUCHAR pDataPtr
= (PUCHAR
) (pZDRD
+1);
1301 PUCHAR pTmpBuffer
= 0, pOldTmpBuffer
;
1303 pTmpBuffer
= kmalloc(E2P_END
- E2P_SUBID
+1, GFP_ATOMIC
);
1307 Status
= NDIS_STATUS_RESOURCES
;
1311 pOldTmpBuffer
= pTmpBuffer
;
1313 for (i
= E2P_SUBID
; i
< E2P_END
; i
+= 4)
1315 tmpULONG
= dot11Obj
.GetReg(reg
, i
);
1316 *pTmpBuffer
= (UCHAR
)(tmpULONG
& 0xFF);
1318 *pTmpBuffer
= (UCHAR
)((tmpULONG
>> 8) & 0xFF);
1320 *pTmpBuffer
= (UCHAR
)((tmpULONG
>> 16) & 0xFF);
1322 *pTmpBuffer
= (UCHAR
)((tmpULONG
>> 24) & 0xFF);
1326 pTmpBuffer
= pOldTmpBuffer
;
1328 if ((WriteOffset
+WriteLength
) <= (E2P_END
- E2P_SUBID
+1))
1329 memcpy(pTmpBuffer
+WriteOffset
, pDataPtr
, WriteLength
);
1331 Status
= NDIS_STATUS_INVALID_LENGTH
;
1333 for (i
= E2P_SUBID
; i
<= E2P_END
; i
+= 4)
1335 tmpULONG
= *pTmpBuffer
;
1337 tmpULONG
|= ((ULONG
)(*pTmpBuffer
)) << 8;
1339 tmpULONG
|= ((ULONG
)(*pTmpBuffer
)) << 16;
1341 tmpULONG
|= ((ULONG
)(*pTmpBuffer
)) << 24;
1344 dot11Obj
.SetReg(reg
, i
, tmpULONG
);
1345 dot11Obj
.DelayUs(10);
1346 ZDPRODUCTDBG("Write 0x%x with 0x%x\n", i
, tmpULONG
);
1349 /* Update the total EEPROM content */
1350 //RamAddr is 2nd argument, it differs from Win
1351 HW_EEPROM_ACCESS(&dot11Obj
, cFIRMWARE_EEPROM_OFFSET
, cEPDATA_OFFSET
, (E2P_END
-E2P_SUBID
)/2, 1);
1352 //ZD1205_WriteE2P(&dot11Obj);
1353 kfree(pOldTmpBuffer
);
1358 ZDPRODUCTDBG("ZDROMUpdate Write\r\n");
1361 PUCHAR pImage
= (PUCHAR
)pZDRD
->Buffer
;
1362 USHORT ImageLen
= (USHORT
)le32_to_cpu(pZDRD
->ZDRdLength
)-sizeof(ZD_RD_STRUCT
)+8;
1368 if (ImageLen
> EEPROM_SIZE
)
1370 Status
= NDIS_STATUS_INVALID_LENGTH
;
1371 ZDPRODUCTDBG("ImageLen>EEPROM_SIZE in ZDROMUpdate Write\n");
1372 ZDPRODUCTDBG("ImageLen:%d,EEPROM_SIZE:%d\n",ImageLen
,EEPROM_SIZE
);
1376 for (i
= E2P_SUBID
; i
<= E2P_END
; i
+= 4)
1378 tmpULONG
= *pBuffer
;
1380 tmpULONG
|= ((ULONG
)(*pBuffer
)) << 8;
1382 tmpULONG
|= ((ULONG
)(*pBuffer
)) << 16;
1384 tmpULONG
|= ((ULONG
)(*pBuffer
)) << 24;
1387 dot11Obj
.SetReg(reg
, i
, tmpULONG
);
1388 dot11Obj
.DelayUs(10);
1391 /* Update the total EEPROM content */
1392 //RamAddr is 2nd argument, it differs from Win
1393 HW_EEPROM_ACCESS(&dot11Obj
, cFIRMWARE_EEPROM_OFFSET
, cEPDATA_OFFSET
, (E2P_END
-E2P_SUBID
)/2, 1);
1394 //ZD1205_WriteE2P(&dot11Obj);
1395 ZDPRODUCTDBG("ZDROMUpdate Write Complete\n");
1398 case ZDSetMACAddress
:
1399 ZDPRODUCTDBG("ZDSetMACAddress\r\n");
1402 u8
*p
= (u8
*)pZDRD
->Buffer
;
1407 dot11Obj
.SetReg(reg
,E2P_MACADDR_P1
,j
);
1408 dot11Obj
.DelayUs(10);
1413 dot11Obj
.SetReg(reg
,E2P_MACADDR_P2
,j
);
1414 dot11Obj
.DelayUs(10);
1416 //HW_EEPROM_ACCESS(&dot11Obj, 0, 0, EEPROM_SIZE, 1);
1417 //RamAddr is 2nd argument, it differs from Win
1418 HW_EEPROM_ACCESS(&dot11Obj
, cFIRMWARE_EEPROM_OFFSET
, cEPDATA_OFFSET
, (E2P_END
-E2P_SUBID
)/2, 1);
1419 //ZD1205_WriteE2P(&dot11Obj);
1422 case ZDEEPROMDataWrite
:
1423 ZDPRODUCTDBG("ZDEEPROMDataWrite\r\n");
1425 if(le32_to_cpu(pZDRD
->ZDRdLength
) < (sizeof(ZD_RD_STRUCT
) - 4))
1427 pZDRD
->ZDRdLength
= sizeof(ZD_RD_STRUCT
);
1428 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
1430 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
1434 //RamAddr is 2nd argument, it differs from Win
1435 /* Update the total EEPROM content */
1436 HW_EEPROM_ACCESS(&dot11Obj
, cFIRMWARE_EEPROM_OFFSET
, cEPDATA_OFFSET
, (E2P_END
-E2P_SUBID
)/2, 1);
1437 //ZD1205_WriteE2P(&dot11Obj);
1440 case ZDTxPowerGainControl
:
1441 ZDPRODUCTDBG("ZDTxPowerGainControl\r\n");
1443 if(le32_to_cpu(pZDRD
->ZDRdLength
) < (sizeof(ZD_RD_STRUCT
) - 4))
1445 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
1446 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
1448 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
1452 if(le32_to_cpu(pZDRD
->Buffer
[0]) == 0)
1454 zd1205_DecreaseTxPower(macp
, cTX_CCK
);
1456 zd1205_DecreaseTxPower(macp
, cTX_OFDM
);
1461 zd1205_IncreaseTxPower(macp
, cTX_CCK
);
1463 zd1205_IncreaseTxPower(macp
, cTX_OFDM
);
1468 case ZDGetNICAdapterTally
:
1469 printk("Clear Tally Information !!!!!!!!!!!!!!!!11\n");
1470 ZDPRODUCTDBG("ZDGetNICAdapterTally\r\n");
1475 case ZDContinuousTx
:
1476 printk(KERN_ERR
"ZDContinuousTx\n");
1478 if (le32_to_cpu(pZDRD
->ZDRdLength
) < sizeof(ZD_RD_STRUCT
))
1480 pZDRD
->ZDRdLength
= cpu_to_le32(sizeof(ZD_RD_STRUCT
));
1481 *BytesNeeded
= sizeof(ZD_RD_STRUCT
);
1483 Status
= NDIS_STATUS_BUFFER_TOO_SHORT
;
1487 macp
->bContinueTxMode
= le32_to_cpu(pZDRD
->Buffer
[0]);
1488 macp
->bContinueTx
= le32_to_cpu(pZDRD
->Buffer
[1]);
1490 /* Use the Fixed Rate instead of LastSentTxRate */
1491 //macp->LastZDContinuousTxRate = macp->cardSetting.LastSentTxRate;
1492 macp
->LastZDContinuousTxRate
= macp
->cardSetting
.FixedRate
;
1494 if ((macp
->RF_Mode
== AL7230B_RF
) && (mMacMode
!= PURE_A_MODE
)) {
1495 if (macp
->LastZDContinuousTxRate
> 3) {
1496 HW_Set_IF_Synthesizer(&dot11Obj
, 0x00093c);
1498 else if (macp
->LastZDContinuousTxRate
<= 3) {
1499 HW_Set_IF_Synthesizer(&dot11Obj
, 0x000abc);
1502 #ifdef ZDCONF_BANDEDGE_ADJUST
1503 // if((macp->RF_Mode == AL7230B_RF) &&
1504 // (mMacMode == PURE_A_MODE) &&
1505 // (macp->LastZDContinuousTxRate == 4) &&
1506 // (macp->PHY_36M_Setpoint_Flag == 0)
1508 // macp->PHY_36M_Setpoint_Flag = 1;
1509 // else if((macp->RF_Mode == AL7230B_RF) &&
1510 // (mMacMode == PURE_A_MODE) &&
1511 // (macp->LastZDContinuousTxRate != 4) &&
1512 // (macp->PHY_36M_Setpoint_Flag == 2)
1514 // macp->PHY_36M_Setpoint_Flag = 3;
1516 if(dot11Obj
.HWFeature
& BIT_21
) { //band edge adjust for calibration, the production test tool must do integration value /set point compensation for other channels which are not calibrated
1517 if( (macp
->RF_Mode
== AL7230B_RF
) &&
1518 ((4 <= macp
->LastZDContinuousTxRate
) && (macp
->LastZDContinuousTxRate
<= 9)) &&
1519 (mMacMode
!= PURE_A_MODE
) &&
1520 (macp
->cardSetting
.Channel
== 1 || macp
->cardSetting
.Channel
== 11)
1523 if(macp
->cardSetting
.Channel
== 1)
1524 HW_Set_IF_Synthesizer(&dot11Obj
, 0x000abc);
1525 LockPhyReg(&dot11Obj
);
1526 dot11Obj
.SetReg(dot11Obj
.reg
, ZD_CR128
, 0x10);
1527 dot11Obj
.SetReg(dot11Obj
.reg
, ZD_CR129
, 0x10);
1528 UnLockPhyReg(&dot11Obj
);
1530 else if((macp
->RF_Mode
== AL7230B_RF
) &&
1531 (macp
->LastZDContinuousTxRate
> 3) &&
1532 (mMacMode
!= PURE_A_MODE
))
1534 if((macp
->LastZDContinuousTxRate
> 9) ||
1535 (macp
->cardSetting
.Channel
!= 1 &&
1536 macp
->cardSetting
.Channel
!= 11))
1538 if(macp
->cardSetting
.Channel
== 1)
1539 HW_Set_IF_Synthesizer(&dot11Obj
, 0x00093c);
1540 LockPhyReg(&dot11Obj
);
1541 dot11Obj
.SetReg(&dot11Obj
.reg
, ZD_CR128
, 0x14);
1542 dot11Obj
.SetReg(&dot11Obj
, ZD_CR129
, 0x12);
1543 UnLockPhyReg(&dot11Obj
);
1546 else if((macp
->RF_Mode
== AL7230B_RF
) &&
1547 (macp
->LastZDContinuousTxRate
<=3) &&
1548 (mMacMode
!= PURE_A_MODE
))
1550 LockPhyReg(&dot11Obj
);
1551 dot11Obj
.SetReg(&dot11Obj
.reg
, ZD_CR128
, 0x14);
1552 dot11Obj
.SetReg(&dot11Obj
, ZD_CR129
, 0x12);
1553 UnLockPhyReg(&dot11Obj
);
1557 #elif !defined(ZDCONF_BANDEDGE_ADJUST)
1558 #error "Undefined ZDCONF_BANDEDGE_ADJUST"
1560 // Roger 2004-11-10 , Set for Dr.Wang request , set 0x0001c4 when CCK mode with AL2230
1561 #ifdef ZDCONF_RF_AL2230_SUPPORT
1562 if (dot11Obj
.rfMode
== AL2230_RF
|| dot11Obj
.rfMode
== AL2230S_RF
)
1564 //if (macp->cardSetting.LastSentTxRate > 3) {
1565 if (macp
->LastZDContinuousTxRate
> 3)
1567 HW_Set_IF_Synthesizer(&dot11Obj
, 0x0005a4);
1569 //else if (macp->cardSetting.LastSentTxRate <= 3) {
1570 else if (macp
->LastZDContinuousTxRate
<= 3)
1572 HW_Set_IF_Synthesizer(&dot11Obj
, 0x0001c4);
1577 ZDPRODUCTDBG("ZDContinuousTx TxMode=%d TxStart=%d TxRate=0x%x\r\n",
1578 macp
->bContinueTxMode
,
1580 macp
->LastZDContinuousTxRate
);
1583 if(le32_to_cpu(pZDRD
->Buffer
[1]) == ContTx_Start
)
1589 LockPhyReg(&dot11Obj
);
1590 dot11Obj
.SetReg(reg
, ZD1205_CR2
, 0x3F);
1591 dot11Obj
.SetReg(reg
, ZD1205_CR138
, 0x28);
1592 dot11Obj
.SetReg(reg
, ZD1205_CR33
, 0x20);
1593 // Query CR60 until change to 0x04
1597 dot11Obj
.DelayUs(10*1000);// sleep 10ms
1598 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR60
);
1600 if(tmpvalue
== 0x04)
1603 if(nLoop
== 0) printk("nLoop count down to zero. But it still fails\n");
1605 UnLockPhyReg(&dot11Obj
);
1606 switch(le32_to_cpu(pZDRD
->Buffer
[0]))
1608 case ContTx_Normal
: // Normal continous transmit
1610 ZDPRODUCTDBG("Start ContTx_Normal\n");
1612 macp
->bContinueTx
= 1;
1613 LockPhyReg(&dot11Obj
);
1614 macp
->PHYTestTimer
= 0;
1615 //ZD1205_WRITE_REGISTER(Adapter,CR122, 0xFF); 2004/10/22 mark
1616 UnLockPhyReg(&dot11Obj
);
1618 LockPhyReg(&dot11Obj
);
1619 /* In order to avoid the uninitial length problem,
1620 force to set length to 0x20.
1622 dot11Obj
.SetReg(reg
, ZD1205_CR134
, 0x20);
1624 switch (macp
->LastZDContinuousTxRate
)
1658 ZDPRODUCTDBG("RateTmp=0x%08x\n", RateTmp
);
1662 dot11Obj
.SetReg(reg
, ZD1205_CR132
, RateTmp
);
1664 //AcquireCtrOfPhyReg(Adapter);
1665 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR159
);
1666 tmpvalue
&= ~(BIT_0
+ BIT_1
);
1668 dot11Obj
.SetReg(reg
, ZD1205_CR159
, tmpvalue
);
1670 UnLockPhyReg(&dot11Obj
);
1672 dot11Obj
.SetReg(reg
, 0x644, 7);
1674 tmpvalue
= dot11Obj
.GetReg(reg
, 0x648);
1676 dot11Obj
.SetReg(reg
, 0x648, tmpvalue
);
1681 tmpChr
= macp
->LastZDContinuousTxRate
;
1682 ZDPRODUCTDBG("tmpChr=0x%x\n", tmpChr
);
1685 if (macp
->preambleMode
== 1)
1686 macp
->cardSetting
.PreambleType
= 0x00;
1687 else if (macp
->preambleMode
== 2)
1688 macp
->cardSetting
.PreambleType
= 0x20;
1691 if (macp
->cardSetting
.PreambleType
== SHORT_PREAMBLE
)
1703 if (macp->RegionCode == 0x10)
1704 tmpChr &= ~BIT_6;//USA
1705 if (macp->RegionCode == 0x40)
1706 tmpChr |= BIT_6;//japan
1710 if ( macp
->RegionCode
== 0x10 ||
1711 macp
->RegionCode
== 0x50 ||
1712 macp
->RegionCode
== 0x51 )
1713 tmpChr
&= ~BIT_6
;//USA , Isreal , Mexcio
1714 if ( macp
->RegionCode
== 0x40 ||
1715 macp
->RegionCode
== 0x30 ||
1716 macp
->RegionCode
== 0x48 ||
1717 macp
->RegionCode
== 0x32 )
1718 tmpChr
|= BIT_6
;//japan ,Europe ,Tiwan,France
1722 dot11Obj
.SetReg(reg
, ZD1205_CR5
, tmpChr
);
1723 UnLockPhyReg(&dot11Obj
);
1725 dot11Obj
.SetReg(reg
, 0x644, 3);
1728 case ContTx_CW
: // CW transmit
1729 ZDPRODUCTDBG("Start CW transmit\n");
1730 macp
->bContinueTx
= 1;
1732 LockPhyReg(&dot11Obj
);
1733 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR9
);
1735 dot11Obj
.SetReg(reg
, ZD1205_CR9
, tmpvalue
);
1736 UnLockPhyReg(&dot11Obj
);
1738 dot11Obj
.SetReg(reg
, 0x644, 0x3);
1741 // Carrier suppression
1742 case ContTx_CarrierSuppression
:
1743 ZDPRODUCTDBG("Start Carrier suppression transmit\n");
1744 macp
->bContinueTx
= 1;
1746 LockPhyReg(&dot11Obj
);
1747 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR9
);
1750 dot11Obj
.SetReg(reg
, ZD1205_CR9
, tmpvalue
);
1752 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR32
);
1754 dot11Obj
.SetReg(reg
, ZD1205_CR32
, tmpvalue
);
1755 UnLockPhyReg(&dot11Obj
);
1757 dot11Obj
.SetReg(reg
, 0x644, 0x3);
1761 ZDPRODUCTDBG("Continuous Tx mode: %d not support\n", pZDRD
->Buffer
[0]);
1769 // Roger 2004-11-10 , Set for Dr.Wang request , set 0x0001c4 when CCK mode with AL2230
1770 #ifdef ZDCONF_RF_AL2230_SUPPORT
1771 if (dot11Obj
.rfMode
== AL2230_RF
|| dot11Obj
.rfMode
== AL2230S_RF
)
1773 HW_Set_IF_Synthesizer(&dot11Obj
, 0x0005a4);
1777 LockPhyReg(&dot11Obj
);
1778 dot11Obj
.SetReg(reg
, ZD1205_CR2
, 0x26);
1779 dot11Obj
.SetReg(reg
, ZD1205_CR138
, 0xA8);
1780 dot11Obj
.SetReg(reg
, ZD1205_CR33
, 0x08);
1781 UnLockPhyReg(&dot11Obj
);
1782 switch(pZDRD
->Buffer
[0])
1784 case ContTx_Normal
: // Normal continous transmit
1785 ZDPRODUCTDBG("Stop Normal Continuous Transmit\n");
1787 macp
->bContinueTx
= 0;
1788 LockPhyReg(&dot11Obj
);
1789 macp
->PHYTestTimer
= 30;
1790 // ZD1205_WRITE_REGISTER(Adapter,CR122, 0x0);
1791 UnLockPhyReg(&dot11Obj
);
1793 if (macp
->LastZDContinuousTxRate
>= 4)
1795 LockPhyReg(&dot11Obj
);
1796 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR159
);
1797 tmpvalue
&= ~(BIT_0
+ BIT_1
+ BIT_2
);
1798 dot11Obj
.SetReg(reg
, ZD1205_CR159
, tmpvalue
);
1799 UnLockPhyReg(&dot11Obj
);
1801 dot11Obj
.SetReg(reg
, 0x644, 0);
1803 tmpvalue
= dot11Obj
.GetReg(reg
, 0x648);
1805 dot11Obj
.SetReg(reg
, 0x648, tmpvalue
);
1811 dot11Obj
.SetReg(reg
, 0x644, 0);
1813 tmpvalue
= dot11Obj
.GetReg(reg
, 0x648);
1815 dot11Obj
.SetReg(reg
, 0x648, tmpvalue
);
1819 case ContTx_CW
: // CW transmit
1820 ZDPRODUCTDBG("Stop CW transmit\n");
1821 macp
->bContinueTx
= 0;
1822 LockPhyReg(&dot11Obj
);
1823 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR9
);
1825 dot11Obj
.SetReg(reg
, ZD1205_CR9
, tmpvalue
);
1826 UnLockPhyReg(&dot11Obj
);
1827 dot11Obj
.SetReg(reg
, 0x644, 0x0);
1830 // Carrier suppression
1831 case ContTx_CarrierSuppression
:
1832 ZDPRODUCTDBG("Stop Carrier suppression transmit\n");
1833 macp
->bContinueTx
= 0;
1834 LockPhyReg(&dot11Obj
);
1835 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR9
);
1837 dot11Obj
.SetReg(reg
, ZD1205_CR9
, tmpvalue
);
1839 tmpvalue
= dot11Obj
.GetReg(reg
, ZD1205_CR32
);
1841 dot11Obj
.SetReg(reg
, ZD1205_CR32
, tmpvalue
);
1842 UnLockPhyReg(&dot11Obj
);
1844 dot11Obj
.SetReg(reg
, 0x644, 0x0);
1847 ZDPRODUCTDBG("Continuous Tx mode: %d not support\r\n", le32_to_cpu(pZDRD
->Buffer
[0]));
1851 //dot11Obj.SetReg(reg, ZD_PS_Ctrl, 0x1);
1852 //Roger 2004-11-16 SoftwareReset here to solve RX fail after TxContinue problem
1853 zd1205_device_reset(macp
);
1859 ZDPRODUCTDBG("OID_ZD_CUSTOM\r\n");
1861 pZDCustom
= (ZD_CUSTOM_STRUCT
*) InformationBuffer
;
1863 switch (le32_to_cpu(pZDCustom
->ZDFuncId
))
1865 case ZDPreambleMode
:
1866 ZDPRODUCTDBG("ZDPreambleMode\r\n");
1867 switch (le32_to_cpu(pZDCustom
->DataBuffer
[0]))
1869 case ZD_PreambleLong
:
1870 macp
->cardSetting
.PreambleType
= LONG_PREAMBLE
;
1873 case ZD_PreambleShort
:
1874 macp
->cardSetting
.PreambleType
= SHORT_PREAMBLE
;
1877 case ZD_PreambleAuto
:
1878 macp
->cardSetting
.PreambleType
= 2;
1882 case ZDAdapterRegion
:
1883 ZDPRODUCTDBG("ZDAdapterRegion\r\n");
1885 macp
->RegionCode
= (USHORT
)pZDCustom
->DataBuffer
[0];
1887 if (macp
->RegionCode
== 0)
1889 ULONG tmpvalue
= dot11Obj
.GetReg(reg
, E2P_SUBID
);
1890 macp
->RegionCode
= (USHORT
)(tmpvalue
>> 16);
1891 ZDPRODUCTDBG("Restore OperationRegionCode=0x%x\n", macp
->RegionCode
);
1894 //HW_SetRfChannel(&dot11Obj, macp->cardSetting.Channel, 1);
1897 case ZDAdapterSupportChannel
:
1900 char *pChannelNumber
= (char *)(pZDCustom
->DataBuffer
);
1901 UINT TotalChannel
= le32_to_cpu(pZDCustom
->ZDCustomLength
) - sizeof(ZD_RD_STRUCT
) + 8;
1903 printk(KERN_ERR
"ZDAdapterSupportChannel\n");
1905 if (TotalChannel
> 14)
1908 //Status = NDIS_STATUS_INVALID_LENGTH;
1909 Status
= NDIS_STATUS_SUCCESS
;
1913 if (TotalChannel
== 0)
1915 dot11Obj
.AllowedChannel
= dot11Obj
.GetReg(reg
, E2P_ALLOWED_CHANNEL
);
1916 ZDPRODUCTDBG("Restore RID_CHANNEL_LIST, dot11Obj.AllowedChannel = %x\n", dot11Obj
.AllowedChannel
);
1920 dot11Obj
.AllowedChannel
&= ~0xffff;
1922 for (i
=0; i
< TotalChannel
; i
++)
1924 dot11Obj
.AllowedChannel
|= (1 << (*(pChannelNumber
)-1));
1925 ZDPRODUCTDBG("AllowedChannel = %x\n", *(pChannelNumber
));
1929 ZDPRODUCTDBG("Set RID_CHANNEL_LIST, dot11Obj.AllowedChannel = %x\n", dot11Obj
.AllowedChannel
);
1934 ZDPRODUCTDBG("Unsupport function code: 0x%08x\r\n", (U32
) pZDCustom
->ZDFuncId
);
1941 IoAddress
= le32_to_cpu((ULONG
)(*((PULONG
)InformationBuffer
))) & 0xffffffff;
1942 IoValue
= le32_to_cpu((ULONG
)(*((PULONG
)InformationBuffer
+ 1)));
1944 ZDPRODUCTDBG("OID_ZD_IO32\r\n");
1947 if (IoAddress
& 0x8000)
1949 IoAddress
&= 0x7fff;
1951 if (IoAddress
== 0x712)
1953 /* Disable all register access */
1954 macp
->PHYTestTimer
= (UCHAR
) IoValue
;
1956 else if (IoAddress
== 0x730)
1958 macp
->PHYLowPower
= (UCHAR
) IoValue
;
1959 if (!(macp
->PHYLowPower
& BIT_1
))
1961 dot11Obj
.CR31Flag
= 0;
1962 macp
->bTraceSetPoint
= 1;
1963 HW_UpdateIntegrationValue(&dot11Obj
, dot11Obj
.Channel
,1);
1966 else if (IoAddress
== 0x903)
1970 LockPhyReg(&dot11Obj
);
1971 dot11Obj
.SetReg(reg
, ZD1205_CR30
, 0x49);
1972 UnLockPhyReg(&dot11Obj
);
1976 LockPhyReg(&dot11Obj
);
1977 dot11Obj
.SetReg(reg
, ZD1205_CR30
, 0x4b);
1978 UnLockPhyReg(&dot11Obj
);
1982 macp
->cardSetting
.FixedRate
= (UCHAR
)IoValue
;
1983 macp
->bFixedRate
= 1;
1985 else if (IoAddress
== 0xa00) {
1986 HW_Set_IF_Synthesizer(&dot11Obj
, IoValue
);
1987 LockPhyReg(&dot11Obj
);
1988 if(dot11Obj
.rfMode
!= UW2453_RF
)
1990 dot11Obj
.SetReg(reg
, ZD1205_CR203
, 0x06);
1994 dot11Obj
.SetReg(reg
, ZD1205_CR101
, 0x09);
1995 dot11Obj
.SetReg(reg
, ZD1205_CR109
, 0x13);
1996 dot11Obj
.SetReg(reg
, ZD1205_CR110
, 0x09);
1997 dot11Obj
.SetReg(reg
, ZD1205_CR111
, 0x13);
1998 dot11Obj
.SetReg(reg
, ZD1205_CR113
, 0x27);
1999 dot11Obj
.SetReg(reg
, ZD1205_CR117
, 0xFA);
2000 dot11Obj
.SetReg(reg
, ZD1205_CR46
, 0x92);
2001 dot11Obj
.SetReg(reg
, ZD1205_CR127
, 0x03);
2004 UnLockPhyReg(&dot11Obj
);
2005 dot11Obj
.CR203Flag
= 2;
2008 else if (IoAddress
== 0xa1a)
2010 macp
->EnableTxPwrCtrl
= (U8
) IoValue
;
2014 ZDPRODUCTDBG("Unknown IOAddress: 0x%08x\r\n", IoAddress
);
2020 ZDPRODUCTDBG("Unknow command: 0x%08x\r\n", IoAddress
);
2025 ZDPRODUCTDBG("OID_ZD_SETRID\r\n");
2026 rid_p
= (RID_STRUCT
*) InformationBuffer
;
2028 switch(le16_to_cpu(rid_p
->rid
))
2031 ZDPRODUCTDBG("RID: 0x%04x not support\r\n", le16_to_cpu(rid_p
->rid
));
2032 Status
= NDIS_STATUS_NOT_SUPPORTED
;
2038 case OID_ZD_SET_TALLIES
:
2039 ZDPRODUCTDBG("OID_ZD_SET_TALLIES\r\n");
2040 Status
= NDIS_STATUS_SUCCESS
;
2044 ZDPRODUCTDBG("%s Unknown OID = 0x%08x\r\n", "ZD1205EM_Custom_SetInformation", Oid
);