mirror of
https://github.com/thead-yocto-mirror/vpu-vc8000e-kernel
synced 2026-06-21 09:02:38 +02:00
Linux_SDK_V0.9.5
This commit is contained in:
30
.gitignore
vendored
Normal file
30
.gitignore
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/.auto.deps
|
||||
/.config.cmd
|
||||
/.config.old
|
||||
/..config.tmp
|
||||
/.config
|
||||
/.vscode
|
||||
*.tmp
|
||||
*.depend
|
||||
*.o
|
||||
*.a
|
||||
*.o.d
|
||||
*.o.cmd
|
||||
*.a.cmd
|
||||
*.ko.cmd
|
||||
*.ko
|
||||
*.mod
|
||||
*.mod.c
|
||||
*.mod.cmd
|
||||
*.order
|
||||
*.orig
|
||||
*.so
|
||||
*.symvers.cmd
|
||||
*.order.cmd
|
||||
.version
|
||||
Module.symvers
|
||||
out/
|
||||
output/
|
||||
obj/
|
||||
dependencies/
|
||||
bin/
|
||||
674
COPYING
Normal file
674
COPYING
Normal file
@@ -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>.
|
||||
85
Makefile
Normal file
85
Makefile
Normal file
@@ -0,0 +1,85 @@
|
||||
##
|
||||
# Copyright (C) 2020 Alibaba Group Holding Limited
|
||||
##
|
||||
ifneq ($(wildcard ../.param),)
|
||||
include ../.param
|
||||
endif
|
||||
|
||||
#CONFIG_DEBUG_MODE=1
|
||||
CONFIG_OUT_ENV=hwlinux
|
||||
|
||||
CONFIG_BUILD_DRV_EXTRA_PARAM:=""
|
||||
|
||||
DIR_TARGET_BASE=bsp/venc
|
||||
DIR_TARGET_KO =bsp/venc/ko
|
||||
|
||||
MODULE_NAME=VENC
|
||||
BUILD_LOG_START="\033[47;30m>>> $(MODULE_NAME) $@ begin\033[0m"
|
||||
BUILD_LOG_END ="\033[47;30m<<< $(MODULE_NAME) $@ end\033[0m"
|
||||
|
||||
#
|
||||
# Do a parallel build with multiple jobs, based on the number of CPUs online
|
||||
# in this system: 'make -j8' on a 8-CPU system, etc.
|
||||
#
|
||||
# (To override it, run 'make JOBS=1' and similar.)
|
||||
#
|
||||
|
||||
ifeq ($(JOBS),)
|
||||
JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
|
||||
ifeq ($(JOBS),)
|
||||
JOBS := 1
|
||||
endif
|
||||
endif
|
||||
|
||||
all: info driver install_local_output
|
||||
.PHONY: info driver install_local_output install_prepare clean_driver clean_output clean
|
||||
|
||||
info:
|
||||
@echo $(BUILD_LOG_START)
|
||||
@echo " ====== Build Info from repo project ======"
|
||||
@echo " BUILDROOT_DIR="$(BUILDROOT_DIR)
|
||||
@echo " CROSS_COMPILE="$(CROSS_COMPILE)
|
||||
@echo " LINUX_DIR="$(LINUX_DIR)
|
||||
@echo " ARCH="$(ARCH)
|
||||
@echo " BOARD_NAME="$(BOARD_NAME)
|
||||
@echo " KERNEL_ID="$(KERNELVERSION)
|
||||
@echo " KERNEL_DIR="$(LINUX_DIR)
|
||||
@echo " INSTALL_DIR_ROOTFS="$(INSTALL_DIR_ROOTFS)
|
||||
@echo " INSTALL_DIR_SDK="$(INSTALL_DIR_SDK)
|
||||
@echo " ====== Build configuration by settings ======"
|
||||
# @echo " CONFIG_DEBUG_MODE="$(CONFIG_DEBUG_MODE)
|
||||
@echo " CONFIG_OUT_ENV="$(CONFIG_OUT_ENV)
|
||||
@echo " JOBS="$(JOBS)
|
||||
@echo $(BUILD_LOG_END)
|
||||
|
||||
driver:
|
||||
@echo $(BUILD_LOG_START)
|
||||
make -C linux/kernel_module KDIR=$(LINUX_DIR) ARCH=$(ARCH)
|
||||
@echo $(BUILD_LOG_END)
|
||||
|
||||
clean_driver:
|
||||
@echo $(BUILD_LOG_START)
|
||||
make -C linux/kernel_module KDIR=$(LINUX_DIR) clean
|
||||
@echo $(BUILD_LOG_END)
|
||||
|
||||
install_prepare:
|
||||
mkdir -p ./output/rootfs/$(DIR_TARGET_KO)
|
||||
|
||||
install_local_output: install_prepare driver
|
||||
@echo $(BUILD_LOG_START)
|
||||
find ./linux -name "*.ko" | xargs -i cp -f {} ./output/rootfs/$(DIR_TARGET_KO)
|
||||
cp -f ./linux/kernel_module/driver_load.sh ./output/rootfs/$(DIR_TARGET_KO)
|
||||
chmod +x ./output/rootfs/$(DIR_TARGET_KO)/*.sh
|
||||
echo "vc8000" > ./output/rootfs/$(DIR_TARGET_KO)/vc8000e.conf
|
||||
@if [ `command -v tree` != "" ]; then \
|
||||
tree ./output/rootfs; \
|
||||
fi
|
||||
@echo $(BUILD_LOG_END)
|
||||
|
||||
clean_output:
|
||||
@echo $(BUILD_LOG_START)
|
||||
rm -rf ./output
|
||||
@echo $(BUILD_LOG_END)
|
||||
|
||||
clean: clean_output clean_driver
|
||||
|
||||
204
linux/kernel_module/Makefile
Executable file
204
linux/kernel_module/Makefile
Executable file
@@ -0,0 +1,204 @@
|
||||
#############################################################################
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2014 - 2021 VERISILICON
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# The GPL License (GPL)
|
||||
#
|
||||
# Copyright (C) 2014 - 2021 VERISILICON
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Note: This software is released under dual MIT and GPL licenses. A
|
||||
# recipient may use this file under the terms of either the MIT license or
|
||||
# GPL License. If you wish to use only one license not the other, you can
|
||||
# indicate your decision by deleting one of the above license notices in your
|
||||
# version of this file.
|
||||
#
|
||||
##############################################################################
|
||||
ARM_CROSS_COMPILE ?= n
|
||||
|
||||
ifeq ($(ARM_CROSS_COMPILE),y)
|
||||
export ARCH=arm64
|
||||
export CROSS_COMPILE=/opt/kmb/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-
|
||||
KDIR := /home/vsi/kmb-evm/kernel/mainline-tracking
|
||||
endif
|
||||
|
||||
SUPPORT_MMU = y
|
||||
SUPPORT_AXIFE = n
|
||||
SUPPORT_VCMD_ENABLE_IP = n
|
||||
|
||||
ifeq ($(obj),)
|
||||
obj = .
|
||||
endif
|
||||
|
||||
#################################################
|
||||
# configuration
|
||||
|
||||
MDIR := hantro
|
||||
|
||||
# drivers objects
|
||||
# list-multi := hantro_mmu.o
|
||||
|
||||
# # what to build
|
||||
|
||||
vc8000-objs := vc8000_driver.o vc8000_vcmd_driver.o bidirect_list.o vcmdswhwregisters.o vc8000_normal_driver.o
|
||||
obj-m += vc8000.o
|
||||
|
||||
ifeq ($(strip $(SUPPORT_MMU)),y)
|
||||
vc8000-objs += hantro_mmu.o
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(SUPPORT_AXIFE)),y)
|
||||
vc8000-objs += vc8000_axife.o
|
||||
endif
|
||||
|
||||
tardest := .
|
||||
|
||||
#################################################
|
||||
# compile modules
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
# recursive call from kernel build system
|
||||
dummy := $(shell echo $(KERNELRELEASE) > $(obj)/.version)
|
||||
|
||||
ifeq ($(VERSION).$(PATCHLEVEL),2.6)
|
||||
export-objs :=
|
||||
list-multi :=
|
||||
else
|
||||
multi-m := $(filter $(list-multi), $(obj-m))
|
||||
int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
|
||||
export-objs := $(filter $(int-m) $(obj-m),$(export-objs))
|
||||
endif
|
||||
|
||||
CC += -I$(obj)
|
||||
EXTRA_CFLAGS += -g
|
||||
|
||||
# Print debugging messages from the device
|
||||
#EXTRA_CFLAGS += -DHANTRO_DRIVER_DEBUG
|
||||
|
||||
#EXTRA_CFLAGS += -DHANTROMMU_DEBUG
|
||||
#EXTRA_CFLAGS += -DDYNAMIC_MALLOC_VCMDNODE
|
||||
|
||||
snapshot := $(wildcard $(obj)/.snapshot)
|
||||
ifneq ($(snapshot),)
|
||||
SNAPSHOT_CFLAGS := -DSNAPSHOT='$(shell cat $(snapshot))'
|
||||
EXTRA_CFLAGS += $(SNAPSHOT_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(SUPPORT_MMU)),y)
|
||||
EXTRA_CFLAGS += -DHANTROMMU_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(SUPPORT_AXIFE)),y)
|
||||
EXTRA_CFLAGS += -DHANTROAXIFE_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(SUPPORT_VCMD_ENABLE_IP)),y)
|
||||
EXTRA_CFLAGS += -DHANTROVCMD_ENABLE_IP_SUPPORT
|
||||
endif
|
||||
|
||||
-include $(TOPDIR)/Rules.make
|
||||
else
|
||||
# take version info from last module build if available
|
||||
KERNELRELEASE := $(shell cat $(obj)/.version 2>/dev/null || uname -r)
|
||||
endif
|
||||
ifneq ($(ARM_CROSS_COMPILE),y)
|
||||
KDIR_BASE := /afs/hantro.com/projects/Testing/Board_Version_Control
|
||||
|
||||
#KDIR := $(KDIR_BASE)/Realview_EB/SW/Linux/v0_0/linux-2.6.19-arm2
|
||||
#KDIR := $(KDIR_BASE)/Realview_EB/SW/Linux/linux-2.6.21-arm1/v0_0/linux-2.6.21-arm1
|
||||
#KDIR := $(KDIR_BASE)/Realview_PB/PB926EJS/SW/Linux/linux-2.6.24-arm2-spnlck/v0_1/linux-2.6.24-arm2-spnlck
|
||||
#KDIR := $(KDIR_BASE)/Realview_PB/PB926EJS/SW/Linux/linux-2.6.28-arm1/v0_1/linux-2.6.28-arm1
|
||||
#KDIR := $(KDIR_BASE)/SW_Common/ARM_realview_v6/2.6.28-arm1/v0_1-v6/linux-2.6.28-arm1
|
||||
|
||||
KVER := $(shell uname -r)
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
PWD := $(shell pwd)
|
||||
DEST := /lib/modules/$(KERNELRELEASE)/$(MDIR)
|
||||
|
||||
# which files to install?
|
||||
inst-m := $(wildcard *.ko)
|
||||
ifeq ($(inst-m),)
|
||||
inst-m := $(obj-m)
|
||||
endif
|
||||
|
||||
# locales seem to cause trouble sometimes.
|
||||
LC_ALL = POSIX
|
||||
export LC_ALL
|
||||
|
||||
default::
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) modules
|
||||
|
||||
install::
|
||||
strip --strip-debug $(inst-m)
|
||||
-su -c "mkdir -p $(DEST); cp -v $(inst-m) $(DEST); depmod -a"
|
||||
|
||||
clean::
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) clean
|
||||
-rm -f .version
|
||||
|
||||
#################################################
|
||||
# build tarballs
|
||||
|
||||
thisdir := $(notdir $(PWD))
|
||||
name := $(shell echo $(thisdir) | sed 's/-.*//')
|
||||
ver := $(shell echo $(thisdir) | sed 's/.*-//')
|
||||
date := $(shell date +%Y%m%d)
|
||||
tardest ?= .
|
||||
|
||||
snapdir := $(HOME)/snapshot
|
||||
snap ?= $(name)
|
||||
|
||||
release: clean
|
||||
rm -f .snapshot
|
||||
(cd ..; tar cvzf $(tardest)/$(name)-$(ver).tar.gz $(thisdir))
|
||||
|
||||
snapshot snap tarball: clean
|
||||
echo $(date) > .snapshot
|
||||
(cd ..; tar czf $(snapdir)/$(snap)-$(date).tar.gz $(thisdir))
|
||||
$(MAKE) -C $(snapdir)
|
||||
|
||||
#################################################
|
||||
# other stuff
|
||||
|
||||
%.asm: %.o
|
||||
objdump -S $< > $@
|
||||
|
||||
42
linux/kernel_module/README
Executable file
42
linux/kernel_module/README
Executable file
@@ -0,0 +1,42 @@
|
||||
|
||||
-- BUILD --
|
||||
|
||||
You need a fully configured kernel source tree in order to build the
|
||||
driver. Please set the location of the kernel tree in the Makefile (KDIR).
|
||||
If you want some extra debug information in the kernel logs, you could
|
||||
define the HANTRO_DRIVER_DEBUG but please be aware that allot of things are traced
|
||||
with this option.
|
||||
Also you could set a particular device MAJOR in the 'vc8000_normal_driver.c' and 'vc8000_vcmd_driver.c'
|
||||
if you don't want dynamic allocation.
|
||||
|
||||
Just run in this dir:
|
||||
|
||||
%make
|
||||
|
||||
If you want to install the modules please check first the install destination
|
||||
in the Makefile (MDIR, DEST) and run:
|
||||
|
||||
%make install
|
||||
|
||||
-- USAGE --
|
||||
|
||||
Run script driver_load.sh to do all the things described below.
|
||||
> sh driver_load.sh vcmd=0
|
||||
|
||||
First of all the module has to be inserted into the kernel with:
|
||||
(you need a Linux shell cmd line)
|
||||
|
||||
%insmod vc8000.ko vcmd_supported=1
|
||||
|
||||
Second of all a char device file has to be created:
|
||||
|
||||
%mknod /dev/vc8000 c $MAJOR 0
|
||||
|
||||
Replace MAJOR = 254 with the correct value (i.e. read /proc/devices to find out
|
||||
the exact value).
|
||||
|
||||
Make sure that you have RW rights for the newly created dev file (use 'chmod').
|
||||
|
||||
The 'driver_load' script is provided for preparing all the things necessary for
|
||||
the driver to be usable. The script is using 'cat' to retrieve the device's
|
||||
major from /proc/devices. Remember to set the driver parameters.
|
||||
222
linux/kernel_module/bidirect_list.c
Normal file
222
linux/kernel_module/bidirect_list.c
Normal file
@@ -0,0 +1,222 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifdef __FREERTOS__
|
||||
#include <string.h>
|
||||
#include "osal.h"
|
||||
#elif defined(__linux__)
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
/* needed for __init,__exit directives */
|
||||
#include <linux/init.h>
|
||||
/* needed for remap_page_range
|
||||
SetPageReserved
|
||||
ClearPageReserved
|
||||
*/
|
||||
#include <linux/mm.h>
|
||||
/* obviously, for kmalloc */
|
||||
#include <linux/slab.h>
|
||||
/* for struct file_operations, register_chrdev() */
|
||||
#include <linux/fs.h>
|
||||
/* standard error codes */
|
||||
#include <linux/errno.h>
|
||||
|
||||
#include <linux/moduleparam.h>
|
||||
/* request_irq(), free_irq() */
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#include <linux/semaphore.h>
|
||||
#include <linux/spinlock.h>
|
||||
/* needed for virt_to_phys() */
|
||||
#include <asm/io.h>
|
||||
#include <linux/pci.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/ioport.h>
|
||||
|
||||
#include <asm/irq.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/timer.h>
|
||||
#else //For other os
|
||||
//TODO...
|
||||
#endif
|
||||
#include "bidirect_list.h"
|
||||
|
||||
void init_bi_list(bi_list* list)
|
||||
{
|
||||
list->head = NULL;
|
||||
list->tail = NULL;
|
||||
}
|
||||
|
||||
bi_list_node* bi_list_create_node(void)
|
||||
{
|
||||
bi_list_node* node=NULL;
|
||||
node=(bi_list_node*)vmalloc(sizeof(bi_list_node));
|
||||
if(node==NULL)
|
||||
{
|
||||
PDEBUG ("%s\n","vmalloc for node fail!");
|
||||
return node;
|
||||
}
|
||||
memset(node,0,sizeof(bi_list_node));
|
||||
return node;
|
||||
}
|
||||
void bi_list_free_node(bi_list_node* node)
|
||||
{
|
||||
//free current node
|
||||
vfree(node);
|
||||
return;
|
||||
}
|
||||
|
||||
void bi_list_insert_node_tail(bi_list* list,bi_list_node* current_node)
|
||||
{
|
||||
if(current_node==NULL)
|
||||
{
|
||||
PDEBUG ("%s\n","insert node tail NULL");
|
||||
return;
|
||||
}
|
||||
if(list->tail)
|
||||
{
|
||||
current_node->previous=list->tail;
|
||||
list->tail->next=current_node;
|
||||
list->tail=current_node;
|
||||
list->tail->next=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->head=current_node;
|
||||
list->tail=current_node;
|
||||
current_node->next=NULL;
|
||||
current_node->previous=NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void bi_list_insert_node_before(bi_list* list,bi_list_node* base_node,bi_list_node* new_node)
|
||||
{
|
||||
bi_list_node* temp_node_previous=NULL;
|
||||
if(new_node==NULL)
|
||||
{
|
||||
PDEBUG ("%s\n","insert node before new node NULL");
|
||||
return;
|
||||
}
|
||||
if(base_node)
|
||||
{
|
||||
if(base_node->previous)
|
||||
{
|
||||
//at middle position
|
||||
temp_node_previous = base_node->previous;
|
||||
temp_node_previous->next=new_node;
|
||||
new_node->next = base_node;
|
||||
base_node->previous = new_node;
|
||||
new_node->previous=temp_node_previous;
|
||||
}
|
||||
else
|
||||
{
|
||||
//at head
|
||||
base_node->previous = new_node;
|
||||
new_node->next = base_node;
|
||||
list->head=new_node;
|
||||
new_node->previous = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//at tail
|
||||
bi_list_insert_node_tail(list,new_node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void bi_list_remove_node(bi_list* list,bi_list_node* current_node)
|
||||
{
|
||||
bi_list_node* temp_node_previous=NULL;
|
||||
bi_list_node* temp_node_next=NULL;
|
||||
if(current_node==NULL)
|
||||
{
|
||||
PDEBUG ("%s\n","remove node NULL");
|
||||
return;
|
||||
}
|
||||
temp_node_next=current_node->next;
|
||||
temp_node_previous=current_node->previous;
|
||||
|
||||
if(temp_node_next==NULL && temp_node_previous==NULL )
|
||||
{
|
||||
//there is only one node.
|
||||
list->head=NULL;
|
||||
list->tail=NULL;
|
||||
}
|
||||
else if(temp_node_next==NULL)
|
||||
{
|
||||
//at tail
|
||||
list->tail=temp_node_previous;
|
||||
temp_node_previous->next=NULL;
|
||||
}
|
||||
else if( temp_node_previous==NULL)
|
||||
{
|
||||
//at head
|
||||
list->head=temp_node_next;
|
||||
temp_node_next->previous=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
//at middle position
|
||||
temp_node_previous->next=temp_node_next;
|
||||
temp_node_next->previous=temp_node_previous;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
116
linux/kernel_module/bidirect_list.h
Normal file
116
linux/kernel_module/bidirect_list.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _BIDIRECT_LIST_H_
|
||||
#define _BIDIRECT_LIST_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __FREERTOS__
|
||||
#include "dev_common_freertos.h" /* needed for the _IOW etc stuff used later */
|
||||
#elif defined(__linux__)
|
||||
#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */
|
||||
#else //For other os
|
||||
//TODO...
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros to help debugging
|
||||
*/
|
||||
|
||||
#undef PDEBUG /* undef it, just in case */
|
||||
#ifdef BIDIRECTION_LIST_DEBUG
|
||||
# ifdef __KERNEL__
|
||||
/* This one if debugging is on, and kernel space */
|
||||
# define PDEBUG(fmt, args...) printk( KERN_INFO "hmp4e: " fmt, ## args)
|
||||
# else
|
||||
/* This one for user space */
|
||||
# define PDEBUG(fmt, args...) printf(__FILE__ ":%d: " fmt, __LINE__ , ## args)
|
||||
# endif
|
||||
#else
|
||||
# define PDEBUG(fmt, args...) /* not debugging: nothing */
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************************\
|
||||
* <Typedefs>
|
||||
\**********************************************************************************************************************************************/
|
||||
typedef struct bi_list_node{
|
||||
void* data;
|
||||
struct bi_list_node* next;
|
||||
struct bi_list_node* previous;
|
||||
}bi_list_node;
|
||||
typedef struct bi_list{
|
||||
bi_list_node* head;
|
||||
bi_list_node* tail;
|
||||
}bi_list;
|
||||
|
||||
void init_bi_list(bi_list* list);
|
||||
|
||||
bi_list_node* bi_list_create_node(void);
|
||||
|
||||
void bi_list_free_node(bi_list_node* node);
|
||||
|
||||
void bi_list_insert_node_tail(bi_list* list,bi_list_node* current_node);
|
||||
|
||||
void bi_list_insert_node_before(bi_list* list,bi_list_node* base_node,bi_list_node* new_node);
|
||||
|
||||
void bi_list_remove_node(bi_list* list,bi_list_node* current_node);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_BIDIRECT_LIST_H_ */
|
||||
61
linux/kernel_module/driver_load.sh
Executable file
61
linux/kernel_module/driver_load.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
#dmesg -C
|
||||
module="vc8000"
|
||||
device="/dev/vc8000"
|
||||
mode="666"
|
||||
#Used to setup default parameters
|
||||
DefaultParameter(){
|
||||
vcmd=1
|
||||
#default value can be added to here
|
||||
}
|
||||
echo
|
||||
|
||||
if [ ! -e /dev ]
|
||||
then
|
||||
mkdir /dev/
|
||||
fi
|
||||
echo "Help information:"
|
||||
echo "Input format should be like as below"
|
||||
echo "./driver_load.sh vcmd=0(default) or (1)"
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
DefaultParameter
|
||||
echo " Default vcmd_supported value = $vcmd"
|
||||
else
|
||||
para_1="$1"
|
||||
vcmd_input=${para_1##*=}
|
||||
vcmd=$vcmd_input
|
||||
if [ $vcmd -ne 0 ] && [ $vcmd -ne 1 ]
|
||||
then
|
||||
echo "Invalid vcmd_supported value, which = $vcmd"
|
||||
echo "vcmd_supported should be 0 or 1"
|
||||
fi
|
||||
echo "vcmd_supported = $vcmd"
|
||||
fi
|
||||
#vcmd_supported = 0(default) or 1
|
||||
#insert module
|
||||
insmod $module.ko vcmd_supported=$vcmd || exit 1
|
||||
#insmod $module.ko vcmd_supported=1 || exit 1
|
||||
|
||||
echo "module $module inserted"
|
||||
|
||||
#remove old nod
|
||||
rm -f $device
|
||||
|
||||
#read the major asigned at loading time
|
||||
major=`cat /proc/devices | grep $module | cut -c1-3`
|
||||
|
||||
echo "$module major = $major"
|
||||
|
||||
#create dev node
|
||||
mknod $device c $major 0
|
||||
|
||||
echo "node $device created"
|
||||
|
||||
#give all 'rw' access
|
||||
chmod $mode $device
|
||||
|
||||
echo "set node access to $mode"
|
||||
|
||||
#the end
|
||||
echo
|
||||
1896
linux/kernel_module/hantro_mmu.c
Executable file
1896
linux/kernel_module/hantro_mmu.c
Executable file
File diff suppressed because it is too large
Load Diff
155
linux/kernel_module/hantrommu.h
Executable file
155
linux/kernel_module/hantrommu.h
Executable file
@@ -0,0 +1,155 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _HANTROMMU_H_
|
||||
#define _HANTROMMU_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __FREERTOS__
|
||||
#elif defined(__linux__)
|
||||
#include <linux/fs.h>
|
||||
#endif
|
||||
|
||||
#define REGION_IN_START 0x0
|
||||
#define REGION_IN_END 0x0
|
||||
#define REGION_OUT_START 0x0
|
||||
#define REGION_OUT_END 0x0
|
||||
#define REGION_PRIVATE_START 0x0
|
||||
#define REGION_PRIVATE_END 0x0
|
||||
|
||||
#define REGION_IN_MMU_START 0x1000
|
||||
#define REGION_IN_MMU_END 0x40002000
|
||||
#define REGION_OUT_MMU_START 0x40002000
|
||||
#define REGION_OUT_MMU_END 0x40002000
|
||||
#define REGION_PRIVATE_MMU_START 0x40002000
|
||||
#define REGION_PRIVATE_MMU_END 0x40002000
|
||||
|
||||
#define MMU_REG_OFFSET 0
|
||||
#define MMU_REG_HW_ID (MMU_REG_OFFSET + 6*4)
|
||||
#define MMU_REG_FLUSH (MMU_REG_OFFSET + 97*4)
|
||||
#define MMU_REG_PAGE_TABLE_ID (MMU_REG_OFFSET + 107*4)
|
||||
#define MMU_REG_CONTROL (MMU_REG_OFFSET + 226*4)
|
||||
#define MMU_REG_ADDRESS (MMU_REG_OFFSET + 227*4)
|
||||
#define MMU_REG_ADDRESS_MSB (MMU_REG_OFFSET + 228*4)
|
||||
|
||||
#define MTLB_PCIE_START_ADDRESS 0x00100000
|
||||
#define PAGE_PCIE_START_ADDRESS 0x00200000 /* page_table_entry start address */
|
||||
#define STLB_PCIE_START_ADDRESS 0x00300000
|
||||
#define PAGE_TABLE_ENTRY_SIZE 64
|
||||
|
||||
enum MMUStatus {
|
||||
MMU_STATUS_OK = 0,
|
||||
|
||||
MMU_STATUS_FALSE = -1,
|
||||
MMU_STATUS_INVALID_ARGUMENT = -2,
|
||||
MMU_STATUS_INVALID_OBJECT = -3,
|
||||
MMU_STATUS_OUT_OF_MEMORY = -4,
|
||||
MMU_STATUS_NOT_FOUND = -19,
|
||||
};
|
||||
|
||||
struct addr_desc {
|
||||
void *virtual_address; /* buffer virtual address */
|
||||
unsigned int bus_address; /* buffer physical address */
|
||||
unsigned int size; /* physical size */
|
||||
};
|
||||
|
||||
struct kernel_addr_desc {
|
||||
unsigned long long bus_address; /* buffer virtual address */
|
||||
unsigned int mmu_bus_address; /* buffer physical address in MMU*/
|
||||
unsigned int size; /* physical size */
|
||||
};
|
||||
|
||||
|
||||
#define HANTRO_IOC_MMU 'm'
|
||||
|
||||
#define HANTRO_IOCS_MMU_MEM_MAP _IOWR(HANTRO_IOC_MMU, 1, struct addr_desc *)
|
||||
#define HANTRO_IOCS_MMU_MEM_UNMAP _IOWR(HANTRO_IOC_MMU, 2, struct addr_desc *)
|
||||
#define HANTRO_IOCS_MMU_ENABLE _IOWR(HANTRO_IOC_MMU, 3, unsigned int *)
|
||||
#define HANTRO_IOCS_MMU_FLUSH _IOWR(HANTRO_IOC_MMU, 4, unsigned int *)
|
||||
#define HANTRO_IOC_MMU_MAXNR 4
|
||||
|
||||
#define MAX_SUBSYS_NUM 4 /* up to 4 subsystem (temporary) */
|
||||
#define HXDEC_MAX_CORES MAX_SUBSYS_NUM /* used in hantro_dec.c */
|
||||
|
||||
/* Init MMU, should be called in driver init function. */
|
||||
enum MMUStatus MMUInit(volatile unsigned char *hwregs);
|
||||
/* Clean up all data in MMU, should be called in driver cleanup function
|
||||
when rmmod driver*/
|
||||
enum MMUStatus MMUCleanup(volatile unsigned char *hwregs[MAX_SUBSYS_NUM][2]);
|
||||
/* The function should be called in driver realease function
|
||||
when driver exit unnormally */
|
||||
enum MMUStatus MMURelease(void *filp, volatile unsigned char *hwregs);
|
||||
|
||||
enum MMUStatus MMUEnable(volatile unsigned char *hwregs[MAX_SUBSYS_NUM][2]);
|
||||
|
||||
/* Used in kernel to map buffer */
|
||||
enum MMUStatus MMUKernelMemNodeMap(struct kernel_addr_desc *addr);
|
||||
|
||||
/* Used in kernel to unmap buffer */
|
||||
enum MMUStatus MMUKernelMemNodeUnmap(struct kernel_addr_desc *addr);
|
||||
|
||||
unsigned long long GetMMUAddress(void);
|
||||
long MMUIoctl(unsigned int cmd, void *filp, unsigned long arg,
|
||||
volatile unsigned char *hwregs[MAX_SUBSYS_NUM][2]);
|
||||
|
||||
void MMURestore(volatile unsigned char *hwregs[MAX_SUBSYS_NUM][2]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
99
linux/kernel_module/vc8000_axife.c
Normal file
99
linux/kernel_module/vc8000_axife.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/sched.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
#include <linux/dma-map-ops.h>
|
||||
#else
|
||||
#include <linux/dma-contiguous.h>
|
||||
#endif
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/dma-buf.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include "vc8000_axife.h"
|
||||
/* mode description
|
||||
* 1: OYB normal(enable)
|
||||
* 2: bypass
|
||||
*/
|
||||
u32 AXIFEEnable(volatile u8 *hwregs, u32 mode) {
|
||||
#ifndef HANTROVCMD_ENABLE_IP_SUPPORT
|
||||
if (!hwregs) return -1;
|
||||
|
||||
//AXI FE pass through
|
||||
if(mode == 1)
|
||||
{
|
||||
iowrite32(0x02, (void *)(hwregs+AXI_REG10_SW_FRONTEND_EN));
|
||||
iowrite32(0x00, (void *)(hwregs+AXI_REG11_SW_WORK_MODE));
|
||||
}
|
||||
else if(mode == 2)
|
||||
{
|
||||
iowrite32(0x02, (void *)(hwregs+AXI_REG10_SW_FRONTEND_EN));
|
||||
iowrite32(0x40, (void *)(hwregs+AXI_REG11_SW_WORK_MODE));
|
||||
}
|
||||
printk(KERN_INFO "AXIFEEnable: axife_reg10_addr=0x%p, *axife_reg10_addr=0x%08x\n", hwregs + 10*4, ioread32((void *)(hwregs + 10*4)));
|
||||
printk(KERN_INFO "AXIFEEnable: axife_reg11_addr=0x%p, *axife_reg11_addr=0x%08x\n", hwregs + 11*4, ioread32((void *)(hwregs + 11*4)));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
77
linux/kernel_module/vc8000_axife.h
Normal file
77
linux/kernel_module/vc8000_axife.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __VC8000_AXIFE_H__
|
||||
#define __VC8000_AXIFE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __FREERTOS__
|
||||
#elif defined(__linux__)
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
|
||||
#define AXI_REG10_SW_FRONTEND_EN 10*4 //0x28
|
||||
#define AXI_REG11_SW_WORK_MODE 11*4 //0x2c
|
||||
|
||||
u32 AXIFEEnable(volatile u8 *hwregs, u32 mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
102
linux/kernel_module/vc8000_driver.c
Normal file
102
linux/kernel_module/vc8000_driver.c
Normal file
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/version.h>
|
||||
#include "vc8000_driver.h"
|
||||
|
||||
static u32 vcmd_supported = 1;
|
||||
int __init hantroenc_normal_init(void);
|
||||
int __init hantroenc_vcmd_init(void);
|
||||
void __exit hantroenc_normal_cleanup(void);
|
||||
void __exit hantroenc_vcmd_cleanup(void);
|
||||
|
||||
int __init hantroenc_init(void)
|
||||
{
|
||||
if(vcmd_supported==0)
|
||||
{
|
||||
return hantroenc_normal_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
return hantroenc_vcmd_init();
|
||||
}
|
||||
}
|
||||
|
||||
void __exit hantroenc_cleanup(void)
|
||||
{
|
||||
if(vcmd_supported==0)
|
||||
{
|
||||
hantroenc_normal_cleanup();
|
||||
}
|
||||
else
|
||||
{
|
||||
hantroenc_vcmd_cleanup();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
module_init(hantroenc_init);
|
||||
module_exit(hantroenc_cleanup);
|
||||
module_param(vcmd_supported,uint,0);
|
||||
|
||||
/* module description */
|
||||
/*MODULE_LICENSE("Proprietary");*/
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Verisilicon");
|
||||
MODULE_DESCRIPTION("VC8000 Vcmd driver");
|
||||
|
||||
|
||||
331
linux/kernel_module/vc8000_driver.h
Normal file
331
linux/kernel_module/vc8000_driver.h
Normal file
@@ -0,0 +1,331 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _VC8000_VCMD_DRIVER_H_
|
||||
#define _VC8000_VCMD_DRIVER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __FREERTOS__
|
||||
/* needed for the _IOW etc stuff used later */
|
||||
#include "base_type.h"
|
||||
#include "osal.h"
|
||||
#include "dev_common_freertos.h"
|
||||
#elif defined(__linux__)
|
||||
#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */
|
||||
#else //For other os
|
||||
//TODO...
|
||||
#endif
|
||||
#ifdef HANTROMMU_SUPPORT
|
||||
#include "hantrommu.h"
|
||||
#endif
|
||||
|
||||
#ifdef HANTROAXIFE_SUPPORT
|
||||
#include "vc8000_axife.h"
|
||||
#endif
|
||||
|
||||
#ifdef __FREERTOS__
|
||||
//ptr_t has been defined in base_type.h //Now the FreeRTOS mem need to support 64bit env
|
||||
#elif defined(__linux__)
|
||||
#undef ptr_t
|
||||
#define ptr_t PTR_T_KERNEL
|
||||
typedef size_t ptr_t;
|
||||
#endif
|
||||
/*
|
||||
* Macros to help debugging
|
||||
*/
|
||||
|
||||
#undef PDEBUG /* undef it, just in case */
|
||||
#ifdef HANTRO_DRIVER_DEBUG
|
||||
# ifdef __KERNEL__
|
||||
/* This one if debugging is on, and kernel space */
|
||||
# define PDEBUG(fmt, args...) printk( KERN_INFO "vc8000: " fmt, ## args)
|
||||
# else
|
||||
/* This one for user space */
|
||||
# define PDEBUG(fmt, args...) printf(__FILE__ ":%d: " fmt, __LINE__ , ## args)
|
||||
# endif
|
||||
#else
|
||||
# define PDEBUG(fmt, args...) /* not debugging: nothing */
|
||||
#endif
|
||||
|
||||
#define ENC_HW_ID1 0x48320100
|
||||
#define ENC_HW_ID2 0x80006000
|
||||
#define CORE_INFO_MODE_OFFSET 31
|
||||
#define CORE_INFO_AMOUNT_OFFSET 28
|
||||
|
||||
/* Use 'k' as magic number */
|
||||
#define HANTRO_IOC_MAGIC 'k'
|
||||
|
||||
/*
|
||||
* S means "Set" through a ptr,
|
||||
* T means "Tell" directly with the argument value
|
||||
* G means "Get": reply by setting through a pointer
|
||||
* Q means "Query": response is on the return value
|
||||
* X means "eXchange": G and S atomically
|
||||
* H means "sHift": T and Q atomically
|
||||
*/
|
||||
|
||||
#define HANTRO_IOCG_HWOFFSET _IOR(HANTRO_IOC_MAGIC, 3, unsigned long *)
|
||||
#define HANTRO_IOCG_HWIOSIZE _IOR(HANTRO_IOC_MAGIC, 4, unsigned int *)
|
||||
#define HANTRO_IOC_CLI _IO(HANTRO_IOC_MAGIC, 5)
|
||||
#define HANTRO_IOC_STI _IO(HANTRO_IOC_MAGIC, 6)
|
||||
#define HANTRO_IOCX_VIRT2BUS _IOWR(HANTRO_IOC_MAGIC, 7, unsigned long *)
|
||||
#define HANTRO_IOCH_ARDRESET _IO(HANTRO_IOC_MAGIC, 8) /* debugging tool */
|
||||
#define HANTRO_IOCG_SRAMOFFSET _IOR(HANTRO_IOC_MAGIC, 9, unsigned long *)
|
||||
#define HANTRO_IOCG_SRAMEIOSIZE _IOR(HANTRO_IOC_MAGIC, 10, unsigned int *)
|
||||
#define HANTRO_IOCH_ENC_RESERVE _IOR(HANTRO_IOC_MAGIC, 11,unsigned int *)
|
||||
#define HANTRO_IOCH_ENC_RELEASE _IOR(HANTRO_IOC_MAGIC, 12,unsigned int *)
|
||||
#define HANTRO_IOCG_CORE_NUM _IOR(HANTRO_IOC_MAGIC, 13,unsigned int *)
|
||||
#define HANTRO_IOCG_CORE_INFO _IOR(HANTRO_IOC_MAGIC, 14,SUBSYS_CORE_INFO *)
|
||||
#define HANTRO_IOCG_CORE_WAIT _IOR(HANTRO_IOC_MAGIC, 15, unsigned int *)
|
||||
#define HANTRO_IOCG_ANYCORE_WAIT _IOR(HANTRO_IOC_MAGIC, 16, CORE_WAIT_OUT *)
|
||||
|
||||
#define HANTRO_IOCH_GET_CMDBUF_PARAMETER _IOWR(HANTRO_IOC_MAGIC, 25,struct cmdbuf_mem_parameter *)
|
||||
#define HANTRO_IOCH_GET_CMDBUF_POOL_SIZE _IOWR(HANTRO_IOC_MAGIC, 26,unsigned long)
|
||||
#define HANTRO_IOCH_SET_CMDBUF_POOL_BASE _IOWR(HANTRO_IOC_MAGIC, 27,unsigned long)
|
||||
#define HANTRO_IOCH_GET_VCMD_PARAMETER _IOWR(HANTRO_IOC_MAGIC, 28, struct config_parameter *)
|
||||
#define HANTRO_IOCH_RESERVE_CMDBUF _IOWR(HANTRO_IOC_MAGIC, 29,struct exchange_parameter *)
|
||||
#define HANTRO_IOCH_LINK_RUN_CMDBUF _IOR(HANTRO_IOC_MAGIC, 30,u16 *)
|
||||
#define HANTRO_IOCH_WAIT_CMDBUF _IOR(HANTRO_IOC_MAGIC, 31,u16 *)
|
||||
#define HANTRO_IOCH_RELEASE_CMDBUF _IOR(HANTRO_IOC_MAGIC, 32,u16 *)
|
||||
#define HANTRO_IOCH_POLLING_CMDBUF _IOR(HANTRO_IOC_MAGIC, 33,u16 *)
|
||||
|
||||
#define HANTRO_IOCH_GET_VCMD_ENABLE _IOWR(HANTRO_IOC_MAGIC, 50,unsigned long)
|
||||
|
||||
#define GET_ENCODER_IDX(type_info) (CORE_VC8000E);
|
||||
#define CORETYPE(core) (1 << core)
|
||||
#define HANTRO_IOC_MAXNR 60
|
||||
|
||||
/*priority support*/
|
||||
|
||||
#define MAX_CMDBUF_PRIORITY_TYPE 2 //0:normal priority,1:high priority
|
||||
|
||||
#define CMDBUF_PRIORITY_NORMAL 0
|
||||
#define CMDBUF_PRIORITY_HIGH 1
|
||||
|
||||
#define OPCODE_WREG (0x01<<27)
|
||||
#define OPCODE_END (0x02<<27)
|
||||
#define OPCODE_NOP (0x03<<27)
|
||||
#define OPCODE_RREG (0x16<<27)
|
||||
#define OPCODE_INT (0x18<<27)
|
||||
#define OPCODE_JMP (0x19<<27)
|
||||
#define OPCODE_STALL (0x09<<27)
|
||||
#define OPCODE_CLRINT (0x1a<<27)
|
||||
#define OPCODE_JMP_RDY0 (0x19<<27)
|
||||
#define OPCODE_JMP_RDY1 ((0x19<<27)|(1<<26))
|
||||
#define JMP_IE_1 (1<<25)
|
||||
#define JMP_RDY_1 (1<<26)
|
||||
|
||||
|
||||
#define CLRINT_OPTYPE_READ_WRITE_1_CLEAR 0
|
||||
#define CLRINT_OPTYPE_READ_WRITE_0_CLEAR 1
|
||||
#define CLRINT_OPTYPE_READ_CLEAR 2
|
||||
|
||||
#define VC8000E_FRAME_RDY_INT_MASK 0x0001
|
||||
#define VC8000E_CUTREE_RDY_INT_MASK 0x0002
|
||||
#define VC8000E_DEC400_INT_MASK 0x0004
|
||||
#define VC8000E_L2CACHE_INT_MASK 0x0008
|
||||
#define VC8000E_MMU_INT_MASK 0x0010
|
||||
#define CUTREE_MMU_INT_MASK 0x0020
|
||||
|
||||
|
||||
#define VC8000D_FRAME_RDY_INT_MASK 0x0100
|
||||
#define VC8000D_DEC400_INT_MASK 0x0400
|
||||
#define VC8000D_L2CACHE_INT_MASK 0x0800
|
||||
#define VC8000D_MMU_INT_MASK 0x1000
|
||||
|
||||
|
||||
#define VC8000D_DEC400_INT_MASK_1_1_1 0x0200
|
||||
#define VC8000D_L2CACHE_INT_MASK_1_1_1 0x0400
|
||||
#define VC8000D_MMU_INT_MASK_1_1_1 0x0800
|
||||
|
||||
|
||||
|
||||
|
||||
#define HW_ID_1_0_C 0x43421001
|
||||
#define HW_ID_1_1_2 0x43421102
|
||||
|
||||
|
||||
#define ASIC_STATUS_SEGMENT_READY 0x1000
|
||||
#define ASIC_STATUS_FUSE_ERROR 0x200
|
||||
#define ASIC_STATUS_SLICE_READY 0x100
|
||||
#define ASIC_STATUS_LINE_BUFFER_DONE 0x080 /* low latency */
|
||||
#define ASIC_STATUS_HW_TIMEOUT 0x040
|
||||
#define ASIC_STATUS_BUFF_FULL 0x020
|
||||
#define ASIC_STATUS_HW_RESET 0x010
|
||||
#define ASIC_STATUS_ERROR 0x008
|
||||
#define ASIC_STATUS_FRAME_READY 0x004
|
||||
#define ASIC_IRQ_LINE 0x001
|
||||
#define ASIC_STATUS_ALL (ASIC_STATUS_SEGMENT_READY |\
|
||||
ASIC_STATUS_FUSE_ERROR |\
|
||||
ASIC_STATUS_SLICE_READY |\
|
||||
ASIC_STATUS_LINE_BUFFER_DONE |\
|
||||
ASIC_STATUS_HW_TIMEOUT |\
|
||||
ASIC_STATUS_BUFF_FULL |\
|
||||
ASIC_STATUS_HW_RESET |\
|
||||
ASIC_STATUS_ERROR |\
|
||||
ASIC_STATUS_FRAME_READY)
|
||||
|
||||
enum
|
||||
{
|
||||
CORE_VC8000E = 0,
|
||||
CORE_VC8000EJ = 1,
|
||||
CORE_CUTREE = 2,
|
||||
CORE_DEC400 = 3,
|
||||
CORE_MMU = 4,
|
||||
CORE_L2CACHE = 5,
|
||||
CORE_AXIFE = 6,
|
||||
CORE_APBFT = 7,
|
||||
CORE_MMU_1 = 8,
|
||||
CORE_AXIFE_1 = 9,
|
||||
CORE_MAX
|
||||
};
|
||||
|
||||
//#define CORE_MAX (CORE_MMU)
|
||||
|
||||
/*module_type support*/
|
||||
|
||||
enum vcmd_module_type{
|
||||
VCMD_TYPE_ENCODER = 0,
|
||||
VCMD_TYPE_CUTREE,
|
||||
VCMD_TYPE_DECODER,
|
||||
VCMD_TYPE_JPEG_ENCODER,
|
||||
VCMD_TYPE_JPEG_DECODER,
|
||||
MAX_VCMD_TYPE
|
||||
};
|
||||
|
||||
struct cmdbuf_mem_parameter
|
||||
{
|
||||
u32 *virt_cmdbuf_addr;
|
||||
ptr_t phy_cmdbuf_addr; //cmdbuf pool base physical address
|
||||
u32 mmu_phy_cmdbuf_addr; //cmdbuf pool base mmu mapping address
|
||||
u32 cmdbuf_total_size; //cmdbuf pool total size in bytes.
|
||||
u16 cmdbuf_unit_size; //one cmdbuf size in bytes. all cmdbuf have same size.
|
||||
u32 *virt_status_cmdbuf_addr;
|
||||
ptr_t phy_status_cmdbuf_addr; //status cmdbuf pool base physical address
|
||||
u32 mmu_phy_status_cmdbuf_addr; //status cmdbuf pool base mmu mapping address
|
||||
u32 status_cmdbuf_total_size; //status cmdbuf pool total size in bytes.
|
||||
u16 status_cmdbuf_unit_size; //one status cmdbuf size in bytes. all status cmdbuf have same size.
|
||||
ptr_t base_ddr_addr; //for pcie interface, hw can only access phy_cmdbuf_addr-pcie_base_ddr_addr.
|
||||
//for other interface, this value should be 0?
|
||||
};
|
||||
|
||||
struct config_parameter
|
||||
{
|
||||
u16 module_type; //input vc8000e=0,cutree=1,vc8000d=2,jpege=3, jpegd=4
|
||||
u16 vcmd_core_num; //output, how many vcmd cores are there with corresponding module_type.
|
||||
u16 submodule_main_addr; //output,if submodule addr == 0xffff, this submodule does not exist.
|
||||
u16 submodule_dec400_addr; //output ,if submodule addr == 0xffff, this submodule does not exist.
|
||||
u16 submodule_L2Cache_addr; //output,if submodule addr == 0xffff, this submodule does not exist.
|
||||
u16 submodule_MMU_addr[2]; //output,if submodule addr == 0xffff, this submodule does not exist.
|
||||
u16 submodule_axife_addr[2]; //output,if submodule addr == 0xffff, this submodule does not exist.
|
||||
u16 config_status_cmdbuf_id; // output , this status comdbuf save the all register values read in driver init.//used for analyse configuration in cwl.
|
||||
u32 vcmd_hw_version_id;
|
||||
};
|
||||
|
||||
/*need to consider how many memory should be allocated for status.*/
|
||||
struct exchange_parameter
|
||||
{
|
||||
u32 executing_time; //input ;executing_time=encoded_image_size*(rdoLevel+1)*(rdoq+1);
|
||||
u16 module_type; //input input vc8000e=0,IM=1,vc8000d=2,jpege=3, jpegd=4
|
||||
u16 cmdbuf_size; //input, reserve is not used; link and run is input.
|
||||
u16 priority; //input,normal=0, high/live=1
|
||||
u16 cmdbuf_id; //output ,it is unique in driver.
|
||||
u16 core_id; //just used for polling.
|
||||
};
|
||||
|
||||
typedef struct CoreWaitOut
|
||||
{
|
||||
u32 job_id[4];
|
||||
u32 irq_status[4];
|
||||
u32 irq_num;
|
||||
} CORE_WAIT_OUT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 subsys_idx;
|
||||
u32 core_type;
|
||||
unsigned long offset;
|
||||
u32 reg_size;
|
||||
int irq;
|
||||
}CORE_CONFIG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long base_addr;
|
||||
u32 iosize;
|
||||
u32 resouce_shared; //indicate the core share resources with other cores or not.If 1, means cores can not work at the same time.
|
||||
}SUBSYS_CONFIG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 type_info; //indicate which IP is contained in this subsystem and each uses one bit of this variable
|
||||
unsigned long offset[CORE_MAX];
|
||||
unsigned long regSize[CORE_MAX];
|
||||
int irq[CORE_MAX];
|
||||
}SUBSYS_CORE_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SUBSYS_CONFIG cfg;
|
||||
SUBSYS_CORE_INFO core_info;
|
||||
}SUBSYS_DATA;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_VC8000_VCMD_DRIVER_H_ */
|
||||
1458
linux/kernel_module/vc8000_normal_driver.c
Normal file
1458
linux/kernel_module/vc8000_normal_driver.c
Normal file
File diff suppressed because it is too large
Load Diff
4620
linux/kernel_module/vc8000_vcmd_driver.c
Normal file
4620
linux/kernel_module/vc8000_vcmd_driver.c
Normal file
File diff suppressed because it is too large
Load Diff
157
linux/kernel_module/vcmdregisterenum.h
Normal file
157
linux/kernel_module/vcmdregisterenum.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
/* Register interface based on the document version 1.1.2 */
|
||||
HWIF_VCMD_HW_ID,
|
||||
HWIF_VCMD_HW_VERSION,
|
||||
HWIF_VCMD_HW_BUILD_DATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD_MMU,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD_L2CACHE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD_DEC400,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE_MMU,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE_MMU,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE_L2CACHE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE_DEC400,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD_MMU,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD_L2CACHE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD_DEC400,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE_MMU,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE_MMU,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE_L2CACHE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE_DEC400,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE,
|
||||
HWIF_VCMD_EXE_CMDBUF_COUNT,
|
||||
HWIF_VCMD_EXECUTING_CMD,
|
||||
HWIF_VCMD_EXECUTING_CMD_MSB,
|
||||
HWIF_VCMD_AXI_TOTAL_AR_LEN,
|
||||
HWIF_VCMD_AXI_TOTAL_R,
|
||||
HWIF_VCMD_AXI_TOTAL_AR,
|
||||
HWIF_VCMD_AXI_TOTAL_R_LAST,
|
||||
HWIF_VCMD_AXI_TOTAL_AW_LEN,
|
||||
HWIF_VCMD_AXI_TOTAL_W,
|
||||
HWIF_VCMD_AXI_TOTAL_AW,
|
||||
HWIF_VCMD_AXI_TOTAL_W_LAST,
|
||||
HWIF_VCMD_AXI_TOTAL_B,
|
||||
HWIF_VCMD_AXI_AR_VALID,
|
||||
HWIF_VCMD_AXI_AR_READY,
|
||||
HWIF_VCMD_AXI_R_VALID,
|
||||
HWIF_VCMD_AXI_R_READY,
|
||||
HWIF_VCMD_AXI_AW_VALID,
|
||||
HWIF_VCMD_AXI_AW_READY,
|
||||
HWIF_VCMD_AXI_W_VALID,
|
||||
HWIF_VCMD_AXI_W_READY,
|
||||
HWIF_VCMD_AXI_B_VALID,
|
||||
HWIF_VCMD_AXI_B_READY,
|
||||
HWIF_VCMD_WORK_STATE,
|
||||
HWIF_VCMD_INIT_MODE,
|
||||
HWIF_VCMD_AXI_CLK_GATE_DISABLE,
|
||||
HWIF_VCMD_MASTER_OUT_CLK_GATE_DISABLE,
|
||||
HWIF_VCMD_CORE_CLK_GATE_DISABLE,
|
||||
HWIF_VCMD_ABORT_MODE,
|
||||
HWIF_VCMD_RESET_CORE,
|
||||
HWIF_VCMD_RESET_ALL,
|
||||
HWIF_VCMD_START_TRIGGER,
|
||||
HWIF_VCMD_IRQ_INTCMD,
|
||||
HWIF_VCMD_IRQ_JMPP,
|
||||
HWIF_VCMD_IRQ_JMPD,
|
||||
HWIF_VCMD_IRQ_RESET,
|
||||
HWIF_VCMD_IRQ_ABORT,
|
||||
HWIF_VCMD_IRQ_CMDERR,
|
||||
HWIF_VCMD_IRQ_TIMEOUT,
|
||||
HWIF_VCMD_IRQ_BUSERR,
|
||||
HWIF_VCMD_IRQ_ENDCMD,
|
||||
HWIF_VCMD_IRQ_INTCMD_EN,
|
||||
HWIF_VCMD_IRQ_JMPP_EN,
|
||||
HWIF_VCMD_IRQ_JMPD_EN,
|
||||
HWIF_VCMD_IRQ_RESET_EN,
|
||||
HWIF_VCMD_IRQ_ABORT_EN,
|
||||
HWIF_VCMD_IRQ_CMDERR_EN,
|
||||
HWIF_VCMD_IRQ_TIMEOUT_EN,
|
||||
HWIF_VCMD_IRQ_BUSERR_EN,
|
||||
HWIF_VCMD_IRQ_ENDCMD_EN,
|
||||
HWIF_VCMD_TIMEOUT_EN,
|
||||
HWIF_VCMD_TIMEOUT_CYCLES,
|
||||
HWIF_VCMD_EXECUTING_CMD_ADDR,
|
||||
HWIF_VCMD_EXECUTING_CMD_ADDR_MSB,
|
||||
HWIF_VCMD_EXE_CMDBUF_LENGTH,
|
||||
HWIF_VCMD_CMD_SWAP,
|
||||
HWIF_VCMD_MAX_BURST_LEN,
|
||||
HWIF_VCMD_AXI_ID_RD,
|
||||
HWIF_VCMD_AXI_ID_WR,
|
||||
HWIF_VCMD_RDY_CMDBUF_COUNT,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD_MMU_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD_L2CACHE_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD_DEC400_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCD_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE_MMU_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE_MMU_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE_L2CACHE_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE_DEC400_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE_GATE,
|
||||
HWIF_VCMD_EXT_ABN_INT_SRC_VCE_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD_MMU_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD_L2CACHE_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD_DEC400_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCD_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE_MMU_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE_MMU_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE_L2CACHE_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE_DEC400_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE_GATE,
|
||||
HWIF_VCMD_EXT_NORM_INT_SRC_VCE_GATE,
|
||||
HWIF_VCMD_CMDBUF_EXECUTING_ID,
|
||||
157
linux/kernel_module/vcmdregistertable.h
Normal file
157
linux/kernel_module/vcmdregistertable.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
/* Register interface based on the document version 1.1.2 */
|
||||
VCMDREG(HWIF_VCMD_HW_ID , 0 ,0xffff0000, 16, 0,RO,"HW ID"),
|
||||
VCMDREG(HWIF_VCMD_HW_VERSION , 0 ,0x0000ffff, 0, 0,RO,"version of hw(1.0.0).[15:12]-major [11:8]-minor [7:0]-build"),
|
||||
VCMDREG(HWIF_VCMD_HW_BUILD_DATE , 4 ,0xffffffff, 0, 0,RO,"Hw package generation date in BCD code"),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD_MMU , 8 ,0x08000000, 27, 0,RO,"external abnormal interrupt source from mmu of vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD_L2CACHE , 8 ,0x04000000, 26, 0,RO,"external abnormal interrupt source from l2cache of vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD_DEC400 , 8 ,0x02000000, 25, 0,RO,"external abnormal interrupt source from dec400 of vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD , 8 ,0x01000000, 24, 0,RO,"external abnormal interrupt source from vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE_MMU , 8 ,0x00200000, 21, 0,RO,"external abnormal interrupt source from mmu of cutree."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE_MMU , 8 ,0x00100000, 20, 0,RO,"external abnormal interrupt source from mmu of vce."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE_L2CACHE , 8 ,0x00080000, 19, 0,RO,"external abnormal interrupt source from l2 cache of vce."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE_DEC400 , 8 ,0x00040000, 18, 0,RO,"external abnormal interrupt source from dec400 of vce."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE , 8 ,0x00020000, 17, 0,RO,"external abnormal interrupt source from cutree."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE , 8 ,0x00010000, 16, 0,RO,"external abnormal interrupt source from vce."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD_MMU , 8 ,0x00000800, 11, 0,RO,"external normal interrupt source from mmu of vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD_L2CACHE , 8 ,0x00000400, 10, 0,RO,"external normal interrupt source from l2cache of vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD_DEC400 , 8 ,0x00000200, 9, 0,RO,"external normal interrupt source from dec400 of vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD , 8 ,0x00000100, 8, 0,RO,"external normal interrupt source from vcd."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE_MMU , 8 ,0x00000020, 5, 0,RO,"external normal interrupt source from mmu of cutree."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE_MMU , 8 ,0x00000010, 4, 0,RO,"external normal interrupt source from mmu of vce."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE_L2CACHE , 8 ,0x00000008, 3, 0,RO,"external normal interrupt source from l2 cache of vce."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE_DEC400 , 8 ,0x00000004, 2, 0,RO,"external normal interrupt source from dec400 of vce."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE , 8 ,0x00000002, 1, 0,RO,"external normal interrupt source from cutree."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE , 8 ,0x00000001, 0, 0,RO,"external normal interrupt source from vce."),
|
||||
VCMDREG(HWIF_VCMD_EXE_CMDBUF_COUNT , 12 ,0xffffffff, 0, 0,RO,"Hw increases this counter by 1 after one more command buffer has been executed"),
|
||||
VCMDREG(HWIF_VCMD_EXECUTING_CMD , 16 ,0xffffffff, 0, 0,RO,"the first 32 bits of the executing cmd."),
|
||||
VCMDREG(HWIF_VCMD_EXECUTING_CMD_MSB , 20 ,0xffffffff, 0, 0,RO,"the second 32 bits of the executing cmd."),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_AR_LEN , 24 ,0xffffffff, 0, 0,RO,"axi total ar length"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_R , 28 ,0xffffffff, 0, 0,RO,"axi total r"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_AR , 32 ,0xffffffff, 0, 0,RO,"axi total ar"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_R_LAST , 36 ,0xffffffff, 0, 0,RO,"axi total r last"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_AW_LEN , 40 ,0xffffffff, 0, 0,RO,"axi total aw length"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_W , 44 ,0xffffffff, 0, 0,RO,"axi total w"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_AW , 48 ,0xffffffff, 0, 0,RO,"axi total aw"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_W_LAST , 52 ,0xffffffff, 0, 0,RO,"axi total w last"),
|
||||
VCMDREG(HWIF_VCMD_AXI_TOTAL_B , 56 ,0xffffffff, 0, 0,RO,"axi total b"),
|
||||
VCMDREG(HWIF_VCMD_AXI_AR_VALID , 60 ,0x80000000, 31, 0,RO,"axi ar valid"),
|
||||
VCMDREG(HWIF_VCMD_AXI_AR_READY , 60 ,0x40000000, 30, 0,RO,"axi ar ready"),
|
||||
VCMDREG(HWIF_VCMD_AXI_R_VALID , 60 ,0x20000000, 29, 0,RO,"axi r valid"),
|
||||
VCMDREG(HWIF_VCMD_AXI_R_READY , 60 ,0x10000000, 28, 0,RO,"axi r ready"),
|
||||
VCMDREG(HWIF_VCMD_AXI_AW_VALID , 60 ,0x08000000, 27, 0,RO,"axi aw valid"),
|
||||
VCMDREG(HWIF_VCMD_AXI_AW_READY , 60 ,0x04000000, 26, 0,RO,"axi aw ready"),
|
||||
VCMDREG(HWIF_VCMD_AXI_W_VALID , 60 ,0x02000000, 25, 0,RO,"axi w valid"),
|
||||
VCMDREG(HWIF_VCMD_AXI_W_READY , 60 ,0x01000000, 24, 0,RO,"axi w ready"),
|
||||
VCMDREG(HWIF_VCMD_AXI_B_VALID , 60 ,0x00800000, 23, 0,RO,"axi b valid"),
|
||||
VCMDREG(HWIF_VCMD_AXI_B_READY , 60 ,0x00400000, 22, 0,RO,"axi b ready"),
|
||||
VCMDREG(HWIF_VCMD_WORK_STATE , 60 ,0x00000007, 0, 0,RO,"hw work state. 0-IDLE 1-WORK 2-STALL 3-PEND 4-ABORT"),
|
||||
VCMDREG(HWIF_VCMD_INIT_MODE , 64 ,0x00000080, 7, 0,RW,"After executed a END command in init mode, VCMD will get back to normal mode"),
|
||||
VCMDREG(HWIF_VCMD_AXI_CLK_GATE_DISABLE , 64 ,0x00000040, 6, 0,RW,"keep axi_clk always on when this bit is set to 1"),
|
||||
VCMDREG(HWIF_VCMD_MASTER_OUT_CLK_GATE_DISABLE , 64 ,0x00000020, 5, 0,RW,"keep master_out_clk(APB/AHB master) always on when this bit is set to 1"),
|
||||
VCMDREG(HWIF_VCMD_CORE_CLK_GATE_DISABLE , 64 ,0x00000010, 4, 0,RW,"keep core_clk always on when this bit is set to 1"),
|
||||
VCMDREG(HWIF_VCMD_ABORT_MODE , 64 ,0x00000008, 3, 0,RW,"0:abort after finishing current cmdbuf command.1:abort immediately "),
|
||||
VCMDREG(HWIF_VCMD_RESET_CORE , 64 ,0x00000004, 2, 0,RW,"sw write 1 to this bit will rset HW core logic when AXI/APB bus is idle."),
|
||||
VCMDREG(HWIF_VCMD_RESET_ALL , 64 ,0x00000002, 1, 0,RW,"sw write 1 to this bit will rset HW immediately including all swregs and AXI/APB bus logic"),
|
||||
VCMDREG(HWIF_VCMD_START_TRIGGER , 64 ,0x00000001, 0, 0,RW,"0:abort previou task and stop hw. 1:trigger hw to fetch and execute commands."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_INTCMD , 68 ,0xffff0000, 16, 0,RW,"interrupt sources which are triggered by command buffer id.. Only for version 1.0.c"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_JMPP , 68 ,0x00000080, 7, 0,RW,"interrupt source which is triggered by JMP command when hw goes to PEND state."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_JMPD , 68 ,0x00000040, 6, 0,RW,"interrupt source which is triggered by JMP command directly."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_RESET , 68 ,0x00000020, 5, 0,RW,"interrupt source which is triggered by hw reset or sw_vcmd_reset_all."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_ABORT , 68 ,0x00000010, 4, 0,RW,"interrupt source which is triggered by abort operation."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_CMDERR , 68 ,0x00000008, 3, 0,RW,"interrupt source which is triggered when there is illegal command in cmdbuf"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_TIMEOUT , 68 ,0x00000004, 2, 0,RW,"interrupt source which is triggered when vcmd timeout."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_BUSERR , 68 ,0x00000002, 1, 0,RW,"interrupt source which is triggered when there is bus error."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_ENDCMD , 68 ,0x00000001, 0, 0,RW,"interrupt source which is triggered by END command."),
|
||||
VCMDREG(HWIF_VCMD_IRQ_INTCMD_EN , 72 ,0xffff0000, 16, 0,RW,"interrupt sources which are triggered by command buffer id. Only for version 1.0.c"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_JMPP_EN , 72 ,0x00000080, 7, 0,RW,"interrupt enable for sw_vcmd_irq_jmpp"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_JMPD_EN , 72 ,0x00000040, 6, 0,RW,"interrupt enable for sw_vcmd_irq_jmpd"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_RESET_EN , 72 ,0x00000020, 5, 0,RW,"interrupt enable for sw_vcmd_irq_reset"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_ABORT_EN , 72 ,0x00000010, 4, 0,RW,"interrupt enable for sw_vcmd_irq_abort"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_CMDERR_EN , 72 ,0x00000008, 3, 0,RW,"interrupt enable for sw_vcmd_irq_cmderr"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_TIMEOUT_EN , 72 ,0x00000004, 2, 0,RW,"interrupt enable for sw_vcmd_irq_timeout"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_BUSERR_EN , 72 ,0x00000002, 1, 0,RW,"interrupt enable for sw_vcmd_irq_buserr"),
|
||||
VCMDREG(HWIF_VCMD_IRQ_ENDCMD_EN , 72 ,0x00000001, 0, 0,RW,"interrupt enable for sw_vcmd_irq_endcmd"),
|
||||
VCMDREG(HWIF_VCMD_TIMEOUT_EN , 76 ,0x80000000, 31, 0,RW,"1:timeout work. 0: timeout do not work"),
|
||||
VCMDREG(HWIF_VCMD_TIMEOUT_CYCLES , 76 ,0x7fffffff, 0, 0,RW,"sw_vcmd_irq_timeout will be generated when timeout counter is equal to this value."),
|
||||
VCMDREG(HWIF_VCMD_EXECUTING_CMD_ADDR , 80 ,0xffffffff, 0, 0,RW,"the least 32 bits address of the executing command"),
|
||||
VCMDREG(HWIF_VCMD_EXECUTING_CMD_ADDR_MSB , 84 ,0xffffffff, 0, 0,RW,"the most 32 bits address of the executing command"),
|
||||
VCMDREG(HWIF_VCMD_EXE_CMDBUF_LENGTH , 88 ,0x0000ffff, 0, 0,RW,"the length of current command buffer in unit of 64bits."),
|
||||
VCMDREG(HWIF_VCMD_CMD_SWAP , 92 ,0xf0000000, 28, 0,RW,"axi data swapping"),
|
||||
VCMDREG(HWIF_VCMD_MAX_BURST_LEN , 92 ,0x00ff0000, 16, 0,RW,"max burst length which will be sent to axi bus"),
|
||||
VCMDREG(HWIF_VCMD_AXI_ID_RD , 92 ,0x0000ff00, 8, 0,RW,"the arid which will be used on axi bus reading"),
|
||||
VCMDREG(HWIF_VCMD_AXI_ID_WR , 92 ,0x000000ff, 0, 0,RW,"the awid which will be used on axi bus writing"),
|
||||
VCMDREG(HWIF_VCMD_RDY_CMDBUF_COUNT , 96 ,0xffffffff, 0, 0,RW,"sw increases this counter by 1 after one more command buffer was ready."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD_MMU_GATE , 100,0x10000000, 28, 0,RW,"external abnormal interrupt source from mmu of vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD_L2CACHE_GATE, 100,0x08000000, 27, 0,RW,"external abnormal interrupt source from l2cache of vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD_DEC400_GATE, 100,0x04000000, 26, 0,RW,"external abnormal interrupt source from dec400 of vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCD_GATE , 100,0x01000000, 24, 0,RW,"external abnormal interrupt source from vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE_MMU_GATE, 100,0x00200000, 21, 0,RW,"external abnormal interrupt source from mmu of cutree gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE_MMU_GATE , 100,0x00100000, 20, 0,RW,"external abnormal interrupt source from mmu of vce gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE_L2CACHE_GATE, 100,0x00080000, 19, 0,RW,"external abnormal interrupt source from l2 cache of vce gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE_DEC400_GATE, 100,0x00040000, 18, 0,RW,"external abnormal interrupt source from dec400 of vce gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_CUTREE_GATE , 100,0x00020000, 17, 0,RW,"external abnormal interrupt source from cutree gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_ABN_INT_SRC_VCE_GATE , 100,0x00010000, 16, 0,RW,"external abnormal interrupt source from vce gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD_MMU_GATE , 100,0x00000800, 11, 0,RW,"external normal interrupt source from mmu of vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD_L2CACHE_GATE, 100,0x00000400, 10, 0,RW,"external normal interrupt source from l2cache of vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD_DEC400_GATE, 100,0x00000200, 9, 0,RW,"external normal interrupt source from dec400 of vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCD_GATE , 100,0x00000100, 8, 0,RW,"external normal interrupt source from vcd gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE_MMU_GATE, 100,0x00000020, 5, 0,RW,"external normal interrupt source from mmu of cutree gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE_MMU_GATE , 100,0x00000010, 4, 0,RW,"external normal interrupt source from mmu of vce gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE_L2CACHE_GATE, 100,0x00000008, 3, 0,RW,"external normal interrupt source from l2 cache of vce gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE_DEC400_GATE, 100,0x00000004, 2, 0,RW,"external normal interrupt source from dec400 of vce gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_CUTREE_GATE , 100,0x00000002, 1, 0,RW,"external normal interrupt source from cutree gate."),
|
||||
VCMDREG(HWIF_VCMD_EXT_NORM_INT_SRC_VCE_GATE , 100,0x00000001, 0, 0,RW,"external normal interrupt source from vce gate."),
|
||||
VCMDREG(HWIF_VCMD_CMDBUF_EXECUTING_ID , 104,0xffffffff, 0, 0,RW,"The ID of current executing command buffer.used after version 1.1.2."),
|
||||
180
linux/kernel_module/vcmdswhwregisters.c
Normal file
180
linux/kernel_module/vcmdswhwregisters.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Table of contents
|
||||
|
||||
1. Include headers
|
||||
2. External compiler flags
|
||||
3. Module defines
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------
|
||||
1. Include headers
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include <asm/io.h>
|
||||
#include "vcmdswhwregisters.h"
|
||||
|
||||
/* NOTE: Don't use ',' in descriptions, because it is used as separator in csv
|
||||
* parsing. */
|
||||
const regVcmdField_s asicVcmdRegisterDesc[] =
|
||||
{
|
||||
#include "vcmdregistertable.h"
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
2. External compiler flags
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
3. Module defines
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* Define this to print debug info for every register write.
|
||||
#define DEBUG_PRINT_REGS */
|
||||
|
||||
/*******************************************************************************
|
||||
Function name : vcmd_read_reg
|
||||
Description : Retrive the content of a hadware register
|
||||
Note: The status register will be read after every MB
|
||||
so it may be needed to buffer it's content if reading
|
||||
the HW register is slow.
|
||||
Return type : u32
|
||||
Argument : u32 offset
|
||||
*******************************************************************************/
|
||||
u32 vcmd_read_reg(const void *hwregs, u32 offset)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
val =(u32) ioread32((void*)hwregs + offset);
|
||||
|
||||
PDEBUG("vcmd_read_reg 0x%02x --> %08x\n", offset, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function name : vcmd_write_reg
|
||||
Description : Set the content of a hadware register
|
||||
Return type : void
|
||||
Argument : u32 offset
|
||||
Argument : u32 val
|
||||
*******************************************************************************/
|
||||
void vcmd_write_reg(const void *hwregs, u32 offset, u32 val)
|
||||
{
|
||||
iowrite32(val,(void*)hwregs + offset);
|
||||
|
||||
PDEBUG("vcmd_write_reg 0x%02x with value %08x\n", offset, val);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
vcmd_write_register_value
|
||||
|
||||
Write a value into a defined register field (write will happens actually).
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
void vcmd_write_register_value(const void *hwregs,u32* reg_mirror,regVcmdName name, u32 value)
|
||||
{
|
||||
const regVcmdField_s *field;
|
||||
u32 regVal;
|
||||
|
||||
field = &asicVcmdRegisterDesc[name];
|
||||
|
||||
#ifdef DEBUG_PRINT_REGS
|
||||
PDEBUG("vcmd_write_register_value 0x%2x 0x%08x Value: %10d %s\n",
|
||||
field->base, field->mask, value, field->description);
|
||||
#endif
|
||||
|
||||
/* Check that value fits in field */
|
||||
PDEBUG("field->name == name=%d\n",field->name == name);
|
||||
PDEBUG("((field->mask >> field->lsb) << field->lsb) == field->mask=%d\n",((field->mask >> field->lsb) << field->lsb) == field->mask);
|
||||
PDEBUG("(field->mask >> field->lsb) >= value=%d\n",(field->mask >> field->lsb) >= value);
|
||||
PDEBUG("field->base < ASIC_VCMD_SWREG_AMOUNT*4=%d\n",field->base < ASIC_VCMD_SWREG_AMOUNT*4);
|
||||
|
||||
/* Clear previous value of field in register */
|
||||
regVal = reg_mirror[field->base/4] & ~(field->mask);
|
||||
|
||||
/* Put new value of field in register */
|
||||
reg_mirror[field->base/4] = regVal | ((value << field->lsb) & field->mask);
|
||||
|
||||
/* write it into HW registers */
|
||||
vcmd_write_reg(hwregs, field->base,reg_mirror[field->base/4]);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
vcmd_get_register_value
|
||||
|
||||
Get an unsigned value from the ASIC registers
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
u32 vcmd_get_register_value(const void *hwregs, u32* reg_mirror,regVcmdName name)
|
||||
{
|
||||
const regVcmdField_s *field;
|
||||
u32 value;
|
||||
|
||||
field = &asicVcmdRegisterDesc[name];
|
||||
|
||||
PDEBUG("field->base < ASIC_VCMD_SWREG_AMOUNT * 4=%d\n",field->base < ASIC_VCMD_SWREG_AMOUNT * 4);
|
||||
|
||||
value = reg_mirror[field->base / 4] = vcmd_read_reg(hwregs, field->base);
|
||||
value = (value & field->mask) >> field->lsb;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
244
linux/kernel_module/vcmdswhwregisters.h
Normal file
244
linux/kernel_module/vcmdswhwregisters.h
Normal file
@@ -0,0 +1,244 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* The GPL License (GPL)
|
||||
*
|
||||
* Copyright (C) 2014 - 2021 VERISILICON
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Note: This software is released under dual MIT and GPL licenses. A
|
||||
* recipient may use this file under the terms of either the MIT license or
|
||||
* GPL License. If you wish to use only one license not the other, you can
|
||||
* indicate your decision by deleting one of the above license notices in your
|
||||
* version of this file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Table of contents
|
||||
|
||||
1. Include headers
|
||||
2. External compiler flags
|
||||
3. Module defines
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef VCMD_SWHWREGISTERS_H
|
||||
#define VCMD_SWHWREGISTERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*------------------------------------------------------------------------------
|
||||
1. Include headers
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifdef __FREERTOS__
|
||||
#include "base_type.h"
|
||||
#include "io_tools.h"
|
||||
#elif defined(__linux__)
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FREERTOS__
|
||||
//ptr_t has been defined in base_type.h //Now the FreeRTOS mem need to support 64bit env
|
||||
#elif defined(__linux__)
|
||||
typedef int i32;
|
||||
typedef size_t ptr_t;
|
||||
#endif
|
||||
|
||||
#undef PDEBUG /* undef it, just in case */
|
||||
#ifdef REGISTER_DEBUG
|
||||
# ifdef __KERNEL__
|
||||
/* This one if debugging is on, and kernel space */
|
||||
# define PDEBUG(fmt, args...) printk( KERN_INFO "memalloc: " fmt, ## args)
|
||||
# else
|
||||
/* This one for user space */
|
||||
# define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
|
||||
# endif
|
||||
#else
|
||||
# define PDEBUG(fmt, args...) /* not debugging: nothing */
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
2. External compiler flags
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
3. Module defines
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifdef HANTROVCMD_ENABLE_IP_SUPPORT
|
||||
#define VCMD_REGISTER_INDEX_SW_INIT_CMD0 32
|
||||
#define ASIC_VCMD_SWREG_AMOUNT 64
|
||||
#else
|
||||
#define ASIC_VCMD_SWREG_AMOUNT 27
|
||||
#endif
|
||||
#define VCMD_REGISTER_CONTROL_OFFSET 0X40
|
||||
#define VCMD_REGISTER_INT_STATUS_OFFSET 0X44
|
||||
#define VCMD_REGISTER_INT_CTL_OFFSET 0X48
|
||||
#define VCMD_REGISTER_EXT_INT_GATE_OFFSET 0X64
|
||||
/* HW Register field names */
|
||||
typedef enum
|
||||
{
|
||||
#include "vcmdregisterenum.h"
|
||||
VcmdRegisterAmount
|
||||
} regVcmdName;
|
||||
|
||||
/* HW Register field descriptions */
|
||||
typedef struct
|
||||
{
|
||||
u32 name; /* Register name and index */
|
||||
i32 base; /* Register base address */
|
||||
u32 mask; /* Bitmask for this field */
|
||||
i32 lsb; /* LSB for this field [31..0] */
|
||||
i32 trace; /* Enable/disable writing in swreg_params.trc */
|
||||
i32 rw; /* 1=Read-only 2=Write-only 3=Read-Write */
|
||||
char *description; /* Field description */
|
||||
} regVcmdField_s;
|
||||
|
||||
/* Flags for read-only, write-only and read-write */
|
||||
#define RO 1
|
||||
#define WO 2
|
||||
#define RW 3
|
||||
|
||||
#define REGBASE(reg) (asicVcmdRegisterDesc[reg].base)
|
||||
|
||||
/* Description field only needed for system model build. */
|
||||
#ifdef TEST_DATA
|
||||
#define VCMDREG(name, base, mask, lsb, trace, rw, desc) \
|
||||
{name, base, mask, lsb, trace, rw, desc}
|
||||
#else
|
||||
#define VCMDREG(name, base, mask, lsb, trace, rw, desc) \
|
||||
{name, base, mask, lsb, trace, rw, ""}
|
||||
#endif
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
4. Function prototypes
|
||||
------------------------------------------------------------------------------*/
|
||||
extern const regVcmdField_s asicVcmdRegisterDesc[];
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
EncAsicSetRegisterValue
|
||||
|
||||
Set a value into a defined register field
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
static inline void vcmd_set_register_mirror_value(u32 *reg_mirror, regVcmdName name, u32 value)
|
||||
{
|
||||
const regVcmdField_s *field;
|
||||
u32 regVal;
|
||||
|
||||
field = &asicVcmdRegisterDesc[name];
|
||||
|
||||
#ifdef DEBUG_PRINT_REGS
|
||||
printf("vcmd_set_register_mirror_value 0x%2x 0x%08x Value: %10d %s\n",
|
||||
field->base, field->mask, value, field->description);
|
||||
#endif
|
||||
|
||||
/* Check that value fits in field */
|
||||
PDEBUG("field->name == name=%d\n",field->name == name);
|
||||
PDEBUG("((field->mask >> field->lsb) << field->lsb) == field->mask=%d\n",((field->mask >> field->lsb) << field->lsb) == field->mask);
|
||||
PDEBUG("(field->mask >> field->lsb) >= value=%d\n",(field->mask >> field->lsb) >= value);
|
||||
PDEBUG("field->base < ASIC_VCMD_SWREG_AMOUNT * 4=%d\n",field->base < ASIC_VCMD_SWREG_AMOUNT * 4);
|
||||
|
||||
/* Clear previous value of field in register */
|
||||
regVal = reg_mirror[field->base / 4] & ~(field->mask);
|
||||
|
||||
/* Put new value of field in register */
|
||||
reg_mirror[field->base / 4] = regVal | ((value << field->lsb) & field->mask);
|
||||
}
|
||||
static inline u32 vcmd_get_register_mirror_value(u32 *reg_mirror, regVcmdName name)
|
||||
{
|
||||
const regVcmdField_s *field;
|
||||
u32 regVal;
|
||||
|
||||
field = &asicVcmdRegisterDesc[name];
|
||||
|
||||
|
||||
/* Check that value fits in field */
|
||||
PDEBUG("field->name == name=%d\n",field->name == name);
|
||||
PDEBUG("((field->mask >> field->lsb) << field->lsb) == field->mask=%d\n",((field->mask >> field->lsb) << field->lsb) == field->mask);
|
||||
PDEBUG("field->base < ASIC_VCMD_SWREG_AMOUNT * 4=%d\n",field->base < ASIC_VCMD_SWREG_AMOUNT * 4);
|
||||
|
||||
regVal = reg_mirror[field->base / 4];
|
||||
regVal = (regVal & field->mask) >> field->lsb;
|
||||
|
||||
#ifdef DEBUG_PRINT_REGS
|
||||
PDEBUG("vcmd_get_register_mirror_value 0x%2x 0x%08x Value: %10d %s\n",
|
||||
field->base, field->mask, regVal, field->description);
|
||||
#endif
|
||||
return regVal;
|
||||
}
|
||||
|
||||
u32 vcmd_read_reg(const void *hwregs, u32 offset);
|
||||
|
||||
void vcmd_write_reg(const void *hwregs, u32 offset, u32 val);
|
||||
|
||||
|
||||
|
||||
void vcmd_write_register_value(const void *hwregs,u32* reg_mirror,regVcmdName name, u32 value);
|
||||
|
||||
|
||||
u32 vcmd_get_register_value(const void *hwregs, u32* reg_mirror,regVcmdName name);
|
||||
|
||||
#define vcmd_set_addr_register_value(reg_base, reg_mirror, name, value) do {\
|
||||
if(sizeof(ptr_t) == 8) {\
|
||||
vcmd_write_register_value((reg_base), (reg_mirror),name, (u32)((ptr_t)value)); \
|
||||
vcmd_write_register_value((reg_base), (reg_mirror),name##_MSB, (u32)(((ptr_t)value) >> 32));\
|
||||
} else {\
|
||||
vcmd_write_register_value((reg_base),(reg_mirror), name, (u32)((ptr_t)value));\
|
||||
}\
|
||||
}while (0)
|
||||
|
||||
#define VCMDGetAddrRegisterValue(reg_base, reg_mirror,name) \
|
||||
((sizeof(ptr_t) == 8) ? (\
|
||||
(((ptr_t)vcmd_get_register_value((reg_base),(reg_mirror), name)) | \
|
||||
(((ptr_t)vcmd_get_register_value((reg_base), (reg_mirror),name##_MSB)) << 32))\
|
||||
) : ((ptr_t)vcmd_get_register_value((reg_base),(reg_mirror), (name))))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VCMD_SWHWREGISTERS_H */
|
||||
Reference in New Issue
Block a user