Compare commits
135 commits
master
...
remove-win
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dfaba0b6a | ||
| 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 |
45 changed files with 1367 additions and 2288 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
|
||||||
28
.github/workflows/ci.yml
vendored
Normal file
28
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
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)
|
||||||
|
|
||||||
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
|
RM = rm -f
|
||||||
AR = ar
|
AR = ar
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
MATHLIB = -lm
|
|
||||||
OPT = -O0
|
|
||||||
|
|
||||||
#DEBUG = -g -pedantic -Wall -Wextra
|
OWNERSHIP ?= --owner root --group root
|
||||||
#DEBUG = -g -Wall -Wextra
|
|
||||||
DEBUG = -g -Werror=missing-prototypes -Werror=strict-prototypes -Werror=implicit-function-declaration
|
# default CFLAGS
|
||||||
|
CFLAGS ?= -O0 -g -Wall -Werror=format -Werror=format-security
|
||||||
|
|
||||||
|
# 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)
|
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
|
BIN = mesaflash
|
||||||
LIBS = -lpci $(MATHLIB)
|
LDFLAGS = -lm $(LIBPCI_LDFLAGS)
|
||||||
CFLAGS += -D_GNU_SOURCE
|
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
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET),windows)
|
ifeq ($(TARGET),windows)
|
||||||
MINGW = c:/MinGW
|
MINGW = c:/MinGW
|
||||||
INCLUDE = -I$(MINGW)/include
|
CFLAGS += -I$(MINGW)/include
|
||||||
BIN = mesaflash.exe
|
BIN = mesaflash.exe
|
||||||
LIBS = -lwsock32 -lws2_32 libpci.dll winio32.dll
|
LDFLAGS = -lwsock32 -lws2_32 libpci.dll winio32.dll
|
||||||
DEBUG += -mno-ms-bitfields
|
CFLAGS += -mno-ms-bitfields
|
||||||
endif
|
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 = 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
|
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
|
$(CC) $(CFLAGS) -c mesaflash.c
|
||||||
|
|
||||||
$(BIN): mesaflash.o anyio.h $(LIBANYIO)
|
$(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)
|
anyio.o : anyio.c $(headers)
|
||||||
$(CC) $(CFLAGS) -c anyio.c
|
$(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
|
$(CC) $(CFLAGS) -c examples/pci_encoder_read.c
|
||||||
|
|
||||||
pci_encoder_read: pci_encoder_read.o anyio.h encoder_module.h
|
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)
|
pci_analog_write.o : examples/pci_analog_write.c $(LIBANYIO) $(headers)
|
||||||
$(CC) $(CFLAGS) -c examples/pci_analog_write.c
|
$(CC) $(CFLAGS) -c examples/pci_analog_write.c
|
||||||
|
|
||||||
pci_analog_write: pci_analog_write.o anyio.h sserial_module.h
|
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 :
|
clean :
|
||||||
$(RM) *.o $(LIBANYIO) $(BIN) pci_encoder_read pci_analog_write
|
$(RM) *.o $(LIBANYIO) $(BIN) pci_encoder_read pci_analog_write
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(BIN)
|
install: $(BIN)
|
||||||
install --mode=0755 --owner root --group root --dir $(DESTDIR)/bin
|
install -p -D --mode=0755 $(OWNERSHIP) $(BIN) $(DESTDIR)/bin/$(BIN)
|
||||||
install --mode=0755 --owner root --group root $(BIN) $(DESTDIR)/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
|
|
||||||
47
README.md
Normal file
47
README.md
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
# 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
|
||||||
|
|
||||||
|
You may need to install git first:
|
||||||
|
|
||||||
|
sudo apt install git
|
||||||
|
|
||||||
|
Clone MesaFlash:
|
||||||
|
|
||||||
|
git clone https://github.com/LinuxCNC/mesaflash.git
|
||||||
|
|
||||||
|
From the top level directory, switch to the source directory:
|
||||||
|
|
||||||
|
cd mesaflash
|
||||||
|
|
||||||
|
In the source directory to build MesaFlash:
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
To get command line syntax from a local make:
|
||||||
|
|
||||||
|
./mesaflash --help
|
||||||
|
|
||||||
|
To build and install MesaFlash:
|
||||||
|
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
To run an installed MesaFlash:
|
||||||
|
|
||||||
|
mesaflash --help
|
||||||
|
|
||||||
|
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.
30
anyio.c
30
anyio.c
|
|
@ -31,9 +31,14 @@
|
||||||
|
|
||||||
supported_board_entry_t supported_boards[] = {
|
supported_board_entry_t supported_boards[] = {
|
||||||
{"ETHER", BOARD_ETH | BOARD_WILDCARD},
|
{"ETHER", BOARD_ETH | BOARD_WILDCARD},
|
||||||
|
{"SPI", BOARD_SPI | BOARD_WILDCARD},
|
||||||
{"7I92", BOARD_ETH},
|
{"7I92", BOARD_ETH},
|
||||||
{"7I93", BOARD_ETH},
|
{"7I93", BOARD_ETH},
|
||||||
|
{"7I94", BOARD_ETH},
|
||||||
|
{"7I95", BOARD_ETH},
|
||||||
{"7I96", BOARD_ETH},
|
{"7I96", BOARD_ETH},
|
||||||
|
{"7I97", BOARD_ETH},
|
||||||
|
{"7I98", BOARD_ETH},
|
||||||
{"7I80", BOARD_ETH},
|
{"7I80", BOARD_ETH},
|
||||||
{"7I76E", BOARD_ETH},
|
{"7I76E", BOARD_ETH},
|
||||||
|
|
||||||
|
|
@ -51,10 +56,13 @@ supported_board_entry_t supported_boards[] = {
|
||||||
{"4I69", BOARD_PCI},
|
{"4I69", BOARD_PCI},
|
||||||
{"3X20", 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},
|
{"7I43", BOARD_MULTI_INTERFACE | BOARD_EPP | BOARD_USB},
|
||||||
{"7I90", BOARD_MULTI_INTERFACE | BOARD_EPP | BOARD_SPI | BOARD_SER},
|
{"7I90", BOARD_MULTI_INTERFACE | BOARD_EPP | BOARD_SPI | BOARD_SER},
|
||||||
{"7I64", BOARD_MULTI_INTERFACE | BOARD_USB | BOARD_SPI},
|
{"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},
|
{NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -74,10 +82,12 @@ void anyio_cleanup(board_access_t *access) {
|
||||||
}
|
}
|
||||||
if (access->open_iface & BOARD_ETH)
|
if (access->open_iface & BOARD_ETH)
|
||||||
eth_boards_cleanup(access);
|
eth_boards_cleanup(access);
|
||||||
|
#if MESAFLASH_IO
|
||||||
if (access->open_iface & BOARD_PCI)
|
if (access->open_iface & BOARD_PCI)
|
||||||
pci_boards_cleanup(access);
|
pci_boards_cleanup(access);
|
||||||
if (access->open_iface & BOARD_EPP)
|
if (access->open_iface & BOARD_EPP)
|
||||||
epp_boards_cleanup(access);
|
epp_boards_cleanup(access);
|
||||||
|
#endif
|
||||||
if (access->open_iface & BOARD_USB)
|
if (access->open_iface & BOARD_USB)
|
||||||
usb_boards_cleanup(access);
|
usb_boards_cleanup(access);
|
||||||
if (access->open_iface & BOARD_SPI)
|
if (access->open_iface & BOARD_SPI)
|
||||||
|
|
@ -118,8 +128,12 @@ int anyio_find_dev(board_access_t *access) {
|
||||||
if (supported_board->type & BOARD_ETH) {
|
if (supported_board->type & BOARD_ETH) {
|
||||||
ret = eth_boards_init(access);
|
ret = eth_boards_init(access);
|
||||||
access->open_iface |= BOARD_ETH;
|
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) {
|
if (supported_board->type & BOARD_PCI) {
|
||||||
ret = pci_boards_init(access);
|
ret = pci_boards_init(access);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
@ -136,6 +150,7 @@ int anyio_find_dev(board_access_t *access) {
|
||||||
access->open_iface |= BOARD_EPP;
|
access->open_iface |= BOARD_EPP;
|
||||||
epp_boards_scan(access);
|
epp_boards_scan(access);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (supported_board->type & BOARD_USB) {
|
if (supported_board->type & BOARD_USB) {
|
||||||
ret = usb_boards_init(access);
|
ret = usb_boards_init(access);
|
||||||
access->open_iface |= BOARD_USB;
|
access->open_iface |= BOARD_USB;
|
||||||
|
|
@ -157,6 +172,7 @@ int anyio_find_dev(board_access_t *access) {
|
||||||
access->open_iface |= BOARD_ETH;
|
access->open_iface |= BOARD_ETH;
|
||||||
eth_boards_scan(access);
|
eth_boards_scan(access);
|
||||||
}
|
}
|
||||||
|
#if MESAFLASH_IO
|
||||||
if (access->type & BOARD_PCI) {
|
if (access->type & BOARD_PCI) {
|
||||||
ret = pci_boards_init(access);
|
ret = pci_boards_init(access);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
@ -173,6 +189,7 @@ int anyio_find_dev(board_access_t *access) {
|
||||||
access->open_iface |= BOARD_EPP;
|
access->open_iface |= BOARD_EPP;
|
||||||
epp_boards_scan(access);
|
epp_boards_scan(access);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (access->type & BOARD_USB) {
|
if (access->type & BOARD_USB) {
|
||||||
ret = usb_boards_init(access);
|
ret = usb_boards_init(access);
|
||||||
access->open_iface |= BOARD_USB;
|
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);
|
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) {
|
void anyio_dev_print_sserial_info(board_t *board) {
|
||||||
if (board == NULL) {
|
if (board == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -334,7 +359,6 @@ void anyio_dev_print_sserial_info(board_t *board) {
|
||||||
void anyio_bitfile_print_info(char *bitfile_name, int verbose_flag) {
|
void anyio_bitfile_print_info(char *bitfile_name, int verbose_flag) {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char part_name[32];
|
char part_name[32];
|
||||||
char board_name[5];
|
|
||||||
|
|
||||||
if (bitfile_name == NULL) {
|
if (bitfile_name == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -344,6 +368,6 @@ void anyio_bitfile_print_info(char *bitfile_name, int verbose_flag) {
|
||||||
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
print_bitfile_header(fp, (char*) &part_name, (char*) &board_name, verbose_flag);
|
print_bitfile_header(fp, (char*) &part_name, verbose_flag);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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_reload(board_t *board, int fallback_flag);
|
||||||
int anyio_dev_reset(board_t *board);
|
int anyio_dev_reset(board_t *board);
|
||||||
void anyio_dev_print_hm2_info(board_t *board, int xml_flag);
|
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_dev_print_sserial_info(board_t *board);
|
||||||
void anyio_bitfile_print_info(char *bitfile_name, int verbose_flag);
|
void anyio_bitfile_print_info(char *bitfile_name, int verbose_flag);
|
||||||
|
|
||||||
|
|
|
||||||
56
bitfile.c
56
bitfile.c
|
|
@ -22,15 +22,12 @@
|
||||||
#include "bitfile.h"
|
#include "bitfile.h"
|
||||||
|
|
||||||
// prints info about bitfile and returns header length or -1 when error
|
// prints info about bitfile and returns header length or -1 when error
|
||||||
int print_bitfile_header(FILE *fp, char *part_name, char *board_id, int verbose_flag) {
|
int print_bitfile_header(FILE *fp, char *part_name, int verbose_flag) {
|
||||||
u8 buff[256];
|
u8 buff[256];
|
||||||
int sleng;
|
int sleng;
|
||||||
int bytesread, conflength;
|
int bytesread, conflength;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if(board_id)
|
|
||||||
strcpy(board_id, "");
|
|
||||||
|
|
||||||
printf("Checking file... ");
|
printf("Checking file... ");
|
||||||
bytesread = fread(&buff, 1, 14, fp);
|
bytesread = fread(&buff, 1, 14, fp);
|
||||||
ret += bytesread;
|
ret += bytesread;
|
||||||
|
|
@ -52,20 +49,6 @@ int print_bitfile_header(FILE *fp, char *part_name, char *board_id, int verbose_
|
||||||
if (verbose_flag == 1) {
|
if (verbose_flag == 1) {
|
||||||
printf(" Design name: %s\n", buff);
|
printf(" Design name: %s\n", buff);
|
||||||
}
|
}
|
||||||
char *id = strstr(buff, "UserID=");
|
|
||||||
if(id && board_id) {
|
|
||||||
int id_hex = -1;
|
|
||||||
sscanf(id+7, "%x", &id_hex);
|
|
||||||
if(id_hex != 0xffffffff)
|
|
||||||
{
|
|
||||||
board_id[0] = (id_hex >> 24) & 0xff;
|
|
||||||
board_id[1] = (id_hex >> 16) & 0xff;
|
|
||||||
board_id[2] = (id_hex >> 8) & 0xff;
|
|
||||||
board_id[3] = id_hex & 0xff;
|
|
||||||
board_id[4] = 0;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "note: board_id = %s\n", board_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bytesread = fread(&buff, 1, 3, fp);
|
bytesread = fread(&buff, 1, 3, fp);
|
||||||
ret += bytesread;
|
ret += bytesread;
|
||||||
|
|
@ -142,40 +125,3 @@ u8 bitfile_reverse_bits(u8 data) {
|
||||||
};
|
};
|
||||||
return swaptab[data];
|
return swaptab[data];
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *bitfile_basename(const char *filename) {
|
|
||||||
const char *s = strrchr(filename, '/');
|
|
||||||
if(!s) s = filename;
|
|
||||||
else s = s + 1;
|
|
||||||
#ifdef _WIN32
|
|
||||||
s = strrchr(filename, '\\');
|
|
||||||
if(!s) s = filename;
|
|
||||||
else s = s + 1;
|
|
||||||
#endif
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
int check_board_name(char *llio_board_name, const char *bitfile_board_name, const char *filename)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "check_board_name %s %s %s\n",
|
|
||||||
llio_board_name, filename, bitfile_board_name);
|
|
||||||
|
|
||||||
if(!llio_board_name) {
|
|
||||||
fprintf(stderr, "LLIO: no boardname, cannot check that bitfile matches\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(bitfile_board_name && *bitfile_board_name) {
|
|
||||||
fprintf(stderr, "NOTE: comparing llio board name '%s' with bitfile board name '%s'\n", llio_board_name, bitfile_board_name);
|
|
||||||
int result = !strncasecmp(llio_board_name, bitfile_board_name, 4);
|
|
||||||
if(!result)
|
|
||||||
fprintf(stderr, "Error: wrong bitfile destination card: Detected %s, bitfile ID is %s\n", llio_board_name, bitfile_board_name);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(filename) {
|
|
||||||
filename = bitfile_basename(filename);
|
|
||||||
int result = !strncasecmp(llio_board_name, filename, 4);
|
|
||||||
if(!result)
|
|
||||||
fprintf(stderr, "Error: wrong bitfile destination card: Detected %s, filename is %.4s\n", llio_board_name, filename);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
int print_bitfile_header(FILE *fp, char *part_name, char *board_id, int verbose_flag);
|
int print_bitfile_header(FILE *fp, char *part_name, int verbose_flag);
|
||||||
int check_board_name(char *llio_board_name, const char *filename, const char *bitfile_board_name);
|
|
||||||
u8 bitfile_reverse_bits(u8 data);
|
u8 bitfile_reverse_bits(u8 data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
2
boards.h
2
boards.h
|
|
@ -60,7 +60,7 @@ struct board_struct {
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
void *base;
|
void *base;
|
||||||
int len;
|
int len;
|
||||||
u32 mem_base;
|
u64 mem_base;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
tagPhysStruct_t mem_handle;
|
tagPhysStruct_t mem_handle;
|
||||||
#endif
|
#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
|
* Don't check bitfile destinations while gpio recovering 6i24/6i25 boards
|
||||||
* Use modules base address from module descriptor, not from regmap
|
* 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
|
-- 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.
|
* First stable release.
|
||||||
* Support 7i90HD under linux in SPI and rs422 mode
|
* 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
|
-- 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.
|
* 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
|
Source: mesaflash
|
||||||
Maintainer: Michael Geszkiewicz <micges@wp.pl>
|
Maintainer: LinuxCNC Developers <emc-developers@lists.sourceforge.net>
|
||||||
Section: misc
|
Section: misc
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Standards-Version: 3.9.4
|
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
|
Package: mesaflash
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
Description: Mesa Electronics utility tool
|
Description: Mesa Electronics utility tool
|
||||||
Configuration and diagnostic tool for
|
Configuration and diagnostic tool for
|
||||||
Mesa Electronics PCI(E)/ETH/EPP/USB boards
|
Mesa Electronics PCI(E)/ETH/EPP/USB/SPI boards
|
||||||
|
|
|
||||||
35
debian/rules
vendored
35
debian/rules
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
include /usr/share/dpkg/pkg-info.mk
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@
|
dh $@
|
||||||
|
|
@ -6,34 +7,12 @@
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
$(MAKE) DESTDIR=$$(pwd)/debian/mesaflash/usr 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
|
.PHONY: get-orig-source
|
||||||
get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE))
|
get-orig-source: $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz
|
||||||
|
|
||||||
|
$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz:
|
||||||
|
git archive HEAD | xz --compress > $@
|
||||||
|
|
||||||
$(PKG)_$(VER)$(DTYPE).orig.tar.xz:
|
override_dh_clean:
|
||||||
@echo "# Downloading..."
|
rm -rf winio32 WinIo32.* libpci.dll libpci
|
||||||
uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
|
dh_clean
|
||||||
$(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)"
|
|
||||||
|
|
|
||||||
5
debian/watch
vendored
5
debian/watch
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
version=3
|
version=3
|
||||||
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/mesaflash-$1\.tar\.gz/ \
|
opts=\
|
||||||
https://github.com/micges/mesaflash/tags .*/v?(\d\S*)\.tar\.gz
|
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
|
||||||
|
|
|
||||||
16
eeprom.c
16
eeprom.c
|
|
@ -22,11 +22,11 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "bitfile.h"
|
|
||||||
#include "eeprom.h"
|
#include "eeprom.h"
|
||||||
#include "eeprom_local.h"
|
#include "eeprom_local.h"
|
||||||
#include "eeprom_remote.h"
|
#include "eeprom_remote.h"
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
|
#include "bitfile.h"
|
||||||
|
|
||||||
u8 boot_block[BOOT_BLOCK_SIZE] = {
|
u8 boot_block[BOOT_BLOCK_SIZE] = {
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
|
|
@ -155,7 +155,6 @@ int eeprom_write(llio_t *self, char *bitfile_name, u32 start_address, int fix_bo
|
||||||
int bytesread, i;
|
int bytesread, i;
|
||||||
u32 eeprom_addr;
|
u32 eeprom_addr;
|
||||||
char part_name[32];
|
char part_name[32];
|
||||||
char board_name[32];
|
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct timeval tv1, tv2;
|
struct timeval tv1, tv2;
|
||||||
|
|
@ -170,7 +169,7 @@ int eeprom_write(llio_t *self, char *bitfile_name, u32 start_address, int fix_bo
|
||||||
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_bitfile_header(fp, (char*) &part_name, (char*) &board_name, board->llio.verbose) == -1) {
|
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -182,10 +181,6 @@ int eeprom_write(llio_t *self, char *bitfile_name, u32 start_address, int fix_bo
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!check_board_name(self->board_name, board_name, bitfile_name)) {
|
|
||||||
fclose(fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// if board doesn't support fallback there is no boot block
|
// if board doesn't support fallback there is no boot block
|
||||||
if (board->fallback_support == 1) {
|
if (board->fallback_support == 1) {
|
||||||
|
|
@ -244,7 +239,6 @@ int eeprom_verify(llio_t *self, char *bitfile_name, u32 start_address) {
|
||||||
int bytesread, i, bindex;
|
int bytesread, i, bindex;
|
||||||
u32 eeprom_addr;
|
u32 eeprom_addr;
|
||||||
char part_name[32];
|
char part_name[32];
|
||||||
char board_name[32];
|
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct timeval tv1, tv2;
|
struct timeval tv1, tv2;
|
||||||
|
|
@ -259,7 +253,7 @@ int eeprom_verify(llio_t *self, char *bitfile_name, u32 start_address) {
|
||||||
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_bitfile_header(fp, (char*) &part_name, (char*) &board_name, board->llio.verbose) == -1) {
|
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -270,10 +264,6 @@ int eeprom_verify(llio_t *self, char *bitfile_name, u32 start_address) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!check_board_name(self->board_name, board_name, bitfile_name)) {
|
|
||||||
fclose(fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// if board doesn't support fallback there is no boot block
|
// if board doesn't support fallback there is no boot block
|
||||||
if (board->fallback_support == 1) {
|
if (board->fallback_support == 1) {
|
||||||
if (check_boot(self) == -1) {
|
if (check_boot(self) == -1) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
#if MESAFLASH_IO
|
||||||
#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
|
#endif
|
||||||
#include <pci/pci.h>
|
#include <pci/pci.h>
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
@ -209,6 +211,7 @@ static u8 recv_byte_gpio(llio_t *self) {
|
||||||
|
|
||||||
// spi access via io ports like on 3x20
|
// spi access via io ports like on 3x20
|
||||||
|
|
||||||
|
#if MESAFLASH_IO
|
||||||
static void wait_for_data_io(llio_t *self) {
|
static void wait_for_data_io(llio_t *self) {
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
|
|
@ -258,7 +261,7 @@ static u8 recv_byte_io(llio_t *self) {
|
||||||
|
|
||||||
// spi access via epp on board 7i43 with EPPIO firmware
|
// spi access via epp on board 7i43 with EPPIO firmware
|
||||||
|
|
||||||
static void wait_for_data_epp(llio_t *self) {
|
void wait_for_data_epp(llio_t *self) {
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
u8 data = 0;
|
u8 data = 0;
|
||||||
|
|
@ -310,6 +313,7 @@ static u8 recv_byte_epp(llio_t *self) {
|
||||||
epp_addr8(board, EPP_SPI_SREG_REG);
|
epp_addr8(board, EPP_SPI_SREG_REG);
|
||||||
return epp_read8(board);
|
return epp_read8(board);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// pci flash
|
// pci flash
|
||||||
|
|
||||||
|
|
@ -435,12 +439,14 @@ void open_spi_access_local(llio_t *self) {
|
||||||
eeprom_access.recv_byte = &recv_byte_hm2;
|
eeprom_access.recv_byte = &recv_byte_hm2;
|
||||||
break;
|
break;
|
||||||
case BOARD_FLASH_IO:
|
case BOARD_FLASH_IO:
|
||||||
|
#if MESAFLASH_IO
|
||||||
eeprom_access.set_cs_low = &set_cs_low_io;
|
eeprom_access.set_cs_low = &set_cs_low_io;
|
||||||
eeprom_access.set_cs_high = &set_cs_high_io;
|
eeprom_access.set_cs_high = &set_cs_high_io;
|
||||||
eeprom_access.prefix = &prefix_io;
|
eeprom_access.prefix = &prefix_io;
|
||||||
eeprom_access.suffix = &suffix_io;
|
eeprom_access.suffix = &suffix_io;
|
||||||
eeprom_access.send_byte = &send_byte_io;
|
eeprom_access.send_byte = &send_byte_io;
|
||||||
eeprom_access.recv_byte = &recv_byte_io;
|
eeprom_access.recv_byte = &recv_byte_io;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case BOARD_FLASH_GPIO:
|
case BOARD_FLASH_GPIO:
|
||||||
eeprom_access.set_cs_low = &set_cs_low_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);
|
init_gpio(self);
|
||||||
break;
|
break;
|
||||||
case BOARD_FLASH_EPP:
|
case BOARD_FLASH_EPP:
|
||||||
|
#if MESAFLASH_IO
|
||||||
eeprom_access.set_cs_low = &set_cs_low_epp;
|
eeprom_access.set_cs_low = &set_cs_low_epp;
|
||||||
eeprom_access.set_cs_high = &set_cs_high_epp;
|
eeprom_access.set_cs_high = &set_cs_high_epp;
|
||||||
eeprom_access.prefix = &prefix_epp;
|
eeprom_access.prefix = &prefix_epp;
|
||||||
eeprom_access.suffix = &suffix_epp;
|
eeprom_access.suffix = &suffix_epp;
|
||||||
eeprom_access.send_byte = &send_byte_epp;
|
eeprom_access.send_byte = &send_byte_epp;
|
||||||
eeprom_access.recv_byte = &recv_byte_epp;
|
eeprom_access.recv_byte = &recv_byte_epp;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case BOARD_FLASH_REMOTE:
|
case BOARD_FLASH_REMOTE:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
17
epp_boards.c
17
epp_boards.c
|
|
@ -16,6 +16,7 @@
|
||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if MESAFLASH_IO
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <linux/parport.h>
|
#include <linux/parport.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
@ -136,7 +137,7 @@ static inline void epp_write32(board_t *board, u32 data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int epp_read(llio_t *self, u32 addr, void *buffer, int size) {
|
int epp_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
int bytes_remaining = size;
|
int bytes_remaining = size;
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
|
|
||||||
|
|
@ -162,7 +163,7 @@ static int epp_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
return 1; // success
|
return 1; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
static int epp_write(llio_t *self, u32 addr, void *buffer, int size) {
|
int epp_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
int bytes_remaining = size;
|
int bytes_remaining = size;
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
|
|
||||||
|
|
@ -188,11 +189,10 @@ static int epp_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int epp_program_fpga(llio_t *self, char *bitfile_name) {
|
int epp_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
int bindex, bytesread;
|
int bindex, bytesread;
|
||||||
char part_name[32];
|
char part_name[32];
|
||||||
char board_name[32];
|
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
|
@ -205,11 +205,7 @@ static int epp_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_bitfile_header(fp, (char*) &part_name, (char*) &board_name, board->llio.verbose) == -1) {
|
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
|
||||||
fclose(fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!check_board_name(self->board_name, board_name, bitfile_name)) {
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +245,7 @@ static int epp_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// return 0 if the board has been reset, -errno if not
|
// return 0 if the board has been reset, -errno if not
|
||||||
static int epp_reset(llio_t *self) {
|
int epp_reset(llio_t *self) {
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
u8 byte;
|
u8 byte;
|
||||||
|
|
||||||
|
|
@ -524,3 +520,4 @@ void epp_print_info(board_t *board) {
|
||||||
|
|
||||||
show_board_info(board);
|
show_board_info(board);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
168
eth_boards.c
168
eth_boards.c
|
|
@ -64,7 +64,7 @@ inline int eth_recv_packet(void *buffer, int size) {
|
||||||
return recvfrom(sd, (char*) buffer, size, 0, (struct sockaddr *) &src_addr, &len);
|
return recvfrom(sd, (char*) buffer, size, 0, (struct sockaddr *) &src_addr, &len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eth_socket_nonblocking(void) {
|
static void eth_socket_nonblocking() {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int val = fcntl(sd, F_GETFL);
|
int val = fcntl(sd, F_GETFL);
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ static void eth_socket_nonblocking(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eth_socket_blocking(void) {
|
static void eth_socket_blocking() {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int val = fcntl(sd, F_GETFL);
|
int val = fcntl(sd, F_GETFL);
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ void eth_socket_set_dest_ip(char *addr_name) {
|
||||||
dst_addr.sin_addr.s_addr = inet_addr(addr_name);
|
dst_addr.sin_addr.s_addr = inet_addr(addr_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *eth_socket_get_src_ip(void) {
|
static char *eth_socket_get_src_ip() {
|
||||||
return inet_ntoa(src_addr.sin_addr);
|
return inet_ntoa(src_addr.sin_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,6 +133,8 @@ static int eth_board_close(board_t *board) {
|
||||||
return 0;
|
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) {
|
static int eth_scan_one_addr(board_access_t *access) {
|
||||||
lbp16_cmd_addr packet, packet2;
|
lbp16_cmd_addr packet, packet2;
|
||||||
int send = 0, recv = 0, ret = 0;
|
int send = 0, recv = 0, ret = 0;
|
||||||
|
|
@ -144,7 +146,7 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
recv = lbp16_recv_packet(&cookie, sizeof(cookie));
|
recv = lbp16_recv_packet(&cookie, sizeof(cookie));
|
||||||
|
|
||||||
if ((recv > 0) && (cookie == HM2_COOKIE)) {
|
if ((recv > 0) && (cookie == HM2_COOKIE)) {
|
||||||
char buff[20];
|
char buff[16];
|
||||||
board_t *board = &boards[boards_count];
|
board_t *board = &boards[boards_count];
|
||||||
|
|
||||||
board_init_struct(board);
|
board_init_struct(board);
|
||||||
|
|
@ -180,6 +182,7 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
board->llio.verbose = access->verbose;
|
||||||
|
boards_count ++;
|
||||||
} else if (strncmp(buff, "7I80DB-25", 9) == 0) {
|
} else if (strncmp(buff, "7I80DB-25", 9) == 0) {
|
||||||
board->type = BOARD_ETH;
|
board->type = BOARD_ETH;
|
||||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||||
|
|
@ -198,13 +201,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.verify_flash = &remote_verify_flash;
|
board->llio.verify_flash = &remote_verify_flash;
|
||||||
board->llio.reset = &lbp16_board_reset;
|
board->llio.reset = &lbp16_board_reset;
|
||||||
board->llio.reload = &lbp16_board_reload;
|
board->llio.reload = &lbp16_board_reload;
|
||||||
|
|
||||||
board->open = ð_board_open;
|
board->open = ð_board_open;
|
||||||
board->close = ð_board_close;
|
board->close = ð_board_close;
|
||||||
board->print_info = ð_print_info;
|
board->print_info = ð_print_info;
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
board->llio.verbose = access->verbose;
|
||||||
|
boards_count ++;
|
||||||
} else if (strncmp(buff, "7I80HD-16", 9) == 0) {
|
} else if (strncmp(buff, "7I80HD-16", 9) == 0) {
|
||||||
board->type = BOARD_ETH;
|
board->type = BOARD_ETH;
|
||||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||||
|
|
@ -222,13 +225,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.verify_flash = &remote_verify_flash;
|
board->llio.verify_flash = &remote_verify_flash;
|
||||||
board->llio.reset = &lbp16_board_reset;
|
board->llio.reset = &lbp16_board_reset;
|
||||||
board->llio.reload = &lbp16_board_reload;
|
board->llio.reload = &lbp16_board_reload;
|
||||||
|
|
||||||
board->open = ð_board_open;
|
board->open = ð_board_open;
|
||||||
board->close = ð_board_close;
|
board->close = ð_board_close;
|
||||||
board->print_info = ð_print_info;
|
board->print_info = ð_print_info;
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
board->llio.verbose = access->verbose;
|
||||||
|
boards_count ++;
|
||||||
} else if (strncmp(buff, "7I80HD-25", 9) == 0) {
|
} else if (strncmp(buff, "7I80HD-25", 9) == 0) {
|
||||||
board->type = BOARD_ETH;
|
board->type = BOARD_ETH;
|
||||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||||
|
|
@ -246,13 +249,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.verify_flash = &remote_verify_flash;
|
board->llio.verify_flash = &remote_verify_flash;
|
||||||
board->llio.reset = &lbp16_board_reset;
|
board->llio.reset = &lbp16_board_reset;
|
||||||
board->llio.reload = &lbp16_board_reload;
|
board->llio.reload = &lbp16_board_reload;
|
||||||
|
|
||||||
board->open = ð_board_open;
|
board->open = ð_board_open;
|
||||||
board->close = ð_board_close;
|
board->close = ð_board_close;
|
||||||
board->print_info = ð_print_info;
|
board->print_info = ð_print_info;
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
board->llio.verbose = access->verbose;
|
||||||
|
boards_count ++;
|
||||||
} else if (strncmp(buff, "7I76E-16", 9) == 0) {
|
} else if (strncmp(buff, "7I76E-16", 9) == 0) {
|
||||||
board->type = BOARD_ETH;
|
board->type = BOARD_ETH;
|
||||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||||
|
|
@ -262,6 +265,7 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.ioport_connector_name[0] = "on-card";
|
board->llio.ioport_connector_name[0] = "on-card";
|
||||||
board->llio.ioport_connector_name[1] = "P1";
|
board->llio.ioport_connector_name[1] = "P1";
|
||||||
board->llio.ioport_connector_name[2] = "P2";
|
board->llio.ioport_connector_name[2] = "P2";
|
||||||
|
board->llio.bob_hint[0] = BOB_7I76;
|
||||||
board->llio.fpga_part_number = "6slx16ftg256";
|
board->llio.fpga_part_number = "6slx16ftg256";
|
||||||
board->llio.num_leds = 4;
|
board->llio.num_leds = 4;
|
||||||
board->llio.read = ð_read;
|
board->llio.read = ð_read;
|
||||||
|
|
@ -270,13 +274,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.verify_flash = &remote_verify_flash;
|
board->llio.verify_flash = &remote_verify_flash;
|
||||||
board->llio.reset = &lbp16_board_reset;
|
board->llio.reset = &lbp16_board_reset;
|
||||||
board->llio.reload = &lbp16_board_reload;
|
board->llio.reload = &lbp16_board_reload;
|
||||||
|
|
||||||
board->open = ð_board_open;
|
board->open = ð_board_open;
|
||||||
board->close = ð_board_close;
|
board->close = ð_board_close;
|
||||||
board->print_info = ð_print_info;
|
board->print_info = ð_print_info;
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
board->llio.verbose = access->verbose;
|
||||||
|
boards_count ++;
|
||||||
} else if (strncmp(buff, "7I92", 4) == 0) {
|
} else if (strncmp(buff, "7I92", 4) == 0) {
|
||||||
board->type = BOARD_ETH;
|
board->type = BOARD_ETH;
|
||||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||||
|
|
@ -293,13 +297,13 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.verify_flash = &remote_verify_flash;
|
board->llio.verify_flash = &remote_verify_flash;
|
||||||
board->llio.reset = &lbp16_board_reset;
|
board->llio.reset = &lbp16_board_reset;
|
||||||
board->llio.reload = &lbp16_board_reload;
|
board->llio.reload = &lbp16_board_reload;
|
||||||
|
|
||||||
board->open = ð_board_open;
|
board->open = ð_board_open;
|
||||||
board->close = ð_board_close;
|
board->close = ð_board_close;
|
||||||
board->print_info = ð_print_info;
|
board->print_info = ð_print_info;
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
board->llio.verbose = access->verbose;
|
||||||
|
boards_count ++;
|
||||||
} else if (strncmp(buff, "7I93", 4) == 0) {
|
} else if (strncmp(buff, "7I93", 4) == 0) {
|
||||||
board->type = BOARD_ETH;
|
board->type = BOARD_ETH;
|
||||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||||
|
|
@ -316,23 +320,23 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.verify_flash = &remote_verify_flash;
|
board->llio.verify_flash = &remote_verify_flash;
|
||||||
board->llio.reset = &lbp16_board_reset;
|
board->llio.reset = &lbp16_board_reset;
|
||||||
board->llio.reload = &lbp16_board_reload;
|
board->llio.reload = &lbp16_board_reload;
|
||||||
|
|
||||||
board->open = ð_board_open;
|
board->open = ð_board_open;
|
||||||
board->close = ð_board_close;
|
board->close = ð_board_close;
|
||||||
board->print_info = ð_print_info;
|
board->print_info = ð_print_info;
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
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;
|
board->type = BOARD_ETH;
|
||||||
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
strncpy(board->dev_addr, eth_socket_get_src_ip(), 16);
|
||||||
strncpy(board->llio.board_name, buff, 16);
|
strncpy(board->llio.board_name, buff, 16);
|
||||||
board->llio.num_ioport_connectors = 3;
|
board->llio.num_ioport_connectors = 2;
|
||||||
board->llio.pins_per_connector = 13;
|
board->llio.pins_per_connector = 21;
|
||||||
board->llio.ioport_connector_name[0] = "P1";
|
board->llio.ioport_connector_name[0] = "Expansion+Serial 0..1";
|
||||||
board->llio.ioport_connector_name[1] = "TB1";
|
board->llio.ioport_connector_name[1] = "Serial 1..7";
|
||||||
board->llio.ioport_connector_name[2] = "TB2";
|
board->llio.bob_hint[0] = BOB_7I94_0;
|
||||||
board->llio.ioport_connector_name[3] = "TB3";
|
board->llio.bob_hint[1] = BOB_7I94_1;
|
||||||
board->llio.fpga_part_number = "6slx9tqg144";
|
board->llio.fpga_part_number = "6slx9tqg144";
|
||||||
board->llio.num_leds = 4;
|
board->llio.num_leds = 4;
|
||||||
board->llio.read = ð_read;
|
board->llio.read = ð_read;
|
||||||
|
|
@ -341,20 +345,124 @@ static int eth_scan_one_addr(board_access_t *access) {
|
||||||
board->llio.verify_flash = &remote_verify_flash;
|
board->llio.verify_flash = &remote_verify_flash;
|
||||||
board->llio.reset = &lbp16_board_reset;
|
board->llio.reset = &lbp16_board_reset;
|
||||||
board->llio.reload = &lbp16_board_reload;
|
board->llio.reload = &lbp16_board_reload;
|
||||||
|
|
||||||
board->open = ð_board_open;
|
board->open = ð_board_open;
|
||||||
board->close = ð_board_close;
|
board->close = ð_board_close;
|
||||||
board->print_info = ð_print_info;
|
board->print_info = ð_print_info;
|
||||||
board->flash = BOARD_FLASH_REMOTE;
|
board->flash = BOARD_FLASH_REMOTE;
|
||||||
board->fallback_support = 1;
|
board->fallback_support = 1;
|
||||||
board->llio.verbose = access->verbose;
|
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 {
|
} else {
|
||||||
printf("Unsupported ethernet device %s at %s\n", buff, eth_socket_get_src_ip());
|
printf("Unsupported ethernet device %s at %s\n", buff, eth_socket_get_src_ip());
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
boards_count++;
|
|
||||||
|
|
||||||
eth_socket_nonblocking();
|
eth_socket_nonblocking();
|
||||||
|
} else {
|
||||||
|
ret = -1;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -403,10 +511,13 @@ void eth_boards_cleanup(board_access_t *access) {
|
||||||
close(sd);
|
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];
|
char addr[16];
|
||||||
int i;
|
int i;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
if (access->address == 0) {
|
if (access->address == 0) {
|
||||||
access->dev_addr = LBP16_HW_IP;
|
access->dev_addr = LBP16_HW_IP;
|
||||||
|
|
@ -419,28 +530,37 @@ void eth_boards_scan(board_access_t *access) {
|
||||||
int size;
|
int size;
|
||||||
if (WSAStringToAddress(access->dev_addr, AF_INET, NULL, (struct sockaddr *)&ss, &size) != 0) {
|
if (WSAStringToAddress(access->dev_addr, AF_INET, NULL, (struct sockaddr *)&ss, &size) != 0) {
|
||||||
#endif
|
#endif
|
||||||
return;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
eth_socket_nonblocking();
|
eth_socket_nonblocking();
|
||||||
|
|
||||||
if (access->address == 1) {
|
if (access->address == 1) {
|
||||||
eth_socket_set_dest_ip(access->dev_addr);
|
eth_socket_set_dest_ip(access->dev_addr);
|
||||||
eth_scan_one_addr(access);
|
r = eth_scan_one_addr(access);
|
||||||
} else {
|
} else {
|
||||||
strncpy(addr, access->dev_addr, 16);
|
strncpy(addr, access->dev_addr, 16);
|
||||||
ptr = strrchr(addr, '.');
|
ptr = strrchr(addr, '.');
|
||||||
*ptr = '\0';
|
*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++) {
|
for (i = 1; i < 255; i++) {
|
||||||
char addr_name[32];
|
char addr_name[32];
|
||||||
|
int this_r;
|
||||||
|
|
||||||
sprintf(addr_name, "%s.%d", addr, i);
|
sprintf(addr_name, "%s.%d", addr, i);
|
||||||
eth_socket_set_dest_ip(addr_name);
|
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();
|
eth_socket_blocking();
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void eth_print_info(board_t *board) {
|
void eth_print_info(board_t *board) {
|
||||||
|
|
@ -549,7 +669,7 @@ void eth_print_info(board_t *board) {
|
||||||
|
|
||||||
printf(" [space 6] LBP16 control/status:\n");
|
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 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(" 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(" error flags: 0x%04X\n", stat_area.ErrorReg);
|
||||||
printf(" debug LED ptr: 0x%04X\n", stat_area.DebugLEDPtr);
|
printf(" debug LED ptr: 0x%04X\n", stat_area.DebugLEDPtr);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
int eth_boards_init(board_access_t *access);
|
int eth_boards_init(board_access_t *access);
|
||||||
void eth_boards_cleanup(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);
|
void eth_print_info(board_t *board);
|
||||||
int eth_send_packet(void *packet, int size);
|
int eth_send_packet(void *packet, int size);
|
||||||
int eth_recv_packet(void *buffer, int size);
|
int eth_recv_packet(void *buffer, int size);
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,11 @@
|
||||||
#include "../sserial_module.h"
|
#include "../sserial_module.h"
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <pci/pci.h>
|
#include <pci/pci.h>
|
||||||
|
#include <unistd.h>
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#include "libpci/pci.h"
|
#include "libpci/pci.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int usleep(useconds_t usec); // static global access variable conflicts with POSIX function in unistd.h
|
|
||||||
|
|
||||||
static int device_flag;
|
static int device_flag;
|
||||||
static int instance_flag;
|
static int instance_flag;
|
||||||
static int instance = 0;
|
static int instance = 0;
|
||||||
|
|
@ -49,7 +48,7 @@ static struct option long_options[] = {
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void print_short_usage(void) {
|
void print_short_usage() {
|
||||||
printf("Example program for writing analog output on pci boards\n");
|
printf("Example program for writing analog output on pci boards\n");
|
||||||
printf("Syntax:\n");
|
printf("Syntax:\n");
|
||||||
printf(" pci_analog_write --device str [--instance i] [--delay d] [--verbose]\n");
|
printf(" pci_analog_write --device str [--instance i] [--delay d] [--verbose]\n");
|
||||||
|
|
@ -59,7 +58,7 @@ static void print_short_usage(void) {
|
||||||
printf(" --verbose printf additional info during execution\n");
|
printf(" --verbose printf additional info during execution\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_cmd_line(int argc, char *argv[]) {
|
int process_cmd_line(int argc, char *argv[]) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,11 @@
|
||||||
#include "../encoder_module.h"
|
#include "../encoder_module.h"
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <pci/pci.h>
|
#include <pci/pci.h>
|
||||||
|
#include <unistd.h>
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#include "libpci/pci.h"
|
#include "libpci/pci.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int usleep(useconds_t usec); // static global access variable conflicts with POSIX function in unistd.h
|
|
||||||
|
|
||||||
static int device_flag;
|
static int device_flag;
|
||||||
static int instance_flag;
|
static int instance_flag;
|
||||||
static int instance = 0;
|
static int instance = 0;
|
||||||
|
|
@ -49,7 +48,7 @@ static struct option long_options[] = {
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void print_short_usage(void) {
|
void print_short_usage() {
|
||||||
printf("Example program forreading encoder on pci boards\n");
|
printf("Example program forreading encoder on pci boards\n");
|
||||||
printf("Syntax:\n");
|
printf("Syntax:\n");
|
||||||
printf(" pci_encoder_read --device str [--instance i] [--delay d] [--verbose]\n");
|
printf(" pci_encoder_read --device str [--instance i] [--delay d] [--verbose]\n");
|
||||||
|
|
@ -59,7 +58,7 @@ static void print_short_usage(void) {
|
||||||
printf(" --verbose printf additional info during execution\n");
|
printf(" --verbose printf additional info during execution\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_cmd_line(int argc, char *argv[]) {
|
int process_cmd_line(int argc, char *argv[]) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
|
||||||
514
hostmot2.c
514
hostmot2.c
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// Copyright (C) 2013-2014 Michael Geszkiewicz
|
// Copyright (C) 2013-2014 Michael Geszkiewicz
|
||||||
|
// Copyright (C) 2018 Sebastian Kuzminsky
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// 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
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "hostmot2.h"
|
#include "hostmot2.h"
|
||||||
|
|
||||||
|
|
||||||
void hm2_read_idrom(hostmot2_t *hm2) {
|
void hm2_read_idrom(hostmot2_t *hm2) {
|
||||||
u32 idrom_addr, cookie;
|
u32 idrom_addr, cookie;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -29,7 +32,7 @@ void hm2_read_idrom(hostmot2_t *hm2) {
|
||||||
printf("ERROR: no HOSTMOT2 firmware found. %X\n", cookie);
|
printf("ERROR: no HOSTMOT2 firmware found. %X\n", cookie);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// check if it was already readed
|
// check if it was already read
|
||||||
if (strncmp(hm2->config_name, "HOSTMOT2", 8) == 0)
|
if (strncmp(hm2->config_name, "HOSTMOT2", 8) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -46,214 +49,6 @@ void hm2_read_idrom(hostmot2_t *hm2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static 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) {
|
hm2_module_desc_t *hm2_find_module(hostmot2_t *hm2, u8 gtag) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -318,100 +113,79 @@ 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));
|
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
|
// 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","Internal","TB3-18,19","TB3-16,17","TB3-13,14","TB3-10,11","TB3-7,8"}},
|
||||||
|
|
||||||
|
{BOB_7I77, {"Internal","TB6-5,6","TB6-3,4","Internal","Internal","Internal","Internal","Internal","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","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","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"}},
|
||||||
|
{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"}}
|
||||||
|
};
|
||||||
|
|
||||||
static pin_name_t pin_names[HM2_MAX_TAGS] = {
|
static pin_name_t pin_names[HM2_MAX_TAGS] = {
|
||||||
{HM2_GTAG_NONE, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
{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_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_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_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_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", "Null6", "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_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_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_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_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_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"}},
|
{HM2_GTAG_DAQ_FIFO, {"Data", "Strobe", "Full", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||||
|
|
@ -419,17 +193,24 @@ 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_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_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_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_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_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_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_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_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_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_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_UART_RX, {"RXData", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||||
{HM2_GTAG_TRAM, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
{HM2_GTAG_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_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] = {
|
static pin_name_t pin_names_xml[HM2_MAX_TAGS] = {
|
||||||
|
|
@ -438,12 +219,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_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_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_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_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_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_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_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_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"}},
|
{HM2_GTAG_DAQ_FIFO, {"Data", "Strobe", "Full", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||||
|
|
@ -451,17 +233,24 @@ 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_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_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_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_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_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_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_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_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_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_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_UART_RX, {"RXData", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
||||||
{HM2_GTAG_TRAM, {"Null1", "Null2", "Null3", "Null4", "Null5", "Null6", "Null7", "Null8", "Null9", "Null10"}},
|
{HM2_GTAG_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_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] = {
|
static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
||||||
|
|
@ -472,6 +261,7 @@ static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
||||||
{"QCount", HM2_GTAG_ENCODER},
|
{"QCount", HM2_GTAG_ENCODER},
|
||||||
{"StepGen", HM2_GTAG_STEPGEN},
|
{"StepGen", HM2_GTAG_STEPGEN},
|
||||||
{"PWM", HM2_GTAG_PWMGEN},
|
{"PWM", HM2_GTAG_PWMGEN},
|
||||||
|
{"RCPWM", HM2_GTAG_RCPWMGEN},
|
||||||
{"SPI", HM2_GTAG_SPI},
|
{"SPI", HM2_GTAG_SPI},
|
||||||
{"SSI", HM2_GTAG_SSI},
|
{"SSI", HM2_GTAG_SSI},
|
||||||
{"UARTTX", HM2_GTAG_UART_TX},
|
{"UARTTX", HM2_GTAG_UART_TX},
|
||||||
|
|
@ -493,8 +283,15 @@ static mod_name_t mod_names[HM2_MAX_TAGS] = {
|
||||||
{"LED", HM2_GTAG_LED},
|
{"LED", HM2_GTAG_LED},
|
||||||
{"ResolverMod", HM2_GTAG_RESOLVER},
|
{"ResolverMod", HM2_GTAG_RESOLVER},
|
||||||
{"SSerial", HM2_GTAG_SSERIAL},
|
{"SSerial", HM2_GTAG_SSERIAL},
|
||||||
|
{"SSerialB", HM2_GTAG_SSERIALB},
|
||||||
{"Twiddler", HM2_GTAG_TWIDDLER},
|
{"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] = {
|
static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
||||||
|
|
@ -505,6 +302,7 @@ static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
||||||
{"Encoder", HM2_GTAG_ENCODER},
|
{"Encoder", HM2_GTAG_ENCODER},
|
||||||
{"StepGen", HM2_GTAG_STEPGEN},
|
{"StepGen", HM2_GTAG_STEPGEN},
|
||||||
{"PWM", HM2_GTAG_PWMGEN},
|
{"PWM", HM2_GTAG_PWMGEN},
|
||||||
|
{"RCPWM", HM2_GTAG_RCPWMGEN},
|
||||||
{"SPI", HM2_GTAG_SPI},
|
{"SPI", HM2_GTAG_SPI},
|
||||||
{"SSI", HM2_GTAG_SSI},
|
{"SSI", HM2_GTAG_SSI},
|
||||||
{"UARTTX", HM2_GTAG_UART_TX},
|
{"UARTTX", HM2_GTAG_UART_TX},
|
||||||
|
|
@ -526,12 +324,20 @@ static mod_name_t mod_names_xml[HM2_MAX_TAGS] = {
|
||||||
{"LED", HM2_GTAG_LED},
|
{"LED", HM2_GTAG_LED},
|
||||||
{"ResolverMod", HM2_GTAG_RESOLVER},
|
{"ResolverMod", HM2_GTAG_RESOLVER},
|
||||||
{"SSerial", HM2_GTAG_SSERIAL},
|
{"SSerial", HM2_GTAG_SSERIAL},
|
||||||
|
{"SSerialB", HM2_GTAG_SSERIALB},
|
||||||
{"Twiddler", HM2_GTAG_TWIDDLER},
|
{"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;
|
int i;
|
||||||
|
static char unknown[100];
|
||||||
mod_name_t *mod_names_ptr;
|
mod_name_t *mod_names_ptr;
|
||||||
|
|
||||||
if (gtag == HM2_GTAG_NONE) {
|
if (gtag == HM2_GTAG_NONE) {
|
||||||
|
|
@ -548,7 +354,9 @@ static char *pin_find_module_name(int gtag, int xml_flag) {
|
||||||
if (mod_names_ptr[i].tag == gtag)
|
if (mod_names_ptr[i].tag == gtag)
|
||||||
return mod_names_ptr[i].name;
|
return mod_names_ptr[i].name;
|
||||||
}
|
}
|
||||||
return "(unknown-gtag)";
|
|
||||||
|
snprintf(unknown, 100, "(unknown-gtag-%d)", gtag);
|
||||||
|
return unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -566,8 +374,8 @@ static char *pin_get_pin_name(hm2_pin_desc_t *pin, int xml_flag) {
|
||||||
|
|
||||||
for (i = 0; i < HM2_MAX_TAGS; i++) {
|
for (i = 0; i < HM2_MAX_TAGS; i++) {
|
||||||
if (pin_names_ptr[i].tag == pin->sec_tag) {
|
if (pin_names_ptr[i].tag == pin->sec_tag) {
|
||||||
if (pin->sec_tag == HM2_GTAG_SSERIAL) {
|
if ((pin->sec_tag == HM2_GTAG_SSERIAL) || (pin->sec_tag == HM2_GTAG_SSERIALB)) {
|
||||||
chan = pin->sec_pin & 0x0F;
|
chan = (pin->sec_pin & 0x0F) - 1;
|
||||||
if ((pin->sec_pin & 0xF0) == 0x00) {
|
if ((pin->sec_pin & 0xF0) == 0x00) {
|
||||||
sprintf(buff, "%s%u", pin_names_ptr[i].name[0], chan);
|
sprintf(buff, "%s%u", pin_names_ptr[i].name[0], chan);
|
||||||
return buff;
|
return buff;
|
||||||
|
|
@ -581,6 +389,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);
|
sprintf(buff, "%s%u", pin_names_ptr[i].name[3], chan);
|
||||||
return buff;
|
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) {
|
} else if (pin->gtag == HM2_GTAG_DAQ_FIFO) {
|
||||||
chan = pin->sec_chan & 0x1F;
|
chan = pin->sec_chan & 0x1F;
|
||||||
if ((pin->sec_pin & 0xE0) == 0x00) {
|
if ((pin->sec_pin & 0xE0) == 0x00) {
|
||||||
|
|
@ -612,13 +429,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);
|
sprintf(buff, "%s%u", pin_names_ptr[i].name[0], chan);
|
||||||
return buff;
|
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 {
|
} else {
|
||||||
sprintf(buff, "%s", pin_names_ptr[i].name[(pin->sec_pin & 0x0F) - 1]);
|
sprintf(buff, "%s", pin_names_ptr[i].name[(pin->sec_pin & 0x0F) - 1]);
|
||||||
return buff;
|
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;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -647,16 +476,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) &&
|
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;
|
(llio->hm2.modules[i].clock_tag == 0) && (llio->hm2.modules[i].instances == 0)) break;
|
||||||
|
|
||||||
{
|
printf(" Module: %s\n", find_module_name(llio->hm2.modules[i].gtag, xml_flag));
|
||||||
int k;
|
printf(" There are %u of %s in configuration\n", llio->hm2.modules[i].instances, find_module_name(llio->hm2.modules[i].gtag, xml_flag));
|
||||||
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(" Version: %u\n", llio->hm2.modules[i].version);
|
printf(" Version: %u\n", llio->hm2.modules[i].version);
|
||||||
printf(" Registers: %u\n", llio->hm2.modules[i].registers);
|
printf(" Registers: %u\n", llio->hm2.modules[i].registers);
|
||||||
|
|
@ -687,14 +508,21 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
||||||
case 32:
|
case 32:
|
||||||
pin_nr = i*(llio->hm2.idrom.port_width) + j;
|
pin_nr = i*(llio->hm2.idrom.port_width) + j;
|
||||||
break;
|
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(" %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) {
|
if (pin->sec_tag == HM2_GTAG_NONE) {
|
||||||
printf(" %-15s", "None");
|
printf(" %-15s", "None");
|
||||||
} else {
|
} 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) {
|
if (pin->sec_chan & HM2_CHAN_GLOBAL) {
|
||||||
printf(" Global ");
|
printf(" Global ");
|
||||||
|
|
@ -730,17 +558,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;
|
(llio->hm2.modules[i].clock_tag == 0) && (llio->hm2.modules[i].instances == 0)) break;
|
||||||
|
|
||||||
printf(" <module>\n");
|
printf(" <module>\n");
|
||||||
{
|
printf(" <tagname>%s</tagname>\n", find_module_name(llio->hm2.modules[i].gtag, xml_flag));
|
||||||
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(" <numinstances>%2d</numinstances>\n", llio->hm2.modules[i].instances);
|
printf(" <numinstances>%2d</numinstances>\n", llio->hm2.modules[i].instances);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf(" </module>\n");
|
printf(" </module>\n");
|
||||||
}
|
}
|
||||||
printf(" </modules>\n");
|
printf(" </modules>\n");
|
||||||
|
|
@ -761,10 +580,13 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
||||||
case 32:
|
case 32:
|
||||||
pin_nr = i*(llio->hm2.idrom.port_width) + j;
|
pin_nr = i*(llio->hm2.idrom.port_width) + j;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
pin_nr = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
printf(" <pin>\n");
|
printf(" <pin>\n");
|
||||||
printf(" <connector>%s</connector>\n", llio->ioport_connector_name[i]);
|
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>");
|
printf(" <secondaryfunctionname>");
|
||||||
if (pin->sec_tag != HM2_GTAG_NONE) {
|
if (pin->sec_tag != HM2_GTAG_NONE) {
|
||||||
printf("%s", pin_get_pin_name(pin, xml_flag));
|
printf("%s", pin_get_pin_name(pin, xml_flag));
|
||||||
|
|
@ -775,7 +597,11 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("</secondaryfunctionname>\n");
|
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(" <secondaryinstance>%2d</secondaryinstance>\n", pin_nr);
|
||||||
|
}
|
||||||
printf(" </pin>\n");
|
printf(" </pin>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -783,3 +609,35 @@ void hm2_print_pin_file(llio_t *llio, int xml_flag) {
|
||||||
printf("</hostmot2>\n");
|
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"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
18
hostmot2.h
18
hostmot2.h
|
|
@ -36,7 +36,8 @@ typedef struct {
|
||||||
int sw_modes_cnt;
|
int sw_modes_cnt;
|
||||||
} sserial_device_t;
|
} sserial_device_t;
|
||||||
|
|
||||||
#define HM2_MAX_TAGS 30
|
#define HM2_MAX_TAGS 255
|
||||||
|
#define MAX_BOB_NAMES 17
|
||||||
#define ANYIO_MAX_IOPORT_CONNECTORS 8
|
#define ANYIO_MAX_IOPORT_CONNECTORS 8
|
||||||
|
|
||||||
typedef struct llio_struct llio_t;
|
typedef struct llio_struct llio_t;
|
||||||
|
|
@ -60,12 +61,13 @@ struct llio_struct {
|
||||||
int num_ioport_connectors;
|
int num_ioport_connectors;
|
||||||
int pins_per_connector;
|
int pins_per_connector;
|
||||||
const char *ioport_connector_name[ANYIO_MAX_IOPORT_CONNECTORS];
|
const char *ioport_connector_name[ANYIO_MAX_IOPORT_CONNECTORS];
|
||||||
|
u16 bob_hint[ANYIO_MAX_IOPORT_CONNECTORS];
|
||||||
int num_leds;
|
int num_leds;
|
||||||
const char *fpga_part_number;
|
const char *fpga_part_number;
|
||||||
char board_name[16];
|
char board_name[16];
|
||||||
void *board;
|
void *board;
|
||||||
hostmot2_t hm2;
|
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];
|
sserial_device_t ss_device[HM2_SSERIAL_MAX_CHANNELS];
|
||||||
int verbose;
|
int verbose;
|
||||||
};
|
};
|
||||||
|
|
@ -75,23 +77,23 @@ typedef struct {
|
||||||
char *name[10];
|
char *name[10];
|
||||||
} pin_name_t;
|
} pin_name_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u16 bobname;
|
||||||
|
char *name[32];
|
||||||
|
} bob_pin_name_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
u8 tag;
|
u8 tag;
|
||||||
} mod_name_t;
|
} mod_name_t;
|
||||||
|
|
||||||
int hm2_check_cookie(llio_t *llio);
|
|
||||||
void hm2_read_idrom(hostmot2_t *hm2);
|
void hm2_read_idrom(hostmot2_t *hm2);
|
||||||
hm2_module_desc_t *hm2_find_module(hostmot2_t *hm2, u8 gtag);
|
hm2_module_desc_t *hm2_find_module(hostmot2_t *hm2, u8 gtag);
|
||||||
void hm2_print_idrom(hostmot2_t *hm2);
|
|
||||||
void hm2_print_modules(hostmot2_t *hm2);
|
|
||||||
void hm2_print_pins(hostmot2_t *hm2);
|
|
||||||
void hm2_print_pin_file(llio_t *llio, int xml_flag);
|
void hm2_print_pin_file(llio_t *llio, int xml_flag);
|
||||||
|
void hm2_print_pin_descriptors(llio_t *llio);
|
||||||
void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source);
|
void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source);
|
||||||
void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction);
|
void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction);
|
||||||
void sserial_module_init(llio_t *llio);
|
void sserial_module_init(llio_t *llio);
|
||||||
void hm2_set_pin_source(hostmot2_t *hm2, int pin_number, u8 source);
|
|
||||||
void hm2_set_pin_direction(hostmot2_t *hm2, int pin_number, u8 direction);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,22 @@
|
||||||
#define HM2_GTAG_BISS 0x18
|
#define HM2_GTAG_BISS 0x18
|
||||||
#define HM2_GTAG_FABS 0x19
|
#define HM2_GTAG_FABS 0x19
|
||||||
#define HM2_GTAG_HM2DPLL 0x1A
|
#define HM2_GTAG_HM2DPLL 0x1A
|
||||||
|
#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_LIOPORT 0x40
|
||||||
#define HM2_GTAG_LED 0x80
|
#define HM2_GTAG_LED 0x80
|
||||||
#define HM2_GTAG_RESOLVER 0xC0
|
#define HM2_GTAG_RESOLVER 0xC0
|
||||||
#define HM2_GTAG_SSERIAL 0xC1
|
#define HM2_GTAG_SSERIAL 0xC1
|
||||||
#define HM2_GTAG_TWIDDLER 0xC2
|
#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
|
// HM2 EEPROM SPI INTERFACE
|
||||||
|
|
||||||
|
|
@ -207,7 +217,7 @@ typedef struct {
|
||||||
|
|
||||||
// SSERIAL MODULE
|
// SSERIAL MODULE
|
||||||
|
|
||||||
#define HM2_SSERIAL_MAX_INTEFACES 4
|
#define HM2_SSERIAL_MAX_INTERFACES 4
|
||||||
#define HM2_SSERIAL_MAX_CHANNELS 8
|
#define HM2_SSERIAL_MAX_CHANNELS 8
|
||||||
|
|
||||||
#define HM2_MOD_OFFS_SSERIAL_CMD 0x0000
|
#define HM2_MOD_OFFS_SSERIAL_CMD 0x0000
|
||||||
|
|
@ -268,6 +278,25 @@ typedef struct {
|
||||||
#define SSLBP_REMOTE_7I77_ANALOG 0x11000000
|
#define SSLBP_REMOTE_7I77_ANALOG 0x11000000
|
||||||
#define SSLBP_REMOTE_7I77_IO 0x12000000
|
#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
|
||||||
|
|
||||||
struct sserial_pdd_struct {
|
struct sserial_pdd_struct {
|
||||||
u8 record_type;
|
u8 record_type;
|
||||||
u8 data_size;
|
u8 data_size;
|
||||||
|
|
|
||||||
11
lbp.c
11
lbp.c
|
|
@ -28,7 +28,7 @@
|
||||||
#include "lbp.h"
|
#include "lbp.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int sd;
|
static int sd = -1;
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
HANDLE sd;
|
HANDLE sd;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -42,6 +42,7 @@ int lbp_send(void *packet, int size) {
|
||||||
#endif
|
#endif
|
||||||
if (LBP_SENDRECV_DEBUG)
|
if (LBP_SENDRECV_DEBUG)
|
||||||
printf("%d=lbp_send(%d)\n", send, size);
|
printf("%d=lbp_send(%d)\n", send, size);
|
||||||
|
|
||||||
return send;
|
return send;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,6 +55,7 @@ int lbp_recv(void *packet, int size) {
|
||||||
#endif
|
#endif
|
||||||
if (LBP_SENDRECV_DEBUG)
|
if (LBP_SENDRECV_DEBUG)
|
||||||
printf("%d=lbp_recv(%d)\n", recv, size);
|
printf("%d=lbp_recv(%d)\n", recv, size);
|
||||||
|
|
||||||
return recv;
|
return recv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,6 +67,7 @@ u8 lbp_read_ctrl(u8 cmd) {
|
||||||
recv = lbp_recv(&data, 1);
|
recv = lbp_recv(&data, 1);
|
||||||
if (LBP_SENDRECV_DEBUG)
|
if (LBP_SENDRECV_DEBUG)
|
||||||
printf("%d=send(%X), %d=recv(%X)\n", send, cmd, recv, data);
|
printf("%d=send(%X), %d=recv(%X)\n", send, cmd, recv, data);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,6 +84,7 @@ int lbp_read(u16 addr, void *buffer) {
|
||||||
recv = lbp_recv(buffer, 4);
|
recv = lbp_recv(buffer, 4);
|
||||||
if (LBP_SENDRECV_DEBUG)
|
if (LBP_SENDRECV_DEBUG)
|
||||||
printf("lbp_read(%02X:%04X): %08X\n", packet.cmd, addr, *ptr);
|
printf("lbp_read(%02X:%04X): %08X\n", packet.cmd, addr, *ptr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,10 +100,11 @@ int lbp_write(u16 addr, void *buffer) {
|
||||||
send = lbp_send(&packet, sizeof(lbp_cmd_addr_data));
|
send = lbp_send(&packet, sizeof(lbp_cmd_addr_data));
|
||||||
if (LBP_SENDRECV_DEBUG)
|
if (LBP_SENDRECV_DEBUG)
|
||||||
printf("lbp_write(%02X:%04X)\n", packet.cmd, addr);
|
printf("lbp_write(%02X:%04X)\n", packet.cmd, addr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lbp_print_info(void) {
|
void lbp_print_info() {
|
||||||
u8 data;
|
u8 data;
|
||||||
|
|
||||||
data = lbp_read_ctrl(LBP_CMD_READ_VERSION);
|
data = lbp_read_ctrl(LBP_CMD_READ_VERSION);
|
||||||
|
|
@ -122,7 +127,7 @@ void lbp_init(board_access_t *access) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void lbp_release(void) {
|
void lbp_release() {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
close(sd);
|
close(sd);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
4
lbp.h
4
lbp.h
|
|
@ -85,9 +85,9 @@ int lbp_recv(void *packet, int size);
|
||||||
u8 lbp_read_ctrl(u8 cmd);
|
u8 lbp_read_ctrl(u8 cmd);
|
||||||
int lbp_read(u16 addr, void *buffer);
|
int lbp_read(u16 addr, void *buffer);
|
||||||
int lbp_write(u16 addr, void *buffer);
|
int lbp_write(u16 addr, void *buffer);
|
||||||
void lbp_print_info(void);
|
void lbp_print_info();
|
||||||
void lbp_init(board_access_t *access);
|
void lbp_init(board_access_t *access);
|
||||||
void lbp_release(void);
|
void lbp_release();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
2
lbp16.c
2
lbp16.c
|
|
@ -142,5 +142,5 @@ void lbp16_init(int board_type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lbp16_cleanup(int board_type) {
|
void lbp_cleanup(int board_type) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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
|
||||||
130
mesaflash.c
130
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
|
// 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
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -29,6 +31,10 @@
|
||||||
#include "libpci/pci.h"
|
#include "libpci/pci.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef VERSION
|
||||||
|
#define VERSION "3.4.0~pre1"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int device_flag;
|
static int device_flag;
|
||||||
static int addr_flag;
|
static int addr_flag;
|
||||||
static int addr_hi_flag;
|
static int addr_hi_flag;
|
||||||
|
|
@ -40,6 +46,7 @@ static int fallback_flag;
|
||||||
static int recover_flag;
|
static int recover_flag;
|
||||||
static int program_flag;
|
static int program_flag;
|
||||||
static int readhmid_flag;
|
static int readhmid_flag;
|
||||||
|
static int print_pd_flag;
|
||||||
static int reload_flag;
|
static int reload_flag;
|
||||||
static int reset_flag;
|
static int reset_flag;
|
||||||
static int sserial_flag;
|
static int sserial_flag;
|
||||||
|
|
@ -72,6 +79,7 @@ static struct option long_options[] = {
|
||||||
{"recover", no_argument, &recover_flag, 1},
|
{"recover", no_argument, &recover_flag, 1},
|
||||||
{"program", required_argument, 0, 'p'},
|
{"program", required_argument, 0, 'p'},
|
||||||
{"readhmid", no_argument, &readhmid_flag, 1},
|
{"readhmid", no_argument, &readhmid_flag, 1},
|
||||||
|
{"print-pd", no_argument, &print_pd_flag, 1},
|
||||||
{"reload", no_argument, &reload_flag, 1},
|
{"reload", no_argument, &reload_flag, 1},
|
||||||
{"reset", no_argument, &reset_flag, 1},
|
{"reset", no_argument, &reset_flag, 1},
|
||||||
{"sserial", no_argument, &sserial_flag, 1},
|
{"sserial", no_argument, &sserial_flag, 1},
|
||||||
|
|
@ -89,15 +97,13 @@ static struct option long_options[] = {
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void print_short_usage(void) {
|
void print_short_usage() {
|
||||||
printf("\nMesaflash version 3.3.0~pre (built on %s %s with libpci %s)\n", __DATE__, __TIME__, PCILIB_VERSION);
|
printf("Mesaflash version %s\n", VERSION);
|
||||||
printf("Configuration and diagnostic tool for Mesa Electronics PCI(E)/ETH/EPP/USB boards\n");
|
printf("Configuration and diagnostic tool for Mesa Electronics PCI(E)/ETH/EPP/USB/SPI boards\n");
|
||||||
printf("(C) 2013-2015 Michael Geszkiewicz (contact: micges@wp.pl)\n");
|
|
||||||
printf("(C) Mesa Electronics\n");
|
|
||||||
printf("Try 'mesaflash --help' for more information\n");
|
printf("Try 'mesaflash --help' for more information\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_usage(void) {
|
void print_usage() {
|
||||||
printf("Syntax:\n");
|
printf("Syntax:\n");
|
||||||
printf(" mesaflash --device device_name [options]\n");
|
printf(" mesaflash --device device_name [options]\n");
|
||||||
printf(" mesaflash --device device_name [options] --write filename\n");
|
printf(" mesaflash --device device_name [options] --write filename\n");
|
||||||
|
|
@ -111,37 +117,58 @@ static void print_usage(void) {
|
||||||
printf(" mesaflash --device device_name [options] --set ip=n.n.n.n\n");
|
printf(" mesaflash --device device_name [options] --set ip=n.n.n.n\n");
|
||||||
printf(" mesaflash --info file_name\n");
|
printf(" mesaflash --info file_name\n");
|
||||||
printf(" mesaflash --help\n");
|
printf(" mesaflash --help\n");
|
||||||
printf("\nOptions:\n");
|
printf("\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("Options:\n");
|
||||||
printf(" --addr <device_address>\n");
|
printf(" --device <name> Select active device name. If no command is given it\n");
|
||||||
printf(" select <device address> for looking for <device_name> (network C mask for ethernet boards, serial port for USB boards)\n");
|
printf(" will detect board with given name and print info\n");
|
||||||
printf(" --addr_hi set the high register address for the EPP interface\n");
|
printf(" about it.\n");
|
||||||
printf(" --epp use EPP interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
printf(" --addr <dev> Select <dev> for looking for <name> (IP address for\n");
|
||||||
printf(" --usb use USB interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
printf(" Ethernet boards, serial device name for USB boards\n");
|
||||||
printf(" --spi use SPI interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
printf(" and serial boards, SPI device name for SPI boards)\n");
|
||||||
printf(" --serial use serial interface to connect to board, only for boards with multiple interfaces (7i43, 7i90, 7i64)\n");
|
printf(" --addr_hi Set the high register address for the EPP interface.\n");
|
||||||
printf(" --fallback use the fallback area of the EEPROM while executing commands\n");
|
printf(" --epp Use EPP interface to connect to board, only for boards\n");
|
||||||
printf(" --recover access board using PCI bridge GPIO (currently only 6I25)\n");
|
printf(" with multiple interfaces (7c80, 7c81, 7i43, 7i90, 7i64).\n");
|
||||||
printf(" --xml format output from 'readhmid' command into XML\n");
|
printf(" --usb Use USB interface to connect to board, only for boards\n");
|
||||||
printf(" --verbose print detailed information while running commands\n");
|
printf(" with multiple interfaces (7c80, 7c81, 7i43, 7i90, 7i64).\n");
|
||||||
printf("\nCommands:\n");
|
printf(" --spi Use SPI interface to connect to board, only for boards\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(" with multiple interfaces (7c80, 7c81, 7i43, 7i90, 7i64).\n");
|
||||||
printf(" --fix-boot-block If a write operation does not detect a valid boot block, write one\n");
|
printf(" --serial Use serial interface to connect to board, only for\n");
|
||||||
printf(" --no-auto-verify Don't automatically verify after writing\n");
|
printf(" boards with multiple interfaces (7i43, 7i90, 7i64).\n");
|
||||||
printf(" --verify verifies the EEPROM configuration against the bitfile 'filename'\n");
|
printf(" --fallback Use the fallback area of the EEPROM while executing\n");
|
||||||
printf(" --program writes a standard bitfile 'filename' configuration to the FPGA (IMPORTANT! 'filename' must be VALID FPGA configuration file)\n");
|
printf(" commands.\n");
|
||||||
printf(" --readhmid print hostmot2 configuration in PIN file format\n");
|
printf(" --recover Access board using PCI bridge GPIO (currently\n");
|
||||||
printf(" --reload do full FPGA reload from flash (only ethernet and pci boards)\n");
|
printf(" only 6I24/6I25).\n");
|
||||||
printf(" --reset do full firmware reset (only ethernet boards)\n");
|
printf(" --xml Format output from 'readhmid' command into XML.\n");
|
||||||
printf(" --sserial print full information about all sserial remote boards\n");
|
printf(" --verbose Print detailed information while running commands.\n");
|
||||||
printf(" --rpo read hostmot2 variable directly at 'address'\n");
|
printf("\n");
|
||||||
printf(" --wpo write hostmot2 variable directly at 'address' with 'value'\n");
|
printf("Commands:\n");
|
||||||
printf(" --set set board IP address in eeprom to n.n.n.n (only ethernet boards)\n");
|
printf(" --write Writes a standard bitfile 'filename' configuration to\n");
|
||||||
printf(" --info print info about configuration in 'file_name'\n");
|
printf(" the userarea of the EEPROM (IMPORTANT! 'filename' must\n");
|
||||||
printf(" --help print this help message\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");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_cmd_line(int argc, char *argv[]) {
|
int process_cmd_line(int argc, char *argv[]) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
@ -203,7 +230,12 @@ static int process_cmd_line(int argc, char *argv[]) {
|
||||||
printf("Error: multiple --write options\n");
|
printf("Error: multiple --write options\n");
|
||||||
exit(-1);
|
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++;
|
write_flag++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -213,7 +245,12 @@ static int process_cmd_line(int argc, char *argv[]) {
|
||||||
printf("Error: multiple --program options\n");
|
printf("Error: multiple --program options\n");
|
||||||
exit(-1);
|
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++;
|
program_flag++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -285,7 +322,12 @@ static int process_cmd_line(int argc, char *argv[]) {
|
||||||
printf("Error: multiple --verify options\n");
|
printf("Error: multiple --verify options\n");
|
||||||
exit(-1);
|
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++;
|
verify_flag++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -295,7 +337,12 @@ static int process_cmd_line(int argc, char *argv[]) {
|
||||||
printf("Error: multiple --info options\n");
|
printf("Error: multiple --info options\n");
|
||||||
exit(-1);
|
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++;
|
info_flag++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -353,6 +400,7 @@ int main(int argc, char *argv[]) {
|
||||||
exit(1);
|
exit(1);
|
||||||
ret = anyio_find_dev(&access);
|
ret = anyio_find_dev(&access);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
printf("No %s board found\n", access.device_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
board = anyio_get_dev(&access, 1);
|
board = anyio_get_dev(&access, 1);
|
||||||
|
|
@ -365,6 +413,8 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (readhmid_flag == 1) {
|
if (readhmid_flag == 1) {
|
||||||
anyio_dev_print_hm2_info(board, xml_flag);
|
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) {
|
} else if (sserial_flag == 1) {
|
||||||
anyio_dev_print_sserial_info(board);
|
anyio_dev_print_sserial_info(board);
|
||||||
} else if (rpo_flag == 1) {
|
} else if (rpo_flag == 1) {
|
||||||
|
|
|
||||||
75
pci_boards.c
75
pci_boards.c
|
|
@ -16,11 +16,12 @@
|
||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if MESAFLASH_IO
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
#include <pci/pci.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <pci/pci.h>
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "libpci/pci.h"
|
#include "libpci/pci.h"
|
||||||
|
|
@ -30,8 +31,8 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
@ -47,9 +48,6 @@ static int memfd = -1;
|
||||||
struct pci_access *pacc;
|
struct pci_access *pacc;
|
||||||
static u8 file_buffer[SECTOR_SIZE];
|
static u8 file_buffer[SECTOR_SIZE];
|
||||||
|
|
||||||
static int pci_read(llio_t *self, u32 addr, void *buffer, int size);
|
|
||||||
static int pci_write(llio_t *self, u32 addr, void *buffer, int size);
|
|
||||||
|
|
||||||
u16 setup_eeprom_5i20[256] = {
|
u16 setup_eeprom_5i20[256] = {
|
||||||
0x9030, // DEVICE ID
|
0x9030, // DEVICE ID
|
||||||
0x10B5, // VENDOR ID
|
0x10B5, // VENDOR ID
|
||||||
|
|
@ -387,7 +385,7 @@ static u16 plx9030_read_eeprom_word(board_t *board, u8 reg) {
|
||||||
return tdata;
|
return tdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pci_plx9030_bridge_eeprom_setup_read(board_t *board) {
|
void pci_plx9030_bridge_eeprom_setup_read(board_t *board) {
|
||||||
int i;
|
int i;
|
||||||
char *bridge_name = "Unknown";
|
char *bridge_name = "Unknown";
|
||||||
|
|
||||||
|
|
@ -414,7 +412,6 @@ static int plx9030_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
int bindex, bytesread;
|
int bindex, bytesread;
|
||||||
u32 status, control;
|
u32 status, control;
|
||||||
char part_name[32];
|
char part_name[32];
|
||||||
char board_name[32];
|
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct timeval tv1, tv2;
|
struct timeval tv1, tv2;
|
||||||
|
|
@ -428,15 +425,10 @@ static int plx9030_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_bitfile_header(fp, (char*) &part_name, (char*) &board_name, board->llio.verbose) == -1) {
|
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!check_board_name(self->board_name, board_name, bitfile_name)) {
|
|
||||||
fclose(fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set /WRITE low for data transfer, and turn on LED
|
// set /WRITE low for data transfer, and turn on LED
|
||||||
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
|
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
|
||||||
control = status & ~PLX9030_WRITE_MASK & ~PLX9030_LED_MASK;
|
control = status & ~PLX9030_WRITE_MASK & ~PLX9030_LED_MASK;
|
||||||
|
|
@ -576,7 +568,6 @@ static int plx905x_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
int bindex, bytesread, i;
|
int bindex, bytesread, i;
|
||||||
u32 status;
|
u32 status;
|
||||||
char part_name[32];
|
char part_name[32];
|
||||||
char board_name[32];
|
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct timeval tv1, tv2;
|
struct timeval tv1, tv2;
|
||||||
|
|
@ -590,11 +581,7 @@ static int plx905x_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_bitfile_header(fp, (char*) &part_name, (char*) &board_name, board->llio.verbose) == -1) {
|
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
|
||||||
fclose(fp);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!check_board_name(self->board_name, board_name, bitfile_name)) {
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -678,7 +665,7 @@ static int plx905x_reset(llio_t *self) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void memcpy32(void *vdest, void *vsrc, int size) {
|
void memcpy32(void *vdest, void *vsrc, int size) {
|
||||||
volatile u32 *dest = (volatile u32*)vdest;
|
volatile u32 *dest = (volatile u32*)vdest;
|
||||||
volatile u32 *src = (volatile u32*)vsrc;
|
volatile u32 *src = (volatile u32*)vsrc;
|
||||||
while(size) {
|
while(size) {
|
||||||
|
|
@ -689,14 +676,14 @@ static void memcpy32(void *vdest, void *vsrc, int size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_read(llio_t *self, u32 addr, void *buffer, int size) {
|
int pci_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
assert(size % 4 == 0);
|
assert(size % 4 == 0);
|
||||||
memcpy32(buffer, board->base + addr, size/4);
|
memcpy32(buffer, board->base + addr, size/4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_write(llio_t *self, u32 addr, void *buffer, int size) {
|
int pci_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
assert(size % 4 == 0);
|
assert(size % 4 == 0);
|
||||||
memcpy32(board->base + addr, buffer, size/4);
|
memcpy32(board->base + addr, buffer, size/4);
|
||||||
|
|
@ -782,6 +769,10 @@ static int pci_board_open(board_t *board) {
|
||||||
if (board->mem_base != 0) {
|
if (board->mem_base != 0) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
board->base = mmap(0, board->len, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, board->mem_base);
|
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
|
#elif _WIN32
|
||||||
board->base = map_memory(board->mem_base, board->len, &(board->mem_handle));
|
board->base = map_memory(board->mem_base, board->len, &(board->mem_handle));
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -826,7 +817,10 @@ int pci_boards_init(board_access_t *access) {
|
||||||
|
|
||||||
memfd = open("/dev/mem", O_RDWR);
|
memfd = open("/dev/mem", O_RDWR);
|
||||||
eno = errno;
|
eno = errno;
|
||||||
seteuid(getuid());
|
if (seteuid(getuid()) != 0) {
|
||||||
|
printf("Failed to restore euid: %s\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (memfd < 0) {
|
if (memfd < 0) {
|
||||||
printf("%s can't open /dev/mem: %s", __func__, strerror(eno));
|
printf("%s can't open /dev/mem: %s", __func__, strerror(eno));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -863,7 +857,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
board_init_struct(board);
|
board_init_struct(board);
|
||||||
if ((dev->vendor_id == VENDORID_XIO2001) && (dev->device_id == DEVICEID_XIO2001)) {
|
if ((dev->vendor_id == VENDORID_XIO2001) && (dev->device_id == DEVICEID_XIO2001)) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 2;
|
||||||
board->llio.pins_per_connector = 17;
|
board->llio.pins_per_connector = 17;
|
||||||
board->llio.ioport_connector_name[0] = "P3";
|
board->llio.ioport_connector_name[0] = "P3";
|
||||||
|
|
@ -897,7 +891,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
if (dev->vendor_id == VENDORID_MESAPCI) {
|
if (dev->vendor_id == VENDORID_MESAPCI) {
|
||||||
if (dev->device_id == DEVICEID_MESA4I74) {
|
if (dev->device_id == DEVICEID_MESA4I74) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P1";
|
board->llio.ioport_connector_name[0] = "P1";
|
||||||
|
|
@ -924,7 +918,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if (dev->device_id == DEVICEID_MESA5I24) {
|
} else if (dev->device_id == DEVICEID_MESA5I24) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P4";
|
board->llio.ioport_connector_name[0] = "P4";
|
||||||
|
|
@ -952,7 +946,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if (dev->device_id == DEVICEID_MESA5I25) {
|
} else if (dev->device_id == DEVICEID_MESA5I25) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 2;
|
||||||
board->llio.pins_per_connector = 17;
|
board->llio.pins_per_connector = 17;
|
||||||
board->llio.ioport_connector_name[0] = "P3";
|
board->llio.ioport_connector_name[0] = "P3";
|
||||||
|
|
@ -979,7 +973,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if (dev->device_id == DEVICEID_MESA6I24) {
|
} else if (dev->device_id == DEVICEID_MESA6I24) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P4";
|
board->llio.ioport_connector_name[0] = "P4";
|
||||||
|
|
@ -1007,7 +1001,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if (dev->device_id == DEVICEID_MESA6I25) {
|
} else if (dev->device_id == DEVICEID_MESA6I25) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 2;
|
||||||
board->llio.pins_per_connector = 17;
|
board->llio.pins_per_connector = 17;
|
||||||
board->llio.ioport_connector_name[0] = "P3";
|
board->llio.ioport_connector_name[0] = "P3";
|
||||||
|
|
@ -1038,7 +1032,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
||||||
if (ssid == SUBDEVICEID_MESA5I20) {
|
if (ssid == SUBDEVICEID_MESA5I20) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P2";
|
board->llio.ioport_connector_name[0] = "P2";
|
||||||
|
|
@ -1068,7 +1062,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
plx9030_fixup_LASxBRD_READY(&(board->llio));
|
plx9030_fixup_LASxBRD_READY(&(board->llio));
|
||||||
} else if (ssid == SUBDEVICEID_MESA4I65) {
|
} else if (ssid == SUBDEVICEID_MESA4I65) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P1";
|
board->llio.ioport_connector_name[0] = "P1";
|
||||||
|
|
@ -1101,7 +1095,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
||||||
if ((ssid == SUBDEVICEID_MESA4I68_OLD) || (ssid == SUBDEVICEID_MESA4I68)) {
|
if ((ssid == SUBDEVICEID_MESA4I68_OLD) || (ssid == SUBDEVICEID_MESA4I68)) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P1";
|
board->llio.ioport_connector_name[0] = "P1";
|
||||||
|
|
@ -1129,7 +1123,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if (ssid == SUBDEVICEID_MESA5I21) {
|
} else if (ssid == SUBDEVICEID_MESA5I21) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 2;
|
||||||
board->llio.pins_per_connector = 32;
|
board->llio.pins_per_connector = 32;
|
||||||
board->llio.ioport_connector_name[0] = "P1";
|
board->llio.ioport_connector_name[0] = "P1";
|
||||||
|
|
@ -1156,7 +1150,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if ((ssid == SUBDEVICEID_MESA5I22_10) || (ssid == SUBDEVICEID_MESA5I22_15)) {
|
} else if ((ssid == SUBDEVICEID_MESA5I22_10) || (ssid == SUBDEVICEID_MESA5I22_15)) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 4;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P2";
|
board->llio.ioport_connector_name[0] = "P2";
|
||||||
|
|
@ -1189,7 +1183,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if (ssid == SUBDEVICEID_MESA5I23) {
|
} else if (ssid == SUBDEVICEID_MESA5I23) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P2";
|
board->llio.ioport_connector_name[0] = "P2";
|
||||||
|
|
@ -1217,7 +1211,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
boards_count++;
|
boards_count++;
|
||||||
} else if ((ssid == SUBDEVICEID_MESA4I69_16) || (ssid == SUBDEVICEID_MESA4I69_25)) {
|
} else if ((ssid == SUBDEVICEID_MESA4I69_16) || (ssid == SUBDEVICEID_MESA4I69_25)) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 3;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P1";
|
board->llio.ioport_connector_name[0] = "P1";
|
||||||
|
|
@ -1252,7 +1246,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
u16 ssid = pci_read_word(dev, PCI_SUBSYSTEM_ID);
|
||||||
if ((ssid == SUBDEVICEID_MESA3X20_10) || (ssid == SUBDEVICEID_MESA3X20_15) || (ssid == SUBDEVICEID_MESA3X20_20)) {
|
if ((ssid == SUBDEVICEID_MESA3X20_10) || (ssid == SUBDEVICEID_MESA3X20_15) || (ssid == SUBDEVICEID_MESA3X20_20)) {
|
||||||
board->type = BOARD_PCI;
|
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.num_ioport_connectors = 6;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P4";
|
board->llio.ioport_connector_name[0] = "P4";
|
||||||
|
|
@ -1293,7 +1287,7 @@ void pci_boards_scan(board_access_t *access) {
|
||||||
}
|
}
|
||||||
} else if (dev->device_id == DEVICEID_PLX8112) {
|
} else if (dev->device_id == DEVICEID_PLX8112) {
|
||||||
board->type = BOARD_PCI;
|
board->type = BOARD_PCI;
|
||||||
strncpy(board->llio.board_name, "5I71", 4);
|
strcpy(board->llio.board_name, "5I71");
|
||||||
board->open = &pci_board_open;
|
board->open = &pci_board_open;
|
||||||
board->close = &pci_board_close;
|
board->close = &pci_board_close;
|
||||||
board->print_info = &pci_print_info;
|
board->print_info = &pci_print_info;
|
||||||
|
|
@ -1326,7 +1320,7 @@ void pci_print_info(board_t *board) {
|
||||||
show_formatted_size(board->dev->size[i]);
|
show_formatted_size(board->dev->size[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else {
|
} 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]);
|
show_formatted_size(board->dev->size[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
@ -1338,7 +1332,8 @@ void pci_print_info(board_t *board) {
|
||||||
if (board->data_base_addr > 0)
|
if (board->data_base_addr > 0)
|
||||||
printf(" Data I/O addr: %04X\n", board->data_base_addr);
|
printf(" Data I/O addr: %04X\n", board->data_base_addr);
|
||||||
if (board->mem_base > 0)
|
if (board->mem_base > 0)
|
||||||
printf(" Memory: %08X\n", board->mem_base);
|
printf(" Memory: %016" PRIx64 "\n", board->mem_base);
|
||||||
|
|
||||||
show_board_info(board);
|
show_board_info(board);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <sys/poll.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "anyio.h"
|
#include "anyio.h"
|
||||||
#include "serial_boards.h"
|
#include "serial_boards.h"
|
||||||
|
|
@ -37,7 +36,7 @@
|
||||||
extern board_t boards[MAX_BOARDS];
|
extern board_t boards[MAX_BOARDS];
|
||||||
extern int boards_count;
|
extern int boards_count;
|
||||||
|
|
||||||
int sd;
|
static int sd = -1;
|
||||||
|
|
||||||
// serial access functions
|
// serial access functions
|
||||||
|
|
||||||
|
|
@ -79,8 +78,15 @@ int serial_recv_packet(void *packet, int size) {
|
||||||
while (r < size) {
|
while (r < size) {
|
||||||
rc = ppoll(fds, 1, &timeout, NULL);
|
rc = ppoll(fds, 1, &timeout, NULL);
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
ret = read(sd, buffer + r, rc);
|
ret = read(sd, buffer + r, 1);
|
||||||
r += rc;
|
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) {
|
} else if (rc == 0) {
|
||||||
timeouts ++;
|
timeouts ++;
|
||||||
if (timeouts == 5) {
|
if (timeouts == 5) {
|
||||||
|
|
@ -292,7 +298,7 @@ void serial_print_info(board_t *board) {
|
||||||
|
|
||||||
printf(" [space 6] LBP16 control/status:\n");
|
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 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(" 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(" error flags: 0x%04X\n", stat_area.ErrorReg);
|
||||||
printf(" debug LED ptr: 0x%04X\n", stat_area.DebugLEDPtr);
|
printf(" debug LED ptr: 0x%04X\n", stat_area.DebugLEDPtr);
|
||||||
|
|
|
||||||
119
spi_boards.c
119
spi_boards.c
|
|
@ -35,12 +35,13 @@
|
||||||
#include "eeprom_local.h"
|
#include "eeprom_local.h"
|
||||||
#include "spi_boards.h"
|
#include "spi_boards.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
extern board_t boards[MAX_BOARDS];
|
extern board_t boards[MAX_BOARDS];
|
||||||
extern int boards_count;
|
extern int boards_count;
|
||||||
|
|
||||||
bool canDo32 = true;
|
static bool canDo32 = true;
|
||||||
|
|
||||||
int sd = -1;
|
static int sd = -1;
|
||||||
struct spi_ioc_transfer settings;
|
struct spi_ioc_transfer settings;
|
||||||
|
|
||||||
static int spidev_set_lsb_first(int fd, u8 lsb_first) {
|
static int spidev_set_lsb_first(int fd, u8 lsb_first) {
|
||||||
|
|
@ -86,7 +87,7 @@ static int spi_board_close(board_t *board) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int spi_boards_init(board_access_t *access) {
|
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;
|
settings.bits_per_word = 32;
|
||||||
|
|
||||||
sd = open(access->dev_addr, O_RDWR);
|
sd = open(access->dev_addr, O_RDWR);
|
||||||
|
|
@ -112,7 +113,7 @@ void spi_boards_cleanup(board_access_t *access) {
|
||||||
if(sd != -1) close(sd);
|
if(sd != -1) close(sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reorderBuffer(char *pBuf, int numInts)
|
void reorderBuffer(char *pBuf, int numInts)
|
||||||
{
|
{
|
||||||
int lcv;
|
int lcv;
|
||||||
for (lcv = 0; lcv < numInts; lcv++)
|
for (lcv = 0; lcv < numInts; lcv++)
|
||||||
|
|
@ -127,7 +128,7 @@ static void reorderBuffer(char *pBuf, int numInts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spi_read(llio_t *self, u32 addr, void *buffer, int size) {
|
int spi_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
if(size % 4 != 0) return -1;
|
if(size % 4 != 0) return -1;
|
||||||
int numInts = 1+size/4;
|
int numInts = 1+size/4;
|
||||||
u32 trxbuf[numInts];
|
u32 trxbuf[numInts];
|
||||||
|
|
@ -156,7 +157,7 @@ static int spi_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spi_write(llio_t *self, u32 addr, void *buffer, int size) {
|
int spi_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
if(size % 4 != 0) return -1;
|
if(size % 4 != 0) return -1;
|
||||||
int numInts = 1+size/4;
|
int numInts = 1+size/4;
|
||||||
u32 txbuf[numInts];
|
u32 txbuf[numInts];
|
||||||
|
|
@ -178,6 +179,52 @@ static int spi_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
return 0;
|
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) {
|
void spi_boards_scan(board_access_t *access) {
|
||||||
u32 buf[4];
|
u32 buf[4];
|
||||||
u32 cookie[] = {0x55aacafe, 0x54534f48, 0x32544f4d};
|
u32 cookie[] = {0x55aacafe, 0x54534f48, 0x32544f4d};
|
||||||
|
|
@ -189,7 +236,7 @@ void spi_boards_scan(board_access_t *access) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(memcmp(buf, cookie, sizeof(cookie))) {
|
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),
|
HM2_COOKIE_REG, HM2_COOKIE_REG + sizeof(buf),
|
||||||
buf[0], buf[1], buf[2]);
|
buf[0], buf[1], buf[2]);
|
||||||
return;
|
return;
|
||||||
|
|
@ -202,8 +249,9 @@ void spi_boards_scan(board_access_t *access) {
|
||||||
board_t *board = &boards[boards_count];
|
board_t *board = &boards[boards_count];
|
||||||
board->type = BOARD_SPI;
|
board->type = BOARD_SPI;
|
||||||
strcpy(board->dev_addr, access->dev_addr);
|
strcpy(board->dev_addr, access->dev_addr);
|
||||||
strncpy(board->llio.board_name, "7I90", 4);
|
strcpy(board->llio.board_name, "7I90");
|
||||||
board->llio.num_ioport_connectors = 24;
|
board->llio.num_ioport_connectors = 3;
|
||||||
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P1";
|
board->llio.ioport_connector_name[0] = "P1";
|
||||||
board->llio.ioport_connector_name[1] = "P2";
|
board->llio.ioport_connector_name[1] = "P2";
|
||||||
board->llio.ioport_connector_name[2] = "P3";
|
board->llio.ioport_connector_name[2] = "P3";
|
||||||
|
|
@ -213,6 +261,59 @@ void spi_boards_scan(board_access_t *access) {
|
||||||
board->llio.read = spi_read;
|
board->llio.read = spi_read;
|
||||||
board->llio.write_flash = local_write_flash;
|
board->llio.write_flash = local_write_flash;
|
||||||
board->llio.verify_flash = local_verify_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->llio.fpga_part_number = "6slx9tqg144";
|
||||||
board->open = spi_board_open;
|
board->open = spi_board_open;
|
||||||
board->close = spi_board_close;
|
board->close = spi_board_close;
|
||||||
|
|
|
||||||
|
|
@ -68,40 +68,40 @@ static void disable_sserial_pins(llio_t *llio) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sslbp_send_local_cmd(sserial_module_t *ssmod, int interface, u32 cmd) {
|
void sslbp_send_local_cmd(sserial_module_t *ssmod, int interface, u32 cmd) {
|
||||||
ssmod->board->llio.write(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_CMD + interface*0x40, &(cmd), sizeof(u32));
|
ssmod->board->llio.write(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_CMD + interface*0x40, &(cmd), sizeof(u32));
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sslbp_read_local_cmd(sserial_module_t *ssmod, int interface) {
|
u32 sslbp_read_local_cmd(sserial_module_t *ssmod, int interface) {
|
||||||
u32 data;
|
u32 data;
|
||||||
|
|
||||||
ssmod->board->llio.read(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_CMD + interface*0x40, &(data), sizeof(u32));
|
ssmod->board->llio.read(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_CMD + interface*0x40, &(data), sizeof(u32));
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sslbp_read_data(sserial_module_t *ssmod, int interface) {
|
u8 sslbp_read_data(sserial_module_t *ssmod, int interface) {
|
||||||
u32 data;
|
u32 data;
|
||||||
|
|
||||||
ssmod->board->llio.read(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_DATA + interface*0x40, &(data), sizeof(u32));
|
ssmod->board->llio.read(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_DATA + interface*0x40, &(data), sizeof(u32));
|
||||||
return data & 0xFF;
|
return data & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sslbp_wait_complete(sserial_module_t *ssmod, int interface) {
|
void sslbp_wait_complete(sserial_module_t *ssmod, int interface) {
|
||||||
while (sslbp_read_local_cmd(ssmod, interface) != 0) {}
|
while (sslbp_read_local_cmd(ssmod, interface) != 0) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sslbp_send_remote_cmd(sserial_module_t *ssmod, int interface, int channel, u32 cmd) {
|
void sslbp_send_remote_cmd(sserial_module_t *ssmod, int interface, int channel, u32 cmd) {
|
||||||
ssmod->board->llio.write(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_CS + interface*0x40 + channel*4, &(cmd), sizeof(u32));
|
ssmod->board->llio.write(&(ssmod->board->llio), ssmod->base_address + HM2_MOD_OFFS_SSERIAL_CS + interface*0x40 + channel*4, &(cmd), sizeof(u32));
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sslbp_read_local8(sserial_module_t *ssmod, int interface, u32 addr) {
|
u8 sslbp_read_local8(sserial_module_t *ssmod, int interface, u32 addr) {
|
||||||
|
|
||||||
sslbp_send_local_cmd(ssmod, interface, SSLBP_CMD_READ(addr));
|
sslbp_send_local_cmd(ssmod, interface, SSLBP_CMD_READ(addr));
|
||||||
sslbp_wait_complete(ssmod, interface);
|
sslbp_wait_complete(ssmod, interface);
|
||||||
return sslbp_read_data(ssmod, interface);
|
return sslbp_read_data(ssmod, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sslbp_read_local32(sserial_module_t *ssmod, int interface, u32 addr) {
|
u32 sslbp_read_local32(sserial_module_t *ssmod, int interface, u32 addr) {
|
||||||
int byte = 4;
|
int byte = 4;
|
||||||
u32 ret = 0;
|
u32 ret = 0;
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ static u32 sslbp_read_local32(sserial_module_t *ssmod, int interface, u32 addr)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sslbp_read_remote8(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
u8 sslbp_read_remote8(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
||||||
u32 data;
|
u32 data;
|
||||||
|
|
||||||
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_READ | LBP_ADDR_AUTO_INC) << 24) | addr);
|
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_READ | LBP_ADDR_AUTO_INC) << 24) | addr);
|
||||||
|
|
@ -120,7 +120,7 @@ static u8 sslbp_read_remote8(sserial_module_t *ssmod, int interface, int channel
|
||||||
return data & 0xFF;
|
return data & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sslbp_read_remote16(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
u16 sslbp_read_remote16(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
||||||
int byte;
|
int byte;
|
||||||
u16 ret = 0;
|
u16 ret = 0;
|
||||||
|
|
||||||
|
|
@ -129,7 +129,7 @@ static u16 sslbp_read_remote16(sserial_module_t *ssmod, int interface, int chann
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sslbp_read_remote32(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
u32 sslbp_read_remote32(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
||||||
int byte;
|
int byte;
|
||||||
u32 ret = 0;
|
u32 ret = 0;
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ static u32 sslbp_read_remote32(sserial_module_t *ssmod, int interface, int chann
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sslbp_write_remote8(sserial_module_t *ssmod, int interface, int channel, u32 addr, u8 data) {
|
void sslbp_write_remote8(sserial_module_t *ssmod, int interface, int channel, u32 addr, u8 data) {
|
||||||
u32 d = data;
|
u32 d = data;
|
||||||
|
|
||||||
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_WRITE | LBP_ARGS_8BIT | LBP_ADDR_AUTO_INC) << 24) | addr);
|
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_WRITE | LBP_ARGS_8BIT | LBP_ADDR_AUTO_INC) << 24) | addr);
|
||||||
|
|
@ -147,7 +147,7 @@ static void sslbp_write_remote8(sserial_module_t *ssmod, int interface, int chan
|
||||||
sslbp_wait_complete(ssmod, interface);
|
sslbp_wait_complete(ssmod, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sslbp_write_remote16(sserial_module_t *ssmod, int interface, int channel, u32 addr, u16 data) {
|
void sslbp_write_remote16(sserial_module_t *ssmod, int interface, int channel, u32 addr, u16 data) {
|
||||||
u32 d = data;
|
u32 d = data;
|
||||||
|
|
||||||
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_WRITE | LBP_ARGS_16BIT | LBP_ADDR_AUTO_INC) << 24) | addr);
|
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_WRITE | LBP_ARGS_16BIT | LBP_ADDR_AUTO_INC) << 24) | addr);
|
||||||
|
|
@ -156,7 +156,7 @@ static void sslbp_write_remote16(sserial_module_t *ssmod, int interface, int cha
|
||||||
sslbp_wait_complete(ssmod, interface);
|
sslbp_wait_complete(ssmod, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sslbp_write_remote32(sserial_module_t *ssmod, int interface, int channel, u32 addr, u32 data) {
|
void sslbp_write_remote32(sserial_module_t *ssmod, int interface, int channel, u32 addr, u32 data) {
|
||||||
u32 d = data;
|
u32 d = data;
|
||||||
|
|
||||||
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_WRITE | LBP_ARGS_32BIT | LBP_ADDR_AUTO_INC) << 24) | addr);
|
sslbp_send_remote_cmd(ssmod, interface, channel, ((LBP_CMD_WRITE | LBP_ARGS_32BIT | LBP_ADDR_AUTO_INC) << 24) | addr);
|
||||||
|
|
@ -165,7 +165,7 @@ static void sslbp_write_remote32(sserial_module_t *ssmod, int interface, int cha
|
||||||
sslbp_wait_complete(ssmod, interface);
|
sslbp_wait_complete(ssmod, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 sslbp_read_nv_remote16(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
u16 sslbp_read_nv_remote16(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
||||||
u16 data;
|
u16 data;
|
||||||
u32 cmd = LBP_CMD_READ_NV << 24;
|
u32 cmd = LBP_CMD_READ_NV << 24;
|
||||||
|
|
||||||
|
|
@ -185,7 +185,7 @@ static u16 sslbp_read_nv_remote16(sserial_module_t *ssmod, int interface, int ch
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sslbp_read_nv_remote32(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
u32 sslbp_read_nv_remote32(sserial_module_t *ssmod, int interface, int channel, u32 addr) {
|
||||||
u32 data;
|
u32 data;
|
||||||
u32 cmd = LBP_CMD_READ_NV << 24;
|
u32 cmd = LBP_CMD_READ_NV << 24;
|
||||||
|
|
||||||
|
|
@ -205,7 +205,7 @@ static u32 sslbp_read_nv_remote32(sserial_module_t *ssmod, int interface, int ch
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sslbp_read_remote_bytes(sserial_module_t *ssmod, int interface, int channel, u32 addr, void *buffer, int size) {
|
void sslbp_read_remote_bytes(sserial_module_t *ssmod, int interface, int channel, u32 addr, void *buffer, int size) {
|
||||||
char *ptr = (char *) buffer;
|
char *ptr = (char *) buffer;
|
||||||
|
|
||||||
while (size != 0) {
|
while (size != 0) {
|
||||||
|
|
@ -228,8 +228,8 @@ int sserial_init(sserial_module_t *ssmod, board_t *board, int interface_num, int
|
||||||
printf("No sserial module found.\n");
|
printf("No sserial module found.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (interface_num >= HM2_SSERIAL_MAX_INTEFACES) {
|
if (interface_num >= HM2_SSERIAL_MAX_INTERFACES) {
|
||||||
printf("sserial inteface number too high.\n");
|
printf("sserial interface number too high.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (channel_num >= HM2_SSERIAL_MAX_CHANNELS) {
|
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_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));
|
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) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
ssmod->device.unit = status;
|
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, &(sserial_md), sizeof(sserial_md_t));
|
||||||
sslbp_read_remote_bytes(ssmod, port, channel, d + sizeof(sserial_md_t), &(name), -1);
|
sslbp_read_remote_bytes(ssmod, port, channel, d + sizeof(sserial_md_t), &(name), -1);
|
||||||
if (sserial_md.mode_type == 0x01) {
|
if (sserial_md.mode_type == 0x01) {
|
||||||
llio->ss_device[channel].sw_modes[llio->ss_device[channel].sw_modes_cnt].index = sserial_md.mode_index;
|
sw_mode_t *sw_mode = &llio->ss_device[channel].sw_modes[llio->ss_device[channel].sw_modes_cnt];
|
||||||
strncpy(llio->ss_device[channel].sw_modes[llio->ss_device[channel].sw_modes_cnt].name, name, strlen(name));
|
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++;
|
llio->ss_device[channel].sw_modes_cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
usb_boards.c
14
usb_boards.c
|
|
@ -33,7 +33,7 @@ extern board_t boards[MAX_BOARDS];
|
||||||
extern int boards_count;
|
extern int boards_count;
|
||||||
static u8 file_buffer[SECTOR_SIZE];
|
static u8 file_buffer[SECTOR_SIZE];
|
||||||
|
|
||||||
static int usb_read(llio_t *self, u32 addr, void *buffer, int size) {
|
int usb_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
lbp_read(addr & 0xFFFF, buffer);
|
lbp_read(addr & 0xFFFF, buffer);
|
||||||
addr += 4;
|
addr += 4;
|
||||||
|
|
@ -43,7 +43,7 @@ static int usb_read(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usb_write(llio_t *self, u32 addr, void *buffer, int size) {
|
int usb_write(llio_t *self, u32 addr, void *buffer, int size) {
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
lbp_write(addr & 0xFFFF, buffer);
|
lbp_write(addr & 0xFFFF, buffer);
|
||||||
addr += 4;
|
addr += 4;
|
||||||
|
|
@ -57,7 +57,6 @@ static int usb_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
board_t *board = self->board;
|
board_t *board = self->board;
|
||||||
int bindex, bytesread;
|
int bindex, bytesread;
|
||||||
char part_name[32];
|
char part_name[32];
|
||||||
char board_name[32];
|
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
u8 cmd = '0';
|
u8 cmd = '0';
|
||||||
|
|
@ -71,13 +70,10 @@ static int usb_program_fpga(llio_t *self, char *bitfile_name) {
|
||||||
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_bitfile_header(fp, (char*) &part_name, (char*) &board_name, board->llio.verbose) == -1) {
|
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!check_board_name(self->board_name, board_name, bitfile_name)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Programming FPGA...\n");
|
printf("Programming FPGA...\n");
|
||||||
printf(" |");
|
printf(" |");
|
||||||
|
|
@ -148,7 +144,7 @@ void usb_boards_scan(board_access_t *access) {
|
||||||
board->type = BOARD_USB;
|
board->type = BOARD_USB;
|
||||||
board->mode = BOARD_MODE_FPGA;
|
board->mode = BOARD_MODE_FPGA;
|
||||||
strcpy(board->dev_addr, access->dev_addr);
|
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.num_ioport_connectors = 2;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P3";
|
board->llio.ioport_connector_name[0] = "P3";
|
||||||
|
|
@ -189,7 +185,7 @@ void usb_boards_scan(board_access_t *access) {
|
||||||
board->type = BOARD_USB;
|
board->type = BOARD_USB;
|
||||||
board->mode = BOARD_MODE_CPLD;
|
board->mode = BOARD_MODE_CPLD;
|
||||||
strcpy(board->dev_addr, access->dev_addr);
|
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.num_ioport_connectors = 2;
|
||||||
board->llio.pins_per_connector = 24;
|
board->llio.pins_per_connector = 24;
|
||||||
board->llio.ioport_connector_name[0] = "P3";
|
board->llio.ioport_connector_name[0] = "P3";
|
||||||
|
|
|
||||||
|
|
@ -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