refactor: extract board definitions to boards.h to remove including main library header file in all submodules
Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
This commit is contained in:
parent
c7c0e4f928
commit
bf2de2cc6d
16 changed files with 10 additions and 75 deletions
2
Makefile
2
Makefile
|
|
@ -48,7 +48,7 @@ objects = common.o lbp.o bitfile.o hostmot2.o eeprom.o anyio.o eth_boards.o epp_
|
|||
objects += sserial_module.o eeprom_local.o eeprom_remote.o spi_boards.o spilbp.o main.o
|
||||
|
||||
headers = eth_boards.h pci_boards.h epp_boards.h usb_boards.h spi_boards.h anyio.h hostmot2.h lbp16.h common.h eeprom.h
|
||||
headers += lbp.h eeprom_local.h eeprom_remote.h spilbp.h bitfile.h sserial_module.h hostmot2_def.h
|
||||
headers += lbp.h eeprom_local.h eeprom_remote.h spilbp.h bitfile.h sserial_module.h hostmot2_def.h boards.h
|
||||
|
||||
$(BIN) all : $(objects)
|
||||
$(CC) -o $(BIN) $(objects) $(MATHLIB) $(LIBS)
|
||||
|
|
|
|||
61
anyio.h
61
anyio.h
|
|
@ -23,66 +23,7 @@
|
|||
#include <windef.h>
|
||||
#include "winio32/winio.h"
|
||||
#endif
|
||||
#include "hostmot2.h"
|
||||
|
||||
#define MAX_BOARDS 8
|
||||
|
||||
typedef enum {BOARD_ETH, BOARD_PCI, BOARD_EPP, BOARD_USB, BOARD_SPI} board_type;
|
||||
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;
|
||||
|
||||
typedef struct board_struct board_t;
|
||||
|
||||
struct board_struct {
|
||||
board_type type;
|
||||
board_mode mode;
|
||||
board_flash flash;
|
||||
u8 flash_id;
|
||||
u32 flash_start_address;
|
||||
int fallback_support;
|
||||
char dev_addr[16];
|
||||
|
||||
struct pci_dev *dev;
|
||||
void *base;
|
||||
int len;
|
||||
u32 mem_base;
|
||||
#ifdef _WIN32
|
||||
tagPhysStruct_t mem_handle;
|
||||
#endif
|
||||
u16 ctrl_base_addr;
|
||||
u16 data_base_addr;
|
||||
|
||||
u16 base_lo;
|
||||
u16 base_hi;
|
||||
void *region;
|
||||
void *region_hi;
|
||||
int epp_wide;
|
||||
|
||||
int (*open)(board_t *self);
|
||||
int (*close)(board_t *self);
|
||||
void (*print_info)(board_t *self);
|
||||
|
||||
llio_t llio;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *device_name;
|
||||
int list;
|
||||
int address;
|
||||
int verbose;
|
||||
int recover;
|
||||
int pci;
|
||||
int epp;
|
||||
int usb;
|
||||
int eth;
|
||||
int spi;
|
||||
char *dev_addr;
|
||||
u16 epp_base_addr;
|
||||
u16 epp_base_hi_addr;
|
||||
} board_access_t;
|
||||
|
||||
extern board_t boards[MAX_BOARDS];
|
||||
extern int boards_count;
|
||||
#include "boards.h"
|
||||
|
||||
int anyio_init(board_access_t *access);
|
||||
void anyio_cleanup(board_access_t *access);
|
||||
|
|
|
|||
1
eeprom.c
1
eeprom.c
|
|
@ -26,6 +26,7 @@
|
|||
#include "eeprom.h"
|
||||
#include "eeprom_local.h"
|
||||
#include "eeprom_remote.h"
|
||||
#include "boards.h"
|
||||
|
||||
u8 boot_block[BOOT_BLOCK_SIZE] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
|
|
|||
1
eeprom.h
1
eeprom.h
|
|
@ -19,7 +19,6 @@
|
|||
#ifndef __EEPROM_H
|
||||
#define __EEPROM_H
|
||||
|
||||
#include "anyio.h"
|
||||
#include "hostmot2.h"
|
||||
|
||||
#define ID_EEPROM_1M 0x10
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "eeprom.h"
|
||||
#include "eeprom_local.h"
|
||||
#include "bitfile.h"
|
||||
#include "anyio.h"
|
||||
#include "epp_boards.h"
|
||||
|
||||
extern board_t boards[MAX_BOARDS];
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef __EPP_BOARDS_H
|
||||
#define __EPP_BOARDS_H
|
||||
|
||||
#include "anyio.h"
|
||||
#include "boards.h"
|
||||
|
||||
#define EPP_STATUS_OFFSET 1
|
||||
#define EPP_CONTROL_OFFSET 2
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "bitfile.h"
|
||||
#include "anyio.h"
|
||||
#include "eth_boards.h"
|
||||
#include "eeprom_remote.h"
|
||||
#include "lbp16.h"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef __ETH_BOARDS_H
|
||||
#define __ETH_BOARDS_H
|
||||
|
||||
#include "anyio.h"
|
||||
#include "boards.h"
|
||||
|
||||
int eth_boards_init(board_access_t *access);
|
||||
void eth_boards_cleanup(board_access_t *access);
|
||||
|
|
|
|||
2
lbp.c
2
lbp.c
|
|
@ -28,7 +28,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "anyio.h"
|
||||
#include "boards.h"
|
||||
#include "lbp.h"
|
||||
|
||||
#ifdef __linux__
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@
|
|||
#include "libpci/pci.h"
|
||||
#endif
|
||||
|
||||
#include "anyio.h"
|
||||
#include "hostmot2.h"
|
||||
#include "boards.h"
|
||||
|
||||
#define VENDORID_MESAPCI 0x2718
|
||||
#define VENDORID_PLX 0x10B5
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include "libpci/pci.h"
|
||||
#endif
|
||||
|
||||
#include "anyio.h"
|
||||
#include "spi_boards.h"
|
||||
#include "common.h"
|
||||
#include "spilbp.h"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef __SPI_BOARDS_H
|
||||
#define __SPI_BOARDS_H
|
||||
|
||||
#include "anyio.h"
|
||||
#include "boards.h"
|
||||
|
||||
int spi_boards_init(board_access_t *access);
|
||||
void spi_boards_cleanup(board_access_t *access);
|
||||
|
|
|
|||
2
spilbp.c
2
spilbp.c
|
|
@ -22,7 +22,7 @@
|
|||
#include "libpci/pci.h"
|
||||
#endif
|
||||
|
||||
#include "anyio.h"
|
||||
#include "boards.h"
|
||||
|
||||
void spilbp_print_info() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "anyio.h"
|
||||
#include "hostmot2.h"
|
||||
|
||||
void sslbp_send_local_cmd(llio_t *llio, int interface, u32 cmd) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "anyio.h"
|
||||
#include "usb_boards.h"
|
||||
#include "common.h"
|
||||
#include "eeprom.h"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef __USB_BOARDS_H
|
||||
#define __USB_BOARDS_H
|
||||
|
||||
#include "anyio.h"
|
||||
#include "boards.h"
|
||||
|
||||
int usb_boards_init(board_access_t *access);
|
||||
void usb_boards_cleanup(board_access_t *access);
|
||||
|
|
|
|||
Loading…
Reference in a new issue