📄 mcal.c
字号:
/* mCal.c - contains functions related to radio calibration */
/* Copyright (c) 2001 Atheros Communications, Inc., All Rights Reserved */
/*
Revsision history
--------------------
1.0 Created.
*/
#ifdef __ATH_DJGPPDOS__
#define __int64 long long
typedef unsigned long DWORD;
#endif // #ifdef __ATH_DJGPPDOS__
#include <errno.h>
#include "wlantype.h"
#include "mConfig.h"
#ifdef SPIRIT_AP
#include "misclib.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
MANLIB_API void ForceSinglePCDACTable(A_UINT32 devNum, A_UINT16 pcdac)
{
A_UINT16 temp16, i;
A_UINT32 temp32;
A_UINT32 regoffset ;
temp16 = (A_UINT16) (0x0000 | (pcdac << 8) | 0x00ff);
temp32 = (temp16 << 16) | temp16 ;
regoffset = 0x9800 + (608 << 2) ;
for (i=0; i<32; i++)
{
REGW(devNum, regoffset, temp32);
regoffset += 4;
}
return;
}
/* Return the mac address of the mac specified
wmac = 0 (for ethernet) wmac = 1 (for wireless)
instance number (used only for ethernet) to get the mac address, if more than one
ethernet mac is present.
macAddr - buffer to return the mac address
*/
MANLIB_API void getMacAddr(A_UINT32 devNum, A_UINT16 wmac, A_UINT16 instNo, A_UINT8 *macAddr)
{
A_UINT32 readVal;
//verify some of the arguments
if (checkDevNum(devNum) == FALSE) {
mError(devNum, EINVAL, "Device Number %d:getMacAddr \n", devNum);
return;
}
if (wmac > 1) {
mError(devNum, EINVAL, "Device Number %d:getMacAddr: Invalid wmac argument \n", devNum);
return;
}
if (macAddr == NULL) {
mError(devNum, EINVAL, "Device Number %d:getMacAddr: Invalid buffer address for returning mac address \n", devNum);
return;
}
#ifndef MDK_AP
// Client card can have only wmac
if (wmac == 0) {
mError(devNum, EINVAL, "Device Number %d:getMacAddr: Client card can read only WMAC address \n", devNum);
return;
}
// Read the mac address from the eeprom
readVal = eepromRead(devNum,0x1d);
macAddr[0] = (A_UINT8)(readVal & 0xff);
macAddr[1] = (A_UINT8)((readVal >> 8) & 0xff);
readVal = eepromRead(devNum,0x1e);
macAddr[2] = (A_UINT8)(readVal & 0xff);
macAddr[3] = (A_UINT8)((readVal >> 8) & 0xff);
readVal = eepromRead(devNum,0x1f);
macAddr[4] = (A_UINT8)(readVal & 0xff);
macAddr[5] = (A_UINT8)((readVal >> 8) & 0xff);
instNo = 0; // referencing to remove warning
#endif
#ifdef SPIRIT_AP
if (spiritGetMacAddr(devNum,wmac,instNo,macAddr) < 0) {
mError(devNum, EIO, "Get mac address failed \n");
return;
}
#endif // SPIRIT
#ifdef AP22_AP
mError(devNum, EIO,"Get Mac Address not implemented for AP22 \n");
#endif // AP22
#ifdef FREEDOM_AP
if (freedomGetMacAddr(devNum,wmac,instNo,macAddr) < 0) {
mError(devNum, EIO, "Get mac address failed \n");
return;
}
#endif // FREEDOM
#ifdef SENAO_AP
mError(devNum, EIO,"Get Mac Address not implemented for senao \n");
#endif // SENAO
return;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -