6 #include "menu_drv_macro.h"
8 extern zd_80211Obj_t dot11Obj
;
9 //for debug message show
10 extern U8 mDynKeyMode
;
12 struct zd1205_private
*lmacp
;
13 extern struct net_device
*g_dev
;
16 static u32 CNT_TBL
[CNT_MAX
];
19 static void copy_cnt_tally(void)
21 struct zd1205_private
*macp
= (struct zd1205_private
*)g_dev
->priv
;
23 memset(CNT_TBL
,0,sizeof(CNT_TBL
));
25 CNT_TBL
[T_bcnCnt
]=macp
->bcnCnt
;
26 CNT_TBL
[T_txCmpCnt
]=macp
->txCmpCnt
;
27 CNT_TBL
[T_dtimCnt
]=macp
->dtimCnt
;
28 CNT_TBL
[T_rxCnt
]=macp
->rxCnt
;
29 CNT_TBL
[T_retryFailCnt
]=macp
->retryFailCnt
;
30 CNT_TBL
[T_txCnt
]=macp
->txCnt
;
33 static void acquire_ctrl_of_phy_req(void *regp
)
37 tmpValue
= zd_readl(CtlReg1
);
39 zd_writel(tmpValue
, CtlReg1
);
43 static void release_ctrl_of_phy_req(void *regp
)
47 tmpValue
= zd_readl(CtlReg1
);
49 zd_writel(tmpValue
, CtlReg1
);
53 int zd1205_zd_dbg2_ioctl(struct zd1205_private
*macp
, struct zdap_ioctl
*zdreq
, u32
*ret
)
55 void *regp
= macp
->regp
;
66 if(zdreq
->addr
< CNT_MAX
-1)
67 *ret
= CNT_TBL
[zdreq
->addr
];
70 acquire_ctrl_of_phy_req(regp
);
71 tmp_value
= zd_readl(zdreq
->addr
);
72 release_ctrl_of_phy_req(regp
);
73 zdreq
->value
= tmp_value
;
76 //if (copy_to_user(ifr->ifr_data, &zdreq, sizeof (zdreq)))
81 acquire_ctrl_of_phy_req(regp
);
82 zd_writel(zdreq
->value
, zdreq
->addr
);
83 release_ctrl_of_phy_req(regp
);
85 if (zdreq
->addr
== RX_OFFSET_BYTE
)
86 macp
->rxOffset
= zdreq
->value
;
91 acquire_ctrl_of_phy_req(regp
);
92 tmp_addr
= zdreq
->addr
;
93 CRn
= ((tmp_addr
& 0xF00)>>8)*100+
94 ((tmp_addr
& 0xF0)>>4)*10+
96 if (CRn
>= 4 && CRn
<= 8)//Special handling for CR4 to CR8
98 u8 cnvtbl1
[]={0x20, 0x10, 0x14, 0x18, 0x1c};
99 tmp_addr
= cnvtbl1
[CRn
-4];
107 zdreq
->value
= zd_readl(tmp_addr
);
111 {// ZD_IOCTL_WRITE_PHY
112 zd_writel(zdreq
->value
, tmp_addr
);
114 release_ctrl_of_phy_req(regp
);
118 printk(KERN_ERR
"zd1205: error command = %x\n", zd_cmd
);