Add fxload3 utility needed for QHY cameras
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
PROJECT(fx3load C)
|
||||
|
||||
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/usb/")
|
||||
############# FX3 Load ###############
|
||||
set(fx3load_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/main.c ${CMAKE_CURRENT_SOURCE_DIR}/ezusb.c)
|
||||
|
||||
add_executable(fxload ${fx3load_SRCS})
|
||||
|
||||
install(TARGETS fxload RUNTIME DESTINATION sbin)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/a3load.hex DESTINATION ${DATA_INSTALL_DIR})
|
||||
+340
@@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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) 19yy <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) 19yy 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 Library General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
FXLOAD UTILITY
|
||||
|
||||
This program is conveniently able to download firmware into FX, FX2,
|
||||
and FX2LP EZ-USB devices, as well as the original AnchorChips EZ-USB.
|
||||
It is intended to be invoked by hotplug scripts when the unprogrammed
|
||||
device appears on the bus.
|
||||
|
||||
Primarily as an aid for developers, this can also be used to update
|
||||
firmware on devices which boot from I2C serial EEPROMs. For that
|
||||
use, as well as downloading firmware to all other off-chip memory,
|
||||
a second stage loader must first be downloaded.
|
||||
|
||||
The distribution includes "a3load.hex", which is a simple second stage
|
||||
loader that works with all the EZ-USB products listed above. If you
|
||||
want to write to an EEPROM, you can use the appropriate version of the
|
||||
"Vend_Ax" code provided with the Cypress developer kit.
|
||||
|
||||
|
||||
UPDATES
|
||||
|
||||
See the download page at http://linux-hotplug.sourceforge.net for the
|
||||
latest release. The CVS repository there holds the most current version
|
||||
of this software. The web site shows some ways to use "fxload" in
|
||||
conjunction with USB hotplugging, to load device firmware.
|
||||
|
||||
Post any bug reports to the linux-hotplug-devel or linux-usb-devel lists.
|
||||
|
||||
If you modify the code, the GPL requires that you make your updates
|
||||
generally available (under most circumstances). Providing them in the
|
||||
form of patches against the current CVS ("cvs diff -u"), or the last
|
||||
release ("diff -u old new") is most useful, since otherwise it's awkward
|
||||
to integrate such changes into the standard distribution.
|
||||
|
||||
$Id: README.txt,v 1.5 2008/10/13 21:23:23 dbrownell Exp $
|
||||
@@ -0,0 +1,95 @@
|
||||
#
|
||||
# $Id: a3load.hex,v 1.1 2002/04/12 00:23:28 dbrownell Exp $
|
||||
#
|
||||
# This file contains "a3load" object code, as found in the Cypress
|
||||
# EZ-USB developer kit. It implements a second stage firmware loader
|
||||
# supporting the original EZ-USB parts and the newer FX and FX2 ones,
|
||||
# using the 0xA3 vendor request convention.
|
||||
#
|
||||
# If you want a loader for development use, which can write to the I2C
|
||||
# boot EEPROM using the 0xA2 request, see the "Vend_Ax" code provided
|
||||
# with the developer kit for your microcontroller.
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2001-2002 by Cypress Semiconductor Corporation
|
||||
#
|
||||
# Cypress Semiconductor Corporation hereby grants a copyright license to
|
||||
# use or redistribute this firmware image, in text or binary form as
|
||||
# required, only in conjunction with devices using a Cypress USB
|
||||
# microcontroller. Every copy in any form of the firmware shall include
|
||||
# Cypress copyright legends.
|
||||
#
|
||||
# DISCLAIMERS.
|
||||
# THIS FIRMWARE IS LICENSED "AS-IS." CYPRESS MAKES NO WARRANTIES AS TO
|
||||
# PERFORMANCE, WHETHER EXPRESS, IMPLIED, OR STATUTORY, IN THIS LICENSE
|
||||
# OR COMMUNICATION BETWEEN LICENSEE AND CYPRESS. CYPRESS SPECIFICALLY
|
||||
# DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
||||
# BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
# OF THIS PROGRAM FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE
|
||||
# FIRMWARE, AND THE USE, OPERATION OR SUPPORT OF THE FIRMWARE.
|
||||
# IN NO EVENT SHALL CYPRESS BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT,
|
||||
# INCIDENTAL, PUNITIVE, OR SPECIAL DAMAGES WHATSOEVER, INCLUDING WITHOUT
|
||||
# LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS
|
||||
# INTERRUPTION, LOSS OF BUSINESS INFORMATION, AND THE LIKE, ARISING OUT
|
||||
# OF OR RELATED TO THE FIRMWARE, EVEN IF CYPRESS HAS BEEN ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGES.
|
||||
#
|
||||
:1003570090E668E0FF74FFF0E0B40B04EFF0D322FF
|
||||
:0603670090E668EFF0C310
|
||||
:01036D00226D
|
||||
:1001B500907FE9E064A360030202C5A3E07508002F
|
||||
:1001C500F509A3E0FEE4EE4208907FEEE0750A0033
|
||||
:1001D500F50BA3E0FEE4EE420A907FE8E064407090
|
||||
:1001E50064E50B450A70030202D6E4907FC5F090E2
|
||||
:1001F5007FB4E020E3F9907FC5E0750C00F50DE4D0
|
||||
:10020500FCFDC3ED950DEC950C501F74C02DF582CA
|
||||
:10021500E4347EF583E0FFE5092DF582E5083CF53C
|
||||
:1002250083EFF00DBD00010C80D8E50D2509F5091A
|
||||
:10023500E50C3508F508C3E50B950DF50BE50A95B5
|
||||
:100245000CF50A809C907FE8E064C060030202D64A
|
||||
:10025500E50B450A607BC3E50B9440E50A94005025
|
||||
:1002650008850A0C850B0D8006750C00750D40E49C
|
||||
:10027500FCFDC3ED950DEC950C501FE5092DF582A0
|
||||
:10028500E5083CF583E0FF74002DF582E4347FF545
|
||||
:1002950083EFF00DBD00010C80D8907FB5E50DF022
|
||||
:1002A5002509F509E50C3508F508C3E50B950DF5A8
|
||||
:1002B5000BE50A950CF50A907FB4E030E29280F7E1
|
||||
:1002C500907FE9E0B4AC0AE4907F00F0907FB5043C
|
||||
:0802D500F0907FB4E04402F058
|
||||
:0102DD0022FE
|
||||
:1000800090E6B9E064A36003020198A3E07508005C
|
||||
:10009000F509A3E0FEE4EE420890E6BEE0750A0032
|
||||
:1000A000F50BA3E0FEE4EE420A90E6B8E06440708F
|
||||
:1000B00066E50B450A70030201ADE490E68AF0A301
|
||||
:1000C000F090E6A0E020E1F990E68BE0750C00F5F9
|
||||
:1000D0000DE4FCFDC3ED950DEC950C501F74402D07
|
||||
:1000E000F582E434E7F583E0FFE5092DF582E508C4
|
||||
:1000F0003CF583EFF00DBD00010C80D8E50D25091E
|
||||
:10010000F509E50C3508F508C3E50B950DF50BE58C
|
||||
:100110000A950CF50A809A90E6B8E064C060030284
|
||||
:1001200001ADE50B450A70030201ADC3E50B944038
|
||||
:10013000E50A94005008850A0C850B0D8006750CA5
|
||||
:1001400000750D40E4FCFDC3ED950DEC950C501FC2
|
||||
:10015000E5092DF582E5083CF583E0FF74402DF5B7
|
||||
:1001600082E434E7F583EFF00DBD00010C80D8E4A4
|
||||
:1001700090E68AF0A3E50DF02509F509E50C3508B0
|
||||
:10018000F508C3E50B950DF50BE50A950CF50A90FE
|
||||
:10019000E6A0E030E18C80F790E6B9E0B4AC0E90D8
|
||||
:1001A000E7407401F0E490E68AF0A304F090E6A042
|
||||
:0401B000E04480F0B7
|
||||
:0101B4002228
|
||||
:1002DE00C2011203579200907F95E044C0F0D2E81D
|
||||
:1002EE0030000890E6687408F08007907FAFE04415
|
||||
:1002FE0001F030000890E65C7401F08006907FAE4D
|
||||
:10030E007401F0D2AF3001FD300005120080800381
|
||||
:07031E001201B5C20180EEDF
|
||||
:03000300020325D0
|
||||
:10032500C0E0C083C082C085C084C086758600D207
|
||||
:10033500015391EF30000890E65D7401F08006905E
|
||||
:100345007FAB7401F0D086D084D085D082D083D0A5
|
||||
:02035500E03294
|
||||
:03004300020400B4
|
||||
:0404000002032500CE
|
||||
:0300000002036E8A
|
||||
:0C036E00787FE4F6D8FD7581200202DEE5
|
||||
:00000001FF
|
||||
@@ -0,0 +1,5 @@
|
||||
fxload (1.0) bionic; urgency=medium
|
||||
|
||||
* FX3 release.
|
||||
|
||||
-- Jasem Mutlaq <mutlaqja@ikarustech.com> Thu, 07 Jul 2022 20:00:00 +0300
|
||||
@@ -0,0 +1 @@
|
||||
10
|
||||
@@ -0,0 +1,19 @@
|
||||
Source: fxload
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
|
||||
XSBC-Original-Maintainer: Jasem Mutlaq <mutlaqja@ikarustech.com>
|
||||
Build-Depends: debhelper (>= 7), cdbs, cmake
|
||||
Standards-Version: 3.8.4
|
||||
|
||||
Package: fxload
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Conflicts: hotplug-utils
|
||||
Replaces: hotplug-utils
|
||||
Provides: hotplug-utils
|
||||
Enhances: hotplug
|
||||
Description: Firmware download to EZ-USB devices
|
||||
This program is conveniently able to download firmware into FX and FX2
|
||||
ez-usb devices. It is intended to be invoked by hotplug scripts when
|
||||
the unprogrammed device appears on the bus.
|
||||
@@ -0,0 +1,40 @@
|
||||
This package was debianized by Fumitoshi UKAI <ukai@debian.or.jp> on
|
||||
Tue, 30 Apr 2002 02:46:12 +0900.
|
||||
|
||||
It was downloaded from http://linux-hotplug.sourceforge.net/
|
||||
|
||||
Upstream Authors:
|
||||
Stephen Williams <steve@icarus.com>
|
||||
David Brownell <dbrownell@users.sourceforge.net>
|
||||
Roger Williams <rawqux@users.sourceforge.net>
|
||||
|
||||
Greg Kroah-Hartman
|
||||
Matthew Dharm
|
||||
Miles Lane
|
||||
Randy Dunlap
|
||||
|
||||
Copyright:
|
||||
Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
Copyright (c) 2001-2002 David Brownell (dbrownell@users.sourceforge.net)
|
||||
Copyright (c) 2008 Roger Williams (rawqux@users.sourceforge.net)
|
||||
|
||||
License: GPL2+
|
||||
|
||||
This source code is free software; you can redistribute it
|
||||
and/or modify it in source code form under the terms of the GNU
|
||||
General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
On Debian systems, a copy of the GNU General Public License may be found in
|
||||
/usr/share/common-licenses/GPL.
|
||||
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
||||
include /usr/share/cdbs/1/class/cmake.mk
|
||||
|
||||
DEB_DH_SHLIBDEPS_ARGS=-u--ignore-missing-info
|
||||
@@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
+1039
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
||||
#ifndef __ezusb_H
|
||||
#define __ezusb_H
|
||||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2002 David Brownell (dbrownell@users.sourceforge.net)
|
||||
* Copyright (c) 2012 Steve Magnani (steve@digidescorp.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ident "$Id: ezusb.h,v 1.4 2008/10/13 21:25:29 dbrownell Exp $"
|
||||
|
||||
|
||||
/*
|
||||
* This function loads the firmware from the given file into RAM.
|
||||
* The file is assumed to be in Intel HEX format unless type is fx3.
|
||||
* If type is fx2 or fx2lp, appropriate reset commands are used.
|
||||
* Stage == 0 means this is a single stage load (or the first of two stages).
|
||||
* Otherwise it's the second of two stages; the caller preloaded the second
|
||||
* stage loader.
|
||||
*
|
||||
* The target processor is reset at the end of this download.
|
||||
*/
|
||||
extern int ezusb_load_ram (int dev, const char *path, const char *type,
|
||||
int stage);
|
||||
|
||||
|
||||
/*
|
||||
* This function stores the firmware from the given file into EEPROM.
|
||||
* The file is assumed to be in Intel HEX format. This uses the right
|
||||
* CPUCS address to terminate the EEPROM load with a reset command,
|
||||
* where FX parts behave differently than FX2 ones. The configuration
|
||||
* byte is as provided here (zero for an21xx parts) and the EEPROM
|
||||
* type is set so that the microcontroller will boot from it.
|
||||
*
|
||||
* The caller must have preloaded a second stage loader that knows
|
||||
* how to respond to the EEPROM write request.
|
||||
*/
|
||||
extern int ezusb_load_eeprom (
|
||||
int dev, /* usbfs device handle */
|
||||
const char *path, /* path to hexfile */
|
||||
const char *type, /* fx, fx2, an21 */
|
||||
int config /* config byte for fx/fx2; else zero */
|
||||
);
|
||||
|
||||
|
||||
/* boolean flag, says whether to write extra messages to stderr */
|
||||
extern int verbose;
|
||||
|
||||
|
||||
/*
|
||||
* $Log: ezusb.h,v $
|
||||
* Revision 1.4 2008/10/13 21:25:29 dbrownell
|
||||
* Whitespace fixes.
|
||||
*
|
||||
* Revision 1.3 2002/04/12 00:28:21 dbrownell
|
||||
* support "-t an21" to program EEPROMs for those microcontrollers
|
||||
*
|
||||
* Revision 1.2 2002/02/26 19:55:05 dbrownell
|
||||
* 2nd stage loader support
|
||||
*
|
||||
* Revision 1.1 2001/06/12 00:00:50 stevewilliams
|
||||
* Added the fxload program.
|
||||
* Rework root makefile and hotplug.spec to install in prefix
|
||||
* location without need of spec file for install.
|
||||
*
|
||||
*/
|
||||
#endif
|
||||
Binary file not shown.
+249
@@ -0,0 +1,249 @@
|
||||
.\" fxload.8
|
||||
.\" Created: Fri Dec 28 2001 by David Brownell
|
||||
.\" Copyright (c) 2001-2002 David Brownell <dbrownell@users.sourceforge.net>
|
||||
.\" Copyright (c) 2008 Roger Williams <rawqux@users.sourceforge.net>
|
||||
.\"
|
||||
.\" Permission is granted to make and distribute verbatim copies of this
|
||||
.\" manual provided the copyright notice and this permission notice are
|
||||
.\" preserved on all copies.
|
||||
.\"
|
||||
.\" Permission is granted to copy and distribute modified versions of this
|
||||
.\" manual under the conditions for verbatim copying, provided that the
|
||||
.\" entire resulting derived work is distributed under the terms of a
|
||||
.\" permission notice identical to this one
|
||||
.\"
|
||||
.\" Since the Linux kernel and libraries are constantly changing, this
|
||||
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
||||
.\" responsibility for errors or omissions, or for damages resulting from
|
||||
.\" the use of the information contained herein. The author(s) may not
|
||||
.\" have taken the same level of care in the production of this manual,
|
||||
.\" which is licensed free of charge, as they might when working
|
||||
.\" professionally.
|
||||
.\"
|
||||
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||
.\" the source, must acknowledge the copyright and authors of this work.
|
||||
.\"
|
||||
.TH FXLOAD 8 "April 2012" "" "Linux Programmer's Manual"
|
||||
.SH "NAME"
|
||||
fxload \- Firmware download to EZ-USB devices
|
||||
.SH "SYNOPSIS"
|
||||
.B fxload
|
||||
.BI "[ \-v ]"
|
||||
.BI "[ \-l ]"
|
||||
.BI "[ \-D " devpath " ]"
|
||||
.BI "[ \-I " firmware " ]"
|
||||
.BI "[ \-t " type " ]"
|
||||
.BI "[ \-c " config " ]"
|
||||
.BI "[ \-s " loader " ]"
|
||||
.br
|
||||
.B fxload
|
||||
.BI "[ \-D " devpath " ]"
|
||||
.BI "[ \-L " link " ]"
|
||||
.BI "[ \-m " mode " ]"
|
||||
.br
|
||||
.B fxload
|
||||
.BI "[ \-V ]"
|
||||
.SH "DESCRIPTION"
|
||||
.B fxload
|
||||
is a program which downloads firmware to USB devices based on
|
||||
AnchorChips EZ-USB, Cypress EZ-USB FX,
|
||||
or Cypress EZ-USB FX2/FX2LP/FX3 microcontrollers.
|
||||
These have 8-bit 8051 cores with special extensions for USB I/O.
|
||||
The FX2 supports high speed USB 2.0 transfers (480 Mbit/sec)
|
||||
as well as full speed USB 1.1 transfers (12 Mbit/sec),
|
||||
while the earlier parts support only full speed transfers.
|
||||
The FX3 supports super speed USB 3.0 transfers and has a 32-bit
|
||||
ARM core.
|
||||
These controllers have several package options,
|
||||
and can be set up with external memory (on-chip memory is
|
||||
usually 8K or 16K; for FX3, it is 512K), EEPROMs, and ROMs when
|
||||
device costs allow.
|
||||
.PP
|
||||
This uses "usbfs" (older name: "usbdevfs") to access
|
||||
devices, and issues vendor specific control requests
|
||||
to download and reset the EZ-USB devices.
|
||||
Normally, firmware will then "renumerate" by disconnecting from
|
||||
USB and then reconnecting as a new device.
|
||||
It then appears with new device descriptors and functionality,
|
||||
as provided by the firmware which has been downloaded.
|
||||
.PP
|
||||
To support some non-firmware applications, this can also set
|
||||
up symbolic links for those usbfs names.
|
||||
It can also change their access modes.
|
||||
Both of these can help simplify software applications that
|
||||
need to talk to USB devices using user mode drivers,
|
||||
don't want to run with privileges or to examine all of the
|
||||
existing USB devices,
|
||||
and which don't need more kernel drivers.
|
||||
.PP
|
||||
See the
|
||||
.I Linux-Hotplug
|
||||
web site for information about how to use
|
||||
.B fxload
|
||||
to download device firmware when hotplugging USB devices,
|
||||
using driver-specific scripts stored in the
|
||||
.I /etc/hotplug/usb
|
||||
directory.
|
||||
.SH "FUNCTION LETTERS"
|
||||
At least one of the following options must be specified.
|
||||
Note that as usual with UNIX and Linux commands,
|
||||
the order of command option flags does not matter.
|
||||
You may use these in any order.
|
||||
.TP
|
||||
.BI "\-I " firmware
|
||||
Downloads the specified firmware file.
|
||||
For FX3 devices, the format is a Cypress-specific binary image.
|
||||
For other devices, the file has standard Intel hexfile format.
|
||||
(Common naming conventions include
|
||||
.I *.hex
|
||||
,
|
||||
.I *.ihx
|
||||
, and
|
||||
.IR *.img ).
|
||||
Depending on the device and firmware in use, the
|
||||
.B \-s
|
||||
option may also be necessary to specify a second stage loader.
|
||||
Firmware is normally downloaded to RAM and executed, but there
|
||||
is also an option for downloading into bootable I2C EEPROMs.
|
||||
.TP
|
||||
.BI "\-L " link
|
||||
Creates the specified symbolic link to the usbfs device path.
|
||||
This would typically be used to create a name in a directory
|
||||
that would be searched by an application.
|
||||
The symlink would be removed by some other component on device unplug.
|
||||
.TP
|
||||
.BI "\-m " mode
|
||||
Changes permissions on the "usbfs" device node.
|
||||
By default, those nodes are only accessible by privileged
|
||||
users, which doesn't help when the user mode device driver
|
||||
needs to run without root privileges.
|
||||
Note that usbfs mount options like
|
||||
.I devmode=0666
|
||||
are also available.
|
||||
.TP
|
||||
.B "\-V"
|
||||
Identifies the version of fxload being invoked, and exits
|
||||
without performing other actions.
|
||||
.PP
|
||||
Note that when downloading firmware that renumerates,
|
||||
there's no point in changing the device permissions
|
||||
or creating a symbolic link.
|
||||
.SH "OPTIONS"
|
||||
By default,
|
||||
.B fxload
|
||||
assumes the device uses an EZ-USB or EZ-USB FX.
|
||||
It also assumes that the device in question has been specified
|
||||
by USB kernel hotplugging conventions, using the
|
||||
.I DEVICE
|
||||
environment variable to name a "usbfs"
|
||||
file that can be used to talk to the device.
|
||||
.TP
|
||||
.BI "\-c " config
|
||||
Indicates the specified firmware should be downloaded to an
|
||||
I2C boot EEPROM rather than to RAM.
|
||||
The parameter is the EZ-USB FX or FX2 configuration byte,
|
||||
and for AnchorChips devices the value should be zero.
|
||||
This requires a second stage loader (e.g. vend_ax.hex) that knows
|
||||
how to write to I2C EEPROMs specified using the
|
||||
.B \-s
|
||||
option, as well as a device that's provided with an EEPROM
|
||||
large enough to store the boot firmware.
|
||||
After downloading to a device's EEPROM,
|
||||
you should retest it starting from power off.
|
||||
.TP
|
||||
.BI "\-s " loader
|
||||
This identifies the file holding a second stage loader
|
||||
(in the same file format as the firmware itself),
|
||||
which is loaded into internal memory.
|
||||
This loader understands additional vendor control requests,
|
||||
beyond the one built into all EZ-USB hardware,
|
||||
which are needed to write external RAM or EEPROM.
|
||||
As a last step when loading firmware,
|
||||
.B fxload
|
||||
normally overwrites this second stage loader
|
||||
with parts of the firmware residing on-chip.
|
||||
.TP
|
||||
.BI "\-t " type
|
||||
Indicates which type of microcontroller is used in the device;
|
||||
type may be one of
|
||||
.I an21
|
||||
(the original AnchorChips devices),
|
||||
.I fx
|
||||
(Cypress' updated version, the EZ-USB FX),
|
||||
.I fx2
|
||||
(the Cypress EZ-USB FX2, supporting high speed transfers),
|
||||
.I fx2lp
|
||||
(the Cypress EZ-USB FX2LP, with 16KB internal RAM), or
|
||||
.I fx3
|
||||
(the Cypress EZ-USB FX3, supporting USB 3.0).
|
||||
Except when writing to EEPROM, all that normally matters when
|
||||
downloading firmware is whether or not the device uses an FX2
|
||||
or FX3.
|
||||
.TP
|
||||
.B "\-v"
|
||||
Prints some diagnostics, such as download addresses and sizes,
|
||||
to standard error. Repeat the flag
|
||||
.RB ( -vv ", " -vvv )
|
||||
to get more diagnostics.
|
||||
.TP
|
||||
.B "\-l"
|
||||
print error and verbose messages to syslog.
|
||||
.TP
|
||||
.BI "\-D " devpath
|
||||
Specifies the "usbfs" path name for the device in question,
|
||||
such as
|
||||
.IR /proc/bus/usb/004/080 .
|
||||
This takes precedence over any
|
||||
.I DEVICE
|
||||
environment variable that may be set.
|
||||
.SH "NOTES"
|
||||
.PP
|
||||
This program implements one extension to the standard "hex file" format.
|
||||
Lines beginning with a "#" character are ignored, and may be used to
|
||||
hold copyright statements and other information.
|
||||
Other tools may not handle hexfiles using this extension.
|
||||
.PP
|
||||
At this writing, "usbfs" is a kernel configuration option.
|
||||
That means that device drivers relying on user mode firmware
|
||||
downloading may need to depend on that kernel configuration option.
|
||||
A less preferable alternative involves compiling the firmware
|
||||
into the kernel and managing downloads and renumeration there.
|
||||
This is less preferable in part because much device firmware is
|
||||
provided with GPL-incompatible licensing, and in part because
|
||||
storing such firmware firmware wastes kernel memory.
|
||||
.PP
|
||||
For EZ-USB family devices, the hardware's first stage loader
|
||||
(supporting the 0xA0 vendor request) can't write into external memory.
|
||||
Configurations that put firmware into external memory thus need a
|
||||
second stage loader.
|
||||
For typical "flat" memory architectures, a loader supporting the 0xA3
|
||||
vendor request is used to write into that memory.
|
||||
Similarly, a second stage loader that supports the 0xA2 vendor request
|
||||
is needed when writing boot firmware into an I2C EEPROM.
|
||||
These 0xA2 and 0xA3 vendor commands are conventions defined by Cypress.
|
||||
Devices that use bank switching or similar mechanisms to stretch the
|
||||
64KByte address space may need different approaches to loading firmware.
|
||||
.PP
|
||||
Not all devices support EEPROM updates.
|
||||
Some EZ-USB based devices don't have an I2C EEPROM;
|
||||
many such EEPROMs are too small to store firmware;
|
||||
and some firmware can't be placed in bootable I2C EEPROMs.
|
||||
.SH "ENVIRONMENT VARIABLES"
|
||||
.TP
|
||||
.B DEVICE
|
||||
normally names a "usbfs" file that will be used to talk to the device.
|
||||
This is provided by the Linux kernel as part of USB hotplugging.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I /usr/share/usb/a3load.hex
|
||||
Second stage loader that works with AnchorChips EZ-USB,
|
||||
Cypress EZ-USB FX, and Cypress EZ-USB FX2.
|
||||
Note that this only supports the 0xA3 vendor command, to
|
||||
write external memory.
|
||||
A loader that also supports the 0xA2 command, to write boot EEPROMs,
|
||||
is included with Cypress developer kits.
|
||||
.SH "SEE ALSO"
|
||||
.BR hotplug "(8) "
|
||||
.SH "AUTHORS"
|
||||
Linux Hotplugging Project
|
||||
.I http://linux-hotplug.sourceforge.net/
|
||||
@@ -0,0 +1,87 @@
|
||||
Summary: EZ-USB utility program
|
||||
Name: fxload
|
||||
Version: VERCODE
|
||||
Release: 1
|
||||
Group: Applications/System
|
||||
License: GPL
|
||||
Url: http://linux-hotplug.sourceforge.net/
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
%description
|
||||
This package contains utilities for downloading firmware to EZ-USB devices.
|
||||
EZ-USB devices use 8051-based microcontrollers that have been enhanced with
|
||||
registers, buffers, and other device-side support for USB transactions.
|
||||
|
||||
It currently supports devices based on the Anchorchips EZ-USB, as well as the
|
||||
Cypress EZ-USB FX (which is almost completely source compatible) and EZ-USB FX2
|
||||
(which is not). All of these support full speed (12 Mbit/sec) transfers. The
|
||||
FX2 also supports high speed (480 Mbit/s) transfers, introduced in USB 2.0.
|
||||
|
||||
This version of FXLOAD supports optional use of two-stage loading, where
|
||||
special device firmware is used to support writing into off-chip memory such
|
||||
as RAM (when firmware neeeds more than about 8 KBytes of code and data) or,
|
||||
for firmware development, I2C serial EEPROM.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
# Build any compiled programs in the source tree.
|
||||
make all CFLAGS="%optflags -DFXLOAD_VERSION=\\\"%version\\\""
|
||||
|
||||
%install
|
||||
make prefix=%buildroot install
|
||||
|
||||
# --
|
||||
# The utils package contains utility programs that certain devices
|
||||
# might need along with the core hotplug in order to boot up the
|
||||
# device in question.
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
/sbin/fxload
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Apr 01 2002 David Brownell <dbrownell@users.sourceforge.net>
|
||||
- fixed/updated RPM build and Makefile
|
||||
- Makefile automatically embeds version into specfile and binary
|
||||
- fxload handles 2nd stage loader
|
||||
|
||||
* Mon Jan 21 2002 David Brownell <dbrownell@users.sourceforge.net>
|
||||
- update fxload rpm description. also, manpage now installs.
|
||||
|
||||
* Mon Jan 14 2002 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- split fxload specific stuff out of the base hotplug.spec file
|
||||
to keep the hotplug core arch independant
|
||||
|
||||
* Mon Jun 11 2001 Steve Williams <steve@icarus.com>
|
||||
- The install process is now in the comon makefile, so that non-
|
||||
rpm installs can work. This spec file thus invokes that install.
|
||||
|
||||
* Fri Jun 8 2001 Steve Williams <steve@icarus.com>
|
||||
- added the /var/run/usb directory to spec file
|
||||
|
||||
* Tue Apr 24 2001 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- added the hotplug.8 manpage written by Fumitoshi UKAI <ukai@debian.or.jp>
|
||||
|
||||
* Fri Mar 2 2001 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- tweaked the post and preun sections to fix problem of hotplug
|
||||
not starting automatically when the package is upgraded.
|
||||
|
||||
* Wed Feb 28 2001 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- 2001_02_28 release
|
||||
|
||||
* Wed Feb 14 2001 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- 2001_02_14 release
|
||||
|
||||
* Wed Jan 17 2001 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- changed specfile based on Chmouel Boudjnah's <chmouel@mandrakesoft.com> comments.
|
||||
|
||||
* Tue Jan 16 2001 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- tweaked the file locations due to the change in the tarball structure.
|
||||
- 2001_01_16 release
|
||||
|
||||
* Mon Jan 15 2001 Greg Kroah-Hartman <greg@kroah.com>
|
||||
- First cut at a spec file for the hotplug scripts.
|
||||
- added patch to usb.rc to allow chkconfig to install and remove it.
|
||||
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2002 David Brownell (dbrownell@users.sourceforge.net)
|
||||
* Copyright (c) 2008 Roger Williams (rawqux@users.sourceforge.net)
|
||||
* Copyright (c) 2012 Steve Magnani (steve@digidescorp.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ident "$Id: main.c,v 1.10 2008/10/13 21:25:29 dbrownell Exp $"
|
||||
|
||||
/*
|
||||
* This program supports loading firmware into a target USB device
|
||||
* that is discovered and referenced by the hotplug usb agent. It can
|
||||
* also do other useful things, like set the permissions of the device
|
||||
* and create a symbolic link for the benefit of applications that are
|
||||
* looking for the device.
|
||||
*
|
||||
* -I <path> -- Download this firmware (intel hex)
|
||||
* -t <type> -- uController type: an21, fx, fx2, fx2lp, fx3
|
||||
* -s <path> -- use this second stage loader
|
||||
* -c <byte> -- Download to EEPROM, with this config byte
|
||||
*
|
||||
* -L <path> -- Create a symbolic link to the device.
|
||||
* -m <mode> -- Set the permissions on the device after download.
|
||||
* -D <path> -- Use this device, instead of $DEVICE
|
||||
*
|
||||
* -V -- Print version ID for program
|
||||
*
|
||||
* This program is intended to be started by hotplug scripts in
|
||||
* response to a device appearing on the bus. It therefore also
|
||||
* expects these environment variables which are passed by hotplug to
|
||||
* its sub-scripts:
|
||||
*
|
||||
* DEVICE=<path>
|
||||
* This is the path to the device is /proc/bus/usb. It is the
|
||||
* complete path to the device, that I can pass to open and
|
||||
* manipulate as a USB device.
|
||||
*/
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
# include <getopt.h>
|
||||
# include <string.h>
|
||||
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# include <fcntl.h>
|
||||
# include <unistd.h>
|
||||
|
||||
# include "ezusb.h"
|
||||
|
||||
#ifndef FXLOAD_VERSION
|
||||
# define FXLOAD_VERSION (__DATE__ " (development)")
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
static int dosyslog=0;
|
||||
|
||||
void logerror(const char *format, ...)
|
||||
__attribute__ ((format (__printf__, 1, 2)));
|
||||
|
||||
void logerror(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
if(dosyslog)
|
||||
vsyslog(LOG_ERR, format, ap);
|
||||
else
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
int main(int argc, char*argv[])
|
||||
{
|
||||
const char *link_path = 0;
|
||||
const char *ihex_path = 0;
|
||||
const char *device_path = getenv("DEVICE");
|
||||
const char *type = 0;
|
||||
const char *stage1 = 0;
|
||||
mode_t mode = 0;
|
||||
int opt;
|
||||
int config = -1;
|
||||
|
||||
while ((opt = getopt (argc, argv, "2vV?D:I:L:c:lm:s:t:")) != EOF)
|
||||
switch (opt) {
|
||||
|
||||
case '2': // original version of "-t fx2"
|
||||
type = "fx2";
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
device_path = optarg;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
ihex_path = optarg;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
link_path = optarg;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
puts (FXLOAD_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'c':
|
||||
config = strtoul (optarg, 0, 0);
|
||||
if (config < 0 || config > 255) {
|
||||
logerror("illegal config byte: %s\n", optarg);
|
||||
goto usage;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
openlog(argv[0], LOG_CONS|LOG_NOWAIT|LOG_PERROR, LOG_USER);
|
||||
dosyslog=1;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
mode = strtoul(optarg,0,0);
|
||||
mode &= 0777;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
stage1 = optarg;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
if (strcmp (optarg, "an21") // original AnchorChips parts
|
||||
&& strcmp (optarg, "fx") // updated Cypress versions
|
||||
&& strcmp (optarg, "fx2") // Cypress USB 2.0 versions
|
||||
&& strcmp (optarg, "fx2lp") // updated FX2
|
||||
&& strcmp (optarg, "fx3") // Cypress USB 3.0 versions
|
||||
) {
|
||||
logerror("illegal microcontroller type: %s\n", optarg);
|
||||
goto usage;
|
||||
}
|
||||
type = optarg;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
goto usage;
|
||||
|
||||
}
|
||||
|
||||
if (config >= 0) {
|
||||
if (type == 0) {
|
||||
logerror("must specify microcontroller type %s",
|
||||
"to write EEPROM!\n");
|
||||
goto usage;
|
||||
}
|
||||
if (!stage1 || !ihex_path) {
|
||||
logerror("need 2nd stage loader and firmware %s",
|
||||
"to write EEPROM!\n");
|
||||
goto usage;
|
||||
}
|
||||
if (link_path || mode) {
|
||||
logerror("links and modes not set up when writing EEPROM\n");
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!device_path) {
|
||||
logerror("no device specified!\n");
|
||||
usage:
|
||||
fputs ("usage: ", stderr);
|
||||
fputs (argv [0], stderr);
|
||||
fputs (" [-vV] [-l] [-t type] [-D devpath]\n", stderr);
|
||||
fputs ("\t\t[-I firmware_hexfile] ", stderr);
|
||||
fputs ("[-s loader] [-c config_byte]\n", stderr);
|
||||
fputs ("\t\t[-L link] [-m mode]\n", stderr);
|
||||
fputs ("... [-D devpath] overrides DEVICE= in env\n", stderr);
|
||||
fputs ("... device types: one of an21, fx, fx2, fx2lp, fx3\n", stderr);
|
||||
fputs ("... at least one of -I, -L, -m is required\n", stderr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ihex_path) {
|
||||
int fd = open(device_path, O_RDWR);
|
||||
int status;
|
||||
|
||||
if (fd == -1) {
|
||||
logerror("%s : %s\n", strerror(errno), device_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type == 0) {
|
||||
type = "fx"; /* an21-compatible for most purposes */
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
logerror("microcontroller type: %s\n", type);
|
||||
|
||||
if (stage1) {
|
||||
/* first stage: put loader into internal memory */
|
||||
if (verbose)
|
||||
logerror("1st stage: load 2nd stage loader\n");
|
||||
status = ezusb_load_ram (fd, stage1, type, 0);
|
||||
if (status != 0)
|
||||
return status;
|
||||
|
||||
/* second stage ... write either EEPROM, or RAM. */
|
||||
if (config >= 0)
|
||||
status = ezusb_load_eeprom (fd, ihex_path, type, config);
|
||||
else
|
||||
status = ezusb_load_ram (fd, ihex_path, type, 1);
|
||||
if (status != 0)
|
||||
return status;
|
||||
} else {
|
||||
/* single stage, put into internal memory */
|
||||
if (verbose)
|
||||
logerror("single stage: load on-chip memory\n");
|
||||
status = ezusb_load_ram (fd, ihex_path, type, 0);
|
||||
if (status != 0)
|
||||
return status;
|
||||
}
|
||||
|
||||
/* some firmware won't renumerate, but typically it will.
|
||||
* link and chmod only make sense without renumeration...
|
||||
*/
|
||||
}
|
||||
|
||||
if (link_path) {
|
||||
int rc = unlink(link_path);
|
||||
rc = symlink(device_path, link_path);
|
||||
if (rc == -1) {
|
||||
logerror("%s : %s\n", strerror(errno), link_path);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode != 0) {
|
||||
int rc = chmod(device_path, mode);
|
||||
if (rc == -1) {
|
||||
logerror("%s : %s\n", strerror(errno), link_path);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ihex_path && !link_path && !mode) {
|
||||
logerror("missing request! (firmware, link, or mode)\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: main.c,v $
|
||||
* Revision 1.10 2008/10/13 21:25:29 dbrownell
|
||||
* Whitespace fixes.
|
||||
*
|
||||
* Revision 1.9 2008/10/13 21:23:23 dbrownell
|
||||
* From Roger Williams <roger@qux.com>: FX2LP support
|
||||
*
|
||||
* Revision 1.8 2005/01/11 03:58:02 dbrownell
|
||||
* From Dirk Jagdmann <doj@cubic.org>: optionally output messages to
|
||||
* syslog instead of stderr.
|
||||
*
|
||||
* Revision 1.7 2002/04/12 00:28:22 dbrownell
|
||||
* support "-t an21" to program EEPROMs for those microcontrollers
|
||||
*
|
||||
* Revision 1.6 2002/04/02 05:26:15 dbrownell
|
||||
* version display now noiseless (-V);
|
||||
* '-?' (usage info) convention now explicit
|
||||
*
|
||||
* Revision 1.5 2002/02/26 20:10:28 dbrownell
|
||||
* - "-s loader" option for 2nd stage loader
|
||||
* - "-c byte" option to write EEPROM with 2nd stage
|
||||
* - "-V" option to dump version code
|
||||
*
|
||||
* Revision 1.4 2002/01/17 14:19:28 dbrownell
|
||||
* fix warnings
|
||||
*
|
||||
* Revision 1.3 2001/12/27 17:54:04 dbrownell
|
||||
* forgot an important character :)
|
||||
*
|
||||
* Revision 1.2 2001/12/27 17:43:29 dbrownell
|
||||
* fail on firmware download errors; add "-v" flag
|
||||
*
|
||||
* Revision 1.1 2001/06/12 00:00:50 stevewilliams
|
||||
* Added the fxload program.
|
||||
* Rework root makefile and hotplug.spec to install in prefix
|
||||
* location without need of spec file for install.
|
||||
*
|
||||
*/
|
||||
Reference in New Issue
Block a user