openwrt之WIFI驱动结构的一点简单分析


1. 第一层的 config.in 和 makefile文件

中,make 文件会调用

build 文件夹下的 kconfig 和makefile 文件

在包含的文件中  -DRT6352_EL_SUPPORT  表示  RT6352_EL_SUPPORT  做了宏定义了

ifeq ($(CONFIG_INTERNAL_PA_EXTERNAL_LNA),y)
EXTRA_CFLAGS += -DRT6352_EL_SUPPORT
endif


在驱动中可以找到这样的定义 :

#if defined(RT6352_EP_SUPPORT) || defined(RT6352_EL_SUPPORT)
VOID RT6352_Init_ExtPA_ExtLNA(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN ReInit)
{
ULONG GpioMode;


/* Check the gpio setting first */
RTMP_SYS_IO_READ32(0xb0000060, &GpioMode);
if ((GpioMode & 0x100000) == 0x100000)
{
GpioMode &= (~0x100000);
RTMP_SYS_IO_WRITE32(0xb0000060, GpioMode);

DBGPRINT(RT_DEBUG_ERROR,("Change as Normal Mode(0x%x)\n", GpioMode));
RTMP_SYS_IO_READ32(0xb0000060, &GpioMode);
DBGPRINT(RT_DEBUG_ERROR,("After Change, now GPIO_MODE value is 0x%x\n", GpioMode));
}


#ifdef RT6352_EP_SUPPORT
if (pAd->bExtPA)
{
UINT32 MacValue;


DBGPRINT_RAW(RT_DEBUG_ERROR, ("%s: Enable Ext-PA. init MAC \n", __FUNCTION__));
RTMP_IO_READ32(pAd, RF_CONTROL3, &MacValue);
MacValue |= 0x00000101;
RTMP_IO_WRITE32(pAd, RF_CONTROL3, MacValue);


RTMP_IO_READ32(pAd, RF_BYPASS3, &MacValue);
MacValue |= 0x00000101;
RTMP_IO_WRITE32(pAd, RF_BYPASS3, MacValue);
}
#endif /* RT6352_EP_SUPPORT */


#ifdef RT6352_EL_SUPPORT
if ((pAd->CommonCfg.PKG_ID == 1) && (pAd->NicConfig2.field.ExternalLNAForG))
{
DBGPRINT_RAW(RT_DEBUG_ERROR, ("%s: Enable Ext-LNA. \n", __FUNCTION__));


/* TFBGA Ext-LNA */
RT635xWriteRFRegister(pAd, RF_BANK4, RF_R14, 0x66);
RT635xWriteRFRegister(pAd, RF_BANK6, RF_R14, 0x66);
RT635xWriteRFRegister(pAd, RF_BANK4, RF_R17, 0x20);
RT635xWriteRFRegister(pAd, RF_BANK6, RF_R17, 0x20);
RT635xWriteRFRegister(pAd, RF_BANK4, RF_R18, 0x42);
RT635xWriteRFRegister(pAd, RF_BANK6, RF_R18, 0x42);
}
#endif /* RT6352_EL_SUPPORT */

你可能感兴趣的:(openwrt)