Private
Public Access
2
0

init: allow init to be called multiple times

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-05-06 10:42:06 +01:00
parent 2f1c493c8b
commit 5161713eaf
3 changed files with 6 additions and 2 deletions

View File

@@ -50,6 +50,7 @@ typedef enum {
MAA_ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */ MAA_ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
MAA_ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */ MAA_ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
MAA_ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */ MAA_ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
MAA_ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised
MAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */ MAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */
} maa_result_t; } maa_result_t;

View File

@@ -31,7 +31,7 @@
#include "version.h" #include "version.h"
static maa_pininfo_t* pindata; static maa_pininfo_t* pindata;
static maa_board_t* plat; static maa_board_t* plat = NULL;
const char * const char *
maa_get_version() maa_get_version()
@@ -45,6 +45,9 @@ maa_init()
/** Once more board definitions have been added, /** Once more board definitions have been added,
* A method for detecting them will need to be devised. * A method for detecting them will need to be devised.
*/ */
if (plat != NULL) {
return MAA_ERROR_PLATFORM_ALREADY_INITIALISED;
}
plat = maa_intel_galileo_rev_d(); plat = maa_intel_galileo_rev_d();
return MAA_SUCCESS; return MAA_SUCCESS;
} }