#endif
/**
+ * MAA supported platform types
+ */
+typedef enum {
+ MAA_INTEL_GALILEO_GEN1 = 0, /**< The Generation 1 Galileo platform (RevD) */
+ MAA_INTEL_GALILEO_GEN2 = 1, /**< The Generation 2 Galileo platform (RevG/H) */
+
+ MAA_UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
+} maa_platform_t;
+
+/**
* MAA return codes
*/
typedef enum {
--- /dev/null
+/*
+ * Author: Brendan Le Foll <brendan.le.foll@intel.com>
+ * Copyright (c) 2014 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#define MAA_INTEL_GALILEO_GEN_2_PINCOUNT 25
+
+maa_board_t*
+maa_intel_galileo_gen2();
${PROJECT_SOURCE_DIR}/src/spi/spi.c
${PROJECT_SOURCE_DIR}/src/aio/aio.c
${PROJECT_SOURCE_DIR}/src/intel_galileo_rev_d.c
+ ${PROJECT_SOURCE_DIR}/src/intel_galileo_gen2.c
# autogenerated version file
${CMAKE_CURRENT_BINARY_DIR}/version.c
)
--- /dev/null
+/*
+ * Author: Brendan Le Foll <brendan.le.foll@intel.com>
+ * Copyright (c) 2014 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "intel_galileo_gen2.h"
+
+maa_board_t*
+maa_intel_galileo_gen2()
+{
+ maa_board_t* b = (maa_board_t*) malloc(sizeof(maa_board_t));
+ if (b == NULL)
+ return NULL;
+
+ b->phy_pin_count = 20;
+ b->gpio_count = 14;
+ b->aio_count = 6;
+
+ b->pins = (maa_pininfo_t*) malloc(sizeof(maa_pininfo_t)*MAA_INTEL_GALILEO_GEN_2_PINCOUNT);
+
+ //BUS DEFINITIONS
+ b->i2c_bus_count = 1;
+ b->def_i2c_bus = 0;
+ b->i2c_bus[0].bus_id = 0;
+ b->i2c_bus[0].sda = 18;
+ b->i2c_bus[0].scl = 19;
+
+ b->spi_bus_count = 1;
+ b->def_spi_bus = 0;
+ b->spi_bus[0].bus_id = 1;
+ b->spi_bus[0].slave_s = 0;
+ b->spi_bus[0].cs = 10;
+ b->spi_bus[0].mosi = 11;
+ b->spi_bus[0].miso = 12;
+ b->spi_bus[0].sclk = 13;
+
+ return b;
+}
#include "maa_internal.h"
#include "intel_galileo_rev_d.h"
+#include "intel_galileo_gen2.h"
#include "gpio.h"
#include "version.h"
Py_InitializeEx(0);
PyEval_InitThreads();
#endif
- plat = maa_intel_galileo_rev_d();
+ maa_platform_t platform_type = MAA_UNKNOWN_PLATFORM;
+
+ // detect a galileo gen2 board
+ char *line = NULL;
+ // let getline allocate memory for *line
+ size_t len = 0;
+ FILE *fh = fopen("/sys/devices/virtual/dmi/id/board_name", "r");
+ if (fh != NULL) {
+ if (getline(&line, &len, fh) != -1) {
+ if (strncmp(line, "GalileoGen2", 10) == 0) {
+ platform_type = MAA_INTEL_GALILEO_GEN2;
+ } else {
+ platform_type = MAA_INTEL_GALILEO_GEN1;
+ }
+ }
+ }
+ free(line);
+ fclose(fh);
+
+ switch(platform_type) {
+ case MAA_INTEL_GALILEO_GEN2:
+ plat = maa_intel_galileo_gen2();
+ break;
+ default:
+ plat = maa_intel_galileo_rev_d();
+ }
+
return MAA_SUCCESS;
}