Private
Public Access
2
0

mraa.c: subplatforms need to be defined after platforms

This also means arm subplatforms can work and removes a plat == NULL check
which will never be true if -DUSBPLAT=ON

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2015-06-26 09:59:40 +01:00
parent 6dfe6ff6bc
commit e170e21031

View File

@@ -101,9 +101,16 @@ mraa_init()
advance_func = (mraa_adv_func_t*) malloc(sizeof(mraa_adv_func_t));
memset(advance_func, 0, sizeof(mraa_adv_func_t));
#ifdef X86PLAT
#if defined(X86PLAT)
// Use runtime x86 platform detection
platform_type = mraa_x86_platform();
#elif defined(ARMPLAT)
// Use runtime ARM platform detection
platform_type = mraa_arm_platform();
#else
#error mraa_ARCH NOTHING
#endif
#ifdef USBPLAT
// This is a platform extender so create null base platform if one doesn't already exist
if (plat == NULL) {
@@ -115,17 +122,11 @@ mraa_init()
platform_type = usb_platform_type;
}
}
#endif
#if defined(ARMPLAT)
// Use runtime ARM platform detection
platform_type = mraa_arm_platform();
#endif
if (plat == NULL) {
printf("mraa: FATAL error, failed to initialise platform\n");
return MRAA_ERROR_PLATFORM_NOT_INITIALISED;
}
#endif
syslog(LOG_NOTICE, "libmraa initialised for platform '%s' of type %d", mraa_get_platform_name(), platform_type);
return MRAA_SUCCESS;