Compare commits
104 commits
master
...
device-aut
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f23d728834 | ||
|
|
76384e6e17 | ||
|
|
6bb35e443b | ||
|
|
2bd4202eca | ||
|
|
cd53e573a7 | ||
|
|
ca6979fadf | ||
|
|
3c57d9dd77 | ||
|
|
bfb0c3065c | ||
|
|
6199c01029 | ||
|
|
c8f4606ab0 | ||
|
|
3633b9457f | ||
|
|
e4b6c9ecad | ||
|
|
a1fe8a333c | ||
|
|
eae3738b95 | ||
|
|
28cd6a3766 | ||
|
|
ada9aa2f25 | ||
|
|
abb3d7b8c7 | ||
|
|
e743729c1a | ||
|
|
dfdce44198 | ||
|
|
0d9357f60f | ||
|
|
c7ff674377 | ||
|
|
33d375821a | ||
|
|
706a8eaf65 | ||
|
|
a852e5c7f1 | ||
|
|
6a4fd889a7 | ||
|
|
5d460b46a9 | ||
|
|
202482a82f | ||
|
|
f09ea90ca1 | ||
|
|
18cd2ebd86 | ||
|
|
54c8a96e12 | ||
|
|
87298f4690 | ||
|
|
f02d331dca | ||
|
|
5be492fce8 | ||
|
|
279ef4a5b5 | ||
|
|
9341ab2a89 | ||
|
|
81e3d971a8 | ||
|
|
3684302a9f | ||
|
|
0294f2fac3 | ||
|
|
7e008541ed | ||
|
|
ef98977a25 | ||
|
|
8b2f060daa | ||
|
|
7ae92326f8 | ||
|
|
68b23a771b | ||
|
|
5f53bda39b | ||
|
|
da53731277 | ||
|
|
86ce0aa359 | ||
|
|
6c6d5a65d4 | ||
|
|
1bded53776 | ||
|
|
625763effa | ||
|
|
650097f4ad | ||
|
|
5aac0ec1da | ||
|
|
3bb6cbe9dd | ||
|
|
c5ba440faa | ||
|
|
e84e9f0781 | ||
|
|
c724677369 | ||
|
|
59cda6148f | ||
|
|
63e8e8f64b | ||
|
|
889ab134af | ||
|
|
803a569576 | ||
|
|
260be11cc0 | ||
|
|
9d6374af3d | ||
|
|
454e45a0bc | ||
|
|
fee7da3cf1 | ||
|
|
84fa463567 | ||
|
|
b0770c6dcd | ||
|
|
5dc2dd1c3a | ||
|
|
2e2d2138ee | ||
|
|
6013aa9022 | ||
|
|
36fa45f70a | ||
|
|
a866381c55 | ||
|
|
5e50dfcb15 | ||
|
|
ed5349aebf | ||
|
|
9e111a39df | ||
|
|
3f09836163 | ||
|
|
fa69937a89 | ||
|
|
e2d8f65a06 | ||
|
|
0a84fe9cdd | ||
|
|
e3160995da | ||
|
|
487e7b78b5 | ||
|
|
38f01ad2bb | ||
|
|
d004da0476 | ||
|
|
a533f15ea3 | ||
|
|
dae69da99b | ||
|
|
084297ebf1 | ||
|
|
9f2bb5e0fa | ||
|
|
35d69bef1c | ||
|
|
0cefd5a03a | ||
|
|
b40248b68e | ||
|
|
fe190b8be9 | ||
|
|
9fa91d7e97 | ||
|
|
137bae5f33 | ||
|
|
9cd36eb934 | ||
|
|
ca3fd5dae3 | ||
|
|
28e189e8a4 | ||
|
|
85f9328f58 | ||
|
|
392e85ef09 | ||
|
|
29759f2667 | ||
|
|
ff1684cfe6 | ||
|
|
55aa941e84 | ||
|
|
b01982d3d7 | ||
|
|
407286323a | ||
|
|
9ea86013ff | ||
|
|
3c326c9aca | ||
|
|
d598b180b6 |
31 changed files with 1287 additions and 385 deletions
8
.gitattributes
vendored
Normal file
8
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
WinIo32.* export-ignore
|
||||
libpci.dll export-ignore
|
||||
|
||||
libpci/** export-ignore
|
||||
libpci export-ignore
|
||||
|
||||
winio32/** export-ignore
|
||||
winio32 export-ignore
|
||||
11
.travis.yml
Normal file
11
.travis.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
language: c
|
||||
|
||||
compiler: gcc
|
||||
|
||||
dist: xenial
|
||||
|
||||
script:
|
||||
- make
|
||||
|
||||
before_install:
|
||||
- sudo apt-get install -y libpci-dev
|
||||
339
COPYING
Normal file
339
COPYING
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
66
Makefile
66
Makefile
|
|
@ -25,33 +25,60 @@ CC = gcc
|
|||
RM = rm -f
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
MATHLIB = -lm
|
||||
OPT = -O0
|
||||
|
||||
#DEBUG = -g -pedantic -Wall -Wextra
|
||||
#DEBUG = -g -Wall -Wextra
|
||||
DEBUG = -g
|
||||
OWNERSHIP ?= --owner root --group root
|
||||
|
||||
# default CFLAGS
|
||||
CFLAGS ?= -O0 -g
|
||||
|
||||
# mesaflash needs at least C99 to compile.
|
||||
#
|
||||
# The oldest distros we support are Debian Wheezy (EOL 2018-05-31)
|
||||
# and Ubuntu Precise (EOL 2017-04-28):
|
||||
#
|
||||
# Debian Wheezy has gcc 4.7.2, which defaults to C90 but supports C11.
|
||||
#
|
||||
# Ubuntu Precise has gcc 4.6.3, which defaults to C90 but supports
|
||||
# C99 (but does not support C11).
|
||||
#
|
||||
# So we explicitly select the newest ancient C standard that we have to
|
||||
# support here.
|
||||
CFLAGS += -std=c99
|
||||
|
||||
ifeq ($(TARGET),linux)
|
||||
INCLUDE = -I/usr/include
|
||||
$(shell which pkg-config > /dev/null)
|
||||
ifeq ($(.SHELLSTATUS), 1)
|
||||
$(error "can't find pkg-config")
|
||||
endif
|
||||
|
||||
$(shell pkg-config --exists libpci > /dev/null)
|
||||
ifeq ($(.SHELLSTATUS), 1)
|
||||
$(error "pkg-config can't find libpci")
|
||||
endif
|
||||
|
||||
LIBPCI_CFLAGS := $(shell pkg-config --cflags libpci)
|
||||
LIBPCI_LDFLAGS := $(shell pkg-config --libs libpci)
|
||||
BIN = mesaflash
|
||||
LIBS = -lpci $(MATHLIB)
|
||||
CFLAGS += -D_GNU_SOURCE
|
||||
LDFLAGS = -lm $(LIBPCI_LDFLAGS)
|
||||
CFLAGS += -D_GNU_SOURCE $(LIBPCI_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),windows)
|
||||
MINGW = c:/MinGW
|
||||
INCLUDE = -I$(MINGW)/include
|
||||
CFLAGS += -I$(MINGW)/include
|
||||
BIN = mesaflash.exe
|
||||
LIBS = -lwsock32 -lws2_32 libpci.dll winio32.dll
|
||||
DEBUG += -mno-ms-bitfields
|
||||
LDFLAGS = -lwsock32 -lws2_32 libpci.dll winio32.dll
|
||||
CFLAGS += -mno-ms-bitfields
|
||||
endif
|
||||
|
||||
CFLAGS += $(OPT) $(DEBUG) $(INCLUDE)
|
||||
|
||||
objects = common.o lbp.o lbp16.o bitfile.o hostmot2.o eeprom.o anyio.o eth_boards.o epp_boards.o usb_boards.o pci_boards.o
|
||||
objects += sserial_module.o encoder_module.o eeprom_local.o eeprom_remote.o spi_boards.o serial_boards.o
|
||||
|
||||
ifeq ($(USE_STUBS),1)
|
||||
CFLAGS += -Istubs
|
||||
objects += io.o
|
||||
endif
|
||||
|
||||
headers = eth_boards.h pci_boards.h epp_boards.h usb_boards.h spi_boards.h serial_boards.h anyio.h hostmot2.h lbp16.h types.h
|
||||
headers += common.h eeprom.h lbp.h eeprom_local.h eeprom_remote.h bitfile.h sserial_module.h hostmot2_def.h boards.h
|
||||
headers += encoder_module.h
|
||||
|
|
@ -67,7 +94,7 @@ mesaflash.o : mesaflash.c $(headers)
|
|||
$(CC) $(CFLAGS) -c mesaflash.c
|
||||
|
||||
$(BIN): mesaflash.o anyio.h $(LIBANYIO)
|
||||
$(CC) -o $(BIN) mesaflash.o $(LIBANYIO) $(LIBS)
|
||||
$(CC) $(CFLAGS) -o $(BIN) mesaflash.o $(LIBANYIO) $(LDFLAGS)
|
||||
|
||||
anyio.o : anyio.c $(headers)
|
||||
$(CC) $(CFLAGS) -c anyio.c
|
||||
|
|
@ -120,22 +147,25 @@ bitfile.o : bitfile.c $(headers)
|
|||
common.o : common.c $(headers)
|
||||
$(CC) $(CFLAGS) -c common.c
|
||||
|
||||
io.o : stubs/sys/io.c stubs/sys/io.h
|
||||
$(CC) $(CFLAGS) -c stubs/sys/io.c
|
||||
|
||||
pci_encoder_read.o : examples/pci_encoder_read.c $(LIBANYIO) $(headers)
|
||||
$(CC) $(CFLAGS) -c examples/pci_encoder_read.c
|
||||
|
||||
pci_encoder_read: pci_encoder_read.o anyio.h encoder_module.h
|
||||
$(CC) -o pci_encoder_read pci_encoder_read.o $(LIBANYIO) $(LIBS)
|
||||
$(CC) $(CFLAGS) -o pci_encoder_read pci_encoder_read.o $(LIBANYIO) $(LDFLAGS)
|
||||
|
||||
pci_analog_write.o : examples/pci_analog_write.c $(LIBANYIO) $(headers)
|
||||
$(CC) $(CFLAGS) -c examples/pci_analog_write.c
|
||||
|
||||
pci_analog_write: pci_analog_write.o anyio.h sserial_module.h
|
||||
$(CC) -o pci_analog_write pci_analog_write.o $(LIBANYIO) $(LIBS)
|
||||
$(CC) $(CFLAGS) -o pci_analog_write pci_analog_write.o $(LIBANYIO) $(LDFLAGS)
|
||||
|
||||
clean :
|
||||
$(RM) *.o $(LIBANYIO) $(BIN) pci_encoder_read pci_analog_write
|
||||
|
||||
.PHONY: install
|
||||
install: $(BIN)
|
||||
install --mode=0755 --owner root --group root --dir $(DESTDIR)/bin
|
||||
install --mode=0755 --owner root --group root $(BIN) $(DESTDIR)/bin
|
||||
install -p -D --mode=0755 $(OWNERSHIP) $(BIN) $(DESTDIR)/bin/$(BIN)
|
||||
install -p -D --mode=0644 $(OWNERSHIP) mesaflash.1 $(DESTDIR)/share/man/man1/mesaflash.1
|
||||
|
|
|
|||
20
README
20
README
|
|
@ -1,20 +0,0 @@
|
|||
mesaflash
|
||||
=========
|
||||
|
||||
Configuration and diagnostic tool for Mesa Electronics PCI(E)/ETH/EPP/USB/SPI boards
|
||||
|
||||
Quickstart:
|
||||
===========
|
||||
|
||||
From the top level directory, switch to the source directory:
|
||||
|
||||
cd mesaflash
|
||||
|
||||
In the source directory, install dependency and build:
|
||||
|
||||
sudo apt-get install libpci-dev
|
||||
make
|
||||
|
||||
to get command line syntax:
|
||||
|
||||
./mesaflash --help
|
||||
41
README.md
Normal file
41
README.md
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# mesaflash
|
||||
|
||||
Configuration and diagnostic tool for Mesa Electronics PCI(E)/ETH/EPP/USB/SPI boards
|
||||
|
||||
Quickstart:
|
||||
===========
|
||||
|
||||
MesaFlash depends on a couple of packages to build, so install those
|
||||
first:
|
||||
|
||||
sudo apt install libpci-dev pkg-config
|
||||
|
||||
You may need to install git first:
|
||||
|
||||
sudo apt install git
|
||||
|
||||
Clone MesaFlash:
|
||||
|
||||
git clone https://github.com/LinuxCNC/mesaflash.git
|
||||
|
||||
From the top level directory, switch to the source directory:
|
||||
|
||||
cd mesaflash
|
||||
|
||||
In the source directory to build MesaFlash:
|
||||
|
||||
make
|
||||
|
||||
To get command line syntax from a local make:
|
||||
|
||||
./mesaflash --help
|
||||
|
||||
To build and install MesaFlash:
|
||||
|
||||
sudo make install
|
||||
|
||||
To run an installed MesaFlash:
|
||||
|
||||
mesaflash --help
|
||||
|
||||
|
||||
21
anyio.c
21
anyio.c
|
|
@ -31,9 +31,14 @@
|
|||
|
||||
supported_board_entry_t supported_boards[] = {
|
||||
{"ETHER", BOARD_ETH | BOARD_WILDCARD},
|
||||
{"SPI", BOARD_SPI | BOARD_WILDCARD},
|
||||
{"7I92", BOARD_ETH},
|
||||
{"7I93", BOARD_ETH},
|
||||
{"7I94", BOARD_ETH},
|
||||
{"7I95", BOARD_ETH},
|
||||
{"7I96", BOARD_ETH},
|
||||
{"7I97", BOARD_ETH},
|
||||
{"7I98", BOARD_ETH},
|
||||
{"7I80", BOARD_ETH},
|
||||
{"7I76E", BOARD_ETH},
|
||||
|
||||
|
|
@ -51,10 +56,13 @@ supported_board_entry_t supported_boards[] = {
|
|||
{"4I69", BOARD_PCI},
|
||||
{"3X20", BOARD_PCI},
|
||||
|
||||
{"7C80", BOARD_MULTI_INTERFACE | BOARD_EPP | BOARD_SPI},
|
||||
{"7C81", BOARD_MULTI_INTERFACE | BOARD_EPP | BOARD_SPI},
|
||||
{"7I43", BOARD_MULTI_INTERFACE | BOARD_EPP | BOARD_USB},
|
||||
{"7I90", BOARD_MULTI_INTERFACE | BOARD_EPP | BOARD_SPI | BOARD_SER},
|
||||
{"7I64", BOARD_MULTI_INTERFACE | BOARD_USB | BOARD_SPI},
|
||||
|
||||
{"AUTO", BOARD_MULTI_INTERFACE | BOARD_WILDCARD | BOARD_USB | BOARD_EPP | BOARD_SPI | BOARD_SER | BOARD_PCI},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
|
|
@ -118,7 +126,10 @@ int anyio_find_dev(board_access_t *access) {
|
|||
if (supported_board->type & BOARD_ETH) {
|
||||
ret = eth_boards_init(access);
|
||||
access->open_iface |= BOARD_ETH;
|
||||
eth_boards_scan(access);
|
||||
ret = eth_boards_scan(access);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (supported_board->type & BOARD_PCI) {
|
||||
ret = pci_boards_init(access);
|
||||
|
|
@ -323,6 +334,14 @@ void anyio_dev_print_hm2_info(board_t *board, int xml_flag) {
|
|||
hm2_print_pin_file(&(board->llio), xml_flag);
|
||||
}
|
||||
|
||||
void anyio_dev_print_pin_descriptors(board_t *board) {
|
||||
if (board == NULL) {
|
||||
return;
|
||||
}
|
||||
hm2_read_idrom(&(board->llio.hm2));
|
||||
hm2_print_pin_descriptors(&board->llio);
|
||||
}
|
||||
|
||||
void anyio_dev_print_sserial_info(board_t *board) {
|
||||
if (board == NULL) {
|
||||
return;
|
||||
|
|
|
|||
1
anyio.h
1
anyio.h
|
|
@ -36,6 +36,7 @@ int anyio_dev_set_remote_ip(board_t *board, char *lbp16_set_ip_addr);
|
|||
int anyio_dev_reload(board_t *board, int fallback_flag);
|
||||
int anyio_dev_reset(board_t *board);
|
||||
void anyio_dev_print_hm2_info(board_t *board, int xml_flag);
|
||||
void anyio_dev_print_pin_descriptors(board_t *board);
|
||||
void anyio_dev_print_sserial_info(board_t *board);
|
||||
void anyio_bitfile_print_info(char *bitfile_name, int verbose_flag);
|
||||
|
||||
|
|
|
|||
27
debian/changelog
vendored
27
debian/changelog
vendored
|
|
@ -1,8 +1,25 @@
|
|||
mesaflash (3.3.0~pre) UNRELEASED; urgency=low
|
||||
mesaflash (3.4.0~pre0-1) UNRELEASED; urgency=medium
|
||||
|
||||
-- Michael Geszkiewicz <micges@wp.pl> 27 Sep 2015 19:24:42 -0500
|
||||
* mesaflash is now maintained by the LinuxCNC organization.
|
||||
|
||||
mesaflash (3.2.0) UNRELEASED; urgency=low
|
||||
-- LinuxCNC Developers <emc-developers@lists.sourceforge.net> Thu, 23 Apr 2020 10:34:49 -0600
|
||||
|
||||
mesaflash (3.3.0~pre0+dfsg-0) stable; urgency=low
|
||||
|
||||
* support Mesa 7i93 ethernet board
|
||||
* support Mesa 7i96 ethernet board
|
||||
* Verify firmware after writing
|
||||
* Many bug fixes
|
||||
|
||||
-- Sebastian Kuzminsky <seb@highlab.com> Tue, 27 Jun 2017 21:52:31 -0600
|
||||
|
||||
mesaflash (3.2.1) stable; urgency=low
|
||||
|
||||
* Fix some compile warnings and link issues on Debian Stretch.
|
||||
|
||||
-- Sebastian Kuzminsky <seb@highlab.com> Tue, 27 Jun 2017 10:25:59 -0600
|
||||
|
||||
mesaflash (3.2.0) stable; urgency=low
|
||||
|
||||
* Don't check bitfile destinations while gpio recovering 6i24/6i25 boards
|
||||
* Use modules base address from module descriptor, not from regmap
|
||||
|
|
@ -16,7 +33,7 @@ mesaflash (3.2.0) UNRELEASED; urgency=low
|
|||
|
||||
-- Michael Geszkiewicz <micges@wp.pl> 27 Sep 2015 19:24:42 -0500
|
||||
|
||||
mesaflash (3.1.0) UNRELEASED; urgency=low
|
||||
mesaflash (3.1.0) stable; urgency=low
|
||||
|
||||
* First stable release.
|
||||
* Support 7i90HD under linux in SPI and rs422 mode
|
||||
|
|
@ -41,7 +58,7 @@ mesaflash (3.1.0) UNRELEASED; urgency=low
|
|||
|
||||
-- Michael Geszkiewicz <micges@wp.pl> Sat, 24 Nov 2014 01:07:22 -0500
|
||||
|
||||
mesaflash (3.0.0) UNRELEASED; urgency=low
|
||||
mesaflash (3.0.0) stable; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
|
|
|
|||
2
debian/compat
vendored
2
debian/compat
vendored
|
|
@ -1 +1 @@
|
|||
7
|
||||
9
|
||||
|
|
|
|||
8
debian/control
vendored
8
debian/control
vendored
|
|
@ -1,13 +1,15 @@
|
|||
Source: mesaflash
|
||||
Maintainer: Michael Geszkiewicz <micges@wp.pl>
|
||||
Maintainer: LinuxCNC Developers <emc-developers@lists.sourceforge.net>
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.4
|
||||
Build-Depends: libpci-dev, debhelper
|
||||
Build-Depends: libpci-dev, debhelper (>= 9), pkg-config
|
||||
Vcs-Browser: https://github.com/linuxcnc/mesaflash
|
||||
Vcs-git: https://github.com/LinuxCNC/mesaflash.git -b master
|
||||
|
||||
Package: mesaflash
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Mesa Electronics utility tool
|
||||
Configuration and diagnostic tool for
|
||||
Mesa Electronics PCI(E)/ETH/EPP/USB boards
|
||||
Mesa Electronics PCI(E)/ETH/EPP/USB/SPI boards
|
||||
|
|
|
|||
35
debian/rules
vendored
35
debian/rules
vendored
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/make -f
|
||||
include /usr/share/dpkg/pkg-info.mk
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
|
@ -6,34 +7,12 @@
|
|||
override_dh_auto_install:
|
||||
$(MAKE) DESTDIR=$$(pwd)/debian/mesaflash/usr install
|
||||
|
||||
PKD = $(abspath $(dir $(MAKEFILE_LIST)))
|
||||
PKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
|
||||
UVER = $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
|
||||
DTYPE = +dfsg
|
||||
VER ?= $(subst $(DTYPE),,$(UVER))
|
||||
|
||||
.PHONY: get-orig-source
|
||||
get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE))
|
||||
get-orig-source: $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz
|
||||
|
||||
$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz:
|
||||
git archive HEAD | xz --compress > $@
|
||||
|
||||
$(PKG)_$(VER)$(DTYPE).orig.tar.xz:
|
||||
@echo "# Downloading..."
|
||||
uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
|
||||
$(if $(wildcard $(PKG)-$(VER)),$(error $(PKG)-$(VER) exist, aborting..))
|
||||
@echo "# Extracting..."
|
||||
mkdir $(PKG)-$(VER) \
|
||||
&& tar -xf $(PKG)_$(VER).orig.tar.* --directory $(PKG)-$(VER) --strip-components 1 \
|
||||
|| $(RM) -r $(PKG)-$(VER)
|
||||
@echo "# Cleaning-up..."
|
||||
cd $(PKG)-$(VER) \
|
||||
&& $(RM) -r -v \
|
||||
debian \
|
||||
winio32 \
|
||||
WinIo32.* \
|
||||
libpci.dll \
|
||||
libpci
|
||||
#$(RM) -v $(PKG)_$(VER).orig.tar.*
|
||||
@echo "# Packing..."
|
||||
find -L "$(PKG)-$(VER)" -xdev -type f -print | LC_ALL=C sort \
|
||||
| XZ_OPT="-6v" tar -caf "$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
|
||||
&& $(RM) -r "$(PKG)-$(VER)"
|
||||
override_dh_clean:
|
||||
rm -rf winio32 WinIo32.* libpci.dll libpci
|
||||
dh_clean
|
||||
|
|
|
|||
5
debian/watch
vendored
5
debian/watch
vendored
|
|
@ -1,3 +1,4 @@
|
|||
version=3
|
||||
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/mesaflash-$1\.tar\.gz/ \
|
||||
https://github.com/micges/mesaflash/tags .*/v?(\d\S*)\.tar\.gz
|
||||
opts=\
|
||||
uversionmangle=s/-pre/~pre/,\
|
||||
filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/mesaflash-$1\.tar\.gz/ https://github.com/LinuxCNC/mesaflash/tags .*/v?(\d\S*)\.tar\.gz
|
||||
|
|
|
|||
1
eeprom.c
1
eeprom.c
|
|
@ -26,6 +26,7 @@
|
|||
#include "eeprom_local.h"
|
||||
#include "eeprom_remote.h"
|
||||
#include "boards.h"
|
||||
#include "bitfile.h"
|
||||
|
||||
u8 boot_block[BOOT_BLOCK_SIZE] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
|
|
|||
151
eth_boards.c
151
eth_boards.c
|
|
@ -133,6 +133,8 @@ static int eth_board_close(board_t *board) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Look for an Ethernet board.
|
||||
// Returns 0 if it finds one, -1 if it doesn't find one.
|
||||
static int eth_scan_one_addr(board_access_t *access) {
|
||||
lbp16_cmd_addr packet, packet2;
|
||||
int send = 0, recv = 0, ret = 0;
|
||||
|
|
@ -144,7 +146,7 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
recv = lbp16_recv_packet(&cookie, sizeof(cookie));
|
||||
|
||||
if ((recv > 0) && (cookie == HM2_COOKIE)) {
|
||||
char buff[20];
|
||||
char buff[16];
|
||||
board_t *board = &boards[boards_count];
|
||||
|
||||
board_init_struct(board);
|
||||
|
|
@ -180,6 +182,7 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I80DB-25", 9) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
|
|
@ -198,13 +201,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I80HD-16", 9) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
|
|
@ -222,13 +225,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I80HD-25", 9) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
|
|
@ -246,13 +249,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I76E-16", 9) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
|
|
@ -270,13 +273,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I92", 4) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
|
|
@ -293,13 +296,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I93", 4) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
|
|
@ -316,23 +319,21 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
} else if (strncmp(buff, "7I96", 4) == 0) {
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I94", 4) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
strncpy(board->llio.board_name, buff, 16);
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 13;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
board->llio.ioport_connector_name[1] = "TB1";
|
||||
board->llio.ioport_connector_name[2] = "TB2";
|
||||
board->llio.ioport_connector_name[3] = "TB3";
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 21;
|
||||
board->llio.ioport_connector_name[0] = "Expansion+Serial 0..1";
|
||||
board->llio.ioport_connector_name[1] = "Serial 1..7";
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.read = ð_read;
|
||||
|
|
@ -341,20 +342,116 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I95", 4) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
strncpy(board->llio.board_name, buff, 16);
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 29;
|
||||
board->llio.ioport_connector_name[0] = "Step/DIR+Serial+Encoders";
|
||||
board->llio.ioport_connector_name[1] = "I/O+Expansion";
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.read = ð_read;
|
||||
board->llio.write = ð_write;
|
||||
board->llio.write_flash = &remote_write_flash;
|
||||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I96", 4) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
strncpy(board->llio.board_name, buff, 16);
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 17;
|
||||
board->llio.ioport_connector_name[0] = "TB3";
|
||||
board->llio.ioport_connector_name[1] = "TB1/TB2";
|
||||
board->llio.ioport_connector_name[2] = "P1";
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.read = ð_read;
|
||||
board->llio.write = ð_write;
|
||||
board->llio.write_flash = &remote_write_flash;
|
||||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I97", 4) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
strncpy(board->llio.board_name, buff, 16);
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 17;
|
||||
board->llio.ioport_connector_name[0] = "TB1/TB2/TB3";
|
||||
board->llio.ioport_connector_name[1] = "TB4/TB5";
|
||||
board->llio.ioport_connector_name[2] = "P1";
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.read = ð_read;
|
||||
board->llio.write = ð_write;
|
||||
board->llio.write_flash = &remote_write_flash;
|
||||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else if (strncmp(buff, "7I98", 4) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||
strncpy(board->llio.board_name, buff, 16);
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 17;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
board->llio.ioport_connector_name[1] = "P2";
|
||||
board->llio.ioport_connector_name[2] = "P3";
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.read = ð_read;
|
||||
board->llio.write = ð_write;
|
||||
board->llio.write_flash = &remote_write_flash;
|
||||
board->llio.verify_flash = &remote_verify_flash;
|
||||
board->llio.reset = &lbp16_board_reset;
|
||||
board->llio.reload = &lbp16_board_reload;
|
||||
board->open = ð_board_open;
|
||||
board->close = ð_board_close;
|
||||
board->print_info = ð_print_info;
|
||||
board->flash = BOARD_FLASH_REMOTE;
|
||||
board->fallback_support = 1;
|
||||
board->llio.verbose = access->verbose;
|
||||
boards_count ++;
|
||||
} else {
|
||||
printf("Unsupported ethernet device %s at %s\n", buff, eth_socket_get_src_ip());
|
||||
ret = -1;
|
||||
}
|
||||
boards_count++;
|
||||
|
||||
eth_socket_nonblocking();
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -403,10 +500,13 @@ void eth_boards_cleanup(board_access_t *access) {
|
|||
close(sd);
|
||||
}
|
||||
|
||||
void eth_boards_scan(board_access_t *access) {
|
||||
// Scan for Ethernet board(s).
|
||||
// Returns 0 if it found one, -1 on failure.
|
||||
int eth_boards_scan(board_access_t *access) {
|
||||
char addr[16];
|
||||
int i;
|
||||
char *ptr;
|
||||
int r = 0;
|
||||
|
||||
if (access->address == 0) {
|
||||
access->dev_addr = LBP16_HW_IP;
|
||||
|
|
@ -419,28 +519,37 @@ void eth_boards_scan(board_access_t *access) {
|
|||
int size;
|
||||
if (WSAStringToAddress(access->dev_addr, AF_INET, NULL, (struct sockaddr *)&ss, &size) != 0) {
|
||||
#endif
|
||||
return;
|
||||
return -1;
|
||||
};
|
||||
|
||||
eth_socket_nonblocking();
|
||||
|
||||
if (access->address == 1) {
|
||||
eth_socket_set_dest_ip(access->dev_addr);
|
||||
eth_scan_one_addr(access);
|
||||
r = eth_scan_one_addr(access);
|
||||
} else {
|
||||
strncpy(addr, access->dev_addr, 16);
|
||||
ptr = strrchr(addr, '.');
|
||||
*ptr = '\0';
|
||||
|
||||
// We're scanning for boards, return Success (0) if we find at
|
||||
// least one, return Fail (-1) if we don't find any.
|
||||
r = -1;
|
||||
|
||||
for (i = 1; i < 255; i++) {
|
||||
char addr_name[32];
|
||||
int this_r;
|
||||
|
||||
sprintf(addr_name, "%s.%d", addr, i);
|
||||
eth_socket_set_dest_ip(addr_name);
|
||||
eth_scan_one_addr(access);
|
||||
this_r = eth_scan_one_addr(access);
|
||||
if (this_r == 0) {
|
||||
r = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
eth_socket_blocking();
|
||||
return r;
|
||||
}
|
||||
|
||||
void eth_print_info(board_t *board) {
|
||||
|
|
@ -549,7 +658,7 @@ void eth_print_info(board_t *board) {
|
|||
|
||||
printf(" [space 6] LBP16 control/status:\n");
|
||||
printf(" packets received: all %d, UDP %d, bad %d\n", stat_area.RXPacketCount, stat_area.RXGoodCount, stat_area.RXBadCount);
|
||||
printf(" packets sended: all %d, UDP %d, bad %d\n", stat_area.TXPacketCount, stat_area.TXGoodCount, stat_area.TXBadCount);
|
||||
printf(" packets sent: all %d, UDP %d, bad %d\n", stat_area.TXPacketCount, stat_area.TXGoodCount, stat_area.TXBadCount);
|
||||
printf(" parse errors: %d, mem errors %d, write errors %d\n", stat_area.LBPParseErrors, stat_area.LBPMemErrors, stat_area.LBPWriteErrors);
|
||||
printf(" error flags: 0x%04X\n", stat_area.ErrorReg);
|
||||
printf(" debug LED ptr: 0x%04X\n", stat_area.DebugLEDPtr);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
int eth_boards_init(board_access_t *access);
|
||||
void eth_boards_cleanup(board_access_t *access);
|
||||
void eth_boards_scan(board_access_t *access);
|
||||
int eth_boards_scan(board_access_t *access);
|
||||
void eth_print_info(board_t *board);
|
||||
int eth_send_packet(void *packet, int size);
|
||||
int eth_recv_packet(void *buffer, int size);
|
||||
|
|
|
|||
|
|
@ -22,23 +22,23 @@
|
|||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "../anyio.h"
|
||||
#include "../sserial_module.h"
|
||||
#ifdef __linux__
|
||||
#include <pci/pci.h>
|
||||
#include <unistd.h>
|
||||
#elif _WIN32
|
||||
#include "libpci/pci.h"
|
||||
#endif
|
||||
|
||||
extern int usleep(useconds_t usec); // static global access variable conflicts with POSIX function in unistd.h
|
||||
|
||||
static int device_flag;
|
||||
static int instance_flag;
|
||||
static int instance = 0;
|
||||
static int delay_flag;
|
||||
static int delay = 50;
|
||||
static int verbose_flag;
|
||||
static board_access_t access;
|
||||
static board_access_t board_access;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"device", required_argument, 0, 'd'},
|
||||
|
|
@ -87,9 +87,9 @@ int process_cmd_line(int argc, char *argv[]) {
|
|||
printf("Error: multiply --device option\n");
|
||||
exit(-1);
|
||||
}
|
||||
access.device_name = optarg;
|
||||
board_access.device_name = optarg;
|
||||
for (i = 0; optarg[i] != '\0'; i++)
|
||||
access.device_name[i] = toupper(access.device_name[i]);
|
||||
board_access.device_name[i] = toupper(board_access.device_name[i]);
|
||||
|
||||
device_flag++;
|
||||
}
|
||||
|
|
@ -143,18 +143,18 @@ int main(int argc, char *argv[]) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
access.verbose = verbose_flag;
|
||||
board_access.verbose = verbose_flag;
|
||||
|
||||
if (anyio_init(&access) != 0) { // init library
|
||||
if (anyio_init(&board_access) != 0) { // init library
|
||||
return -1;
|
||||
}
|
||||
ret = anyio_find_dev(&access); // find board
|
||||
ret = anyio_find_dev(&board_access); // find board
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
board = anyio_get_dev(&access, 1); // if found the get board handle
|
||||
board = anyio_get_dev(&board_access, 1); // if found the get board handle
|
||||
if (board == NULL) {
|
||||
printf("No %s board found\n", access.device_name);
|
||||
printf("No %s board found\n", board_access.device_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
board->close(board); // close board communication
|
||||
|
||||
anyio_cleanup(&access); // close library
|
||||
anyio_cleanup(&board_access); // close library
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,23 +22,23 @@
|
|||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "../anyio.h"
|
||||
#include "../encoder_module.h"
|
||||
#ifdef __linux__
|
||||
#include <pci/pci.h>
|
||||
#include <unistd.h>
|
||||
#elif _WIN32
|
||||
#include "libpci/pci.h"
|
||||
#endif
|
||||
|
||||
extern int usleep(useconds_t usec); // static global access variable conflicts with POSIX function in unistd.h
|
||||
|
||||
static int device_flag;
|
||||
static int instance_flag;
|
||||
static int instance = 0;
|
||||
static int delay_flag;
|
||||
static int delay = 50;
|
||||
static int verbose_flag;
|
||||
static board_access_t access;
|
||||
static board_access_t board_access;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"device", required_argument, 0, 'd'},
|
||||
|
|
@ -87,9 +87,9 @@ int process_cmd_line(int argc, char *argv[]) {
|
|||
printf("Error: multiply --device option\n");
|
||||
exit(-1);
|
||||
}
|
||||
access.device_name = optarg;
|
||||
board_access.device_name = optarg;
|
||||
for (i = 0; optarg[i] != '\0'; i++)
|
||||
access.device_name[i] = toupper(access.device_name[i]);
|
||||
board_access.device_name[i] = toupper(board_access.device_name[i]);
|
||||
|
||||
device_flag++;
|
||||
}
|
||||
|
|
@ -141,18 +141,18 @@ int main(int argc, char *argv[]) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
access.verbose = verbose_flag;
|
||||
board_access.verbose = verbose_flag;
|
||||
|
||||
if (anyio_init(&access) != 0) { // init library
|
||||
if (anyio_init(&board_access) != 0) { // init library
|
||||
return -1;
|
||||
}
|
||||
ret = anyio_find_dev(&access); // find board
|
||||
ret = anyio_find_dev(&board_access); // find board
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
board = anyio_get_dev(&access, 1); // if found the get board handle
|
||||
board = anyio_get_dev(&board_access, 1); // if found the get board handle
|
||||
if (board == NULL) {
|
||||
printf("No %s board found\n", access.device_name);
|
||||
printf("No %s board found\n", board_access.device_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ int main(int argc, char *argv[]) {
|
|||
fail0:
|
||||
board->close(board); // close board communication
|
||||
|
||||
anyio_cleanup(&access); // close library
|
||||
anyio_cleanup(&board_access); // close library
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
340
hostmot2.c
340
hostmot2.c
|
|
@ -1,5 +1,6 @@
|
|||
//
|
||||
// Copyright (C) 2013-2014 Michael Geszkiewicz
|
||||
// Copyright (C) 2018 Sebastian Kuzminsky
|
||||
//
|
||||
// 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
|
||||
|
|
@ -29,7 +30,7 @@ void hm2_read_idrom(hostmot2_t *hm2) {
|
|||
printf("ERROR: no HOSTMOT2 firmware found. %X\n", cookie);
|
||||
return;
|
||||
}
|
||||
// check if it was already readed
|
||||
// check if it was already read
|
||||
if (strncmp(hm2->config_name, "HOSTMOT2", 8) == 0)
|
||||
return;
|
||||
|
||||
|
|
@ -46,65 +47,6 @@ void hm2_read_idrom(hostmot2_t *hm2) {
|
|||
}
|
||||
}
|
||||
|
||||
const char *hm2_hz_to_mhz(u32 freq_hz) {
|
||||
static char mhz_str[20];
|
||||
int r;
|
||||
int freq_mhz, freq_mhz_fractional;
|
||||
|
||||
freq_mhz = freq_hz / (1000*1000);
|
||||
freq_mhz_fractional = (freq_hz / 1000) % 1000;
|
||||
r = snprintf(mhz_str, sizeof(mhz_str), "%d.%03d", freq_mhz, freq_mhz_fractional);
|
||||
if (r >= sizeof(mhz_str)) {
|
||||
printf("too many MHz!\n");
|
||||
return "(unpresentable)";
|
||||
}
|
||||
|
||||
return mhz_str;
|
||||
}
|
||||
|
||||
const char *hm2_get_general_function_name(int gtag) {
|
||||
switch (gtag) {
|
||||
case HM2_GTAG_IRQ_LOGIC: return "IRQ logic";
|
||||
case HM2_GTAG_WATCHDOG: return "Watchdog";
|
||||
case HM2_GTAG_IOPORT: return "IOPort";
|
||||
case HM2_GTAG_ENCODER: return "Encoder";
|
||||
case HM2_GTAG_STEPGEN: return "StepGen";
|
||||
case HM2_GTAG_PWMGEN: return "PWMGen";
|
||||
case HM2_GTAG_SPI: return "SPI";
|
||||
case HM2_GTAG_SSI: return "SSI";
|
||||
case HM2_GTAG_UART_TX: return "UART Transmit Channel";
|
||||
case HM2_GTAG_UART_RX: return "UART Receive Channel";
|
||||
case HM2_GTAG_TRAM: return "TrnslationRAM";
|
||||
case HM2_GTAG_MUXED_ENCODER: return "Muxed Encoder";
|
||||
case HM2_GTAG_MUXED_ENCODER_SEL: return "Muxed Encoder Select";
|
||||
case HM2_GTAG_BSPI: return "Buffered SPI Interface";
|
||||
case HM2_GTAG_DBSPI: return "DBSPI";
|
||||
case HM2_GTAG_DPLL: return "DPLL";
|
||||
case HM2_GTAG_MUXED_ENCODER_MIM: return "Muxed Encoder MIM";
|
||||
case HM2_GTAG_MUXED_ENCODER_SEL_MIM: return "Muxed Encoder Select MIM";
|
||||
case HM2_GTAG_TPPWM: return "ThreePhasePWM";
|
||||
case HM2_GTAG_WAVEGEN: return "WaveGen";
|
||||
case HM2_GTAG_DAQ_FIFO: return "DAQ FIFO";
|
||||
case HM2_GTAG_BIN_OSC: return "BIN OSC";
|
||||
case HM2_GTAG_BIN_DMDMA: return "BIN DMDMA";
|
||||
case HM2_GTAG_BISS: return "BISS";
|
||||
case HM2_GTAG_FABS: return "FABS";
|
||||
case HM2_GTAG_HM2DPLL: return "HM2DPLL";
|
||||
case HM2_GTAG_LIOPORT: return "LIOPORT";
|
||||
case HM2_GTAG_LED: return "LED";
|
||||
case HM2_GTAG_RESOLVER: return "Resolver";
|
||||
case HM2_GTAG_SSERIAL: return "Smart Serial Interface";
|
||||
case HM2_GTAG_TWIDDLER: return "TWIDDLER";
|
||||
case HM2_GTAG_XFORMER: return "Transformer";
|
||||
default: {
|
||||
static char unknown[100];
|
||||
snprintf(unknown, 100, "(unknown-gtag-%d)", gtag);
|
||||
printf("Firmware contains unknown function (gtag-%d)/n", gtag);
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char* hm2_get_pin_secondary_name(hm2_pin_desc_t *pin) {
|
||||
static char unknown[100];
|
||||
int sec_pin = pin->sec_pin & 0x7F; // turn off the "pin is an output" bit
|
||||
|
|
@ -174,6 +116,7 @@ static const char* hm2_get_pin_secondary_name(hm2_pin_desc_t *pin) {
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case HM2_GTAG_STEPGEN:
|
||||
// FIXME: these depend on the stepgen mode
|
||||
switch (sec_pin) {
|
||||
|
|
@ -220,6 +163,76 @@ static const char* hm2_get_pin_secondary_name(hm2_pin_desc_t *pin) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case HM2_GTAG_INMUX:
|
||||
if (pin->sec_pin & 0x80){ // Output pin codes
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "muxdata";
|
||||
}
|
||||
break;
|
||||
}else{ // INput Pin Codes
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "addr0";
|
||||
case 0x2: return "addr1";
|
||||
case 0x3: return "addr2";
|
||||
case 0x4: return "addr3";
|
||||
case 0x5: return "addr4";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HM2_GTAG_INM:
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "input0";
|
||||
case 0x2: return "input1";
|
||||
case 0x3: return "input2";
|
||||
case 0x4: return "input3";
|
||||
case 0x5: return "input4";
|
||||
case 0x6: return "input5";
|
||||
case 0x7: return "input6";
|
||||
case 0x8: return "input7";
|
||||
case 0x9: return "input8";
|
||||
case 0xA: return "input9";
|
||||
case 0xB: return "input10";
|
||||
case 0xC: return "input11";
|
||||
case 0xD: return "input12";
|
||||
case 0xE: return "input13";
|
||||
case 0xF: return "input14";
|
||||
case 0x10: return "input15";
|
||||
case 0x11: return "input16";
|
||||
case 0x12: return "input17";
|
||||
case 0x13: return "input18";
|
||||
case 0x14: return "input19";
|
||||
case 0x15: return "input20";
|
||||
case 0x16: return "input21";
|
||||
case 0x17: return "input22";
|
||||
case 0x18: return "input23";
|
||||
case 0x19: return "input24";
|
||||
case 0x1A: return "input25";
|
||||
case 0x1B: return "input26";
|
||||
case 0x1C: return "input27";
|
||||
case 0x1D: return "input28";
|
||||
case 0x1E: return "input29";
|
||||
case 0x1F: return "input30";
|
||||
case 0x20: return "input31";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_XYMOD:
|
||||
if (pin->sec_pin & 0x80){ // Output pin codes
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "datax";
|
||||
case 0x2: return "datay";
|
||||
case 0x3: return "clk";
|
||||
case 0x4: return "sync";
|
||||
}
|
||||
break;
|
||||
}else{ // INput Pin Codes
|
||||
switch (sec_pin) {
|
||||
case 0x5: return "status";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case HM2_GTAG_BSPI:
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "/Frame";
|
||||
|
|
@ -318,86 +331,6 @@ void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction) {
|
|||
hm2->llio->write(hm2->llio, addr + HM2_MOD_OFFS_GPIO_DDR + (pin_number / 24)*4, &data, sizeof(data));
|
||||
}
|
||||
|
||||
void hm2_print_idrom(hostmot2_t *hm2) {
|
||||
printf("IDRom:\n");
|
||||
printf(" IDRom Type: 0x%02X\n", hm2->idrom.idrom_type);
|
||||
printf(" Offset to Modules: 0x%08X\n", hm2->idrom.offset_to_modules);
|
||||
printf(" Offset to Pin Description: 0x%08X\n", hm2->idrom.offset_to_pins);
|
||||
printf(" Board Name: %.*s\n", (int)sizeof(hm2->config_name), hm2->idrom.board_name);
|
||||
printf(" FPGA Size: %u\n", hm2->idrom.fpga_size);
|
||||
printf(" FPGA Pins: %u\n", hm2->idrom.fpga_pins);
|
||||
printf(" Port Width: %u\n", hm2->idrom.port_width);
|
||||
printf(" IO Ports: %u\n", hm2->idrom.io_ports);
|
||||
printf(" IO Width: %u\n", hm2->idrom.io_width);
|
||||
printf(" Clock Low: %d Hz (%d KHz, %d MHz)\n", hm2->idrom.clock_low, (hm2->idrom.clock_low / 1000), (hm2->idrom.clock_low / (1000 * 1000)));
|
||||
printf(" Clock High: %d Hz (%d KHz, %d MHz)\n", hm2->idrom.clock_high, (hm2->idrom.clock_high / 1000), (hm2->idrom.clock_high / (1000 * 1000)));
|
||||
printf(" Instance Stride 0: 0x%08X\n", hm2->idrom.instance_stride0);
|
||||
printf(" Instance Stride 1: 0x%08X\n", hm2->idrom.instance_stride1);
|
||||
printf(" Register Stride 0: 0x%08X\n", hm2->idrom.register_stride0);
|
||||
printf(" Register Stride 1: 0x%08X\n", hm2->idrom.register_stride1);
|
||||
}
|
||||
|
||||
void hm2_print_modules(hostmot2_t *hm2) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < HM2_MAX_MODULES; i++) {
|
||||
hm2_module_desc_t *mod = &hm2->modules[i];
|
||||
u32 addr = HM2_IDROM_ADDR + hm2->idrom.offset_to_modules + i*sizeof(hm2_module_desc_t);
|
||||
u32 clock_freq;
|
||||
|
||||
if (mod->gtag == HM2_GTAG_NONE) break;
|
||||
printf("Module Descriptor %d at 0x%04X:\n", i, addr);
|
||||
printf(" General Function Tag: %d (%s)\n", mod->gtag, hm2_get_general_function_name(mod->gtag));
|
||||
printf(" Version: %d\n", mod->version);
|
||||
if (mod->clock_tag == HM2_CLOCK_LOW_TAG) {
|
||||
clock_freq = hm2->idrom.clock_low;
|
||||
} else if (mod->clock_tag == HM2_CLOCK_HIGH_TAG) {
|
||||
clock_freq = hm2->idrom.clock_high;
|
||||
} else {
|
||||
printf("Module Descriptor %d (at 0x%04x) has invalid ClockTag %d\n", i, addr, mod->clock_tag);
|
||||
return;
|
||||
}
|
||||
printf(" Clock Tag: %d (%s MHz)\n", mod->clock_tag, hm2_hz_to_mhz(clock_freq));
|
||||
printf(" Instances: %d\n", mod->instances);
|
||||
printf(" Base Address: 0x%04X\n", mod->base_address);
|
||||
printf(" -- Num Registers: %d\n", mod->registers);
|
||||
if ((mod->strides & 0x0000000F) == 0) {
|
||||
printf(" Register Stride: 0x%08X\n", hm2->idrom.register_stride0);
|
||||
} else if ((mod->strides & 0x0000000F) == 1) {
|
||||
printf(" Register Stride: 0x%08X\n", hm2->idrom.register_stride1);
|
||||
} else {
|
||||
printf("Module Descriptor %d (at 0x%04x) has invalid RegisterStride %d\n", i, addr, mod->strides);
|
||||
return;
|
||||
}
|
||||
if (((mod->strides >> 4) & 0x0000000F) == 0) {
|
||||
printf(" -- Instance Stride: 0x%08X\n", hm2->idrom.instance_stride0);
|
||||
} else if (((mod->strides >> 4) & 0x0000000F) == 1) {
|
||||
printf(" -- Instance Stride: 0x%08X\n", hm2->idrom.instance_stride1);
|
||||
} else {
|
||||
printf("Module Descriptor %d (at 0x%04x) has invalid InstanceStride %d\n", i, addr, mod->strides);
|
||||
return;
|
||||
}
|
||||
printf(" -- Multiple Registers: 0x%08X\n", mod->mp_bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
void hm2_print_pins(hostmot2_t *hm2) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < HM2_MAX_PINS; i++) {
|
||||
hm2_pin_desc_t *pin = &hm2->pins[i];
|
||||
|
||||
if (pin->gtag == 0) break;
|
||||
printf("pin %d:\n", i);
|
||||
printf(" Primary Tag: 0x%02X (%s)\n", pin->gtag, hm2_get_general_function_name(pin->gtag));
|
||||
if (pin->sec_tag != 0) {
|
||||
printf(" Secondary Tag: 0x%02X (%s)\n", pin->sec_tag, hm2_get_general_function_name(pin->sec_tag));
|
||||
printf(" Secondary Unit: 0x%02X\n", pin->sec_chan);
|
||||
printf(" Secondary Pin: 0x%02X (%s, %s)\n", pin->sec_pin, hm2_get_pin_secondary_name(pin), ((pin->sec_pin & 0x80) ? "Output" : "Input"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PIN FILE GENERATING SUPPORT
|
||||
|
||||
static pin_name_t pin_names[HM2_MAX_TAGS] = {
|
||||
|
|
@ -412,6 +345,7 @@ static pin_name_t pin_names[HM2_MAX_TAGS] = {
|
|||
{HM2_GTAG_MUXED_ENCODER_SEL_MIM, {"MuxSel0", "MuxSel1", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_STEPGEN, {"Step/Table1", "Dir/Table2", "Table3", "Table4", "Table5", "Table6", "SGindex", "SGProbe", "Null9", "Null10"}},
|
||||
{HM2_GTAG_PWMGEN, {"PWM", "Dir", "/Enable", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_RCPWMGEN, {"PWM", "Null2","Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_TPPWM, {"PWMA", "PWMB", "PWMC", "NPWMA", "NPWMB", "NPWMC", "/ENA", "FAULT", "Null9", "Null10"}},
|
||||
{HM2_GTAG_WAVEGEN, {"PDMA", "PDMB", "Trig0", "Trig1", "Trig2", "Trig3", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_DAQ_FIFO, {"Data", "Strobe", "Full", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
|
|
@ -420,16 +354,20 @@ static pin_name_t pin_names[HM2_MAX_TAGS] = {
|
|||
{HM2_GTAG_RESOLVER, {"PwrEn", "PDMP", "PDMM", "ADChan0", "ADChan1", "ADChan2", "SPICS", "SPIClk", "SPIDI0", "SPIDI1"}},
|
||||
{HM2_GTAG_SSERIAL, {"RXData", "TXData", "TXEn", "TestPin", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_TWIDDLER, {"InBit", "IOBit", "OutBit", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_XFORMER, {"Drive", "Ref", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_SSR, {"Out", "AC Ref", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_SPI, {"/Frame", "DOut", "SClk", "DIn", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_BSPI, {"/Frame", "DOut", "SClk", "DIn", "CS0", "CS1", "CS2", "CS3", "Null9", "Null10"}},
|
||||
{HM2_GTAG_DBSPI, {"Null1", "DOut", "SClk", "DIn", "/CS-FRM0", "/CS-FRM1", "/CS-FRM2", "/CS-FRM3", "Null9", "Null10"}},
|
||||
{HM2_GTAG_DPLL, {"Sync", "DDSMSB", "FOut", "PostOut", "SyncToggle", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_SSI, {"SClk", "SClkEn", "Data", "DAv", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_BISS, {"Clk", "ClkEn", "Din", "DAv", "TData", "STime", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_UART_TX, {"TXData", "TXEna", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_UART_RX, {"RXData", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_TRAM, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_LED, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_INMUX, {"Addr0", "Addr1", "Addr2", "Addr3", "Addr4", "MuxData", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_INM, {"Input0", "Input1", "Input2", "Input3", "Input4", "Input5", "Input6", "Input7", "Input8"}},
|
||||
{HM2_GTAG_XYMOD, {"XData", "YData", "Clk", "Sync", "Status", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
};
|
||||
|
||||
static pin_name_t pin_names_xml[HM2_MAX_TAGS] = {
|
||||
|
|
@ -444,6 +382,7 @@ static pin_name_t pin_names_xml[HM2_MAX_TAGS] = {
|
|||
{HM2_GTAG_MUXED_ENCODER_SEL_MIM, {"MuxSel0", "MuxSel1", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_STEPGEN, {"Step/Table1", "Dir/Table2", "Table3", "Table4", "Table5", "Table6", "SGindex", "SGProbe", "Null9", "Null10"}},
|
||||
{HM2_GTAG_PWMGEN, {"PWM/Up", "Dir/Down", "/Enable", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_RCPWMGEN, {"PWM", "Null2","Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_TPPWM, {"PWMA", "PWMB", "PWMC", "NPWMA", "NPWMB", "NPWMC", "/ENA", "FAULT", "Null9", "Null10"}},
|
||||
{HM2_GTAG_WAVEGEN, {"PDMA", "PDMB", "Trig0", "Trig1", "Trig2", "Trig3", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_DAQ_FIFO, {"Data", "Strobe", "Full", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
|
|
@ -452,16 +391,20 @@ static pin_name_t pin_names_xml[HM2_MAX_TAGS] = {
|
|||
{HM2_GTAG_RESOLVER, {"PwrEn", "PDMP", "PDMM", "ADChan0", "ADChan1", "ADChan2", "SPICS", "SPIClk", "SPIDI0", "SPIDI1"}},
|
||||
{HM2_GTAG_SSERIAL, {"RXData", "TXData", "TXEn", "TestPin", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_TWIDDLER, {"InBit", "IOBit", "OutBit", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_XFORMER, {"Drive", "Ref", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_SSR, {"Out", "AC Ref", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_SPI, {"/Frame", "DOut", "SClk", "DIn", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_BSPI, {"/Frame", "DOut", "SClk", "DIn", "CS0", "CS1", "CS2", "CS3", "Null9", "Null10"}},
|
||||
{HM2_GTAG_DBSPI, {"Null1", "DOut", "SClk", "DIn", "/CS-FRM0", "/CS-FRM1", "/CS-FRM2", "/CS-FRM3", "Null9", "Null10"}},
|
||||
{HM2_GTAG_DPLL, {"Sync", "DDSMSB", "FOut", "PostOut", "SyncToggle", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_SSI, {"SClk", "SClkEn", "Din", "DAv", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_BISS, {"Clk", "ClkEn", "Din", "DAv", "TData", "STime", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_UART_TX, {"TXData", "TXEna", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_UART_RX, {"RXData", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_TRAM, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_LED, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_INMUX, {"Addr0", "Addr1", "Addr2", "Addr3", "Addr4", "MuxData", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_INM, {"Input0", "Input1", "Input2", "Input3", "Input4", "Input5", "Input6", "Input7", "Input8"}},
|
||||
{HM2_GTAG_XYMOD, {"XData", "YData", "Clk", "Sync", "Status", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
};
|
||||
|
||||
static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
||||
|
|
@ -472,6 +415,7 @@ static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
|||
{"QCount", HM2_GTAG_ENCODER},
|
||||
{"StepGen", HM2_GTAG_STEPGEN},
|
||||
{"PWM", HM2_GTAG_PWMGEN},
|
||||
{"RCPWM", HM2_GTAG_RCPWMGEN},
|
||||
{"SPI", HM2_GTAG_SPI},
|
||||
{"SSI", HM2_GTAG_SSI},
|
||||
{"UARTTX", HM2_GTAG_UART_TX},
|
||||
|
|
@ -494,7 +438,11 @@ static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
|||
{"ResolverMod", HM2_GTAG_RESOLVER},
|
||||
{"SSerial", HM2_GTAG_SSERIAL},
|
||||
{"Twiddler", HM2_GTAG_TWIDDLER},
|
||||
{"Transformer", HM2_GTAG_XFORMER},
|
||||
{"SSR", HM2_GTAG_SSR},
|
||||
{"InMux", HM2_GTAG_INMUX},
|
||||
{"InM", HM2_GTAG_INM},
|
||||
{"BISS", HM2_GTAG_BISS},
|
||||
{"XYMod", HM2_GTAG_XYMOD},
|
||||
};
|
||||
|
||||
static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
||||
|
|
@ -505,6 +453,7 @@ static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
|||
{"Encoder", HM2_GTAG_ENCODER},
|
||||
{"StepGen", HM2_GTAG_STEPGEN},
|
||||
{"PWM", HM2_GTAG_PWMGEN},
|
||||
{"RCPWM", HM2_GTAG_RCPWMGEN},
|
||||
{"SPI", HM2_GTAG_SPI},
|
||||
{"SSI", HM2_GTAG_SSI},
|
||||
{"UARTTX", HM2_GTAG_UART_TX},
|
||||
|
|
@ -527,11 +476,16 @@ static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
|||
{"ResolverMod", HM2_GTAG_RESOLVER},
|
||||
{"SSerial", HM2_GTAG_SSERIAL},
|
||||
{"Twiddler", HM2_GTAG_TWIDDLER},
|
||||
{"Transformer", HM2_GTAG_XFORMER},
|
||||
{"SSR", HM2_GTAG_SSR},
|
||||
{"InMux", HM2_GTAG_INMUX},
|
||||
{"InM", HM2_GTAG_INM},
|
||||
{"BISS", HM2_GTAG_BISS},
|
||||
{"XYMod", HM2_GTAG_XYMOD},
|
||||
};
|
||||
|
||||
static char *pin_find_module_name(int gtag, int xml_flag) {
|
||||
static char *find_module_name(int gtag, int xml_flag) {
|
||||
int i;
|
||||
static char unknown[100];
|
||||
mod_name_t *mod_names_ptr;
|
||||
|
||||
if (gtag == HM2_GTAG_NONE) {
|
||||
|
|
@ -548,7 +502,9 @@ static char *pin_find_module_name(int gtag, int xml_flag) {
|
|||
if (mod_names_ptr[i].tag == gtag)
|
||||
return mod_names_ptr[i].name;
|
||||
}
|
||||
return "(unknown-gtag)";
|
||||
|
||||
snprintf(unknown, 100, "(unknown-gtag-%d)", gtag);
|
||||
return unknown;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -567,7 +523,7 @@ static char *pin_get_pin_name(hm2_pin_desc_t *pin, int xml_flag) {
|
|||
for (i = 0; i < HM2_MAX_TAGS; i++) {
|
||||
if (pin_names_ptr[i].tag == pin->sec_tag) {
|
||||
if (pin->sec_tag == HM2_GTAG_SSERIAL) {
|
||||
chan = pin->sec_pin & 0x0F;
|
||||
chan = (pin->sec_pin & 0x0F) - 1;
|
||||
if ((pin->sec_pin & 0xF0) == 0x00) {
|
||||
sprintf(buff, "%s%u", pin_names_ptr[i].name[0], chan);
|
||||
return buff;
|
||||
|
|
@ -581,6 +537,15 @@ static char *pin_get_pin_name(hm2_pin_desc_t *pin, int xml_flag) {
|
|||
sprintf(buff, "%s%u", pin_names_ptr[i].name[3], chan);
|
||||
return buff;
|
||||
}
|
||||
} else if (pin->sec_tag == HM2_GTAG_SSR) {
|
||||
if ((pin->sec_pin & 0xF0) == 0x80) {
|
||||
chan = pin->sec_pin - 0x81;
|
||||
sprintf(buff, "%s-%02u", pin_names_ptr[i].name[0], chan);
|
||||
return buff;
|
||||
} else if (pin->sec_pin == 0xA0) {
|
||||
sprintf(buff, "%s", pin_names_ptr[i].name[1]);
|
||||
return buff;
|
||||
}
|
||||
} else if (pin->gtag == HM2_GTAG_DAQ_FIFO) {
|
||||
chan = pin->sec_chan & 0x1F;
|
||||
if ((pin->sec_pin & 0xE0) == 0x00) {
|
||||
|
|
@ -612,13 +577,25 @@ static char *pin_get_pin_name(hm2_pin_desc_t *pin, int xml_flag) {
|
|||
sprintf(buff, "%s%u", pin_names_ptr[i].name[0], chan);
|
||||
return buff;
|
||||
}
|
||||
} else if (pin->sec_tag == HM2_GTAG_INMUX) {
|
||||
if ((pin->sec_pin & 0x80) == 0x80) {
|
||||
// output pins
|
||||
snprintf(buff, sizeof(buff), "Addr%d", pin->sec_pin - 0x81);
|
||||
} else {
|
||||
// input pins
|
||||
snprintf(buff, sizeof(buff), "Data%d", pin->sec_pin - 0x01);
|
||||
}
|
||||
return buff;
|
||||
} else if (pin->sec_tag == HM2_GTAG_INM) {
|
||||
snprintf(buff, sizeof(buff), "Input%d", pin->sec_pin - 0x01);
|
||||
return buff;
|
||||
} else {
|
||||
sprintf(buff, "%s", pin_names_ptr[i].name[(pin->sec_pin & 0x0F) - 1]);
|
||||
return buff;
|
||||
}
|
||||
};
|
||||
};
|
||||
sprintf(buff, "Unknown");
|
||||
snprintf(buff, sizeof(buff), "Unknown-Gtag%d-Chan%d-Pin%d", pin->sec_tag, pin->sec_chan, pin->sec_pin);
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
|
@ -647,16 +624,8 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
|||
if ((llio->hm2.modules[i].gtag == 0) && (llio->hm2.modules[i].version == 0) &&
|
||||
(llio->hm2.modules[i].clock_tag == 0) && (llio->hm2.modules[i].instances == 0)) break;
|
||||
|
||||
{
|
||||
int k;
|
||||
for (k = 0; k < HM2_MAX_TAGS; k++) {
|
||||
if (mod_names[k].tag == llio->hm2.modules[i].gtag) {
|
||||
printf(" Module: %s\n", mod_names[k].name);
|
||||
printf(" There are %u of %s in configuration\n", llio->hm2.modules[i].instances, mod_names[k].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(" Module: %s\n", find_module_name(llio->hm2.modules[i].gtag, xml_flag));
|
||||
printf(" There are %u of %s in configuration\n", llio->hm2.modules[i].instances, find_module_name(llio->hm2.modules[i].gtag, xml_flag));
|
||||
|
||||
printf(" Version: %u\n", llio->hm2.modules[i].version);
|
||||
printf(" Registers: %u\n", llio->hm2.modules[i].registers);
|
||||
|
|
@ -687,14 +656,17 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
|||
case 32:
|
||||
pin_nr = i*(llio->hm2.idrom.port_width) + j;
|
||||
break;
|
||||
default:
|
||||
pin_nr = 0;
|
||||
break;
|
||||
}
|
||||
printf("%2u", pin_nr);
|
||||
printf(" %3u", i*(llio->hm2.idrom.port_width) + j);
|
||||
printf(" %-8s", pin_find_module_name(pin->gtag, xml_flag));
|
||||
printf(" %-8s", find_module_name(pin->gtag, xml_flag));
|
||||
if (pin->sec_tag == HM2_GTAG_NONE) {
|
||||
printf(" %-15s", "None");
|
||||
} else {
|
||||
printf(" %-15s", pin_find_module_name(pin->sec_tag, xml_flag));
|
||||
printf(" %-15s", find_module_name(pin->sec_tag, xml_flag));
|
||||
|
||||
if (pin->sec_chan & HM2_CHAN_GLOBAL) {
|
||||
printf(" Global ");
|
||||
|
|
@ -730,17 +702,8 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
|||
(llio->hm2.modules[i].clock_tag == 0) && (llio->hm2.modules[i].instances == 0)) break;
|
||||
|
||||
printf(" <module>\n");
|
||||
{
|
||||
int k;
|
||||
for (k = 0; k < HM2_MAX_TAGS; k++) {
|
||||
if (mod_names[k].tag == llio->hm2.modules[i].gtag) {
|
||||
printf(" <tagname>%s</tagname>\n", mod_names[k].name);
|
||||
printf(" <tagname>%s</tagname>\n", find_module_name(llio->hm2.modules[i].gtag, xml_flag));
|
||||
printf(" <numinstances>%2d</numinstances>\n", llio->hm2.modules[i].instances);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf(" </module>\n");
|
||||
}
|
||||
printf(" </modules>\n");
|
||||
|
|
@ -761,10 +724,13 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
|||
case 32:
|
||||
pin_nr = i*(llio->hm2.idrom.port_width) + j;
|
||||
break;
|
||||
default:
|
||||
pin_nr = 0;
|
||||
break;
|
||||
}
|
||||
printf(" <pin>\n");
|
||||
printf(" <connector>%s</connector>\n", llio->ioport_connector_name[i]);
|
||||
printf(" <secondarymodulename>%s</secondarymodulename>\n", pin_find_module_name(pin->sec_tag, xml_flag));
|
||||
printf(" <secondarymodulename>%s</secondarymodulename>\n", find_module_name(pin->sec_tag, xml_flag));
|
||||
printf(" <secondaryfunctionname>");
|
||||
if (pin->sec_tag != HM2_GTAG_NONE) {
|
||||
printf("%s", pin_get_pin_name(pin, xml_flag));
|
||||
|
|
@ -783,3 +749,35 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
|||
printf("</hostmot2>\n");
|
||||
}
|
||||
}
|
||||
|
||||
void hm2_print_pin_descriptors(llio_t *llio) {
|
||||
int num_pins;
|
||||
|
||||
num_pins = llio->hm2.idrom.io_ports * llio->hm2.idrom.port_width;
|
||||
printf("%d HM2 Pin Descriptors:\n", num_pins);
|
||||
|
||||
for (int i = 0; i < num_pins; i ++) {
|
||||
hm2_pin_desc_t *pd = &llio->hm2.pins[i];
|
||||
|
||||
printf(" pin %d:\n", i);
|
||||
printf(
|
||||
" Primary Tag: 0x%02X (%s)\n",
|
||||
pd->gtag,
|
||||
find_module_name(pd->gtag, 0)
|
||||
);
|
||||
if (llio->hm2.pins[i].sec_tag != 0) {
|
||||
printf(
|
||||
" Secondary Tag: 0x%02X (%s)\n",
|
||||
llio->hm2.pins[i].sec_tag,
|
||||
find_module_name(pd->sec_tag, 0)
|
||||
);
|
||||
printf(" Secondary Unit: 0x%02X\n", pd->sec_chan);
|
||||
printf(
|
||||
" Secondary Pin: 0x%02X (%s, %s)\n",
|
||||
pd->sec_pin,
|
||||
pin_get_pin_name(pd, 0),
|
||||
(pd->sec_pin & 0x80) ? "Output" : "Input"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ typedef struct {
|
|||
int sw_modes_cnt;
|
||||
} sserial_device_t;
|
||||
|
||||
#define HM2_MAX_TAGS 30
|
||||
#define HM2_MAX_TAGS 255
|
||||
#define ANYIO_MAX_IOPORT_CONNECTORS 8
|
||||
|
||||
typedef struct llio_struct llio_t;
|
||||
|
|
@ -65,7 +65,7 @@ struct llio_struct {
|
|||
char board_name[16];
|
||||
void *board;
|
||||
hostmot2_t hm2;
|
||||
sserial_interface_t ss_interface[HM2_SSERIAL_MAX_INTEFACES];
|
||||
sserial_interface_t ss_interface[HM2_SSERIAL_MAX_INTERFACES];
|
||||
sserial_device_t ss_device[HM2_SSERIAL_MAX_CHANNELS];
|
||||
int verbose;
|
||||
};
|
||||
|
|
@ -80,13 +80,10 @@ typedef struct {
|
|||
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_print_pin_descriptors(llio_t *llio);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -59,12 +59,16 @@
|
|||
#define HM2_GTAG_BISS 0x18
|
||||
#define HM2_GTAG_FABS 0x19
|
||||
#define HM2_GTAG_HM2DPLL 0x1A
|
||||
#define HM2_GTAG_INMUX 0x1E
|
||||
#define HM2_GTAG_INM 0x23
|
||||
#define HM2_GTAG_XYMOD 0x2B
|
||||
#define HM2_GTAG_RCPWMGEN 0x2C
|
||||
#define HM2_GTAG_LIOPORT 0x40
|
||||
#define HM2_GTAG_LED 0x80
|
||||
#define HM2_GTAG_RESOLVER 0xC0
|
||||
#define HM2_GTAG_SSERIAL 0xC1
|
||||
#define HM2_GTAG_TWIDDLER 0xC2
|
||||
#define HM2_GTAG_XFORMER 0xC3
|
||||
#define HM2_GTAG_SSR 0xC3
|
||||
|
||||
// HM2 EEPROM SPI INTERFACE
|
||||
|
||||
|
|
@ -207,7 +211,7 @@ typedef struct {
|
|||
|
||||
// SSERIAL MODULE
|
||||
|
||||
#define HM2_SSERIAL_MAX_INTEFACES 4
|
||||
#define HM2_SSERIAL_MAX_INTERFACES 4
|
||||
#define HM2_SSERIAL_MAX_CHANNELS 8
|
||||
|
||||
#define HM2_MOD_OFFS_SSERIAL_CMD 0x0000
|
||||
|
|
|
|||
7
lbp.c
7
lbp.c
|
|
@ -28,7 +28,7 @@
|
|||
#include "lbp.h"
|
||||
|
||||
#ifdef __linux__
|
||||
int sd;
|
||||
static int sd = -1;
|
||||
#elif _WIN32
|
||||
HANDLE sd;
|
||||
#endif
|
||||
|
|
@ -42,6 +42,7 @@ int lbp_send(void *packet, int size) {
|
|||
#endif
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("%d=lbp_send(%d)\n", send, size);
|
||||
|
||||
return send;
|
||||
}
|
||||
|
||||
|
|
@ -54,6 +55,7 @@ int lbp_recv(void *packet, int size) {
|
|||
#endif
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("%d=lbp_recv(%d)\n", recv, size);
|
||||
|
||||
return recv;
|
||||
}
|
||||
|
||||
|
|
@ -65,6 +67,7 @@ u8 lbp_read_ctrl(u8 cmd) {
|
|||
recv = lbp_recv(&data, 1);
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("%d=send(%X), %d=recv(%X)\n", send, cmd, recv, data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
@ -81,6 +84,7 @@ int lbp_read(u16 addr, void *buffer) {
|
|||
recv = lbp_recv(buffer, 4);
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("lbp_read(%02X:%04X): %08X\n", packet.cmd, addr, *ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +100,7 @@ int lbp_write(u16 addr, void *buffer) {
|
|||
send = lbp_send(&packet, sizeof(lbp_cmd_addr_data));
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("lbp_write(%02X:%04X)\n", packet.cmd, addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
117
mesaflash.1
Normal file
117
mesaflash.1
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
.TH MESAFLASH 1 "August 13 2019" "version 3.4.0~pre"
|
||||
.SH NAME
|
||||
MesaFlash \- utility to flash Mesa Electronics FPGA Cards
|
||||
.SH SYNOPSIS
|
||||
.B mesaflash [options] [commands]
|
||||
.SH DESCRIPTION
|
||||
.B mesaflash
|
||||
Read, write, configure Mesa Electronics FPGA cards.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI --device " name"
|
||||
Select active device name. If no command is given it will detect board
|
||||
with given name and print info about it.
|
||||
|
||||
The special values "ETHER", "SPI" and "AUTO" will attempt to detect a device
|
||||
on ethernet, SPI, or any interface; --addr still needs to be specified for
|
||||
non-PCI devices.
|
||||
.TP
|
||||
.BI --addr " [ip]|[device]"
|
||||
Use ip or device name to look for <name> (IP address for Ethernet boards,
|
||||
serial device name for USB boards and serial boards, SPI device name for
|
||||
SPI boards)
|
||||
.TP
|
||||
.B --addr_hi
|
||||
Set the high register address for the EPP interface.
|
||||
.TP
|
||||
.B --epp
|
||||
Use EPP interface to connect to board, only for boards with multiple
|
||||
interfaces (7i43, 7i90, 7i64).
|
||||
.TP
|
||||
.B --usb
|
||||
Use USB interface to connect to board, only for boards with multiple
|
||||
interfaces (7i43, 7i90, 7i64).
|
||||
.TP
|
||||
.B --spi
|
||||
Use SPI interface to connect to board, only for boards with multiple
|
||||
interfaces (7i43, 7i90, 7i64).
|
||||
.TP
|
||||
.B --serial
|
||||
Use serial interface to connect to board, only for boards with multiple
|
||||
interfaces (7i43, 7i90, 7i64).
|
||||
.TP
|
||||
.B --fallback
|
||||
Use the fallback area of the EEPROM while executing commands.
|
||||
.TP
|
||||
.B --recover
|
||||
Access board using PCI bridge GPIO (currently only 6I24/6I25).
|
||||
.TP
|
||||
.B --xml
|
||||
Format output from 'readhmid' command into XML.
|
||||
.TP
|
||||
.B --verbose
|
||||
Print detailed information while running commands.
|
||||
.SH COMMANDS
|
||||
.TP
|
||||
.BI --write " filename"
|
||||
Writes a standard bitfile 'filename' configuration to the userarea of
|
||||
the EEPROM (IMPORTANT! 'filename' must be VALID FPGA configuration file).
|
||||
.TP
|
||||
.B --fix-boot-block
|
||||
If a write operation does not detect a valid boot block, write one.
|
||||
.TP
|
||||
.B --no-auto-verify
|
||||
Don't automatically verify after writing.
|
||||
.TP
|
||||
.BI --verify " filename"
|
||||
Verifies the EEPROM configuration against the bitfile 'filename'.
|
||||
.TP
|
||||
.BI --program " filename"
|
||||
Writes a standard bitfile 'filename' configuration to the FPGA
|
||||
(IMPORTANT! 'filename' must be VALID FPGA configuration file).
|
||||
.TP
|
||||
.B --readhmid
|
||||
Print hostmot2 configuration in PIN file format.
|
||||
.TP
|
||||
.B --print-pd
|
||||
Print hostmot2 Pin Descriptors.
|
||||
.TP
|
||||
.B --reload
|
||||
Do full FPGA reload from flash (only Ethernet and pci boards).
|
||||
.TP
|
||||
.B --reset
|
||||
Do full firmware reset (only Ethernet and serial boards).
|
||||
.TP
|
||||
.B --sserial
|
||||
Print full information about all sserial remote boards.
|
||||
.TP
|
||||
.BI --rpo " address"
|
||||
Read hostmot2 variable directly at 'address'.
|
||||
.TP
|
||||
.BI --wpo " address value"
|
||||
Write hostmot2 variable directly at 'address' with 'value'.
|
||||
.TP
|
||||
.BI --set " ip address"
|
||||
Set board IP address in eeprom to n.n.n.n (only Ethernet boards).
|
||||
.TP
|
||||
.BI --info " filename"
|
||||
Print info about configuration in 'file_name'.
|
||||
.TP
|
||||
.B --help
|
||||
Print the help message
|
||||
.SH BUGS
|
||||
No known bugs.
|
||||
.SH AUTHOR
|
||||
LinuxCNC Developer Community <emc-developers@lists.sourceforge.net>
|
||||
.PP
|
||||
Michael Geszkiewicz <micges@wp.pl>
|
||||
.PP
|
||||
Peter Wallace <tech@mesanet.com>
|
||||
.SH COPYRIGHT
|
||||
GNU GPL v2+ License
|
||||
.PP
|
||||
Copyright (c) 2020 Sebastian Kuzminsky
|
||||
.PP
|
||||
Copyright (c) 2019 Peter Wallace
|
||||
.PP
|
||||
Copyright (c) 2013-2015 Michael Geszkiewicz
|
||||
124
mesaflash.c
124
mesaflash.c
|
|
@ -1,5 +1,7 @@
|
|||
//
|
||||
// Copyright (C) 2013-2014 Michael Geszkiewicz
|
||||
// Copyright (C) 2020 Sebastian Kuzminsky <seb@highlab.com>
|
||||
// Copyright (C) 2013-2015 Michael Geszkiewicz
|
||||
// Copyright (C) Mesa Electronics
|
||||
//
|
||||
// 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
|
||||
|
|
@ -29,6 +31,10 @@
|
|||
#include "libpci/pci.h"
|
||||
#endif
|
||||
|
||||
#ifndef VERSION
|
||||
#define VERSION "3.4.0~pre0"
|
||||
#endif
|
||||
|
||||
static int device_flag;
|
||||
static int addr_flag;
|
||||
static int addr_hi_flag;
|
||||
|
|
@ -40,6 +46,7 @@ static int fallback_flag;
|
|||
static int recover_flag;
|
||||
static int program_flag;
|
||||
static int readhmid_flag;
|
||||
static int print_pd_flag;
|
||||
static int reload_flag;
|
||||
static int reset_flag;
|
||||
static int sserial_flag;
|
||||
|
|
@ -72,6 +79,7 @@ static struct option long_options[] = {
|
|||
{"recover", no_argument, &recover_flag, 1},
|
||||
{"program", required_argument, 0, 'p'},
|
||||
{"readhmid", no_argument, &readhmid_flag, 1},
|
||||
{"print-pd", no_argument, &print_pd_flag, 1},
|
||||
{"reload", no_argument, &reload_flag, 1},
|
||||
{"reset", no_argument, &reset_flag, 1},
|
||||
{"sserial", no_argument, &sserial_flag, 1},
|
||||
|
|
@ -90,10 +98,8 @@ static struct option long_options[] = {
|
|||
};
|
||||
|
||||
void print_short_usage() {
|
||||
printf("\nMesaflash version 3.3.0~pre (built on %s %s with libpci %s)\n", __DATE__, __TIME__, PCILIB_VERSION);
|
||||
printf("Configuration and diagnostic tool for Mesa Electronics PCI(E)/ETH/EPP/USB boards\n");
|
||||
printf("(C) 2013-2015 Michael Geszkiewicz (contact: micges@wp.pl)\n");
|
||||
printf("(C) Mesa Electronics\n");
|
||||
printf("Mesaflash version %s\n", VERSION);
|
||||
printf("Configuration and diagnostic tool for Mesa Electronics PCI(E)/ETH/EPP/USB/SPI boards\n");
|
||||
printf("Try 'mesaflash --help' for more information\n");
|
||||
}
|
||||
|
||||
|
|
@ -111,34 +117,55 @@ void print_usage() {
|
|||
printf(" mesaflash --device device_name [options] --set ip=n.n.n.n\n");
|
||||
printf(" mesaflash --info file_name\n");
|
||||
printf(" mesaflash --help\n");
|
||||
printf("\nOptions:\n");
|
||||
printf(" --device select active device name. If no command is given it will detect board with given name and print info about it.\n");
|
||||
printf(" --addr <device_address>\n");
|
||||
printf(" select <device address> for looking for <device_name> (network C mask for ethernet boards, serial port for USB boards)\n");
|
||||
printf(" --addr_hi set the high register address for the EPP interface\n");
|
||||
printf(" --epp use EPP interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
||||
printf(" --usb use USB interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
||||
printf(" --spi use SPI interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
||||
printf(" --serial use serial interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
||||
printf(" --fallback use the fallback area of the EEPROM while executing commands\n");
|
||||
printf(" --recover access board using PCI bridge GPIO (currently only 6I25)\n");
|
||||
printf(" --xml format output from 'readhmid' command into XML\n");
|
||||
printf(" --verbose print detailed information while running commands\n");
|
||||
printf("\nCommands:\n");
|
||||
printf(" --write writes a standard bitfile 'filename' configuration to the userarea of the EEPROM (IMPORTANT! 'filename' must be VALID FPGA configuration file)\n");
|
||||
printf(" --fix-boot-block If a write operation does not detect a valid boot block, write one\n");
|
||||
printf(" --no-auto-verify Don't automatically verify after writing\n");
|
||||
printf(" --verify verifies the EEPROM configuration against the bitfile 'filename'\n");
|
||||
printf(" --program writes a standard bitfile 'filename' configuration to the FPGA (IMPORTANT! 'filename' must be VALID FPGA configuration file)\n");
|
||||
printf(" --readhmid print hostmot2 configuration in PIN file format\n");
|
||||
printf(" --reload do full FPGA reload from flash (only ethernet and pci boards)\n");
|
||||
printf(" --reset do full firmware reset (only ethernet boards)\n");
|
||||
printf(" --sserial print full information about all sserial remote boards\n");
|
||||
printf(" --rpo read hostmot2 variable directly at 'address'\n");
|
||||
printf(" --wpo write hostmot2 variable directly at 'address' with 'value'\n");
|
||||
printf(" --set set board IP address in eeprom to n.n.n.n (only ethernet boards)\n");
|
||||
printf(" --info print info about configuration in 'file_name'\n");
|
||||
printf(" --help print this help message\n");
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" --device <name> Select active device name. If no command is given it\n");
|
||||
printf(" will detect board with given name and print info\n");
|
||||
printf(" about it.\n");
|
||||
printf(" --addr <dev> Select <dev> for looking for <name> (IP address for\n");
|
||||
printf(" Ethernet boards, serial device name for USB boards\n");
|
||||
printf(" and serial boards, SPI device name for SPI boards)\n");
|
||||
printf(" --addr_hi Set the high register address for the EPP interface.\n");
|
||||
printf(" --epp Use EPP interface to connect to board, only for boards\n");
|
||||
printf(" with multiple interfaces (7c80, 7c81, 7i43, 7i90, 7i64).\n");
|
||||
printf(" --usb Use USB interface to connect to board, only for boards\n");
|
||||
printf(" with multiple interfaces (7c80, 7c81, 7i43, 7i90, 7i64).\n");
|
||||
printf(" --spi Use SPI interface to connect to board, only for boards\n");
|
||||
printf(" with multiple interfaces (7c80, 7c81, 7i43, 7i90, 7i64).\n");
|
||||
printf(" --serial Use serial interface to connect to board, only for\n");
|
||||
printf(" boards with multiple interfaces (7i43, 7i90, 7i64).\n");
|
||||
printf(" --fallback Use the fallback area of the EEPROM while executing\n");
|
||||
printf(" commands.\n");
|
||||
printf(" --recover Access board using PCI bridge GPIO (currently\n");
|
||||
printf(" only 6I24/6I25).\n");
|
||||
printf(" --xml Format output from 'readhmid' command into XML.\n");
|
||||
printf(" --verbose Print detailed information while running commands.\n");
|
||||
printf("\n");
|
||||
printf("Commands:\n");
|
||||
printf(" --write Writes a standard bitfile 'filename' configuration to\n");
|
||||
printf(" the userarea of the EEPROM (IMPORTANT! 'filename' must\n");
|
||||
printf(" be VALID FPGA configuration file).\n");
|
||||
printf(" --fix-boot-block If a write operation does not detect a valid boot\n");
|
||||
printf(" block, write one.\n");
|
||||
printf(" --no-auto-verify Don't automatically verify after writing.\n");
|
||||
printf(" --verify Verifies the EEPROM configuration against the\n");
|
||||
printf(" bitfile 'filename'.\n");
|
||||
printf(" --program Writes a standard bitfile 'filename' configuration to\n");
|
||||
printf(" the FPGA (IMPORTANT! 'filename' must be VALID FPGA\n");
|
||||
printf(" configuration file).\n");
|
||||
printf(" --readhmid Print hostmot2 configuration in PIN file format.\n");
|
||||
printf(" --print-pd Print hostmot2 Pin Descriptors.\n");
|
||||
printf(" --reload Do full FPGA reload from flash (only Ethernet, SPI and\n");
|
||||
printf(" PCI boards).\n");
|
||||
printf(" --reset Do full firmware reset (only Ethernet and serial boards).\n");
|
||||
printf(" --sserial Print full information about all sserial remote boards.\n");
|
||||
printf(" --rpo Read hostmot2 variable directly at 'address'.\n");
|
||||
printf(" --wpo Write hostmot2 variable directly at 'address'\n");
|
||||
printf(" with 'value'.\n");
|
||||
printf(" --set Set board IP address in eeprom to n.n.n.n (only\n");
|
||||
printf(" Ethernet boards).\n");
|
||||
printf(" --info Print info about configuration in 'file_name'.\n");
|
||||
printf(" --help Print this help message.\n");
|
||||
}
|
||||
|
||||
int process_cmd_line(int argc, char *argv[]) {
|
||||
|
|
@ -203,7 +230,12 @@ int process_cmd_line(int argc, char *argv[]) {
|
|||
printf("Error: multiple --write options\n");
|
||||
exit(-1);
|
||||
}
|
||||
strncpy(bitfile_name, optarg, 255);
|
||||
size_t len = strlen(optarg);
|
||||
if (len+1 > sizeof(bitfile_name)) {
|
||||
printf("--write argument too long (max %lu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
write_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -213,7 +245,12 @@ int process_cmd_line(int argc, char *argv[]) {
|
|||
printf("Error: multiple --program options\n");
|
||||
exit(-1);
|
||||
}
|
||||
strncpy(bitfile_name, optarg, 255);
|
||||
size_t len = strlen(optarg);
|
||||
if (len+1 > sizeof(bitfile_name)) {
|
||||
printf("--program argument too long (max %lu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
program_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -285,7 +322,12 @@ int process_cmd_line(int argc, char *argv[]) {
|
|||
printf("Error: multiple --verify options\n");
|
||||
exit(-1);
|
||||
}
|
||||
strncpy(bitfile_name, optarg, 255);
|
||||
size_t len = strlen(optarg);
|
||||
if (len+1 > sizeof(bitfile_name)) {
|
||||
printf("--verify argument too long (max %lu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
verify_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -295,7 +337,12 @@ int process_cmd_line(int argc, char *argv[]) {
|
|||
printf("Error: multiple --info options\n");
|
||||
exit(-1);
|
||||
}
|
||||
strncpy(bitfile_name, optarg, 255);
|
||||
size_t len = strlen(optarg);
|
||||
if (len+1 > sizeof(bitfile_name)) {
|
||||
printf("--info argument too long (max %lu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
info_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -353,6 +400,7 @@ int main(int argc, char *argv[]) {
|
|||
exit(1);
|
||||
ret = anyio_find_dev(&access);
|
||||
if (ret < 0) {
|
||||
printf("No %s board found\n", access.device_name);
|
||||
return -1;
|
||||
}
|
||||
board = anyio_get_dev(&access, 1);
|
||||
|
|
@ -365,6 +413,8 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if (readhmid_flag == 1) {
|
||||
anyio_dev_print_hm2_info(board, xml_flag);
|
||||
} else if (print_pd_flag == 1) {
|
||||
anyio_dev_print_pin_descriptors(board);
|
||||
} else if (sserial_flag == 1) {
|
||||
anyio_dev_print_sserial_info(board);
|
||||
} else if (rpo_flag == 1) {
|
||||
|
|
|
|||
36
pci_boards.c
36
pci_boards.c
|
|
@ -19,6 +19,7 @@
|
|||
#ifdef __linux__
|
||||
#include <sys/mman.h>
|
||||
#include <sys/io.h>
|
||||
#include <sys/time.h>
|
||||
#include <pci/pci.h>
|
||||
#elif _WIN32
|
||||
#include <windows.h>
|
||||
|
|
@ -811,7 +812,10 @@ int pci_boards_init(board_access_t *access) {
|
|||
|
||||
memfd = open("/dev/mem", O_RDWR);
|
||||
eno = errno;
|
||||
seteuid(getuid());
|
||||
if (seteuid(getuid()) != 0) {
|
||||
printf("Failed to restore euid: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (memfd < 0) {
|
||||
printf("%s can't open /dev/mem: %s", __func__, strerror(eno));
|
||||
return -1;
|
||||
|
|
@ -848,7 +852,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
board_init_struct(board);
|
||||
if ((dev->vendor_id == VENDORID_XIO2001) && (dev->device_id == DEVICEID_XIO2001)) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "6I25 (RECOVER)", 14);
|
||||
strcpy(board->llio.board_name, "6I25 (RECOVER)");
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 17;
|
||||
board->llio.ioport_connector_name[0] = "P3";
|
||||
|
|
@ -882,7 +886,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
if (dev->vendor_id == VENDORID_MESAPCI) {
|
||||
if (dev->device_id == DEVICEID_MESA4I74) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy((char *) board->llio.board_name, "4I74", 4);
|
||||
strcpy((char *) board->llio.board_name, "4I74");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
|
|
@ -909,7 +913,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if (dev->device_id == DEVICEID_MESA5I24) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy((char *) board->llio.board_name, "5I24", 4);
|
||||
strcpy(board->llio.board_name, "5I24");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P4";
|
||||
|
|
@ -937,7 +941,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if (dev->device_id == DEVICEID_MESA5I25) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy((char *) board->llio.board_name, "5I25", 4);
|
||||
strcpy(board->llio.board_name, "5I25");
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 17;
|
||||
board->llio.ioport_connector_name[0] = "P3";
|
||||
|
|
@ -964,7 +968,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if (dev->device_id == DEVICEID_MESA6I24) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy((char *) board->llio.board_name, "6I24", 4);
|
||||
strcpy(board->llio.board_name, "6I24");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P4";
|
||||
|
|
@ -992,7 +996,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if (dev->device_id == DEVICEID_MESA6I25) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "6I25", 4);
|
||||
strcpy(board->llio.board_name, "6I25");
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 17;
|
||||
board->llio.ioport_connector_name[0] = "P3";
|
||||
|
|
@ -1023,7 +1027,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
||||
if (ssid == SUBDEVICEID_MESA5I20) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "5I20", 4);
|
||||
strcpy(board->llio.board_name, "5I20");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P2";
|
||||
|
|
@ -1053,7 +1057,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
plx9030_fixup_LASxBRD_READY(&(board->llio));
|
||||
} else if (ssid == SUBDEVICEID_MESA4I65) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "4I65", 4);
|
||||
strcpy(board->llio.board_name, "4I65");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
|
|
@ -1086,7 +1090,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
||||
if ((ssid == SUBDEVICEID_MESA4I68_OLD) || (ssid == SUBDEVICEID_MESA4I68)) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "4I68", 4);
|
||||
strcpy(board->llio.board_name, "4I68");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
|
|
@ -1114,7 +1118,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if (ssid == SUBDEVICEID_MESA5I21) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "5I21", 4);
|
||||
strcpy(board->llio.board_name, "5I21");
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 32;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
|
|
@ -1141,7 +1145,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if ((ssid == SUBDEVICEID_MESA5I22_10) || (ssid == SUBDEVICEID_MESA5I22_15)) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "5I22", 4);
|
||||
strcpy(board->llio.board_name, "5I22");
|
||||
board->llio.num_ioport_connectors = 4;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P2";
|
||||
|
|
@ -1174,7 +1178,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if (ssid == SUBDEVICEID_MESA5I23) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "5I23", 4);
|
||||
strcpy(board->llio.board_name, "5I23");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P2";
|
||||
|
|
@ -1202,7 +1206,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
boards_count++;
|
||||
} else if ((ssid == SUBDEVICEID_MESA4I69_16) || (ssid == SUBDEVICEID_MESA4I69_25)) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "4I69", 4);
|
||||
strcpy(board->llio.board_name, "4I69");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
|
|
@ -1237,7 +1241,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
||||
if ((ssid == SUBDEVICEID_MESA3X20_10) || (ssid == SUBDEVICEID_MESA3X20_15) || (ssid == SUBDEVICEID_MESA3X20_20)) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "3X20", 4);
|
||||
strcpy(board->llio.board_name, "3X20");
|
||||
board->llio.num_ioport_connectors = 6;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P4";
|
||||
|
|
@ -1278,7 +1282,7 @@ void pci_boards_scan(board_access_t *access) {
|
|||
}
|
||||
} else if (dev->device_id == DEVICEID_PLX8112) {
|
||||
board->type = BOARD_PCI;
|
||||
strncpy(board->llio.board_name, "5I71", 4);
|
||||
strcpy(board->llio.board_name, "5I71");
|
||||
board->open = &pci_board_open;
|
||||
board->close = &pci_board_close;
|
||||
board->print_info = &pci_print_info;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/poll.h>
|
||||
#include "types.h"
|
||||
#include "anyio.h"
|
||||
|
|
@ -35,7 +36,7 @@
|
|||
extern board_t boards[MAX_BOARDS];
|
||||
extern int boards_count;
|
||||
|
||||
int sd;
|
||||
static int sd = -1;
|
||||
|
||||
// serial access functions
|
||||
|
||||
|
|
@ -77,8 +78,15 @@ int serial_recv_packet(void *packet, int size) {
|
|||
while (r < size) {
|
||||
rc = ppoll(fds, 1, &timeout, NULL);
|
||||
if (rc > 0) {
|
||||
ret = read(sd, buffer + r, rc);
|
||||
r += rc;
|
||||
ret = read(sd, buffer + r, 1);
|
||||
if (ret < 0) {
|
||||
printf("serial read error: %s\n", strerror(errno));
|
||||
return -1;
|
||||
} else if (ret == 0) {
|
||||
printf("serial read EOF\n");
|
||||
return -1;
|
||||
}
|
||||
r += ret;
|
||||
} else if (rc == 0) {
|
||||
timeouts ++;
|
||||
if (timeouts == 5) {
|
||||
|
|
@ -290,7 +298,7 @@ void serial_print_info(board_t *board) {
|
|||
|
||||
printf(" [space 6] LBP16 control/status:\n");
|
||||
printf(" packets received: all %d, good %d, bad %d\n", stat_area.RXPacketCount, stat_area.RXGoodCount, stat_area.RXBadCount);
|
||||
printf(" packets sended: all %d, good %d, bad %d\n", stat_area.TXPacketCount, stat_area.TXGoodCount, stat_area.TXBadCount);
|
||||
printf(" packets sent: all %d, good %d, bad %d\n", stat_area.TXPacketCount, stat_area.TXGoodCount, stat_area.TXBadCount);
|
||||
printf(" parse errors: %d, mem errors %d, write errors %d\n", stat_area.LBPParseErrors, stat_area.LBPMemErrors, stat_area.LBPWriteErrors);
|
||||
printf(" error flags: 0x%04X\n", stat_area.ErrorReg);
|
||||
printf(" debug LED ptr: 0x%04X\n", stat_area.DebugLEDPtr);
|
||||
|
|
|
|||
110
spi_boards.c
110
spi_boards.c
|
|
@ -16,6 +16,7 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/spi/spidev.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -28,7 +29,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "types.h"
|
||||
#include "eeprom.h"
|
||||
#include "eeprom_local.h"
|
||||
#include "spi_boards.h"
|
||||
#include "common.h"
|
||||
|
|
@ -36,9 +39,9 @@
|
|||
extern board_t boards[MAX_BOARDS];
|
||||
extern int boards_count;
|
||||
|
||||
bool canDo32 = true;
|
||||
static bool canDo32 = true;
|
||||
|
||||
int sd = -1;
|
||||
static int sd = -1;
|
||||
struct spi_ioc_transfer settings;
|
||||
|
||||
static int spidev_set_lsb_first(int fd, u8 lsb_first) {
|
||||
|
|
@ -84,7 +87,7 @@ static int spi_board_close(board_t *board) {
|
|||
}
|
||||
|
||||
int spi_boards_init(board_access_t *access) {
|
||||
settings.speed_hz = 8 * 1000 * 1000;
|
||||
settings.speed_hz = 20 * 1000 * 1000;
|
||||
settings.bits_per_word = 32;
|
||||
|
||||
sd = open(access->dev_addr, O_RDWR);
|
||||
|
|
@ -176,6 +179,52 @@ int spi_write(llio_t *self, u32 addr, void *buffer, int size) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int spi_board_reload(llio_t *self, int fallback_flag) {
|
||||
board_t *board = self->board;
|
||||
int i;
|
||||
u32 boot_addr, cookie;
|
||||
|
||||
spi_read(&(board->llio), HM2_ICAP_REG, &cookie, sizeof(u32));
|
||||
if (cookie != HM2_ICAP_COOKIE) {
|
||||
printf("ERROR: Active firmware too old to support --reload\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fallback_flag == 1) {
|
||||
boot_addr = 0x10000;
|
||||
} else {
|
||||
boot_addr = 0x0;
|
||||
}
|
||||
boot_addr |= 0x0B000000; // plus read command in high byte
|
||||
|
||||
u32 data[14] = {
|
||||
0xFFFF, // dummy
|
||||
0xFFFF, // dummy
|
||||
0xAA99, // sync
|
||||
0x5566, // sync
|
||||
0x3261, // load low flash start address
|
||||
boot_addr & 0xFFFF, // start addr
|
||||
0x3281, // load high start address + read command
|
||||
boot_addr >> 16, // start addr (plus read command in high byte)
|
||||
0x30A1, // load command register
|
||||
0x000E, // IPROG command
|
||||
0x2000, // NOP
|
||||
0x2000, // NOP
|
||||
0x2000, // NOP
|
||||
0x2000 // NOP
|
||||
};
|
||||
|
||||
|
||||
for (i = 0; i < 14; i++) {
|
||||
spi_write(&(board->llio), HM2_ICAP_REG, &data[i], sizeof(u32));
|
||||
usleep(1000);
|
||||
}
|
||||
printf("Waiting for FPGA configuration...");
|
||||
sleep(2);
|
||||
printf("OK\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void spi_boards_scan(board_access_t *access) {
|
||||
u32 buf[4];
|
||||
u32 cookie[] = {0x55aacafe, 0x54534f48, 0x32544f4d};
|
||||
|
|
@ -187,7 +236,7 @@ void spi_boards_scan(board_access_t *access) {
|
|||
}
|
||||
|
||||
if(memcmp(buf, cookie, sizeof(cookie))) {
|
||||
fprintf(stderr, "Unexpected cookie at %04x..%04x:\n%08x %08x %08x\n",
|
||||
fprintf(stderr, "Unexpected cookie at %04x..%04lx:\n%08x %08x %08x\n",
|
||||
HM2_COOKIE_REG, HM2_COOKIE_REG + sizeof(buf),
|
||||
buf[0], buf[1], buf[2]);
|
||||
return;
|
||||
|
|
@ -200,8 +249,9 @@ void spi_boards_scan(board_access_t *access) {
|
|||
board_t *board = &boards[boards_count];
|
||||
board->type = BOARD_SPI;
|
||||
strcpy(board->dev_addr, access->dev_addr);
|
||||
strncpy(board->llio.board_name, "7I90", 4);
|
||||
board->llio.num_ioport_connectors = 24;
|
||||
strcpy(board->llio.board_name, "7I90");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P1";
|
||||
board->llio.ioport_connector_name[1] = "P2";
|
||||
board->llio.ioport_connector_name[2] = "P3";
|
||||
|
|
@ -211,6 +261,54 @@ void spi_boards_scan(board_access_t *access) {
|
|||
board->llio.read = spi_read;
|
||||
board->llio.write_flash = local_write_flash;
|
||||
board->llio.verify_flash = local_verify_flash;
|
||||
board->llio.reload = &spi_board_reload;
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->open = spi_board_open;
|
||||
board->close = spi_board_close;
|
||||
board->print_info = spi_print_info;
|
||||
board->flash = BOARD_FLASH_HM2;
|
||||
board->fallback_support = 1;
|
||||
boards_count ++;
|
||||
} else if(!memcmp(ident, "MESA7C80", 8)) {
|
||||
board_t *board = &boards[boards_count];
|
||||
board->type = BOARD_SPI;
|
||||
strcpy(board->dev_addr, access->dev_addr);
|
||||
strcpy(board->llio.board_name, "7C80");
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 27;
|
||||
board->llio.ioport_connector_name[0] = "StepGens+Misc";
|
||||
board->llio.ioport_connector_name[1] = "Outputs+P1";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.verbose = access->verbose;
|
||||
board->llio.write = spi_write;
|
||||
board->llio.read = spi_read;
|
||||
board->llio.write_flash = local_write_flash;
|
||||
board->llio.verify_flash = local_verify_flash;
|
||||
board->llio.reload = &spi_board_reload;
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->open = spi_board_open;
|
||||
board->close = spi_board_close;
|
||||
board->print_info = spi_print_info;
|
||||
board->flash = BOARD_FLASH_HM2;
|
||||
board->fallback_support = 1;
|
||||
boards_count ++;
|
||||
} else if(!memcmp(ident, "MESA7C81", 8)) {
|
||||
board_t *board = &boards[boards_count];
|
||||
board->type = BOARD_SPI;
|
||||
strcpy(board->dev_addr, access->dev_addr);
|
||||
strcpy(board->llio.board_name, "7C81");
|
||||
board->llio.num_ioport_connectors = 3;
|
||||
board->llio.pins_per_connector = 19;
|
||||
board->llio.ioport_connector_name[0] = "P1+Serial";
|
||||
board->llio.ioport_connector_name[1] = "P2+Serial";
|
||||
board->llio.ioport_connector_name[2] = "P7+Serial";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.verbose = access->verbose;
|
||||
board->llio.write = spi_write;
|
||||
board->llio.read = spi_read;
|
||||
board->llio.write_flash = local_write_flash;
|
||||
board->llio.verify_flash = local_verify_flash;
|
||||
board->llio.reload = &spi_board_reload;
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->open = spi_board_open;
|
||||
board->close = spi_board_close;
|
||||
|
|
|
|||
|
|
@ -228,8 +228,8 @@ int sserial_init(sserial_module_t *ssmod, board_t *board, int interface_num, int
|
|||
printf("No sserial module found.\n");
|
||||
return -1;
|
||||
}
|
||||
if (interface_num >= HM2_SSERIAL_MAX_INTEFACES) {
|
||||
printf("sserial inteface number too high.\n");
|
||||
if (interface_num >= HM2_SSERIAL_MAX_INTERFACES) {
|
||||
printf("sserial interface number too high.\n");
|
||||
return -1;
|
||||
}
|
||||
if (channel_num >= HM2_SSERIAL_MAX_CHANNELS) {
|
||||
|
|
@ -286,7 +286,7 @@ int sserial_init(sserial_module_t *ssmod, board_t *board, int interface_num, int
|
|||
board->llio.read(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_CS + interface_num*ssmod->instance_stride + channel_num*4, &(status), sizeof(u32));
|
||||
board->llio.read(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_INTERFACE0 + interface_num*ssmod->instance_stride + channel_num*4, &(status), sizeof(u32));
|
||||
if ((status & 0xFF000000) != remote_type) {
|
||||
printf("Found wrong remote at %d:%d, reqeust %x but found %x\n", interface_num, channel_num, remote_type, status);
|
||||
printf("Found wrong remote at %d:%d, request %x but found %x\n", interface_num, channel_num, remote_type, status);
|
||||
return -1;
|
||||
}
|
||||
ssmod->device.unit = status;
|
||||
|
|
@ -475,8 +475,13 @@ void sserial_module_init(llio_t *llio) {
|
|||
sslbp_read_remote_bytes(ssmod, port, channel, d, &(sserial_md), sizeof(sserial_md_t));
|
||||
sslbp_read_remote_bytes(ssmod, port, channel, d + sizeof(sserial_md_t), &(name), -1);
|
||||
if (sserial_md.mode_type == 0x01) {
|
||||
llio->ss_device[channel].sw_modes[llio->ss_device[channel].sw_modes_cnt].index = sserial_md.mode_index;
|
||||
strncpy(llio->ss_device[channel].sw_modes[llio->ss_device[channel].sw_modes_cnt].name, name, strlen(name));
|
||||
sw_mode_t *sw_mode = &llio->ss_device[channel].sw_modes[llio->ss_device[channel].sw_modes_cnt];
|
||||
if (strlen(name)+1 > sizeof(sw_mode->name)) {
|
||||
printf("name too long while reading LBP_MODE (max %lu)\n", sizeof(sw_mode->name)-1);
|
||||
abort();
|
||||
}
|
||||
sw_mode->index = sserial_md.mode_index;
|
||||
strcpy(sw_mode->name, name);
|
||||
llio->ss_device[channel].sw_modes_cnt++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
46
stubs/sys/io.c
Normal file
46
stubs/sys/io.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// Copyright (C) 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
#include <errno.h>
|
||||
#include "io.h"
|
||||
|
||||
unsigned char inb(unsigned short int port) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short int inw(unsigned short int port) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int inl(unsigned short int port) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void outb(unsigned char value, unsigned short int port) {
|
||||
}
|
||||
|
||||
void outw(unsigned short int value, unsigned short int port) {
|
||||
}
|
||||
|
||||
void outl(unsigned int value, unsigned short int port) {
|
||||
}
|
||||
|
||||
int iopl(int level) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
32
stubs/sys/io.h
Normal file
32
stubs/sys/io.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Copyright (C) 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
|
||||
//
|
||||
// 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 _IO_H_
|
||||
#define _IO_H_
|
||||
|
||||
unsigned char inb(unsigned short int port);
|
||||
unsigned short int inw(unsigned short int port);
|
||||
unsigned int inl(unsigned short int port);
|
||||
|
||||
void outb(unsigned char value, unsigned short int port);
|
||||
void outw(unsigned short int value, unsigned short int port);
|
||||
void outl(unsigned int value, unsigned short int port);
|
||||
|
||||
int iopl(int level);
|
||||
|
||||
#endif
|
||||
|
|
@ -144,7 +144,7 @@ void usb_boards_scan(board_access_t *access) {
|
|||
board->type = BOARD_USB;
|
||||
board->mode = BOARD_MODE_FPGA;
|
||||
strcpy(board->dev_addr, access->dev_addr);
|
||||
strncpy(board->llio.board_name, "7I43", 4);
|
||||
strcpy(board->llio.board_name, "7I43");
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P3";
|
||||
|
|
@ -185,7 +185,7 @@ void usb_boards_scan(board_access_t *access) {
|
|||
board->type = BOARD_USB;
|
||||
board->mode = BOARD_MODE_CPLD;
|
||||
strcpy(board->dev_addr, access->dev_addr);
|
||||
strncpy(board->llio.board_name, "7I43", 4);
|
||||
strcpy(board->llio.board_name, "7I43");
|
||||
board->llio.num_ioport_connectors = 2;
|
||||
board->llio.pins_per_connector = 24;
|
||||
board->llio.ioport_connector_name[0] = "P3";
|
||||
|
|
|
|||
Loading…
Reference in a new issue