mirror of
https://github.com/jfdelnero/HxCFloppyEmulator.git
synced 2026-10-26 22:10:31 +00:00
Command line converter tool (linux & windows).
git-svn-id: svn://svn.code.sf.net/p/hxcfloppyemu/code/HxCFloppyEmulator/HxCFloppyEmulator_cmdline/trunk@339 63fa2f70-6a9b-4bc4-b855-9c6a949b1d69
This commit is contained in:
commit
10a782d38e
20 files changed
+6024
No files matched your search
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,792 @@
|
||||
HxC Floppy Emulator - A generic/universal floppy disk drive emulator
|
||||
Copyright (C) 2006-2012 Jean-François DEL NERO / HxC2001
|
||||
|
||||
contact: hxc2001( a t )free.fr
|
||||
website: http://www.hxc2001.com / http://hxc2001.free.fr/floppy_drive_emulator
|
||||
forum: http://www.torlus.com/floppy/forum
|
||||
|
||||
HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
that this copyright statement is not removed from the file and that any
|
||||
derivative work contains the original copyright notice and the associated
|
||||
disclaimer.
|
||||
|
||||
HxCFloppyEmulator 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.
|
||||
|
||||
HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
The HxCFloppyEmulator software embedded the following libraries :
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
ADFLib :
|
||||
|
||||
ADFLib 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.
|
||||
|
||||
ADFLib 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 Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The main developper is
|
||||
Laurent Clévy (laurent.clevy (a t) club-internet.fr)
|
||||
|
||||
Contributors are:
|
||||
Bjarne Viksoe
|
||||
(C++ wrapper, lot of bug fixes)
|
||||
Gary Harris
|
||||
(bug fixes and W32 support)
|
||||
Dan Sutherland
|
||||
(bug fixes and W32 support)
|
||||
|
||||
See CHANGES.txt for detailed contributions.
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
xDMS v1.3 - Portable DMS archive unpacker - Public Domain
|
||||
Written by Andre Rodrigues de la Rocha <adlroc (a t) usa.net>
|
||||
xdms is licensed under PUBLIC DOMAIN. Read xdms.txt.
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
LibSAP
|
||||
Version 0.9.4
|
||||
Copyright (C) 2000-2003 Eric Botcazou
|
||||
|
||||
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
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
ZLIB DATA COMPRESSION LIBRARY
|
||||
zlib 1.2.3 is a general purpose data compression library.
|
||||
|
||||
(C) 1995-2004 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup(a t)gzip.org madler(a t)alumni.caltech.edu
|
||||
|
||||
If you use the zlib library in a product, we would appreciate *not*
|
||||
receiving lengthy legal documents to sign. The sources are provided
|
||||
for free but without warranty of any kind. The library has been
|
||||
entirely written by Jean-loup Gailly and Mark Adler; it does not
|
||||
include third-party code.
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,54 @@
|
||||
#CC=i386-pc-linux-gcc
|
||||
CC=gcc
|
||||
|
||||
ifdef IPF_LIB_SUPPORT
|
||||
CFLAGS=-O3 -I ../../../libhxcfe/trunk/sources -I . -I ../sources/ftdi/ -DIPF_SUPPORT
|
||||
DISKLOADERPLUGINS_IPF= ipf_loader.o libcapsimage.so.2.0
|
||||
else
|
||||
CFLAGS=-O3 -I ../sources -I ../../../libhxcfe/trunk/sources -I ../sources/ftdi/
|
||||
DISKLOADERPLUGINS_IPF=
|
||||
endif
|
||||
|
||||
LDFLAGS=-lc -lm -ldl -lpthread
|
||||
EXEC=hxcfe
|
||||
|
||||
FTDIFLOPPYEMU=usb_hxcfloppyemulator.o variablebitrate.o
|
||||
|
||||
all: $(EXEC)
|
||||
|
||||
hxcfloppyemulator_convert: hxcfloppyemu_convert.o floppy_loader.o floppy_utils.o linux_api.o emuii_track.o crc.o track_generator.o gcr_track.o sector_extractor.o $(ADFLIBOBJ) $(DISKLOADERPLUGINS_IPF)
|
||||
$(CC) -o $@ $^ $(LDFLAGS) -DFTDILIB
|
||||
|
||||
hxcfloppyemulator_d2xx: hxcfloppyemu.o floppy_loader.o floppy_utils.o linux_api.o ftdi_d2xxmode.o emuii_track.o crc.o track_generator.o gcr_track.o sector_extractor.o $(ADFLIBOBJ) $(DISKLOADERPLUGINS_IPF) $(FTDIFLOPPYEMU) libftd2xx.a.0.4.13
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
#hxcfe: hxcfe.o linux_api.o $(FTDIFLOPPYEMU) $(DISKLOADERPLUGINS_IPF) /usr/local/lib/libftdi.so.1
|
||||
|
||||
hxcfe: hxcfe.o linux_api.o ../../../build/libhxcfe.a
|
||||
$(CC) -o $@ $^ $(LDFLAGS) -DFTDILIB
|
||||
|
||||
hxcfe.o: ../sources/hxcfe.c
|
||||
$(CC) -o $@ -c $< $(CFLAGS)
|
||||
|
||||
linux_api.o: ../sources/linux_api.c
|
||||
$(CC) -o $@ -c $< $(CFLAGS)
|
||||
|
||||
usb_hxcfloppyemulator.o : ../sources/usb_floppyemulator/usb_hxcfloppyemulator.c
|
||||
$(CC) -o $@ -c $< $(CFLAGS)
|
||||
|
||||
variablebitrate.o : ../sources/usb_floppyemulator/variablebitrate.c
|
||||
$(CC) -o $@ -c $< $(CFLAGS)
|
||||
|
||||
ftdi_d2xxmode.o : ../sources/ftdi/ftdi.c ../sources/ftdi/ftdi.h ../sources/ftdi/ftd2xx.h ../sources/ftdi/WinTypes.h
|
||||
$(CC) -o $@ -c $< $(CFLAGS)
|
||||
|
||||
ftdi_libftdimode.o : ../sources/ftdi/ftdi.c ../sources/ftdi/ftdi.h ../sources/ftdi/ftd2xx.h ../sources/ftdi/WinTypes.h
|
||||
$(CC) -o $@ -c $< $(CFLAGS) -DFTDILIB
|
||||
|
||||
clean:
|
||||
rm -rf *.o
|
||||
|
||||
mrproper: clean
|
||||
rm -rf $(EXEC)
|
||||
|
||||
.PHONY: clean mrproper
|
||||
@@ -0,0 +1,104 @@
|
||||
# Microsoft Developer Studio Project File - Name="hxcfe" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=hxcfe - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "hxcfe.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "hxcfe.mak" CFG="hxcfe - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "hxcfe - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "hxcfe - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "hxcfe - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "..\..\..\build\"
|
||||
# PROP BASE Intermediate_Dir "..\..\..\build\Release_hxcfe"
|
||||
# PROP BASE Target_Dir "..\..\..\build\"
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\..\build\"
|
||||
# PROP Intermediate_Dir "..\..\..\build\Release_hxcfe"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir "..\..\..\build\"
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "../../../libhxcfe/trunk/sources" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "IPF_SUPPORT" /FR /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../build/libhxcfe.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "hxcfe - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "..\..\..\build\"
|
||||
# PROP BASE Intermediate_Dir "..\..\..\build\Debug_hxcfe"
|
||||
# PROP BASE Target_Dir "..\..\..\build\"
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\..\..\build\"
|
||||
# PROP Intermediate_Dir "..\..\..\build\Debug_hxcfe"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir "..\..\..\build\"
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../libhxcfe/trunk/sources" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "IPF_SUPPORT" /FR /FD /GZ /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../build/libhxcfe.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /out:""..\..\..\build\hxcfe.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "hxcfe - Win32 Release"
|
||||
# Name "hxcfe - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sources\hxcfe.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "img2hfe"=.\hxcfe.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#ifndef __WINDOWS_TYPES__
|
||||
#define __WINDOWS_TYPES__
|
||||
|
||||
#define MAX_NUM_DEVICES 50
|
||||
#include <sys/time.h>
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned short USHORT;
|
||||
typedef short SHORT;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned char *LPBYTE;
|
||||
typedef int BOOL;
|
||||
typedef char BOOLEAN;
|
||||
typedef char CHAR;
|
||||
typedef int *LPBOOL;
|
||||
typedef unsigned char *PUCHAR;
|
||||
typedef const char *LPCSTR;
|
||||
typedef char *PCHAR;
|
||||
typedef void *PVOID;
|
||||
typedef void *HANDLE;
|
||||
typedef long LONG;
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
typedef char *LPSTR;
|
||||
typedef char *LPTSTR;
|
||||
typedef DWORD *LPDWORD;
|
||||
typedef WORD *LPWORD;
|
||||
typedef ULONG *PULONG;
|
||||
typedef PVOID LPVOID;
|
||||
typedef void VOID;
|
||||
typedef unsigned long long int ULONGLONG;
|
||||
|
||||
typedef struct _OVERLAPPED {
|
||||
DWORD Internal;
|
||||
DWORD InternalHigh;
|
||||
DWORD Offset;
|
||||
DWORD OffsetHigh;
|
||||
HANDLE hEvent;
|
||||
} OVERLAPPED, *LPOVERLAPPED;
|
||||
|
||||
typedef struct _SECURITY_ATTRIBUTES {
|
||||
DWORD nLength;
|
||||
LPVOID lpSecurityDescriptor;
|
||||
BOOL bInheritHandle;
|
||||
} SECURITY_ATTRIBUTES , *LPSECURITY_ATTRIBUTES;
|
||||
|
||||
typedef struct timeval SYSTEMTIME;
|
||||
typedef struct timeval FILETIME;
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
//
|
||||
// Modem Status Flags
|
||||
//
|
||||
#define MS_CTS_ON ((DWORD)0x0010)
|
||||
#define MS_DSR_ON ((DWORD)0x0020)
|
||||
#define MS_RING_ON ((DWORD)0x0040)
|
||||
#define MS_RLSD_ON ((DWORD)0x0080)
|
||||
|
||||
//
|
||||
// Error Flags
|
||||
//
|
||||
|
||||
#define CE_RXOVER 0x0001 // Receive Queue overflow
|
||||
#define CE_OVERRUN 0x0002 // Receive Overrun Error
|
||||
#define CE_RXPARITY 0x0004 // Receive Parity Error
|
||||
#define CE_FRAME 0x0008 // Receive Framing error
|
||||
#define CE_BREAK 0x0010 // Break Detected
|
||||
#define CE_TXFULL 0x0100 // TX Queue is full
|
||||
#define CE_PTO 0x0200 // LPTx Timeout
|
||||
#define CE_IOE 0x0400 // LPTx I/O Error
|
||||
#define CE_DNS 0x0800 // LPTx Device not selected
|
||||
#define CE_OOP 0x1000 // LPTx Out-Of-Paper
|
||||
#define CE_MODE 0x8000 // Requested mode unsupported
|
||||
|
||||
#ifndef INVALID_HANDLE_VALUE
|
||||
#define INVALID_HANDLE_VALUE 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
[Globals]
|
||||
ConfigFlags=0x80000000
|
||||
[VID_0403&PID_6001]
|
||||
ConfigFlags=0x80000000
|
||||
[FT000001]
|
||||
ConfigFlags=0x80000000
|
||||
@@ -0,0 +1,946 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2001-2006 Future Technology Devices International Ltd.
|
||||
|
||||
Module Name:
|
||||
|
||||
ftd2xx.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Native USB interface for FTDI FT8U232/245/2232C
|
||||
FTD2XX library definitions
|
||||
|
||||
Environment:
|
||||
|
||||
kernel & user mode
|
||||
|
||||
Revision History:
|
||||
|
||||
13/03/01 awm Created.
|
||||
13/01/03 awm Added device information support.
|
||||
19/03/03 awm Added FT_W32_CancelIo.
|
||||
12/06/03 awm Added FT_StopInTask and FT_RestartInTask.
|
||||
18/09/03 awm Added FT_SetResetPipeRetryCount.
|
||||
10/10/03 awm Added FT_ResetPort.
|
||||
/03/04 st modified for linux users
|
||||
12/10/04 st added FT_SetVIDPID
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
#ifndef FTD2XX_H
|
||||
#define FTD2XX_H
|
||||
|
||||
#ifndef _WINDOWS
|
||||
#include <pthread.h>
|
||||
#define WINAPI
|
||||
#endif
|
||||
|
||||
// The following ifdef block is the standard way of creating macros
|
||||
// which make exporting from a DLL simpler. All files within this DLL
|
||||
// are compiled with the FTD2XX_EXPORTS symbol defined on the command line.
|
||||
// This symbol should not be defined on any project that uses this DLL.
|
||||
// This way any other project whose source files include this file see
|
||||
// FTD2XX_API functions as being imported from a DLL, whereas this DLL
|
||||
// sees symbols defined with this macro as being exported.
|
||||
|
||||
#ifdef FTD2XX_EXPORTS
|
||||
#define FTD2XX_API __declspec(dllexport)
|
||||
#else
|
||||
#define FTD2XX_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifndef _WINDOWS
|
||||
#include "WinTypes.h"
|
||||
|
||||
#ifdef FTD2XX_API
|
||||
#undef FTD2XX_API
|
||||
#define FTD2XX_API
|
||||
#endif
|
||||
#endif
|
||||
typedef struct _EVENT_HANDLE{
|
||||
pthread_cond_t eCondVar;
|
||||
pthread_mutex_t eMutex;
|
||||
int iVar;
|
||||
} EVENT_HANDLE;
|
||||
|
||||
typedef DWORD *FT_HANDLE;
|
||||
|
||||
typedef ULONG FT_STATUS;
|
||||
|
||||
//
|
||||
// Device status
|
||||
//
|
||||
enum {
|
||||
FT_OK,
|
||||
FT_INVALID_HANDLE,
|
||||
FT_DEVICE_NOT_FOUND,
|
||||
FT_DEVICE_NOT_OPENED,
|
||||
FT_IO_ERROR,
|
||||
FT_INSUFFICIENT_RESOURCES,
|
||||
FT_INVALID_PARAMETER,
|
||||
FT_INVALID_BAUD_RATE, //7
|
||||
|
||||
FT_DEVICE_NOT_OPENED_FOR_ERASE,
|
||||
FT_DEVICE_NOT_OPENED_FOR_WRITE,
|
||||
FT_FAILED_TO_WRITE_DEVICE,
|
||||
FT_EEPROM_READ_FAILED,
|
||||
FT_EEPROM_WRITE_FAILED,
|
||||
FT_EEPROM_ERASE_FAILED,
|
||||
FT_EEPROM_NOT_PRESENT,
|
||||
FT_EEPROM_NOT_PROGRAMMED,
|
||||
FT_INVALID_ARGS,
|
||||
FT_NOT_SUPPORTED,
|
||||
FT_OTHER_ERROR
|
||||
};
|
||||
|
||||
|
||||
#define FT_SUCCESS(status) ((status) == FT_OK)
|
||||
|
||||
//
|
||||
// FT_OpenEx Flags
|
||||
//
|
||||
|
||||
#define FT_OPEN_BY_SERIAL_NUMBER 1
|
||||
#define FT_OPEN_BY_DESCRIPTION 2
|
||||
|
||||
//
|
||||
// FT_ListDevices Flags (used in conjunction with FT_OpenEx Flags
|
||||
//
|
||||
|
||||
#define FT_LIST_NUMBER_ONLY 0x80000000
|
||||
#define FT_LIST_BY_INDEX 0x40000000
|
||||
#define FT_LIST_ALL 0x20000000
|
||||
|
||||
#define FT_LIST_MASK (FT_LIST_NUMBER_ONLY|FT_LIST_BY_INDEX|FT_LIST_ALL)
|
||||
|
||||
//
|
||||
// Baud Rates
|
||||
//
|
||||
|
||||
#define FT_BAUD_300 300
|
||||
#define FT_BAUD_600 600
|
||||
#define FT_BAUD_1200 1200
|
||||
#define FT_BAUD_2400 2400
|
||||
#define FT_BAUD_4800 4800
|
||||
#define FT_BAUD_9600 9600
|
||||
#define FT_BAUD_14400 14400
|
||||
#define FT_BAUD_19200 19200
|
||||
#define FT_BAUD_38400 38400
|
||||
#define FT_BAUD_57600 57600
|
||||
#define FT_BAUD_115200 115200
|
||||
#define FT_BAUD_230400 230400
|
||||
#define FT_BAUD_460800 460800
|
||||
#define FT_BAUD_921600 921600
|
||||
|
||||
//
|
||||
// Word Lengths
|
||||
//
|
||||
|
||||
#define FT_BITS_8 (UCHAR) 8
|
||||
#define FT_BITS_7 (UCHAR) 7
|
||||
#define FT_BITS_6 (UCHAR) 6
|
||||
#define FT_BITS_5 (UCHAR) 5
|
||||
|
||||
//
|
||||
// Stop Bits
|
||||
//
|
||||
|
||||
#define FT_STOP_BITS_1 (UCHAR) 0
|
||||
#define FT_STOP_BITS_1_5 (UCHAR) 1
|
||||
#define FT_STOP_BITS_2 (UCHAR) 2
|
||||
|
||||
//
|
||||
// Parity
|
||||
//
|
||||
|
||||
#define FT_PARITY_NONE (UCHAR) 0
|
||||
#define FT_PARITY_ODD (UCHAR) 1
|
||||
#define FT_PARITY_EVEN (UCHAR) 2
|
||||
#define FT_PARITY_MARK (UCHAR) 3
|
||||
#define FT_PARITY_SPACE (UCHAR) 4
|
||||
|
||||
//
|
||||
// Flow Control
|
||||
//
|
||||
|
||||
#define FT_FLOW_NONE 0x0000
|
||||
#define FT_FLOW_RTS_CTS 0x0100
|
||||
#define FT_FLOW_DTR_DSR 0x0200
|
||||
#define FT_FLOW_XON_XOFF 0x0400
|
||||
|
||||
//
|
||||
// Purge rx and tx buffers
|
||||
//
|
||||
#define FT_PURGE_RX 1
|
||||
#define FT_PURGE_TX 2
|
||||
|
||||
//
|
||||
// Events
|
||||
//
|
||||
|
||||
typedef void (*PFT_EVENT_HANDLER)(DWORD,DWORD);
|
||||
|
||||
#define FT_EVENT_RXCHAR 1
|
||||
#define FT_EVENT_MODEM_STATUS 2
|
||||
|
||||
//
|
||||
// Timeouts
|
||||
//
|
||||
|
||||
#define FT_DEFAULT_RX_TIMEOUT 300
|
||||
#define FT_DEFAULT_TX_TIMEOUT 300
|
||||
|
||||
//
|
||||
// Device types
|
||||
//
|
||||
|
||||
typedef ULONG FT_DEVICE;
|
||||
|
||||
enum {
|
||||
FT_DEVICE_BM,
|
||||
FT_DEVICE_AM,
|
||||
FT_DEVICE_100AX,
|
||||
FT_DEVICE_UNKNOWN,
|
||||
FT_DEVICE_2232C,
|
||||
FT_DEVICE_232R
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_Open(
|
||||
int deviceNumber,
|
||||
FT_HANDLE *pHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_OpenEx(
|
||||
PVOID pArg1,
|
||||
DWORD Flags,
|
||||
FT_HANDLE *pHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_ListDevices(
|
||||
PVOID pArg1,
|
||||
PVOID pArg2,
|
||||
DWORD Flags
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS FT_SetVIDPID(
|
||||
DWORD dwVID,
|
||||
DWORD dwPID
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS FT_GetVIDPID(
|
||||
DWORD * pdwVID,
|
||||
DWORD * pdwPID
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_Close(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_Read(
|
||||
FT_HANDLE ftHandle,
|
||||
LPVOID lpBuffer,
|
||||
DWORD nBufferSize,
|
||||
LPDWORD lpBytesReturned
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_Write(
|
||||
FT_HANDLE ftHandle,
|
||||
LPVOID lpBuffer,
|
||||
DWORD nBufferSize,
|
||||
LPDWORD lpBytesWritten
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_IoCtl( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD dwIoControlCode,
|
||||
LPVOID lpInBuf,
|
||||
DWORD nInBufSize,
|
||||
LPVOID lpOutBuf,
|
||||
DWORD nOutBufSize,
|
||||
LPDWORD lpBytesReturned,
|
||||
LPOVERLAPPED lpOverlapped
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetBaudRate(
|
||||
FT_HANDLE ftHandle,
|
||||
ULONG BaudRate
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetDivisor(
|
||||
FT_HANDLE ftHandle,
|
||||
USHORT Divisor
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetDataCharacteristics(
|
||||
FT_HANDLE ftHandle,
|
||||
UCHAR WordLength,
|
||||
UCHAR StopBits,
|
||||
UCHAR Parity
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetFlowControl(
|
||||
FT_HANDLE ftHandle,
|
||||
USHORT FlowControl,
|
||||
UCHAR XonChar,
|
||||
UCHAR XoffChar
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_ResetDevice(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetDtr(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_ClrDtr(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetRts(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_ClrRts(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetModemStatus(
|
||||
FT_HANDLE ftHandle,
|
||||
ULONG *pModemStatus
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetChars(
|
||||
FT_HANDLE ftHandle,
|
||||
UCHAR EventChar,
|
||||
UCHAR EventCharEnabled,
|
||||
UCHAR ErrorChar,
|
||||
UCHAR ErrorCharEnabled
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_Purge(
|
||||
FT_HANDLE ftHandle,
|
||||
ULONG Mask
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetTimeouts(
|
||||
FT_HANDLE ftHandle,
|
||||
ULONG ReadTimeout,
|
||||
ULONG WriteTimeout
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetQueueStatus(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD *dwRxBytes
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetEventNotification(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD Mask,
|
||||
PVOID Param
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetStatus(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD *dwRxBytes,
|
||||
DWORD *dwTxBytes,
|
||||
DWORD *dwEventDWord
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetBreakOn(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetBreakOff(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetWaitMask( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD Mask
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_WaitOnMask( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD *Mask
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetEventStatus(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD *dwEventDWord
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_ReadEE(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD dwWordOffset,
|
||||
LPWORD lpwValue
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_WriteEE(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD dwWordOffset,
|
||||
WORD wValue
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EraseEE(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
//
|
||||
// structure to hold program data for FT_Program function
|
||||
//
|
||||
typedef struct ft_program_data {
|
||||
|
||||
DWORD Signature1; // Header - must be 0x00000000
|
||||
DWORD Signature2; // Header - must be 0xffffffff
|
||||
DWORD Version; // Header - FT_PROGRAM_DATA version
|
||||
// 0 = original
|
||||
// 1 = FT2232C extensions
|
||||
// 2 = FT232R extensions
|
||||
|
||||
WORD VendorId; // 0x0403
|
||||
WORD ProductId; // 0x6001
|
||||
char *Manufacturer; // "FTDI"
|
||||
char *ManufacturerId; // "FT"
|
||||
char *Description; // "USB HS Serial Converter"
|
||||
char *SerialNumber; // "FT000001" if fixed, or NULL
|
||||
WORD MaxPower; // 0 < MaxPower <= 500
|
||||
WORD PnP; // 0 = disabled, 1 = enabled
|
||||
WORD SelfPowered; // 0 = bus powered, 1 = self powered
|
||||
WORD RemoteWakeup; // 0 = not capable, 1 = capable
|
||||
//
|
||||
// Rev4 extensions
|
||||
//
|
||||
UCHAR Rev4; // non-zero if Rev4 chip, zero otherwise
|
||||
UCHAR IsoIn; // non-zero if in endpoint is isochronous
|
||||
UCHAR IsoOut; // non-zero if out endpoint is isochronous
|
||||
UCHAR PullDownEnable; // non-zero if pull down enabled
|
||||
UCHAR SerNumEnable; // non-zero if serial number to be used
|
||||
UCHAR USBVersionEnable; // non-zero if chip uses USBVersion
|
||||
WORD USBVersion; // BCD (0x0200 => USB2)
|
||||
//
|
||||
// FT2232C extensions
|
||||
//
|
||||
UCHAR Rev5; // non-zero if Rev5 chip, zero otherwise
|
||||
UCHAR IsoInA; // non-zero if in endpoint is isochronous
|
||||
UCHAR IsoInB; // non-zero if in endpoint is isochronous
|
||||
UCHAR IsoOutA; // non-zero if out endpoint is isochronous
|
||||
UCHAR IsoOutB; // non-zero if out endpoint is isochronous
|
||||
UCHAR PullDownEnable5; // non-zero if pull down enabled
|
||||
UCHAR SerNumEnable5; // non-zero if serial number to be used
|
||||
UCHAR USBVersionEnable5; // non-zero if chip uses USBVersion
|
||||
WORD USBVersion5; // BCD (0x0200 => USB2)
|
||||
UCHAR AIsHighCurrent; // non-zero if interface is high current
|
||||
UCHAR BIsHighCurrent; // non-zero if interface is high current
|
||||
UCHAR IFAIsFifo; // non-zero if interface is 245 FIFO
|
||||
UCHAR IFAIsFifoTar; // non-zero if interface is 245 FIFO CPU target
|
||||
UCHAR IFAIsFastSer; // non-zero if interface is Fast serial
|
||||
UCHAR AIsVCP; // non-zero if interface is to use VCP drivers
|
||||
UCHAR IFBIsFifo; // non-zero if interface is 245 FIFO
|
||||
UCHAR IFBIsFifoTar; // non-zero if interface is 245 FIFO CPU target
|
||||
UCHAR IFBIsFastSer; // non-zero if interface is Fast serial
|
||||
UCHAR BIsVCP; // non-zero if interface is to use VCP drivers
|
||||
//
|
||||
// FT232R extensions
|
||||
//
|
||||
UCHAR UseExtOsc; // Use External Oscillator
|
||||
UCHAR HighDriveIOs; // High Drive I/Os
|
||||
UCHAR EndpointSize; // Endpoint size
|
||||
|
||||
UCHAR PullDownEnableR; // non-zero if pull down enabled
|
||||
UCHAR SerNumEnableR; // non-zero if serial number to be used
|
||||
|
||||
UCHAR InvertTXD; // non-zero if invert TXD
|
||||
UCHAR InvertRXD; // non-zero if invert RXD
|
||||
UCHAR InvertRTS; // non-zero if invert RTS
|
||||
UCHAR InvertCTS; // non-zero if invert CTS
|
||||
UCHAR InvertDTR; // non-zero if invert DTR
|
||||
UCHAR InvertDSR; // non-zero if invert DSR
|
||||
UCHAR InvertDCD; // non-zero if invert DCD
|
||||
UCHAR InvertRI; // non-zero if invert RI
|
||||
|
||||
UCHAR Cbus0; // Cbus Mux control
|
||||
UCHAR Cbus1; // Cbus Mux control
|
||||
UCHAR Cbus2; // Cbus Mux control
|
||||
UCHAR Cbus3; // Cbus Mux control
|
||||
UCHAR Cbus4; // Cbus Mux control
|
||||
|
||||
UCHAR RIsVCP; // zero if using VCP drivers
|
||||
|
||||
} FT_PROGRAM_DATA, *PFT_PROGRAM_DATA;
|
||||
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EE_Program(
|
||||
FT_HANDLE ftHandle,
|
||||
PFT_PROGRAM_DATA pData
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EE_ProgramEx(
|
||||
FT_HANDLE ftHandle,
|
||||
PFT_PROGRAM_DATA lpData,
|
||||
char *Manufacturer,
|
||||
char *ManufacturerId,
|
||||
char *Description,
|
||||
char *SerialNumber
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EE_Read(
|
||||
FT_HANDLE ftHandle,
|
||||
PFT_PROGRAM_DATA pData
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EE_ReadEx(
|
||||
FT_HANDLE ftHandle,
|
||||
PFT_PROGRAM_DATA lpData,
|
||||
char *Manufacturer,
|
||||
char *ManufacturerId,
|
||||
char *Description,
|
||||
char *SerialNumber
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EE_UASize(
|
||||
FT_HANDLE ftHandle,
|
||||
LPDWORD lpdwSize
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EE_UAWrite(
|
||||
FT_HANDLE ftHandle,
|
||||
PUCHAR pucData,
|
||||
DWORD dwDataLen
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_EE_UARead(
|
||||
FT_HANDLE ftHandle,
|
||||
PUCHAR pucData,
|
||||
DWORD dwDataLen,
|
||||
LPDWORD lpdwBytesRead
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetLatencyTimer(
|
||||
FT_HANDLE ftHandle,
|
||||
UCHAR ucLatency
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetLatencyTimer(
|
||||
FT_HANDLE ftHandle,
|
||||
PUCHAR pucLatency
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetBitMode(
|
||||
FT_HANDLE ftHandle,
|
||||
UCHAR ucMask,
|
||||
UCHAR ucEnable
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetBitMode(
|
||||
FT_HANDLE ftHandle,
|
||||
PUCHAR pucMode
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetUSBParameters(
|
||||
FT_HANDLE ftHandle,
|
||||
ULONG ulInTransferSize,
|
||||
ULONG ulOutTransferSize
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetDeadmanTimeout(
|
||||
FT_HANDLE ftHandle,
|
||||
ULONG ulDeadmanTimeout // -1 for infinite (2.6 kernels only). High +ve number for 2.4 kernels
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetDeviceInfo(
|
||||
FT_HANDLE ftHandle,
|
||||
FT_DEVICE *lpftDevice,
|
||||
LPDWORD lpdwID,
|
||||
PCHAR SerialNumber,
|
||||
PCHAR Description,
|
||||
LPVOID Dummy
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_StopInTask(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_RestartInTask(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_SetResetPipeRetryCount( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD dwCount
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_ResetPort( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_CyclePort( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Win32-type functions
|
||||
//
|
||||
|
||||
FTD2XX_API
|
||||
FT_HANDLE WINAPI FT_W32_CreateFile(
|
||||
LPCSTR lpszName,
|
||||
DWORD dwAccess,
|
||||
DWORD dwShareMode,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreate,
|
||||
DWORD dwAttrsAndFlags,
|
||||
HANDLE hTemplate
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_CloseHandle(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_ReadFile(
|
||||
FT_HANDLE ftHandle,
|
||||
LPVOID lpBuffer,
|
||||
DWORD nBufferSize,
|
||||
LPDWORD lpBytesReturned,
|
||||
LPOVERLAPPED lpOverlapped
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_WriteFile(
|
||||
FT_HANDLE ftHandle,
|
||||
LPVOID lpBuffer,
|
||||
DWORD nBufferSize,
|
||||
LPDWORD lpBytesWritten,
|
||||
LPOVERLAPPED lpOverlapped
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
DWORD WINAPI FT_W32_GetLastError(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_GetOverlappedResult( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle,
|
||||
LPOVERLAPPED lpOverlapped,
|
||||
LPDWORD lpdwBytesTransferred,
|
||||
BOOL bWait
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_CancelIo( // Linux, OS X: Not supported
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Win32 COMM API type functions
|
||||
//
|
||||
typedef struct _FTCOMSTAT {
|
||||
DWORD fCtsHold : 1;
|
||||
DWORD fDsrHold : 1;
|
||||
DWORD fRlsdHold : 1;
|
||||
DWORD fXoffHold : 1;
|
||||
DWORD fXoffSent : 1;
|
||||
DWORD fEof : 1;
|
||||
DWORD fTxim : 1;
|
||||
DWORD fReserved : 25;
|
||||
DWORD cbInQue;
|
||||
DWORD cbOutQue;
|
||||
} FTCOMSTAT, *LPFTCOMSTAT;
|
||||
|
||||
typedef struct _FTDCB {
|
||||
DWORD DCBlength; /* sizeof(FTDCB) */
|
||||
DWORD BaudRate; /* Baudrate at which running */
|
||||
DWORD fBinary: 1; /* Binary Mode (skip EOF check) */
|
||||
DWORD fParity: 1; /* Enable parity checking */
|
||||
DWORD fOutxCtsFlow:1; /* CTS handshaking on output */
|
||||
DWORD fOutxDsrFlow:1; /* DSR handshaking on output */
|
||||
DWORD fDtrControl:2; /* DTR Flow control */
|
||||
DWORD fDsrSensitivity:1; /* DSR Sensitivity */
|
||||
DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
|
||||
DWORD fOutX: 1; /* Enable output X-ON/X-OFF */
|
||||
DWORD fInX: 1; /* Enable input X-ON/X-OFF */
|
||||
DWORD fErrorChar: 1; /* Enable Err Replacement */
|
||||
DWORD fNull: 1; /* Enable Null stripping */
|
||||
DWORD fRtsControl:2; /* Rts Flow control */
|
||||
DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
|
||||
DWORD fDummy2:17; /* Reserved */
|
||||
WORD wReserved; /* Not currently used */
|
||||
WORD XonLim; /* Transmit X-ON threshold */
|
||||
WORD XoffLim; /* Transmit X-OFF threshold */
|
||||
BYTE ByteSize; /* Number of bits/byte, 4-8 */
|
||||
BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */
|
||||
BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */
|
||||
char XonChar; /* Tx and Rx X-ON character */
|
||||
char XoffChar; /* Tx and Rx X-OFF character */
|
||||
char ErrorChar; /* Error replacement char */
|
||||
char EofChar; /* End of Input character */
|
||||
char EvtChar; /* Received Event character */
|
||||
WORD wReserved1; /* Fill for now. */
|
||||
} FTDCB, *LPFTDCB;
|
||||
|
||||
typedef struct _FTTIMEOUTS {
|
||||
DWORD ReadIntervalTimeout; /* Maximum time between read chars. */
|
||||
DWORD ReadTotalTimeoutMultiplier; /* Multiplier of characters. */
|
||||
DWORD ReadTotalTimeoutConstant; /* Constant in milliseconds. */
|
||||
DWORD WriteTotalTimeoutMultiplier; /* Multiplier of characters. */
|
||||
DWORD WriteTotalTimeoutConstant; /* Constant in milliseconds. */
|
||||
} FTTIMEOUTS,*LPFTTIMEOUTS;
|
||||
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_ClearCommBreak(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_ClearCommError(
|
||||
FT_HANDLE ftHandle,
|
||||
LPDWORD lpdwErrors,
|
||||
LPFTCOMSTAT lpftComstat
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_EscapeCommFunction(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD dwFunc
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_GetCommModemStatus(
|
||||
FT_HANDLE ftHandle,
|
||||
LPDWORD lpdwModemStatus
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_GetCommState(
|
||||
FT_HANDLE ftHandle,
|
||||
LPFTDCB lpftDcb
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_GetCommTimeouts(
|
||||
FT_HANDLE ftHandle,
|
||||
FTTIMEOUTS *pTimeouts
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_PurgeComm(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD dwMask
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_SetCommBreak(
|
||||
FT_HANDLE ftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_SetCommMask(
|
||||
FT_HANDLE ftHandle,
|
||||
ULONG ulEventMask
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_SetCommState(
|
||||
FT_HANDLE ftHandle,
|
||||
LPFTDCB lpftDcb
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_SetCommTimeouts(
|
||||
FT_HANDLE ftHandle,
|
||||
FTTIMEOUTS *pTimeouts
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_SetupComm(
|
||||
FT_HANDLE ftHandle,
|
||||
DWORD dwReadBufferSize,
|
||||
DWORD dwWriteBufferSize
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
BOOL WINAPI FT_W32_WaitCommEvent(
|
||||
FT_HANDLE ftHandle,
|
||||
PULONG pulEvent,
|
||||
LPOVERLAPPED lpOverlapped
|
||||
);
|
||||
|
||||
//
|
||||
// Device information
|
||||
//
|
||||
|
||||
typedef struct _ft_device_list_info_node {
|
||||
ULONG Flags;
|
||||
ULONG Type;
|
||||
ULONG ID;
|
||||
DWORD LocId;
|
||||
char SerialNumber[16];
|
||||
char Description[64];
|
||||
FT_HANDLE ftHandle;
|
||||
} FT_DEVICE_LIST_INFO_NODE;
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_CreateDeviceInfoList(
|
||||
LPDWORD lpdwNumDevs
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetDeviceInfoList(
|
||||
FT_DEVICE_LIST_INFO_NODE *pDest,
|
||||
LPDWORD lpdwNumDevs
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetDeviceInfoDetail(
|
||||
DWORD dwIndex,
|
||||
LPDWORD lpdwFlags,
|
||||
LPDWORD lpdwType,
|
||||
LPDWORD lpdwID,
|
||||
LPDWORD lpdwLocId,
|
||||
LPVOID lpSerialNumber,
|
||||
LPVOID lpDescription,
|
||||
FT_HANDLE *pftHandle
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetDriverVersion(
|
||||
FT_HANDLE ftHandle,
|
||||
LPDWORD lpdwVersion
|
||||
);
|
||||
|
||||
FTD2XX_API
|
||||
FT_STATUS WINAPI FT_GetLibraryVersion(
|
||||
LPDWORD lpdwVersion
|
||||
);
|
||||
|
||||
//
|
||||
// Events
|
||||
//
|
||||
|
||||
#define EV_RXCHAR 0x0001 // Any Character received
|
||||
#define EV_RXFLAG 0x0002 // Received certain character
|
||||
#define EV_TXEMPTY 0x0004 // Transmitt Queue Empty
|
||||
#define EV_CTS 0x0008 // CTS changed state
|
||||
#define EV_DSR 0x0010 // DSR changed state
|
||||
#define EV_RLSD 0x0020 // RLSD changed state
|
||||
#define EV_BREAK 0x0040 // BREAK received
|
||||
#define EV_ERR 0x0080 // Line status error occurred
|
||||
#define EV_RING 0x0100 // Ring signal detected
|
||||
#define EV_PERR 0x0200 // Printer error occured
|
||||
#define EV_RX80FULL 0x0400 // Receive buffer is 80 percent full
|
||||
#define EV_EVENT1 0x0800 // Provider specific event 1
|
||||
#define EV_EVENT2 0x1000 // Provider specific event 2
|
||||
|
||||
//
|
||||
// Escape Functions
|
||||
//
|
||||
|
||||
#define SETXOFF 1 // Simulate XOFF received
|
||||
#define SETXON 2 // Simulate XON received
|
||||
#define SETRTS 3 // Set RTS high
|
||||
#define CLRRTS 4 // Set RTS low
|
||||
#define SETDTR 5 // Set DTR high
|
||||
#define CLRDTR 6 // Set DTR low
|
||||
#define RESETDEV 7 // Reset device if possible
|
||||
#define SETBREAK 8 // Set the device break line.
|
||||
#define CLRBREAK 9 // Clear the device break line.
|
||||
|
||||
//
|
||||
// PURGE function flags.
|
||||
//
|
||||
#define PURGE_TXABORT 0x0001 // Kill the pending/current writes to the comm port.
|
||||
#define PURGE_RXABORT 0x0002 // Kill the pending/current reads to the comm port.
|
||||
#define PURGE_TXCLEAR 0x0004 // Kill the transmit queue if there.
|
||||
#define PURGE_RXCLEAR 0x0008 // Kill the typeahead buffer if there.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* FTD2XX_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,513 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
|
||||
//#define FTDILIB 1
|
||||
//#define DEBUGMODE 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "WinTypes.h"
|
||||
|
||||
#include "libhxcfe.h"
|
||||
#include "usb_floppyemulator/usb_hxcfloppyemulator.h"
|
||||
#include "linux_api.h"
|
||||
#include "ftd2xx.h"
|
||||
|
||||
#ifdef FTDILIB
|
||||
#include "libftdi-0.14/src/ftdi.h"
|
||||
#else
|
||||
#include "ftdi.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FTDILIB
|
||||
#define BUFFERSIZE 32*1024
|
||||
|
||||
|
||||
EVENT_HANDLE * STOP_THREAD_EVENT;
|
||||
EVENT_HANDLE * READ_THREAD_EVENT;
|
||||
int stop_thread;
|
||||
struct ftdi_context ftdic;
|
||||
|
||||
|
||||
typedef struct _DATA_FIFO{
|
||||
unsigned long ptr_in;
|
||||
unsigned long ptr_out;
|
||||
unsigned char BUFFER[BUFFERSIZE];
|
||||
} DATA_FIFO;
|
||||
|
||||
DATA_FIFO tx_fifo;
|
||||
DATA_FIFO rx_fifo;
|
||||
|
||||
unsigned char RXBUFFER[64];
|
||||
|
||||
EVENT_HANDLE * createevent()
|
||||
{
|
||||
EVENT_HANDLE* theevent;
|
||||
theevent=(EVENT_HANDLE*)malloc(sizeof(EVENT_HANDLE));
|
||||
pthread_mutex_init(&theevent->eMutex, NULL);
|
||||
pthread_cond_init(&theevent->eCondVar, NULL);
|
||||
return theevent;
|
||||
}
|
||||
|
||||
void setevent(EVENT_HANDLE * theevent)
|
||||
{
|
||||
pthread_cond_signal(&theevent->eCondVar);
|
||||
}
|
||||
|
||||
void destroyevent(EVENT_HANDLE * theevent)
|
||||
{
|
||||
pthread_cond_destroy(&theevent->eCondVar);
|
||||
free(theevent);
|
||||
}
|
||||
|
||||
int waitevent(EVENT_HANDLE* theevent,int timeout)
|
||||
{
|
||||
struct timeval now;
|
||||
struct timespec timeoutstr;
|
||||
int retcode;
|
||||
int ret;
|
||||
|
||||
//if(timeout==0) timeout=INFINITE;
|
||||
//ret=WaitForSingleObject(eventtab[id],timeout);
|
||||
|
||||
pthread_mutex_lock(&theevent->eMutex);
|
||||
gettimeofday(&now,0);
|
||||
timeoutstr.tv_sec = now.tv_sec + (timeout/1000);
|
||||
timeoutstr.tv_nsec = (now.tv_usec * 1000) ;//+(timeout*1000000);
|
||||
retcode = 0;
|
||||
|
||||
retcode = pthread_cond_timedwait(&theevent->eCondVar, &theevent->eMutex, &timeoutstr);
|
||||
if (retcode == ETIMEDOUT)
|
||||
{
|
||||
pthread_mutex_unlock(&theevent->eMutex);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pthread_mutex_unlock(&theevent->eMutex);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
typedef int (*RDTHREADFUNCTION) (struct ftdi_context * ftdihandle);
|
||||
|
||||
typedef struct listenerthreadinit_
|
||||
{
|
||||
RDTHREADFUNCTION thread;
|
||||
struct ftdi_context *ftdihandle;
|
||||
//HXCFLOPPYEMULATOR * hxcfloppyemulatorcontext;
|
||||
//HWINTERFACE * hwcontext;
|
||||
}listenerthreadinit;
|
||||
|
||||
void * FTDIListenerThreadProc( void *lpParameter)
|
||||
{
|
||||
listenerthreadinit *threadinitptr;
|
||||
RDTHREADFUNCTION thread;
|
||||
|
||||
threadinitptr=(listenerthreadinit*)lpParameter;
|
||||
thread=threadinitptr->thread;
|
||||
|
||||
thread(threadinitptr->ftdihandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FTDIListener(struct ftdi_context *ftdihandle)
|
||||
{
|
||||
int returnvalue,i;
|
||||
unsigned char * bufferptr;
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
printf("FTDIListener\n");
|
||||
#endif
|
||||
do
|
||||
{
|
||||
|
||||
do
|
||||
{
|
||||
returnvalue=ftdi_read_data(ftdihandle, RXBUFFER, 2);
|
||||
}while(returnvalue==0);
|
||||
if(returnvalue>0)
|
||||
{
|
||||
for(i=0;i<returnvalue;i++)
|
||||
{
|
||||
rx_fifo.BUFFER[(rx_fifo.ptr_in)&(BUFFERSIZE-1)]=RXBUFFER[i];
|
||||
rx_fifo.ptr_in=(rx_fifo.ptr_in+1)&(BUFFERSIZE-1);
|
||||
}
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
printf("rx : %d %d \n",rx_fifo.ptr_in,returnvalue);
|
||||
#endif
|
||||
if(READ_THREAD_EVENT)setevent(READ_THREAD_EVENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_thread=1;
|
||||
if(READ_THREAD_EVENT)setevent(READ_THREAD_EVENT);
|
||||
}
|
||||
|
||||
}while(!stop_thread);
|
||||
setevent(STOP_THREAD_EVENT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int createlistenerthread(RDTHREADFUNCTION thread,int priority,struct ftdi_context * ftdihandle)
|
||||
{
|
||||
unsigned long sit;
|
||||
pthread_t threadid;
|
||||
listenerthreadinit *threadinitptr;
|
||||
pthread_attr_t threadattrib;
|
||||
struct sched_param param;
|
||||
|
||||
//pthread_attr_create(&threadattrib);
|
||||
pthread_attr_init(&threadattrib);
|
||||
pthread_attr_setinheritsched(&threadattrib,1);
|
||||
//pthread_attr_setsched(&threadattrib,SCHED_FIFO);
|
||||
//pthread_attr_setprio(&threadattrib,4);
|
||||
|
||||
pthread_attr_setschedpolicy(&threadattrib,SCHED_FIFO);
|
||||
param.sched_priority = sched_get_priority_max(SCHED_FIFO) ;
|
||||
/* set the new scheduling param */
|
||||
pthread_attr_setschedparam (&threadattrib, ¶m);
|
||||
|
||||
threadinitptr=(listenerthreadinit *)malloc(sizeof(listenerthreadinit));
|
||||
threadinitptr->thread=thread;
|
||||
threadinitptr->ftdihandle=ftdihandle;
|
||||
|
||||
//pthread_create(&threadid, &threadattrib,FTDIListenerThreadProc, threadinitptr);
|
||||
pthread_create(&threadid,0,FTDIListenerThreadProc, threadinitptr);
|
||||
|
||||
return sit;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int ftdi_load_lib (HXCFLOPPYEMULATOR* floppycontext)
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
printf("---ftdi_load_lib---\n");
|
||||
#endif
|
||||
#ifdef FTDILIB
|
||||
ftdi_init(&ftdic);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int open_ftdichip(unsigned long * ftdihandle)
|
||||
{
|
||||
static unsigned char c=0;
|
||||
int ret;
|
||||
#ifdef DEBUGMODE
|
||||
printf("---open_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
|
||||
ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001);
|
||||
if(ret<0)
|
||||
{
|
||||
c++;
|
||||
*ftdihandle=0;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_thread=0;
|
||||
*ftdihandle=(unsigned long)(&ftdic);
|
||||
STOP_THREAD_EVENT=createevent();
|
||||
READ_THREAD_EVENT=0;
|
||||
tx_fifo.ptr_in=0;
|
||||
tx_fifo.ptr_out=0;
|
||||
memset(tx_fifo.BUFFER,0,BUFFERSIZE);
|
||||
rx_fifo.ptr_in=0;
|
||||
rx_fifo.ptr_out=0;
|
||||
memset(rx_fifo.BUFFER,0,BUFFERSIZE);
|
||||
|
||||
createlistenerthread(FTDIListener,128,&ftdic);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if(FT_Open(c&0xf,(FT_HANDLE*)ftdihandle)!=FT_OK)
|
||||
{
|
||||
c++;
|
||||
*ftdihandle=0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int close_ftdichip(unsigned long ftdihandle)
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
printf("---close_ftdichip---\n");
|
||||
#endif
|
||||
#ifdef FTDILIB
|
||||
stop_thread=1;
|
||||
waitevent(STOP_THREAD_EVENT,10000);
|
||||
ftdi_usb_close((struct ftdi_context *)ftdihandle);
|
||||
destroyevent(STOP_THREAD_EVENT);
|
||||
#else
|
||||
|
||||
if(FT_Close((FT_HANDLE)ftdihandle)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int purge_ftdichip(unsigned long ftdihandle,unsigned long buffer)
|
||||
{
|
||||
int ret;
|
||||
#ifdef DEBUGMODE
|
||||
printf("---purge_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
|
||||
ftdi_usb_purge_rx_buffer((struct ftdi_context *)ftdihandle);
|
||||
ftdi_usb_purge_tx_buffer((struct ftdi_context *)ftdihandle);
|
||||
ret=ftdi_usb_purge_buffers((struct ftdi_context *)ftdihandle);
|
||||
|
||||
rx_fifo.ptr_in=0;
|
||||
rx_fifo.ptr_out=0;
|
||||
|
||||
if(ret)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if(FT_Purge((FT_HANDLE)ftdihandle,buffer)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setusbparameters_ftdichip(unsigned long ftdihandle,unsigned long buffersizetx,unsigned long buffersizerx)
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
printf("---setusbparameters_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
|
||||
ftdi_read_data_set_chunksize((struct ftdi_context *)ftdihandle, buffersizerx);
|
||||
ftdi_write_data_set_chunksize((struct ftdi_context *)ftdihandle, buffersizetx);
|
||||
|
||||
#else
|
||||
|
||||
if(FT_SetUSBParameters ((FT_HANDLE)ftdihandle,buffersizerx,buffersizetx)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setlatencytimer_ftdichip(unsigned long ftdihandle,unsigned char latencytimer_ms)
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
printf("---setlatencytimer_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
|
||||
if(ftdi_set_latency_timer((struct ftdi_context *)ftdihandle, latencytimer_ms)<0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if(FT_SetLatencyTimer ((FT_HANDLE)ftdihandle,latencytimer_ms)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int write_ftdichip(unsigned long ftdihandle,unsigned char * buffer,unsigned int size)
|
||||
{
|
||||
long dwWritten;
|
||||
#ifdef DEBUGMODE
|
||||
printf("---write_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
|
||||
dwWritten=ftdi_write_data((struct ftdi_context *)ftdihandle, buffer, size);
|
||||
if(dwWritten<0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return dwWritten;
|
||||
|
||||
#else
|
||||
|
||||
if(FT_Write ((FT_HANDLE)ftdihandle, (LPVOID)buffer, size,&dwWritten)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return dwWritten;
|
||||
}
|
||||
|
||||
int read_ftdichip(unsigned long ftdihandle,unsigned char * buffer,unsigned int size)
|
||||
{
|
||||
long returnvalue,nb_of_byte;
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
printf("---read_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
nb_of_byte=0;
|
||||
while((rx_fifo.ptr_in != rx_fifo.ptr_out) && (nb_of_byte<size))
|
||||
{
|
||||
buffer[nb_of_byte]=rx_fifo.BUFFER[(rx_fifo.ptr_out)&(BUFFERSIZE-1)];
|
||||
nb_of_byte++;
|
||||
rx_fifo.ptr_out=(rx_fifo.ptr_out+1)&(BUFFERSIZE-1);
|
||||
}
|
||||
if(stop_thread)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nb_of_byte;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if(FT_Read((FT_HANDLE)ftdihandle,buffer,size,&returnvalue)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return returnvalue;
|
||||
}
|
||||
|
||||
int getfifostatus_ftdichip(unsigned long ftdihandle,unsigned long * txlevel,unsigned long *rxlevel,unsigned long * event)
|
||||
{
|
||||
long nb_of_byte,ptr_out;
|
||||
#ifdef DEBUGMODE
|
||||
printf("---getfifostatus_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
if(rx_fifo.ptr_in != rx_fifo.ptr_out)
|
||||
{
|
||||
nb_of_byte=0;
|
||||
ptr_out=rx_fifo.ptr_out&(BUFFERSIZE-1);
|
||||
while((rx_fifo.ptr_in != ptr_out))
|
||||
{
|
||||
nb_of_byte++;
|
||||
ptr_out=(ptr_out+1)&(BUFFERSIZE-1);
|
||||
}
|
||||
*event=FT_EVENT_RXCHAR;
|
||||
*rxlevel=nb_of_byte;
|
||||
//printf("%d...\n",*rxlevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
*txlevel=0;
|
||||
*rxlevel=0;
|
||||
*event=0;
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if(FT_GetStatus((FT_HANDLE)ftdihandle,rxlevel,txlevel,event)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int seteventnotification_ftdichip(unsigned long ftdihandle,unsigned long eventmask,void * event)
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
printf("---seteventnotification_ftdichip---\n");
|
||||
#endif
|
||||
|
||||
#ifdef FTDILIB
|
||||
|
||||
READ_THREAD_EVENT=(EVENT_HANDLE*)event;
|
||||
#else
|
||||
|
||||
if(FT_SetEventNotification((FT_HANDLE)ftdihandle,eventmask,event)!=FT_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
/////////////
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
#define SRAMSIZE 8*1024
|
||||
|
||||
#define FT_PURGE_RX 1
|
||||
#define FT_PURGE_TX 2
|
||||
#define FT_EVENT_RXCHAR 1
|
||||
|
||||
int ftdi_load_lib (HXCFLOPPYEMULATOR* floppycontext);
|
||||
|
||||
int open_ftdichip(unsigned long * ftdihandle);
|
||||
int close_ftdichip(unsigned long ftdihandle);
|
||||
int purge_ftdichip(unsigned long ftdihandle,unsigned long buffer);
|
||||
int setusbparameters_ftdichip(unsigned long ftdihandle,unsigned long buffersizetx,unsigned long buffersizerx);
|
||||
int setlatencytimer_ftdichip(unsigned long ftdihandle,unsigned char latencytimer_ms);
|
||||
int write_ftdichip(unsigned long ftdihandle,unsigned char * buffer,unsigned int size);
|
||||
int read_ftdichip(unsigned long ftdihandle,unsigned char * buffer,unsigned int size);
|
||||
int getfifostatus_ftdichip(unsigned long ftdihandle,unsigned long * txlevel,unsigned long *rxlevel,unsigned long * event);
|
||||
int seteventnotification_ftdichip(unsigned long ftdihandle,unsigned long eventmask,void * event);
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "libhxcfe.h"
|
||||
|
||||
int CUI_affiche(int MSGTYPE,char * chaine, ...)
|
||||
{
|
||||
if(MSGTYPE!=MSG_DEBUG)
|
||||
{
|
||||
va_list marker;
|
||||
va_start( marker, chaine );
|
||||
|
||||
vprintf(chaine,marker);
|
||||
printf("\n");
|
||||
|
||||
va_end( marker );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char * gettype(char * str_type,char *ext)
|
||||
{
|
||||
if(!strcmp(str_type,"-HFE"))
|
||||
{
|
||||
strcpy(ext,".hfe");
|
||||
return PLUGIN_HXC_HFE;
|
||||
}
|
||||
|
||||
if(!strcmp(str_type,"-AFI"))
|
||||
{
|
||||
strcpy(ext,".afi");
|
||||
return PLUGIN_HXC_AFI;
|
||||
}
|
||||
|
||||
if(!strcmp(str_type,"-CPCDSK"))
|
||||
{
|
||||
strcpy(ext,".dsk");
|
||||
return PLUGIN_AMSTRADCPC_DSK;
|
||||
}
|
||||
|
||||
if(!strcmp(str_type,"-RAW"))
|
||||
{
|
||||
strcpy(ext,".raw");
|
||||
return PLUGIN_RAW_LOADER;
|
||||
}
|
||||
|
||||
if(!strcmp(str_type,"-MFM"))
|
||||
{
|
||||
strcpy(ext,".mfm");
|
||||
return PLUGIN_HXC_MFM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void get_filename(char * path,char * filename)
|
||||
{
|
||||
int i,done;
|
||||
|
||||
i=strlen(path);
|
||||
done=0;
|
||||
while(i && !done)
|
||||
{
|
||||
i--;
|
||||
|
||||
if(path[i]=='/')
|
||||
{
|
||||
done=1;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(filename,"%s",&path[i]);
|
||||
|
||||
i=0;
|
||||
while(filename[i])
|
||||
{
|
||||
if(filename[i]=='.')
|
||||
{
|
||||
filename[i]='_';
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ret;
|
||||
char filename[512];
|
||||
char ext[16];
|
||||
char * output_file_type;
|
||||
|
||||
FLOPPY * floppydisk;
|
||||
HXCFLOPPYEMULATOR* hxcfe;
|
||||
|
||||
hxcfe=hxcfe_init();
|
||||
hxcfe_setOutputFunc(hxcfe,&CUI_affiche);
|
||||
|
||||
printf("HxC Floppy Emulator : Floppy image file converter\n");
|
||||
printf("Copyright (C) 2006-2012 Jean-Francois DEL NERO\n");
|
||||
printf("This program comes with ABSOLUTELY NO WARRANTY\n");
|
||||
printf("This is free software, and you are welcome to redistribute it\n");
|
||||
printf("under certain conditions;\n\n");
|
||||
|
||||
if(argv[1] && argv[2])
|
||||
{
|
||||
output_file_type=gettype(argv[2],(char*)&ext);
|
||||
if(output_file_type)
|
||||
{
|
||||
hxcfe_selectContainer(hxcfe,"AUTOSELECT");
|
||||
floppydisk=hxcfe_floppyLoad(hxcfe,argv[1],&ret);
|
||||
|
||||
if(ret!=HXCFE_NOERROR || !floppydisk)
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case HXCFE_UNSUPPORTEDFILE:
|
||||
printf("Load error!: Image file not yet supported!\n");
|
||||
break;
|
||||
case HXCFE_FILECORRUPTED:
|
||||
printf("Load error!: File corrupted ? Read error ?\n");
|
||||
break;
|
||||
case HXCFE_ACCESSERROR:
|
||||
printf("Load error!: Read file error!\n");
|
||||
break;
|
||||
default:
|
||||
printf("Load error! error %d\n",ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
get_filename(argv[1],filename);
|
||||
strcat(filename,ext);
|
||||
|
||||
hxcfe_selectContainer(hxcfe,output_file_type);
|
||||
|
||||
hxcfe_floppyExport(hxcfe,floppydisk,filename);
|
||||
|
||||
hxcfe_floppyUnload(hxcfe,floppydisk);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Syntax: %s [image-file] [-HFE/-AFI/-CPCDSK/-RAW/-MFM]\n",argv[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Syntax: %s [image-file] [-HFE/-AFI/-CPCDSK/-RAW/-MFM]\n",argv[0]);
|
||||
}
|
||||
|
||||
hxcfe_deinit(hxcfe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
|
||||
#include "libhxcfe.h"
|
||||
#include "usb_floppyemulator/usb_hxcfloppyemulator.h"
|
||||
#include "linux_api.h"
|
||||
#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include "ftd2xx.h"
|
||||
|
||||
|
||||
EVENT_HANDLE * eventtab[256];
|
||||
|
||||
void strlwr(char *string)
|
||||
{
|
||||
int i;
|
||||
|
||||
i=0;
|
||||
while (string[i])
|
||||
{
|
||||
string[i] = tolower(string[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void * ThreadProc( void *lpParameter)
|
||||
{
|
||||
threadinit *threadinitptr;
|
||||
THREADFUNCTION thread;
|
||||
HXCFLOPPYEMULATOR* floppycontext;
|
||||
HWINTERFACE* hw_context;
|
||||
|
||||
//SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
|
||||
threadinitptr=(threadinit*)lpParameter;
|
||||
thread=threadinitptr->thread;
|
||||
floppycontext=threadinitptr->hxcfloppyemulatorcontext;
|
||||
hw_context=threadinitptr->hwcontext;
|
||||
thread(floppycontext,hw_context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
DWORD WINAPI ThreadProc( LPVOID lpParameter)
|
||||
{
|
||||
threadinit *threadinitptr;
|
||||
THREADFUNCTION thread;
|
||||
HXCFLOPPYEMULATOR* floppycontext;
|
||||
HWINTERFACE* hw_context;
|
||||
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
|
||||
threadinitptr=(threadinit*)lpParameter;
|
||||
thread=threadinitptr->thread;
|
||||
floppycontext=threadinitptr->hxcfloppyemulatorcontext;
|
||||
hw_context=threadinitptr->hwcontext;
|
||||
thread(floppycontext,hw_context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long hxc_create_ftdi_event(HXCFLOPPYEMULATOR* floppycontext,unsigned char id)
|
||||
{
|
||||
//eventtab[id]=CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||
//seteventnotification_ftdichip(eventtab[id]);
|
||||
return (unsigned long)eventtab[id];
|
||||
}
|
||||
*/
|
||||
|
||||
int hxc_setevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id)
|
||||
{
|
||||
//SetEvent(eventtab[id]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long hxc_createevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id)
|
||||
{
|
||||
//eventtab[id]=CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||
eventtab[id]=(EVENT_HANDLE*)malloc(sizeof(EVENT_HANDLE));
|
||||
pthread_mutex_init(&eventtab[id]->eMutex, NULL);
|
||||
pthread_cond_init(&eventtab[id]->eCondVar, NULL);
|
||||
return (unsigned long)eventtab[id];
|
||||
}
|
||||
|
||||
int hxc_waitevent(HXCFLOPPYEMULATOR* floppycontext,int id,int timeout)
|
||||
{
|
||||
|
||||
struct timeval now;
|
||||
struct timespec timeoutstr;
|
||||
int retcode;
|
||||
int ret;
|
||||
|
||||
//if(timeout==0) timeout=INFINITE;
|
||||
//ret=WaitForSingleObject(eventtab[id],timeout);
|
||||
|
||||
|
||||
pthread_mutex_lock(&eventtab[id]->eMutex);
|
||||
gettimeofday(&now,0);
|
||||
timeoutstr.tv_sec = now.tv_sec + (timeout/1000);
|
||||
timeoutstr.tv_nsec = (now.tv_usec * 1000) ;//+(timeout*1000000);
|
||||
retcode = 0;
|
||||
|
||||
retcode = pthread_cond_timedwait(&eventtab[id]->eCondVar, &eventtab[id]->eMutex, &timeoutstr);
|
||||
if (retcode == ETIMEDOUT)
|
||||
{
|
||||
pthread_mutex_unlock(&eventtab[id]->eMutex);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pthread_mutex_unlock(&eventtab[id]->eMutex);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void hxc_pause(int ms)
|
||||
{
|
||||
sleep(1);
|
||||
//msleep(ms);
|
||||
}
|
||||
|
||||
int hxc_createthread(HXCFLOPPYEMULATOR* floppycontext,HWINTERFACE* hwcontext,THREADFUNCTION thread,int priority)
|
||||
{
|
||||
unsigned long sit;
|
||||
pthread_t threadid;
|
||||
pthread_attr_t threadattrib;
|
||||
threadinit *threadinitptr;
|
||||
struct sched_param param;
|
||||
|
||||
pthread_attr_init(&threadattrib);
|
||||
|
||||
pthread_attr_setschedpolicy(&threadattrib,SCHED_FIFO);
|
||||
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
||||
/* set the new scheduling param */
|
||||
pthread_attr_setschedparam (&threadattrib, ¶m);
|
||||
|
||||
threadinitptr=(threadinit *)malloc(sizeof(threadinit));
|
||||
threadinitptr->thread=thread;
|
||||
threadinitptr->hxcfloppyemulatorcontext=floppycontext;
|
||||
threadinitptr->hwcontext=hwcontext;
|
||||
|
||||
pthread_create(&threadid, &threadattrib,ThreadProc, threadinitptr);
|
||||
|
||||
return sit;
|
||||
}
|
||||
|
||||
int getlistoffile(unsigned char * directorypath,unsigned char *** filelist)
|
||||
{
|
||||
int numberoffile;
|
||||
char ** filepathtab;
|
||||
/*
|
||||
HANDLE findfilehandle;
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
|
||||
filepathtab=0;
|
||||
numberoffile=0;
|
||||
|
||||
findfilehandle=FindFirstFile(directorypath,&FindFileData);
|
||||
if(findfilehandle!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
||||
do
|
||||
{
|
||||
filepathtab=(char **) realloc(filepathtab,sizeof(char*)*(numberoffile+1));
|
||||
filepathtab[numberoffile]=(char*)malloc(strlen(FindFileData.cFileName)+1);
|
||||
strcpy(filepathtab[numberoffile],FindFileData.cFileName);
|
||||
numberoffile++;
|
||||
}while(FindNextFile(findfilehandle,&FindFileData));
|
||||
|
||||
FindClose(findfilehandle);
|
||||
}
|
||||
*filelist=filepathtab;*/
|
||||
|
||||
return 0;//numberoffile;
|
||||
}
|
||||
|
||||
|
||||
char * getcurrentdirectory(char *currentdirectory,int buffersize)
|
||||
{
|
||||
memset(currentdirectory,0,buffersize);
|
||||
/* if(GetModuleFileName(GetModuleHandle(NULL),currentdirectory,buffersize))
|
||||
{
|
||||
if(strrchr(currentdirectory,'\\'))
|
||||
{
|
||||
*((char*)strrchr(currentdirectory,'\\'))=0;
|
||||
return currentdirectory;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int loaddiskplugins(HXCFLOPPYEMULATOR* floppycontext,FLOPPY * newfloppy,char *pluginpath)
|
||||
{
|
||||
/* HMODULE module;
|
||||
|
||||
// module=LoadLibrary(pluginpath);
|
||||
if(module)
|
||||
{
|
||||
newfloppy->IsValidDiskFile=(ISVALIDDISKFILE )GetProcAddress(module,"IsValidDiskFile");
|
||||
newfloppy->UnLoadDiskFile=(UNLOADDISKFILE )GetProcAddress(module,"UnLoadDiskFile");
|
||||
newfloppy->GetFloppyPropretiesInt=(GETFLOPPYPROPRETIESINT)GetProcAddress(module,"GetFloppyPropretiesInt");
|
||||
newfloppy->GetTrackData=(GETTRACKDATA)GetProcAddress(module,"GetTrackData");
|
||||
newfloppy->GetIndexData=(GETINDEXDATA)GetProcAddress(module,"GetIndexData");
|
||||
newfloppy->LoadDiskFile=(LOADDISKFILE)GetProcAddress(module,"LoadDiskFile");
|
||||
if(newfloppy->IsValidDiskFile && newfloppy->UnLoadDiskFile && newfloppy->GetFloppyPropretiesInt && newfloppy->GetTrackData && newfloppy->GetIndexData && newfloppy->LoadDiskFile)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeLibrary(module);
|
||||
}
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long find_first_file(char *folder,char *file,filefoundinfo* fileinfo)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
long find_next_file(long handleff,char *folder,char *file,filefoundinfo* fileinfo)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
long find_close(long handle)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char * strupper(char * str)
|
||||
{
|
||||
int i;
|
||||
|
||||
i=0;
|
||||
while(str[i])
|
||||
{
|
||||
|
||||
if(str[i]>='a' && str[i]<='z')
|
||||
{
|
||||
str[i]=str[i]+('A'-'a');
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
char * strlower(char * str)
|
||||
{
|
||||
int i;
|
||||
|
||||
i=0;
|
||||
while(str[i])
|
||||
{
|
||||
|
||||
if(str[i]>='A' && str[i]<='Z')
|
||||
{
|
||||
str[i]=str[i]+('a'-'A');
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
|
||||
typedef int (*THREADFUNCTION) (void* floppyemulator,void* hwemulator);
|
||||
|
||||
typedef struct threadinit_
|
||||
{
|
||||
THREADFUNCTION thread;
|
||||
HXCFLOPPYEMULATOR * hxcfloppyemulatorcontext;
|
||||
HWINTERFACE * hwcontext;
|
||||
}threadinit;
|
||||
|
||||
int getlistoffile(unsigned char * directorypath,unsigned char *** filelist);
|
||||
char * getcurrentdirectory(char *currentdirectory,int buffersize);
|
||||
int loaddiskplugins(HXCFLOPPYEMULATOR* floppycontext,FLOPPY * newfloppy,char *pluginpath);
|
||||
int hxc_createthread(HXCFLOPPYEMULATOR* floppycontext,HWINTERFACE* hwcontext,THREADFUNCTION thread,int priority);
|
||||
//int createthread(HXCFLOPPYEMULATOR* floppycontext,THREADFUNCTION thread,int priority);
|
||||
unsigned long hxc_createevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id);
|
||||
|
||||
int hxc_waitevent(HXCFLOPPYEMULATOR* floppycontext,int id,int timeout);
|
||||
int hxc_setevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id);
|
||||
unsigned long hxc_create_ftdi_event(HXCFLOPPYEMULATOR* floppycontext,unsigned char id);
|
||||
void hxc_pause(int ms);
|
||||
|
||||
typedef struct filefoundinfo_
|
||||
{
|
||||
int isdirectory;
|
||||
char * filename;
|
||||
char * fullpath;
|
||||
int size;
|
||||
}filefoundinfo;
|
||||
|
||||
long find_close(long handleff);
|
||||
long find_next_file(long handleff,char *folder,char *file,filefoundinfo* fileinfo);
|
||||
long find_first_file(char *folder,char *file,filefoundinfo* fileinfo);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#define SETINDEX_H0_OPCODE 0xC0
|
||||
#define SETINDEX_H1_OPCODE 0x0C
|
||||
|
||||
#define NOP_H0_OPCODE 0x70
|
||||
#define NOP_H1_OPCODE 0x07
|
||||
|
||||
#define SETBITRATE_H0_OPCODE 0xD0
|
||||
#define SETBITRATE_H1_OPCODE 0x0D
|
||||
|
||||
@@ -0,0 +1,953 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
//#define DEBUGVB 1
|
||||
|
||||
#include "libhxcfe.h"
|
||||
#include "usb_hxcfloppyemulator.h"
|
||||
|
||||
#include "ftdi.h"
|
||||
#include "os_api.h"
|
||||
#include "variablebitrate.h"
|
||||
|
||||
|
||||
int hxc_createthread(HXCFLOPPYEMULATOR* floppycontext,HWINTERFACE* hwcontext,THREADFUNCTION thread,int priority);
|
||||
|
||||
// fonction permettant de changer l'etat des signaux ready, dskchg et de source de selection
|
||||
// dans un buffer
|
||||
void patchbuffer(unsigned char * buffer, unsigned long bufferlen,unsigned char patchvalue)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i=0;
|
||||
do
|
||||
{
|
||||
if(((buffer[i]&0xF)==0xC) || ((buffer[i]&0xF0)==0xC0))
|
||||
{
|
||||
buffer[i+1]=buffer[i+1]|patchvalue;
|
||||
}
|
||||
i=i+2;
|
||||
}while(i<bufferlen);
|
||||
}
|
||||
|
||||
// fonction generant des code mfm aléatoire dans un buffer MFM
|
||||
// (emulation track non formate / weak bits)
|
||||
void randomizebuffer(HWINTERFACE* hw_context,unsigned char * buffer,unsigned char * randombuffer, unsigned long bufferlen)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i=0;
|
||||
do
|
||||
{
|
||||
if(randombuffer[i])
|
||||
{
|
||||
buffer[i]=(buffer[i] & ~randombuffer[i]) | ( hw_context->randomlut[rand()&0x3FF] & randombuffer[i] );
|
||||
if((buffer[i]&3)==0x03)
|
||||
buffer[i]=buffer[i]^0x2;
|
||||
|
||||
if((buffer[i]&0xC)==0x0C)
|
||||
buffer[i]=buffer[i]^0x8;
|
||||
|
||||
if((buffer[i]&0x30)==0x30)
|
||||
buffer[i]=buffer[i]^0x20;
|
||||
|
||||
if((buffer[i]&0xC0)==0xC0)
|
||||
buffer[i]=buffer[i]^0x80;
|
||||
|
||||
}
|
||||
i++;
|
||||
}while(i<bufferlen);
|
||||
}
|
||||
|
||||
|
||||
//permet de detecter sur un octet est une commande ou un code MFM
|
||||
unsigned char iscmd(unsigned char c)
|
||||
{
|
||||
unsigned char c2;
|
||||
|
||||
c2=(c>>4)&0xF;
|
||||
if((c==0x7) || (c==0xD) || (c==0xC) || (c2==0x7) || (c2==0xD) || (c2==0xC))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// fonction de generation du prochain paquet USB a envoyer
|
||||
int FillBuffer(HXCFLOPPYEMULATOR* floppycontext,HWINTERFACE* hw_context,unsigned char * paquetbuffer,int * headmoved)
|
||||
{
|
||||
int t;
|
||||
int trackposition;
|
||||
static int l=0;
|
||||
static int currenttrack_finalbuffer=0;
|
||||
int floppypin34;
|
||||
int floppypin2;
|
||||
int writeprotect;
|
||||
int amigaready;
|
||||
unsigned long bytecopied;
|
||||
unsigned long final_buffer_len;
|
||||
unsigned char * trackptr;
|
||||
unsigned char * randomtrackptr;
|
||||
unsigned int floppydisable;
|
||||
unsigned char ctrl_byte;
|
||||
|
||||
|
||||
if(hw_context->current_track<hw_context->number_of_track)
|
||||
{
|
||||
trackposition=hw_context->current_track;
|
||||
if(trackposition<0)trackposition=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
trackposition=hw_context->number_of_track-1;
|
||||
if(trackposition<0)trackposition=0;
|
||||
}
|
||||
|
||||
|
||||
final_buffer_len=hw_context->precalcusbtrack[trackposition].tracklen;
|
||||
trackptr=hw_context->precalcusbtrack[trackposition].usbtrack;
|
||||
randomtrackptr=hw_context->precalcusbtrack[trackposition].randomusbtrack;
|
||||
|
||||
// selection des bon etats pour les signaux ready et diskchg
|
||||
// selon la machine cible
|
||||
floppypin34=0;
|
||||
floppypin2=0;
|
||||
amigaready=0;
|
||||
writeprotect=0;
|
||||
|
||||
switch(hw_context->interface_mode)
|
||||
{
|
||||
case AMIGA_DD_FLOPPYMODE: // amiga
|
||||
case AMIGA_HD_FLOPPYMODE: // amiga
|
||||
amigaready=1;
|
||||
floppypin34=1;
|
||||
|
||||
if(hw_context->floppychanged)
|
||||
{
|
||||
floppypin2=1;
|
||||
|
||||
if(l>200)
|
||||
{
|
||||
//hw_context->floppychanged=0;
|
||||
if(*headmoved)
|
||||
{
|
||||
*headmoved=0;
|
||||
floppypin2=0;
|
||||
hw_context->floppychanged=0;
|
||||
l=0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
l++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
floppypin2=0;
|
||||
*headmoved=0;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case IBMPC_DD_FLOPPYMODE: // pc / st 720k
|
||||
case ATARIST_DD_FLOPPYMODE:
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
if(hw_context->floppychanged)
|
||||
{
|
||||
floppypin34=1;
|
||||
writeprotect=1;
|
||||
if(l>100)
|
||||
{
|
||||
if(*headmoved)
|
||||
{
|
||||
*headmoved=0;
|
||||
floppypin34=0;
|
||||
hw_context->floppychanged=0;
|
||||
l=0;
|
||||
}
|
||||
|
||||
writeprotect=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
l++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
floppypin34=0;
|
||||
*headmoved=0;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case IBMPC_HD_FLOPPYMODE: // pc / st 1.44MB
|
||||
case ATARIST_HD_FLOPPYMODE:
|
||||
amigaready=0;
|
||||
floppypin2=1;
|
||||
|
||||
if(hw_context->floppychanged)
|
||||
{
|
||||
floppypin34=1;
|
||||
writeprotect=1;
|
||||
|
||||
if(l>100)
|
||||
{
|
||||
if(*headmoved)
|
||||
{
|
||||
*headmoved=0;
|
||||
floppypin34=0;
|
||||
hw_context->floppychanged=0;
|
||||
l=0;
|
||||
}
|
||||
writeprotect=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
l++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
floppypin34=0;
|
||||
*headmoved=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MSX2_DD_FLOPPYMODE:
|
||||
case CPC_DD_FLOPPYMODE: // cpc / korg dss1
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
floppypin34=1;
|
||||
break;
|
||||
|
||||
|
||||
case GENERIC_SHUGART_DD_FLOPPYMODE:
|
||||
case EMU_SHUGART_FLOPPYMODE:
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
floppypin34=1;
|
||||
break;
|
||||
|
||||
default:
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
floppypin34=1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bytecopied=0;
|
||||
if(final_buffer_len)
|
||||
{
|
||||
|
||||
hw_context->trackbuffer_pos=hw_context->trackbuffer_pos % final_buffer_len;
|
||||
if((hw_context->trackbuffer_pos+hw_context->usbstats.packetsize)<final_buffer_len)
|
||||
{
|
||||
memcpy(paquetbuffer,trackptr+hw_context->trackbuffer_pos,hw_context->usbstats.packetsize);
|
||||
randomizebuffer(hw_context,paquetbuffer,randomtrackptr+hw_context->trackbuffer_pos, hw_context->usbstats.packetsize);
|
||||
|
||||
hw_context->trackbuffer_pos=hw_context->trackbuffer_pos+hw_context->usbstats.packetsize;
|
||||
bytecopied=bytecopied+hw_context->usbstats.packetsize;
|
||||
}
|
||||
else
|
||||
{ // roll over
|
||||
t=(hw_context->trackbuffer_pos+hw_context->usbstats.packetsize)-final_buffer_len;
|
||||
memcpy(paquetbuffer,trackptr+hw_context->trackbuffer_pos,hw_context->usbstats.packetsize-t);
|
||||
randomizebuffer(hw_context,paquetbuffer,randomtrackptr+hw_context->trackbuffer_pos, hw_context->usbstats.packetsize-t);
|
||||
hw_context->trackbuffer_pos=0;
|
||||
memcpy(&paquetbuffer[(hw_context->usbstats.packetsize-t)],trackptr+hw_context->trackbuffer_pos,t);
|
||||
randomizebuffer(hw_context,&paquetbuffer[(hw_context->usbstats.packetsize-t)],randomtrackptr+hw_context->trackbuffer_pos,t);
|
||||
hw_context->trackbuffer_pos=hw_context->trackbuffer_pos+t;
|
||||
bytecopied=bytecopied+hw_context->usbstats.packetsize;
|
||||
}
|
||||
|
||||
//on verifie qu'il n'y a pas de commande a cheval entre 2 buffers
|
||||
// si oui on corrige en ajoutant 1 octet au buffer
|
||||
if(iscmd(paquetbuffer[hw_context->usbstats.packetsize-1]))
|
||||
{
|
||||
if(!iscmd(paquetbuffer[hw_context->usbstats.packetsize-2]))
|
||||
{
|
||||
paquetbuffer[hw_context->usbstats.packetsize]=*(trackptr+hw_context->trackbuffer_pos);
|
||||
randomizebuffer(hw_context,&paquetbuffer[hw_context->usbstats.packetsize],randomtrackptr+hw_context->trackbuffer_pos,1);
|
||||
hw_context->trackbuffer_pos=hw_context->trackbuffer_pos+1;
|
||||
hw_context->trackbuffer_pos=hw_context->trackbuffer_pos % final_buffer_len;
|
||||
bytecopied++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hw_context->trackbuffer_pos=hw_context->trackbuffer_pos % final_buffer_len;
|
||||
|
||||
|
||||
// Derniere etape on change les etat des signaux floppy
|
||||
// ready, diskchg, etc...
|
||||
|
||||
|
||||
/* index_signal<= SRAM_DATA(0); -- change index state
|
||||
ready_signal<= SRAM_DATA(1);
|
||||
diskchanged_signal<= SRAM_DATA(2);
|
||||
writeprotect_signal<= SRAM_DATA(3);
|
||||
amigareadymode<= SRAM_DATA(4);
|
||||
FLOPPY_SELdisable<= SRAM_DATA(5);
|
||||
FLOPPY_SELreg(0)<= SRAM_DATA(6);
|
||||
FLOPPY_SELreg(1)<= SRAM_DATA(7);*/
|
||||
|
||||
if(hw_context->drive_select_source>3)
|
||||
{
|
||||
floppydisable=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
floppydisable=0;
|
||||
}
|
||||
|
||||
ctrl_byte=((hw_context->drive_select_source&0x3)<<6)|((floppydisable&0x1)<<5) | (amigaready<<4)| (writeprotect<<3) | (floppypin2<<2)|(floppypin34<<1);
|
||||
patchbuffer(paquetbuffer, bytecopied,ctrl_byte);
|
||||
}
|
||||
|
||||
return bytecopied;
|
||||
}
|
||||
|
||||
|
||||
int ftdichiplistener(HXCFLOPPYEMULATOR* floppycontext,HWINTERFACE* hw_context)
|
||||
{
|
||||
unsigned long hw_handle;
|
||||
int we_ret;
|
||||
int init_failed,ftdierror;
|
||||
int i;
|
||||
unsigned long RxBytes,TxBytes;
|
||||
unsigned char * srambuffer;
|
||||
unsigned char * srambuffer2;
|
||||
unsigned char * input_buffer;
|
||||
int byteread,bytetoread;
|
||||
int checkalignement;
|
||||
int trackpointer;
|
||||
int byte_read;
|
||||
int txbuffersize;
|
||||
unsigned long eventftdi,eventftdimask;
|
||||
unsigned long * rxevent;
|
||||
int headmoved;
|
||||
int bytetowrite;
|
||||
int floppypin34;
|
||||
int floppypin2;
|
||||
int amigaready;
|
||||
unsigned int floppydisable;
|
||||
unsigned char ctrl_byte,current_track;
|
||||
|
||||
floppycontext->hxc_printf(MSG_DEBUG,"thread ftdichiplistener");
|
||||
hw_handle=0;
|
||||
headmoved=0;
|
||||
|
||||
srambuffer=(unsigned char*)malloc(SRAMSIZE);
|
||||
srambuffer2=(unsigned char*)malloc(SRAMSIZE);
|
||||
input_buffer=(unsigned char*)malloc(SRAMSIZE);
|
||||
if(!srambuffer || !input_buffer)
|
||||
{
|
||||
floppycontext->hxc_printf(MSG_ERROR,"srambuffer malloc error !");
|
||||
return -1;
|
||||
}
|
||||
|
||||
hw_context->running=0;
|
||||
|
||||
hw_context->usbstats.totaldataout=0;
|
||||
hw_context->usbstats.dataout=0;
|
||||
hw_context->usbstats.synclost=0;
|
||||
if(!hw_context->usbstats.packetsize)
|
||||
hw_context->usbstats.packetsize=1664;
|
||||
hw_context->usbstats.totalpacketsent=0;
|
||||
hw_context->usbstats.packetsent=0;
|
||||
hw_context->usbstats.totaldataout=0;
|
||||
|
||||
rxevent=(unsigned long*)hxc_createevent(floppycontext,1);
|
||||
|
||||
do // boucle principale
|
||||
{
|
||||
|
||||
hw_context->status=STATUS_LOOKINGFOR;
|
||||
do // boucle autodetection/initialisation de la carte
|
||||
{
|
||||
|
||||
if(hw_handle)
|
||||
{// driver ftdi ouvert-> on le ferme
|
||||
close_ftdichip(hw_handle);
|
||||
hw_handle=0;
|
||||
}
|
||||
init_failed=0;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
// ouverture driver ftdi
|
||||
open_ftdichip(&hw_handle);
|
||||
if(!hw_handle)
|
||||
{// probleme !
|
||||
// il faut temporiser et retenter plus tard
|
||||
hxc_pause(500);
|
||||
}
|
||||
else
|
||||
{
|
||||
//ok
|
||||
//configuration du driver et du chip!
|
||||
setusbparameters_ftdichip(hw_handle,2048,2048);
|
||||
|
||||
//4ms de timeout pour l'envoi des data coté ft245
|
||||
setlatencytimer_ftdichip(hw_handle,4);
|
||||
|
||||
purge_ftdichip(hw_handle,FT_PURGE_TX);
|
||||
purge_ftdichip(hw_handle,FT_PURGE_RX);
|
||||
|
||||
//utilisation de la methode d'attente sur evenement
|
||||
// pour la reception
|
||||
eventftdimask= FT_EVENT_RXCHAR;
|
||||
seteventnotification_ftdichip(hw_handle,eventftdimask,rxevent);
|
||||
}
|
||||
|
||||
}while(!hw_handle);
|
||||
|
||||
// ici l'acces au ft245 est validé
|
||||
// il faut maintenant verifier le cpld.
|
||||
|
||||
// hardware test
|
||||
|
||||
// on efface la SRAM de la carte
|
||||
memset(srambuffer,0x00,SRAMSIZE);
|
||||
write_ftdichip(hw_handle,srambuffer,SRAMSIZE);
|
||||
|
||||
purge_ftdichip(hw_handle,FT_PURGE_RX);
|
||||
|
||||
//memoire effacee -> la carte ne doit rien envoyer
|
||||
if(hxc_waitevent(floppycontext,1,400))
|
||||
{// ok on est parti en timeout
|
||||
//
|
||||
// maintenant on place une commande de synchro dans le buffer
|
||||
// et cette fois-ci la carte doit envoyer un octet regulierement
|
||||
|
||||
i=0;
|
||||
do
|
||||
{
|
||||
memset(srambuffer,0x00,SRAMSIZE);
|
||||
srambuffer[0]=0xdd;
|
||||
srambuffer[1]=0xaa;
|
||||
srambuffer[2]=0x33;
|
||||
write_ftdichip(hw_handle,srambuffer,SRAMSIZE);
|
||||
|
||||
we_ret=hxc_waitevent(floppycontext,1,1000);
|
||||
|
||||
getfifostatus_ftdichip(hw_handle,&RxBytes,&TxBytes,&eventftdi);
|
||||
|
||||
if(we_ret==1)//si timeout -> pas bon
|
||||
{
|
||||
init_failed=1;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
while(i<8 && !init_failed); //(on fait 8 fois l'operation)
|
||||
|
||||
}
|
||||
else
|
||||
{// erreur on a reçu des donnees ?! (ancienne version du cpld ?!)
|
||||
init_failed=1;
|
||||
}
|
||||
|
||||
}while(init_failed);
|
||||
|
||||
|
||||
// detection terminee
|
||||
// on rentre dans la boucle de fonctionnement
|
||||
// normal
|
||||
hw_context->status=STATUS_ONLINE;
|
||||
purge_ftdichip(hw_handle,FT_PURGE_RX);
|
||||
checkalignement=5;
|
||||
ftdierror=0;
|
||||
do
|
||||
{
|
||||
|
||||
byteread=0;
|
||||
if(checkalignement==0)
|
||||
{
|
||||
bytetoread=2;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytetoread=1;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
// attente de 1 ou 2 octets (bytetoread) de synchro.
|
||||
hxc_waitevent(floppycontext,1,2000);
|
||||
if (!getfifostatus_ftdichip(hw_handle,&TxBytes,&RxBytes,&eventftdi))
|
||||
{
|
||||
if((eventftdi&FT_EVENT_RXCHAR) && RxBytes)
|
||||
{
|
||||
byte_read=read_ftdichip(hw_handle,input_buffer,RxBytes);
|
||||
if (byte_read>=0)
|
||||
{
|
||||
if((bytetoread==1 && RxBytes>1) || (bytetoread==2 && RxBytes>2))
|
||||
{
|
||||
// pas le bon nombre d'octet recu
|
||||
// la synchro a ete perdue
|
||||
// on reinitialise l'ensemble
|
||||
ftdierror=1;
|
||||
hw_context->usbstats.synclost++;
|
||||
}
|
||||
byteread=byteread+RxBytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
ftdierror=1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ftdierror=1;
|
||||
}
|
||||
}while(byteread<bytetoread && (ftdierror==0));
|
||||
|
||||
// l'alignement viens juste d'etre verifié
|
||||
// on remet ça dans 5 tours
|
||||
if(checkalignement==0)
|
||||
{
|
||||
checkalignement=5;
|
||||
}
|
||||
|
||||
// stop ou encore ?
|
||||
if(hw_context->stop_emulation)
|
||||
{
|
||||
hw_context->running=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(hw_context->start_emulation)
|
||||
{
|
||||
hw_context->running=1;
|
||||
}
|
||||
}
|
||||
|
||||
if(ftdierror==0)
|
||||
{
|
||||
trackpointer=0;//BytesReceived-1;
|
||||
|
||||
if((input_buffer[trackpointer]&0x80)!=0)
|
||||
{
|
||||
// la tete a bougee
|
||||
headmoved=headmoved|1;
|
||||
}
|
||||
|
||||
current_track=input_buffer[trackpointer]&0x7F;
|
||||
|
||||
// stockage track courante
|
||||
if(hw_context->double_step)
|
||||
{
|
||||
hw_context->current_track=current_track>>1;
|
||||
}
|
||||
else
|
||||
{
|
||||
hw_context->current_track=current_track;
|
||||
}
|
||||
|
||||
if(hw_context->running)
|
||||
{//Mode normal : il y a une image a envoyer
|
||||
|
||||
checkalignement--;
|
||||
|
||||
// recherche des prochaines données a envoyer
|
||||
txbuffersize=FillBuffer(floppycontext,hw_context,srambuffer,&headmoved);
|
||||
|
||||
// recherche d'une zone sans commande au debut
|
||||
// du buffer pour y inserer un commande de
|
||||
// synchro
|
||||
i=2;
|
||||
do
|
||||
{
|
||||
if(iscmd(srambuffer[i]))
|
||||
{
|
||||
i=i+2;
|
||||
}
|
||||
}while((i<txbuffersize) && iscmd(srambuffer[i]));
|
||||
|
||||
|
||||
// une commande de synchro
|
||||
// en debut de buffer
|
||||
srambuffer2[0]=0x33;
|
||||
srambuffer2[1]=current_track;
|
||||
|
||||
if(!checkalignement)
|
||||
{
|
||||
// et si il faut verifier la synchro
|
||||
// une autre commande de synchro
|
||||
// un peu plus loin.
|
||||
memcpy(&srambuffer2[2],srambuffer,i+2);
|
||||
srambuffer2[i+2]=0x33;
|
||||
srambuffer2[i+3]=current_track;
|
||||
memcpy(&srambuffer2[i+4],&srambuffer[i],txbuffersize-(i));
|
||||
bytetowrite=txbuffersize+(2*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&srambuffer2[2],&srambuffer[0],txbuffersize);
|
||||
bytetowrite=txbuffersize+2;
|
||||
}
|
||||
|
||||
// envois du buffer vers la carte
|
||||
if(write_ftdichip(hw_handle,srambuffer2,bytetowrite)<0)
|
||||
{
|
||||
ftdierror=1;
|
||||
}
|
||||
|
||||
// gestion des stats usb
|
||||
hw_context->usbstats.packetsent++;
|
||||
hw_context->usbstats.totalpacketsent++;
|
||||
hw_context->usbstats.totaldataout=hw_context->usbstats.totaldataout+bytetowrite;
|
||||
hw_context->usbstats.dataout=hw_context->usbstats.dataout+bytetowrite;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mode "standby":
|
||||
// pas d'image a envoyer: on fait fonctionner la
|
||||
// carte au ralenti
|
||||
checkalignement--;
|
||||
memset(srambuffer,0,hw_context->usbstats.packetsize);
|
||||
srambuffer[0]=0xDD; // set bitrate
|
||||
srambuffer[1]=0xF0;
|
||||
srambuffer[2]=0x33; // synchro
|
||||
srambuffer[3]=current_track;//hw_context->current_track;;
|
||||
srambuffer[4]=0xAA;
|
||||
|
||||
|
||||
// selection des bon etats pour les signaux ready et diskchg
|
||||
// selon la machine cible
|
||||
floppypin34=0;
|
||||
floppypin2=0;
|
||||
amigaready=0;
|
||||
|
||||
switch(hw_context->interface_mode)
|
||||
{
|
||||
case AMIGA_DD_FLOPPYMODE: // amiga
|
||||
case AMIGA_HD_FLOPPYMODE: // amiga
|
||||
amigaready=1;
|
||||
floppypin34=1;
|
||||
|
||||
if(hw_context->floppychanged)
|
||||
{
|
||||
floppypin2=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
floppypin2=0;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case IBMPC_DD_FLOPPYMODE: // pc / st 720k
|
||||
case ATARIST_DD_FLOPPYMODE:
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
if(hw_context->floppychanged)
|
||||
{
|
||||
floppypin34=1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
floppypin34=0;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case IBMPC_HD_FLOPPYMODE: // pc / st 1.44MB
|
||||
case ATARIST_HD_FLOPPYMODE:
|
||||
amigaready=0;
|
||||
floppypin2=1;
|
||||
|
||||
if(hw_context->floppychanged)
|
||||
{
|
||||
floppypin34=1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
floppypin34=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MSX2_DD_FLOPPYMODE:
|
||||
case CPC_DD_FLOPPYMODE: // cpc / korg dss1
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
floppypin34=1;
|
||||
break;
|
||||
|
||||
|
||||
case GENERIC_SHUGART_DD_FLOPPYMODE:
|
||||
case EMU_SHUGART_FLOPPYMODE:
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
floppypin34=1;
|
||||
break;
|
||||
|
||||
default:
|
||||
amigaready=0;
|
||||
floppypin2=0;
|
||||
floppypin34=1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(hw_context->drive_select_source>3)
|
||||
{
|
||||
floppydisable=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
floppydisable=0;
|
||||
}
|
||||
|
||||
ctrl_byte=((hw_context->drive_select_source&0x3)<<6)|((floppydisable&0x1)<<5) | (amigaready<<4)| (floppypin2<<2)|(floppypin34<<1);
|
||||
|
||||
|
||||
srambuffer[15]=0xCC;
|
||||
srambuffer[16]=ctrl_byte;
|
||||
;
|
||||
if(!checkalignement)
|
||||
srambuffer[8]=0x33; // synchro
|
||||
|
||||
if(write_ftdichip(hw_handle,srambuffer,hw_context->usbstats.packetsize)<0)
|
||||
{
|
||||
ftdierror=1;
|
||||
}
|
||||
hw_context->usbstats.packetsent++;
|
||||
hw_context->usbstats.totalpacketsent++;
|
||||
hw_context->usbstats.totaldataout=hw_context->usbstats.totaldataout+hw_context->usbstats.packetsize;
|
||||
hw_context->usbstats.dataout=hw_context->usbstats.dataout+hw_context->usbstats.packetsize;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}while(!ftdierror);
|
||||
|
||||
|
||||
}while(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HW_CPLDFloppyEmulator_init(HXCFLOPPYEMULATOR* floppycontext,HWINTERFACE * hwif)
|
||||
{
|
||||
int i,j;
|
||||
unsigned char randomvalue;
|
||||
|
||||
floppycontext->hxc_printf(MSG_INFO_0,"Starting CPLDFloppyEmulator Hw manager...");
|
||||
floppycontext->hxc_printf(MSG_INFO_1,"Loading %s...","ftd2xx.dll");
|
||||
|
||||
if(!(ftdi_load_lib (floppycontext)<0))
|
||||
{
|
||||
hwif->hw_handle=0;
|
||||
|
||||
// generation d'une LUT pour le random MFM
|
||||
hwif->randomlut=(unsigned char*)malloc(1024);
|
||||
for(i=0;i<1024;i++)
|
||||
{
|
||||
hwif->randomlut[i]=0;
|
||||
|
||||
for(j=0;j<4;j++)
|
||||
{
|
||||
do
|
||||
{
|
||||
randomvalue=(rand()&3);
|
||||
if(randomvalue>2) randomvalue=randomvalue^(rand()&3);
|
||||
}while(randomvalue>2);
|
||||
hwif->randomlut[i]=hwif->randomlut[i] | (randomvalue<<(j*2));
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////
|
||||
hwif->start_emulation=0;
|
||||
hwif->stop_emulation=0;
|
||||
hwif->drive_select_source=0;
|
||||
|
||||
hxc_createevent(floppycontext,0);
|
||||
hxc_createthread(floppycontext,hwif,&ftdichiplistener,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
floppycontext->hxc_printf(MSG_INFO_0,"Device ok !");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int HW_deinit(HXCFLOPPYEMULATOR* floppycontext)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int InjectFloppyImg(HXCFLOPPYEMULATOR* floppycontext,FLOPPY * floppydisk,HWINTERFACE * hwif)
|
||||
{
|
||||
#define BUFFERSIZE 2*128*1024
|
||||
unsigned int final_buffer_len;
|
||||
unsigned short i;
|
||||
unsigned char * final_buffer;
|
||||
unsigned char * final_randombuffer;
|
||||
|
||||
#ifdef DEBUGVB
|
||||
FILE * fdebug;
|
||||
char fdebug_name[512];
|
||||
#endif
|
||||
|
||||
floppycontext->hxc_printf(MSG_INFO_0,"USB HxCFloppyEmulator :Convert track data...");
|
||||
if(hwif->running)
|
||||
{
|
||||
hwif->start_emulation=0;
|
||||
hwif->stop_emulation=1;
|
||||
do
|
||||
{
|
||||
hxc_pause(16);
|
||||
}while(hwif->running);
|
||||
hwif->stop_emulation=0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(i=0;i<hwif->number_of_track;i++)
|
||||
{
|
||||
free(hwif->precalcusbtrack[i].usbtrack);
|
||||
free(hwif->precalcusbtrack[i].randomusbtrack);
|
||||
}
|
||||
|
||||
//final_buffer=(unsigned char*) malloc(BUFFERSIZE);
|
||||
//final_randombuffer=(unsigned char*) malloc(BUFFERSIZE);
|
||||
hwif->number_of_track=(unsigned char)floppydisk->floppyNumberOfTrack;
|
||||
for(i=0;i<floppydisk->floppyNumberOfTrack;i++)
|
||||
{
|
||||
|
||||
//memset(final_buffer,0,BUFFERSIZE);
|
||||
//memset(final_randombuffer,0,BUFFERSIZE);
|
||||
|
||||
if(floppydisk->tracks[i]->number_of_side==2)
|
||||
{
|
||||
final_buffer_len=GetNewTrackRevolution(floppycontext,
|
||||
floppydisk->tracks[i]->sides[0]->indexbuffer,
|
||||
floppydisk->tracks[i]->sides[0]->databuffer,
|
||||
floppydisk->tracks[i]->sides[0]->tracklen,
|
||||
floppydisk->tracks[i]->sides[1]->databuffer,
|
||||
floppydisk->tracks[i]->sides[1]->tracklen,
|
||||
floppydisk->tracks[i]->sides[0]->flakybitsbuffer,
|
||||
floppydisk->tracks[i]->sides[1]->flakybitsbuffer,
|
||||
floppydisk->tracks[i]->sides[0]->bitrate,
|
||||
floppydisk->tracks[i]->sides[0]->timingbuffer,
|
||||
floppydisk->tracks[i]->sides[1]->bitrate,
|
||||
floppydisk->tracks[i]->sides[1]->timingbuffer,
|
||||
&final_buffer,
|
||||
&final_randombuffer,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
final_buffer_len=GetNewTrackRevolution(floppycontext,
|
||||
floppydisk->tracks[i]->sides[0]->indexbuffer,
|
||||
floppydisk->tracks[i]->sides[0]->databuffer,
|
||||
floppydisk->tracks[i]->sides[0]->tracklen,
|
||||
floppydisk->tracks[i]->sides[0]->databuffer,
|
||||
floppydisk->tracks[i]->sides[0]->tracklen,
|
||||
floppydisk->tracks[i]->sides[0]->flakybitsbuffer,
|
||||
floppydisk->tracks[i]->sides[0]->flakybitsbuffer,
|
||||
floppydisk->tracks[i]->sides[0]->bitrate,
|
||||
floppydisk->tracks[i]->sides[0]->timingbuffer,
|
||||
floppydisk->tracks[i]->sides[0]->bitrate,
|
||||
floppydisk->tracks[i]->sides[0]->timingbuffer,
|
||||
&final_buffer,
|
||||
&final_randombuffer,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
hwif->precalcusbtrack[i].usbtrack=(unsigned char *)malloc(final_buffer_len);
|
||||
hwif->precalcusbtrack[i].randomusbtrack=(unsigned char *)malloc(final_buffer_len);
|
||||
hwif->precalcusbtrack[i].tracklen=final_buffer_len;
|
||||
|
||||
memcpy(hwif->precalcusbtrack[i].usbtrack,final_buffer,final_buffer_len);
|
||||
memcpy(hwif->precalcusbtrack[i].randomusbtrack,final_randombuffer,final_buffer_len);
|
||||
|
||||
|
||||
floppycontext->hxc_printf(MSG_DEBUG,"USB Track %d Size: %d bytes",i,final_buffer_len);
|
||||
|
||||
if(final_randombuffer)
|
||||
free(final_randombuffer);
|
||||
if(final_buffer)
|
||||
free(final_buffer);
|
||||
|
||||
#ifdef DEBUGVB
|
||||
sprintf(fdebug_name,"usb_track_%d.bin",i);
|
||||
fdebug=(FILE*) fopen(fdebug_name,"w+b");
|
||||
if(fdebug)
|
||||
{
|
||||
fwrite(hwif->precalcusbtrack[i].usbtrack,1,final_buffer_len,fdebug);
|
||||
fclose(fdebug);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
hwif->interface_mode=(unsigned char)floppydisk->floppyiftype;
|
||||
hwif->floppychanged=1;
|
||||
|
||||
|
||||
|
||||
floppycontext->hxc_printf(MSG_INFO_0,"Starting emulation...");
|
||||
hwif->start_emulation=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
#define NEXTPACKET_EVENT 0x1
|
||||
#define TRACKCHANGED_EVENT 0x2
|
||||
#define INCOMINGPACKET_EVENT 0x4
|
||||
|
||||
#define STATUS_ERROR 0
|
||||
#define STATUS_LOOKINGFOR 1
|
||||
#define STATUS_ONLINE 2
|
||||
|
||||
|
||||
typedef struct _USBStats
|
||||
{
|
||||
unsigned long totaldataout;
|
||||
unsigned long dataout;
|
||||
|
||||
unsigned long synclost;
|
||||
|
||||
unsigned long packetsize;
|
||||
unsigned long totalpacketsent;
|
||||
unsigned long packetsent;
|
||||
|
||||
}USBStats;
|
||||
|
||||
typedef struct usbtrack_
|
||||
{
|
||||
unsigned char * usbtrack;
|
||||
unsigned char * randomusbtrack;
|
||||
unsigned long tracklen;
|
||||
}usbtrack;
|
||||
|
||||
typedef struct HWINTERFACE_
|
||||
{
|
||||
USBStats usbstats;
|
||||
|
||||
unsigned char number_of_track;
|
||||
usbtrack precalcusbtrack[256];
|
||||
|
||||
unsigned char *randomlut;
|
||||
unsigned long hw_handle;
|
||||
|
||||
unsigned char interface_mode;
|
||||
unsigned int drive_select_source;
|
||||
unsigned char double_step;
|
||||
|
||||
unsigned char current_track;
|
||||
|
||||
// unsigned char floppyloaded;
|
||||
unsigned char floppychanged;
|
||||
|
||||
unsigned long trackbuffer_pos;
|
||||
|
||||
unsigned char start_emulation;
|
||||
unsigned char stop_emulation;
|
||||
unsigned char running;
|
||||
|
||||
unsigned char status; // 0 -> error 1->lookingfor 2->online
|
||||
|
||||
|
||||
}HWINTERFACE;
|
||||
|
||||
int HW_CPLDFloppyEmulator_init(HXCFLOPPYEMULATOR* floppycontext,HWINTERFACE * hwif);
|
||||
int HW_deinit(HXCFLOPPYEMULATOR* floppycontext);
|
||||
int InjectFloppyImg(HXCFLOPPYEMULATOR* floppycontext,FLOPPY * floppydisk,HWINTERFACE * hwif);
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Jean-François DEL NERO
|
||||
//
|
||||
// This file is part of HxCFloppyEmulator.
|
||||
//
|
||||
// HxCFloppyEmulator may be used and distributed without restriction provided
|
||||
// that this copyright statement is not removed from the file and that any
|
||||
// derivative work contains the original copyright notice and the associated
|
||||
// disclaimer.
|
||||
//
|
||||
// HxCFloppyEmulator 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.
|
||||
//
|
||||
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
*/
|
||||
#define FLOPPYEMUFREQ 16000000
|
||||
|
||||
typedef struct trackzone_
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
unsigned long bitrate;
|
||||
|
||||
unsigned char code1;
|
||||
unsigned int code1lenint;
|
||||
|
||||
unsigned char code2;
|
||||
unsigned int code2lenint;
|
||||
|
||||
}trackzone;
|
||||
|
||||
typedef struct trackpart_
|
||||
{
|
||||
unsigned char code;
|
||||
int len;
|
||||
}trackpart;
|
||||
|
||||
#define GRANULA 64
|
||||
|
||||
int GetNewTrackRevolution(HXCFLOPPYEMULATOR* floppycontext,unsigned char * index_h0,unsigned char * datah0,unsigned int lendatah0,unsigned char * datah1,unsigned int lendatah1,unsigned char * randomh0,unsigned char * randomh1,long fixedbitrateh0,unsigned long * timeh0,long fixedbitrateh1,unsigned long * timeh1,unsigned char ** finalbuffer,unsigned char ** randomfinalbuffer,unsigned char readysignal,unsigned char diskchange,unsigned char writeprotect,unsigned char amigaready,unsigned char selectconfig);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user