96boards.c: Added Bubblegum 96 board
- Proper board detection - Styling refactored using clang-format Signed-off-by: Fan Jiang <i@fanjiang.me> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
68e9399c4c
commit
250590e1ed
@@ -25,19 +25,20 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <mraa/common.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <mraa/common.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "arm/96boards.h"
|
||||
#include "common.h"
|
||||
|
||||
#define DT_BASE "/sys/firmware/devicetree/base"
|
||||
#define DT_BASE "/proc/device-tree"
|
||||
|
||||
#define PLATFORM_NAME_DB410C "DB410C"
|
||||
#define PLATFORM_NAME_HIKEY "HIKEY"
|
||||
#define PLATFORM_NAME_BBGUM "BBGUM"
|
||||
|
||||
int db410c_ls_gpio_pins[MRAA_96BOARDS_LS_GPIO_COUNT] = {
|
||||
36, 12, 13, 69, 115, 4, 24, 25, 35, 34, 28, 33,
|
||||
@@ -49,10 +50,15 @@ int hikey_ls_gpio_pins[MRAA_96BOARDS_LS_GPIO_COUNT] = {
|
||||
488, 489, 490, 491, 492, 415, 463, 495, 426, 433, 427, 434,
|
||||
};
|
||||
|
||||
|
||||
const char* hikey_serialdev[MRAA_96BOARDS_LS_UART_COUNT] = { "/dev/ttyAMA2", "/dev/ttyAMA3" };
|
||||
|
||||
void mraa_96boards_pininfo(mraa_board_t* board, int index, int sysfs_pin,
|
||||
char *fmt, ...)
|
||||
int bbgum_ls_gpio_pins[MRAA_96BOARDS_LS_UART_COUNT] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 155, 154 };
|
||||
|
||||
const char* bbgum_serialdev[MRAA_96BOARDS_LS_UART_COUNT] = { "/dev/ttyS3", "/dev/ttyS5" };
|
||||
|
||||
void
|
||||
mraa_96boards_pininfo(mraa_board_t* board, int index, int sysfs_pin, char* fmt, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
if (index > board->phy_pin_count)
|
||||
@@ -70,7 +76,8 @@ void mraa_96boards_pininfo(mraa_board_t* board, int index, int sysfs_pin,
|
||||
pininfo->gpio.mux_total = 0;
|
||||
}
|
||||
|
||||
mraa_board_t* mraa_96boards()
|
||||
mraa_board_t*
|
||||
mraa_96boards()
|
||||
{
|
||||
int i, pin;
|
||||
int* ls_gpio_pins = NULL;
|
||||
@@ -97,6 +104,11 @@ mraa_board_t* mraa_96boards()
|
||||
ls_gpio_pins = hikey_ls_gpio_pins;
|
||||
b->uart_dev[0].device_path = hikey_serialdev[0];
|
||||
b->uart_dev[1].device_path = hikey_serialdev[1];
|
||||
} else if (mraa_file_contains(DT_BASE "/model", "s900")) {
|
||||
b->platform_name = PLATFORM_NAME_BBGUM;
|
||||
ls_gpio_pins = bbgum_ls_gpio_pins;
|
||||
b->uart_dev[0].device_path = bbgum_serialdev[0];
|
||||
b->uart_dev[1].device_path = bbgum_serialdev[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,10 +164,8 @@ mraa_board_t* mraa_96boards()
|
||||
mraa_96boards_pininfo(b, 21, -1, "I2C1_SDA");
|
||||
mraa_96boards_pininfo(b, 22, -1, "PCM_DI");
|
||||
// GPIOs are labelled "GPIO-A" through "GPIO-L"
|
||||
for (i = 0; i < MRAA_96BOARDS_LS_GPIO_COUNT; i++)
|
||||
{
|
||||
mraa_96boards_pininfo(b, 23 + i, ls_gpio_pins ? ls_gpio_pins[i] : -1,
|
||||
"GPIO-%c", 'A'+i);
|
||||
for (i = 0; i < MRAA_96BOARDS_LS_GPIO_COUNT; i++) {
|
||||
mraa_96boards_pininfo(b, 23 + i, ls_gpio_pins ? ls_gpio_pins[i] : -1, "GPIO-%c", 'A' + i);
|
||||
}
|
||||
mraa_96boards_pininfo(b, 35, -1, "1.8v");
|
||||
mraa_96boards_pininfo(b, 36, -1, "SYS_DCIN");
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mraa_internal.h"
|
||||
#include "arm/raspberry_pi.h"
|
||||
#include "arm/beaglebone.h"
|
||||
#include "arm/banana.h"
|
||||
#include "arm/96boards.h"
|
||||
#include "arm/banana.h"
|
||||
#include "arm/beaglebone.h"
|
||||
#include "arm/raspberry_pi.h"
|
||||
#include "mraa_internal.h"
|
||||
|
||||
|
||||
mraa_platform_t
|
||||
@@ -46,21 +46,19 @@ mraa_arm_platform()
|
||||
if (strncmp(line, "Hardware", 8) == 0) {
|
||||
if (strstr(line, "BCM2708")) {
|
||||
platform_type = MRAA_RASPBERRY_PI;
|
||||
}
|
||||
else if (strstr(line, "BCM2709")) {
|
||||
} else if (strstr(line, "BCM2709")) {
|
||||
platform_type = MRAA_RASPBERRY_PI;
|
||||
}
|
||||
else if (strstr(line, "Generic AM33XX")) {
|
||||
} else if (strstr(line, "Generic AM33XX")) {
|
||||
platform_type = MRAA_BEAGLEBONE;
|
||||
}
|
||||
else if (strstr(line, "HiKey Development Board")) {
|
||||
} else if (strstr(line, "HiKey Development Board")) {
|
||||
platform_type = MRAA_96BOARDS;
|
||||
}
|
||||
else if (strstr(line, "sun7i")) {
|
||||
} else if (strstr(line, "s900")) {
|
||||
platform_type = MRAA_96BOARDS;
|
||||
} else if (strstr(line, "sun7i")) {
|
||||
if (mraa_file_contains("/sys/firmware/devicetree/base/model", "Banana Pro")) {
|
||||
platform_type = MRAA_BANANA;
|
||||
}
|
||||
else if (mraa_file_contains("/sys/firmware/devicetree/base/model", "Banana Pi")) {
|
||||
} else if (mraa_file_contains("/sys/firmware/devicetree/base/model",
|
||||
"Banana Pi")) {
|
||||
platform_type = MRAA_BANANA;
|
||||
}
|
||||
// For old kernels
|
||||
@@ -69,17 +67,20 @@ mraa_arm_platform()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
fclose(fh);
|
||||
}
|
||||
free(line);
|
||||
|
||||
/* Get compatible string from Device tree for boards that dont have enough info in /proc/cpuinfo */
|
||||
/* Get compatible string from Device tree for boards that dont have enough info in /proc/cpuinfo
|
||||
*/
|
||||
if (platform_type == MRAA_UNKNOWN_PLATFORM) {
|
||||
if (mraa_file_contains("/sys/firmware/devicetree/base/compatible", "qcom,apq8016-sbc"))
|
||||
platform_type = MRAA_96BOARDS;
|
||||
else if (mraa_file_contains("/sys/firmware/devicetree/base/model", "HiKey Development Board"))
|
||||
else if (mraa_file_contains("/sys/firmware/devicetree/base/model",
|
||||
"HiKey Development Board"))
|
||||
platform_type = MRAA_96BOARDS;
|
||||
else if (mraa_file_contains("/proc/device-tree/model", "s900"))
|
||||
platform_type = MRAA_96BOARDS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user