- 论坛徽章:
- 0
|
5可用积分
以下是一个设置wifi usb dongle的channel的函数
zd1205_ioctl_setfreq(struct net_device *dev, struct iw_freq *frq)
{
struct zd1205_private *macp = dev->priv;
int chan = -1;
int fflag=0;
if ( (frq->e == 0) && (frq->m <= 1000) ) {
/* Setting by channel number */
chan = frq->m;
fflag=1;
} else {
/* Setting by frequency - search the table */
int mult = 1;
int i;
for (i = 0; i < (6 - frq->e); i++)
mult *= 10;
if(PURE_A_MODE != mMacMode ) {
for (i = 0; i < NUM_CHANNELS; i++)
if (frq->m == (channel_frequency * mult)) {
chan = i+1;
fflag=1;
break;
}
}
else {
for (i = 0; i < NUM_CHANNELS_11A; i++)
if (frq->m == (channel_frequency_11A[i*2+1] * mult)) {
chan = channel_frequency_11A[i*2];
fflag=1;
break;
}
}
}
。。。}
以下是结构体iw_freq的定义
/*
* A frequency
* For numbers lower than 10^9, we encode the number in 'm' and
* set 'e' to 0
* For number greater than 10^9, we divide it by the lowest power
* of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
* The power of 10 is in 'e', the result of the division is in 'm'.
*/
struct iw_freq
{
__s32 m; /* Mantissa */
__s16 e; /* Exponent */
__u8 i; /* List index (when in range struct) */
__u8 flags; /* Flags (fixed/auto) */
};
问题就在这个iw_freq里,上面那段英文怎么都看不懂,所以函数zd1205_ioctl_setfreq()里的if语句也看不懂。
有哪位高手能点拨一下?!万分感谢! |
最佳答案
查看完整内容
以下是结构体iw_freq的定义/** A frequency* For numbers lower than 10^9, we encode the number in 'm' and* set 'e' to 0* For number greater than 10^9, we divide it by the lowest power* of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...* The power of 10 is in 'e', the result of the division is in 'm'.*/这个具体驱动尝试帮你翻译一下:1、如果频率f10的9次 ...
|