Compare commits
156 commits
master
...
no-overrid
| Author | SHA1 | Date | |
|---|---|---|---|
| e81c39da67 | |||
|
|
53dd47a528 | ||
|
|
8ee6bbeee6 | ||
|
|
b3da02b210 | ||
|
|
906a89dd6a | ||
| c1556b401f | |||
| d0771248d4 | |||
| add5d8475e | |||
| 77de3a955d | |||
|
|
d8e53e5f36 | ||
|
|
494a71ba0a | ||
| c04ee41911 | |||
| 5c72b7b42c | |||
| 341bb8bcb8 | |||
| 3fc88b0f42 | |||
|
|
7c1375432f | ||
|
|
32f823b2bd | ||
|
|
8dfaba0b6a | ||
|
|
5dfed431dc | ||
|
|
555269dd05 | ||
|
|
48a8ca2ae6 | ||
|
|
9fcd70351c | ||
| a0f3c26ae4 | |||
|
|
0359666ea4 | ||
| b594a7d4ab | |||
| 7b2cb3abcd | |||
| d3778586fb | |||
| 1de31add09 | |||
| e5395db448 | |||
| e8190b61a8 | |||
| dc0dfa936f | |||
| a58d670647 | |||
|
|
acfe208625 | ||
|
|
c863030e66 | ||
|
|
6672a29903 | ||
|
|
d2df119ac1 | ||
|
|
09e9224ea3 | ||
|
|
370e76bca6 | ||
|
|
b3d11257f5 | ||
|
|
aae5929f6d | ||
|
|
891a19cdfe | ||
|
|
9168723538 | ||
|
|
946725c83c | ||
|
|
a61da59aa9 | ||
|
|
84b8b3f35d | ||
|
|
d0d21a71db | ||
|
|
b2a9a89a49 | ||
|
|
4ed087f518 | ||
|
|
f23d728834 | ||
|
|
f15d246724 | ||
|
|
d1eb20b81d | ||
|
|
66d5effcc8 | ||
|
|
6aa9b69671 | ||
|
|
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 |
48 changed files with 1696 additions and 2261 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
|
||||
35
.github/workflows/ci.yml
vendored
Normal file
35
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
on:
|
||||
push:
|
||||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
check_suite:
|
||||
types: [rerequested]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y eatmydata
|
||||
sudo eatmydata apt-get install -y --no-install-suggests --no-install-recommends build-essential devscripts equivs
|
||||
mk-build-deps -irs sudo -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
|
||||
- name: Build
|
||||
run: |
|
||||
make -j$(nproc)
|
||||
- name: Clean
|
||||
run: |
|
||||
make clean
|
||||
- name: Build (package)
|
||||
run: |
|
||||
dch -l+`git rev-parse --short HEAD` "actions package build"
|
||||
debuild -b
|
||||
|
||||
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.
|
||||
64
Makefile
64
Makefile
|
|
@ -25,29 +25,59 @@ 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 -Wall -Wextra -Werror
|
||||
|
||||
# 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) -D_FILE_OFFSET_BITS=64
|
||||
|
||||
UNAME_M := $(shell uname -m)
|
||||
ifeq ($(UNAME_M),aarch64)
|
||||
MESAFLASH_IO ?= 0
|
||||
endif
|
||||
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)
|
||||
MESAFLASH_IO ?= 1
|
||||
CFLAGS += -DMESAFLASH_IO=$(MESAFLASH_IO)
|
||||
|
||||
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
|
||||
|
|
@ -67,7 +97,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
|
||||
|
|
@ -124,18 +154,18 @@ 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
|
||||
48
README.md
Normal file
48
README.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# 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 build-essential 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, bypassing the operating system packaging system:
|
||||
```
|
||||
sudo make install
|
||||
```
|
||||
To run an installed MesaFlash:
|
||||
```
|
||||
mesaflash --help
|
||||
```
|
||||
|
||||
Depending on permissions and the types of devices you wish to access, you may need to run mesaflash as root, `sudo ./mesaflash` or `sudo mesaflash`.
|
||||
|
||||
Distributions
|
||||
===============
|
||||
**mesaflash** package is available on [Fedora](https://src.fedoraproject.org/rpms/mesaflash) _(version 31 or newer)_ and can be simply installed by using:
|
||||
```
|
||||
# dnf install mesaflash
|
||||
```
|
||||
Availability of **mesaflash** for other Linux distributions can be checked on [release-monitoring](https://release-monitoring.org/project/105522/) project page.
|
||||
BIN
WinIo32.dll
BIN
WinIo32.dll
Binary file not shown.
BIN
WinIo32.sys
BIN
WinIo32.sys
Binary file not shown.
27
anyio.c
27
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},
|
||||
};
|
||||
|
||||
|
|
@ -74,10 +82,12 @@ void anyio_cleanup(board_access_t *access) {
|
|||
}
|
||||
if (access->open_iface & BOARD_ETH)
|
||||
eth_boards_cleanup(access);
|
||||
#if MESAFLASH_IO
|
||||
if (access->open_iface & BOARD_PCI)
|
||||
pci_boards_cleanup(access);
|
||||
if (access->open_iface & BOARD_EPP)
|
||||
epp_boards_cleanup(access);
|
||||
#endif
|
||||
if (access->open_iface & BOARD_USB)
|
||||
usb_boards_cleanup(access);
|
||||
if (access->open_iface & BOARD_SPI)
|
||||
|
|
@ -118,8 +128,12 @@ 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 MESAFLASH_IO
|
||||
if (supported_board->type & BOARD_PCI) {
|
||||
ret = pci_boards_init(access);
|
||||
if (ret < 0) {
|
||||
|
|
@ -136,6 +150,7 @@ int anyio_find_dev(board_access_t *access) {
|
|||
access->open_iface |= BOARD_EPP;
|
||||
epp_boards_scan(access);
|
||||
}
|
||||
#endif
|
||||
if (supported_board->type & BOARD_USB) {
|
||||
ret = usb_boards_init(access);
|
||||
access->open_iface |= BOARD_USB;
|
||||
|
|
@ -157,6 +172,7 @@ int anyio_find_dev(board_access_t *access) {
|
|||
access->open_iface |= BOARD_ETH;
|
||||
eth_boards_scan(access);
|
||||
}
|
||||
#if MESAFLASH_IO
|
||||
if (access->type & BOARD_PCI) {
|
||||
ret = pci_boards_init(access);
|
||||
if (ret < 0) {
|
||||
|
|
@ -173,6 +189,7 @@ int anyio_find_dev(board_access_t *access) {
|
|||
access->open_iface |= BOARD_EPP;
|
||||
epp_boards_scan(access);
|
||||
}
|
||||
#endif
|
||||
if (access->type & BOARD_USB) {
|
||||
ret = usb_boards_init(access);
|
||||
access->open_iface |= BOARD_USB;
|
||||
|
|
@ -323,6 +340,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);
|
||||
|
||||
|
|
|
|||
2
boards.h
2
boards.h
|
|
@ -60,7 +60,7 @@ struct board_struct {
|
|||
struct pci_dev *dev;
|
||||
void *base;
|
||||
int len;
|
||||
u32 mem_base;
|
||||
u64 mem_base;
|
||||
#ifdef _WIN32
|
||||
tagPhysStruct_t mem_handle;
|
||||
#endif
|
||||
|
|
|
|||
35
debian/changelog
vendored
35
debian/changelog
vendored
|
|
@ -1,8 +1,33 @@
|
|||
mesaflash (3.3.0~pre) UNRELEASED; urgency=low
|
||||
mesaflash (3.4.0~pre1-1) stable; urgency=medium
|
||||
|
||||
-- Michael Geszkiewicz <micges@wp.pl> 27 Sep 2015 19:24:42 -0500
|
||||
* Add a manpage.
|
||||
* Fix several compile warnings.
|
||||
* Add `--device AUTO` and `--device SPI`.
|
||||
|
||||
mesaflash (3.2.0) UNRELEASED; urgency=low
|
||||
-- LinuxCNC Developers <emc-developers@lists.sourceforge.net> Fri, 22 May 2020 10:30:23 -0600
|
||||
|
||||
mesaflash (3.4.0~pre0-1) stable; urgency=medium
|
||||
|
||||
* mesaflash is now maintained by the LinuxCNC organization.
|
||||
|
||||
-- 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 +41,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 +66,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
|
||||
|
|
|
|||
33
debian/rules
vendored
33
debian/rules
vendored
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/make -f
|
||||
include /usr/share/dpkg/pkg-info.mk
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
|
@ -6,34 +7,8 @@
|
|||
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
|
||||
|
||||
|
||||
$(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)"
|
||||
$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz:
|
||||
git archive HEAD | xz --compress > $@
|
||||
|
|
|
|||
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
|
||||
|
|
|
|||
5
eeprom.c
5
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,
|
||||
|
|
@ -50,6 +51,7 @@ char *eeprom_get_flash_type(u8 flash_id) {
|
|||
case ID_EEPROM_4M: return "4Mb";
|
||||
case ID_EEPROM_8M: return "8Mb";
|
||||
case ID_EEPROM_16M: return "16Mb";
|
||||
case ID_EEPROM_32M: return "32Mb";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
|
@ -61,6 +63,7 @@ static u32 eeprom_get_flash_size(u8 flash_id) {
|
|||
case ID_EEPROM_4M: return 0x400000 / 8;
|
||||
case ID_EEPROM_8M: return 0x800000 / 8;
|
||||
case ID_EEPROM_16M: return 0x1000000 / 8;
|
||||
case ID_EEPROM_32M: return 0x2000000 / 8;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -73,6 +76,7 @@ void eeprom_prepare_boot_block(u8 flash_id) {
|
|||
case ID_EEPROM_4M: boot_block[25] = 0x04; break;
|
||||
case ID_EEPROM_8M: boot_block[25] = 0x08; break;
|
||||
case ID_EEPROM_16M: boot_block[25] = 0x10; break;
|
||||
case ID_EEPROM_32M: boot_block[25] = 0x20; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +87,7 @@ u32 eeprom_calc_user_space(u8 flash_id) {
|
|||
case ID_EEPROM_4M: return 0x40000; break;
|
||||
case ID_EEPROM_8M: return 0x80000; break;
|
||||
case ID_EEPROM_16M: return 0x100000; break;
|
||||
case ID_EEPROM_32M: return 0x200000; break;
|
||||
default: return 0x80000; break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
eeprom.h
2
eeprom.h
|
|
@ -27,7 +27,7 @@
|
|||
#define ID_EEPROM_4M 0x12
|
||||
#define ID_EEPROM_8M 0x13
|
||||
#define ID_EEPROM_16M 0x14
|
||||
#define ID_EEPROM_25M 0x15
|
||||
#define ID_EEPROM_32M 0x15
|
||||
|
||||
#define PAGE_SIZE 256
|
||||
#define SECTOR_SIZE 65536
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@
|
|||
//
|
||||
|
||||
#ifdef __linux__
|
||||
#if MESAFLASH_IO
|
||||
#include <sys/io.h>
|
||||
#endif
|
||||
#include <pci/pci.h>
|
||||
#elif _WIN32
|
||||
#include <windows.h>
|
||||
|
|
@ -209,6 +211,7 @@ static u8 recv_byte_gpio(llio_t *self) {
|
|||
|
||||
// spi access via io ports like on 3x20
|
||||
|
||||
#if MESAFLASH_IO
|
||||
static void wait_for_data_io(llio_t *self) {
|
||||
board_t *board = self->board;
|
||||
u32 i = 0;
|
||||
|
|
@ -310,6 +313,7 @@ static u8 recv_byte_epp(llio_t *self) {
|
|||
epp_addr8(board, EPP_SPI_SREG_REG);
|
||||
return epp_read8(board);
|
||||
}
|
||||
#endif
|
||||
|
||||
// pci flash
|
||||
|
||||
|
|
@ -435,12 +439,14 @@ void open_spi_access_local(llio_t *self) {
|
|||
eeprom_access.recv_byte = &recv_byte_hm2;
|
||||
break;
|
||||
case BOARD_FLASH_IO:
|
||||
#if MESAFLASH_IO
|
||||
eeprom_access.set_cs_low = &set_cs_low_io;
|
||||
eeprom_access.set_cs_high = &set_cs_high_io;
|
||||
eeprom_access.prefix = &prefix_io;
|
||||
eeprom_access.suffix = &suffix_io;
|
||||
eeprom_access.send_byte = &send_byte_io;
|
||||
eeprom_access.recv_byte = &recv_byte_io;
|
||||
#endif
|
||||
break;
|
||||
case BOARD_FLASH_GPIO:
|
||||
eeprom_access.set_cs_low = &set_cs_low_gpio;
|
||||
|
|
@ -452,12 +458,14 @@ void open_spi_access_local(llio_t *self) {
|
|||
init_gpio(self);
|
||||
break;
|
||||
case BOARD_FLASH_EPP:
|
||||
#if MESAFLASH_IO
|
||||
eeprom_access.set_cs_low = &set_cs_low_epp;
|
||||
eeprom_access.set_cs_high = &set_cs_high_epp;
|
||||
eeprom_access.prefix = &prefix_epp;
|
||||
eeprom_access.suffix = &suffix_epp;
|
||||
eeprom_access.send_byte = &send_byte_epp;
|
||||
eeprom_access.recv_byte = &recv_byte_epp;
|
||||
#endif
|
||||
break;
|
||||
case BOARD_FLASH_REMOTE:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -36,53 +36,49 @@ extern spi_eeprom_dev_t eeprom_access;
|
|||
// eeprom access functions
|
||||
|
||||
static void read_page(llio_t *self, u32 addr, void *buff) {
|
||||
(void)self;
|
||||
lbp16_cmd_addr_data32 write_addr_pck;
|
||||
lbp16_cmd_addr read_page_pck;
|
||||
int send, recv;
|
||||
|
||||
LBP16_INIT_PACKET8(write_addr_pck, CMD_WRITE_FPGA_FLASH_ADDR32(1), FLASH_ADDR_REG, addr);
|
||||
LBP16_INIT_PACKET4(read_page_pck, CMD_READ_FPGA_FLASH_ADDR32(64), FLASH_DATA_REG);
|
||||
|
||||
send = lbp16_send_packet(&write_addr_pck, sizeof(write_addr_pck));
|
||||
send = lbp16_send_packet(&read_page_pck, sizeof(read_page_pck));
|
||||
recv = lbp16_recv_packet(buff, PAGE_SIZE);
|
||||
lbp16_send_packet_checked(&write_addr_pck, sizeof(write_addr_pck));
|
||||
lbp16_send_packet_checked(&read_page_pck, sizeof(read_page_pck));
|
||||
lbp16_recv_packet_checked(buff, PAGE_SIZE);
|
||||
}
|
||||
|
||||
static void write_page(llio_t *self, u32 addr, void *buff) {
|
||||
(void)self;
|
||||
lbp16_cmd_addr_data32 write_addr_pck;
|
||||
lbp16_write_flash_page_packets write_page_pck;
|
||||
int send, recv;
|
||||
u32 ignored;
|
||||
|
||||
LBP16_INIT_PACKET8(write_addr_pck, CMD_WRITE_FPGA_FLASH_ADDR32(1), FLASH_ADDR_REG, addr);
|
||||
send = lbp16_send_packet(&write_addr_pck, sizeof(write_addr_pck));
|
||||
lbp16_send_packet_checked(&write_addr_pck, sizeof(write_addr_pck));
|
||||
|
||||
LBP16_INIT_PACKET6(write_page_pck.write_ena_pck, CMD_WRITE_COMM_CTRL_ADDR16(1), COMM_CTRL_WRITE_ENA_REG, 0x5A03);
|
||||
LBP16_INIT_PACKET4(write_page_pck.fl_write_page_pck, CMD_WRITE_FPGA_FLASH_ADDR32(64), FLASH_DATA_REG);
|
||||
memcpy(&write_page_pck.fl_write_page_pck.page, buff, 256);
|
||||
send = lbp16_send_packet(&write_page_pck, sizeof(write_page_pck));
|
||||
lbp16_send_packet_checked(&write_page_pck, sizeof(write_page_pck));
|
||||
// packet read for board syncing
|
||||
recv = lbp16_read(CMD_READ_FPGA_FLASH_ADDR32(1), FLASH_ADDR_REG, &ignored, 4);
|
||||
lbp16_read(CMD_READ_FPGA_FLASH_ADDR32(1), FLASH_ADDR_REG, &ignored, 4);
|
||||
}
|
||||
|
||||
static void erase_sector(llio_t *self, u32 addr) {
|
||||
(void)self;
|
||||
lbp16_erase_flash_sector_packets sector_erase_pck;
|
||||
lbp16_cmd_addr_data32 write_addr_pck;
|
||||
int send, recv;
|
||||
u32 ignored;
|
||||
|
||||
LBP16_INIT_PACKET8(write_addr_pck, CMD_WRITE_FPGA_FLASH_ADDR32(1), FLASH_ADDR_REG, addr);
|
||||
send = lbp16_send_packet(&write_addr_pck, sizeof(write_addr_pck));
|
||||
if (send < 0)
|
||||
printf("ERROR: %s(): %s\n", __func__, strerror(errno));
|
||||
lbp16_send_packet_checked(&write_addr_pck, sizeof(write_addr_pck));
|
||||
|
||||
LBP16_INIT_PACKET6(sector_erase_pck.write_ena_pck, CMD_WRITE_COMM_CTRL_ADDR16(1), COMM_CTRL_WRITE_ENA_REG, 0x5A03);
|
||||
LBP16_INIT_PACKET8(sector_erase_pck.fl_erase_pck, CMD_WRITE_FPGA_FLASH_ADDR32(1), FLASH_SEC_ERASE_REG, 0);
|
||||
send = lbp16_send_packet(§or_erase_pck, sizeof(sector_erase_pck));
|
||||
if (send < 0)
|
||||
printf("ERROR: %s(): %s\n", __func__, strerror(errno));
|
||||
lbp16_send_packet_checked(§or_erase_pck, sizeof(sector_erase_pck));
|
||||
// packet read for board syncing
|
||||
recv = lbp16_read(CMD_READ_FPGA_FLASH_ADDR32(1), FLASH_ADDR_REG, &ignored, 4);
|
||||
lbp16_read(CMD_READ_FPGA_FLASH_ADDR32(1), FLASH_ADDR_REG, &ignored, 4);
|
||||
}
|
||||
|
||||
static int remote_start_programming(llio_t *self, u32 start_address, int fsize) {
|
||||
|
|
@ -100,6 +96,7 @@ int remote_verify_flash(llio_t *self, char *bitfile_name, u32 start_address) {
|
|||
}
|
||||
|
||||
void open_spi_access_remote(llio_t *self) {
|
||||
(void)self;
|
||||
eeprom_access.read_page = &read_page;
|
||||
eeprom_access.write_page = &write_page;
|
||||
eeprom_access.erase_sector = &erase_sector;
|
||||
|
|
@ -107,4 +104,5 @@ void open_spi_access_remote(llio_t *self) {
|
|||
};
|
||||
|
||||
void close_spi_access_remote(llio_t *self) {
|
||||
(void)self;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ static void enable_encoder_pins(hostmot2_t *hm2) {
|
|||
|
||||
// Return the physical ports to default
|
||||
static void disable_encoder_pins(llio_t *llio) {
|
||||
(void)llio;
|
||||
}
|
||||
|
||||
int encoder_init(encoder_module_t *enc, board_t *board, int instance, int delay) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
|
||||
#if MESAFLASH_IO
|
||||
#ifdef __linux__
|
||||
#include <linux/parport.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
|
@ -289,6 +290,7 @@ int epp_reset(llio_t *self) {
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int epp_boards_init(board_access_t *access) {
|
||||
(void)access;
|
||||
#ifdef __linux__
|
||||
if (seteuid(0) != 0) {
|
||||
printf("You need root privileges (or setuid root) to access EPP hardware\n");
|
||||
|
|
@ -301,6 +303,7 @@ int epp_boards_init(board_access_t *access) {
|
|||
}
|
||||
|
||||
void epp_boards_cleanup(board_access_t *access) {
|
||||
(void)access;
|
||||
}
|
||||
|
||||
static int epp_board_open(board_t *board) {
|
||||
|
|
@ -519,3 +522,4 @@ void epp_print_info(board_t *board) {
|
|||
|
||||
show_board_info(board);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
197
eth_boards.c
197
eth_boards.c
|
|
@ -99,6 +99,7 @@ static char *eth_socket_get_src_ip() {
|
|||
}
|
||||
|
||||
static int eth_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
if ((size/4) > LBP16_MAX_PACKET_DATA_SIZE) {
|
||||
printf("ERROR: LBP16: Requested %d units to read, but protocol supports up to %d units to be read per packet\n", size/4, LBP16_MAX_PACKET_DATA_SIZE);
|
||||
return -1;
|
||||
|
|
@ -108,6 +109,7 @@ static int eth_read(llio_t *self, u32 addr, void *buffer, int size) {
|
|||
}
|
||||
|
||||
static int eth_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
if ((size/4) > LBP16_MAX_PACKET_DATA_SIZE) {
|
||||
printf("ERROR: LBP16: Requested %d units to write, but protocol supports up to %d units to be write per packet\n", size/4, LBP16_MAX_PACKET_DATA_SIZE);
|
||||
return -1;
|
||||
|
|
@ -130,21 +132,24 @@ static int eth_board_open(board_t *board) {
|
|||
}
|
||||
|
||||
static int eth_board_close(board_t *board) {
|
||||
(void)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;
|
||||
int ret = 0;
|
||||
u32 cookie;
|
||||
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_HM2_COOKIE, HM2_COOKIE_REG);
|
||||
send = lbp16_send_packet(&packet, sizeof(packet));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
sleep_ns(2*1000*1000);
|
||||
recv = lbp16_recv_packet(&cookie, sizeof(cookie));
|
||||
size_t 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);
|
||||
|
|
@ -152,8 +157,8 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
eth_socket_blocking();
|
||||
LBP16_INIT_PACKET4(packet2, CMD_READ_BOARD_INFO_ADDR16_INCR(8), 0);
|
||||
memset(buff, 0, sizeof(buff));
|
||||
send = lbp16_send_packet(&packet2, sizeof(packet2));
|
||||
recv = lbp16_recv_packet(&buff, sizeof(buff));
|
||||
lbp16_send_packet_checked(&packet2, sizeof(packet2));
|
||||
lbp16_recv_packet_checked(&buff, sizeof(buff));
|
||||
|
||||
if (strncmp(buff, "7I80DB-16", 9) == 0) {
|
||||
board->type = BOARD_ETH;
|
||||
|
|
@ -180,6 +185,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 +204,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 +228,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 +252,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);
|
||||
|
|
@ -262,6 +268,7 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
board->llio.ioport_connector_name[0] = "on-card";
|
||||
board->llio.ioport_connector_name[1] = "P1";
|
||||
board->llio.ioport_connector_name[2] = "P2";
|
||||
board->llio.bob_hint[0] = BOB_7I76;
|
||||
board->llio.fpga_part_number = "6slx16ftg256";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.read = ð_read;
|
||||
|
|
@ -270,13 +277,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 +300,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 +323,23 @@ 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.bob_hint[0] = BOB_7I94_0;
|
||||
board->llio.bob_hint[1] = BOB_7I94_1;
|
||||
board->llio.fpga_part_number = "6slx9tqg144";
|
||||
board->llio.num_leds = 4;
|
||||
board->llio.read = ð_read;
|
||||
|
|
@ -341,20 +348,124 @@ 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.bob_hint[0] = BOB_7I95_0;
|
||||
board->llio.bob_hint[1] = BOB_7I95_1;
|
||||
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.bob_hint[0] = BOB_7I96_0;
|
||||
board->llio.bob_hint[1] = BOB_7I96_1;
|
||||
board->llio.bob_hint[2] = BOB_7I96_2;
|
||||
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.bob_hint[0] = BOB_7I97_0;
|
||||
board->llio.bob_hint[1] = BOB_7I97_1;
|
||||
board->llio.bob_hint[2] = BOB_7I97_2;
|
||||
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;
|
||||
}
|
||||
|
|
@ -362,6 +473,7 @@ static int eth_scan_one_addr(board_access_t *access) {
|
|||
// public functions
|
||||
|
||||
int eth_boards_init(board_access_t *access) {
|
||||
(void)access;
|
||||
// open socket
|
||||
#ifdef __linux__
|
||||
sd = socket (PF_INET, SOCK_DGRAM, 0);
|
||||
|
|
@ -392,6 +504,7 @@ int eth_boards_init(board_access_t *access) {
|
|||
}
|
||||
|
||||
void eth_boards_cleanup(board_access_t *access) {
|
||||
(void)access;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < boards_count; i++) {
|
||||
|
|
@ -403,10 +516,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 +535,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) {
|
||||
|
|
@ -474,25 +599,25 @@ void eth_print_info(board_t *board) {
|
|||
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_ETH_EEPROM_ADDR16_INCR(sizeof(eth_area)/2), 0);
|
||||
memset(ð_area, 0, sizeof(eth_area));
|
||||
lbp16_send_packet(&packet, sizeof(packet));
|
||||
lbp16_recv_packet(ð_area, sizeof(eth_area));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(ð_area, sizeof(eth_area));
|
||||
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_COMM_CTRL_ADDR16_INCR(sizeof(stat_area)/2), 0);
|
||||
memset(&stat_area, 0, sizeof(stat_area));
|
||||
lbp16_send_packet(&packet, sizeof(packet));
|
||||
lbp16_recv_packet(&stat_area, sizeof(stat_area));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(&stat_area, sizeof(stat_area));
|
||||
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_BOARD_INFO_ADDR16_INCR(sizeof(info_area)/2), 0);
|
||||
memset(&info_area, 0, sizeof(info_area));
|
||||
lbp16_send_packet(&packet, sizeof(packet));
|
||||
lbp16_recv_packet(&info_area, sizeof(info_area));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(&info_area, sizeof(info_area));
|
||||
|
||||
if (info_area.LBP16_version >= 3) {
|
||||
LBP16_INIT_PACKET4(cmds[4], CMD_READ_AREA_INFO_ADDR16_INCR(LBP16_SPACE_TIMER, sizeof(mem_area)/2), 0);
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_TIMER_ADDR16_INCR(sizeof(timers_area)/2), 0);
|
||||
memset(&timers_area, 0, sizeof(timers_area));
|
||||
lbp16_send_packet(&packet, sizeof(packet));
|
||||
lbp16_recv_packet(&timers_area, sizeof(timers_area));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(&timers_area, sizeof(timers_area));
|
||||
}
|
||||
|
||||
printf("Communication:\n");
|
||||
|
|
@ -511,8 +636,8 @@ void eth_print_info(board_t *board) {
|
|||
|
||||
if ((cmds[i].cmd_lo == 0) && (cmds[i].cmd_hi == 0)) continue;
|
||||
memset(&mem_area, 0, sizeof(mem_area));
|
||||
lbp16_send_packet(&cmds[i], sizeof(cmds[i]));
|
||||
lbp16_recv_packet(&mem_area, sizeof (mem_area));
|
||||
lbp16_send_packet_checked(&cmds[i], sizeof(cmds[i]));
|
||||
lbp16_recv_packet_checked(&mem_area, sizeof (mem_area));
|
||||
|
||||
printf(" %d: %.*s (%s, %s", i, (int)sizeof(mem_area.name), mem_area.name, mem_types[(mem_area.size >> 8) & 0x7F],
|
||||
mem_writeable[(mem_area.size & 0x8000) >> 15]);
|
||||
|
|
@ -549,7 +674,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;
|
||||
}
|
||||
|
|
|
|||
638
hostmot2.c
638
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
|
||||
|
|
@ -16,10 +17,12 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "hostmot2.h"
|
||||
|
||||
|
||||
void hm2_read_idrom(hostmot2_t *hm2) {
|
||||
u32 idrom_addr, cookie;
|
||||
int i;
|
||||
|
|
@ -29,7 +32,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,214 +49,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
|
||||
|
||||
switch (pin->sec_tag) {
|
||||
|
||||
case HM2_GTAG_MUXED_ENCODER:
|
||||
switch (sec_pin) {
|
||||
case 1: return "Muxed A";
|
||||
case 2: return "Muxed B";
|
||||
case 3: return "Muxed Index";
|
||||
case 4: return "Muxed IndexMask";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_MUXED_ENCODER_SEL:
|
||||
switch (sec_pin) {
|
||||
case 1: return "Mux Select 0";
|
||||
case 2: return "Mux Select 1";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_ENCODER:
|
||||
switch (sec_pin) {
|
||||
case 1: return "A";
|
||||
case 2: return "B";
|
||||
case 3: return "Index";
|
||||
case 4: return "IndexMask";
|
||||
case 5: return "Probe";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_RESOLVER:
|
||||
switch (sec_pin) {
|
||||
case 1: return "NC";
|
||||
case 2: return "REFPDM+";
|
||||
case 3: return "REFPDM-";
|
||||
case 4: return "AMUX0";
|
||||
case 5: return "AMUX1";
|
||||
case 6: return "AMUX2";
|
||||
case 7: return "SPICS";
|
||||
case 8: return "SPICLK";
|
||||
case 9: return "SPIDO0";
|
||||
case 10: return "SPIDO1";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_PWMGEN:
|
||||
// FIXME: these depend on the pwmgen mode
|
||||
switch (sec_pin) {
|
||||
case 1: return "Out0 (PWM or Up)";
|
||||
case 2: return "Out1 (Dir or Down)";
|
||||
case 3: return "Not-Enable";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_TPPWM:
|
||||
switch (sec_pin) {
|
||||
case 1: return "PWM A";
|
||||
case 2: return "PWM B";
|
||||
case 3: return "PWM C";
|
||||
case 4: return "PWM /A";
|
||||
case 5: return "PWM /B";
|
||||
case 6: return "PWM /C";
|
||||
case 7: return "Enable";
|
||||
case 8: return "Fault";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_STEPGEN:
|
||||
// FIXME: these depend on the stepgen mode
|
||||
switch (sec_pin) {
|
||||
case 1: return "Step";
|
||||
case 2: return "Direction";
|
||||
case 3: return "(unused)";
|
||||
case 4: return "(unused)";
|
||||
case 5: return "(unused)";
|
||||
case 6: return "(unused)";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_SSERIAL:
|
||||
if (pin->sec_pin & 0x80){ // Output pin codes
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "TxData0";
|
||||
case 0x2: return "TxData1";
|
||||
case 0x3: return "TxData2";
|
||||
case 0x4: return "TxData3";
|
||||
case 0x5: return "TxData4";
|
||||
case 0x6: return "TxData5";
|
||||
case 0x7: return "TxData6";
|
||||
case 0x8: return "TxData7";
|
||||
case 0x11: return "TxEn0 ";
|
||||
case 0x12: return "TxEn1 ";
|
||||
case 0x13: return "TxEn2 ";
|
||||
case 0x14: return "TxEn3 ";
|
||||
case 0x15: return "TxEn4 ";
|
||||
case 0x16: return "TxEn5 ";
|
||||
case 0x17: return "TxEn6 ";
|
||||
case 0x18: return "TxEn7 ";
|
||||
}
|
||||
break;
|
||||
}else{ // INput Pin Codes
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "RxData0";
|
||||
case 0x2: return "RxData1";
|
||||
case 0x3: return "RxData2";
|
||||
case 0x4: return "RxData3";
|
||||
case 0x5: return "RxData4";
|
||||
case 0x6: return "RxData5";
|
||||
case 0x7: return "RxData6";
|
||||
case 0x8: return "RxData7";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HM2_GTAG_BSPI:
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "/Frame";
|
||||
case 0x2: return "Serial Out";
|
||||
case 0x3: return "Clock";
|
||||
case 0x4: return "Serial In";
|
||||
case 0x5: return "CS0";
|
||||
case 0x6: return "CS1";
|
||||
case 0x7: return "CS2";
|
||||
case 0x8: return "CS3";
|
||||
case 0x9: return "CS4";
|
||||
case 0xA: return "CS5";
|
||||
case 0xB: return "CS6";
|
||||
case 0xC: return "CS7";
|
||||
}
|
||||
break;
|
||||
|
||||
case HM2_GTAG_UART_RX:
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "RX Data";
|
||||
}
|
||||
break;
|
||||
case HM2_GTAG_UART_TX:
|
||||
switch (sec_pin) {
|
||||
case 0x1: return "TX Data";
|
||||
case 0x2: return "Drv Enable";
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
snprintf(unknown, sizeof(unknown), "unknown-pin-%d", sec_pin & 0x7F);
|
||||
return unknown;
|
||||
}
|
||||
|
||||
hm2_module_desc_t *hm2_find_module(hostmot2_t *hm2, u8 gtag) {
|
||||
int i;
|
||||
|
||||
|
|
@ -264,7 +59,7 @@ hm2_module_desc_t *hm2_find_module(hostmot2_t *hm2, u8 gtag) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source) {
|
||||
void hm2_set_pin_source(hostmot2_t *hm2, u32 pin_number, u8 source) {
|
||||
u32 data;
|
||||
u16 addr;
|
||||
hm2_module_desc_t *md = hm2_find_module(hm2, HM2_GTAG_IOPORT);
|
||||
|
|
@ -273,7 +68,7 @@ void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source) {
|
|||
printf("hm2_set_pin_source(): no IOPORT module found\n");
|
||||
return;
|
||||
}
|
||||
if ((pin_number < 0) || (pin_number >= (hm2->idrom.io_ports*hm2->idrom.io_width))) {
|
||||
if (pin_number >= (hm2->idrom.io_ports*hm2->idrom.io_width)) {
|
||||
printf("hm2_set_pin_source(): invalid pin number %d\n", pin_number);
|
||||
return;
|
||||
}
|
||||
|
|
@ -291,7 +86,7 @@ void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source) {
|
|||
hm2->llio->write(hm2->llio, addr + HM2_MOD_OFFS_GPIO_ALT_SOURCE + (pin_number / 24)*4, &data, sizeof(data));
|
||||
}
|
||||
|
||||
void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction) {
|
||||
void hm2_set_pin_direction(hostmot2_t *hm2, u32 pin_number, u8 direction) {
|
||||
u32 data;
|
||||
u16 addr;
|
||||
hm2_module_desc_t *md = hm2_find_module(hm2, HM2_GTAG_IOPORT);
|
||||
|
|
@ -300,7 +95,7 @@ void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction) {
|
|||
printf("hm2_set_pin_direction(): no IOPORT module found\n");
|
||||
return;
|
||||
}
|
||||
if ((pin_number < 0) || (pin_number >= (hm2->idrom.io_ports*hm2->idrom.io_width))) {
|
||||
if (pin_number >= (hm2->idrom.io_ports*hm2->idrom.io_width)) {
|
||||
printf("hm2_set_pin_direction(): invalid pin number %d\n", pin_number);
|
||||
return;
|
||||
}
|
||||
|
|
@ -318,100 +113,175 @@ 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 bob_pin_name_t bob_pin_names[MAX_BOB_NAMES] = {
|
||||
{BOB_7I76, {"TB2-4,5","TB2-2,3","TB2-10,11","TB2-8,9","TB2-16,17","TB2-14,15","TB2-22,23","TB2-20,21",
|
||||
"TB3-4,5","TB3-2,3","Internal-Field-IO","Internal-Field-IO","TB3-18,19","TB3-16,17","TB3-13,14","TB3-10,11","TB3-7,8"}},
|
||||
|
||||
{BOB_7I77, {"Internal-TXEn","TB6-5,6","TB6-3,4","Internal-Analog-IO","Internal-Analog-IO","Internal-Field-IO","Internal-Field-IO","Internal-EncMux",
|
||||
"TB3-1,2,9,10","TB3-4,5,12,13","TB3-7,8,15,16","TB3-17,18,TB4-1,2","TB3-20,21,TB4-4,5","TB3-23,24,TB4-7,8","TB4-9,10,17,18","TB4-12,13,20,21","TB4-15,16,23,24"}},
|
||||
|
||||
{BOB_7I94_0, {"P1-01/DB25-01","P1-02/DB25-14","P1-03/DB25-02","P1-04/DB25-15",
|
||||
"P1-05/DB25-03","P1-06/DB25-16","P1-07/DB25-04","P1-08/DB25-17","P1-09/DB25-05","P1-11/DB25-06","P1-13/DB25-07",
|
||||
"P1-15/DB25-08","P1-17/DB25-09","P1-19/DB25-10","P1-21/DB25-11","P1-23/DB25-12","P1-25/DB25-13","J6 1,2","J6 3,6","J6 TXEN","J7 1,2"}},
|
||||
{BOB_7I94_1, {"J7-3,6","J7-TXEN","J8-1,2","J8-3,6","J8-TXEN","J9-1,2","J9-3,6","J9-TXEN","J4-1,2","J4-3,6",
|
||||
"J4-TXEN","J3-1,2","J3-3,6","J3-TXEN","J2-1,2","J2-3,6","J2-TXEN","J1-1,2","J1-3,6","J1-TXEN","P2-/ENA"}},
|
||||
|
||||
{BOB_7I95_0, {"TB3-2,3","TB3-4,5","TB3-8,9","TB3-10,11","TB3-14,15","TB3-16,17","TB3-20,21","TB3-22,23",
|
||||
"TB4-2,3","TB4-4,5","TB4-8,9","TB4-10,11","TB2-14,15","TB4-16,17","Internal","TB4-20,21","TB4-22,23","Internal",
|
||||
"TB1-1,2,9,10","TB1-4,5,12,13","TB1-7,8,15,16","TB1-17,18 TB2-1,2","TB1-20,21 TB2-4,5","TB1-23,24,TB2-7,8",
|
||||
"TB2-9,10,17,18","TB2-11,12,20,21","TB2-15,16,23,24","Internal","Internal"}},
|
||||
{BOB_7I95_1, {"Internal","Internal","Internal","Internal","Internal","TB3 13,14","TB3 15,16","TB3 17,18",
|
||||
"TB3-19,20","TB3-21,22","TB3-23,24","Internal","P1-01/DB25-01","P1-02/DB25-14","P1-03/DB25-02","P1-04/DB25-15",
|
||||
"P1-05/DB25-03","P1-06/DB25-16","P1-07/DB25-04","P1-08/DB25-17","P1-09/DB25-05","P1-11/DB25-06","P1-13/DB25-07",
|
||||
"P1-15/DB25-08","P1-17/DB25-09","P1-19/DB25-10","P1-21/DB25-11","P1-23/DB25-12","P1-25/DB25-13"}},
|
||||
|
||||
{BOB_7I96_0, {"TB3-1","TB3-2","TB3-3","TB3-4","TB3-5","TB3-6","TB3-7","TB3-8","TB3-9","TB3-10","TB3-11",
|
||||
"TB3-13,14","TB3-15,16","TB3-17,18","TB3-19,20","TB3-21,22","TB3-23,24"}},
|
||||
{BOB_7I96_1, {"TB1-2,3","TB1-4,5","TB1-8,9","TB1-10,11","TB1-14,15","TB1-16,17","TB1-20,21","TB1-22,23",
|
||||
"TB2-2,3","TB2-4,5","TB2-7,8","TB2-10,11","TB2-13,14","TB2-16,17","TB2-18,19","Internal-TXEn","Internal"}},
|
||||
{BOB_7I96_2, {"P1-01/DB25-01","P1-02/DB25-14","P1-03/DB25-02","P1-04/DB25-15",
|
||||
"P1-05/DB25-03","P1-06/DB25-16","P1-07/DB25-04","P1-08/DB25-17","P1-09/DB25-05","P1-11/DB25-06","P1-13/DB25-07",
|
||||
"P1-15/DB25-08","P1-17/DB25-09","P1-19/DB25-10","P1-21/DB25-11","P1-23/DB25-12","P1-25/DB25-13"}},
|
||||
|
||||
{BOB_7I97_0, {"TB3-4","TB3-8","TB3-12","TB3-16","TB3-20","TB3-20","TB3-24","TB3-24","TB3-4,8,12,16",
|
||||
"TB1-1,2,9,10","TB1-4,5,12,13","TB1-7,8,15,16","TB1-17,18,TB2 1,2","TB1-20,21,TB2-4,5","TB1-23,24,TB2-7,8",
|
||||
"TB2-9,10,17,18","TB2-12,13,20,21"}},
|
||||
{BOB_7I97_1, {"TB2-15,16,23,24","Internal-EncMux","TB5-13,14","TB5-15,16","TB5-17,18","TB5-19,20","TB5-21,22",
|
||||
"TB5-23,24","Internal","Internal","Internal","Internal","Internal","Internal","TB4-15,16","TB4-17,18","Internal-TXEn"}},
|
||||
{BOB_7I97_2, {"P1-01/DB25-01","P1-02/DB25-14","P1-03/DB25-02","P1-04/DB25-15",
|
||||
"P1-05/DB25-03","P1-06/DB25-16","P1-07/DB25-04","P1-08/DB25-17","P1-09/DB25-05","P1-11/DB25-06","P1-13/DB25-07",
|
||||
"P1-15/DB25-08","P1-17/DB25-09","P1-19/DB25-10","P1-21/DB25-11","P1-23/DB25-12","P1-25/DB25-13"}},
|
||||
|
||||
{BOB_7C80_0, {"TB7-2,3","TB7-4,5","TB8-2,3","TB8-4,5","TB9-2,3","TB9-4,5","TB10-2,3","TB10-4,5","TB11-2,3","TB11-4,5",
|
||||
"TB12-2,3","TB13-4,5","TB3-3,4","TB3-5,6","Internal","TB4-1,2","TB4-4,5","TB4-7,8","TB5-2","TB5-2","TB5-5,6","TB5-7,8"
|
||||
"Internal","Internal","Internal","Internal","Internal"}},
|
||||
{BOB_7C80_1, {"Internal","TB13-1,2","TB13-3,4","TB13-5,6","TB13-7,8","TB14-1,2","TB14-3,4","TB14-5,6","TB14-7,8",
|
||||
"Internal", "P1-01/DB25-01","P1-02/DB25-14","P1-03/DB25-02","P1-04/DB25-15",
|
||||
"P1-05/DB25-03","P1-06/DB25-16","P1-07/DB25-04","P1-08/DB25-17","P1-09/DB25-05","P1-11/DB25-06","P1-13/DB25-07",
|
||||
"P1-15/DB25-08","P1-17/DB25-09","P1-19/DB25-10","P1-21/DB25-11","P1-23/DB25-12","P1-25/DB25-13"}},
|
||||
|
||||
{BOB_7C81_0, {"P1-01/DB25-01","P1-02/DB25-14","P1-03/DB25-02","P1-04/DB25-15",
|
||||
"P1-05/DB25-03","P1-06/DB25-16","P1-07/DB25-04","P1-08/DB25-17","P1-09/DB25-05","P1-11/DB25-06","P1-13/DB25-07",
|
||||
"P1-15/DB25-08","P1-17/DB25-09","P1-19/DB25-10","P1-21/DB25-11","P1-23/DB25-12","P1-25/DB25-13","P5 3,6","P6 3,6"}},
|
||||
{BOB_7C81_1, {"P2-01/DB25-01","P2-02/DB25-14","P2-03/DB25-02","P2-04/DB25-15",
|
||||
"P2-05/DB25-03","P2-06/DB25-16","P2-07/DB25-04","P2-08/DB25-17","P2-09/DB25-05","P2-11/DB25-06","P2-13/DB25-07",
|
||||
"P2-15/DB25-08","P2-17/DB25-09","P2-19/DB25-10","P2-21/DB25-11","P2-23/DB25-12","P2-25/DB25-13","P5 TXEN","P6 TXEN"}},
|
||||
{BOB_7C81_2, {"P7-01/DB25-01","P7-02/DB25-14","P7-03/DB25-02","P7-04/DB25-15",
|
||||
"P7-05/DB25-03","P7-06/DB25-16","P7-07/DB25-04","P7-08/DB25-17","P7-09/DB25-05","P7-11/DB25-06","P7-13/DB25-07",
|
||||
"P7-15/DB25-08","P7-17/DB25-09","P7-19/DB25-10","P7-21/DB25-11","P7-23/DB25-12","P7-25/DB25-13","P5 1,2","P6 1,2"}},
|
||||
|
||||
{BOB_7I74, {"CHAN0-RX","CHAN1-RX","CHAN2-RX","CHAN3-RX","CHAN0-TX","CHAN1-TX","CHAN2-TX","CHAN3-TX",
|
||||
"CHAN4-RX","CHAN5-RX","CHAN6-RX","CHAN7-RX","CHAN4-TX","CHAN5-TX","CHAN6-TX","CHAN7-TX","CHAN7-TXEn"}},
|
||||
|
||||
{BOB_7I78, {"TB1-4,5","TB1-2,3","TB1-10,11","TB1-8,9","TB1-16,17","TB1-14,15","TB1-22,23","TB1-20,21","TB2-18","TB2-21,22",
|
||||
"TB2-23,24","TB2-12,13","Internal-TXEn","TB2-10,11","TB2-7,8","TB2-4,5","TB2-1,2"}},
|
||||
|
||||
{BOB_7I85, {"TB1-19,20","TB1-21,22","TB1-11,12","TB1-13,14","TB1-3,4","TB1-5,6","TB2-19,20","TB2-21,22","TB2-11,12","TB2-13,14",
|
||||
"Internal-EncMux","TB3-1,2,9,10","TB3-4,5,12,13","TB3-7,8,12,13","TB3-17,18,TB2-1,2","TB3-20,21,TB2-4,5","TB3-23,24,TB2-7,8"}},
|
||||
|
||||
{BOB_7I88, {"TB2-2,3","TB2-4,5","TB2-8,9","TB2-10,11","TB2-14,15","TB2-16,17","TB2-20,21","TB2-22,23","TB3-2,3","TB3-4,5",
|
||||
"TB3,8,9","TB3-10,11","TB3-13,14","TB3-16,17","TB3-20,21,Opt-TXEn","TB3-22,23","Opt-TB3-20,21"}},
|
||||
|
||||
{BOB_7I89, {"TB3-1,2,9,10","TB3-4,5,12,13","TB2-7,8,15,16","TB3-17,18,TB2-1,2","TB3-20,21,TB2-4,5","TB3-23,24,TB2-7,8","TB2-9,10,17,18",
|
||||
"TB2-12,13,20,21","TB2-15,16,23,24","TB1-1,2,9,10","TB1-4,5,12,13","TB1-7,8,15,16","Internal-EncMux","Internal-EncPower","TB1-19,20","TB1-21,22","Internal-TXEn"}},
|
||||
|
||||
{BOB_DMM4250, {"Spindle-PWM","Drive-Enable","X-Dir","EStop-In","X-Step","Output-16","Y-Dir",
|
||||
"Output-17","Y-Step","Z-Dir","Z-Step","A-Dir","A-Step,Charge-Pump","X-Limit","Y-Limit","Z-Limit","A-Limit"}},
|
||||
|
||||
{BOB_5ABOB, {"Spindle-PWM","Drive-Enable","X-Step","Input-P15","X-Dir","B-Step","Y-Step",
|
||||
"B-Dir,Relay","Y-Dir","Z-Step","Z-Dir","A-Step","A-Dir","Input-P10","Input-P11","Input-P12","Input-P13"}},
|
||||
|
||||
{BOB_G540, {"Output-2","Spindle-PWM","X-Step","Fault","X-Dir","Charge-Pump","Y-Step",
|
||||
"Output-1","Y-Dir","Z-Step","Z-Dir","A-Step","A-Dir","Input-1","Input-2","Input-3","Input-4"}},
|
||||
|
||||
{BOB_C11, {"Relay-2","Spindle-Rate","Out-2","Input-P15","Out-3","Relay-1","Out-4",
|
||||
"Charge-Pump","Out-5","Out-6","Out-7","Out-8","Out-9","Input-P10","Input-P11","Input-P12","Input-P13"}},
|
||||
|
||||
{BOB_C11G, {"Relay-3","Spindle-PWM","Out-2","Input-P15","Out-3","Spindle-Dir","Out-4",
|
||||
"Charge-Pump,Relay-3","Out-5","Out-6","Out-7","Out-8","Out-9","Input-P10","Input-P11","Input-P12","Input-P13"}},
|
||||
|
||||
{BOB_7I33TA, {"TB2-4,5","TB2-1,2","TB1-4,5","TB1-1,2","TB2-7,8","TB1-7,8","TB2-10:PWM","TB1-10:PWM","TB2-10:Dir","TB1-10:Dir","TB2-12:Ena","TB1-12:Ena",
|
||||
"TB2-16,17","TB2-13,14","TB1-16,17","TB1-13,14","TB2-19,20","TB1-19,20","TB2-22:PWM","TB1-22:PWM","TB2-22:Dir","TB1-22:Dir","TB2-24:Ena","TB1-24:Ena"}},
|
||||
|
||||
{BOB_7I37TA, {"TB1-1,2","TB2-1,2","TB1-3,4","TB2-3,4","TB1-5,6","TB2-5,6","TB1-7,8","TB2-7,8","TB1-9,10","TB2-9,10","TB1-11,12","TB2-11,12",
|
||||
"TB1-13,14","TB2-13,14","TB1-15,16","TB2-15,16","TB1-17,18","TB2-17,18","TB1-19,20","TB2-19,20","TB1-21,22","TB2-21,22","TB1-23,24","TB2-23,24"}},
|
||||
|
||||
{BOB_7I44, {"CHAN0-RX","CHAN1-RX","CHAN2-RX","CHAN3-RX","CHAN0-TX","CHAN0-TXEn","CHAN1-TX","CHAN1-TXEn","CHAN2-TX","CHAN2-TXEn","CHAN3-TX","CHAN3-TXEn",
|
||||
"CHAN4-RX","CHAN5-RX","CHAN6-RX","CHAN7-RX","CHAN4-TX","CHAN4-TXEn","CHAN5-TX","CHAN5-TXEn","CHAN6-TX","CHAN6-TXEn","CHAN7-TX","CHAN7-TXEn"}},
|
||||
|
||||
{BOB_7I47, {"P2-1,2","P2-4,5","P2-7,8","P2-10,11","P4-1,2","P3-1,2","P4-4,5","P3-4,5","P4-7,8","P3-7,8","P4-9,10","P3-9,10",
|
||||
"P4-12,13","P3-12,13","P4-15,16","P3-15,16","P2-13,14","P2-16,17","P2-19,20","P2-22,23","P4-19,20","P4-22,23","P3-19,20","P3-22,23"}},
|
||||
|
||||
{BOB_7I47S, {"P2-1,2","P2-4,5","P2-7,8","P2-10,11","P4-1,2","P3-1,2","P4-4,5","P3-4,5","P4-7,8","P3-7,8","P4-9,10","P3-9,10",
|
||||
"P4-12,13","P3-12,13","P4-15,16","P3-15,16","P2-15,16:Aux","P2-17,18:Dir","P2-19,20:/Ena","P2-23:PWM","P4-19,20","P4-22,23","P3-19,20","P3-22,23"}},
|
||||
|
||||
{BOB_7I48, {"/Ena0","P4-1,2,9,10","P4-4,5,12,13","P4-7,8,15,16","P3-1,2,9,10","P3-4,5,12,13","P3-7,8,15,16","P2-1,2,9,10","P2-4,5,12,13","P2-7,8,15,16",
|
||||
"Internal-EncMux","P4-20:PWM-Up","P4-20:PWM-Dwn","P4-24:PWM-Up","P4-24:PWM-Dwn","P3-20:PWM-Up","P3-20:PWM-Dwn","P3-24:PWM-Up","P3-24:PWM-Dwn",
|
||||
"P2-20:PWM-Up","P2-20:PWM-Dwn","P2-24:PWM-Up","P2-24:PWM-Dwn","/Ena1"}},
|
||||
|
||||
{BOB_7I52, {"P2-5,6:/Ena","P5-1,2,9,10","P5-4,5,12,13","P5-7,8,15,16","P5-17,18,P4-1,2","P5-20,21,P4-4,5","P5-23,24,P4-7,8","P3-9,10,17,18","P3-12,13,20,21",
|
||||
"P3-15,16,23,24","Internal-EncMux","P2-21,22","P2-19,20","P2-13,14","P2-11,12","P2-5,6","P2-3,4","P3-21,22","P3-19,20","P3-13,14","P3-11,12","P3-5,6","P3-3,4","P3-5,6:/Ena"}}
|
||||
|
||||
};
|
||||
|
||||
static struct {
|
||||
int value;
|
||||
const char *name;
|
||||
} bob_names[] = {
|
||||
{ BOB_7I76, "7I76" },
|
||||
{ BOB_7I77, "7I77" },
|
||||
{ BOB_7I94_0, "7I94_0" },
|
||||
{ BOB_7I94_1, "7I94_1" },
|
||||
{ BOB_7I95_0, "7I95_0" },
|
||||
{ BOB_7I95_1, "7I95_1" },
|
||||
{ BOB_7I96_0, "7I96_0" },
|
||||
{ BOB_7I96_1, "7I96_1" },
|
||||
{ BOB_7I96_2, "7I96_2" },
|
||||
{ BOB_7I97_0, "7I97_0" },
|
||||
{ BOB_7I97_1, "7I97_1" },
|
||||
{ BOB_7I97_2, "7I97_2" },
|
||||
{ BOB_7C80_0, "7C80_0" },
|
||||
{ BOB_7C80_1, "7C80_1" },
|
||||
{ BOB_7C81_0, "7C81_0" },
|
||||
{ BOB_7C81_1, "7C81_1" },
|
||||
{ BOB_7C81_2, "7C81_2" },
|
||||
{ BOB_7I74, "7I74" },
|
||||
{ BOB_7I78, "7I78" },
|
||||
{ BOB_7I85, "7I85" },
|
||||
{ BOB_7I85, "7I85S"},
|
||||
{ BOB_7I88, "7I88"},
|
||||
{ BOB_7I89, "7I89"},
|
||||
{ BOB_DMM4250, "DMM4250"},
|
||||
{ BOB_5ABOB, "5ABOB"},
|
||||
{ BOB_G540, "G540"},
|
||||
{ BOB_C11, "C11"},
|
||||
{ BOB_C11G, "C11G"},
|
||||
{ BOB_7I33TA, "7I33TA"},
|
||||
{ BOB_7I37TA, "7I37TA"},
|
||||
{ BOB_7I47, "7I44"},
|
||||
{ BOB_7I47, "7I47"},
|
||||
{ BOB_7I47S, "7I47S"},
|
||||
{ BOB_7I48, "7I48"},
|
||||
{ BOB_7I52, "7I52"},
|
||||
{ BOB_7I52, "7I52S"},
|
||||
{ -1, NULL },
|
||||
};
|
||||
|
||||
static pin_name_t pin_names[HM2_MAX_TAGS] = {
|
||||
{HM2_GTAG_NONE, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_IRQ_LOGIC, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_WATCHDOG, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_IOPORT, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_ENCODER, {"Quad-A", "Quad-B", "Quad-IDX", "Quad-IDXM", "Quad-Probe", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER, {"MuxQ-A", "MuxQ-B", "MuxQ-IDX", "MuxQ-IDXM", "Quad-ProbeM", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_ENCODER, {"Quad-A", "Quad-B", "Quad-IDX", "Quad-IDXM", "Quad-Probe", "Shared-IDX", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER, {"MuxQ-A", "MuxQ-B", "MuxQ-IDX", "MuxQ-IDXM", "Quad-ProbeM", "Shared-IDX", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER_SEL, {"MuxSel0", "MuxSel1", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER_MIM, {"MuxQ-A", "MuxQ-B", "MuxQ-IDX", "MuxQ-IDXM", "Quad-ProbeM", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER_MIM, {"MuxQ-A", "MuxQ-B", "MuxQ-IDX", "MuxQ-IDXM", "Quad-ProbeM", "Shared-IDX", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{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_STEPGEN, {"Step/Table1", "Dir/Table2", "Table3", "Table4", "Table5", "Table6", "Table7", "Table8", "Index", "Probe"}},
|
||||
{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"}},
|
||||
|
|
@ -419,17 +289,26 @@ static pin_name_t pin_names[HM2_MAX_TAGS] = {
|
|||
{HM2_GTAG_BIN_DMDMA, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{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_SSERIALB, {"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_PKTUART_TX, {"TXData", "TXEna", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_PKTUART_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_SIGMA5, {"TXData", "RXData", "TxEn", "Null4", "Null5", "Null6", "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"}},
|
||||
{HM2_GTAG_DPAINTER, {"VidData", "VidClk", "Null3", "Null4", "Null5","Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
};
|
||||
|
||||
static pin_name_t pin_names_xml[HM2_MAX_TAGS] = {
|
||||
|
|
@ -438,12 +317,13 @@ static pin_name_t pin_names_xml[HM2_MAX_TAGS] = {
|
|||
{HM2_GTAG_WATCHDOG, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_IOPORT, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_ENCODER, {"Phase A", "Phase B", "Index", "Quad-IDXM", "Quad-Probe", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER, {"Muxed Phase A", "Muxed Phase B", "Muxed Index", "MuxQ-IDXM", "Quad-ProbeM", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER, {"Muxed Phase A", "Muxed Phase B", "Muxed Index", "MuxQ-IDXM", "Quad-ProbeM", "Shared-IDX", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER_SEL, {"Muxed Encoder Select 0", "Muxed Encoder select 1", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER_MIM, {"MuxQ-A", "MuxQ-B", "MuxQ-IDX", "MuxQ-IDXM", "Quad-ProbeM", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_MUXED_ENCODER_MIM, {"MuxQ-A", "MuxQ-B", "MuxQ-IDX", "MuxQ-IDXM", "Quad-ProbeM", "Shared-IDX", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{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_STEPGEN, {"Step/Table1", "Dir/Table2", "Table3", "Table4", "Table5", "Table6", "Table7", "Table8", "Index", "Probe"}},
|
||||
{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"}},
|
||||
|
|
@ -451,17 +331,26 @@ static pin_name_t pin_names_xml[HM2_MAX_TAGS] = {
|
|||
{HM2_GTAG_BIN_DMDMA, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{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_SSERIALB, {"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_PKTUART_TX, {"TXData", "TXEna", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
{HM2_GTAG_PKTUART_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_SIGMA5, {"TXData", "RXData", "TxEn", "Null4", "Null5", "Null6", "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"}},
|
||||
{HM2_GTAG_DPAINTER, {"VidData", "VidClk", "Null3", "Null4", "Null5","Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||
};
|
||||
|
||||
static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
||||
|
|
@ -472,10 +361,13 @@ 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},
|
||||
{"UARTRX", HM2_GTAG_UART_RX},
|
||||
{"PktUARTTX", HM2_GTAG_PKTUART_TX},
|
||||
{"PktUARTRX", HM2_GTAG_PKTUART_RX},
|
||||
{"AddrX", HM2_GTAG_TRAM},
|
||||
{"MuxedQCount", HM2_GTAG_MUXED_ENCODER},
|
||||
{"MuxedQCountSel", HM2_GTAG_MUXED_ENCODER_SEL},
|
||||
|
|
@ -493,8 +385,15 @@ static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
|||
{"LED", HM2_GTAG_LED},
|
||||
{"ResolverMod", HM2_GTAG_RESOLVER},
|
||||
{"SSerial", HM2_GTAG_SSERIAL},
|
||||
{"SSerialB", HM2_GTAG_SSERIALB},
|
||||
{"Twiddler", HM2_GTAG_TWIDDLER},
|
||||
{"Transformer", HM2_GTAG_XFORMER},
|
||||
{"SSR", HM2_GTAG_SSR},
|
||||
{"InMux", HM2_GTAG_INMUX},
|
||||
{"Sigma5Enc", HM2_GTAG_SIGMA5},
|
||||
{"InM", HM2_GTAG_INM},
|
||||
{"BISS", HM2_GTAG_BISS},
|
||||
{"XYMod", HM2_GTAG_XYMOD},
|
||||
{"DataPainter",HM2_GTAG_DPAINTER},
|
||||
};
|
||||
|
||||
static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
||||
|
|
@ -505,10 +404,13 @@ 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},
|
||||
{"UARTRX", HM2_GTAG_UART_RX},
|
||||
{"PktUARTTX", HM2_GTAG_PKTUART_TX},
|
||||
{"PktUARTRX", HM2_GTAG_PKTUART_RX},
|
||||
{"AddrX", HM2_GTAG_TRAM},
|
||||
{"MuxedQCount", HM2_GTAG_MUXED_ENCODER},
|
||||
{"MuxedQCountSel", HM2_GTAG_MUXED_ENCODER_SEL},
|
||||
|
|
@ -526,12 +428,20 @@ static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
|||
{"LED", HM2_GTAG_LED},
|
||||
{"ResolverMod", HM2_GTAG_RESOLVER},
|
||||
{"SSerial", HM2_GTAG_SSERIAL},
|
||||
{"SSerialB", HM2_GTAG_SSERIALB},
|
||||
{"Twiddler", HM2_GTAG_TWIDDLER},
|
||||
{"Transformer", HM2_GTAG_XFORMER},
|
||||
{"SSR", HM2_GTAG_SSR},
|
||||
{"InMux", HM2_GTAG_INMUX},
|
||||
{"Sigma5Enc", HM2_GTAG_SIGMA5},
|
||||
{"InM", HM2_GTAG_INM},
|
||||
{"BISS", HM2_GTAG_BISS},
|
||||
{"XYMod", HM2_GTAG_XYMOD},
|
||||
{"DataPainter",HM2_GTAG_DPAINTER},
|
||||
};
|
||||
|
||||
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 +458,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;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -566,8 +478,8 @@ 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;
|
||||
if ((pin->sec_tag == HM2_GTAG_SSERIAL) || (pin->sec_tag == HM2_GTAG_SSERIALB)) {
|
||||
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 +493,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 +533,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 +580,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 +612,21 @@ 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;
|
||||
}
|
||||
if (llio->bob_hint[i] != 0) {
|
||||
printf("%-18s",bob_pin_names[llio->bob_hint[i]-1].name[j]);
|
||||
} else {
|
||||
printf("%2u ", pin_nr);
|
||||
}
|
||||
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 +662,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 +684,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));
|
||||
|
|
@ -775,7 +701,11 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
|||
}
|
||||
}
|
||||
printf("</secondaryfunctionname>\n");
|
||||
if (llio->bob_hint[i] != 0) {
|
||||
printf(" <secondaryinstance>%-18s</secondaryinstance>\n",bob_pin_names[llio->bob_hint[i]-1].name[j]);
|
||||
} else {
|
||||
printf(" <secondaryinstance>%2d</secondaryinstance>\n", pin_nr);
|
||||
}
|
||||
printf(" </pin>\n");
|
||||
}
|
||||
}
|
||||
|
|
@ -783,3 +713,45 @@ 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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int hm2_find_bob_hint_by_name(const char *name) {
|
||||
for (size_t i=0; bob_names[i].name; i++) {
|
||||
if(strcasecmp(bob_names[i].name, name) == 0) {
|
||||
return bob_names[i].value;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
22
hostmot2.h
22
hostmot2.h
|
|
@ -36,7 +36,8 @@ typedef struct {
|
|||
int sw_modes_cnt;
|
||||
} sserial_device_t;
|
||||
|
||||
#define HM2_MAX_TAGS 30
|
||||
#define HM2_MAX_TAGS 255
|
||||
#define MAX_BOB_NAMES 35
|
||||
#define ANYIO_MAX_IOPORT_CONNECTORS 8
|
||||
|
||||
typedef struct llio_struct llio_t;
|
||||
|
|
@ -60,12 +61,13 @@ struct llio_struct {
|
|||
int num_ioport_connectors;
|
||||
int pins_per_connector;
|
||||
const char *ioport_connector_name[ANYIO_MAX_IOPORT_CONNECTORS];
|
||||
u16 bob_hint[ANYIO_MAX_IOPORT_CONNECTORS];
|
||||
int num_leds;
|
||||
const char *fpga_part_number;
|
||||
char board_name[16];
|
||||
void *board;
|
||||
hostmot2_t hm2;
|
||||
sserial_interface_t ss_interface[HM2_SSERIAL_MAX_INTEFACES];
|
||||
sserial_interface_t ss_interface[HM2_SSERIAL_MAX_INTERFACES];
|
||||
sserial_device_t ss_device[HM2_SSERIAL_MAX_CHANNELS];
|
||||
int verbose;
|
||||
};
|
||||
|
|
@ -75,21 +77,25 @@ typedef struct {
|
|||
char *name[10];
|
||||
} pin_name_t;
|
||||
|
||||
typedef struct {
|
||||
u16 bobname;
|
||||
char *name[32];
|
||||
} bob_pin_name_t;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
u8 tag;
|
||||
} mod_name_t;
|
||||
|
||||
int hm2_check_cookie(llio_t *llio);
|
||||
void hm2_read_idrom(hostmot2_t *hm2);
|
||||
hm2_module_desc_t *hm2_find_module(hostmot2_t *hm2, u8 gtag);
|
||||
void hm2_print_idrom(hostmot2_t *hm2);
|
||||
void hm2_print_modules(hostmot2_t *hm2);
|
||||
void hm2_print_pins(hostmot2_t *hm2);
|
||||
void hm2_print_pin_file(llio_t *llio, int xml_flag);
|
||||
void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source);
|
||||
void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction);
|
||||
void hm2_print_pin_descriptors(llio_t *llio);
|
||||
void hm2_set_pin_source(hostmot2_t *hm2, u32 pin_number, u8 source);
|
||||
void hm2_set_pin_direction(hostmot2_t *hm2, u32 pin_number, u8 direction);
|
||||
void sserial_module_init(llio_t *llio);
|
||||
|
||||
int hm2_find_bob_hint_by_name(const char *arg);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -59,12 +59,24 @@
|
|||
#define HM2_GTAG_BISS 0x18
|
||||
#define HM2_GTAG_FABS 0x19
|
||||
#define HM2_GTAG_HM2DPLL 0x1A
|
||||
#define HM2_GTAG_PKTUART_TX 0x1B
|
||||
#define HM2_GTAG_PKTUART_RX 0x1C
|
||||
#define HM2_GTAG_INMUX 0x1E
|
||||
#define HM2_GTAG_SIGMA5 0x1F
|
||||
#define HM2_GTAG_INM 0x23
|
||||
#define HM2_GTAG_DPAINTER 0x2A
|
||||
#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
|
||||
#define HM2_GTAG_CPDRIVE 0xC4
|
||||
#define HM2_GTAG_DSAD 0xC5
|
||||
#define HM2_GTAG_SSERIALB 0xC6
|
||||
|
||||
|
||||
// HM2 EEPROM SPI INTERFACE
|
||||
|
||||
|
|
@ -207,7 +219,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
|
||||
|
|
@ -268,6 +280,45 @@ typedef struct {
|
|||
#define SSLBP_REMOTE_7I77_ANALOG 0x11000000
|
||||
#define SSLBP_REMOTE_7I77_IO 0x12000000
|
||||
|
||||
// must match BOB name order
|
||||
# define BOB_7I76 1
|
||||
# define BOB_7I77 2
|
||||
# define BOB_7I94_0 3
|
||||
# define BOB_7I94_1 4
|
||||
# define BOB_7I95_0 5
|
||||
# define BOB_7I95_1 6
|
||||
# define BOB_7I96_0 7
|
||||
# define BOB_7I96_1 8
|
||||
# define BOB_7I96_2 9
|
||||
# define BOB_7I97_0 10
|
||||
# define BOB_7I97_1 11
|
||||
# define BOB_7I97_2 12
|
||||
# define BOB_7C80_0 13
|
||||
# define BOB_7C80_1 14
|
||||
# define BOB_7C81_0 15
|
||||
# define BOB_7C81_1 16
|
||||
# define BOB_7C81_2 17
|
||||
# define BOB_7I74 18
|
||||
# define BOB_7I78 19
|
||||
# define BOB_7I85 20
|
||||
# define BOB_7I85S 20
|
||||
# define BOB_7I88 21
|
||||
# define BOB_7I89 22
|
||||
# define BOB_DMM4250 23
|
||||
# define BOB_5ABOB 24
|
||||
# define BOB_G540 25
|
||||
# define BOB_C11 26
|
||||
# define BOB_C11G 27
|
||||
# define BOB_7I33TA 28
|
||||
# define BOB_7I37TA 29
|
||||
# define BOB_7I44 30
|
||||
# define BOB_7I47 31
|
||||
# define BOB_7I47S 32
|
||||
# define BOB_7I48 33
|
||||
# define BOB_7I52 34
|
||||
|
||||
|
||||
|
||||
struct sserial_pdd_struct {
|
||||
u8 record_type;
|
||||
u8 data_size;
|
||||
|
|
|
|||
55
lbp.c
55
lbp.c
|
|
@ -22,54 +22,60 @@
|
|||
#include <sys/fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "types.h"
|
||||
#include "boards.h"
|
||||
#include "lbp.h"
|
||||
|
||||
#ifdef __linux__
|
||||
int sd;
|
||||
static int sd = -1;
|
||||
#elif _WIN32
|
||||
HANDLE sd;
|
||||
#endif
|
||||
|
||||
int lbp_send(void *packet, int size) {
|
||||
void lbp_send_checked(void *packet, int size) {
|
||||
#ifdef __linux__
|
||||
int send = write(sd, packet, size);
|
||||
int result = write(sd, packet, size);
|
||||
if (result != size) {
|
||||
perror("write(lbp_send_checked)");
|
||||
abort();
|
||||
}
|
||||
#elif _WIN32
|
||||
DWORD send = 0;
|
||||
WriteFile(sd, packet, size, &send, NULL);
|
||||
BOOL result = WriteFile(sd, packet, size, &send, NULL);
|
||||
if (!result) {
|
||||
printf("WriteFile(lbp_send_checked): %d\n", GetLastError());
|
||||
}
|
||||
#endif
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("%d=lbp_send(%d)\n", send, size);
|
||||
return send;
|
||||
}
|
||||
|
||||
int lbp_recv(void *packet, int size) {
|
||||
void lbp_recv_checked(void *packet, int size) {
|
||||
#ifdef __linux__
|
||||
int recv = read(sd, packet, size);
|
||||
int result = read(sd, packet, size);
|
||||
if (result != size) {
|
||||
perror("read(lbp_recv_checked)");
|
||||
abort();
|
||||
}
|
||||
#elif _WIN32
|
||||
DWORD recv = 0;
|
||||
ReadFile(sd, packet, size, &recv, NULL);
|
||||
BOOL result = ReadFile(sd, packet, size, &recv, NULL);
|
||||
if (!result) {
|
||||
printf("ReadFile(lbp_recv_checked): %d\n", GetLastError());
|
||||
}
|
||||
#endif
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("%d=lbp_recv(%d)\n", recv, size);
|
||||
return recv;
|
||||
}
|
||||
|
||||
u8 lbp_read_ctrl(u8 cmd) {
|
||||
u8 data;
|
||||
int send, recv;
|
||||
|
||||
send = lbp_send(&cmd, 1);
|
||||
recv = lbp_recv(&data, 1);
|
||||
lbp_send_checked(&cmd, 1);
|
||||
lbp_recv_checked(&data, 1);
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("%d=send(%X), %d=recv(%X)\n", send, cmd, recv, data);
|
||||
printf("send(%X), recv(%X)\n", cmd, data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int lbp_read(u16 addr, void *buffer) {
|
||||
int send, recv;
|
||||
lbp_cmd_addr packet;
|
||||
u32 *ptr = buffer;
|
||||
|
||||
|
|
@ -77,15 +83,15 @@ int lbp_read(u16 addr, void *buffer) {
|
|||
packet.addr_hi = LO_BYTE(addr);
|
||||
packet.addr_lo = HI_BYTE(addr);
|
||||
|
||||
send = lbp_send(&packet, sizeof(lbp_cmd_addr));
|
||||
recv = lbp_recv(buffer, 4);
|
||||
lbp_send_checked(&packet, sizeof(lbp_cmd_addr));
|
||||
lbp_recv_checked(buffer, 4);
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("lbp_read(%02X:%04X): %08X\n", packet.cmd, addr, *ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lbp_write(u16 addr, void *buffer) {
|
||||
int send;
|
||||
lbp_cmd_addr_data packet;
|
||||
|
||||
packet.cmd = LBP_CMD_WRITE | LBP_ARGS_32BIT;
|
||||
|
|
@ -93,9 +99,10 @@ int lbp_write(u16 addr, void *buffer) {
|
|||
packet.addr_lo = HI_BYTE(addr);
|
||||
memcpy(&packet.data, buffer, 4);
|
||||
|
||||
send = lbp_send(&packet, sizeof(lbp_cmd_addr_data));
|
||||
lbp_send_checked(&packet, sizeof(lbp_cmd_addr_data));
|
||||
if (LBP_SENDRECV_DEBUG)
|
||||
printf("lbp_write(%02X:%04X)\n", packet.cmd, addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
4
lbp.h
4
lbp.h
|
|
@ -80,8 +80,8 @@ struct lbp_cmd_addr_data_struct {
|
|||
} __attribute__ ((__packed__));
|
||||
typedef struct lbp_cmd_addr_data_struct lbp_cmd_addr_data;
|
||||
|
||||
int lbp_send(void *packet, int size);
|
||||
int lbp_recv(void *packet, int size);
|
||||
void lbp_send_checked(void *packet, int size);
|
||||
void lbp_recv_checked(void *packet, int size);
|
||||
u8 lbp_read_ctrl(u8 cmd);
|
||||
int lbp_read(u16 addr, void *buffer);
|
||||
int lbp_write(u16 addr, void *buffer);
|
||||
|
|
|
|||
39
lbp16.c
39
lbp16.c
|
|
@ -19,6 +19,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include "types.h"
|
||||
#include "lbp16.h"
|
||||
#include "eth_boards.h"
|
||||
|
|
@ -26,27 +27,38 @@
|
|||
|
||||
static lbp16_access_t lbp16_access;
|
||||
|
||||
int lbp16_send_packet(void *packet, int size) {
|
||||
return lbp16_access.send_packet(packet, size);
|
||||
void lbp16_send_packet_checked(void *packet, int size) {
|
||||
int result = lbp16_access.send_packet(packet, size);
|
||||
if (size != result) {
|
||||
perror("lbp16_access.send_packet");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int lbp16_recv_packet(void *packet, int size) {
|
||||
return lbp16_access.recv_packet(packet, size);
|
||||
}
|
||||
|
||||
void lbp16_recv_packet_checked(void *packet, int size) {
|
||||
int result = lbp16_access.recv_packet(packet, size);
|
||||
if (size != result) {
|
||||
perror("lbp16_access.recv_packet");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int lbp16_read(u16 cmd, u32 addr, void *buffer, int size) {
|
||||
lbp16_cmd_addr packet;
|
||||
int send, recv;
|
||||
u8 local_buff[size];
|
||||
|
||||
LBP16_INIT_PACKET4(packet, cmd, addr);
|
||||
if (LBP16_SENDRECV_DEBUG) {
|
||||
printf("SEND: %02X %02X %02X %02X | REQUEST %d bytes\n", packet.cmd_hi, packet.cmd_lo, packet.addr_hi, packet.addr_lo, size);
|
||||
}
|
||||
send = lbp16_access.send_packet(&packet, sizeof(packet));
|
||||
recv = lbp16_access.recv_packet(&local_buff, sizeof(local_buff));
|
||||
lbp16_access.send_packet(&packet, sizeof(packet));
|
||||
lbp16_access.recv_packet(&local_buff, sizeof(local_buff));
|
||||
if (LBP16_SENDRECV_DEBUG) {
|
||||
printf("RECV: %d bytes\n", recv);
|
||||
printf("RECV: %zd bytes\n", sizeof(local_buff));
|
||||
}
|
||||
memcpy(buffer, local_buff, size);
|
||||
|
||||
|
|
@ -58,7 +70,6 @@ int lbp16_write(u16 cmd, u32 addr, void *buffer, int size) {
|
|||
lbp16_cmd_addr wr_packet;
|
||||
u8 tmp_buffer[LBP16_MAX_PACKET_DATA_SIZE*8];
|
||||
} packet;
|
||||
int send;
|
||||
|
||||
LBP16_INIT_PACKET4(packet.wr_packet, cmd, addr);
|
||||
memcpy(&packet.tmp_buffer, buffer, size);
|
||||
|
|
@ -66,32 +77,31 @@ int lbp16_write(u16 cmd, u32 addr, void *buffer, int size) {
|
|||
printf("SEND: %02X %02X %02X %02X | WRITE %d bytes\n", packet.wr_packet.cmd_hi, packet.wr_packet.cmd_lo,
|
||||
packet.wr_packet.addr_hi, packet.wr_packet.addr_lo, size);
|
||||
}
|
||||
send = lbp16_access.send_packet(&packet, sizeof(lbp16_cmd_addr) + size);
|
||||
lbp16_access.send_packet(&packet, sizeof(lbp16_cmd_addr) + size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lbp16_board_reset(llio_t *self) {
|
||||
int send;
|
||||
(void)self;
|
||||
lbp16_cmd_addr_data16 packet;
|
||||
|
||||
LBP16_INIT_PACKET6(packet, CMD_WRITE_COMM_CTRL_ADDR16(1), 0x1C, 0x0001); // reset if != 0
|
||||
send = lbp16_send_packet(&packet, sizeof(packet));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lbp16_board_reload(llio_t *self, int fallback_flag) {
|
||||
board_t *board = self->board;
|
||||
int send;
|
||||
u32 boot_addr;
|
||||
u16 fw_ver;
|
||||
lbp16_cmd_addr_data16 packet[14];
|
||||
lbp16_cmd_addr fw_packet;
|
||||
|
||||
LBP16_INIT_PACKET4(fw_packet, CMD_READ_BOARD_INFO_ADDR16(1), offsetof(lbp_info_area, firmware_version));
|
||||
lbp16_send_packet(&fw_packet, sizeof(fw_packet));
|
||||
lbp16_recv_packet(&fw_ver, sizeof(fw_ver));
|
||||
lbp16_send_packet_checked(&fw_packet, sizeof(fw_packet));
|
||||
lbp16_recv_packet_checked(&fw_ver, sizeof(fw_ver));
|
||||
|
||||
if ((board->type & BOARD_ETH) && (fw_ver < 15)) {
|
||||
printf("ERROR: FPGA reload only supported by ethernet card firmware > 14.\n");
|
||||
|
|
@ -122,7 +132,7 @@ int lbp16_board_reload(llio_t *self, int fallback_flag) {
|
|||
LBP16_INIT_PACKET6(packet[11], CMD_WRITE_COMM_CTRL_ADDR16(1), 0x1E, 0x2000); // NOP
|
||||
LBP16_INIT_PACKET6(packet[12], CMD_WRITE_COMM_CTRL_ADDR16(1), 0x1E, 0x2000); // NOP
|
||||
LBP16_INIT_PACKET6(packet[13], CMD_WRITE_COMM_CTRL_ADDR16(1), 0x1E, 0x2000); // NOP
|
||||
send = lbp16_send_packet(&packet, sizeof(packet));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -143,4 +153,5 @@ void lbp16_init(int board_type) {
|
|||
}
|
||||
|
||||
void lbp_cleanup(int board_type) {
|
||||
(void)board_type;
|
||||
}
|
||||
|
|
|
|||
3
lbp16.h
3
lbp16.h
|
|
@ -256,7 +256,8 @@ int lbp16_read(u16 cmd, u32 addr, void *buffer, int size);
|
|||
int lbp16_write(u16 cmd, u32 addr, void *buffer, int size);
|
||||
int lbp16_board_reset(llio_t *self);
|
||||
int lbp16_board_reload(llio_t *self, int fallback_flag);
|
||||
int lbp16_send_packet(void *packet, int size);
|
||||
void lbp16_send_packet_checked(void *packet, int size);
|
||||
int lbp16_recv_packet(void *packet, int size);
|
||||
void lbp16_recv_packet_checked(void *packet, int size);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
BIN
libpci.dll
BIN
libpci.dll
Binary file not shown.
|
|
@ -1,6 +0,0 @@
|
|||
#define PCI_ARCH_I386
|
||||
#define PCI_OS_WINDOWS
|
||||
#define PCI_HAVE_PM_INTEL_CONF
|
||||
#define PCI_IDS "pci.ids"
|
||||
#define PCI_PATH_IDS_DIR "."
|
||||
#define PCILIB_VERSION "3.1.10"
|
||||
1204
libpci/header.h
1204
libpci/header.h
File diff suppressed because it is too large
Load diff
240
libpci/pci.h
240
libpci/pci.h
|
|
@ -1,240 +0,0 @@
|
|||
/*
|
||||
* The PCI Library
|
||||
*
|
||||
* Copyright (c) 1997--2009 Martin Mares <mj@ucw.cz>
|
||||
*
|
||||
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||
*/
|
||||
|
||||
#ifndef _PCI_LIB_H
|
||||
#define _PCI_LIB_H
|
||||
|
||||
#ifndef PCI_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "header.h"
|
||||
#include "types.h"
|
||||
|
||||
#define PCI_LIB_VERSION 0x030100
|
||||
|
||||
#ifndef PCI_ABI
|
||||
#define PCI_ABI
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PCI Access Structure
|
||||
*/
|
||||
|
||||
struct pci_methods;
|
||||
|
||||
enum pci_access_type {
|
||||
/* Known access methods, remember to update access.c as well */
|
||||
PCI_ACCESS_AUTO, /* Autodetection */
|
||||
PCI_ACCESS_SYS_BUS_PCI, /* Linux /sys/bus/pci */
|
||||
PCI_ACCESS_PROC_BUS_PCI, /* Linux /proc/bus/pci */
|
||||
PCI_ACCESS_I386_TYPE1, /* i386 ports, type 1 */
|
||||
PCI_ACCESS_I386_TYPE2, /* i386 ports, type 2 */
|
||||
PCI_ACCESS_FBSD_DEVICE, /* FreeBSD /dev/pci */
|
||||
PCI_ACCESS_AIX_DEVICE, /* /dev/pci0, /dev/bus0, etc. */
|
||||
PCI_ACCESS_NBSD_LIBPCI, /* NetBSD libpci */
|
||||
PCI_ACCESS_OBSD_DEVICE, /* OpenBSD /dev/pci */
|
||||
PCI_ACCESS_DUMP, /* Dump file */
|
||||
PCI_ACCESS_MAX
|
||||
};
|
||||
|
||||
struct pci_access {
|
||||
/* Options you can change: */
|
||||
unsigned int method; /* Access method */
|
||||
int writeable; /* Open in read/write mode */
|
||||
int buscentric; /* Bus-centric view of the world */
|
||||
|
||||
char *id_file_name; /* Name of ID list file (use pci_set_name_list_path()) */
|
||||
int free_id_name; /* Set if id_file_name is malloced */
|
||||
int numeric_ids; /* Enforce PCI_LOOKUP_NUMERIC (>1 => PCI_LOOKUP_MIXED) */
|
||||
|
||||
unsigned int id_lookup_mode; /* pci_lookup_mode flags which are set automatically */
|
||||
/* Default: PCI_LOOKUP_CACHE */
|
||||
|
||||
int debugging; /* Turn on debugging messages */
|
||||
|
||||
/* Functions you can override: */
|
||||
void (*error)(char *msg, ...) PCI_PRINTF(1,2); /* Write error message and quit */
|
||||
void (*warning)(char *msg, ...) PCI_PRINTF(1,2); /* Write a warning message */
|
||||
void (*debug)(char *msg, ...) PCI_PRINTF(1,2); /* Write a debugging message */
|
||||
|
||||
struct pci_dev *devices; /* Devices found on this bus */
|
||||
|
||||
/* Fields used internally: */
|
||||
struct pci_methods *methods;
|
||||
struct pci_param *params;
|
||||
struct id_entry **id_hash; /* names.c */
|
||||
struct id_bucket *current_id_bucket;
|
||||
int id_load_failed;
|
||||
int id_cache_status; /* 0=not read, 1=read, 2=dirty */
|
||||
int fd; /* proc/sys: fd for config space */
|
||||
int fd_rw; /* proc/sys: fd opened read-write */
|
||||
int fd_pos; /* proc/sys: current position */
|
||||
int fd_vpd; /* sys: fd for VPD */
|
||||
struct pci_dev *cached_dev; /* proc/sys: device the fds are for */
|
||||
};
|
||||
|
||||
/* Initialize PCI access */
|
||||
struct pci_access *pci_alloc(void) PCI_ABI;
|
||||
void pci_init(struct pci_access *) PCI_ABI;
|
||||
void pci_cleanup(struct pci_access *) PCI_ABI;
|
||||
|
||||
/* Scanning of devices */
|
||||
void pci_scan_bus(struct pci_access *acc) PCI_ABI;
|
||||
struct pci_dev *pci_get_dev(struct pci_access *acc, int domain, int bus, int dev, int func) PCI_ABI; /* Raw access to specified device */
|
||||
void pci_free_dev(struct pci_dev *) PCI_ABI;
|
||||
|
||||
/* Names of access methods */
|
||||
int pci_lookup_method(char *name) PCI_ABI; /* Returns -1 if not found */
|
||||
char *pci_get_method_name(int index) PCI_ABI; /* Returns "" if unavailable, NULL if index out of range */
|
||||
|
||||
/*
|
||||
* Named parameters
|
||||
*/
|
||||
|
||||
struct pci_param {
|
||||
struct pci_param *next; /* Please use pci_walk_params() for traversing the list */
|
||||
char *param; /* Name of the parameter */
|
||||
char *value; /* Value of the parameter */
|
||||
int value_malloced; /* used internally */
|
||||
char *help; /* Explanation of the parameter */
|
||||
};
|
||||
|
||||
char *pci_get_param(struct pci_access *acc, char *param) PCI_ABI;
|
||||
int pci_set_param(struct pci_access *acc, char *param, char *value) PCI_ABI; /* 0 on success, -1 if no such parameter */
|
||||
/* To traverse the list, call pci_walk_params repeatedly, first with prev=NULL, and do not modify the parameters during traversal. */
|
||||
struct pci_param *pci_walk_params(struct pci_access *acc, struct pci_param *prev) PCI_ABI;
|
||||
|
||||
/*
|
||||
* Devices
|
||||
*/
|
||||
|
||||
struct pci_dev {
|
||||
struct pci_dev *next; /* Next device in the chain */
|
||||
u16 domain; /* PCI domain (host bridge) */
|
||||
u8 bus, dev, func; /* Bus inside domain, device and function */
|
||||
|
||||
/* These fields are set by pci_fill_info() */
|
||||
int known_fields; /* Set of info fields already known */
|
||||
u16 vendor_id, device_id; /* Identity of the device */
|
||||
u16 device_class; /* PCI device class */
|
||||
int irq; /* IRQ number */
|
||||
pciaddr_t base_addr[6]; /* Base addresses including flags in lower bits */
|
||||
pciaddr_t size[6]; /* Region sizes */
|
||||
pciaddr_t rom_base_addr; /* Expansion ROM base address */
|
||||
pciaddr_t rom_size; /* Expansion ROM size */
|
||||
struct pci_cap *first_cap; /* List of capabilities */
|
||||
char *phy_slot; /* Physical slot */
|
||||
|
||||
/* Fields used internally: */
|
||||
struct pci_access *access;
|
||||
struct pci_methods *methods;
|
||||
u8 *cache; /* Cached config registers */
|
||||
int cache_len;
|
||||
int hdrtype; /* Cached low 7 bits of header type, -1 if unknown */
|
||||
void *aux; /* Auxillary data */
|
||||
};
|
||||
|
||||
#define PCI_ADDR_IO_MASK (~(pciaddr_t) 0x3)
|
||||
#define PCI_ADDR_MEM_MASK (~(pciaddr_t) 0xf)
|
||||
#define PCI_ADDR_FLAG_MASK 0xf
|
||||
|
||||
u8 pci_read_byte(struct pci_dev *, int pos) PCI_ABI; /* Access to configuration space */
|
||||
u16 pci_read_word(struct pci_dev *, int pos) PCI_ABI;
|
||||
u32 pci_read_long(struct pci_dev *, int pos) PCI_ABI;
|
||||
int pci_read_block(struct pci_dev *, int pos, u8 *buf, int len) PCI_ABI;
|
||||
int pci_read_vpd(struct pci_dev *d, int pos, u8 *buf, int len) PCI_ABI;
|
||||
int pci_write_byte(struct pci_dev *, int pos, u8 data) PCI_ABI;
|
||||
int pci_write_word(struct pci_dev *, int pos, u16 data) PCI_ABI;
|
||||
int pci_write_long(struct pci_dev *, int pos, u32 data) PCI_ABI;
|
||||
int pci_write_block(struct pci_dev *, int pos, u8 *buf, int len) PCI_ABI;
|
||||
|
||||
int pci_fill_info(struct pci_dev *, int flags) PCI_ABI; /* Fill in device information */
|
||||
|
||||
#define PCI_FILL_IDENT 1
|
||||
#define PCI_FILL_IRQ 2
|
||||
#define PCI_FILL_BASES 4
|
||||
#define PCI_FILL_ROM_BASE 8
|
||||
#define PCI_FILL_SIZES 16
|
||||
#define PCI_FILL_CLASS 32
|
||||
#define PCI_FILL_CAPS 64
|
||||
#define PCI_FILL_EXT_CAPS 128
|
||||
#define PCI_FILL_PHYS_SLOT 256
|
||||
#define PCI_FILL_RESCAN 0x10000
|
||||
|
||||
void pci_setup_cache(struct pci_dev *, u8 *cache, int len) PCI_ABI;
|
||||
|
||||
/*
|
||||
* Capabilities
|
||||
*/
|
||||
|
||||
struct pci_cap {
|
||||
struct pci_cap *next;
|
||||
u16 id; /* PCI_CAP_ID_xxx */
|
||||
u16 type; /* PCI_CAP_xxx */
|
||||
unsigned int addr; /* Position in the config space */
|
||||
};
|
||||
|
||||
#define PCI_CAP_NORMAL 1 /* Traditional PCI capabilities */
|
||||
#define PCI_CAP_EXTENDED 2 /* PCIe extended capabilities */
|
||||
|
||||
struct pci_cap *pci_find_cap(struct pci_dev *, unsigned int id, unsigned int type) PCI_ABI;
|
||||
|
||||
/*
|
||||
* Filters
|
||||
*/
|
||||
|
||||
struct pci_filter {
|
||||
int domain, bus, slot, func; /* -1 = ANY */
|
||||
int vendor, device;
|
||||
};
|
||||
|
||||
void pci_filter_init(struct pci_access *, struct pci_filter *) PCI_ABI;
|
||||
char *pci_filter_parse_slot(struct pci_filter *, char *) PCI_ABI;
|
||||
char *pci_filter_parse_id(struct pci_filter *, char *) PCI_ABI;
|
||||
int pci_filter_match(struct pci_filter *, struct pci_dev *) PCI_ABI;
|
||||
|
||||
/*
|
||||
* Conversion of PCI ID's to names (according to the pci.ids file)
|
||||
*
|
||||
* Call pci_lookup_name() to identify different types of ID's:
|
||||
*
|
||||
* VENDOR (vendorID) -> vendor
|
||||
* DEVICE (vendorID, deviceID) -> device
|
||||
* VENDOR | DEVICE (vendorID, deviceID) -> combined vendor and device
|
||||
* SUBSYSTEM | VENDOR (subvendorID) -> subsystem vendor
|
||||
* SUBSYSTEM | DEVICE (vendorID, deviceID, subvendorID, subdevID) -> subsystem device
|
||||
* SUBSYSTEM | VENDOR | DEVICE (vendorID, deviceID, subvendorID, subdevID) -> combined subsystem v+d
|
||||
* SUBSYSTEM | ... (-1, -1, subvendorID, subdevID) -> generic subsystem
|
||||
* CLASS (classID) -> class
|
||||
* PROGIF (classID, progif) -> programming interface
|
||||
*/
|
||||
|
||||
char *pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, ...) PCI_ABI;
|
||||
|
||||
int pci_load_name_list(struct pci_access *a) PCI_ABI; /* Called automatically by pci_lookup_*() when needed; returns success */
|
||||
void pci_free_name_list(struct pci_access *a) PCI_ABI; /* Called automatically by pci_cleanup() */
|
||||
void pci_set_name_list_path(struct pci_access *a, char *name, int to_be_freed) PCI_ABI;
|
||||
void pci_id_cache_flush(struct pci_access *a) PCI_ABI;
|
||||
|
||||
enum pci_lookup_mode {
|
||||
PCI_LOOKUP_VENDOR = 1, /* Vendor name (args: vendorID) */
|
||||
PCI_LOOKUP_DEVICE = 2, /* Device name (args: vendorID, deviceID) */
|
||||
PCI_LOOKUP_CLASS = 4, /* Device class (args: classID) */
|
||||
PCI_LOOKUP_SUBSYSTEM = 8,
|
||||
PCI_LOOKUP_PROGIF = 16, /* Programming interface (args: classID, prog_if) */
|
||||
PCI_LOOKUP_NUMERIC = 0x10000, /* Want only formatted numbers; default if access->numeric_ids is set */
|
||||
PCI_LOOKUP_NO_NUMBERS = 0x20000, /* Return NULL if not found in the database; default is to print numerically */
|
||||
PCI_LOOKUP_MIXED = 0x40000, /* Include both numbers and names */
|
||||
PCI_LOOKUP_NETWORK = 0x80000, /* Try to resolve unknown ID's by DNS */
|
||||
PCI_LOOKUP_SKIP_LOCAL = 0x100000, /* Do not consult local database */
|
||||
PCI_LOOKUP_CACHE = 0x200000, /* Consult the local cache before using DNS */
|
||||
PCI_LOOKUP_REFRESH_CACHE = 0x400000, /* Forget all previously cached entries, but still allow updating the cache */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* The PCI Library -- Types and Format Strings
|
||||
*
|
||||
* Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
|
||||
*
|
||||
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef PCI_HAVE_Uxx_TYPES
|
||||
|
||||
#ifdef PCI_OS_WINDOWS
|
||||
#include <windef.h>
|
||||
typedef BYTE u8;
|
||||
typedef WORD u16;
|
||||
typedef DWORD u32;
|
||||
#elif defined(PCI_HAVE_STDINT_H) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
||||
#include <stdint.h>
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
#else
|
||||
typedef u_int8_t u8;
|
||||
typedef u_int16_t u16;
|
||||
typedef u_int32_t u32;
|
||||
#endif
|
||||
|
||||
#ifdef PCI_HAVE_64BIT_ADDRESS
|
||||
#include <limits.h>
|
||||
#if ULONG_MAX > 0xffffffff
|
||||
typedef unsigned long u64;
|
||||
#define PCI_U64_FMT "l"
|
||||
#else
|
||||
typedef unsigned long long u64;
|
||||
#define PCI_U64_FMT "ll"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* PCI_HAVE_Uxx_TYPES */
|
||||
|
||||
#ifdef PCI_HAVE_64BIT_ADDRESS
|
||||
typedef u64 pciaddr_t;
|
||||
#define PCIADDR_T_FMT "%08" PCI_U64_FMT "x"
|
||||
#define PCIADDR_PORT_FMT "%04" PCI_U64_FMT "x"
|
||||
#else
|
||||
typedef u32 pciaddr_t;
|
||||
#define PCIADDR_T_FMT "%08x"
|
||||
#define PCIADDR_PORT_FMT "%04x"
|
||||
#endif
|
||||
|
||||
#ifdef PCI_ARCH_SPARC64
|
||||
/* On sparc64 Linux the kernel reports remapped port addresses and IRQ numbers */
|
||||
#undef PCIADDR_PORT_FMT
|
||||
#define PCIADDR_PORT_FMT PCIADDR_T_FMT
|
||||
#define PCIIRQ_FMT "%08x"
|
||||
#else
|
||||
#define PCIIRQ_FMT "%d"
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ > 2
|
||||
#define PCI_PRINTF(x,y) __attribute__((format(printf, x, y)))
|
||||
#else
|
||||
#define PCI_PRINTF(x,y)
|
||||
#endif
|
||||
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
|
||||
157
mesaflash.c
157
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~pre1"
|
||||
#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;
|
||||
|
|
@ -59,6 +66,9 @@ static int info_flag;
|
|||
static int verbose_flag;
|
||||
static char bitfile_name[255];
|
||||
static board_access_t access;
|
||||
static int bob_hints[6];
|
||||
|
||||
#define array_size(x) ((sizeof(x) / sizeof(x[0])))
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"device", required_argument, 0, 'd'},
|
||||
|
|
@ -72,6 +82,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},
|
||||
|
|
@ -83,6 +94,12 @@ static struct option long_options[] = {
|
|||
{"wpo", required_argument, 0, 'o'},
|
||||
{"set", required_argument, 0, 's'},
|
||||
{"xml", no_argument, &xml_flag, 1},
|
||||
{"dbname1", required_argument, NULL, '1'},
|
||||
{"dbname2", required_argument, NULL, '2'},
|
||||
{"dbname3", required_argument, NULL, '3'},
|
||||
{"dbname4", required_argument, NULL, '4'},
|
||||
{"dbname5", required_argument, NULL, '5'},
|
||||
{"dbname6", required_argument, NULL, '6'},
|
||||
{"info", required_argument, 0, 'i'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"verbose", no_argument, &verbose_flag, 1},
|
||||
|
|
@ -90,10 +107,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 +126,59 @@ 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(" --dbname# <name> Set daughter board name to <name> for FPGA connector <N> \n");
|
||||
printf(" Allows readhmid to include daughterboard terminal names\n");
|
||||
printf(" where # can be in the range 1 to 6.\n");
|
||||
printf(" (1 means first FPGA connector)\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 +243,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 %zu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
write_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -213,7 +258,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 %zu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
program_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -285,7 +335,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 %zu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
verify_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -295,7 +350,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 %zu)\n", sizeof(bitfile_name)-1);
|
||||
return 1;
|
||||
}
|
||||
strcpy(bitfile_name, optarg);
|
||||
info_flag++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -306,6 +366,21 @@ int process_cmd_line(int argc, char *argv[]) {
|
|||
}
|
||||
break;
|
||||
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
{
|
||||
int bob_idx = c - '1';
|
||||
int hint = hm2_find_bob_hint_by_name(optarg);
|
||||
if (hint == 0) {
|
||||
printf("--dbname%c %s not recognized\n", c, optarg);
|
||||
}
|
||||
bob_hints[bob_idx] = hint;
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
/* getopt_long already printed an error message. */
|
||||
return -1;
|
||||
|
|
@ -353,6 +428,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);
|
||||
|
|
@ -362,9 +438,16 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
board->open(board);
|
||||
for(size_t i=0; i<array_size(bob_hints); i++) {
|
||||
if(bob_hints[i]) {
|
||||
board->llio.bob_hint[i] = bob_hints[i];
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
93
pci_boards.c
93
pci_boards.c
|
|
@ -16,9 +16,11 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
|
||||
#if MESAFLASH_IO
|
||||
#ifdef __linux__
|
||||
#include <sys/mman.h>
|
||||
#include <sys/io.h>
|
||||
#include <sys/time.h>
|
||||
#include <pci/pci.h>
|
||||
#elif _WIN32
|
||||
#include <windows.h>
|
||||
|
|
@ -29,8 +31,8 @@
|
|||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "types.h"
|
||||
|
|
@ -40,6 +42,27 @@
|
|||
#include "bitfile.h"
|
||||
#include "pci_boards.h"
|
||||
|
||||
#ifdef __linux__
|
||||
static int open_as_root(const char *path, int flags) {
|
||||
if (seteuid(0) != 0) {
|
||||
printf("You need root privileges (or setuid root) to access PCI hardware\n");
|
||||
return -1;
|
||||
}
|
||||
int fd = open(path, flags);
|
||||
int eno = errno;
|
||||
if (seteuid(getuid()) != 0) {
|
||||
printf("Failed to restore euid: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (fd < 0) {
|
||||
errno = eno;
|
||||
printf("%s can't open /dev/mem: %s", __func__, strerror(errno));
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
extern board_t boards[MAX_BOARDS];
|
||||
extern int boards_count;
|
||||
static int memfd = -1;
|
||||
|
|
@ -760,13 +783,29 @@ static void pci_fix_bar_lengths(struct pci_dev *dev) {
|
|||
|
||||
dev->size[i] = size + 1;
|
||||
}
|
||||
#else
|
||||
(void)dev;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int pci_board_open(board_t *board) {
|
||||
if (board->mem_base != 0) {
|
||||
#ifdef __linux__
|
||||
char path[256];
|
||||
struct pci_dev *dev = board->dev;
|
||||
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%04x:%02x:%02x.%x/enable", dev->domain, dev->bus, dev->dev, dev->func);
|
||||
int enable_fd = open_as_root(path, O_RDWR);
|
||||
if (enable_fd < 0) {
|
||||
perror("open_as_root(enable)");
|
||||
abort();
|
||||
}
|
||||
write(enable_fd, "1\n", 2);
|
||||
close(enable_fd);
|
||||
board->base = mmap(0, board->len, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, board->mem_base);
|
||||
if (board->base == NULL || board->base == MAP_FAILED) {
|
||||
perror("mmap pci");
|
||||
abort();
|
||||
}
|
||||
#elif _WIN32
|
||||
board->base = map_memory(board->mem_base, board->len, &(board->mem_handle));
|
||||
#endif
|
||||
|
|
@ -789,6 +828,16 @@ static int pci_board_close(board_t *board) {
|
|||
if (board->base) {
|
||||
#ifdef __linux__
|
||||
munmap(board->base, board->len);
|
||||
char path[256];
|
||||
struct pci_dev *dev = board->dev;
|
||||
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%04x:%02x:%02x.%x/enable", dev->domain, dev->bus, dev->dev, dev->func);
|
||||
int enable_fd = open_as_root(path, O_RDWR);
|
||||
if (enable_fd < 0) {
|
||||
perror("open_as_root(enable)");
|
||||
abort();
|
||||
}
|
||||
write(enable_fd, "0\n", 2);
|
||||
close(enable_fd);
|
||||
#elif _WIN32
|
||||
unmap_memory(&(board->mem_handle));
|
||||
#endif
|
||||
|
|
@ -799,6 +848,7 @@ static int pci_board_close(board_t *board) {
|
|||
}
|
||||
|
||||
int pci_boards_init(board_access_t *access) {
|
||||
(void)access;
|
||||
int eno;
|
||||
|
||||
#ifdef __linux__
|
||||
|
|
@ -811,7 +861,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;
|
||||
|
|
@ -824,6 +877,7 @@ int pci_boards_init(board_access_t *access) {
|
|||
}
|
||||
|
||||
void pci_boards_cleanup(board_access_t *access) {
|
||||
(void)access;
|
||||
#ifdef __linux__
|
||||
close(memfd);
|
||||
#elif _WIN32
|
||||
|
|
@ -848,7 +902,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 +936,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 +963,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 +991,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 +1018,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 +1046,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 +1077,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 +1107,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 +1140,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 +1168,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 +1195,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 +1228,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 +1256,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 +1291,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 +1332,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;
|
||||
|
|
@ -1311,7 +1365,7 @@ void pci_print_info(board_t *board) {
|
|||
show_formatted_size(board->dev->size[i]);
|
||||
printf("\n");
|
||||
} else {
|
||||
printf(" Region %d: Memory at %08X", i, (unsigned int) board->dev->base_addr[i]);
|
||||
printf(" Region %d: Memory at %016" PRIx64, i, board->dev->base_addr[i]);
|
||||
show_formatted_size(board->dev->size[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -1323,7 +1377,8 @@ void pci_print_info(board_t *board) {
|
|||
if (board->data_base_addr > 0)
|
||||
printf(" Data I/O addr: %04X\n", board->data_base_addr);
|
||||
if (board->mem_base > 0)
|
||||
printf(" Memory: %08X\n", board->mem_base);
|
||||
printf(" Memory: %016" PRIx64 "\n", board->mem_base);
|
||||
|
||||
show_board_info(board);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
@ -94,10 +102,12 @@ int serial_recv_packet(void *packet, int size) {
|
|||
}
|
||||
|
||||
static int serial_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
return lbp16_read(CMD_READ_HOSTMOT2_ADDR32_INCR(size/4), addr, buffer, size);
|
||||
}
|
||||
|
||||
static int serial_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
return lbp16_write(CMD_WRITE_HOSTMOT2_ADDR32_INCR(size/4), addr, buffer, size);
|
||||
}
|
||||
|
||||
|
|
@ -114,6 +124,7 @@ static int serial_board_open(board_t *board) {
|
|||
}
|
||||
|
||||
static int serial_board_close(board_t *board) {
|
||||
(void)board;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -160,17 +171,17 @@ int serial_boards_init(board_access_t *access) {
|
|||
}
|
||||
|
||||
void serial_boards_cleanup(board_access_t *access) {
|
||||
(void)access;
|
||||
close(sd);
|
||||
}
|
||||
|
||||
void serial_boards_scan(board_access_t *access) {
|
||||
lbp16_cmd_addr packet;
|
||||
int send = 0, recv = 0;
|
||||
char buff[16];
|
||||
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_BOARD_INFO_ADDR16_INCR(8), 0);
|
||||
send = lbp16_send_packet(&packet, sizeof(packet));
|
||||
recv = lbp16_recv_packet(buff, 16);
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(buff, 16);
|
||||
if (strncmp(buff, "7I90HD", 6) == 0) {
|
||||
board_t *board = &boards[boards_count];
|
||||
|
||||
|
|
@ -206,7 +217,7 @@ void serial_boards_scan(board_access_t *access) {
|
|||
|
||||
void serial_print_info(board_t *board) {
|
||||
lbp16_cmd_addr packet;
|
||||
int i, j, recv;
|
||||
int i, j;
|
||||
char *mem_types[16] = {NULL, "registers", "memory", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "EEPROM", "flash"};
|
||||
char *mem_writeable[2] = {"RO", "RW"};
|
||||
char *acc_types[4] = {"8-bit", "16-bit", "32-bit", "64-bit"};
|
||||
|
|
@ -231,20 +242,20 @@ void serial_print_info(board_t *board) {
|
|||
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_COMM_CTRL_ADDR16_INCR(sizeof(stat_area)/2), 0);
|
||||
memset(&stat_area, 0, sizeof(stat_area));
|
||||
lbp16_send_packet(&packet, sizeof(packet));
|
||||
recv = lbp16_recv_packet(&stat_area, sizeof(stat_area));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(&stat_area, sizeof(stat_area));
|
||||
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_BOARD_INFO_ADDR16_INCR(sizeof(info_area)/2), 0);
|
||||
memset(&info_area, 0, sizeof(info_area));
|
||||
lbp16_send_packet(&packet, sizeof(packet));
|
||||
recv = lbp16_recv_packet(&info_area, sizeof(info_area));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(&info_area, sizeof(info_area));
|
||||
|
||||
if (info_area.LBP16_version >= 3) {
|
||||
LBP16_INIT_PACKET4(cmds[4], CMD_READ_AREA_INFO_ADDR16_INCR(LBP16_SPACE_TIMER, sizeof(mem_area)/2), 0);
|
||||
LBP16_INIT_PACKET4(packet, CMD_READ_TIMER_ADDR16_INCR(sizeof(timers_area)/2), 0);
|
||||
memset(&timers_area, 0, sizeof(timers_area));
|
||||
lbp16_send_packet(&packet, sizeof(packet));
|
||||
recv = lbp16_recv_packet(&timers_area, sizeof(timers_area));
|
||||
lbp16_send_packet_checked(&packet, sizeof(packet));
|
||||
lbp16_recv_packet_checked(&timers_area, sizeof(timers_area));
|
||||
}
|
||||
|
||||
printf("Communication:\n");
|
||||
|
|
@ -260,8 +271,8 @@ void serial_print_info(board_t *board) {
|
|||
|
||||
if ((cmds[i].cmd_lo == 0) && (cmds[i].cmd_hi == 0)) continue;
|
||||
memset(&mem_area, 0, sizeof(mem_area));
|
||||
lbp16_send_packet(&cmds[i], sizeof(cmds[i]));
|
||||
lbp16_recv_packet(&mem_area, sizeof (mem_area));
|
||||
lbp16_send_packet_checked(&cmds[i], sizeof(cmds[i]));
|
||||
lbp16_recv_packet_checked(&mem_area, sizeof (mem_area));
|
||||
|
||||
printf(" %d: %.*s (%s, %s", i, (int)sizeof(mem_area.name), mem_area.name, mem_types[(mem_area.size >> 8) & 0x7F],
|
||||
mem_writeable[(mem_area.size & 0x8000) >> 15]);
|
||||
|
|
@ -290,7 +301,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);
|
||||
|
|
|
|||
123
spi_boards.c
123
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) {
|
||||
|
|
@ -80,11 +83,12 @@ static int spi_board_open(board_t *board) {
|
|||
}
|
||||
|
||||
static int spi_board_close(board_t *board) {
|
||||
(void)board;
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
@ -107,6 +111,7 @@ int spi_boards_init(board_access_t *access) {
|
|||
}
|
||||
|
||||
void spi_boards_cleanup(board_access_t *access) {
|
||||
(void)access;
|
||||
if(sd != -1) close(sd);
|
||||
}
|
||||
|
||||
|
|
@ -126,6 +131,7 @@ void reorderBuffer(char *pBuf, int numInts)
|
|||
}
|
||||
|
||||
int spi_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
if(size % 4 != 0) return -1;
|
||||
int numInts = 1+size/4;
|
||||
u32 trxbuf[numInts];
|
||||
|
|
@ -155,6 +161,7 @@ int spi_read(llio_t *self, u32 addr, void *buffer, int size) {
|
|||
}
|
||||
|
||||
int spi_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
if(size % 4 != 0) return -1;
|
||||
int numInts = 1+size/4;
|
||||
u32 txbuf[numInts];
|
||||
|
|
@ -176,6 +183,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 +240,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..%04zx:\n%08x %08x %08x\n",
|
||||
HM2_COOKIE_REG, HM2_COOKIE_REG + sizeof(buf),
|
||||
buf[0], buf[1], buf[2]);
|
||||
return;
|
||||
|
|
@ -200,8 +253,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 +265,59 @@ 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.bob_hint[0] = BOB_7C80_0;
|
||||
board->llio.bob_hint[1] = BOB_7C80_1;
|
||||
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.bob_hint[0] = BOB_7C81_0;
|
||||
board->llio.bob_hint[1] = BOB_7C81_1;
|
||||
board->llio.bob_hint[2] = BOB_7C81_2;
|
||||
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;
|
||||
|
|
@ -219,8 +326,7 @@ void spi_boards_scan(board_access_t *access) {
|
|||
board->fallback_support = 1;
|
||||
boards_count ++;
|
||||
} else {
|
||||
int i=0;
|
||||
for(i=0; i<sizeof(ident); i++)
|
||||
for(size_t i=0; i<sizeof(ident); i++)
|
||||
if(!isprint(ident[i])) ident[i] = '?';
|
||||
|
||||
fprintf(stderr, "Unknown board: %.8s\n", ident);
|
||||
|
|
@ -228,4 +334,5 @@ void spi_boards_scan(board_access_t *access) {
|
|||
}
|
||||
|
||||
void spi_print_info(board_t *board) {
|
||||
(void)board;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
// Temporarily enable the pins that are not masked by sserial_mode
|
||||
static void enable_sserial_pins(llio_t *llio) {
|
||||
int port_pin, port;
|
||||
int pin = -1;
|
||||
int chan_counts[] = {0,0,0,0,0,0,0,0};
|
||||
u32 port_pin, port;
|
||||
u32 pin = -1;
|
||||
u16 chan_counts[] = {0,0,0,0,0,0,0,0};
|
||||
hm2_module_desc_t *md = hm2_find_module(&(llio->hm2), HM2_GTAG_IOPORT);
|
||||
u16 addr = md->base_address;
|
||||
|
||||
|
|
@ -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 %zu)\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++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ struct opd_mode_1_7i77_struct {
|
|||
unsigned int analogena : 1;
|
||||
unsigned int spinena : 1;
|
||||
unsigned int ignore1 : 16;
|
||||
} __attribute__ ((__packed__));
|
||||
} __attribute__ ((__packed__, aligned(4)));
|
||||
|
||||
typedef struct opd_mode_1_7i77_struct opd_mode_1_7i77_t;
|
||||
|
||||
|
|
|
|||
28
usb_boards.c
28
usb_boards.c
|
|
@ -34,6 +34,7 @@ extern int boards_count;
|
|||
static u8 file_buffer[SECTOR_SIZE];
|
||||
|
||||
int usb_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
while (size > 0) {
|
||||
lbp_read(addr & 0xFFFF, buffer);
|
||||
addr += 4;
|
||||
|
|
@ -44,6 +45,7 @@ int usb_read(llio_t *self, u32 addr, void *buffer, int size) {
|
|||
}
|
||||
|
||||
int usb_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||
(void)self;
|
||||
while (size > 0) {
|
||||
lbp_write(addr & 0xFFFF, buffer);
|
||||
addr += 4;
|
||||
|
|
@ -79,10 +81,10 @@ static int usb_program_fpga(llio_t *self, char *bitfile_name) {
|
|||
printf(" |");
|
||||
fflush(stdout);
|
||||
|
||||
lbp_send(&cmd, 1);
|
||||
lbp_send(&cmd, 1);
|
||||
lbp_send(&cmd, 1);
|
||||
lbp_send(&cmd, 1);
|
||||
lbp_send_checked(&cmd, 1);
|
||||
lbp_send_checked(&cmd, 1);
|
||||
lbp_send_checked(&cmd, 1);
|
||||
lbp_send_checked(&cmd, 1);
|
||||
// program the FPGA
|
||||
while (!feof(fp)) {
|
||||
bytesread = fread(&file_buffer, 1, 8192, fp);
|
||||
|
|
@ -91,7 +93,7 @@ static int usb_program_fpga(llio_t *self, char *bitfile_name) {
|
|||
file_buffer[bindex] = bitfile_reverse_bits(file_buffer[bindex]);
|
||||
bindex++;
|
||||
}
|
||||
lbp_send(&file_buffer, bytesread);
|
||||
lbp_send_checked(&file_buffer, bytesread);
|
||||
printf("W");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
|
@ -103,10 +105,12 @@ static int usb_program_fpga(llio_t *self, char *bitfile_name) {
|
|||
}
|
||||
|
||||
static int usb_board_open(board_t *board) {
|
||||
(void)board;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usb_board_close(board_t *board) {
|
||||
(void)board;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -116,6 +120,7 @@ int usb_boards_init(board_access_t *access) {
|
|||
}
|
||||
|
||||
void usb_boards_cleanup(board_access_t *access) {
|
||||
(void)access;
|
||||
lbp_release();
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +149,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";
|
||||
|
|
@ -179,20 +184,20 @@ void usb_boards_scan(board_access_t *access) {
|
|||
}
|
||||
|
||||
cmd = '1';
|
||||
lbp_send(&cmd, 1);
|
||||
lbp_recv(&data, 1);
|
||||
lbp_send_checked(&cmd, 1);
|
||||
lbp_recv_checked(&data, 1);
|
||||
if ((data & 0x01) == 0) { // found 7i43 without flashed FPGA
|
||||
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";
|
||||
board->llio.ioport_connector_name[1] = "P4";
|
||||
cmd = '0';
|
||||
lbp_send(&cmd, 1);
|
||||
lbp_recv(&data, 1);
|
||||
lbp_send_checked(&cmd, 1);
|
||||
lbp_recv_checked(&data, 1);
|
||||
if (data & 0x01)
|
||||
board->llio.fpga_part_number = "3s400tq144";
|
||||
else
|
||||
|
|
@ -210,6 +215,7 @@ void usb_boards_scan(board_access_t *access) {
|
|||
}
|
||||
|
||||
void usb_boards_release(board_access_t *access) {
|
||||
(void)access;
|
||||
lbp_release();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef WINIO_H
|
||||
#define WINIO_H
|
||||
|
||||
#include "winio_nt.h"
|
||||
|
||||
typedef struct tagPhysStruct tagPhysStruct_t;
|
||||
|
||||
BOOL InitializeWinIo();
|
||||
void ShutdownWinIo();
|
||||
PBYTE MapPhysToLin(tagPhysStruct_t *PhysStruct);
|
||||
BOOL UnmapPhysicalMemory(tagPhysStruct_t *PhysStruct);
|
||||
BOOL GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);
|
||||
BOOL SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);
|
||||
BOOL GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize);
|
||||
BOOL SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);
|
||||
BOOL InstallWinIoDriver(PWSTR pszWinIoDriverPath, BOOL IsDemandLoaded);
|
||||
BOOL RemoveWinIoDriver();
|
||||
|
||||
extern HANDLE hDriver;
|
||||
extern BOOL IsWinIoInitialized;
|
||||
extern BOOL g_Is64BitOS;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#ifndef WINIONT_H
|
||||
#define WINIONT_H
|
||||
|
||||
// Define the various device type values. Note that values used by Microsoft
|
||||
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
|
||||
// by customers.
|
||||
|
||||
#define FILE_DEVICE_WINIO 0x00008010
|
||||
|
||||
// Macro definition for defining IOCTL and FSCTL function control codes.
|
||||
// Note that function codes 0-2047 are reserved for Microsoft Corporation,
|
||||
// and 2048-4095 are reserved for customers.
|
||||
|
||||
#define WINIO_IOCTL_INDEX 0x810
|
||||
|
||||
// Define our own private IOCTL
|
||||
|
||||
#define IOCTL_WINIO_MAPPHYSTOLIN CTL_CODE(FILE_DEVICE_WINIO, \
|
||||
WINIO_IOCTL_INDEX, \
|
||||
METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_WINIO_UNMAPPHYSADDR CTL_CODE(FILE_DEVICE_WINIO, \
|
||||
WINIO_IOCTL_INDEX + 1, \
|
||||
METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_WINIO_ENABLEDIRECTIO CTL_CODE(FILE_DEVICE_WINIO, \
|
||||
WINIO_IOCTL_INDEX + 2, \
|
||||
METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_WINIO_DISABLEDIRECTIO CTL_CODE(FILE_DEVICE_WINIO, \
|
||||
WINIO_IOCTL_INDEX + 3, \
|
||||
METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_WINIO_READPORT CTL_CODE(FILE_DEVICE_WINIO, \
|
||||
WINIO_IOCTL_INDEX + 4, \
|
||||
METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_WINIO_WRITEPORT CTL_CODE(FILE_DEVICE_WINIO, \
|
||||
WINIO_IOCTL_INDEX + 5, \
|
||||
METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
struct tagPhysStruct
|
||||
{
|
||||
DWORD64 dwPhysMemSizeInBytes;
|
||||
DWORD64 pvPhysAddress;
|
||||
DWORD64 PhysicalMemoryHandle;
|
||||
DWORD64 pvPhysMemLin;
|
||||
DWORD64 pvPhysSection;
|
||||
};
|
||||
|
||||
struct tagPortStruct
|
||||
{
|
||||
USHORT wPortAddr;
|
||||
ULONG dwPortVal;
|
||||
UCHAR bSize;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue