Corey Osgood wrote:
meh, my n00b C skills are kicking in again, I know this can be done in C++, but gcc doesn't like it here. I'm trying to differentiate between i82801 models by using a config option, in Options.lb. The config option is "I82801_MODEL", and it would expect some short string (AA, AB, CA, DBM, etc). Then, in i82801_device_ids.h, there's something like this for each model:
#if I82801_MODEL == "AA" #define I82801_PCI 0x2418 /* D30:F0, PCI Interface Hub */ #define I82801_LPC 0x2410 /* D31:F0, LPC Interface Bridge */ #define I82801_IDE 0x2411 /* D31:F1, IDE Controller */ #define I82801_USB1 0x2412 /* D31:F2, USB Controller */ #define I82801_SMBUS 0x2413 /* D31:F3, SMBUS Controller */ #define I82801_AC97 0x2415 /* D31:F5, AC'97 Audio Controller */ #define I82801_MC97 0x2416 /* D31:F6, AC'97 Modem Controller */ #endif
But, the build error:
i82801_device_ids.h:3.19: warning: Replacing undefined macro: AA with 0 i82801_device_ids.h:4.0: arithmetic type expexted
Is there any way to get this to work, or am I stuck defining dummy values for AA, AB, etc? Is there something requred beyond the quotes to tell the compiler that its supposed to be a string? I've thought about using hex strings, ie 0xAA, but it wouldn''t work for the dbm or er. Same is true for the ich version, i82801er = ICH5R.
Thanks! Corey
you could do something like
#define MODEL_AA 1 #define MODEL_AB 2 #define MODEL_CA 3 #define MODEL_DBM 4
#define I82801_MODEL MODEL_AA
#if I82801_MODEL == MODEL_AA
#endif
Probably other ways to do it though.
Ben