forked from LinuxCNC/mesaflash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hostmot2.h
95 lines (82 loc) · 2.83 KB
/
hostmot2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// Copyright (C) 2013-2014 Michael Geszkiewicz
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef __HOSTMOT2_H
#define __HOSTMOT2_H
#include "types.h"
#include "hostmot2_def.h"
typedef struct {
int index;
char name[64];
} sw_mode_t;
typedef struct {
u32 unit;
u16 sw_revision;
u16 hw_revision;
char name[4];
sw_mode_t sw_modes[256];
int sw_modes_cnt;
} sserial_device_t;
#define HM2_MAX_TAGS 30
#define ANYIO_MAX_IOPORT_CONNECTORS 8
typedef struct llio_struct llio_t;
typedef struct {
llio_t *llio;
char config_name[8];
hm2_idrom_desc_t idrom;
hm2_module_desc_t modules[HM2_MAX_MODULES];
hm2_pin_desc_t pins[HM2_MAX_PINS];
} hostmot2_t;
struct llio_struct {
int (*read)(llio_t *self, u32 addr, void *buffer, int size);
int (*write)(llio_t *self, u32 addr, void *buffer, int size);
int (*write_flash)(llio_t *self, char *bitfile_name, u32 start_address, int fix_boot_flag);
int (*verify_flash)(llio_t *self, char *bitfile_name, u32 start_address);
int (*program_fpga)(llio_t *self, char *bitfile_name);
int (*reset)(llio_t *self);
int (*reload)(llio_t *self, int fallback_flag);
int num_ioport_connectors;
int pins_per_connector;
const char *ioport_connector_name[ANYIO_MAX_IOPORT_CONNECTORS];
int num_leds;
const char *fpga_part_number;
char board_name[16];
void *board;
hostmot2_t hm2;
sserial_interface_t ss_interface[HM2_SSERIAL_MAX_INTEFACES];
sserial_device_t ss_device[HM2_SSERIAL_MAX_CHANNELS];
int verbose;
};
typedef struct {
u8 tag;
char *name[10];
} pin_name_t;
typedef struct {
char *name;
u8 tag;
} mod_name_t;
int hm2_check_cookie(llio_t *llio);
void hm2_read_idrom(hostmot2_t *hm2);
hm2_module_desc_t *hm2_find_module(hostmot2_t *hm2, u8 gtag);
void hm2_print_idrom(hostmot2_t *hm2);
void hm2_print_modules(hostmot2_t *hm2);
void hm2_print_pins(hostmot2_t *hm2);
void hm2_print_pin_file(llio_t *llio, int xml_flag);
void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source);
void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction);
void sserial_module_init(llio_t *llio);
#endif