detection: support '--device ETHER' for any ethernet device

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
Jeff Epler 2016-10-22 14:44:24 -05:00
parent 44a7008b4b
commit 25b9daf69c
2 changed files with 5 additions and 1 deletions

View file

@ -30,6 +30,7 @@
#include "serial_boards.h"
supported_board_entry_t supported_boards[] = {
{"ETHER", BOARD_ETH | BOARD_WILDCARD},
{"7I92", BOARD_ETH},
{"7I80", BOARD_ETH},
{"7I76E", BOARD_ETH},
@ -105,6 +106,8 @@ int anyio_find_dev(board_access_t *access) {
}
access->open_iface = 0;
if (supported_board->type & BOARD_WILDCARD)
access->open_iface = BOARD_WILDCARD;
if (access->type == BOARD_ANY) {
if (supported_board->type & BOARD_MULTI_INTERFACE) {
printf("ERROR: you must select transport layer for board\n");
@ -195,7 +198,7 @@ board_t *anyio_get_dev(board_access_t *access, int board_number) {
for (i = 0, j = 0; i < boards_count; i++) {
board_t *board = NULL;
board = &boards[i];
if (strncmp(access->device_name, board->llio.board_name, strlen(access->device_name)) == 0) {
if (strncmp(access->device_name, board->llio.board_name, strlen(access->device_name)) == 0 || access->open_iface & BOARD_WILDCARD) {
j++;
if (j == board_number) {
return board;

View file

@ -36,6 +36,7 @@
#define BOARD_USB (1<<4)
#define BOARD_SPI (1<<5)
#define BOARD_SER (1<<6)
#define BOARD_WILDCARD (1<<30)
typedef enum {BOARD_MODE_CPLD, BOARD_MODE_FPGA} board_mode;
typedef enum {BOARD_FLASH_NONE = 0, BOARD_FLASH_HM2, BOARD_FLASH_IO, BOARD_FLASH_GPIO, BOARD_FLASH_REMOTE, BOARD_FLASH_EPP} board_flash;