Linux中常使用的宏判断的几个例子

示例一

#ifdef CONFIG_XX1
......
#endif

 

示例二

#ifdef CONFIG_XX1
......
#else
......
#endif

 

示例三

#if defined(CONFIG_MEDIA_CONTROLLER)
......
#endif

或者

#if defined CONFIG_MEDIA_CONTROLLER
......
#endif

 

示例四

#if defined HCF_CFG_HSI_3_TOP || defined HCF_CFG_HSI_3_BOTTOM
......
#endif

或者

#if defined(HCF_CFG_HSI_3_TOP) || defined(HCF_CFG_HSI_3_BOTTOM)
......
#endif

 

示例五

#if !defined(SBE_ISR_TASKLET) && !defined(SBE_ISR_IMMEDIATE) && !defined(SBE_ISR_INLINE)
......
#endif

 

示例六

#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE
...... #endif

 

示例七

#if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0
......
#endif

 

示例八

#ifdef    CONFIG_USB_OTG
......
#elif    !defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OHCI_HCD_MODULE)
......
#else
......
#endif

 

示例九

#if PLATFORM == INTEL
#define ACON1_BASE        (WS_MODES | A1_RUN)
#elif PLATFORM == MOTOROLA
#define ACON1_BASE        (WS_MODES | A1_RUN | A1_SWAP | A2_SWAP)
#endif

 

示例十

#if defined _RTL871X_XMIT_C_
......
#elif defined _XMIT_OSDEP_C_
......
#elif defined _RTL871X_RECV_C_
......
#endif

 

示例十一

#if defined(CONFIG_1) || (defined(CONFIG_2) && !defined(CONFIG_3))
......
#endif

 

示例十二

#if defined(CONFIG_MTRR) && 0
......
#endif

 

 

 

 

 

posted @ 2015-01-21 10:12  摩斯电码  阅读(1042)  评论(0编辑  收藏  举报