wct4xxp: Moving the transmit short detection behind debug module param.

This needs some more testing before it's on by default.  If the card is
otherwise functioning, these messages may be confusing to the user.  If
the card is not functioning, the driver can be reloaded with debug to
check for this condition.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9205 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2010-08-27 21:59:27 +00:00
commit bf3fe05dfb
265 changed files with 190229 additions and 0 deletions

341
LICENSE Normal file
View File

@ -0,0 +1,341 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

504
LICENSE.LGPL Normal file
View File

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

218
Makefile Normal file
View File

@ -0,0 +1,218 @@
#
# Makefile for DAHDI Linux kernel modules
#
# Copyright (C) 2001-2009 Digium, Inc.
#
#
PWD:=$(shell pwd)
DAHDI_MODULES_EXTRA:=$(MODULES_EXTRA:%=%.o) $(SUBDIRS_EXTRA:%=%/)
# If you want to build for a kernel other than the current kernel, set KVERS
ifndef KVERS
KVERS:=$(shell uname -r)
endif
ifndef KSRC
ifneq (,$(wildcard /lib/modules/$(KVERS)/build))
KSRC:=/lib/modules/$(KVERS)/build
else
KSRC_SEARCH_PATH:=/usr/src/linux
KSRC:=$(shell for dir in $(KSRC_SEARCH_PATH); do if [ -d $$dir ]; then echo $$dir; break; fi; done)
endif
endif
KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2)
KINCLUDES:=$(KSRC)/include
# We use the kernel's .config file as an indication that the KSRC
# directory is indeed a valid and configured kernel source (or partial
# source) directory.
#
# We also source it, as it has the format of Makefile variables list.
# Thus we will have many CONFIG_* variables from there.
KCONFIG:=$(KSRC)/.config
ifneq (,$(wildcard $(KCONFIG)))
HAS_KSRC:=yes
include $(KCONFIG)
else
HAS_KSRC:=no
endif
CHECKSTACK=$(KSRC)/scripts/checkstack.pl
# Set HOTPLUG_FIRMWARE=no to override automatic building with hotplug support
# if it is enabled in the kernel.
ifeq (yes,$(HAS_KSRC))
HOTPLUG_FIRMWARE:=$(shell if grep -q '^CONFIG_FW_LOADER=[ym]' $(KCONFIG); then echo "yes"; else echo "no"; fi)
endif
UDEV_DIR:=/etc/udev/rules.d
MODULE_ALIASES:=wcfxs wctdm8xxp wct2xxp
INST_HEADERS:=kernel.h user.h fasthdlc.h wctdm_user.h dahdi_config.h
DAHDI_BUILD_ALL:=m
KMAKE=$(MAKE) -C $(KSRC) SUBDIRS=$(PWD)/drivers/dahdi DAHDI_INCLUDE=$(PWD)/include DAHDI_MODULES_EXTRA="$(DAHDI_MODULES_EXTRA)" HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
ROOT_PREFIX:=
ASCIIDOC:=asciidoc
ASCIIDOC_CMD:=$(ASCIIDOC) -n -a toc -a toclevels=4
GENERATED_DOCS:=README.html
ifneq ($(wildcard .version),)
DAHDIVERSION:=$(shell cat .version)
else
ifneq ($(wildcard .svn),)
DAHDIVERSION:=$(shell build_tools/make_version . dahdi/linux)
endif
endif
all: modules
modules: prereq
ifeq (no,$(HAS_KSRC))
@echo "You do not appear to have the sources for the $(KVERS) kernel installed."
@exit 1
endif
$(KMAKE) modules DAHDI_BUILD_ALL=$(DAHDI_BUILD_ALL)
include/dahdi/version.h: FORCE
@DAHDIVERSION="${DAHDIVERSION}" build_tools/make_version_h > $@.tmp
@if cmp -s $@.tmp $@ ; then :; else \
mv $@.tmp $@ ; \
fi
@rm -f $@.tmp
prereq: include/dahdi/version.h firmware-loaders
stackcheck: $(CHECKSTACK) modules
objdump -d drivers/dahdi/*.ko drivers/dahdi/*/*.ko | $(CHECKSTACK)
install: all install-modules install-devices install-include install-firmware install-xpp-firm
@echo "###################################################"
@echo "###"
@echo "### DAHDI installed successfully."
@echo "### If you have not done so before, install the package"
@echo "### dahdi-tools."
@echo "###"
@echo "###################################################"
uninstall: uninstall-modules uninstall-devices uninstall-include uninstall-firmware
install-modconf:
build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out dahdi dahdi_dummy xpp dahdi_transcode dahdi_dynamic,$(BUILD_MODULES)) $(MODULE_ALIASES)"
@if [ -d /etc/modutils ]; then \
/sbin/update-modules ; \
fi
install-xpp-firm:
$(MAKE) -C drivers/dahdi/xpp/firmwares install
install-firmware:
ifeq ($(HOTPLUG_FIRMWARE),yes)
$(MAKE) -C drivers/dahdi/firmware hotplug-install DESTDIR=$(DESTDIR) HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
endif
uninstall-firmware:
$(MAKE) -C drivers/dahdi/firmware hotplug-uninstall DESTDIR=$(DESTDIR)
firmware-loaders:
$(MAKE) -C drivers/dahdi/firmware firmware-loaders
install-include:
for hdr in $(INST_HEADERS); do \
install -D -m 644 include/dahdi/$$hdr $(DESTDIR)/usr/include/dahdi/$$hdr; \
done
@rm -rf $(DESTDIR)/usr/include/zaptel
uninstall-include:
for hdr in $(INST_HEADERS); do \
rm -f $(DESTDIR)/usr/include/dahdi/$$hdr; \
done
-rmdir $(DESTDIR)/usr/include/dahdi
install-devices:
install -d $(DESTDIR)$(UDEV_DIR)
build_tools/genudevrules > $(DESTDIR)$(UDEV_DIR)/dahdi.rules
install -m 644 drivers/dahdi/xpp/xpp.rules $(DESTDIR)$(UDEV_DIR)/
uninstall-devices:
rm -f $(DESTDIR)$(UDEV_DIR)/dahdi.rules
install-modules: modules
ifndef DESTDIR
@if modinfo zaptel > /dev/null 2>&1; then \
echo -n "Removing Zaptel modules for kernel $(KVERS), please wait..."; \
build_tools/uninstall-modules zaptel $(KVERS); \
rm -rf /lib/modules/$(KVERS)/zaptel; \
echo "done."; \
fi
build_tools/uninstall-modules dahdi $(KVERS)
endif
$(KMAKE) INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=dahdi modules_install
[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
uninstall-modules:
ifdef DESTDIR
@echo "Uninstalling modules is not supported with a DESTDIR specified."
@exit 1
else
@if modinfo dahdi > /dev/null 2>&1 ; then \
echo -n "Removing DAHDI modules for kernel $(KVERS), please wait..."; \
build_tools/uninstall-modules dahdi $(KVERS); \
rm -rf /lib/modules/$(KVERS)/dahdi; \
echo "done."; \
fi
[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
endif
update:
@if [ -d .svn ]; then \
echo "Updating from Subversion..." ; \
svn update | tee update.out; \
rm -f .version; \
if [ `grep -c ^C update.out` -gt 0 ]; then \
echo ; echo "The following files have conflicts:" ; \
grep ^C update.out | cut -b4- ; \
fi ; \
rm -f update.out; \
else \
echo "Not under version control"; \
fi
clean:
ifneq (no,$(HAS_KSRC))
$(KMAKE) clean
endif
@rm -f $(GENERATED_DOCS)
$(MAKE) -C drivers/dahdi/firmware clean
distclean: dist-clean
dist-clean: clean
@rm -f include/dahdi/version.h
@$(MAKE) -C drivers/dahdi/firmware dist-clean
@rm -f drivers/dahdi/vpmadt032_loader/*.o_shipped
firmware-download:
@$(MAKE) -C drivers/dahdi/firmware all
test:
./test-script $(DESTDIR)/lib/modules/$(KVERS) dahdi
docs: $(GENERATED_DOCS)
README.html: README
$(ASCIIDOC_CMD) -o $@ $<
dahdi-api.html: drivers/dahdi/dahdi-base.c
build_tools/kernel-doc --kernel $(KSRC) $^ >$@
.PHONY: distclean dist-clean clean all install devices modules stackcheck install-udev update install-modules install-include uninstall-modules firmware-download install-xpp-firm firmware-loaders
FORCE:

1017
README Normal file

File diff suppressed because it is too large Load Diff

85
UPGRADE.txt Normal file
View File

@ -0,0 +1,85 @@
=====================================================================
=== Information for upgrading from Zaptel 1.2 or 1.4 to DAHDI 2.0 ===
=====================================================================
Upgrading from Zaptel to DAHDI is fairly straightforward; install this
package using the installation instructions, and then reconfigure and
rebuild Asterisk; Asterisk 1.4 releases later than 1.4.21, and all
releases of Asterisk 1.6, will automatically use DAHDI in preference
to Zaptel, even if Zaptel is still installed on the system.
Important notes about upgrading:
* The Zaptel package, which included both kernel modules and userspace
tools for configuring and managing the modules, has been split into
two packages:
dahdi-linux: kernel modules
dahdi-tools: userspace tools
In addition, there is a dahdi-linux-complete package that contains both
dahdi-linux and dahdi-tools for simplified installation.
Note: The dahdi-linux and dahdi-tools packages have *separate*
version numbers; they will not be released 'in sync', and it is
perfectly acceptable to use (for example) dahdi-tools 2.0.6 with
dahdi-linux 2.0.11. The dahdi-linux-complete package version number will
always include *both* of these version numbers so that you will know
what is included in it.
Notes about the dahdi-linux package:
* The primary kernel modules have changed names; the new names are:
zaptel.ko -> dahdi.ko
ztd-eth.ko -> dahdi_dynamic_eth.ko
ztd-loc.ko -> dahdi_dynamic_loc.ko
ztdummy.ko -> dahdi_dummy.ko
ztdynamic.ko -> dahdi_dynamic.ko
zttranscode.ko -> dahdi_transcode.ko
* The kernel modules for card drivers have *not* changed names,
although the wcusb and torisa drivers are no longer included.
* This package no longer includes the 'menuselect' utility for
choosing which modules to build; all modules that can be built are
built automatically.
* It is no longer possible to select a software echo canceler at
compile time to build into dahdi.ko; all four included echo
cancelers (MG2, KB1, SEC and SEC2) are built as loadable modules,
and if the Digium HPEC binary object file has been placed into the
proper directory the HPEC module will be built as well. Any or all
of these modules can be loaded at the same time, and the echo
canceler to be used on the system's channels can be configured using
the dahdi_cfg tool from the dahdi-tools package.
Note: It is *mandatory* to configure an echo canceler for the
system's channels using dahdi_cfg unless the interface cards in use
have echo canceler modules available and enabled. There is *no*
default software echo canceler with DAHDI.
Notes about the dahdi-tools package:
* Many tool names have changed:
ztcfg -> dahdi_cfg
ztmonitor -> dahdi_monitor
ztscan -> dahdi_scan
ztspeed -> dahdi_speed
zttest -> dahdi_test
zttool -> dahdi_tool
zapconf -> dahdi_genconf (deprecates genzaptelconf)
* The system configuration file has moved from /etc/zaptel.conf to
/etc/dahdi/system.conf.
* The dahdi_cfg tool can now be used to select an echo canceler on a
channel-by-channel basis in the system configuration file; see
system.conf.sample for examples of how to do this.
* The configuration for XPP init_card_* scripts is done now
in /etc/dahdi/xpp.conf and uses a simple syntax (example included).
For PRI modules, the 'pri_protocol' setting, determines how
to configure it (E1/T1).
* In Astribank PRI modules, the LED behaviour represents which ports
are *CLOCK MASTER* (red color) and which are *CLOCK SLAVE* (green color).
Usually (but not always), this corresponds to the NT/TE settings in Asterisk.

168
build_tools/builder Executable file
View File

@ -0,0 +1,168 @@
#!/bin/sh
# build_test - a build testing script
#
# Copyright (C) 2008 by Xorcom <support@xorcom.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Setup:
#
# 0. Copy this script under build_tools/ and
#
# chmod +x build_tools/builder
#
# 1. Make sure you have git and sqlite3 installed. If the sqlite3 binary
# is called differently, fix the line "SQLITE=" in the script or in
# build_tools/test_build.conf .
#
# 2. Run:
#
# ./build_tools/test_kernel_git init /path/to/some/dir
#
# /path/to/some/dir must exist . This will download a recent kernel
# git repository to /path/to/some/dir/linux-2.6 . Use
# './build_tools/test_kernel_git update' to pull a fresh update there.
#
# 3. Run:
#
# ./build_tools/builder init
#
#
# Usage:
#
# ./build_tools build
#
# The past results are in a sqlite database in the logs subdirectory. For
# a simple list of results:
#
# ./build_tools report
#
# You can also look at the build log for a specific build in the logs
# directory.
BIN_DIR=`dirname $0`
BASE_DIR=`dirname $BIN_DIR`
SQLITE=sqlite3
HOSTS="localhost"
LOGS_DIR="$BASE_DIR/logs"
DB=$LOGS_DIR/builds.db
BUILD_SCRIPT=$BIN_DIR/test_kernel_git
KERNELS_localhost="2.6.12 2.6.18 2.6.25"
usage() {
me=`basename $0`
echo "$me: test building Zaptel/DAHDI with various kernels"
echo ""
echo "Usage: $0 command <optional parameters>"
echo " init Create results directory and database."
echo " build [<kernels>] Run the test builds. The default list: "
echo " $KERNELS_localhost"
echo " report [<filter>] Print all results [matching <filter>]"
echo " Default is to print all the resaults."
echo ""
echo "Filters:"
echo " failed: Only failed tests."
echo " fail_type <type> Where fail_type matches <type>."
echo " 2.6* Only builds for a matching kernel version."
echo " Else: Match a string from the build name, which "
echo " is essentially the time it started."
echo ""
}
set -e
if [ -r $BIN_DIR/test_build.conf ]; then . $BIN_DIR/test_build.conf; fi
# Runs the test script, logs the result, and fails if the test command
# has failed.
build_and_check() {
test_name="$1"
test_cmd="$2"
log_file="$3"
results_str="$4"
fail_type=''
set +e
$BUILD_SCRIPT $test_cmd >$log_file 2>&1
rc=$?
set -e
if [ $rc != 0 ]; then
fail_type="$test_name"
echo "$results_str, $rc, '$fail_type', '$log_file');" | $SQLITE $DB
fi
return $rc
}
build_zaptel() {
build_name="$1"
host="$2"
kvers="$3"
log_base="build__${build_name}__${host}__${kvers}"
log_base_full="$LOGS_DIR/$log_base"
log_file="$log_base_full.log"
results_str="INSERT INTO results VALUES ('$build_name', '$host', '$kvers'"
# Due to 'set -e' a failed test exists the script.
build_and_check setver "setver $kvers" "$log_file" "$results_str"
build_and_check clean "test clean" "$log_file" "$results_str"
build_and_check build "build" "$log_file" "$results_str"
# If we got here, all was well.
echo "$results_str, 0, 'complete', '$log_file');" | $SQLITE $DB
}
case "$1" in
init)
mkdir -p $LOGS_DIR
cat <<EOF | $SQLITE $DB
CREATE TABLE runs(name TEXT PRIMARY KEY, time INTEGER DEFAULT CURRENT_TIMESTAMP, driver_ver TEXT);
CREATE TABLE results(name TEXT, system TEXT, kvers TEXT, result INTEGER, fail_type TEXT, log TEXT);
EOF
mkdir -p $LOGS_DIR
;;
build)
cd $BASE_DIR
shift
if [ "$*" != '' ]; then KERNELS_localhost="$*"; fi
driver_ver=`$BUILD_SCRIPT version_driver`
build_name=`date '+%Y%m%d-%H%M%si'`
echo "INSERT INTO runs (name, driver_ver) VALUES ('$build_name', '$driver_ver');" | $SQLITE $DB
for host in $HOSTS; do
eval kernels="\$KERNELS_$host"
for kvers in $kernels; do
build_zaptel $build_name $host $kvers
done
done
;;
report)
case "$2" in
'') where='1=1' ;;
failed) where='result != 0' ;;
fail_type) where="fail_type like \"%$3%\"" ;;
2.6*) where="kvers like \"$2%\"" ;;
*) where="name like \"%$2%\"" ;;
esac
echo "select * from results where $where;" | $SQLITE $DB
;;
*)
usage
echo >&2 "$0: Unknown command '$1'. Aborting."
exit 1
esac

80
build_tools/genmodconf Executable file
View File

@ -0,0 +1,80 @@
#!/bin/sh
# this script makes an attempt to build a proper set of rules
# for loading the DAHDI modules and automatically running dahdi_xcfg
#
# it accepts two parameters:
# the root prefix to be used for finding/creating the files
# the list of module names being installed
#
# the process is as follows:
#
# the file can be located at /etc/modprobe.conf (combined with all
# other rules), /etc/modprobe.d/dahdi (DAHDI only) or /etc/modules.d/dahdi
# (DAHDI only)
#
# when the file is DAHDI rules only, then we don't preserve the existing
# contents of the file; the system administrator can put desired options and
# overrides in a separate file with a name that appears earlier in the sort
# order, so there is no need to edit the file produced by this script
#
# when the file is combined with all other rules, then we make a backup
# of it and remove all the old DAHDI rules we can find, replacing them with
# new ones
#
# in addition, versions of module-init-tools 3.2.0 and later
# have the ability to pass module parameters specified on the modprobe command
# line to commands in 'install' rules, thus keeping them from being lost, so
# we try to determine what version is installed and take advantage of that
toolver=`/sbin/modprobe --version 2>/dev/null| awk '{print $3}' | cut -d. -f2 | cut -d- -f1`
if [ ${toolver} -ge 2 ]; then
cmdopts=\$CMDLINE_OPTS
fi
if [ -d ${1}/etc/modprobe.d ]; then
target=${1}/etc/modprobe.d/dahdi
elif [ -d ${1}/etc/modules.d ]; then
target=${1}/etc/modules.d/dahdi
elif [ -f ${1}/etc/modprobe.conf ]; then
target=${1}/etc/modprobe.conf
combined=1
elif [ -f ${1}/etc/conf.modules ]; then
target=${1}/etc/conf.modules
combined=1
else
echo No suitable location for module rules can be found... exiting.
exit 1
fi
if [ -n "${combined}" ]; then
if [ -f ${target} ]; then
mv ${target} ${target}.bak
cat ${target}.bak | grep -v "alias char-major-250" | grep -v "alias char-major-196" > ${target}
fi
else
if [ -f ${target} ]; then
mv ${target} ${target}.bak
fi
echo "# automatically generated file; do not edit" > ${target}
fi
echo Building ${target}...
for mod in ${2}; do
if ! grep -q "install ${mod} " ${target}; then
echo "install ${mod} /sbin/modprobe --ignore-install ${mod} ${cmdopts} && /sbin/ztcfg" >> ${target}
fi
done
if [ -z "${combined}" ]; then
echo "***"
echo "*** WARNING:"
echo "*** If you had custom settings in ${target},"
echo "*** they have been moved to ${target}.bak."
echo "***"
echo "*** In the future, do not edit ${target}, but"
echo "*** instead put your changes in another file"
echo "*** in the same directory so that they will not"
echo "*** be overwritten by future DAHDI updates."
echo "***"
fi

40
build_tools/genudevrules Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
ver=`udevinfo -V | cut -f3 -d" "`
if [ -z "${ver}" ]; then
# Not found - try udevadm
ver=`udevadm info -V | cut -f3 -d" "`
if [ -z "${ver}" ]; then
# nobody has that old version, anyway.
ver=54
fi
fi
# udev versions prior to 055 use a single '=' for matching key values
# udev versions 055 and later support '==' for that purpose, and versions
# beyond 092 will probably make it mandatory
#
# very old versions of udev required naming rules and permissions rules to be
# in separate files, but it's not clear at what version number that changed
if [ ${ver} -gt 54 ]; then
match="=="
else
match="="
fi
cat <<EOF
# udev rules to generate the /dev/dahdi device files (if not yet provided
# by your distribution):
KERNEL${match}"dahdictl", NAME="dahdi/ctl"
KERNEL${match}"dahditranscode", NAME="dahdi/transcode"
KERNEL${match}"dahditimer", NAME="dahdi/timer"
KERNEL${match}"dahdichannel", NAME="dahdi/channel"
KERNEL${match}"dahdipseudo", NAME="dahdi/pseudo"
KERNEL${match}"dahdi[0-9]*", NAME="dahdi/%n"
# DAHDI devices with ownership/permissions for running as non-root
SUBSYSTEM${match}"dahdi", OWNER="asterisk", GROUP="asterisk", MODE="0660"
EOF

48
build_tools/kernel-cp Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
# A simple wrapper to the kernel.org script checkpatch.pl
# Usage:
#
# svn diff | ./build_tools/kernel-cp -
# ./build_tools/kernel-cp my.diff
# ./build_tools/kernel-cp --file drivers/dahdi/wctdm.c
mydir=`dirname $0`
check_patch_dir="$mydir/cp"
rel_path="scripts/checkpatch.pl"
check_patch="$mydir/checkpatch.pl"
URL='http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=scripts/checkpatch.pl;hb=HEAD'
# Required files in directories in the tree
SUBDIRS="fs ipc lib arch init scripts drivers kernel Documentation include"
set -e
if [ "$1" = 'download' ]; then
if [ -x "$check_patch" ]; then
exit 0
fi
wget -O "$check_patch" "$URL"
if [ `wc -c <"$check_patch"` -lt 1000 ]; then
# already downloaded
# FIXME: redirection fails on downloading and you get a
# short HTML file as your "script".
echo >&2 "$0: Error: Download failed".
exit 1
fi
chmod +x "$check_patch"
exit 0
fi
if [ ! -x "$check_patch" ]; then
echo >&2 "Script $check_patch not found. Download it?"
echo >&2 ""
echo >&2 " $0 download"
exit 1
fi
exec $check_patch --no-tree --no-signoff "$@"

63
build_tools/kernel-doc Executable file
View File

@ -0,0 +1,63 @@
#!/bin/sh
# a wrapper to kernel-doc from the kernel source tree
#
# Copyright (C) 2009 by Xorcom <support@xorcom.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# For 'man' version: build_tools/kernel-doc -f man | man -l -
files="drivers/dahdi/dahdi-base.c"
format="html"
kernel="/lib/modules/`uname -r`/build"
usage() {
me=`basename $0`
cat <<EOF
$me: wrapper around the kernel's kernel-doc script
Extracts kernel-doc from $files .
$me [options]
Options:
-f --format: Alternative output format (man, text, docbook. Default: html)
-k --kernel: kernel source tree. Default: $kernel .
EOF
}
options=`getopt -o f:hk: --long format:,help,kernel: -- "$@"`
if [ $? != 0 ] ; then echo >&2 "Terminating..." ; exit 1 ; fi
eval set -- "$options"
while true ; do
case "$1" in
-f|--format) format="$2"; shift ;;
-h|--help) usage; exit 0;;
-k|--kernel) kernel="$2"; shift ;;
--) shift ; break ;;
esac
shift;
done
if [ "$*" != '' ]; then
files="$*" #FIXME: spaces
fi
script="$kernel/scripts/kernel-doc"
$script -$format $files

323
build_tools/live_dahdi Executable file
View File

@ -0,0 +1,323 @@
#!/bin/sh
LINUX_DIR=${LINUX_DIR:=.}
TOOLS_DIR=${TOOLS_DIR:=../dahdi-tools}
DYNAMIC_LOC="${DYNAMIC_LOC:-no}"
DESTDIR=$PWD/live
KVERS=${KVERS:-`uname -r`}
XPP_SYNC=${XPP_SYNC:-auto}
AST_SCRIPT=${AST_SCRIPT:-/etc/init.d/asterisk}
# Use this file to pass options to modules:
PERLLIBDIR=`perl -V:sitelib | cut -d "'" -f 2`
EXTRA_MODS="crc_ccitt"
# Manual list of modules. They will be loaded by insmod.
# If reside in a subdir, add it explicitly.
MODULES_LOAD="${MODULES_LOAD:-dahdi dahdi_echocan_mg2}"
# this one *is* resolved recusively.
# the only reason to set a different value is if you use hpec / oslec,
# as Zaptel depends on them.
REMOVE_MODULES="${REMOVE_MODULES:-dahdi}" # "dahdi oslec"?
if [ -r $DESTDIR/live.conf ]; then . $DESTDIR/live.conf; fi
MODULES_DIR="$DESTDIR/lib/modules/$KVERS/dahdi"
if [ ! -d "$LINUX_DIR" ]; then
echo >&2 "$0:dahdi-linux dir '$LINUX_DIR' does not exits. Aborting".
exit 1
fi
if [ ! -d "$TOOLS_DIR" ]; then
echo >&2 "$0:dahdi-tools dir '$TOOLS_DIR' does not exits. Aborting".
exit 1
fi
set -e
LINUX_DIR_FULL=`(cd $LINUX_DIR; pwd)`
TOOLS_DIR_FULL=`(cd $TOOLS_DIR; pwd)`
# Give priority to our installed binaries:
PATH=$DESTDIR/sbin:$DESTDIR/usr/sbin:$PATH
export PATH
# TODO: If you already use PERL5DIR, please fix this part:
PERL5LIB="$DESTDIR/$PERLLIBDIR"
export PERL5LIB
# used in xpp_fxloader:
FIRMWARE_DIR="$DESTDIR/usr/share/dahdi"
export FIRMWARE_DIR
ASTRIBANK_TOOL="$DESTDIR/usr/sbin/astribank_tool"
export ASTRIBANK_TOOL
ASTRIBANK_HEXLOAD="$DESTDIR/usr/sbin/astribank_hexload"
export ASTRIBANK_HEXLOAD
# make sure Astribank initialization scripts are from our tree.
xpp_ARGS="$xpp_ARGS initdir=$FIRMWARE_DIR"
#dahdi_ARGS="$dahdi_ARGS initdir=$FIRMWARE_DIR"
if [ "$DYNAMIC_LOC" = 'yes' ]; then
MODULES_LOAD="$MODULES_LOAD dahdi_dynamic dahdi_dynamic_loc"
fi
# the same as xpp/utils/dahdi_drivers .
# With the remote mode, I can't rely on files in the source directory.
dahdi_drivers() {
perl -MDahdi::Hardware -e '
my @drivers = Dahdi::Hardware->drivers;
print join(" ", @drivers);
'
}
# Add modules for existing hardware on the system for the list of
# modules to load.
#
# As module loading is manual with insmod, some manual fixes are needed.
set_modules_to_load() {
for mod in `dahdi_drivers`; do
case "$mod" in
xpp_usb)
MODULES_LOAD="$MODULES_LOAD xpp/xpp xpp/xpd_fxs"
MODULES_LOAD="$MODULES_LOAD xpp/xpd_fxo xpp/xpd_pri"
if [ -r "$MODULES_DIR/xpp/xpd_bri.ko" ]; then
MODULES_LOAD="$MODULES_LOAD xpp/xpd_bri"
fi
MODULES_LOAD="$MODULES_LOAD xpp/xpp_usb"
;;
wctdm24xxp | wcte12xp)
# FIXME: better automation of the voicebus
# dependency:
MODULES_LOAD="$MODULES_LOAD voicebus/dahdi_voicebus $mod/$mod"
EXTRA_MODS="$EXTRA_MODS firmware_class"
;;
wct4xxp | wcte12xp | wctc4xp | wcb4xxp)
MODULES_LOAD="$MODULES_LOAD $mod/$mod"
;;
wanpipe)
: # requires different handling
;;
*)
MODULES_LOAD="$MODULES_LOAD $mod"
;;
esac
done
}
# Initialize the Xorcom Astribank (xpp/) using perl utiliites:
# intended to replace all the the three functions below if user has
# installed the dahdi-perl utilities.
xpp_startup() {
# do nothing if there are no astribank devices:
if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; then return 0; fi
echo "Waiting for Astribank devices to initialize:"
"$FIRMWARE_DIR/waitfor_xpds" # Asusmes a recent dahdi-tools
# overriding locales for the above two, as perl can be noisy
# when locales are missing.
# No register all the devices if they didn't auto-register:
LC_ALL=C dahdi_registration on
# this one could actually be run after dahdi_cfg:
LC_ALL=C xpp_sync "$XPP_SYNC"
}
# recursively unload a module and its dependencies, if possible.
# where's modprobe -r when you need it?
# inputs: module to unload.
# returns: the result from
unload_module() {
module="$1"
line=`lsmod 2>/dev/null | grep "^$1 " || :`
if [ "$line" = '' ]; then return; fi # module was not loaded
set -- $line
# $1: the original module, $2: size, $3: refcount, $4: deps list
mods=`echo $4 | tr , ' '`
ec_modules=""
# xpp_usb keeps the xpds below busy if an xpp hardware is
# connected. Hence must be removed before them:
case "$module" in xpd_*) mods="xpp_usb $mods";; esac
for mod in $mods; do
case "$mod" in
dahdi_echocan_*)
ec_modules="$mod $ec_modules"
;;
*)
# run in a subshell, so it won't step over our vars:
(unload_module $mod)
;;
esac
done
# Now that all the other dependencies are unloaded, we can unload the
# dahdi_echocan modules. The drivers that register spans may keep
# references on the echocan modules before they are unloaded.
for mod in $ec_modules; do
(unload_module $mod)
done
rmmod $module
}
load_dynamic() {
if [ "$DYNAMIC_LOC" != yes ]; then return; fi
local conf_file="$DESTDIR/etc/dahdi/dynamic.conf"
if [ ! -r "$conf_file" ]; then
cat <<EOF >"$conf_file"
dynamic=loc,1:0,5,0
dynamic=loc,1:1,5,0
EOF
fi
dahdi_cfg -c "$conf_file"
}
unload_dynamic() {
if [ "$DYNAMIC_LOC" != yes ]; then return; fi
local conf_file="$DESTDIR/etc/dahdi/dynamic.conf"
if [ ! -r "$conf_file" ]; then return; fi
dahdi_cfg -c "$conf_file" -s || :
}
genconf() {
GENCONF_PARAMETERS=$DESTDIR/etc/dahdi/genconf_parameters \
DAHDI_CONF_FILE=$DESTDIR/etc/dahdi/system.conf \
DAHDI_MODS_FILE=$DESTDIR/etc/dahdi/modules \
CHAN_DAHDI_CHANNELS_FILE=$DESTDIR/etc/asterisk/dahdi-channels.conf \
dahdi_genconf
if [ "$DYNAMIC_LOC" = yes ]; then
cat "$DESTDIR/etc/dahdi/dynamic.conf" >>"$DESTDIR/etc/dahdi/system.conf"
fi
dahdi_cfg -c $DESTDIR/etc/dahdi/system.conf
# TODO: fxotune, hpec
}
run_asterisk() {
$AST_SCRIPT start
}
usage() {
me=`basename $0`
echo "$me: Run DAHDI in a test environment"
echo 'Version: $Id$'
echo ''
echo "Usage: equivalent of:"
echo "$me configure ./configure"
echo "$me install make install"
echo "$me config make config"
echo "$me unload /etc/init.d/dahdi stop"
echo "$me load /etc/init.d/dahdi start"
echo "$me reload /etc/init.d/dahdi restart"
echo "$me xpp-firm (Reset and load xpp firmware)"
echo "$me genconf dahdi_genconf; dahdi_cfg"
echo "$me asterisk /etc/init.d/asterisk start"
echo "$me rsync TARGET (copy filea to /tmp/live in host TARGET)"
echo "$me exec COMMAND (Run COMMAND in 'live' environment)"
echo ""
echo "dahdi-linux: $LINUX_DIR"
echo "dahdi-tools: $TOOLS_DIR"
}
case "$1" in
configure)
shift
cd "$TOOLS_DIR"; ./configure --with-dahdi="$LINUX_DIR_FULL" "$@"
;;
install)
shift
cd "$LINUX_DIR"; make install DESTDIR=$DESTDIR "$@"
cd "$TOOLS_DIR_FULL"; make install DESTDIR=$DESTDIR DYNFS=yes "$@"
;;
config)
shift
cd "$TOOLS_DIR"; make config DESTDIR=$DESTDIR "$@"
mkdir -p $DESTDIR/etc/asterisk
cat >"$FIRMWARE_DIR/live-init.conf" <<EOF
PATH="$PATH" # FIXME: add to existing \$PATH?
export PATH
dahdiconfdir="${DESTDIR}/etc/dahdi"
export dahdiconfdir
EOF
;;
rsync)
if [ $# -ne 2 ]; then
echo >&2 "$0: Error: rsync requires a target parameter".
exit 1
fi
# copy the script itself and the installed directory to the
# target host:
rsync -ai "$0" $DESTDIR "$2:/tmp/"
;;
unload)
# OK for Asterisk not to be running. TODO: a better test?
$AST_SCRIPT stop || :
unload_dynamic
for mod in $REMOVE_MODULES; do
unload_module $mod
done
;;
load)
# TODO: Find a way to use modprobe.
# Or implement a way to pass arguments to modules here (yuck)
set_modules_to_load
for mod in $EXTRA_MODS; do
modprobe $mod || : # FIXME: Make this optional?
done
for module in $MODULES_LOAD; do
eval module_args="\$`basename ${module}`_ARGS"
insmod $MODULES_DIR/$module.ko $module_args
done
xpp_startup
load_dynamic
genconf
# or find a way to reuse init.d start sequence.
# TODO: A local copy of Asterisk, configured with dahdi_gnconf.
# doable, but trickier.
run_asterisk
;;
genconf)
genconf
;;
asterisk)
run_asterisk
;;
reload)
$0 unload
$0 load
;;
exec)
if [ $# -lt 2 ]; then
# No command given: start a subshell in the environemnt
# of the "live" system:
echo >&2 "$0: Error: exec requires a command to run"
exit 1
fi
# Command given: run it:
shift
"$@"
;;
xpp-firm)
# Still broken. Needs to be run several times.
# set XPP_HOTPLUG_DISABLED=yes in /etc/dahdi/init.conf
XPP_FIRMWARE_DIR=$FIRMWARE_DIR \
"$FIRMWARE_DIR/xpp_fxloader" reset
sleep 5
XPP_FIRMWARE_DIR=$FIRMWARE_DIR \
"$FIRMWARE_DIR/xpp_fxloader" load
;;
help|'')
usage
;;
*)
echo >&2 "$0: Error: incorrect command \"$1\". Aborting"
usage
exit 1
esac

67
build_tools/make_static_devs Executable file
View File

@ -0,0 +1,67 @@
#!/bin/sh
set -e
# make_static_devs: create static device files for DAHDI
# Copyright (C) 2010 by Xorcom <support@xorcom.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# In most cases DAHDI device files are generated by udev,
# but there would be cases where you'd want to just have static device
# files. Note that if you do use udev, that static device files will be
# essentially deleted.
BASE_DIR="/dev/dahdi"
usage() {
me=`basename $0`
echo "$me: Generate static DAHDI device files"
echo ""
echo "Usage:"
echo " $me [-h] [-d base_dir]"
echo " -d base_dir: create under base_dir (default: $BASE_DIR)"
echo " -h: this help message."
}
mknod_safe() {
if [ -c $1 ]; then return; fi
mknod "$@"
}
while getopts 'd:h' opt; do
case "$opt" in
h) usage; exit 0;;
d) BASE_DIR="$OPTARG";;
\?) usage; exit 1;;
esac
done
mkdir -p "$BASE_DIR"
mknod_safe "${BASE_DIR}/ctl" c 196 0
mknod_safe "${BASE_DIR}/transcode" c 196 250
mknod_safe "${BASE_DIR}/timer" c 196 253
mknod_safe "${BASE_DIR}/channel" c 196 254
mknod_safe "${BASE_DIR}/pseudo" c 196 255
# The following are not used by Asterisk itself nowadays. Some DAHDI
# users still find it simpler to open them directly rather than using
# /dev/dahdi/channel and the DAHDI_SPECIFY ioctl .
for i in `seq 249`; do
mknod_safe ${BASE_DIR}/$i c 196 $i
done

56
build_tools/make_version Executable file
View File

@ -0,0 +1,56 @@
#!/bin/sh
if [ -f ${1}/.version ]; then
cat ${1}.version
elif [ -f ${1}/.svnrevision ]; then
echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision`
elif [ -d .svn ]; then
PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/${2}/:: | sed -e 's:/: :g'`
BRANCH=0
TEAM=0
REV=`svnversion -c ${1} | cut -d: -f2`
if [ "${PARTS}" = "trunk" ]
then
echo SVN-'trunk'-r${REV}
exit 0
fi
for PART in $PARTS
do
if [ ${BRANCH} != 0 ]
then
RESULT="${RESULT}-${PART}"
break
fi
if [ ${TEAM} != 0 ]
then
RESULT="${RESULT}-${PART}"
continue
fi
if [ "${PART}" = "branches" ]
then
BRANCH=1
RESULT="branch"
continue
fi
if [ "${PART}" = "tags" ]
then
BRANCH=1
RESULT="tag"
continue
fi
if [ "${PART}" = "team" ]
then
TEAM=1
continue
fi
done
echo SVN-${RESULT##-}-r${REV}
fi

9
build_tools/make_version_h Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
cat << END
/*
* version.h
* Automatically generated
*/
#define DAHDI_VERSION "${DAHDIVERSION}"
END

101
build_tools/test_kernel_git Executable file
View File

@ -0,0 +1,101 @@
#!/bin/sh
set -e
GIT_URL=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
CONF_FILE=build_tools/git_test.conf
usage() {
me=`basename $0`
echo "$me: test building DAHDI vs. kernel from git"
echo "Usage:"
echo " $me checkout <kerneldir> Pull a kernel version into <kerneldir>"
echo " $me update Update (pull) the kernel tree."
echo " $me setver <kernel_ver> Set the kernel version"
echo " $me versions Print available versions"
echo " $me version Print current (kernel) version"
echo " $me version_driver Print the version of DAHDI"
echo " $me build Test-build"
echo " $me git <git command> Run <git command>"
echo ""
echo " $me versions [pattern] List available versions."
}
# Set a variable in $CONF_FILE
# The format of CONF_FILE is assumed to be:
# VAR=value
# in shell syntax. "value" may be quoted.
# "value should not contain a '|' character.
set_var() {
var="$1"
val="$2"
if grep -q "^$var=" $CONF_FILE 2>/dev/null; then
sed -i -e "s|^$var=.*|$var=\"$val\"|" $CONF_FILE
else
echo "$var=\"$val\"" >>$CONF_FILE
fi
}
if [ -r "$CONF_FILE" ]; then . "$CONF_FILE"; fi
if echo "$CONF_FILE" | grep -qv '^/'; then
# make CONF_FILE an absolute path:
CONF_FILE="$PWD/$CONF_FILE"
fi
command="$1"
case "$command" in
checkout)
kernel_dir="$2"
cd "$kernel_dir"
git clone $GIT_URL
set_var kernel_dir "$kernel_dir/linux-2.6"
;;
update)
cd "$kernel_dir"
git pull
;;
git)
cd "$kernel_dir"
shift
git "$@"
;;
versions)
cd "$kernel_dir"
git tag -l $2 | cut -c2-
;;
version)
cd "$kernel_dir"
echo "Configured: $kernel_ver"
echo -n "Actual: "
git describe | cut -c2-
;;
version_driver)
version_h=include/dahdi/version.h
make $version_h >/dev/null
awk -F'"' '/DAHDI_VERSION/{print $2}' $version_h
;;
setver)
kernel_ver="$2"
tag="v$kernel_ver"
cd "$kernel_dir"
git-reset --hard "$tag"
make distclean
make defconfig modules_prepare
set_var kernel_ver "$kernel_ver"
;;
test|build)
# you can pass extra parameters to the make command in
# two ways:
# 1. Set the value of MAKE_PARAMS in git_test.conf .
# 2. Any extra command-line parameter.
shift
make KSRC="$kernel_dir" KVERS=$kernel_ver $MAKE_PARAMS "$@"
;;
*)
echo "$0: no such command $command. Aborting."
usage
exit 1
;;
esac

64
build_tools/uninstall-modules Executable file
View File

@ -0,0 +1,64 @@
#!/bin/sh
# This script takes two arguments: a top-level module name, and a kernel version string
#
# It will search the entire /lib/modules directory tree for the given kernel version,
# and find all modules that are dependent (even indirectly) on the specified module.
# After producing that list, it will remove all those modules.
base="${1}"
deptree="${base}"
rmlist=""
founddep=1
checkmod() {
SAVEIFS="${IFS}"
IFS=","
modname=`basename ${1}`
modname=${modname%.ko}
if test "${modname}" = "${base}"; then
rmlist="${rmlist} ${1}"
IFS="${SAVEIFS}"
return
fi
for dep in `modinfo -F depends ${1}`; do
for mod in ${deptree}; do
if test "${dep}" = "${mod}"; then
addit=1
for checkmod in ${deptree}; do
if test "${checkmod}" = "${modname}"; then
addit=0
break
fi
done
if test "${addit}" = "1"; then
deptree="${deptree},${modname%.ko}"
rmlist="${rmlist} ${1}"
founddep=1
fi
fi
done
done
IFS="${SAVEIFS}"
}
while test "${founddep}" = "1"; do
founddep=0
find /lib/modules/${2}/misc -name \*.ko -print > /tmp/modlist.$$ 2> /dev/null
find /lib/modules/${2}/extra -name \*.ko -print >> /tmp/modlist.$$ 2> /dev/null
find /lib/modules/${2}/zaptel -name \*.ko -print >> /tmp/modlist.$$ 2> /dev/null
find /lib/modules/${2}/dahdi -name \*.ko -print >> /tmp/modlist.$$ 2> /dev/null
exec 9<&0 < /tmp/modlist.$$
while read mod; do
checkmod ${mod}
done
exec 0<&9 9<&-
rm /tmp/modlist.$$
done
if test -n "${rmlist}"; then
for mod in ${rmlist}; do
rm -f ${mod}
done
fi

149
drivers/dahdi/Kbuild Normal file
View File

@ -0,0 +1,149 @@
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI) += dahdi.o
#obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DUMMY) += dahdi_dummy.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC) += dahdi_dynamic.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_LOC) += dahdi_dynamic_loc.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_ETH) += dahdi_dynamic_eth.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_ETHMF) += dahdi_dynamic_ethmf.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TRANSCODE) += dahdi_transcode.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT4XXP) += wct4xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTC4XXP) += wctc4xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP) += wctdm24xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE12XP) += wcte12xp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM) += wctdm.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VOICEBUS) += voicebus/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCB4XXP) += wcb4xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT1XXP) += wct1xxp.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE11XP) += wcte11xp.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCFXO) += wcfxo.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TOR2) += tor2.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_PCIRADIO) += pciradio.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPP) += xpp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_JPAH) += dahdi_echocan_jpah.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_STEVE) += dahdi_echocan_sec.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_STEVE2) += dahdi_echocan_sec2.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_KB1) += dahdi_echocan_kb1.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_MG2) += dahdi_echocan_mg2.o
obj-m += $(DAHDI_MODULES_EXTRA)
# Only enable this if you think you know what you're doing. This is not
# supported yet:
#obj-m += dahdi_echocan_oslec.o
#
# A quick and dirty way to build OSLEC, if you happened to place it
# yourself in the dahdi source tree. This is experimental. See README
# regarding OSLEC.
#obj-m += ../staging/echo/
CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(src)
ifndef HOTPLUG_FIRMWARE
ifneq (,$(filter y m,$(CONFIG_FW_LOADER)))
HOTPLUG_FIRMWARE := yes
else
HOTPLUG_FIRMWARE := no
endif
export HOTPLUG_FIRMWARE
endif
# fix typo present in CentOS and RHEL 2.6.9 kernels
BAD_KERNELS_VERS := 22 34 34.0.1 34.0.2
BAD_KERNELS := $(foreach ver,$(BAD_KERNELS_VERS),2.6.9-$(ver).EL 2.6.9-$(ver).ELsmp)
ifneq (,$(filter $(KVERS),$(BAD_KERNELS)))
EXTRA_CFLAGS+=-Drw_lock_t=rwlock_t
endif
# A number of Fedora 10 (9 also?) kernels backported hrtimer to 2.6.27
# as part of an ALSA backport. TODO: Any better way to detect that?
ifeq (1,$(shell fgrep -q ' hrtimer_set_expires' include/linux/hrtimer.h 2>/dev/null && echo 1))
EXTRA_CFLAGS+=-DHAVE_HRTIMER_ACCESSORS=1
endif
ifeq (1,$(shell fgrep -q 'wait_for_completion_timeout' include/linux/completion.h 2>/dev/null && echo 1))
CFLAGS_MODULE+=-DHAVE_WAIT_FOR_COMPLETION_TIMEOUT=1
endif
# In 2.6.18 skb_linearize changed; however, some distros backported the change
ifneq (,$(wildcard $(srctree)/include/linux/skbuff.h))
ifeq ($(shell grep "skb_linearize.*(.*, .* gfp)" $(srctree)/include/linux/skbuff.h),)
CFLAGS_dahdi_dynamic_eth.o := -DNEW_SKB_LINEARIZE
CFLAGS_dahdi_dynamic_ethmf.o := -DNEW_SKB_LINEARIZE
endif
endif
dahdi-objs := dahdi-base.o
###############################################################################
# Find appropriate ARCH value for VPMADT032 and HPEC binary modules
###############################################################################
ifeq ($(ARCH),i386)
DAHDI_ARCH=x86_32
else
ifeq ($(ARCH),x86_64)
DAHDI_ARCH=x86_64
else
ifeq ($(ARCH),x86)
ifeq ($(CONFIG_X86_32),y)
DAHDI_ARCH=x86_32
else
DAHDI_ARCH=x86_64
endif
else
$(warning CPU Architecture '$(ARCH)' does not support VPMADT032 or HPEC. Skipping.)
endif
endif
endif
###############################################################################
# VPMADT032 Loader
###############################################################################
dahdi_vpmadt032_loader-objs := vpmadt032_loader/dahdi_vpmadt032_loader.o
ifneq ($(DAHDI_ARCH),)
ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o_shipped),)
VPMADT032_LOADER_PRESENT=yes
dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER) += dahdi_vpmadt032_loader.o
endif
endif
###############################################################################
# HPEC Support
###############################################################################
dahdi_echocan_hpec-objs := hpec/dahdi_echocan_hpec.o
CFLAGS_dahdi_echocan_hpec.o := -I$(src)/hpec
ifneq ($(DAHDI_ARCH),)
ifneq ($(wildcard $(src)/hpec/hpec_$(DAHDI_ARCH).o_shipped),)
HPEC_PRESENT=yes
dahdi_echocan_hpec-objs += hpec/hpec_$(DAHDI_ARCH).o
endif
endif
ifeq ($(HPEC_PRESENT),yes)
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_HPEC) += dahdi_echocan_hpec.o
endif
$(obj)/pciradio.o: $(obj)/radfw.h
$(obj)/tor2.o: $(obj)/tor2fw.h
hostprogs-y := $(obj)/makefw
$(obj)/tor2fw.h: $(src)/tormenta2.rbt $(obj)/makefw
$(obj)/makefw $< tor2fw > $@
$(obj)/radfw.h: $(src)/pciradio.rbt $(obj)/makefw
$(obj)/makefw $< radfw > $@
$(obj)/makefw: $(src)/makefw.c
$(HOSTCC) -o $@ $^
clean-files := radfw.h tor2fw.h

294
drivers/dahdi/Kconfig Normal file
View File

@ -0,0 +1,294 @@
#
# DAHDI configuration
#
menuconfig DAHDI
tristate "DAHDI support"
select CRC_CCITT
default m
---help---
DAHDI basic infrastructure.
To compile this driver as a module, choose M here: the
module will be called dahdi.
If unsure, say Y.
config DAHDI_ECHOCAN
tristate "DADHI Echo Cancelers (software)"
depends on DAHDI
default DAHDI
config DAHDI_ECHOCAN_MG2
tristate "DADHI MG2 Echo Canceler"
depends on DAHDI_ECHOCAN
default DAHDI_ECHOCAN
---help---
To compile this driver as a module, choose M here: the
module will be called dahdi_echocancel_mg2.
If unsure, say Y.
config DAHDI_ECHOCAN_KB1
tristate "DADHI KB1 Echo Canceler"
depends on DAHDI_ECHOCAN
default DAHDI_ECHOCAN
---help---
To compile this driver as a module, choose M here: the
module will be called dahdi_echocancel_kb1.
If unsure, say Y.
config DAHDI_ECHOCAN_SEC
tristate "DADHI SEC Echo Canceler"
depends on DAHDI_ECHOCAN
default DAHDI_ECHOCAN
---help---
To compile this driver as a module, choose M here: the
module will be called dahdi_echocancel_sec.
If unsure, say Y.
config DAHDI_ECHOCAN_SEC2
tristate "DADHI SEC2 Echo Canceler"
depends on DAHDI_ECHOCAN
default DAHDI_ECHOCAN
---help---
To compile this driver as a module, choose M here: the
module will be called dahdi_echocancel_sec2.
If unsure, say Y.
config DAHDI_ECHOCAN_HPEC
tristate "DADHI HPEC Echo Canceler"
depends on DAHDI_ECHOCAN
default DAHDI_ECHOCAN
---help---
To compile this driver as a module, choose M here: the
module will be called dahdi_echocancel_hpec.
If unsure, say Y.
config DAHDI_WCTDM
tristate "Digium Wildcard TDM400P Support"
depends on DAHDI && PCI
default DAHDI
---help---
This driver provides support for the Digium Wildcard TDM400P.
To compile this driver as a module, choose M here: the
module will be called wctdm.
If unsure, say Y.
config DAHDI_WCT4XXP
tristate "Digium Wildcard dual- and quad-T1/E1/J1 Support"
depends on DAHDI && PCI
default DAHDI
---help---
This driver provides support for the following Digium
Wildcard products:
* TE205/206/207/210/211/212P (PCI/PCI-X)
* TE220 (PCI-E)
* TE405/406/407/410/411/412P (PCI/PCI-X)
* TE420 (PCI-E)
To compile this driver as a module, choose M here: the
module will be called wct4xxp.
If unsure, say Y.
config DAHDI_TRANSCODE
tristate "DAHDI transcoding support"
depends on DAHDI
default DAHDI
---help---
DAHDI transcoding infrastructure.
To compile this driver as a module, choose M here: the
module will be called dahdi_transcode.
If unsure, say Y.
config DAHDI_WCTC4XXP
tristate "Digium Wildcard TC400B Support"
depends on DAHDI_TRANSCODE && PCI
default DAHDI
---help---
This driver provides support for the Digium Wildcard TC400B.
To compile this driver as a module, choose M here: the
module will be called wctc4xxp.
If unsure, say Y.
config DAHDI_VOICEBUS
tristate "VoiceBus(tm) Interface Library"
depends on PCI
default DAHDI
---help---
This driver provides the common interface for telephony cards that
use the VoiceBus(tm) interface. It also contains common supporting
libraries for the VPMADT032 hardware echo cancelation module that
is available for the VoiceBus cards.
To compile this driver as a module, choose M here: the module will
be called voicebus.
If unsure, say Y.
config DAHDI_WCTDM24XXP
tristate "Digium Wildcard VoiceBus analog card Support"
depends on DAHDI && DAHDI_VOICEBUS
default DAHDI
---help---
This driver provides support for the following Digium
Wildcard products:
* TDM410P (PCI/PCI-X)
* AEX410 (PCI-E)
* TDM800P (PCI/PCI-X)
* AEX800 (PCI-E)
* TDM2400P (PCI/PCI-X)
* AEX2400 (PCI-E)
To compile this driver as a module, choose M here: the
module will be called wctdm24xxp.
If unsure, say Y.
config DAHDI_WCTE12XP
tristate "Digium Wildcard VoiceBus digital card Support"
depends on DAHDI && DAHDI_VOICEBUS
default DAHDI
---help---
This driver provides support for the following Digium
Wildcard products:
* TE120P (PCI/PCI-X)
* TE121 (PCI/PCI-X)
* TE122 (PCI-E)
To compile this driver as a module, choose M here: the
module will be called wcte12xp.
If unsure, say Y.
config DAHDI_PCIRADIO
tristate "PCI Radio Support"
depends on DAHDI && PCI
default DAHDI
---help---
To compile this driver as a module, choose M here: the
module will be called pciradio.
If unsure, say Y.
config DAHDI_DUMMY
tristate "Dummy (no hardware) Timing Support"
depends on DAHDI
default DAHDI
---help---
This module provides timing support for applications that
use DAHDI conference mixing services, pseudo channels or
for other purposes.
To compile this driver as a module, choose M here: the
module will be called dahdi_dummy.
If unsure, say Y.
config DAHDI_DYNAMIC
tristate "Dynamic (virtual) Span Support"
depends on DAHDI
default DAHDI
---help---
This module provides support for virtual spans, which are
emulated or provided using various technologies.
To compile this driver as a module, choose M here: the
module will be called dahdi_dynamic.
If unsure, say Y.
config DAHDI_DYNAMIC_ETH
tristate "Ethernet (TDMoE) Span Support"
depends on DAHDI && DAHDI_DYNAMIC
default DAHDI
---help---
This module provides support for spans over Ethernet,
using the TDMoE protocol.
To compile this driver as a module, choose M here: the
module will be called dahdi_dynamic_eth.
If unsure, say Y.
config DAHDI_DYNAMIC_ETHMF
tristate "Ethernet (TDMoE) Multi-Frame Span Support"
depends on DAHDI && DAHDI_DYNAMIC
default DAHDI
---help---
This module provides support for spans over Ethernet,
using the TDMoE-Multi-Frame protocol.
To compile this driver as a module, choose M here: the
module will be called dahdi_dynamic_ethmf.
If unsure, say Y.
config DAHDI_DYNAMIC_LOC
tristate "Local (loopback) Span Support"
depends on DAHDI && DAHDI_DYNAMIC
default DAHDI
---help---
This module provides support for spans in the local system,
primarily used for looping and monitoring other spans.
To compile this driver as a module, choose M here: the
module will be called dahdi_dynamic_loc.
If unsure, say Y.
config DAHDI_TOR2
tristate "Tormenta2 quad-port T1/E1 Support"
depends on DAHDI && PCI
default DAHDI
---help---
To compile this driver as a module, choose M here: the
module will be called tor2.
If unsure, say Y.
config DAHDI_WCFXO
tristate "Digium Wildcard X100P Support"
depends on DAHDI && PCI
default DAHDI
---help---
To compile this driver as a module, choose M here: the
module will be called wcfxo.
If unsure, say Y.
config DAHDI_WCT1XXP
tristate "Digium Wildcard T100P Support"
depends on DAHDI && PCI
default DAHDI
---help---
To compile this driver as a module, choose M here: the
module will be called wct1xxp.
If unsure, say Y.
config DAHDI_WCTE11XP
tristate "Digium Wildcard TE110P Support"
depends on DAHDI && PCI
default DAHDI
---help---
To compile this driver as a module, choose M here: the
module will be called wcte11xp.
If unsure, say Y.
source "drivers/dahdi/xpp/Kconfig"

6
drivers/dahdi/Makefile Normal file
View File

@ -0,0 +1,6 @@
ifdef KBUILD_EXTMOD
# We only get here on kernels 2.6.0-2.6.9 .
# For newer kernels, Kbuild will be included directly by the kernel
# build system.
include $(src)/Kbuild
endif

73
drivers/dahdi/adt_lec.c Normal file
View File

@ -0,0 +1,73 @@
/*
* ADT Line Echo Canceller Parameter Parsing
*
* Copyright (C) 2008-2009 Digium, Inc.
*
* Kevin P. Fleming <kpfleming@digium.com>
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#ifndef _ADT_LEC_C
#define _ADT_LEC_C
#include <linux/ctype.h>
static inline void adt_lec_init_defaults(struct adt_lec_params *params, __u32 tap_length)
{
params->tap_length = tap_length;
params->nlp_type = 0;
params->nlp_max_suppress = 0;
params->nlp_threshold = 0;
}
static int adt_lec_parse_params(struct adt_lec_params *params,
struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
{
unsigned int x;
char *c;
params->tap_length = ecp->tap_length;
for (x = 0; x < ecp->param_count; x++) {
for (c = p[x].name; *c; c++)
*c = tolower(*c);
if (!strcmp(p[x].name, "nlp_type")) {
switch (p[x].value) {
case ADT_LEC_NLP_OFF:
case ADT_LEC_NLP_MUTE:
case ADT_LEC_RANDOM_NOISE:
case ADT_LEC_HOTH_NOISE:
case ADT_LEC_SUPPRESS:
params->nlp_type = p[x].value;
break;
default:
return -EINVAL;
}
} else if (!strcmp(p[x].name, "nlp_thresh")) {
params->nlp_threshold = p[x].value;
} else if (!strcmp(p[x].name, "nlp_suppress")) {
params->nlp_max_suppress = p[x].value;
} else {
return -EINVAL;
}
}
return 0;
}
#endif /* _ADT_LEC_C */

48
drivers/dahdi/adt_lec.h Normal file
View File

@ -0,0 +1,48 @@
/*
* ADT Line Echo Canceller Parameter Parsing
*
* Copyright (C) 2008 Digium, Inc.
*
* Kevin P. Fleming <kpfleming@digium.com>
*
* All rights reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#ifndef _ADT_LEC_H
#define _ADT_LEC_H
enum adt_lec_nlp_type {
ADT_LEC_NLP_OFF = 0,
ADT_LEC_NLP_MUTE,
ADT_LEC_RANDOM_NOISE,
ADT_LEC_HOTH_NOISE,
ADT_LEC_SUPPRESS,
};
enum adt_companding {
ADT_COMP_ULAW = 0,
ADT_COMP_ALAW,
};
struct adt_lec_params {
__u32 tap_length;
enum adt_lec_nlp_type nlp_type;
__u32 nlp_threshold;
__u32 nlp_max_suppress;
enum adt_companding companding;
};
#endif /* _ADT_LEC_H */

378
drivers/dahdi/arith.h Normal file
View File

@ -0,0 +1,378 @@
/*
* Handy add/subtract functions to operate on chunks of shorts.
* Feel free to add customizations for additional architectures
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#ifndef _DAHDI_ARITH_H
#define _DAHDI_ARITH_H
#ifdef CONFIG_DAHDI_MMX
#ifdef DAHDI_CHUNKSIZE
static inline void __ACSS(volatile short *dst, const short *src)
{
__asm__ __volatile__ (
"movq 0(%0), %%mm0;\n"
"movq 0(%1), %%mm1;\n"
"movq 8(%0), %%mm2;\n"
"movq 8(%1), %%mm3;\n"
"paddsw %%mm1, %%mm0;\n"
"paddsw %%mm3, %%mm2;\n"
"movq %%mm0, 0(%0);\n"
"movq %%mm2, 8(%0);\n"
: "=r" (dst)
: "r" (src), "0" (dst)
: "memory"
#ifdef CLOBBERMMX
, "%mm0", "%mm1", "%mm2", "%mm3"
#endif
);
}
static inline void __SCSS(volatile short *dst, const short *src)
{
__asm__ __volatile__ (
"movq 0(%0), %%mm0;\n"
"movq 0(%1), %%mm1;\n"
"movq 8(%0), %%mm2;\n"
"movq 8(%1), %%mm3;\n"
"psubsw %%mm1, %%mm0;\n"
"psubsw %%mm3, %%mm2;\n"
"movq %%mm0, 0(%0);\n"
"movq %%mm2, 8(%0);\n"
: "=r" (dst)
: "r" (src), "0" (dst)
: "memory"
#ifdef CLOBBERMMX
, "%mm0", "%mm1", "%mm2", "%mm3"
#endif
);
}
#if (DAHDI_CHUNKSIZE == 8)
#define ACSS(a,b) __ACSS(a,b)
#define SCSS(a,b) __SCSS(a,b)
#elif (DAHDI_CHUNKSIZE > 8)
static inline void ACSS(volatile short *dst, const short *src)
{
int x;
for (x=0;x<DAHDI_CHUNKSIZE;x+=8)
__ACSS(dst + x, src + x);
}
static inline void SCSS(volatile short *dst, const short *src)
{
int x;
for (x=0;x<DAHDI_CHUNKSIZE;x+=8)
__SCSS(dst + x, src + x);
}
#else
#error No MMX for DAHDI_CHUNKSIZE < 8
#endif
#endif
static inline int CONVOLVE(const int *coeffs, const short *hist, int len)
{
int sum;
/* Divide length by 16 */
len >>= 4;
/* Clear our accumulator, mm4 */
/*
For every set of eight...
Load 16 coefficients into four registers...
Shift each word right 16 to make them shorts...
Pack the resulting shorts into two registers...
With the coefficients now in mm0 and mm2, load the
history into mm1 and mm3...
Multiply/add mm1 into mm0, and mm3 into mm2...
Add mm2 into mm0 (without saturation, alas). Now we have two half-results.
Accumulate in mm4 (again, without saturation, alas)
*/
__asm__ (
"pxor %%mm4, %%mm4;\n"
"mov %1, %%edi;\n"
"mov %2, %%esi;\n"
"mov %3, %%ecx;\n"
"1:"
"movq 0(%%edi), %%mm0;\n"
"movq 8(%%edi), %%mm1;\n"
"movq 16(%%edi), %%mm2;\n"
"movq 24(%%edi), %%mm3;\n"
/* can't use 4/5 since 4 is the accumulator for us */
"movq 32(%%edi), %%mm6;\n"
"movq 40(%%edi), %%mm7;\n"
"psrad $16, %%mm0;\n"
"psrad $16, %%mm1;\n"
"psrad $16, %%mm2;\n"
"psrad $16, %%mm3;\n"
"psrad $16, %%mm6;\n"
"psrad $16, %%mm7;\n"
"packssdw %%mm1, %%mm0;\n"
"packssdw %%mm3, %%mm2;\n"
"packssdw %%mm7, %%mm6;\n"
"movq 0(%%esi), %%mm1;\n"
"movq 8(%%esi), %%mm3;\n"
"movq 16(%%esi), %%mm7;\n"
"pmaddwd %%mm1, %%mm0;\n"
"pmaddwd %%mm3, %%mm2;\n"
"pmaddwd %%mm7, %%mm6;\n"
"paddd %%mm6, %%mm4;\n"
"paddd %%mm2, %%mm4;\n"
"paddd %%mm0, %%mm4;\n"
/* Come back and do for the last few bytes */
"movq 48(%%edi), %%mm6;\n"
"movq 56(%%edi), %%mm7;\n"
"psrad $16, %%mm6;\n"
"psrad $16, %%mm7;\n"
"packssdw %%mm7, %%mm6;\n"
"movq 24(%%esi), %%mm7;\n"
"pmaddwd %%mm7, %%mm6;\n"
"paddd %%mm6, %%mm4;\n"
"add $64, %%edi;\n"
"add $32, %%esi;\n"
"dec %%ecx;\n"
"jnz 1b;\n"
"movq %%mm4, %%mm0;\n"
"psrlq $32, %%mm0;\n"
"paddd %%mm0, %%mm4;\n"
"movd %%mm4, %0;\n"
: "=r" (sum)
: "r" (coeffs), "r" (hist), "r" (len)
: "%ecx", "%edi", "%esi"
);
return sum;
}
static inline void UPDATE(volatile int *taps, const short *history, const int nsuppr, const int ntaps)
{
int i;
int correction;
for (i=0;i<ntaps;i++) {
correction = history[i] * nsuppr;
taps[i] += correction;
}
}
static inline void UPDATE2(volatile int *taps, volatile short *taps_short, const short *history, const int nsuppr, const int ntaps)
{
int i;
int correction;
#if 0
ntaps >>= 4;
/* First, load up taps, */
__asm__ (
"pxor %%mm4, %%mm4;\n"
"mov %0, %%edi;\n"
"mov %1, %%esi;\n"
"mov %3, %%ecx;\n"
"1:"
"jnz 1b;\n"
"movq %%mm4, %%mm0;\n"
"psrlq $32, %%mm0;\n"
"paddd %%mm0, %%mm4;\n"
"movd %%mm4, %0;\n"
: "=r" (taps), "=r" (taps_short)
: "r" (history), "r" (nsuppr), "r" (ntaps), "0" (taps)
: "%ecx", "%edi", "%esi"
);
#endif
#if 1
for (i=0;i<ntaps;i++) {
correction = history[i] * nsuppr;
taps[i] += correction;
taps_short[i] = taps[i] >> 16;
}
#endif
}
static inline int CONVOLVE2(const short *coeffs, const short *hist, int len)
{
int sum;
/* Divide length by 16 */
len >>= 4;
/* Clear our accumulator, mm4 */
/*
For every set of eight...
Load in eight coefficients and eight historic samples, multliply add and
accumulate the result
*/
__asm__ (
"pxor %%mm4, %%mm4;\n"
"mov %1, %%edi;\n"
"mov %2, %%esi;\n"
"mov %3, %%ecx;\n"
"1:"
"movq 0(%%edi), %%mm0;\n"
"movq 8(%%edi), %%mm2;\n"
"movq 0(%%esi), %%mm1;\n"
"movq 8(%%esi), %%mm3;\n"
"pmaddwd %%mm1, %%mm0;\n"
"pmaddwd %%mm3, %%mm2;\n"
"paddd %%mm2, %%mm4;\n"
"paddd %%mm0, %%mm4;\n"
"movq 16(%%edi), %%mm0;\n"
"movq 24(%%edi), %%mm2;\n"
"movq 16(%%esi), %%mm1;\n"
"movq 24(%%esi), %%mm3;\n"
"pmaddwd %%mm1, %%mm0;\n"
"pmaddwd %%mm3, %%mm2;\n"
"paddd %%mm2, %%mm4;\n"
"paddd %%mm0, %%mm4;\n"
"add $32, %%edi;\n"
"add $32, %%esi;\n"
"dec %%ecx;\n"
"jnz 1b;\n"
"movq %%mm4, %%mm0;\n"
"psrlq $32, %%mm0;\n"
"paddd %%mm0, %%mm4;\n"
"movd %%mm4, %0;\n"
: "=r" (sum)
: "r" (coeffs), "r" (hist), "r" (len)
: "%ecx", "%edi", "%esi"
);
return sum;
}
static inline short MAX16(const short *y, int len, int *pos)
{
int k;
short max = 0;
int bestpos = 0;
for (k=0;k<len;k++) {
if (max < y[k]) {
bestpos = k;
max = y[k];
}
}
*pos = (len - 1 - bestpos);
return max;
}
#else
#ifdef DAHDI_CHUNKSIZE
static inline void ACSS(short *dst, short *src)
{
int x;
/* Add src to dst with saturation, storing in dst */
#ifdef BFIN
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
dst[x] = __builtin_bfin_add_fr1x16(dst[x], src[x]);
#else
int sum;
for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
sum = dst[x] + src[x];
if (sum > 32767)
sum = 32767;
else if (sum < -32768)
sum = -32768;
dst[x] = sum;
}
#endif
}
static inline void SCSS(short *dst, short *src)
{
int x;
/* Subtract src from dst with saturation, storing in dst */
#ifdef BFIN
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
dst[x] = __builtin_bfin_sub_fr1x16(dst[x], src[x]);
#else
int sum;
for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
sum = dst[x] - src[x];
if (sum > 32767)
sum = 32767;
else if (sum < -32768)
sum = -32768;
dst[x] = sum;
}
#endif
}
#endif /* DAHDI_CHUNKSIZE */
static inline int CONVOLVE(const int *coeffs, const short *hist, int len)
{
int x;
int sum = 0;
for (x=0;x<len;x++)
sum += (coeffs[x] >> 16) * hist[x];
return sum;
}
static inline int CONVOLVE2(const short *coeffs, const short *hist, int len)
{
int x;
int sum = 0;
for (x=0;x<len;x++)
sum += coeffs[x] * hist[x];
return sum;
}
static inline void UPDATE(int *taps, const short *history, const int nsuppr, const int ntaps)
{
int i;
int correction;
for (i=0;i<ntaps;i++) {
correction = history[i] * nsuppr;
taps[i] += correction;
}
}
static inline void UPDATE2(int *taps, short *taps_short, const short *history, const int nsuppr, const int ntaps)
{
int i;
int correction;
for (i=0;i<ntaps;i++) {
correction = history[i] * nsuppr;
taps[i] += correction;
taps_short[i] = taps[i] >> 16;
}
}
static inline short MAX16(const short *y, int len, int *pos)
{
int k;
short max = 0;
int bestpos = 0;
for (k=0;k<len;k++) {
if (max < y[k]) {
bestpos = k;
max = y[k];
}
}
*pos = (len - 1 - bestpos);
return max;
}
#endif /* MMX */
#endif /* _DAHDI_ARITH_H */

60
drivers/dahdi/biquad.h Normal file
View File

@ -0,0 +1,60 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* biquad.h - General telephony bi-quad section routines (currently this just
* handles canonic/type 2 form)
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 Steve Underwood
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
static inline void biquad2_init (biquad2_state_t *bq,
int32_t gain,
int32_t a1,
int32_t a2,
int32_t b1,
int32_t b2)
{
bq->gain = gain;
bq->a1 = a1;
bq->a2 = a2;
bq->b1 = b1;
bq->b2 = b2;
bq->z1 = 0;
bq->z2 = 0;
}
/*- End of function --------------------------------------------------------*/
static inline int16_t biquad2 (biquad2_state_t *bq, int16_t sample)
{
int32_t y;
int32_t z0;
z0 = sample*bq->gain + bq->z1*bq->a1 + bq->z2*bq->a2;
y = z0 + bq->z1*bq->b1 + bq->z2*bq->b2;
bq->z2 = bq->z1;
bq->z1 = z0 >> 15;
y >>= 15;
return y;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

8764
drivers/dahdi/dahdi-base.c Normal file

File diff suppressed because it is too large Load Diff

286
drivers/dahdi/dahdi_dummy.c Normal file
View File

@ -0,0 +1,286 @@
/*
* Dummy DAHDI Driver for DAHDI Telephony interface
*
* Required: kernel > 2.6.0
*
* Written by Robert Pleh <robert.pleh@hermes.si>
* 2.6 version by Tony Hoyle
* Unified by Mark Spencer <markster@digium.com>
*
* Converted to use HighResTimers on i386 by Jeffery Palmer <jeff@triggerinc.com>
*
* Copyright (C) 2002, Hermes Softlab
* Copyright (C) 2004-2009, Digium, Inc.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
/*
* To use the high resolution timers, in your kernel CONFIG_HIGH_RES_TIMERS
* needs to be enabled (Processor type and features -> High Resolution
* Timer Support), and optionally HPET (Processor type and features ->
* HPET Timer Support) provides a better clock source.
*/
#include <linux/version.h>
#if defined(CONFIG_HIGH_RES_TIMERS) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
#define USE_HIGHRESTIMER
#endif
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/moduleparam.h>
#if defined(USE_HIGHRESTIMER)
#include <linux/hrtimer.h>
#else
#include <linux/time.h>
#endif
#include <dahdi/kernel.h>
#ifndef HAVE_HRTIMER_ACCESSORS
#if defined(USE_HIGHRESTIMER) && \
(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28))
/* Compatibility with new hrtimer interface */
static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
{
return timer->expires;
}
static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
{
timer->expires = time;
}
#endif
#endif
struct dahdi_dummy {
struct dahdi_span span;
struct dahdi_chan _chan;
struct dahdi_chan *chan;
#if !defined(USE_HIGHRESTIMER)
unsigned long calls_since_start;
struct timespec start_interval;
#endif
};
static struct dahdi_dummy *ztd;
static int debug = 0;
#ifdef USE_HIGHRESTIMER
#define CLOCK_SRC "HRtimer"
static struct hrtimer zaptimer;
#define DAHDI_RATE 1000 /* DAHDI ticks per second */
#define DAHDI_TIME (1000000 / DAHDI_RATE) /* DAHDI tick time in us */
#define DAHDI_TIME_NS (DAHDI_TIME * 1000) /* DAHDI tick time in ns */
#else
#define CLOCK_SRC "Linux26"
static struct timer_list timer;
static atomic_t shutdown;
#define JIFFIES_INTERVAL max(HZ/250, 1) /* 4ms is fine for dahdi_dummy */
#endif
/* Different bits of the debug variable: */
#define DEBUG_GENERAL (1 << 0)
#define DEBUG_TICKS (1 << 1)
#if defined(USE_HIGHRESTIMER)
static enum hrtimer_restart dahdi_dummy_hr_int(struct hrtimer *htmr)
{
unsigned long overrun;
/* Trigger DAHDI */
dahdi_receive(&ztd->span);
dahdi_transmit(&ztd->span);
/* Overrun should always return 1, since we are in the timer that
* expired.
* We should worry if overrun is 2 or more; then we really missed
* a tick */
overrun = hrtimer_forward(&zaptimer, hrtimer_get_expires(htmr),
ktime_set(0, DAHDI_TIME_NS));
if(overrun > 1) {
if(printk_ratelimit())
printk(KERN_NOTICE "dahdi_dummy: HRTimer missed %lu ticks\n",
overrun - 1);
}
if(debug && DEBUG_TICKS) {
static int count = 0;
/* Printk every 5 seconds, good test to see if timer is
* running properly */
if (count++ % 5000 == 0)
printk(KERN_DEBUG "dahdi_dummy: 5000 ticks from hrtimer\n");
}
/* Always restart the timer */
return HRTIMER_RESTART;
}
#else
static unsigned long timespec_diff_ms(struct timespec *t0, struct timespec *t1)
{
long nanosec, sec;
unsigned long ms;
sec = (t1->tv_sec - t0->tv_sec);
nanosec = (t1->tv_nsec - t0->tv_nsec);
while (nanosec >= NSEC_PER_SEC) {
nanosec -= NSEC_PER_SEC;
++sec;
}
while (nanosec < 0) {
nanosec += NSEC_PER_SEC;
--sec;
}
ms = (sec * 1000) + (nanosec / 1000000L);
return ms;
}
static void dahdi_dummy_timer(unsigned long param)
{
unsigned long ms_since_start;
struct timespec now;
const unsigned long MAX_INTERVAL = 100000L;
const unsigned long MS_LIMIT = 3000;
if (!atomic_read(&shutdown))
mod_timer(&timer, jiffies + JIFFIES_INTERVAL);
now = current_kernel_time();
ms_since_start = timespec_diff_ms(&ztd->start_interval, &now);
/*
* If the system time has changed, it is possible for us to be far
* behind. If we are more than MS_LIMIT milliseconds behind, just
* reset our time base and continue so that we do not hang the system
* here.
*
*/
if (unlikely((ms_since_start - ztd->calls_since_start) > MS_LIMIT)) {
if (printk_ratelimit()) {
printk(KERN_INFO
"dahdi_dummy: Detected time shift.\n");
}
ztd->calls_since_start = 0;
ztd->start_interval = now;
return;
}
while (ms_since_start > ztd->calls_since_start) {
ztd->calls_since_start++;
dahdi_receive(&ztd->span);
dahdi_transmit(&ztd->span);
}
if (ms_since_start > MAX_INTERVAL) {
ztd->calls_since_start = 0;
ztd->start_interval = now;
}
}
#endif
static const struct dahdi_span_ops dummy_ops = {
.owner = THIS_MODULE,
};
static int dahdi_dummy_initialize(struct dahdi_dummy *ztd)
{
/* DAHDI stuff */
ztd->chan = &ztd->_chan;
sprintf(ztd->span.name, "DAHDI_DUMMY/1");
snprintf(ztd->span.desc, sizeof(ztd->span.desc) - 1, "%s (source: " CLOCK_SRC ") %d", ztd->span.name, 1);
sprintf(ztd->chan->name, "DAHDI_DUMMY/%d/%d", 1, 0);
dahdi_copy_string(ztd->span.devicetype, "DAHDI Dummy Timing", sizeof(ztd->span.devicetype));
ztd->chan->chanpos = 1;
ztd->span.chans = &ztd->chan;
ztd->span.channels = 0; /* no channels on our span */
ztd->span.deflaw = DAHDI_LAW_MULAW;
init_waitqueue_head(&ztd->span.maintq);
ztd->chan->pvt = ztd;
ztd->span.ops = &dummy_ops;
if (dahdi_register(&ztd->span, 0)) {
return -1;
}
return 0;
}
int init_module(void)
{
ztd = kzalloc(sizeof(*ztd), GFP_KERNEL);
if (ztd == NULL) {
printk(KERN_ERR "dahdi_dummy: Unable to allocate memory\n");
return -ENOMEM;
}
if (dahdi_dummy_initialize(ztd)) {
printk(KERN_ERR "dahdi_dummy: Unable to intialize DAHDI driver\n");
kfree(ztd);
return -ENODEV;
}
#if defined(USE_HIGHRESTIMER)
printk(KERN_DEBUG "dahdi_dummy: Trying to load High Resolution Timer\n");
hrtimer_init(&zaptimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
printk(KERN_DEBUG "dahdi_dummy: Initialized High Resolution Timer\n");
/* Set timer callback function */
zaptimer.function = dahdi_dummy_hr_int;
printk(KERN_DEBUG "dahdi_dummy: Starting High Resolution Timer\n");
hrtimer_start(&zaptimer, ktime_set(0, DAHDI_TIME_NS), HRTIMER_MODE_REL);
printk(KERN_INFO "dahdi_dummy: High Resolution Timer started, good to go\n");
#else
init_timer(&timer);
timer.function = dahdi_dummy_timer;
ztd->start_interval = current_kernel_time();
timer.expires = jiffies + JIFFIES_INTERVAL;
atomic_set(&shutdown, 0);
add_timer(&timer);
#endif
if (debug)
printk(KERN_DEBUG "dahdi_dummy: init() finished\n");
return 0;
}
void cleanup_module(void)
{
#if defined(USE_HIGHRESTIMER)
/* Stop high resolution timer */
hrtimer_cancel(&zaptimer);
#else
atomic_set(&shutdown, 1);
del_timer_sync(&timer);
#endif
dahdi_unregister(&ztd->span);
kfree(ztd);
if (debug)
printk(KERN_DEBUG "dahdi_dummy: cleanup() finished\n");
}
module_param(debug, int, 0600);
MODULE_DESCRIPTION("Timing-Only Driver");
MODULE_AUTHOR("Robert Pleh <robert.pleh@hermes.si>");
MODULE_LICENSE("GPL v2");

View File

@ -0,0 +1,820 @@
/*
* Dynamic Span Interface for DAHDI
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2008, Digium, Inc.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <dahdi/kernel.h>
/*
* Tasklets provide better system interactive response at the cost of the
* possibility of losing a frame of data at very infrequent intervals. If
* you are more concerned with the performance of your machine, enable the
* tasklets. If you are strict about absolutely no drops, then do not enable
* tasklets.
*/
#define ENABLE_TASKLETS
/*
* Dynamic spans implemented using TDM over X with standard message
* types. Message format is as follows:
*
* Byte #: Meaning
* 0 Number of samples per channel
* 1 Current flags on span
* Bit 0: Yellow Alarm
* Bit 1: Sig bits present
* Bits 2-7: reserved for future use
* 2-3 16-bit counter value for detecting drops, network byte order.
* 4-5 Number of channels in the message, network byte order
* 6... 16-bit words, containing sig bits for each
* four channels, least significant 4 bits being
* the least significant channel, network byte order.
* the rest data for each channel, all samples per channel
before moving to the next.
*/
/* Arbitrary limit to the max # of channels in a span */
#define DAHDI_DYNAMIC_MAX_CHANS 256
#define ZTD_FLAG_YELLOW_ALARM (1 << 0)
#define ZTD_FLAG_SIGBITS_PRESENT (1 << 1)
#define ZTD_FLAG_LOOPBACK (1 << 2)
#define ERR_NSAMP (1 << 16)
#define ERR_NCHAN (1 << 17)
#define ERR_LEN (1 << 18)
EXPORT_SYMBOL(dahdi_dynamic_register);
EXPORT_SYMBOL(dahdi_dynamic_unregister);
EXPORT_SYMBOL(dahdi_dynamic_receive);
static int ztdynamic_init(void);
static void ztdynamic_cleanup(void);
#ifdef ENABLE_TASKLETS
static int taskletrun;
static int taskletsched;
static int taskletpending;
static int taskletexec;
static int txerrors;
static struct tasklet_struct ztd_tlet;
static void ztd_tasklet(unsigned long data);
#endif
struct dahdi_dynamic {
char addr[40];
char dname[20];
int err;
int usecount;
int dead;
long rxjif;
unsigned short txcnt;
unsigned short rxcnt;
struct dahdi_span span;
struct dahdi_chan *chans[DAHDI_DYNAMIC_MAX_CHANS];
struct dahdi_dynamic_driver *driver;
void *pvt;
int timing;
int master;
unsigned char *msgbuf;
struct list_head list;
};
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(dspan_lock);
static DEFINE_SPINLOCK(driver_lock);
#else
static spinlock_t dspan_lock = SPIN_LOCK_UNLOCKED;
static spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
#endif
static LIST_HEAD(dspan_list);
static LIST_HEAD(driver_list);
static int debug = 0;
static int hasmaster = 0;
static void checkmaster(void)
{
int newhasmaster=0;
int best = 9999999;
struct dahdi_dynamic *z, *master=NULL;
rcu_read_lock();
list_for_each_entry_rcu(z, &dspan_list, list) {
if (z->timing) {
z->master = 0;
if (!(z->span.alarms & DAHDI_ALARM_RED) &&
(z->timing < best) && !z->dead) {
/* If not in alarm and they're
a better timing source, use them */
master = z;
best = z->timing;
newhasmaster = 1;
}
}
}
hasmaster = newhasmaster;
/* Mark the new master if there is one */
if (master)
master->master = 1;
rcu_read_unlock();
if (master)
printk(KERN_INFO "TDMoX: New master: %s\n", master->span.name);
else
printk(KERN_INFO "TDMoX: No master.\n");
}
static void ztd_sendmessage(struct dahdi_dynamic *z)
{
unsigned char *buf = z->msgbuf;
unsigned short bits;
int msglen = 0;
int x;
int offset;
/* Byte 0: Number of samples per channel */
*buf = DAHDI_CHUNKSIZE;
buf++; msglen++;
/* Byte 1: Flags */
*buf = 0;
if (z->span.alarms & DAHDI_ALARM_RED)
*buf |= ZTD_FLAG_YELLOW_ALARM;
*buf |= ZTD_FLAG_SIGBITS_PRESENT;
buf++; msglen++;
/* Bytes 2-3: Transmit counter */
*((unsigned short *)buf) = htons((unsigned short)z->txcnt);
z->txcnt++;
buf++; msglen++;
buf++; msglen++;
/* Bytes 4-5: Number of channels */
*((unsigned short *)buf) = htons((unsigned short)z->span.channels);
buf++; msglen++;
buf++; msglen++;
bits = 0;
offset = 0;
for (x=0;x<z->span.channels;x++) {
offset = x % 4;
bits |= (z->chans[x]->txsig & 0xf) << (offset << 2);
if (offset == 3) {
/* Write the bits when we have four channels */
*((unsigned short *)buf) = htons(bits);
buf++; msglen++;
buf++; msglen++;
bits = 0;
}
}
if (offset != 3) {
/* Finish it off if it's not done already */
*((unsigned short *)buf) = htons(bits);
buf++; msglen++;
buf++; msglen++;
}
for (x=0;x<z->span.channels;x++) {
memcpy(buf, z->chans[x]->writechunk, DAHDI_CHUNKSIZE);
buf += DAHDI_CHUNKSIZE;
msglen += DAHDI_CHUNKSIZE;
}
z->driver->transmit(z->pvt, z->msgbuf, msglen);
}
static void __ztdynamic_run(void)
{
struct dahdi_dynamic *z;
struct dahdi_dynamic_driver *drv;
int y;
rcu_read_lock();
list_for_each_entry_rcu(z, &dspan_list, list) {
if (!z->dead) {
for (y=0;y<z->span.channels;y++) {
/* Echo cancel double buffered data */
dahdi_ec_chunk(z->span.chans[y], z->span.chans[y]->readchunk, z->span.chans[y]->writechunk);
}
dahdi_receive(&z->span);
dahdi_transmit(&z->span);
/* Handle all transmissions now */
ztd_sendmessage(z);
}
}
list_for_each_entry_rcu(drv, &driver_list, list) {
/* Flush any traffic still pending in the driver */
if (drv->flush) {
drv->flush();
}
}
rcu_read_unlock();
}
#ifdef ENABLE_TASKLETS
static void ztdynamic_run(void)
{
if (likely(!taskletpending)) {
taskletpending = 1;
taskletsched++;
tasklet_hi_schedule(&ztd_tlet);
} else {
txerrors++;
}
}
#else
#define ztdynamic_run __ztdynamic_run
#endif
static inline struct dahdi_dynamic *dynamic_from_span(struct dahdi_span *span)
{
return container_of(span, struct dahdi_dynamic, span);
}
void dahdi_dynamic_receive(struct dahdi_span *span, unsigned char *msg, int msglen)
{
struct dahdi_dynamic *ztd = dynamic_from_span(span);
int newerr=0;
int sflags;
int xlen;
int x, bits, sig;
int nchans, master;
int newalarm;
unsigned short rxpos, rxcnt;
rcu_read_lock();
if (unlikely(msglen < 6)) {
rcu_read_unlock();
newerr = ERR_LEN;
if (newerr != ztd->err) {
printk(KERN_NOTICE "Span %s: Insufficient samples for header (only %d)\n", span->name, msglen);
}
ztd->err = newerr;
return;
}
/* First, check the chunksize */
if (unlikely(*msg != DAHDI_CHUNKSIZE)) {
rcu_read_unlock();
newerr = ERR_NSAMP | msg[0];
if (newerr != ztd->err) {
printk(KERN_NOTICE "Span %s: Expected %d samples, but receiving %d\n", span->name, DAHDI_CHUNKSIZE, msg[0]);
}
ztd->err = newerr;
return;
}
msg++;
sflags = *msg;
msg++;
rxpos = ntohs(*((unsigned short *)msg));
msg++;
msg++;
nchans = ntohs(*((unsigned short *)msg));
if (unlikely(nchans != span->channels)) {
rcu_read_unlock();
newerr = ERR_NCHAN | nchans;
if (newerr != ztd->err) {
printk(KERN_NOTICE "Span %s: Expected %d channels, but receiving %d\n", span->name, span->channels, nchans);
}
ztd->err = newerr;
return;
}
msg++;
msg++;
/* Okay now we've accepted the header, lets check our message
length... */
/* Start with header */
xlen = 6;
/* Add samples of audio */
xlen += nchans * DAHDI_CHUNKSIZE;
/* If RBS info is there, add that */
if (sflags & ZTD_FLAG_SIGBITS_PRESENT) {
/* Account for sigbits -- one short per 4 channels*/
xlen += ((nchans + 3) / 4) * 2;
}
if (unlikely(xlen != msglen)) {
rcu_read_unlock();
newerr = ERR_LEN | xlen;
if (newerr != ztd->err) {
printk(KERN_NOTICE "Span %s: Expected message size %d, but was %d instead\n", span->name, xlen, msglen);
}
ztd->err = newerr;
return;
}
bits = 0;
/* Record sigbits if present */
if (sflags & ZTD_FLAG_SIGBITS_PRESENT) {
for (x=0;x<nchans;x++) {
if (!(x%4)) {
/* Get new bits */
bits = ntohs(*((unsigned short *)msg));
msg++;
msg++;
}
/* Pick the right bits */
sig = (bits >> ((x % 4) << 2)) & 0xff;
/* Update signalling if appropriate */
if (sig != span->chans[x]->rxsig)
dahdi_rbsbits(span->chans[x], sig);
}
}
/* Record data for channels */
for (x=0;x<nchans;x++) {
memcpy(span->chans[x]->readchunk, msg, DAHDI_CHUNKSIZE);
msg += DAHDI_CHUNKSIZE;
}
master = ztd->master;
rxcnt = ztd->rxcnt;
ztd->rxcnt = rxpos+1;
/* Keep track of last received packet */
ztd->rxjif = jiffies;
rcu_read_unlock();
/* Check for Yellow alarm */
newalarm = span->alarms & ~(DAHDI_ALARM_YELLOW | DAHDI_ALARM_RED);
if (sflags & ZTD_FLAG_YELLOW_ALARM)
newalarm |= DAHDI_ALARM_YELLOW;
if (newalarm != span->alarms) {
span->alarms = newalarm;
dahdi_alarm_notify(span);
checkmaster();
}
/* note if we had a missing packet */
if (unlikely(rxpos != rxcnt))
printk(KERN_NOTICE "Span %s: Expected seq no %d, but received %d instead\n", span->name, rxcnt, rxpos);
/* If this is our master span, then run everything */
if (master)
ztdynamic_run();
}
static void dynamic_destroy(struct dahdi_dynamic *z)
{
unsigned int x;
/* Unregister span if appropriate */
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &z->span.flags))
dahdi_unregister(&z->span);
/* Destroy the pvt stuff if there */
if (z->pvt)
z->driver->destroy(z->pvt);
/* Free message buffer if appropriate */
if (z->msgbuf)
kfree(z->msgbuf);
/* Free channels */
for (x = 0; x < z->span.channels; x++) {
kfree(z->chans[x]);
}
/* Free z */
kfree(z);
checkmaster();
}
static struct dahdi_dynamic *find_dynamic(struct dahdi_dynamic_span *zds)
{
struct dahdi_dynamic *z = NULL, *found = NULL;
rcu_read_lock();
list_for_each_entry_rcu(z, &dspan_list, list) {
if (!strcmp(z->dname, zds->driver) &&
!strcmp(z->addr, zds->addr)) {
found = z;
break;
}
}
rcu_read_unlock();
return found;
}
static struct dahdi_dynamic_driver *find_driver(char *name)
{
struct dahdi_dynamic_driver *ztd, *found = NULL;
rcu_read_lock();
list_for_each_entry_rcu(ztd, &driver_list, list) {
/* here's our driver */
if (!strcmp(name, ztd->name)) {
found = ztd;
break;
}
}
rcu_read_unlock();
return found;
}
static int destroy_dynamic(struct dahdi_dynamic_span *zds)
{
unsigned long flags;
struct dahdi_dynamic *z;
z = find_dynamic(zds);
if (unlikely(!z)) {
return -EINVAL;
}
if (z->usecount) {
printk(KERN_NOTICE "Attempt to destroy dynamic span while it is in use\n");
return -EBUSY;
}
spin_lock_irqsave(&dspan_lock, flags);
list_del_rcu(&z->list);
spin_unlock_irqrestore(&dspan_lock, flags);
synchronize_rcu();
/* Destroy it */
dynamic_destroy(z);
return 0;
}
static int ztd_rbsbits(struct dahdi_chan *chan, int bits)
{
/* Don't have to do anything */
return 0;
}
static int ztd_open(struct dahdi_chan *chan)
{
struct dahdi_dynamic *z = dynamic_from_span(chan->span);
if (likely(z)) {
if (unlikely(z->dead))
return -ENODEV;
z->usecount++;
}
return 0;
}
static int ztd_chanconfig(struct dahdi_chan *chan, int sigtype)
{
return 0;
}
static int ztd_close(struct dahdi_chan *chan)
{
struct dahdi_dynamic *z = dynamic_from_span(chan->span);
if (z) {
z->usecount--;
if (z->dead && !z->usecount)
dynamic_destroy(z);
}
return 0;
}
static const struct dahdi_span_ops dynamic_ops = {
.owner = THIS_MODULE,
.rbsbits = ztd_rbsbits,
.open = ztd_open,
.close = ztd_close,
.chanconfig = ztd_chanconfig,
};
static int create_dynamic(struct dahdi_dynamic_span *zds)
{
struct dahdi_dynamic *z;
struct dahdi_dynamic_driver *ztd;
unsigned long flags;
int x;
int bufsize;
if (zds->numchans < 1) {
printk(KERN_NOTICE "Can't be less than 1 channel (%d)!\n", zds->numchans);
return -EINVAL;
}
if (zds->numchans >= DAHDI_DYNAMIC_MAX_CHANS) {
printk(KERN_NOTICE "Can't create dynamic span with greater than %d channels. See ztdynamic.c and increase DAHDI_DYNAMIC_MAX_CHANS\n", zds->numchans);
return -EINVAL;
}
z = find_dynamic(zds);
if (z)
return -EEXIST;
/* Allocate memory */
z = (struct dahdi_dynamic *) kmalloc(sizeof(struct dahdi_dynamic), GFP_KERNEL);
if (!z) {
return -ENOMEM;
}
/* Zero it out */
memset(z, 0, sizeof(*z));
for (x = 0; x < zds->numchans; x++) {
if (!(z->chans[x] = kmalloc(sizeof(*z->chans[x]), GFP_KERNEL))) {
dynamic_destroy(z);
return -ENOMEM;
}
memset(z->chans[x], 0, sizeof(*z->chans[x]));
}
/* Allocate message buffer with sample space and header space */
bufsize = zds->numchans * DAHDI_CHUNKSIZE + zds->numchans / 4 + 48;
z->msgbuf = kmalloc(bufsize, GFP_KERNEL);
if (!z->msgbuf) {
dynamic_destroy(z);
return -ENOMEM;
}
/* Zero out -- probably not needed but why not */
memset(z->msgbuf, 0, bufsize);
/* Setup parameters properly assuming we're going to be okay. */
dahdi_copy_string(z->dname, zds->driver, sizeof(z->dname));
dahdi_copy_string(z->addr, zds->addr, sizeof(z->addr));
z->timing = zds->timing;
sprintf(z->span.name, "DYN/%s/%s", zds->driver, zds->addr);
sprintf(z->span.desc, "Dynamic '%s' span at '%s'", zds->driver, zds->addr);
z->span.channels = zds->numchans;
z->span.deflaw = DAHDI_LAW_MULAW;
z->span.flags |= DAHDI_FLAG_RBS;
z->span.chans = z->chans;
z->span.ops = &dynamic_ops;
for (x=0; x < z->span.channels; x++) {
sprintf(z->chans[x]->name, "DYN/%s/%s/%d", zds->driver, zds->addr, x+1);
z->chans[x]->sigcap = DAHDI_SIG_EM | DAHDI_SIG_CLEAR | DAHDI_SIG_FXSLS |
DAHDI_SIG_FXSKS | DAHDI_SIG_FXSGS | DAHDI_SIG_FXOLS |
DAHDI_SIG_FXOKS | DAHDI_SIG_FXOGS | DAHDI_SIG_SF |
DAHDI_SIG_DACS_RBS | DAHDI_SIG_CAS;
z->chans[x]->chanpos = x + 1;
z->chans[x]->pvt = z;
}
ztd = find_driver(zds->driver);
if (!ztd) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,70)
char fn[80];
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,70)
request_module("dahdi_dynamic_%s", zds->driver);
#else
sprintf(fn, "dahdi_dynamic_%s", zds->driver);
request_module(fn);
#endif
ztd = find_driver(zds->driver);
}
/* Another race -- should let the module get unloaded while we
have it here */
if (!ztd) {
printk(KERN_NOTICE "No such driver '%s' for dynamic span\n", zds->driver);
dynamic_destroy(z);
return -EINVAL;
}
/* Create the stuff */
z->pvt = ztd->create(&z->span, z->addr);
if (!z->pvt) {
printk(KERN_NOTICE "Driver '%s' (%s) rejected address '%s'\n", ztd->name, ztd->desc, z->addr);
/* Creation failed */
return -EINVAL;
}
/* Remember the driver */
z->driver = ztd;
/* Whee! We're created. Now register the span */
if (dahdi_register(&z->span, 0)) {
printk(KERN_NOTICE "Unable to register span '%s'\n", z->span.name);
dynamic_destroy(z);
return -EINVAL;
}
spin_lock_irqsave(&dspan_lock, flags);
list_add_rcu(&z->list, &dspan_list);
spin_unlock_irqrestore(&dspan_lock, flags);
checkmaster();
/* All done */
return z->span.spanno;
}
#ifdef ENABLE_TASKLETS
static void ztd_tasklet(unsigned long data)
{
taskletrun++;
if (taskletpending) {
taskletexec++;
__ztdynamic_run();
}
taskletpending = 0;
}
#endif
static int ztdynamic_ioctl(unsigned int cmd, unsigned long data)
{
struct dahdi_dynamic_span zds;
int res;
switch(cmd) {
case 0:
/* This is called just before rotation. If none of our
spans are pulling timing, then now is the time to process
them */
if (!hasmaster)
ztdynamic_run();
return 0;
case DAHDI_DYNAMIC_CREATE:
if (copy_from_user(&zds, (__user const void *) data, sizeof(zds)))
return -EFAULT;
if (debug)
printk(KERN_DEBUG "Dynamic Create\n");
res = create_dynamic(&zds);
if (res < 0)
return res;
zds.spanno = res;
/* Let them know the new span number */
if (copy_to_user((__user void *) data, &zds, sizeof(zds)))
return -EFAULT;
return 0;
case DAHDI_DYNAMIC_DESTROY:
if (copy_from_user(&zds, (__user const void *) data, sizeof(zds)))
return -EFAULT;
if (debug)
printk(KERN_DEBUG "Dynamic Destroy\n");
return destroy_dynamic(&zds);
}
return -ENOTTY;
}
int dahdi_dynamic_register(struct dahdi_dynamic_driver *dri)
{
unsigned long flags;
int res = 0;
if (find_driver(dri->name)) {
res = -1;
} else {
spin_lock_irqsave(&driver_lock, flags);
list_add_rcu(&dri->list, &driver_list);
spin_unlock_irqrestore(&driver_lock, flags);
}
return res;
}
void dahdi_dynamic_unregister(struct dahdi_dynamic_driver *dri)
{
struct dahdi_dynamic *z;
unsigned long flags;
spin_lock_irqsave(&driver_lock, flags);
list_del_rcu(&dri->list);
spin_unlock_irqrestore(&driver_lock, flags);
synchronize_rcu();
list_for_each_entry(z, &dspan_list, list) {
if (z->driver == dri) {
spin_lock_irqsave(&dspan_lock, flags);
list_del_rcu(&z->list);
spin_unlock_irqrestore(&dspan_lock, flags);
synchronize_rcu();
if (!z->usecount)
dynamic_destroy(z);
else
z->dead = 1;
}
}
}
static struct timer_list alarmcheck;
static void check_for_red_alarm(unsigned long ignored)
{
int newalarm;
int alarmchanged = 0;
struct dahdi_dynamic *z;
rcu_read_lock();
list_for_each_entry_rcu(z, &dspan_list, list) {
newalarm = z->span.alarms & ~DAHDI_ALARM_RED;
/* If nothing received for a second, consider that RED ALARM */
if ((jiffies - z->rxjif) > 1 * HZ) {
newalarm |= DAHDI_ALARM_RED;
if (z->span.alarms != newalarm) {
z->span.alarms = newalarm;
dahdi_alarm_notify(&z->span);
alarmchanged++;
}
}
}
rcu_read_unlock();
if (alarmchanged)
checkmaster();
/* Do the next one */
mod_timer(&alarmcheck, jiffies + 1 * HZ);
}
static int ztdynamic_init(void)
{
dahdi_set_dynamic_ioctl(ztdynamic_ioctl);
/* Start process to check for RED ALARM */
init_timer(&alarmcheck);
alarmcheck.expires = 0;
alarmcheck.data = 0;
alarmcheck.function = check_for_red_alarm;
/* Check once per second */
mod_timer(&alarmcheck, jiffies + 1 * HZ);
#ifdef ENABLE_TASKLETS
tasklet_init(&ztd_tlet, ztd_tasklet, 0);
#endif
printk(KERN_INFO "DAHDI Dynamic Span support LOADED\n");
return 0;
}
static void ztdynamic_cleanup(void)
{
#ifdef ENABLE_TASKLETS
if (taskletpending) {
tasklet_disable(&ztd_tlet);
tasklet_kill(&ztd_tlet);
}
#endif
dahdi_set_dynamic_ioctl(NULL);
del_timer(&alarmcheck);
printk(KERN_INFO "DAHDI Dynamic Span support unloaded\n");
}
module_param(debug, int, 0600);
MODULE_DESCRIPTION("DAHDI Dynamic Span Support");
MODULE_AUTHOR("Mark Spencer <markster@digium.com>");
MODULE_LICENSE("GPL v2");
module_init(ztdynamic_init);
module_exit(ztdynamic_cleanup);

View File

@ -0,0 +1,440 @@
/*
* Dynamic Span Interface for DAHDI (Ethernet Interface)
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2008, Digium, Inc.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/netdevice.h>
#include <linux/notifier.h>
#include <dahdi/kernel.h>
#define ETH_P_DAHDI_DETH 0xd00d
struct ztdeth_header {
unsigned short subaddr;
};
/* We take the raw message, put it in an ethernet frame, and add a
two byte addressing header at the top for future use */
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(zlock);
#else
static spinlock_t zlock = SPIN_LOCK_UNLOCKED;
#endif
static struct sk_buff_head skbs;
static struct ztdeth {
unsigned char addr[ETH_ALEN];
unsigned short subaddr; /* Network byte order */
struct dahdi_span *span;
char ethdev[IFNAMSIZ];
struct net_device *dev;
struct ztdeth *next;
} *zdevs = NULL;
static struct dahdi_span *ztdeth_getspan(unsigned char *addr, unsigned short subaddr)
{
unsigned long flags;
struct ztdeth *z;
struct dahdi_span *span = NULL;
spin_lock_irqsave(&zlock, flags);
z = zdevs;
while(z) {
if (!memcmp(addr, z->addr, ETH_ALEN) &&
z->subaddr == subaddr)
break;
z = z->next;
}
if (z)
span = z->span;
spin_unlock_irqrestore(&zlock, flags);
return span;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
#else
static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
#endif
{
struct dahdi_span *span;
struct ztdeth_header *zh;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
zh = (struct ztdeth_header *)skb_network_header(skb);
#else
zh = (struct ztdeth_header *)skb->nh.raw;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
span = ztdeth_getspan(eth_hdr(skb)->h_source, zh->subaddr);
#else
span = ztdeth_getspan(skb->mac.ethernet->h_source, zh->subaddr);
#endif
if (span) {
skb_pull(skb, sizeof(struct ztdeth_header));
#ifdef NEW_SKB_LINEARIZE
if (skb_is_nonlinear(skb))
skb_linearize(skb);
#else
if (skb_is_nonlinear(skb))
skb_linearize(skb, GFP_KERNEL);
#endif
dahdi_dynamic_receive(span, (unsigned char *)skb->data, skb->len);
}
kfree_skb(skb);
return 0;
}
static int ztdeth_notifier(struct notifier_block *block, unsigned long event, void *ptr)
{
struct net_device *dev = ptr;
struct ztdeth *z;
unsigned long flags;
switch(event) {
case NETDEV_GOING_DOWN:
case NETDEV_DOWN:
spin_lock_irqsave(&zlock, flags);
z = zdevs;
while(z) {
/* Note that the device no longer exists */
if (z->dev == dev)
z->dev = NULL;
z = z->next;
}
spin_unlock_irqrestore(&zlock, flags);
break;
case NETDEV_UP:
spin_lock_irqsave(&zlock, flags);
z = zdevs;
while(z) {
/* Now that the device exists again, use it */
if (!strcmp(z->ethdev, dev->name))
z->dev = dev;
z = z->next;
}
spin_unlock_irqrestore(&zlock, flags);
break;
}
return 0;
}
static int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen)
{
struct ztdeth *z;
struct sk_buff *skb;
struct ztdeth_header *zh;
unsigned long flags;
struct net_device *dev;
unsigned char addr[ETH_ALEN];
unsigned short subaddr; /* Network byte order */
spin_lock_irqsave(&zlock, flags);
z = pvt;
if (z->dev) {
/* Copy fields to local variables to remove spinlock ASAP */
dev = z->dev;
memcpy(addr, z->addr, sizeof(z->addr));
subaddr = z->subaddr;
spin_unlock_irqrestore(&zlock, flags);
skb = dev_alloc_skb(msglen + dev->hard_header_len + sizeof(struct ztdeth_header) + 32);
if (skb) {
/* Reserve header space */
skb_reserve(skb, dev->hard_header_len + sizeof(struct ztdeth_header));
/* Copy message body */
memcpy(skb_put(skb, msglen), msg, msglen);
/* Throw on header */
zh = (struct ztdeth_header *)skb_push(skb, sizeof(struct ztdeth_header));
zh->subaddr = subaddr;
/* Setup protocol and such */
skb->protocol = __constant_htons(ETH_P_DAHDI_DETH);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
skb_set_network_header(skb, 0);
#else
skb->nh.raw = skb->data;
#endif
skb->dev = dev;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
dev_hard_header(skb, dev, ETH_P_DAHDI_DETH, addr, dev->dev_addr, skb->len);
#else
if (dev->hard_header)
dev->hard_header(skb, dev, ETH_P_DAHDI_DETH, addr, dev->dev_addr, skb->len);
#endif
skb_queue_tail(&skbs, skb);
}
}
else
spin_unlock_irqrestore(&zlock, flags);
return 0;
}
static int ztdeth_flush(void)
{
struct sk_buff *skb;
/* Handle all transmissions now */
while ((skb = skb_dequeue(&skbs))) {
dev_queue_xmit(skb);
}
return 0;
}
static struct packet_type ztdeth_ptype = {
.type = __constant_htons(ETH_P_DAHDI_DETH), /* Protocol */
.dev = NULL, /* Device (NULL = wildcard) */
.func = ztdeth_rcv, /* Receiver */
};
static int digit2int(char d)
{
switch(d) {
case 'F':
case 'E':
case 'D':
case 'C':
case 'B':
case 'A':
return d - 'A' + 10;
case 'f':
case 'e':
case 'd':
case 'c':
case 'b':
case 'a':
return d - 'a' + 10;
case '9':
case '8':
case '7':
case '6':
case '5':
case '4':
case '3':
case '2':
case '1':
case '0':
return d - '0';
}
return -1;
}
static int hex2int(char *s)
{
int res;
int tmp;
/* Gotta be at least one digit */
if (strlen(s) < 1)
return -1;
/* Can't be more than two */
if (strlen(s) > 2)
return -1;
/* Grab the first digit */
res = digit2int(s[0]);
if (res < 0)
return -1;
tmp = res;
/* Grab the next */
if (strlen(s) > 1) {
res = digit2int(s[1]);
if (res < 0)
return -1;
tmp = tmp * 16 + res;
}
return tmp;
}
static void ztdeth_destroy(void *pvt)
{
struct ztdeth *z = pvt;
unsigned long flags;
struct ztdeth *prev=NULL, *cur;
spin_lock_irqsave(&zlock, flags);
cur = zdevs;
while(cur) {
if (cur == z) {
if (prev)
prev->next = cur->next;
else
zdevs = cur->next;
break;
}
prev = cur;
cur = cur->next;
}
spin_unlock_irqrestore(&zlock, flags);
if (cur == z) { /* Successfully removed */
printk(KERN_INFO "TDMoE: Removed interface for %s\n", z->span->name);
kfree(z);
module_put(THIS_MODULE);
}
}
static void *ztdeth_create(struct dahdi_span *span, char *addr)
{
struct ztdeth *z;
char src[256];
char tmp[256], *tmp2, *tmp3, *tmp4 = NULL;
int res,x;
unsigned long flags;
z = kmalloc(sizeof(struct ztdeth), GFP_KERNEL);
if (z) {
/* Zero it out */
memset(z, 0, sizeof(struct ztdeth));
/* Address should be <dev>/<macaddr>[/subaddr] */
dahdi_copy_string(tmp, addr, sizeof(tmp));
tmp2 = strchr(tmp, '/');
if (tmp2) {
*tmp2 = '\0';
tmp2++;
dahdi_copy_string(z->ethdev, tmp, sizeof(z->ethdev));
} else {
printk(KERN_NOTICE "Invalid TDMoE address (no device) '%s'\n", addr);
kfree(z);
return NULL;
}
if (tmp2) {
tmp4 = strchr(tmp2+1, '/');
if (tmp4) {
*tmp4 = '\0';
tmp4++;
}
/* We don't have SSCANF :( Gotta do this the hard way */
tmp3 = strchr(tmp2, ':');
for (x=0;x<6;x++) {
if (tmp2) {
if (tmp3) {
*tmp3 = '\0';
tmp3++;
}
res = hex2int(tmp2);
if (res < 0)
break;
z->addr[x] = res & 0xff;
} else
break;
if ((tmp2 = tmp3))
tmp3 = strchr(tmp2, ':');
}
if (x != 6) {
printk(KERN_NOTICE "TDMoE: Invalid MAC address in: %s\n", addr);
kfree(z);
return NULL;
}
} else {
printk(KERN_NOTICE "TDMoE: Missing MAC address\n");
kfree(z);
return NULL;
}
if (tmp4) {
int sub = 0;
int mul = 1;
/* We have a subaddr */
tmp3 = tmp4 + strlen (tmp4) - 1;
while (tmp3 >= tmp4) {
if (*tmp3 >= '0' && *tmp3 <= '9') {
sub += (*tmp3 - '0') * mul;
} else {
printk(KERN_NOTICE "TDMoE: Invalid subaddress\n");
kfree(z);
return NULL;
}
mul *= 10;
tmp3--;
}
z->subaddr = htons(sub);
}
z->dev = dev_get_by_name(
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
&init_net,
#endif
z->ethdev);
if (!z->dev) {
printk(KERN_NOTICE "TDMoE: Invalid device '%s'\n", z->ethdev);
kfree(z);
return NULL;
}
z->span = span;
src[0] ='\0';
for (x=0;x<5;x++)
sprintf(src + strlen(src), "%02x:", z->dev->dev_addr[x]);
sprintf(src + strlen(src), "%02x", z->dev->dev_addr[5]);
printk(KERN_INFO "TDMoE: Added new interface for %s at %s (addr=%s, src=%s, subaddr=%d)\n", span->name, z->dev->name, addr, src, ntohs(z->subaddr));
spin_lock_irqsave(&zlock, flags);
z->next = zdevs;
zdevs = z;
spin_unlock_irqrestore(&zlock, flags);
if(!try_module_get(THIS_MODULE))
printk(KERN_DEBUG "TDMoE: Unable to increment module use count\n");
}
return z;
}
static struct dahdi_dynamic_driver ztd_eth = {
"eth",
"Ethernet",
ztdeth_create,
ztdeth_destroy,
ztdeth_transmit,
ztdeth_flush
};
static struct notifier_block ztdeth_nblock = {
.notifier_call = ztdeth_notifier,
};
static int __init ztdeth_init(void)
{
dev_add_pack(&ztdeth_ptype);
register_netdevice_notifier(&ztdeth_nblock);
dahdi_dynamic_register(&ztd_eth);
skb_queue_head_init(&skbs);
return 0;
}
static void __exit ztdeth_exit(void)
{
dev_remove_pack(&ztdeth_ptype);
unregister_netdevice_notifier(&ztdeth_nblock);
dahdi_dynamic_unregister(&ztd_eth);
}
MODULE_DESCRIPTION("DAHDI Dynamic TDMoE Support");
MODULE_AUTHOR("Mark Spencer <markster@digium.com>");
MODULE_LICENSE("GPL v2");
module_init(ztdeth_init);
module_exit(ztdeth_exit);

View File

@ -0,0 +1,844 @@
/*
* Dynamic Span Interface for DAHDI (Multi-Span Ethernet Interface)
*
* Written by Joseph Benden <joe@thrallingpenguin.com>
*
* Copyright (C) 2007-2010, Thralling Penguin LLC.
*
* All rights reserved.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <linux/netdevice.h>
#include <linux/notifier.h>
#include <linux/crc32.h>
/**
* Undefine USE_PROC_FS, if you do not want the /proc/dahdi/dynamic-ethmf
* support. Undefining this would give a slight performance increase.
*/
#define USE_PROC_FS
#ifdef USE_PROC_FS
# include <linux/proc_fs.h>
# include <asm/atomic.h>
#endif
#ifdef CONFIG_DEVFS_FS
# include <linux/devfs_fs_kernel.h>
#endif
#include <dahdi/kernel.h>
#include <dahdi/user.h>
#define ETH_P_ZTDETH 0xd00d
#define ETHMF_MAX_PER_SPAN_GROUP 8
#define ETHMF_MAX_GROUPS 16
#define ETHMF_FLAG_IGNORE_CHAN0 (1 << 3)
#define ETHMF_MAX_SPANS 4
struct ztdeth_header {
unsigned short subaddr;
};
/* Timer for enabling spans - used to combat a lock problem */
static struct timer_list timer;
/* Whether or not the timer has been deleted */
static atomic_t timer_deleted = ATOMIC_INIT(0);
/* Global error counter */
static atomic_t errcount = ATOMIC_INIT(0);
/* Whether or not we are in shutdown */
static atomic_t shutdown = ATOMIC_INIT(0);
static struct sk_buff_head skbs;
#ifdef USE_PROC_FS
struct ethmf_group {
unsigned int hash_addr;
atomic_t spans;
atomic_t rxframecount;
atomic_t txframecount;
atomic_t rxbytecount;
atomic_t txbytecount;
atomic_t devupcount;
atomic_t devdowncount;
};
static struct ethmf_group ethmf_groups[ETHMF_MAX_GROUPS];
#endif
struct ztdeth {
/* Destination MAC address */
unsigned char addr[ETH_ALEN];
/* Destination MAC address hash value */
unsigned int addr_hash;
/* span sub-address, in network byte order */
unsigned short subaddr;
/* DAHDI span associated with this TDMoE-mf span */
struct dahdi_span *span;
/* Ethernet interface name */
char ethdev[IFNAMSIZ];
/* Ethernet device reference */
struct net_device *dev;
/* trx buffer */
unsigned char *msgbuf;
/* trx buffer length */
int msgbuf_len;
/* wether or not this frame is ready for trx */
atomic_t ready;
/* delay counter, to ensure all spans are added, prior to usage */
atomic_t delay;
/* rvc buffer */
unsigned char *rcvbuf;
/* the number of channels in this span */
int real_channels;
/* use padding if 1, else no padding */
atomic_t no_front_padding;
/* counter to pseudo lock the rcvbuf */
atomic_t refcnt;
struct list_head list;
};
/**
* Lock for adding and removing items in ethmf_list
*/
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(ethmf_lock);
#else
static spinlock_t ethmf_lock = SPIN_LOCK_UNLOCKED;
#endif
/**
* The active list of all running spans
*/
static LIST_HEAD(ethmf_list);
static inline void ethmf_errors_inc(void)
{
#ifdef USE_PROC_FS
atomic_inc(&errcount);
#endif
}
#ifdef USE_PROC_FS
static inline int hashaddr_to_index(unsigned int hash_addr)
{
int i, z = -1;
for (i = 0; i < ETHMF_MAX_GROUPS; ++i) {
if (z == -1 && ethmf_groups[i].hash_addr == 0)
z = i;
if (ethmf_groups[i].hash_addr == hash_addr)
return i;
}
if (z != -1) {
ethmf_groups[z].hash_addr = hash_addr;
}
return z;
}
#endif
/**
* Find the Ztdeth Struct and DAHDI span for a given MAC address and subaddr.
*
* NOTE: RCU read lock must already be held.
*/
static inline void find_ethmf(const unsigned char *addr,
const unsigned short subaddr, struct ztdeth **ze,
struct dahdi_span **span)
{
struct ztdeth *z;
list_for_each_entry_rcu(z, &ethmf_list, list) {
if (!atomic_read(&z->delay)) {
if (!memcmp(addr, z->addr, ETH_ALEN)
&& z->subaddr == subaddr) {
*ze = z;
*span = z->span;
return;
}
}
}
/* no results */
*ze = NULL;
*span = NULL;
}
/**
* Determines if all spans are ready for transmit. If all spans are ready,
* we return the number of spans which indeed are ready and populate the
* array of pointers to those spans..
*
* NOTE: RCU read lock must already be held.
*/
static inline int ethmf_trx_spans_ready(unsigned int addr_hash, struct ztdeth *(*ready_spans)[ETHMF_MAX_PER_SPAN_GROUP])
{
struct ztdeth *t;
int span_count = 0, spans_ready = 0;
list_for_each_entry_rcu(t, &ethmf_list, list) {
if (!atomic_read(&t->delay) && t->addr_hash == addr_hash) {
++span_count;
if (atomic_read(&t->ready)) {
short subaddr = ntohs(t->subaddr);
if (subaddr < ETHMF_MAX_PER_SPAN_GROUP) {
(*ready_spans)[subaddr] = t;
++spans_ready;
} else {
printk(KERN_ERR "More than %d spans per multi-frame group are not currently supported.",
ETHMF_MAX_PER_SPAN_GROUP);
}
}
}
}
if (span_count && spans_ready && span_count == spans_ready) {
return spans_ready;
}
return 0;
}
/**
* Ethernet receiving side processing function.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
static int ztdethmf_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
#else
static int ztdethmf_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt)
#endif
{
int num_spans = 0, span_index = 0;
unsigned char *data;
struct dahdi_span *span;
struct ztdeth *z = NULL;
struct ztdeth_header *zh;
unsigned int samples, channels, rbslen, flags;
unsigned int skip = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
zh = (struct ztdeth_header *) skb_network_header(skb);
#else
zh = (struct ztdeth_header *) skb->nh.raw;
#endif
if (ntohs(zh->subaddr) & 0x8000) {
/* got a multi-span frame */
num_spans = ntohs(zh->subaddr) & 0xFF;
/* Currently max of 4 spans supported */
if (unlikely(num_spans > ETHMF_MAX_SPANS)) {
kfree_skb(skb);
return 0;
}
skb_pull(skb, sizeof(struct ztdeth_header));
#ifdef NEW_SKB_LINEARIZE
if (skb_is_nonlinear(skb))
skb_linearize(skb);
#else
if (skb_is_nonlinear(skb))
skb_linearize(skb, GFP_KERNEL);
#endif
data = (unsigned char *) skb->data;
rcu_read_lock();
do {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
find_ethmf(eth_hdr(skb)->h_source,
htons(span_index), &z, &span);
#else
find_ethmf(skb->mac.ethernet->h_source,
htons(span_index), &z, &span);
#endif
if (unlikely(!z || !span)) {
/* The recv'd span does not belong to us */
/* ethmf_errors_inc(); */
++span_index;
continue;
}
samples = data[(span_index * 6)] & 0xFF;
flags = data[((span_index * 6) + 1)] & 0xFF;
channels = data[((span_index * 6) + 5)] & 0xFF;
/* Precomputed defaults for most typical values */
if (channels == 24)
rbslen = 12;
else if (channels == 31)
rbslen = 16;
else
rbslen = ((channels + 3) / 4) * 2;
if (unlikely(samples != 8 || channels >= 32 || channels == 0)) {
ethmf_errors_inc();
++span_index;
continue;
}
if (atomic_dec_and_test(&z->refcnt) == 0) {
memcpy(z->rcvbuf, data + 6*span_index, 6); /* TDM Header */
/*
* If we ignore channel zero we must skip the first eight bytes and
* ensure that ztdynamic doesn't get confused by this new flag
*/
if (flags & ETHMF_FLAG_IGNORE_CHAN0) {
skip = 8;
/* Remove this flag since ztdynamic may not understand it */
z->rcvbuf[1] = flags & ~(ETHMF_FLAG_IGNORE_CHAN0);
/* Additionally, now we will transmit with front padding */
atomic_set(&z->no_front_padding, 0);
} else {
/* Disable front padding if we recv'd a packet without it */
atomic_set(&z->no_front_padding, 1);
}
memcpy(z->rcvbuf + 6, data + 6*num_spans + 16
*span_index, rbslen); /* RBS Header */
/* 256 == 32*8; if padding lengths change, this must be modified */
memcpy(z->rcvbuf + 6 + rbslen, data + 6*num_spans + 16
*num_spans + (256)*span_index + skip, channels
* 8); /* Payload */
dahdi_dynamic_receive(span, z->rcvbuf, 6 + rbslen
+ channels*8);
} else {
ethmf_errors_inc();
printk(KERN_INFO "TDMoE span overflow detected. Span %d was dropped.", span_index);
}
atomic_inc(&z->refcnt);
#ifdef USE_PROC_FS
if (span_index == 0) {
atomic_inc(&(ethmf_groups[hashaddr_to_index(z->addr_hash)].rxframecount));
atomic_add(skb->len + z->dev->hard_header_len +
sizeof(struct ztdeth_header),
&(ethmf_groups[hashaddr_to_index(z->addr_hash)].rxbytecount));
}
#endif
++span_index;
} while (!atomic_read(&shutdown) && span_index < num_spans);
rcu_read_unlock();
}
kfree_skb(skb);
return 0;
}
static int ztdethmf_notifier(struct notifier_block *block, unsigned long event,
void *ptr)
{
struct net_device *dev = ptr;
struct ztdeth *z;
switch (event) {
case NETDEV_GOING_DOWN:
case NETDEV_DOWN:
rcu_read_lock();
list_for_each_entry_rcu(z, &ethmf_list, list) {
/* Note that the device no longer exists */
if (z->dev == dev) {
z->dev = NULL;
#ifdef USE_PROC_FS
atomic_inc(&(ethmf_groups[hashaddr_to_index(z->addr_hash)].devdowncount));
#endif
}
}
rcu_read_unlock();
break;
case NETDEV_UP:
rcu_read_lock();
list_for_each_entry_rcu(z, &ethmf_list, list) {
/* Now that the device exists again, use it */
if (!strcmp(z->ethdev, dev->name)) {
z->dev = dev;
#ifdef USE_PROC_FS
atomic_inc(&(ethmf_groups[hashaddr_to_index(z->addr_hash)].devupcount));
#endif
}
}
rcu_read_unlock();
break;
}
return 0;
}
static int ztdethmf_transmit(void *pvt, unsigned char *msg, int msglen)
{
struct ztdeth *z = pvt, *ready_spans[ETHMF_MAX_PER_SPAN_GROUP];
struct sk_buff *skb;
struct ztdeth_header *zh;
struct net_device *dev;
unsigned char addr[ETH_ALEN];
int spans_ready = 0, index = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
unsigned long flags;
#endif
if (atomic_read(&shutdown))
return 0;
rcu_read_lock();
if (unlikely(!z || !z->dev)) {
rcu_read_unlock();
return 0;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
if (!atomic_read(&z->ready)) {
spin_lock_irqsave(&lock, flags);
atomic_inc(&z->ready);
if (1 == atomic_read(&z->ready)) {
memcpy(z->msgbuf, msg, msglen);
z->msgbuf_len = msglen;
}
spin_unlock_irqrestore(&lock, flags);
}
#else
if (!atomic_read(&z->ready)) {
if (atomic_inc_return(&z->ready) == 1) {
memcpy(z->msgbuf, msg, msglen);
z->msgbuf_len = msglen;
}
}
#endif
spans_ready = ethmf_trx_spans_ready(z->addr_hash, &ready_spans);
if (spans_ready) {
int pad[ETHMF_MAX_SPANS], rbs[ETHMF_MAX_SPANS];
dev = z->dev;
memcpy(addr, z->addr, sizeof(z->addr));
for (index = 0; index < spans_ready; index++) {
int chan = ready_spans[index]->real_channels;
/* By default we pad to 32 channels, but if
* no_front_padding is false then we have a pad
* in the front of 8 bytes, so this implies one
* less channel
*/
if (atomic_read(&(ready_spans[index]->no_front_padding)))
pad[index] = (32 - chan)*8;
else
pad[index] = (31 - chan)*8;
if (chan == 24)
rbs[index] = 12;
else if (chan == 31)
rbs[index] = 16;
else
/* Shouldn't this be index, not spans_ready? */
rbs[spans_ready] = ((chan + 3) / 4) * 2;
}
/* Allocate the standard size for a 32-chan frame */
skb = dev_alloc_skb(1112 + dev->hard_header_len
+ sizeof(struct ztdeth_header) + 32);
if (unlikely(!skb)) {
rcu_read_unlock();
ethmf_errors_inc();
return 0;
}
/* Reserve header space */
skb_reserve(skb, dev->hard_header_len
+ sizeof(struct ztdeth_header));
/* copy each spans header */
for (index = 0; index < spans_ready; index++) {
if (!atomic_read(&(ready_spans[index]->no_front_padding)))
ready_spans[index]->msgbuf[1]
|= ETHMF_FLAG_IGNORE_CHAN0;
memcpy(skb_put(skb, 6), ready_spans[index]->msgbuf, 6);
}
/* copy each spans RBS payload */
for (index = 0; index < spans_ready; index++) {
memcpy(skb_put(skb, 16), ready_spans[index]->msgbuf + 6,
rbs[index]);
}
/* copy each spans data/voice payload */
for (index = 0; index < spans_ready; index++) {
int chan = ready_spans[index]->real_channels;
if (!atomic_read(&(ready_spans[index]->no_front_padding))) {
/* This adds an additional (padded) channel to our total */
memset(skb_put(skb, 8), 0xA5, 8); /* ETHMF_IGNORE_CHAN0 */
}
memcpy(skb_put(skb, chan*8), ready_spans[index]->msgbuf
+ (6 + rbs[index]), chan*8);
if (pad[index] > 0) {
memset(skb_put(skb, pad[index]), 0xDD, pad[index]);
}
/* mark span as ready for new data/voice */
atomic_set(&(ready_spans[index]->ready), 0);
}
/* Throw on header */
zh = (struct ztdeth_header *)skb_push(skb,
sizeof(struct ztdeth_header));
zh->subaddr = htons((unsigned short)(0x8000 | (unsigned char)(spans_ready & 0xFF)));
/* Setup protocol type */
skb->protocol = __constant_htons(ETH_P_ZTDETH);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
skb_set_network_header(skb, 0);
#else
skb->nh.raw = skb->data;
#endif
skb->dev = dev;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
dev_hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len);
#else
if (dev->hard_header)
dev->hard_header(skb, dev, ETH_P_ZTDETH, addr,
dev->dev_addr, skb->len);
#endif
/* queue frame for delivery */
if (dev) {
skb_queue_tail(&skbs, skb);
}
#ifdef USE_PROC_FS
atomic_inc(&(ethmf_groups[hashaddr_to_index(z->addr_hash)].txframecount));
atomic_add(skb->len, &(ethmf_groups[hashaddr_to_index(z->addr_hash)].txbytecount));
#endif
}
rcu_read_unlock();
return 0;
}
static int ztdethmf_flush(void)
{
struct sk_buff *skb;
/* Handle all transmissions now */
while ((skb = skb_dequeue(&skbs))) {
dev_queue_xmit(skb);
}
return 0;
}
static struct packet_type ztdethmf_ptype = {
.type = __constant_htons(ETH_P_ZTDETH), /* Protocol */
.dev = NULL, /* Device (NULL = wildcard) */
.func = ztdethmf_rcv, /* Receiver */
};
static void ztdethmf_destroy(void *pvt)
{
struct ztdeth *z = pvt;
unsigned long flags;
atomic_set(&shutdown, 1);
synchronize_rcu();
spin_lock_irqsave(&ethmf_lock, flags);
list_del_rcu(&z->list);
spin_unlock_irqrestore(&ethmf_lock, flags);
synchronize_rcu();
atomic_dec(&(ethmf_groups[hashaddr_to_index(z->addr_hash)].spans));
if (z) { /* Successfully removed */
printk(KERN_INFO "Removed interface for %s\n",
z->span->name);
kfree(z->msgbuf);
kfree(z);
module_put(THIS_MODULE);
} else {
if (z && z->span && z->span->name) {
printk(KERN_ERR "Cannot find interface for %s\n",
z->span->name);
}
}
}
static void *ztdethmf_create(struct dahdi_span *span, char *addr)
{
struct ztdeth *z;
char src[256];
char *src_ptr;
int x, bufsize, num_matched;
unsigned long flags;
BUG_ON(!span);
BUG_ON(!addr);
z = kmalloc(sizeof(struct ztdeth), GFP_KERNEL);
if (!z)
return NULL;
/* Zero it out */
memset(z, 0, sizeof(struct ztdeth));
/* set a delay for xmit/recv to workaround Zaptel problems */
atomic_set(&z->delay, 4);
/* create a msg buffer. MAX OF 31 CHANNELS!!!! */
bufsize = 31 * DAHDI_CHUNKSIZE + 31 / 4 + 48;
z->msgbuf = kmalloc(bufsize, GFP_KERNEL);
z->rcvbuf = kmalloc(bufsize, GFP_KERNEL);
/* Address should be <dev>/<macaddr>/subaddr */
dahdi_copy_string(src, addr, sizeof(src));
/* replace all / with space; otherwise kernel sscanf does not work */
src_ptr = src;
while (*src_ptr) {
if (*src_ptr == '/')
*src_ptr = ' ';
++src_ptr;
}
num_matched = sscanf(src,
"%16s %hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hu",
z->ethdev, &z->addr[0], &z->addr[1],
&z->addr[2], &z->addr[3], &z->addr[4],
&z->addr[5], &z->subaddr);
if (8 != num_matched) {
printk(KERN_ERR "Only matched %d entries in '%s'\n", num_matched, src);
printk(KERN_ERR "Invalid TDMoE Multiframe address: %s\n", addr);
kfree(z);
return NULL;
}
z->dev = dev_get_by_name(
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
&init_net,
#endif
z->ethdev);
if (!z->dev) {
printk(KERN_ERR "TDMoE Multiframe: Invalid device '%s'\n", z->ethdev);
kfree(z);
return NULL;
}
z->span = span;
z->subaddr = htons(z->subaddr);
z->addr_hash = crc32_le(0, z->addr, ETH_ALEN);
z->real_channels = span->channels;
src[0] = '\0';
for (x = 0; x < 5; x++)
sprintf(src + strlen(src), "%02x:", z->dev->dev_addr[x]);
sprintf(src + strlen(src), "%02x", z->dev->dev_addr[5]);
printk(KERN_INFO "TDMoEmf: Added new interface for %s at %s "
"(addr=%s, src=%s, subaddr=%d)\n", span->name, z->dev->name,
addr, src, ntohs(z->subaddr));
atomic_set(&z->ready, 0);
atomic_set(&z->refcnt, 0);
spin_lock_irqsave(&ethmf_lock, flags);
list_add_rcu(&z->list, &ethmf_list);
spin_unlock_irqrestore(&ethmf_lock, flags);
atomic_inc(&(ethmf_groups[hashaddr_to_index(z->addr_hash)].spans));
if (!try_module_get(THIS_MODULE))
printk(KERN_ERR "TDMoEmf: Unable to increment module use count\n");
/* enable the timer for enabling the spans */
mod_timer(&timer, jiffies + HZ);
atomic_set(&shutdown, 0);
return z;
}
static struct dahdi_dynamic_driver ztd_ethmf = {
"ethmf",
"Ethernet",
ztdethmf_create,
ztdethmf_destroy,
ztdethmf_transmit,
ztdethmf_flush
};
static struct notifier_block ztdethmf_nblock = {
.notifier_call = ztdethmf_notifier,
};
/**
* Decrements each delay counter in the ethmf_list and returns the number of
* delay counters that are not equal to zero.
*/
static int ethmf_delay_dec(void)
{
struct ztdeth *z;
int count_nonzero = 0;
rcu_read_lock();
list_for_each_entry_rcu(z, &ethmf_list, list) {
if (atomic_read(&z->delay)) {
atomic_dec(&z->delay);
++count_nonzero;
} else
atomic_set(&z->delay, 0);
}
rcu_read_unlock();
return count_nonzero;
}
/**
* Timer callback function to allow all spans to be added, prior to any of
* them being used.
*/
static void timer_callback(unsigned long param)
{
if (ethmf_delay_dec()) {
if (!atomic_read(&timer_deleted)) {
timer.expires = jiffies + HZ;
add_timer(&timer);
}
} else {
printk(KERN_INFO "All TDMoE multiframe span groups are active.\n");
del_timer(&timer);
}
}
#ifdef USE_PROC_FS
static struct proc_dir_entry *proc_entry;
static const char *ztdethmf_procname = "dahdi/dynamic-ethmf";
static int ztdethmf_proc_read(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct ztdeth *z = NULL;
int len = 0, i = 0;
unsigned int group = 0, c = 0;
rcu_read_lock();
len += sprintf(page + len, "Errors: %d\n\n", atomic_read(&errcount));
for (group = 0; group < ETHMF_MAX_GROUPS; ++group) {
if (atomic_read(&(ethmf_groups[group].spans))) {
len += sprintf(page + len, "Group #%d (0x%x)\n", i++, ethmf_groups[group].hash_addr);
len += sprintf(page + len, " Spans: %d\n",
atomic_read(&(ethmf_groups[group].spans)));
c = 1;
list_for_each_entry_rcu(z, &ethmf_list, list) {
if (z->addr_hash == ethmf_groups[group].hash_addr) {
if (c == 1) {
len += sprintf(page + len,
" Device: %s (MAC: %02x:%02x:%02x:%02x:%02x:%02x)\n",
z->ethdev,
z->addr[0], z->addr[1], z->addr[2],
z->addr[3], z->addr[4], z->addr[5]);
}
len += sprintf(page + len, " Span %d: subaddr=%u ready=%d delay=%d real_channels=%d no_front_padding=%d\n",
c++, ntohs(z->subaddr),
atomic_read(&z->ready), atomic_read(&z->delay),
z->real_channels, atomic_read(&z->no_front_padding));
}
}
len += sprintf(page + len, " Device UPs: %u\n",
atomic_read(&(ethmf_groups[group].devupcount)));
len += sprintf(page + len, " Device DOWNs: %u\n",
atomic_read(&(ethmf_groups[group].devdowncount)));
len += sprintf(page + len, " Rx Frames: %u\n",
atomic_read(&(ethmf_groups[group].rxframecount)));
len += sprintf(page + len, " Tx Frames: %u\n",
atomic_read(&(ethmf_groups[group].txframecount)));
len += sprintf(page + len, " Rx Bytes: %u\n",
atomic_read(&(ethmf_groups[group].rxbytecount)));
len += sprintf(page + len, " Tx Bytes: %u\n",
atomic_read(&(ethmf_groups[group].txbytecount)));
if (len <= off) {
off -= len;
len = 0;
}
if (len > off+count)
break;
}
}
rcu_read_unlock();
if (len <= off) {
off -= len;
len = 0;
}
*start = page + off;
len -= off;
if (len > count)
len = count;
return len;
}
#endif
static int __init ztdethmf_init(void)
{
init_timer(&timer);
timer.expires = jiffies + HZ;
timer.function = &timer_callback;
if (!timer_pending(&timer))
add_timer(&timer);
dev_add_pack(&ztdethmf_ptype);
register_netdevice_notifier(&ztdethmf_nblock);
dahdi_dynamic_register(&ztd_ethmf);
skb_queue_head_init(&skbs);
#ifdef USE_PROC_FS
proc_entry = create_proc_read_entry(ztdethmf_procname, 0444, NULL,
ztdethmf_proc_read, NULL);
if (!proc_entry) {
printk(KERN_ALERT "create_proc_read_entry failed.\n");
}
#endif
return 0;
}
static void __exit ztdethmf_exit(void)
{
atomic_set(&timer_deleted, 1);
del_timer_sync(&timer);
dev_remove_pack(&ztdethmf_ptype);
unregister_netdevice_notifier(&ztdethmf_nblock);
dahdi_dynamic_unregister(&ztd_ethmf);
#ifdef USE_PROC_FS
if (proc_entry)
remove_proc_entry(ztdethmf_procname, NULL);
#endif
}
MODULE_DESCRIPTION("DAHDI Dynamic TDMoEmf Support");
MODULE_AUTHOR("Joseph Benden <joe@thrallingpenguin.com>");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
module_init(ztdethmf_init);
module_exit(ztdethmf_exit);

View File

@ -0,0 +1,265 @@
/*
* Dynamic Span Interface for DAHDI (Local Interface)
*
* Written by Nicolas Bougues <nbougues@axialys.net>
*
* Copyright (C) 2004, Axialys Interactive
*
* All rights reserved.
*
* Note : a DAHDI timing source must exist prior to loading this driver
*
* Address syntax :
* <key>:<id>[:<monitor id>]
*
* As of now, keys and ids are single digit only
*
* One span may have up to one "normal" peer, and one "monitor" peer
*
* Example :
*
* Say you have two spans cross connected, a third one monitoring RX on the
* first one, a fourth one monitoring RX on the second one
*
* 1:0
* 1:1
* 1:2:0
* 1:3:1
*
* Contrary to TDMoE, no frame loss can occur.
*
* See bug #2021 for more details
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/netdevice.h>
#include <linux/notifier.h>
#include <dahdi/kernel.h>
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(zlock);
#else
static spinlock_t zlock = SPIN_LOCK_UNLOCKED;
#endif
static struct ztdlocal {
unsigned short key;
unsigned short id;
struct ztdlocal *monitor_rx_peer; /* Indicates the peer span that monitors this span */
struct ztdlocal *peer; /* Indicates the rw peer for this span */
struct dahdi_span *span;
struct ztdlocal *next;
} *zdevs = NULL;
static int ztdlocal_transmit(void *pvt, unsigned char *msg, int msglen)
{
struct ztdlocal *z;
unsigned long flags;
spin_lock_irqsave(&zlock, flags);
z = pvt;
if (z->peer && z->peer->span) {
dahdi_dynamic_receive(z->peer->span, msg, msglen);
}
if (z->monitor_rx_peer && z->monitor_rx_peer->span) {
dahdi_dynamic_receive(z->monitor_rx_peer->span, msg, msglen);
}
spin_unlock_irqrestore(&zlock, flags);
return 0;
}
static int digit2int(char d)
{
switch(d) {
case 'F':
case 'E':
case 'D':
case 'C':
case 'B':
case 'A':
return d - 'A' + 10;
case 'f':
case 'e':
case 'd':
case 'c':
case 'b':
case 'a':
return d - 'a' + 10;
case '9':
case '8':
case '7':
case '6':
case '5':
case '4':
case '3':
case '2':
case '1':
case '0':
return d - '0';
}
return -1;
}
static void ztdlocal_destroy(void *pvt)
{
struct ztdlocal *z = pvt;
unsigned long flags;
struct ztdlocal *prev=NULL, *cur;
spin_lock_irqsave(&zlock, flags);
cur = zdevs;
while(cur) {
if (cur->peer == z)
cur->peer = NULL;
if (cur->monitor_rx_peer == z)
cur->monitor_rx_peer = NULL;
cur = cur->next;
}
cur = zdevs;
while(cur) {
if (cur == z) {
if (prev)
prev->next = cur->next;
else
zdevs = cur->next;
break;
}
prev = cur;
cur = cur->next;
}
spin_unlock_irqrestore(&zlock, flags);
if (cur == z) {
printk(KERN_INFO "TDMoL: Removed interface for %s, key %d id %d\n", z->span->name, z->key, z->id);
module_put(THIS_MODULE);
kfree(z);
}
}
static void *ztdlocal_create(struct dahdi_span *span, char *address)
{
struct ztdlocal *z, *l;
unsigned long flags;
int key = -1, id = -1, monitor = -1;
if (strlen(address) >= 3) {
if (address[1] != ':')
goto INVALID_ADDRESS;
key = digit2int(address[0]);
id = digit2int(address[2]);
}
if (strlen (address) == 5) {
if (address[3] != ':')
goto INVALID_ADDRESS;
monitor = digit2int(address[4]);
}
if (key == -1 || id == -1)
goto INVALID_ADDRESS;
z = kmalloc(sizeof(struct ztdlocal), GFP_KERNEL);
if (z) {
/* Zero it out */
memset(z, 0, sizeof(struct ztdlocal));
z->key = key;
z->id = id;
z->span = span;
spin_lock_irqsave(&zlock, flags);
/* Add this peer to any existing spans with same key
And add them as peers to this one */
for (l = zdevs; l; l = l->next)
if (l->key == z->key) {
if (l->id == z->id) {
printk(KERN_DEBUG "TDMoL: Duplicate id (%d) for key %d\n", z->id, z->key);
goto CLEAR_AND_DEL_FROM_PEERS;
}
if (monitor == -1) {
if (l->peer) {
printk(KERN_DEBUG "TDMoL: Span with key %d and id %d already has a R/W peer\n", z->key, z->id);
goto CLEAR_AND_DEL_FROM_PEERS;
} else {
l->peer = z;
z->peer = l;
}
}
if (monitor == l->id) {
if (l->monitor_rx_peer) {
printk(KERN_DEBUG "TDMoL: Span with key %d and id %d already has a monitoring peer\n", z->key, z->id);
goto CLEAR_AND_DEL_FROM_PEERS;
} else {
l->monitor_rx_peer = z;
}
}
}
z->next = zdevs;
zdevs = z;
spin_unlock_irqrestore(&zlock, flags);
if(!try_module_get(THIS_MODULE))
printk(KERN_DEBUG "TDMoL: Unable to increment module use count\n");
printk(KERN_INFO "TDMoL: Added new interface for %s, key %d id %d\n", span->name, z->key, z->id);
}
return z;
CLEAR_AND_DEL_FROM_PEERS:
for (l = zdevs; l; l = l->next) {
if (l->peer == z)
l->peer = NULL;
if (l->monitor_rx_peer == z)
l->monitor_rx_peer = NULL;
}
kfree (z);
spin_unlock_irqrestore(&zlock, flags);
return NULL;
INVALID_ADDRESS:
printk (KERN_NOTICE "TDMoL: Invalid address %s\n", address);
return NULL;
}
static struct dahdi_dynamic_driver ztd_local = {
"loc",
"Local",
ztdlocal_create,
ztdlocal_destroy,
ztdlocal_transmit,
NULL /* flush */
};
static int __init ztdlocal_init(void)
{
dahdi_dynamic_register(&ztd_local);
return 0;
}
static void __exit ztdlocal_exit(void)
{
dahdi_dynamic_unregister(&ztd_local);
}
module_init(ztdlocal_init);
module_exit(ztdlocal_exit);
MODULE_LICENSE("GPL v2");

View File

@ -0,0 +1,145 @@
/*
* ECHO_CAN_JPAH
*
* by Jason Parker
*
* Based upon mg2ec.h - sort of.
* This "echo can" will completely hose your audio.
* Don't use it unless you're absolutely sure you know what you're doing.
*
* Copyright (C) 2007-2008, Digium, Inc.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/moduleparam.h>
#include <dahdi/kernel.h>
static int debug;
#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
#define debug_printk(level, fmt, args...) if (debug >= level) printk("%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
static const struct dahdi_echocan_factory my_factory = {
.name = "JPAH",
.owner = THIS_MODULE,
.echocan_create = echo_can_create,
};
static const struct dahdi_echocan_ops my_ops = {
.name = "JPAH",
.echocan_free = echo_can_free,
.echocan_process = echo_can_process,
.echocan_traintap = echo_can_traintap,
};
struct ec_pvt {
struct dahdi_echocan_state dahdi;
int blah;
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct ec_pvt *pvt;
if (ecp->param_count > 0) {
printk(KERN_WARNING "JPAH does not support parameters; failing request\n");
return -EINVAL;
}
pvt = kzalloc(sizeof(*pvt), GFP_KERNEL);
if (!pvt)
return -ENOMEM;
pvt->dahdi.ops = &my_ops;
*ec = &pvt->dahdi;
return 0;
}
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
kfree(pvt);
}
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
u32 x;
for (x = 0; x < size; x++) {
if (pvt->blah < 2) {
pvt->blah++;
*isig++ = 0;
} else {
pvt->blah = 0;
isig++;
}
}
}
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
{
return 0;
}
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
}
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
return 0;
}
static void __exit mod_exit(void)
{
dahdi_unregister_echocan_factory(&my_factory);
}
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_DESCRIPTION("DAHDI Jason Parker Audio Hoser");
MODULE_AUTHOR("Jason Parker <jparker@digium.com>");
MODULE_LICENSE("GPL v2");
module_init(mod_init);
module_exit(mod_exit);

View File

@ -0,0 +1,744 @@
/*
* ECHO_CAN_KB1
*
* by Kris Boutilier
*
* Based upon mec2.h
*
* Copyright (C) 2002, Digium, Inc.
*
* Additional background on the techniques used in this code can be found in:
*
* Messerschmitt, David; Hedberg, David; Cole, Christopher; Haoui, Amine;
* Winship, Peter; "Digital Voice Echo Canceller with a TMS32020,"
* in Digital Signal Processing Applications with the TMS320 Family,
* pp. 415-437, Texas Instruments, Inc., 1986.
*
* A pdf of which is available by searching on the document title at http://www.ti.com/
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/moduleparam.h>
#include <dahdi/kernel.h>
static int debug;
static int aggressive;
#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
#define debug_printk(level, fmt, args...) if (debug >= level) printk(KERN_DEBUG "%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
/* Uncomment to provide summary statistics for overall echo can performance every 4000 samples */
/* #define MEC2_STATS 4000 */
/* Uncomment to generate per-sample statistics - this will severely degrade system performance and audio quality */
/* #define MEC2_STATS_DETAILED */
/* Get optimized routines for math */
#include "arith.h"
/*
Important constants for tuning kb1 echo can
*/
/* Convergence (aka. adaptation) speed -- higher means slower */
#define DEFAULT_BETA1_I 2048
/* Constants for various power computations */
#define DEFAULT_SIGMA_LY_I 7
#define DEFAULT_SIGMA_LU_I 7
#define DEFAULT_ALPHA_ST_I 5 /* near-end speech detection sensitivity factor */
#define DEFAULT_ALPHA_YT_I 5
#define DEFAULT_CUTOFF_I 128
/* Define the near-end speech hangover counter: if near-end speech
* is declared, hcntr is set equal to hangt (see pg. 432)
*/
#define DEFAULT_HANGT 600 /* in samples, so 600 samples = 75ms */
/* define the residual error suppression threshold */
#define DEFAULT_SUPPR_I 16 /* 16 = -24db */
/* This is the minimum reference signal power estimate level
* that will result in filter adaptation.
* If this is too low then background noise will cause the filter
* coefficients to constantly be updated.
*/
#define MIN_UPDATE_THRESH_I 4096
/* The number of samples used to update coefficients using the
* the block update method (M). It should be related back to the
* length of the echo can.
* ie. it only updates coefficients when (sample number MOD default_m) = 0
*
* Getting this wrong may cause an oops. Consider yourself warned!
*/
#define DEFAULT_M 16 /* every 16th sample */
/* If AGGRESSIVE supression is enabled, then we start cancelling residual
* echos again even while there is potentially the very end of a near-side
* signal present.
* This defines how many samples of DEFAULT_HANGT can remain before we
* kick back in
*/
#define AGGRESSIVE_HCNTR 160 /* in samples, so 160 samples = 20ms */
/***************************************************************/
/* The following knobs are not implemented in the current code */
/* we need a dynamic level of suppression varying with the ratio of the
power of the echo to the power of the reference signal this is
done so that we have a smoother background.
we have a higher suppression when the power ratio is closer to
suppr_ceil and reduces logarithmically as we approach suppr_floor.
*/
#define SUPPR_FLOOR -64
#define SUPPR_CEIL -24
/* in a second departure, we calculate the residual error suppression
* as a percentage of the reference signal energy level. The threshold
* is defined in terms of dB below the reference signal.
*/
#define RES_SUPR_FACTOR -20
#ifndef NULL
#define NULL 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
/* Generic circular buffer definition */
typedef struct {
/* Pointer to the relative 'start' of the buffer */
int idx_d;
/* The absolute size of the buffer */
int size_d;
/* The actual sample - twice as large as we need, however we do store values at idx_d and idx_d+size_d */
short *buf_d;
} echo_can_cb_s;
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
static const struct dahdi_echocan_factory my_factory = {
.name = "KB1",
.owner = THIS_MODULE,
.echocan_create = echo_can_create,
};
static const struct dahdi_echocan_features my_features = {
.NLP_toggle = 1,
};
static const struct dahdi_echocan_ops my_ops = {
.name = "KB1",
.echocan_free = echo_can_free,
.echocan_process = echo_can_process,
.echocan_traintap = echo_can_traintap,
.echocan_NLP_toggle = echocan_NLP_toggle,
};
struct ec_pvt {
struct dahdi_echocan_state dahdi;
/* an arbitrary ID for this echo can - this really should be settable from the calling channel... */
int id;
/* absolute time - aka. sample number index - essentially the number of samples since this can was init'ed */
int i_d;
/* Pre-computed constants */
/* ---------------------- */
/* Number of filter coefficents */
int N_d;
/* Rate of adaptation of filter */
int beta2_i;
/* Accumulators for power computations */
/* ----------------------------------- */
/* reference signal power estimate - aka. Average absolute value of y(k) */
int Ly_i;
/* ... */
int Lu_i;
/* Accumulators for signal detectors */
/* --------------------------------- */
/* Power estimate of the recent past of the near-end hybrid signal - aka. Short-time average of: 2 x |s(i)| */
int s_tilde_i;
/* Power estimate of the recent past of the far-end receive signal - aka. Short-time average of: |y(i)| */
int y_tilde_i;
/* Near end speech detection counter - stores Hangover counter time remaining, in samples */
int HCNTR_d;
/* Circular buffers and coefficients */
/* --------------------------------- */
/* ... */
int *a_i;
/* ... */
short *a_s;
/* Reference samples of far-end receive signal */
echo_can_cb_s y_s;
/* Reference samples of near-end signal */
echo_can_cb_s s_s;
/* Reference samples of near-end signal minus echo estimate */
echo_can_cb_s u_s;
/* Reference samples of far-end receive signal used to calculate short-time average */
echo_can_cb_s y_tilde_s;
/* Peak far-end receive signal */
/* --------------------------- */
/* Highest y_tilde value in the sample buffer */
short max_y_tilde;
/* Index of the sample containing the max_y_tilde value */
int max_y_tilde_pos;
#ifdef MEC2_STATS
/* Storage for performance statistics */
int cntr_nearend_speech_frames;
int cntr_residualcorrected_frames;
int cntr_residualcorrected_framesskipped;
int cntr_coeff_updates;
int cntr_coeff_missedupdates;
int avg_Lu_i_toolow;
int avg_Lu_i_ok;
#endif
unsigned int aggressive:1;
int use_nlp;
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
{
cb->buf_d = (short *)where;
cb->idx_d = 0;
cb->size_d = len;
}
static inline void add_cc_s(echo_can_cb_s *cb, short newval)
{
/* Can't use modulus because N+M isn't a power of two (generally) */
cb->idx_d--;
if (cb->idx_d < (int)0)
/* Whoops - the pointer to the 'start' wrapped around so reset it to the top of the buffer */
cb->idx_d += cb->size_d;
/* Load two copies into memory */
cb->buf_d[cb->idx_d] = newval;
cb->buf_d[cb->idx_d + cb->size_d] = newval;
}
static inline short get_cc_s(echo_can_cb_s *cb, int pos)
{
/* Load two copies into memory */
return cb->buf_d[cb->idx_d + pos];
}
static inline void init_cc(struct ec_pvt *pvt, int N, int maxy, int maxu)
{
void *ptr = pvt;
unsigned long tmp;
/* Double-word align past end of state */
ptr += sizeof(*pvt);
tmp = (unsigned long)ptr;
tmp += 3;
tmp &= ~3L;
ptr = (void *)tmp;
/* Reset parameters */
pvt->N_d = N;
pvt->beta2_i = DEFAULT_BETA1_I;
/* Allocate coefficient memory */
pvt->a_i = ptr;
ptr += (sizeof(int) * pvt->N_d);
pvt->a_s = ptr;
ptr += (sizeof(short) * pvt->N_d);
/* Reset Y circular buffer (short version) */
init_cb_s(&pvt->y_s, maxy, ptr);
ptr += (sizeof(short) * (maxy) * 2);
/* Reset Sigma circular buffer (short version for FIR filter) */
init_cb_s(&pvt->s_s, (1 << DEFAULT_ALPHA_ST_I), ptr);
ptr += (sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) * 2);
init_cb_s(&pvt->u_s, maxu, ptr);
ptr += (sizeof(short) * maxu * 2);
/* Allocate a buffer for the reference signal power computation */
init_cb_s(&pvt->y_tilde_s, pvt->N_d, ptr);
/* Reset the absolute time index */
pvt->i_d = (int)0;
/* Reset the power computations (for y and u) */
pvt->Ly_i = DEFAULT_CUTOFF_I;
pvt->Lu_i = DEFAULT_CUTOFF_I;
#ifdef MEC2_STATS
/* set the identity */
pvt->id = (int)&ptr;
/* Reset performance stats */
pvt->cntr_nearend_speech_frames = (int)0;
pvt->cntr_residualcorrected_frames = (int)0;
pvt->cntr_residualcorrected_framesskipped = (int)0;
pvt->cntr_coeff_updates = (int)0;
pvt->cntr_coeff_missedupdates = (int)0;
pvt->avg_Lu_i_toolow = (int)0;
pvt->avg_Lu_i_ok = (int)0;
#endif
/* Reset the near-end speech detector */
pvt->s_tilde_i = (int)0;
pvt->y_tilde_i = (int)0;
pvt->HCNTR_d = (int)0;
}
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
kfree(pvt);
}
static inline short sample_update(struct ec_pvt *pvt, short iref, short isig)
{
/* Declare local variables that are used more than once */
/* ... */
int k;
/* ... */
int rs;
/* ... */
short u;
/* ... */
int Py_i;
/* ... */
int two_beta_i;
/* flow A on pg. 428 */
/* eq. (16): high-pass filter the input to generate the next value;
* push the current value into the circular buffer
*
* sdc_im1_d = sdc_d;
* sdc_d = sig;
* s_i_d = sdc_d;
* s_d = s_i_d;
* s_i_d = (float)(1.0 - gamma_d) * s_i_d
* + (float)(0.5 * (1.0 - gamma_d)) * (sdc_d - sdc_im1_d);
*/
/* Update the Far-end receive signal circular buffers and accumulators */
/* ------------------------------------------------------------------- */
/* Delete the oldest sample from the power estimate accumulator */
pvt->y_tilde_i -= abs(get_cc_s(&pvt->y_s, (1 << DEFAULT_ALPHA_YT_I) - 1)) >> DEFAULT_ALPHA_YT_I;
/* Add the new sample to the power estimate accumulator */
pvt->y_tilde_i += abs(iref) >> DEFAULT_ALPHA_ST_I;
/* Push a copy of the new sample into its circular buffer */
add_cc_s(&pvt->y_s, iref);
/* eq. (2): compute r in fixed-point */
rs = CONVOLVE2(pvt->a_s,
pvt->y_s.buf_d + pvt->y_s.idx_d,
pvt->N_d);
rs >>= 15;
/* eq. (3): compute the output value (see figure 3) and the error
* note: the error is the same as the output signal when near-end
* speech is not present
*/
u = isig - rs;
/* Push a copy of the output value sample into its circular buffer */
add_cc_s(&pvt->u_s, u);
/* Update the Near-end hybrid signal circular buffers and accumulators */
/* ------------------------------------------------------------------- */
/* Delete the oldest sample from the power estimate accumulator */
pvt->s_tilde_i -= abs(get_cc_s(&pvt->s_s, (1 << DEFAULT_ALPHA_ST_I) - 1));
/* Add the new sample to the power estimate accumulator */
pvt->s_tilde_i += abs(isig);
/* Push a copy of the new sample into it's circular buffer */
add_cc_s(&pvt->s_s, isig);
/* Push a copy of the current short-time average of the far-end receive signal into it's circular buffer */
add_cc_s(&pvt->y_tilde_s, pvt->y_tilde_i);
/* flow B on pg. 428 */
/* If the hangover timer isn't running then compute the new convergence factor, otherwise set Py_i to 32768 */
if (!pvt->HCNTR_d) {
Py_i = (pvt->Ly_i >> DEFAULT_SIGMA_LY_I) * (pvt->Ly_i >> DEFAULT_SIGMA_LY_I);
Py_i >>= 15;
} else {
Py_i = (1 << 15);
}
#if 0
/* Vary rate of adaptation depending on position in the file
* Do not do this for the first (DEFAULT_UPDATE_TIME) secs after speech
* has begun of the file to allow the echo cancellor to estimate the
* channel accurately
* Still needs conversion!
*/
if (pvt->start_speech_d != 0) {
if (pvt->i_d > (DEFAULT_T0 + pvt->start_speech_d)*(SAMPLE_FREQ)) {
pvt->beta2_d = max_cc_float(MIN_BETA, DEFAULT_BETA1 * exp((-1/DEFAULT_TAU)*((pvt->i_d/(float)SAMPLE_FREQ) - DEFAULT_T0 - pvt->start_speech_d)));
}
} else {
pvt->beta2_d = DEFAULT_BETA1;
}
#endif
/* Fixed point, inverted */
pvt->beta2_i = DEFAULT_BETA1_I;
/* Fixed point version, inverted */
two_beta_i = (pvt->beta2_i * Py_i) >> 15;
if (!two_beta_i)
two_beta_i++;
/* Update the Suppressed signal power estimate accumulator */
/* ------------------------------------------------------- */
/* Delete the oldest sample from the power estimate accumulator */
pvt->Lu_i -= abs(get_cc_s(&pvt->u_s, (1 << DEFAULT_SIGMA_LU_I) - 1));
/* Add the new sample to the power estimate accumulator */
pvt->Lu_i += abs(u);
/* Update the Far-end reference signal power estimate accumulator */
/* -------------------------------------------------------------- */
/* eq. (10): update power estimate of the reference */
/* Delete the oldest sample from the power estimate accumulator */
pvt->Ly_i -= abs(get_cc_s(&pvt->y_s, (1 << DEFAULT_SIGMA_LY_I) - 1)) ;
/* Add the new sample to the power estimate accumulator */
pvt->Ly_i += abs(iref);
if (pvt->Ly_i < DEFAULT_CUTOFF_I)
pvt->Ly_i = DEFAULT_CUTOFF_I;
/* Update the Peak far-end receive signal detected */
/* ----------------------------------------------- */
if (pvt->y_tilde_i > pvt->max_y_tilde) {
/* New highest y_tilde with full life */
pvt->max_y_tilde = pvt->y_tilde_i;
pvt->max_y_tilde_pos = pvt->N_d - 1;
} else if (--pvt->max_y_tilde_pos < 0) {
/* Time to find new max y tilde... */
pvt->max_y_tilde = MAX16(pvt->y_tilde_s.buf_d + pvt->y_tilde_s.idx_d, pvt->N_d, &pvt->max_y_tilde_pos);
}
/* Determine if near end speech was detected in this sample */
/* -------------------------------------------------------- */
if (((pvt->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)) > pvt->max_y_tilde)
&& (pvt->max_y_tilde > 0)) {
/* Then start the Hangover counter */
pvt->HCNTR_d = DEFAULT_HANGT;
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "Reset near end speech timer with: s_tilde_i %d, stmnt %d, max_y_tilde %d\n", pvt->s_tilde_i, (pvt->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)), pvt->max_y_tilde);
#endif
#ifdef MEC2_STATS
++pvt->cntr_nearend_speech_frames;
#endif
} else if (pvt->HCNTR_d > (int)0) {
/* otherwise, if it's still non-zero, decrement the Hangover counter by one sample */
#ifdef MEC2_STATS
++pvt->cntr_nearend_speech_frames;
#endif
pvt->HCNTR_d--;
}
/* Update coefficients if no near-end speech in this sample (ie. HCNTR_d = 0)
* and we have enough signal to bother trying to update.
* --------------------------------------------------------------------------
*/
if (!pvt->HCNTR_d && /* no near-end speech present */
!(pvt->i_d % DEFAULT_M)) { /* we only update on every DEFAULM_M'th sample from the stream */
if (pvt->Lu_i > MIN_UPDATE_THRESH_I) { /* there is sufficient energy above the noise floor to contain meaningful data */
/* so loop over all the filter coefficients */
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "updating coefficients with: pvt->Lu_i %9d\n", pvt->Lu_i);
#endif
#ifdef MEC2_STATS
pvt->avg_Lu_i_ok = pvt->avg_Lu_i_ok + pvt->Lu_i;
++pvt->cntr_coeff_updates;
#endif
for (k = 0; k < pvt->N_d; k++) {
/* eq. (7): compute an expectation over M_d samples */
int grad2;
grad2 = CONVOLVE2(pvt->u_s.buf_d + pvt->u_s.idx_d,
pvt->y_s.buf_d + pvt->y_s.idx_d + k,
DEFAULT_M);
/* eq. (7): update the coefficient */
pvt->a_i[k] += grad2 / two_beta_i;
pvt->a_s[k] = pvt->a_i[k] >> 16;
}
} else {
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "insufficient signal to update coefficients pvt->Lu_i %5d < %5d\n", pvt->Lu_i, MIN_UPDATE_THRESH_I);
#endif
#ifdef MEC2_STATS
pvt->avg_Lu_i_toolow = pvt->avg_Lu_i_toolow + pvt->Lu_i;
++pvt->cntr_coeff_missedupdates;
#endif
}
}
/* paragraph below eq. (15): if no near-end speech in the sample and
* the reference signal power estimate > cutoff threshold
* then perform residual error suppression
*/
#ifdef MEC2_STATS_DETAILED
if (pvt->HCNTR_d == 0)
printk(KERN_INFO "possibly correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d and expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifndef NO_ECHO_SUPPRESSOR
if (pvt->use_nlp) {
if (pvt->aggressive) {
if ((pvt->HCNTR_d < AGGRESSIVE_HCNTR) && (pvt->Ly_i > (pvt->Lu_i << 1))) {
for (k = 0; k < 2; k++) {
u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1);
}
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "aggresively correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifdef MEC2_STATS
++pvt->cntr_residualcorrected_frames;
#endif
}
} else {
if (pvt->HCNTR_d == 0) {
if ((pvt->Ly_i/(pvt->Lu_i + 1)) > DEFAULT_SUPPR_I) {
for (k = 0; k < 1; k++) {
u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1);
}
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifdef MEC2_STATS
++pvt->cntr_residualcorrected_frames;
#endif
}
#ifdef MEC2_STATS
else {
++pvt->cntr_residualcorrected_framesskipped;
}
#endif
}
}
}
#endif
#if 0
/* This will generate a non-linear supression factor, once converted */
if ((pvt->HCNTR_d == 0) &&
((pvt->Lu_d/pvt->Ly_d) < DEFAULT_SUPPR) &&
(pvt->Lu_d/pvt->Ly_d > EC_MIN_DB_VALUE)) {
suppr_factor = (10 / (float)(SUPPR_FLOOR - SUPPR_CEIL)) * log(pvt->Lu_d/pvt->Ly_d)
- SUPPR_CEIL / (float)(SUPPR_FLOOR - SUPPR_CEIL);
u_suppr = pow(10.0, (suppr_factor) * RES_SUPR_FACTOR / 10.0) * u_suppr;
}
#endif
#ifdef MEC2_STATS
/* Periodically dump performance stats */
if ((pvt->i_d % MEC2_STATS) == 0) {
/* make sure to avoid div0's! */
if (pvt->cntr_coeff_missedupdates > 0)
pvt->avg_Lu_i_toolow = (int)(pvt->avg_Lu_i_toolow / pvt->cntr_coeff_missedupdates);
else
pvt->avg_Lu_i_toolow = -1;
if (pvt->cntr_coeff_updates > 0)
pvt->avg_Lu_i_ok = (pvt->avg_Lu_i_ok / pvt->cntr_coeff_updates);
else
pvt->avg_Lu_i_ok = -1;
printk( KERN_INFO "%d: Near end speech: %5d Residuals corrected/skipped: %5d/%5d Coefficients updated ok/low sig: %3d/%3d Lu_i avg ok/low sig %6d/%5d\n",
pvt->id,
pvt->cntr_nearend_speech_frames,
pvt->cntr_residualcorrected_frames, pvt->cntr_residualcorrected_framesskipped,
pvt->cntr_coeff_updates, pvt->cntr_coeff_missedupdates,
pvt->avg_Lu_i_ok, pvt->avg_Lu_i_toolow);
pvt->cntr_nearend_speech_frames = 0;
pvt->cntr_residualcorrected_frames = 0;
pvt->cntr_residualcorrected_framesskipped = 0;
pvt->cntr_coeff_updates = 0;
pvt->cntr_coeff_missedupdates = 0;
pvt->avg_Lu_i_ok = 0;
pvt->avg_Lu_i_toolow = 0;
}
#endif
/* Increment the sample index and return the corrected sample */
pvt->i_d++;
return u;
}
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
u32 x;
short result;
for (x = 0; x < size; x++) {
result = sample_update(pvt, *iref, *isig);
*isig++ = result;
++iref;
}
}
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
int maxy;
int maxu;
size_t size;
unsigned int x;
char *c;
struct ec_pvt *pvt;
maxy = ecp->tap_length + DEFAULT_M;
maxu = DEFAULT_M;
if (maxy < (1 << DEFAULT_ALPHA_YT_I))
maxy = (1 << DEFAULT_ALPHA_YT_I);
if (maxy < (1 << DEFAULT_SIGMA_LY_I))
maxy = (1 << DEFAULT_SIGMA_LY_I);
if (maxu < (1 << DEFAULT_SIGMA_LU_I))
maxu = (1 << DEFAULT_SIGMA_LU_I);
size = sizeof(*ec) +
4 + /* align */
sizeof(int) * ecp->tap_length + /* a_i */
sizeof(short) * ecp->tap_length + /* a_s */
2 * sizeof(short) * (maxy) + /* y_s */
2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */
2 * sizeof(short) * (maxu) + /* u_s */
2 * sizeof(short) * ecp->tap_length; /* y_tilde_s */
pvt = kzalloc(size, GFP_KERNEL);
if (!pvt)
return -ENOMEM;
pvt->dahdi.ops = &my_ops;
pvt->aggressive = aggressive;
pvt->dahdi.features = my_features;
for (x = 0; x < ecp->param_count; x++) {
for (c = p[x].name; *c; c++)
*c = tolower(*c);
if (!strcmp(p[x].name, "aggressive")) {
pvt->aggressive = p[x].value ? 1 : 0;
} else {
printk(KERN_WARNING "Unknown parameter supplied to KB1 echo canceler: '%s'\n", p[x].name);
kfree(pvt);
return -EINVAL;
}
}
init_cc(pvt, ecp->tap_length, maxy, maxu);
/* Non-linear processor - a fancy way to say "zap small signals, to avoid
accumulating noise". */
pvt->use_nlp = TRUE;
*ec = &pvt->dahdi;
return 0;
}
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
/* Set the hangover counter to the length of the can to
* avoid adjustments occuring immediately after initial forced training
*/
pvt->HCNTR_d = pvt->N_d << 1;
if (pos >= pvt->N_d)
return 1;
pvt->a_i[pos] = val << 17;
pvt->a_s[pos] = val << 1;
if (++pos >= pvt->N_d)
return 1;
return 0;
}
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
pvt->use_nlp = enable ? 1 : 0;
}
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
}
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
return 0;
}
static void __exit mod_exit(void)
{
dahdi_unregister_echocan_factory(&my_factory);
}
module_param(debug, int, S_IRUGO | S_IWUSR);
module_param(aggressive, int, S_IRUGO | S_IWUSR);
MODULE_DESCRIPTION("DAHDI 'KB1' Echo Canceler");
MODULE_AUTHOR("Kris Boutilier");
MODULE_LICENSE("GPL v2");
module_init(mod_init);
module_exit(mod_exit);

View File

@ -0,0 +1,891 @@
/*
* ECHO_CAN_MG2
*
* by Michael Gernoth
*
* Based upon kb1ec.h and mec2.h
*
* Copyright (C) 2002, Digium, Inc.
*
* Additional background on the techniques used in this code can be found in:
*
* Messerschmitt, David; Hedberg, David; Cole, Christopher; Haoui, Amine;
* Winship, Peter; "Digital Voice Echo Canceller with a TMS32020,"
* in Digital Signal Processing Applications with the TMS320 Family,
* pp. 415-437, Texas Instruments, Inc., 1986.
*
* A pdf of which is available by searching on the document title at http://www.ti.com/
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/moduleparam.h>
#include <dahdi/kernel.h>
static int debug;
static int aggressive;
#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
#define debug_printk(level, fmt, args...) if (debug >= level) printk("%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
#define ABS(a) abs(a!=-32768?a:-32767)
#define RESTORE_COEFFS {\
int x;\
memcpy(pvt->a_i, pvt->c_i, pvt->N_d*sizeof(int));\
for (x = 0; x < pvt->N_d; x++) {\
pvt->a_s[x] = pvt->a_i[x] >> 16;\
}\
pvt->backup = BACKUP;\
}
/* Uncomment to provide summary statistics for overall echo can performance every 4000 samples */
/* #define MEC2_STATS 4000 */
/* Uncomment to generate per-sample statistics - this will severely degrade system performance and audio quality */
/* #define MEC2_STATS_DETAILED */
/* Uncomment to generate per-call DC bias offset messages */
/* #define MEC2_DCBIAS_MESSAGE */
/* Get optimized routines for math */
#include "arith.h"
/*
Important constants for tuning mg2 echo can
*/
/* Convergence (aka. adaptation) speed -- higher means slower */
#define DEFAULT_BETA1_I 2048
/* Constants for various power computations */
#define DEFAULT_SIGMA_LY_I 7
#define DEFAULT_SIGMA_LU_I 7
#define DEFAULT_ALPHA_ST_I 5 /* near-end speech detection sensitivity factor */
#define DEFAULT_ALPHA_YT_I 5
#define DEFAULT_CUTOFF_I 128
/* Define the near-end speech hangover counter: if near-end speech
* is declared, hcntr is set equal to hangt (see pg. 432)
*/
#define DEFAULT_HANGT 600 /* in samples, so 600 samples = 75ms */
/* define the residual error suppression threshold */
#define DEFAULT_SUPPR_I 16 /* 16 = -24db */
/* This is the minimum reference signal power estimate level
* that will result in filter adaptation.
* If this is too low then background noise will cause the filter
* coefficients to constantly be updated.
*/
#define MIN_UPDATE_THRESH_I 2048
/* The number of samples used to update coefficients using the
* the block update method (M). It should be related back to the
* length of the echo can.
* ie. it only updates coefficients when (sample number MOD default_m) = 0
*
* Getting this wrong may cause an oops. Consider yourself warned!
*/
#define DEFAULT_M 16 /* every 16th sample */
/* If AGGRESSIVE supression is enabled, then we start cancelling residual
* echos again even while there is potentially the very end of a near-side
* signal present.
* This defines how many samples of DEFAULT_HANGT can remain before we
* kick back in
*/
#define AGGRESSIVE_HCNTR 160 /* in samples, so 160 samples = 20ms */
/* Treat sample as error if it has a different sign as the
* input signal and is this number larger in ABS() as
* the input-signal */
#define MAX_SIGN_ERROR 3000
/* Number of coefficients really used for calculating the
* simulated echo. The value specifies how many of the
* biggest coefficients are used for calculating rs.
* This helps on long echo-tails by artificially limiting
* the number of coefficients for the calculation and
* preventing overflows.
* Comment this to deactivate the code */
#define USED_COEFFS 64
/* Backup coefficients every this number of samples */
#define BACKUP 256
/***************************************************************/
/* The following knobs are not implemented in the current code */
/* we need a dynamic level of suppression varying with the ratio of the
power of the echo to the power of the reference signal this is
done so that we have a smoother background.
we have a higher suppression when the power ratio is closer to
suppr_ceil and reduces logarithmically as we approach suppr_floor.
*/
#define SUPPR_FLOOR -64
#define SUPPR_CEIL -24
/* in a second departure, we calculate the residual error suppression
* as a percentage of the reference signal energy level. The threshold
* is defined in terms of dB below the reference signal.
*/
#define RES_SUPR_FACTOR -20
#define DC_NORMALIZE
#ifndef NULL
#define NULL 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
/* Generic circular buffer definition */
typedef struct {
/* Pointer to the relative 'start' of the buffer */
int idx_d;
/* The absolute size of the buffer */
int size_d;
/* The actual sample - twice as large as we need, however we do store values at idx_d and idx_d+size_d */
short *buf_d;
} echo_can_cb_s;
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
static const struct dahdi_echocan_factory my_factory = {
.name = "MG2",
.owner = THIS_MODULE,
.echocan_create = echo_can_create,
};
static const struct dahdi_echocan_features my_features = {
.NLP_toggle = 1,
};
static const struct dahdi_echocan_ops my_ops = {
.name = "MG2",
.echocan_free = echo_can_free,
.echocan_process = echo_can_process,
.echocan_traintap = echo_can_traintap,
.echocan_NLP_toggle = echocan_NLP_toggle,
};
struct ec_pvt {
struct dahdi_echocan_state dahdi;
/* an arbitrary ID for this echo can - this really should be settable from the calling channel... */
int id;
/* absolute time - aka. sample number index - essentially the number of samples since this can was init'ed */
int i_d;
/* Pre-computed constants */
/* ---------------------- */
/* Number of filter coefficents */
int N_d;
/* Rate of adaptation of filter */
int beta2_i;
/* Accumulators for power computations */
/* ----------------------------------- */
/* reference signal power estimate - aka. Average absolute value of y(k) */
int Ly_i;
/* ... */
int Lu_i;
/* Accumulators for signal detectors */
/* --------------------------------- */
/* Power estimate of the recent past of the near-end hybrid signal - aka. Short-time average of: 2 x |s(i)| */
int s_tilde_i;
/* Power estimate of the recent past of the far-end receive signal - aka. Short-time average of: |y(i)| */
int y_tilde_i;
/* Near end speech detection counter - stores Hangover counter time remaining, in samples */
int HCNTR_d;
/* Circular buffers and coefficients */
/* --------------------------------- */
/* ... */
int *a_i;
/* ... */
short *a_s;
/* Backups */
int *b_i;
int *c_i;
/* Reference samples of far-end receive signal */
echo_can_cb_s y_s;
/* Reference samples of near-end signal */
echo_can_cb_s s_s;
/* Reference samples of near-end signal minus echo estimate */
echo_can_cb_s u_s;
/* Reference samples of far-end receive signal used to calculate short-time average */
echo_can_cb_s y_tilde_s;
/* Peak far-end receive signal */
/* --------------------------- */
/* Highest y_tilde value in the sample buffer */
short max_y_tilde;
/* Index of the sample containing the max_y_tilde value */
int max_y_tilde_pos;
#ifdef MEC2_STATS
/* Storage for performance statistics */
int cntr_nearend_speech_frames;
int cntr_residualcorrected_frames;
int cntr_residualcorrected_framesskipped;
int cntr_coeff_updates;
int cntr_coeff_missedupdates;
int avg_Lu_i_toolow;
int avg_Lu_i_ok;
#endif
unsigned int aggressive:1;
short lastsig;
int lastcount;
int backup;
#ifdef DC_NORMALIZE
int dc_estimate;
#endif
int use_nlp;
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
{
cb->buf_d = (short *)where;
cb->idx_d = 0;
cb->size_d = len;
}
static inline void add_cc_s(echo_can_cb_s *cb, short newval)
{
/* Can't use modulus because N+M isn't a power of two (generally) */
cb->idx_d--;
if (cb->idx_d < (int)0)
/* Whoops - the pointer to the 'start' wrapped around so reset it to the top of the buffer */
cb->idx_d += cb->size_d;
/* Load two copies into memory */
cb->buf_d[cb->idx_d] = newval;
cb->buf_d[cb->idx_d + cb->size_d] = newval;
}
static inline short get_cc_s(echo_can_cb_s *cb, int pos)
{
/* Load two copies into memory */
return cb->buf_d[cb->idx_d + pos];
}
static inline void init_cc(struct ec_pvt *pvt, int N, int maxy, int maxu)
{
void *ptr = pvt;
unsigned long tmp;
/* Double-word align past end of state */
ptr += sizeof(*pvt);
tmp = (unsigned long)ptr;
tmp += 3;
tmp &= ~3L;
ptr = (void *)tmp;
/* Reset parameters */
pvt->N_d = N;
pvt->beta2_i = DEFAULT_BETA1_I;
/* Allocate coefficient memory */
pvt->a_i = ptr;
ptr += (sizeof(int) * pvt->N_d);
pvt->a_s = ptr;
ptr += (sizeof(short) * pvt->N_d);
/* Allocate backup memory */
pvt->b_i = ptr;
ptr += (sizeof(int) * pvt->N_d);
pvt->c_i = ptr;
ptr += (sizeof(int) * pvt->N_d);
/* Reset Y circular buffer (short version) */
init_cb_s(&pvt->y_s, maxy, ptr);
ptr += (sizeof(short) * (maxy) * 2);
/* Reset Sigma circular buffer (short version for FIR filter) */
init_cb_s(&pvt->s_s, (1 << DEFAULT_ALPHA_ST_I), ptr);
ptr += (sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) * 2);
init_cb_s(&pvt->u_s, maxu, ptr);
ptr += (sizeof(short) * maxu * 2);
/* Allocate a buffer for the reference signal power computation */
init_cb_s(&pvt->y_tilde_s, pvt->N_d, ptr);
/* Reset the absolute time index */
pvt->i_d = (int)0;
/* Reset the power computations (for y and u) */
pvt->Ly_i = DEFAULT_CUTOFF_I;
pvt->Lu_i = DEFAULT_CUTOFF_I;
#ifdef MEC2_STATS
/* set the identity */
pvt->id = (int)&ptr;
/* Reset performance stats */
pvt->cntr_nearend_speech_frames = (int)0;
pvt->cntr_residualcorrected_frames = (int)0;
pvt->cntr_residualcorrected_framesskipped = (int)0;
pvt->cntr_coeff_updates = (int)0;
pvt->cntr_coeff_missedupdates = (int)0;
pvt->avg_Lu_i_toolow = (int)0;
pvt->avg_Lu_i_ok = (int)0;
#endif
/* Reset the near-end speech detector */
pvt->s_tilde_i = (int)0;
pvt->y_tilde_i = (int)0;
pvt->HCNTR_d = (int)0;
}
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
#if defined(DC_NORMALIZE) && defined(MEC2_DCBIAS_MESSAGE)
printk(KERN_INFO "EC: DC bias calculated: %d V\n", pvt->dc_estimate >> 15);
#endif
kfree(pvt);
}
#ifdef DC_NORMALIZE
short inline dc_removal(int *dc_estimate, short samp)
{
*dc_estimate += ((((int)samp << 15) - *dc_estimate) >> 9);
return samp - (*dc_estimate >> 15);
}
#endif
static inline short sample_update(struct ec_pvt *pvt, short iref, short isig)
{
/* Declare local variables that are used more than once */
/* ... */
int k;
/* ... */
int rs;
/* ... */
short u;
/* ... */
int Py_i;
/* ... */
int two_beta_i;
#ifdef DC_NORMALIZE
isig = dc_removal(&pvt->dc_estimate, isig);
#endif
/* flow A on pg. 428 */
/* eq. (16): high-pass filter the input to generate the next value;
* push the current value into the circular buffer
*
* sdc_im1_d = sdc_d;
* sdc_d = sig;
* s_i_d = sdc_d;
* s_d = s_i_d;
* s_i_d = (float)(1.0 - gamma_d) * s_i_d
* + (float)(0.5 * (1.0 - gamma_d)) * (sdc_d - sdc_im1_d);
*/
/* Update the Far-end receive signal circular buffers and accumulators */
/* ------------------------------------------------------------------- */
/* Delete the oldest sample from the power estimate accumulator */
pvt->y_tilde_i -= abs(get_cc_s(&pvt->y_s, (1 << DEFAULT_ALPHA_YT_I) - 1)) >> DEFAULT_ALPHA_YT_I;
/* Add the new sample to the power estimate accumulator */
pvt->y_tilde_i += abs(iref) >> DEFAULT_ALPHA_ST_I;
/* Push a copy of the new sample into its circular buffer */
add_cc_s(&pvt->y_s, iref);
/* eq. (2): compute r in fixed-point */
rs = CONVOLVE2(pvt->a_s,
pvt->y_s.buf_d + pvt->y_s.idx_d,
pvt->N_d);
rs >>= 15;
if (pvt->lastsig == isig) {
pvt->lastcount++;
} else {
pvt->lastcount = 0;
pvt->lastsig = isig;
}
if (isig == 0) {
u = 0;
} else if (pvt->lastcount > 255) {
/* We have seen the same input-signal more than 255 times,
* we should pass it through uncancelled, as we are likely on hold */
u = isig;
} else {
int sign_error;
if (rs < -32768) {
rs = -32768;
pvt->HCNTR_d = DEFAULT_HANGT;
RESTORE_COEFFS;
} else if (rs > 32767) {
rs = 32767;
pvt->HCNTR_d = DEFAULT_HANGT;
RESTORE_COEFFS;
}
sign_error = ABS(rs) - ABS(isig);
if (ABS(sign_error) > MAX_SIGN_ERROR)
{
rs = 0;
RESTORE_COEFFS;
}
/* eq. (3): compute the output value (see figure 3) and the error
* note: the error is the same as the output signal when near-end
* speech is not present
*/
u = isig - rs;
if (u / isig < 0)
u = isig - (rs >> 1);
}
/* Push a copy of the output value sample into its circular buffer */
add_cc_s(&pvt->u_s, u);
if (!pvt->backup) {
/* Backup coefficients periodically */
pvt->backup = BACKUP;
memcpy(pvt->c_i, pvt->b_i, pvt->N_d*sizeof(int));
memcpy(pvt->b_i, pvt->a_i, pvt->N_d*sizeof(int));
} else
pvt->backup--;
/* Update the Near-end hybrid signal circular buffers and accumulators */
/* ------------------------------------------------------------------- */
/* Delete the oldest sample from the power estimate accumulator */
pvt->s_tilde_i -= abs(get_cc_s(&pvt->s_s, (1 << DEFAULT_ALPHA_ST_I) - 1));
/* Add the new sample to the power estimate accumulator */
pvt->s_tilde_i += abs(isig);
/* Push a copy of the new sample into it's circular buffer */
add_cc_s(&pvt->s_s, isig);
/* Push a copy of the current short-time average of the far-end receive signal into it's circular buffer */
add_cc_s(&pvt->y_tilde_s, pvt->y_tilde_i);
/* flow B on pg. 428 */
/* If the hangover timer isn't running then compute the new convergence factor, otherwise set Py_i to 32768 */
if (!pvt->HCNTR_d) {
Py_i = (pvt->Ly_i >> DEFAULT_SIGMA_LY_I) * (pvt->Ly_i >> DEFAULT_SIGMA_LY_I);
Py_i >>= 15;
} else {
Py_i = (1 << 15);
}
#if 0
/* Vary rate of adaptation depending on position in the file
* Do not do this for the first (DEFAULT_UPDATE_TIME) secs after speech
* has begun of the file to allow the echo cancellor to estimate the
* channel accurately
* Still needs conversion!
*/
if (pvt->start_speech_d != 0) {
if (pvt->i_d > (DEFAULT_T0 + pvt->start_speech_d)*(SAMPLE_FREQ)) {
pvt->beta2_d = max_cc_float(MIN_BETA, DEFAULT_BETA1 * exp((-1/DEFAULT_TAU)*((pvt->i_d/(float)SAMPLE_FREQ) - DEFAULT_T0 - pvt->start_speech_d)));
}
} else {
pvt->beta2_d = DEFAULT_BETA1;
}
#endif
/* Fixed point, inverted */
pvt->beta2_i = DEFAULT_BETA1_I;
/* Fixed point version, inverted */
two_beta_i = (pvt->beta2_i * Py_i) >> 15;
if (!two_beta_i)
two_beta_i++;
/* Update the Suppressed signal power estimate accumulator */
/* ------------------------------------------------------- */
/* Delete the oldest sample from the power estimate accumulator */
pvt->Lu_i -= abs(get_cc_s(&pvt->u_s, (1 << DEFAULT_SIGMA_LU_I) - 1));
/* Add the new sample to the power estimate accumulator */
pvt->Lu_i += abs(u);
/* Update the Far-end reference signal power estimate accumulator */
/* -------------------------------------------------------------- */
/* eq. (10): update power estimate of the reference */
/* Delete the oldest sample from the power estimate accumulator */
pvt->Ly_i -= abs(get_cc_s(&pvt->y_s, (1 << DEFAULT_SIGMA_LY_I) - 1)) ;
/* Add the new sample to the power estimate accumulator */
pvt->Ly_i += abs(iref);
if (pvt->Ly_i < DEFAULT_CUTOFF_I)
pvt->Ly_i = DEFAULT_CUTOFF_I;
/* Update the Peak far-end receive signal detected */
/* ----------------------------------------------- */
if (pvt->y_tilde_i > pvt->max_y_tilde) {
/* New highest y_tilde with full life */
pvt->max_y_tilde = pvt->y_tilde_i;
pvt->max_y_tilde_pos = pvt->N_d - 1;
} else if (--pvt->max_y_tilde_pos < 0) {
/* Time to find new max y tilde... */
pvt->max_y_tilde = MAX16(pvt->y_tilde_s.buf_d + pvt->y_tilde_s.idx_d, pvt->N_d, &pvt->max_y_tilde_pos);
}
/* Determine if near end speech was detected in this sample */
/* -------------------------------------------------------- */
if (((pvt->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)) > pvt->max_y_tilde)
&& (pvt->max_y_tilde > 0)) {
/* Then start the Hangover counter */
pvt->HCNTR_d = DEFAULT_HANGT;
RESTORE_COEFFS;
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "Reset near end speech timer with: s_tilde_i %d, stmnt %d, max_y_tilde %d\n", pvt->s_tilde_i, (pvt->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)), pvt->max_y_tilde);
#endif
#ifdef MEC2_STATS
++pvt->cntr_nearend_speech_frames;
#endif
} else if (pvt->HCNTR_d > (int)0) {
/* otherwise, if it's still non-zero, decrement the Hangover counter by one sample */
#ifdef MEC2_STATS
++pvt->cntr_nearend_speech_frames;
#endif
pvt->HCNTR_d--;
}
/* Update coefficients if no near-end speech in this sample (ie. HCNTR_d = 0)
* and we have enough signal to bother trying to update.
* --------------------------------------------------------------------------
*/
if (!pvt->HCNTR_d && /* no near-end speech present */
!(pvt->i_d % DEFAULT_M)) { /* we only update on every DEFAULM_M'th sample from the stream */
if (pvt->Lu_i > MIN_UPDATE_THRESH_I) { /* there is sufficient energy above the noise floor to contain meaningful data */
/* so loop over all the filter coefficients */
#ifdef USED_COEFFS
int max_coeffs[USED_COEFFS];
int *pos;
if (pvt->N_d > USED_COEFFS)
memset(max_coeffs, 0, USED_COEFFS*sizeof(int));
#endif
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "updating coefficients with: pvt->Lu_i %9d\n", pvt->Lu_i);
#endif
#ifdef MEC2_STATS
pvt->avg_Lu_i_ok = pvt->avg_Lu_i_ok + pvt->Lu_i;
++pvt->cntr_coeff_updates;
#endif
for (k = 0; k < pvt->N_d; k++) {
/* eq. (7): compute an expectation over M_d samples */
int grad2;
grad2 = CONVOLVE2(pvt->u_s.buf_d + pvt->u_s.idx_d,
pvt->y_s.buf_d + pvt->y_s.idx_d + k,
DEFAULT_M);
/* eq. (7): update the coefficient */
pvt->a_i[k] += grad2 / two_beta_i;
pvt->a_s[k] = pvt->a_i[k] >> 16;
#ifdef USED_COEFFS
if (pvt->N_d > USED_COEFFS) {
if (abs(pvt->a_i[k]) > max_coeffs[USED_COEFFS-1]) {
/* More or less insertion-sort... */
pos = max_coeffs;
while (*pos > abs(pvt->a_i[k]))
pos++;
if (*pos > max_coeffs[USED_COEFFS-1])
memmove(pos+1, pos, (USED_COEFFS-(pos-max_coeffs)-1)*sizeof(int));
*pos = abs(pvt->a_i[k]);
}
}
#endif
}
#ifdef USED_COEFFS
/* Filter out irrelevant coefficients */
if (pvt->N_d > USED_COEFFS)
for (k = 0; k < pvt->N_d; k++)
if (abs(pvt->a_i[k]) < max_coeffs[USED_COEFFS-1])
pvt->a_i[k] = pvt->a_s[k] = 0;
#endif
} else {
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "insufficient signal to update coefficients pvt->Lu_i %5d < %5d\n", pvt->Lu_i, MIN_UPDATE_THRESH_I);
#endif
#ifdef MEC2_STATS
pvt->avg_Lu_i_toolow = pvt->avg_Lu_i_toolow + pvt->Lu_i;
++pvt->cntr_coeff_missedupdates;
#endif
}
}
/* paragraph below eq. (15): if no near-end speech in the sample and
* the reference signal power estimate > cutoff threshold
* then perform residual error suppression
*/
#ifdef MEC2_STATS_DETAILED
if (pvt->HCNTR_d == 0)
printk(KERN_INFO "possibly correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d and expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifndef NO_ECHO_SUPPRESSOR
if (pvt->use_nlp) {
if (pvt->aggressive) {
if ((pvt->HCNTR_d < AGGRESSIVE_HCNTR) && (pvt->Ly_i > (pvt->Lu_i << 1))) {
for (k = 0; k < 2; k++) {
u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1);
}
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "aggresively correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifdef MEC2_STATS
++pvt->cntr_residualcorrected_frames;
#endif
}
} else {
if (pvt->HCNTR_d == 0) {
if ((pvt->Ly_i/(pvt->Lu_i + 1)) > DEFAULT_SUPPR_I) {
for (k = 0; k < 1; k++) {
u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1);
}
#ifdef MEC2_STATS_DETAILED
printk(KERN_INFO "correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifdef MEC2_STATS
++pvt->cntr_residualcorrected_frames;
#endif
}
#ifdef MEC2_STATS
else {
++pvt->cntr_residualcorrected_framesskipped;
}
#endif
}
}
}
#endif
#if 0
/* This will generate a non-linear supression factor, once converted */
if ((pvt->HCNTR_d == 0) &&
((pvt->Lu_d/pvt->Ly_d) < DEFAULT_SUPPR) &&
(pvt->Lu_d/pvt->Ly_d > EC_MIN_DB_VALUE)) {
suppr_factor = (10 / (float)(SUPPR_FLOOR - SUPPR_CEIL)) * log(pvt->Lu_d/pvt->Ly_d)
- SUPPR_CEIL / (float)(SUPPR_FLOOR - SUPPR_CEIL);
u_suppr = pow(10.0, (suppr_factor) * RES_SUPR_FACTOR / 10.0) * u_suppr;
}
#endif
#ifdef MEC2_STATS
/* Periodically dump performance stats */
if ((pvt->i_d % MEC2_STATS) == 0) {
/* make sure to avoid div0's! */
if (pvt->cntr_coeff_missedupdates > 0)
pvt->avg_Lu_i_toolow = (int)(pvt->avg_Lu_i_toolow / pvt->cntr_coeff_missedupdates);
else
pvt->avg_Lu_i_toolow = -1;
if (pvt->cntr_coeff_updates > 0)
pvt->avg_Lu_i_ok = (pvt->avg_Lu_i_ok / pvt->cntr_coeff_updates);
else
pvt->avg_Lu_i_ok = -1;
printk(KERN_INFO "%d: Near end speech: %5d Residuals corrected/skipped: %5d/%5d Coefficients updated ok/low sig: %3d/%3d Lu_i avg ok/low sig %6d/%5d\n",
pvt->id,
pvt->cntr_nearend_speech_frames,
pvt->cntr_residualcorrected_frames, pvt->cntr_residualcorrected_framesskipped,
pvt->cntr_coeff_updates, pvt->cntr_coeff_missedupdates,
pvt->avg_Lu_i_ok, pvt->avg_Lu_i_toolow);
pvt->cntr_nearend_speech_frames = 0;
pvt->cntr_residualcorrected_frames = 0;
pvt->cntr_residualcorrected_framesskipped = 0;
pvt->cntr_coeff_updates = 0;
pvt->cntr_coeff_missedupdates = 0;
pvt->avg_Lu_i_ok = 0;
pvt->avg_Lu_i_toolow = 0;
}
#endif
/* Increment the sample index and return the corrected sample */
pvt->i_d++;
return u;
}
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
u32 x;
short result;
for (x = 0; x < size; x++) {
result = sample_update(pvt, *iref, *isig);
*isig++ = result;
++iref;
}
}
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
int maxy;
int maxu;
size_t size;
unsigned int x;
char *c;
struct ec_pvt *pvt;
maxy = ecp->tap_length + DEFAULT_M;
maxu = DEFAULT_M;
if (maxy < (1 << DEFAULT_ALPHA_YT_I))
maxy = (1 << DEFAULT_ALPHA_YT_I);
if (maxy < (1 << DEFAULT_SIGMA_LY_I))
maxy = (1 << DEFAULT_SIGMA_LY_I);
if (maxu < (1 << DEFAULT_SIGMA_LU_I))
maxu = (1 << DEFAULT_SIGMA_LU_I);
size = sizeof(**ec) +
4 + /* align */
sizeof(int) * ecp->tap_length + /* a_i */
sizeof(short) * ecp->tap_length + /* a_s */
sizeof(int) * ecp->tap_length + /* b_i */
sizeof(int) * ecp->tap_length + /* c_i */
2 * sizeof(short) * (maxy) + /* y_s */
2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */
2 * sizeof(short) * (maxu) + /* u_s */
2 * sizeof(short) * ecp->tap_length; /* y_tilde_s */
pvt = kzalloc(size, GFP_KERNEL);
if (!pvt)
return -ENOMEM;
pvt->dahdi.ops = &my_ops;
pvt->aggressive = aggressive;
pvt->dahdi.features = my_features;
for (x = 0; x < ecp->param_count; x++) {
for (c = p[x].name; *c; c++)
*c = tolower(*c);
if (!strcmp(p[x].name, "aggressive")) {
pvt->aggressive = p[x].value ? 1 : 0;
} else {
printk(KERN_WARNING "Unknown parameter supplied to MG2 echo canceler: '%s'\n", p[x].name);
kfree(pvt);
return -EINVAL;
}
}
init_cc(pvt, ecp->tap_length, maxy, maxu);
/* Non-linear processor - a fancy way to say "zap small signals, to avoid
accumulating noise". */
pvt->use_nlp = TRUE;
*ec = &pvt->dahdi;
return 0;
}
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
/* Set the hangover counter to the length of the can to
* avoid adjustments occuring immediately after initial forced training
*/
pvt->HCNTR_d = pvt->N_d << 1;
if (pos >= pvt->N_d) {
memcpy(pvt->b_i, pvt->a_i, pvt->N_d*sizeof(int));
memcpy(pvt->c_i, pvt->a_i, pvt->N_d*sizeof(int));
return 1;
}
pvt->a_i[pos] = val << 17;
pvt->a_s[pos] = val << 1;
if (++pos >= pvt->N_d) {
memcpy(pvt->b_i, pvt->a_i, pvt->N_d*sizeof(int));
memcpy(pvt->c_i, pvt->a_i, pvt->N_d*sizeof(int));
return 1;
}
return 0;
}
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
pvt->use_nlp = enable ? 1 : 0;
}
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
}
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
return 0;
}
static void __exit mod_exit(void)
{
dahdi_unregister_echocan_factory(&my_factory);
}
module_param(debug, int, S_IRUGO | S_IWUSR);
module_param(aggressive, int, S_IRUGO | S_IWUSR);
MODULE_DESCRIPTION("DAHDI 'MG2' Echo Canceler");
MODULE_AUTHOR("Michael Gernoth");
MODULE_LICENSE("GPL v2");
module_init(mod_init);
module_exit(mod_exit);

View File

@ -0,0 +1,144 @@
/*
* DAHDI Telephony Interface to the Open Source Line Echo Canceller (OSLEC)
*
* Written by Tzafrir Cohen <tzafrir.cohen@xorcom.com>
* Copyright (C) 2008 Xorcom, Inc.
*
* All rights reserved.
*
* Based on dahdi_echocan_hpec.c, Copyright (C) 2006-2008 Digium, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/moduleparam.h>
/* Fix this if OSLEC is elsewhere */
#include "../staging/echo/oslec.h"
//#include <linux/oslec.h>
#include <dahdi/kernel.h>
#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
static const struct dahdi_echocan_factory my_factory = {
.name = "OSLEC",
.owner = THIS_MODULE,
.echocan_create = echo_can_create,
};
static const struct dahdi_echocan_ops my_ops = {
.name = "OSLEC",
.echocan_free = echo_can_free,
.echocan_process = echo_can_process,
.echocan_traintap = echo_can_traintap,
};
struct ec_pvt {
struct oslec_state *oslec;
struct dahdi_echocan_state dahdi;
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
oslec_free(pvt->oslec);
kfree(pvt);
}
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
u32 SampleNum;
for (SampleNum = 0; SampleNum < size; SampleNum++, iref++) {
short iCleanSample;
iCleanSample = oslec_update(pvt->oslec, *iref, *isig);
*isig++ = iCleanSample;
}
}
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct ec_pvt *pvt;
if (ecp->param_count > 0) {
printk(KERN_WARNING "OSLEC does not support parameters; failing request\n");
return -EINVAL;
}
pvt = kzalloc(sizeof(*pvt), GFP_KERNEL);
if (!pvt)
return -ENOMEM;
pvt->dahdi.ops = &my_ops;
pvt->oslec = oslec_create(ecp->tap_length, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP | ECHO_CAN_USE_CLIP | ECHO_CAN_USE_TX_HPF | ECHO_CAN_USE_RX_HPF);
if (!pvt->oslec) {
kfree(pvt);
*ec = NULL;
return -ENOTTY;
} else {
*ec = &pvt->dahdi;
return 0;
}
}
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
{
return 1;
}
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
}
module_printk(KERN_INFO, "Registered echo canceler '%s'\n", my_factory.name);
return 0;
}
static void __exit mod_exit(void)
{
dahdi_unregister_echocan_factory(&my_factory);
}
MODULE_DESCRIPTION("DAHDI OSLEC wrapper");
MODULE_AUTHOR("Tzafrir Cohen <tzafrir.cohen@xorcom.com>");
MODULE_LICENSE("GPL");
module_init(mod_init);
module_exit(mod_exit);

View File

@ -0,0 +1,356 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* echo.c - An echo cancellor, suitable for electrical and acoustic
* cancellation. This code does not currently comply with
* any relevant standards (e.g. G.164/5/7/8). One day....
*
* Written by Steve Underwood <steveu@coppice.org>
* Various optimizations and improvements by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001 Steve Underwood
*
* Based on a bit from here, a bit from there, eye of toad,
* ear of bat, etc - plus, of course, my own 2 cents.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
/* TODO:
Finish the echo suppressor option, however nasty suppression may be
Add an option to reintroduce side tone at -24dB under appropriate conditions.
Improve double talk detector (iterative!)
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/moduleparam.h>
#include <dahdi/kernel.h>
static int debug;
#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
#define debug_printk(level, fmt, args...) if (debug >= level) printk(KERN_DEBUG "%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
#include "arith.h"
#ifndef NULL
#define NULL 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#define USE_SHORTS
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
/* Original parameters :
#define MIN_TX_POWER_FOR_ADAPTION 256
#define MIN_RX_POWER_FOR_ADAPTION 128
*/
#define MIN_TX_POWER_FOR_ADAPTION 256
#define MIN_RX_POWER_FOR_ADAPTION 64
/* Better ones found by Jim
#define MIN_TX_POWER_FOR_ADAPTION 128
#define MIN_RX_POWER_FOR_ADAPTION 64
*/
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
static const struct dahdi_echocan_factory my_factory = {
.name = "SEC",
.owner = THIS_MODULE,
.echocan_create = echo_can_create,
};
static const struct dahdi_echocan_features my_features = {
.NLP_toggle = 1,
};
static const struct dahdi_echocan_ops my_ops = {
.name = "SEC",
.echocan_free = echo_can_free,
.echocan_process = echo_can_process,
.echocan_traintap = echo_can_traintap,
.echocan_NLP_toggle = echocan_NLP_toggle,
};
struct ec_pvt {
struct dahdi_echocan_state dahdi;
int tx_power;
int rx_power;
int clean_rx_power;
int rx_power_threshold;
int nonupdate_dwell;
int16_t *tx_history; /* Last N tx samples */
int32_t *fir_taps; /* Echo FIR taps */
int16_t *fir_taps_short; /* Echo FIR taps, shorts instead of ints */
int curr_pos;
int taps;
int tap_mask;
int use_nlp;
int use_suppressor;
int32_t supp_test1;
int32_t supp_test2;
int32_t supp1;
int32_t supp2;
int32_t latest_correction; /* Indication of the magnitude of the latest
adaption, or a code to indicate why adaption
was skipped, for test purposes */
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct ec_pvt *pvt;
size_t size;
if (ecp->param_count > 0) {
printk(KERN_WARNING "SEC does not support parameters; failing request\n");
return -EINVAL;
}
size = sizeof(*pvt) + ecp->tap_length * sizeof(int32_t) + ecp->tap_length * 3 * sizeof(int16_t);
pvt = kzalloc(size, GFP_KERNEL);
if (!pvt)
return -ENOMEM;
pvt->dahdi.ops = &my_ops;
pvt->dahdi.features = my_features;
pvt->taps = ecp->tap_length;
pvt->tap_mask = ecp->tap_length - 1;
pvt->tx_history = (int16_t *) (pvt + sizeof(*pvt));
pvt->fir_taps = (int32_t *) (pvt + sizeof(*pvt) +
ecp->tap_length * 2 * sizeof(int16_t));
pvt->fir_taps_short = (int16_t *) (pvt + sizeof(*pvt) +
ecp->tap_length * sizeof(int32_t) +
ecp->tap_length * 2 * sizeof(int16_t));
pvt->rx_power_threshold = 10000000;
pvt->use_suppressor = FALSE;
/* Non-linear processor - a fancy way to say "zap small signals, to avoid
accumulating noise". */
pvt->use_nlp = TRUE;
*ec = &pvt->dahdi;
return 0;
}
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
kfree(pvt);
}
static inline int16_t sample_update(struct ec_pvt *pvt, int16_t tx, int16_t rx)
{
int32_t echo_value;
int clean_rx;
int nsuppr;
pvt->tx_history[pvt->curr_pos] = tx;
pvt->tx_history[pvt->curr_pos + pvt->taps] = tx;
/* Evaluate the echo - i.e. apply the FIR filter */
/* Assume the gain of the FIR does not exceed unity. Exceeding unity
would seem like a rather poor thing for an echo cancellor to do :)
This means we can compute the result with a total disregard for
overflows. 16bits x 16bits -> 31bits, so no overflow can occur in
any multiply. While accumulating we may overflow and underflow the
32 bit scale often. However, if the gain does not exceed unity,
everything should work itself out, and the final result will be
OK, without any saturation logic. */
/* Overflow is very much possible here, and we do nothing about it because
of the compute costs */
/* 16 bit coeffs for the LMS give lousy results (maths good, actual sound
bad!), but 32 bit coeffs require some shifting. On balance 32 bit seems
best */
#ifdef USE_SHORTS
echo_value = CONVOLVE2(pvt->fir_taps_short, pvt->tx_history + pvt->curr_pos, pvt->taps);
#else
echo_value = CONVOLVE(pvt->fir_taps, pvt->tx_history + pvt->curr_pos, pvt->taps);
#endif
echo_value >>= 16;
/* And the answer is..... */
clean_rx = rx - echo_value;
/* That was the easy part. Now we need to adapt! */
if (pvt->nonupdate_dwell > 0)
pvt->nonupdate_dwell--;
/* If there is very little being transmitted, any attempt to train is
futile. We would either be training on the far end's noise or signal,
the channel's own noise, or our noise. Either way, this is hardly good
training, so don't do it (avoid trouble). */
/* If the received power is very low, either we are sending very little or
we are already well adapted. There is little point in trying to improve
the adaption under these circumstanceson, so don't do it (reduce the
compute load). */
if (pvt->tx_power > MIN_TX_POWER_FOR_ADAPTION && pvt->rx_power > MIN_RX_POWER_FOR_ADAPTION) {
/* This is a really crude piece of decision logic, but it does OK
for now. */
if (pvt->tx_power > pvt->rx_power << 1) {
/* There is no far-end speech detected */
if (pvt->nonupdate_dwell == 0) {
/* ... and we are not in the dwell time from previous speech. */
/* nsuppr = saturate((clean_rx << 16)/pvt->tx_power); */
nsuppr = (clean_rx << 16) / pvt->tx_power;
nsuppr >>= 4;
if (nsuppr > 512)
nsuppr = 512;
if (nsuppr < -512)
nsuppr = -512;
/* Update the FIR taps */
pvt->latest_correction = 0;
#ifdef USE_SHORTS
UPDATE2(pvt->fir_taps, pvt->fir_taps_short, pvt->tx_history + pvt->curr_pos, nsuppr, pvt->taps);
#else
UPDATE(pvt->fir_taps, pvt->fir_taps_short, pvt->tx_history + pvt->curr_pos, nsuppr, pvt->taps);
#endif
} else {
pvt->latest_correction = -3;
}
} else {
pvt->nonupdate_dwell = NONUPDATE_DWELL_TIME;
pvt->latest_correction = -2;
}
} else {
pvt->nonupdate_dwell = 0;
pvt->latest_correction = -1;
}
/* Calculate short term power levels using very simple single pole IIRs */
/* TODO: Is the nasty modulus approach the fastest, or would a real
tx*tx power calculation actually be faster? */
pvt->tx_power += ((abs(tx) - pvt->tx_power) >> 5);
pvt->rx_power += ((abs(rx) - pvt->rx_power) >> 5);
pvt->clean_rx_power += ((abs(clean_rx) - pvt->clean_rx_power) >> 5);
#if defined(XYZZY)
if (pvt->use_suppressor) {
pvt->supp_test1 += (pvt->tx_history[pvt->curr_pos] - pvt->tx_history[(pvt->curr_pos - 7) & pvt->tap_mask]);
pvt->supp_test2 += (pvt->tx_history[(pvt->curr_pos - 24) & pvt->tap_mask] - pvt->tx_history[(pvt->curr_pos - 31) & pvt->tap_mask]);
if (pvt->supp_test1 > 42 && pvt->supp_test2 > 42)
supp_change = 25;
else
supp_change = 50;
supp = supp_change + k1*pvt->supp1 + k2*pvt->supp2;
pvt->supp2 = pvt->supp1;
pvt->supp1 = supp;
clean_rx *= (1 - supp);
}
#endif
if (pvt->use_nlp && pvt->rx_power < 32)
clean_rx = 0;
/* Roll around the rolling buffer */
pvt->curr_pos = (pvt->curr_pos - 1) & pvt->tap_mask;
return clean_rx;
}
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
u32 x;
short result;
for (x = 0; x < size; x++) {
result = sample_update(pvt, *iref, *isig);
*isig++ = result;
++iref;
}
}
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
/* Reset hang counter to avoid adjustments after
initial forced training */
pvt->nonupdate_dwell = pvt->taps << 1;
if (pos >= pvt->taps)
return 1;
pvt->fir_taps[pos] = val << 17;
pvt->fir_taps_short[pos] = val << 1;
if (++pos >= pvt->taps)
return 1;
else
return 0;
}
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
pvt->use_nlp = enable ? 1 : 0;
}
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
}
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
return 0;
}
static void __exit mod_exit(void)
{
dahdi_unregister_echocan_factory(&my_factory);
}
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_DESCRIPTION("DAHDI 'SEC' Echo Canceler");
MODULE_AUTHOR("Steve Underwood <steveu@coppice.org>");
MODULE_LICENSE("GPL");
module_init(mod_init);
module_exit(mod_exit);

View File

@ -0,0 +1,351 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* echo.c - An echo cancellor, suitable for electrical and acoustic
* cancellation. This code does not currently comply with
* any relevant standards (e.g. G.164/5/7/8). One day....
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 Steve Underwood
*
* Based on a bit from here, a bit from there, eye of toad,
* ear of bat, etc - plus, of course, my own 2 cents.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
/* TODO:
Finish the echo suppressor option, however nasty suppression may be
Add an option to reintroduce side tone at -24dB under appropriate conditions.
Improve double talk detector (iterative!)
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/moduleparam.h>
#include <dahdi/kernel.h>
static int debug;
#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
#define debug_printk(level, fmt, args...) if (debug >= level) printk(KERN_DEBUG "%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
#include "fir.h"
#ifndef NULL
#define NULL 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
/*
* According to Jim...
*/
#define MIN_TX_POWER_FOR_ADAPTION 512
#define MIN_RX_POWER_FOR_ADAPTION 64
/*
* According to Steve...
*/
/* #define MIN_TX_POWER_FOR_ADAPTION 4096
#define MIN_RX_POWER_FOR_ADAPTION 64 */
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
static const struct dahdi_echocan_factory my_factory = {
.name = "SEC2",
.owner = THIS_MODULE,
.echocan_create = echo_can_create,
};
static const struct dahdi_echocan_ops my_ops = {
.name = "SEC2",
.echocan_free = echo_can_free,
.echocan_process = echo_can_process,
.echocan_traintap = echo_can_traintap,
};
struct ec_pvt {
struct dahdi_echocan_state dahdi;
int tx_power;
int rx_power;
int clean_rx_power;
int rx_power_threshold;
int nonupdate_dwell;
fir16_state_t fir_state;
int16_t *fir_taps16; /* 16-bit version of FIR taps */
int32_t *fir_taps32; /* 32-bit version of FIR taps */
int curr_pos;
int taps;
int tap_mask;
int use_nlp;
int use_suppressor;
int32_t supp_test1;
int32_t supp_test2;
int32_t supp1;
int32_t supp2;
int32_t latest_correction; /* Indication of the magnitude of the latest
adaption, or a code to indicate why adaption
was skipped, for test purposes */
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct ec_pvt *pvt;
size_t size;
if (ecp->param_count > 0) {
printk(KERN_WARNING "SEC2 does not support parameters; failing request\n");
return -EINVAL;
}
size = sizeof(*pvt) + ecp->tap_length * sizeof(int32_t) + ecp->tap_length * 3 * sizeof(int16_t);
pvt = kzalloc(size, GFP_KERNEL);
if (!pvt)
return -ENOMEM;
pvt->dahdi.ops = &my_ops;
if (ecp->param_count > 0) {
printk(KERN_WARNING "SEC-2 echo canceler does not support parameters; failing request\n");
return -EINVAL;
}
pvt->taps = ecp->tap_length;
pvt->curr_pos = ecp->tap_length - 1;
pvt->tap_mask = ecp->tap_length - 1;
pvt->fir_taps32 = (int32_t *) (pvt + sizeof(*pvt));
pvt->fir_taps16 = (int16_t *) (pvt + sizeof(*pvt) + ecp->tap_length * sizeof(int32_t));
/* Create FIR filter */
fir16_create(&pvt->fir_state, pvt->fir_taps16, pvt->taps);
pvt->rx_power_threshold = 10000000;
pvt->use_suppressor = FALSE;
/* Non-linear processor - a fancy way to say "zap small signals, to avoid
accumulating noise". */
pvt->use_nlp = FALSE;
*ec = &pvt->dahdi;
return 0;
}
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
fir16_free(&pvt->fir_state);
kfree(pvt);
}
static inline int16_t sample_update(struct ec_pvt *pvt, int16_t tx, int16_t rx)
{
int offset1;
int offset2;
int32_t echo_value;
int clean_rx;
int nsuppr;
int i;
int correction;
/* Evaluate the echo - i.e. apply the FIR filter */
/* Assume the gain of the FIR does not exceed unity. Exceeding unity
would seem like a rather poor thing for an echo cancellor to do :)
This means we can compute the result with a total disregard for
overflows. 16bits x 16bits -> 31bits, so no overflow can occur in
any multiply. While accumulating we may overflow and underflow the
32 bit scale often. However, if the gain does not exceed unity,
everything should work itself out, and the final result will be
OK, without any saturation logic. */
/* Overflow is very much possible here, and we do nothing about it because
of the compute costs */
/* 16 bit coeffs for the LMS give lousy results (maths good, actual sound
bad!), but 32 bit coeffs require some shifting. On balance 32 bit seems
best */
echo_value = fir16 (&pvt->fir_state, tx);
/* And the answer is..... */
clean_rx = rx - echo_value;
/* That was the easy part. Now we need to adapt! */
if (pvt->nonupdate_dwell > 0)
pvt->nonupdate_dwell--;
/* If there is very little being transmitted, any attempt to train is
futile. We would either be training on the far end's noise or signal,
the channel's own noise, or our noise. Either way, this is hardly good
training, so don't do it (avoid trouble). */
/* If the received power is very low, either we are sending very little or
we are already well adapted. There is little point in trying to improve
the adaption under these circumstanceson, so don't do it (reduce the
compute load). */
if (pvt->tx_power > MIN_TX_POWER_FOR_ADAPTION && pvt->rx_power > MIN_RX_POWER_FOR_ADAPTION) {
/* This is a really crude piece of decision logic, but it does OK
for now. */
if (pvt->tx_power > 2*pvt->rx_power) {
/* There is no far-end speech detected */
if (pvt->nonupdate_dwell == 0) {
/* ... and we are not in the dwell time from previous speech. */
/* nsuppr = saturate((clean_rx << 16)/pvt->tx_power); */
nsuppr = clean_rx >> 3;
/* Update the FIR taps */
offset2 = pvt->curr_pos + 1;
offset1 = pvt->taps - offset2;
pvt->latest_correction = 0;
for (i = pvt->taps - 1; i >= offset1; i--) {
correction = pvt->fir_state.history[i - offset1]*nsuppr;
/* Leak to avoid false training on signals with multiple
strong correlations. */
pvt->fir_taps32[i] -= (pvt->fir_taps32[i] >> 12);
pvt->fir_taps32[i] += correction;
pvt->fir_state.coeffs[i] = pvt->fir_taps32[i] >> 15;
pvt->latest_correction += abs(correction);
}
for ( ; i >= 0; i--) {
correction = pvt->fir_state.history[i + offset2]*nsuppr;
/* Leak to avoid false training on signals with multiple
strong correlations. */
pvt->fir_taps32[i] -= (pvt->fir_taps32[i] >> 12);
pvt->fir_taps32[i] += correction;
pvt->fir_state.coeffs[i] = pvt->fir_taps32[i] >> 15;
pvt->latest_correction += abs(correction);
}
} else {
pvt->latest_correction = -1;
}
} else {
pvt->nonupdate_dwell = NONUPDATE_DWELL_TIME;
pvt->latest_correction = -2;
}
} else {
pvt->nonupdate_dwell = 0;
pvt->latest_correction = -3;
}
/* Calculate short term power levels using very simple single pole IIRs */
/* TODO: Is the nasty modulus approach the fastest, or would a real
tx*tx power calculation actually be faster? */
pvt->tx_power += ((abs(tx) - pvt->tx_power) >> 5);
pvt->rx_power += ((abs(rx) - pvt->rx_power) >> 5);
pvt->clean_rx_power += ((abs(clean_rx) - pvt->clean_rx_power) >> 5);
#if defined(XYZZY)
if (pvt->use_suppressor) {
pvt->supp_test1 += (pvt->fir_state.history[pvt->curr_pos] - pvt->fir_state.history[(pvt->curr_pos - 7) & pvt->tap_mask]);
pvt->supp_test2 += (pvt->fir_state.history[(pvt->curr_pos - 24) & pvt->tap_mask] - pvt->fir_state.history[(pvt->curr_pos - 31) & pvt->tap_mask]);
if (pvt->supp_test1 > 42 && pvt->supp_test2 > 42)
supp_change = 25;
else
supp_change = 50;
supp = supp_change + k1*pvt->supp1 + k2*pvt->supp2;
pvt->supp2 = pvt->supp1;
pvt->supp1 = supp;
clean_rx *= (1 - supp);
}
#endif
if (pvt->use_nlp && pvt->rx_power < 32)
clean_rx = 0;
/* Roll around the rolling buffer */
if (pvt->curr_pos <= 0)
pvt->curr_pos = pvt->taps;
pvt->curr_pos--;
return clean_rx;
}
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
u32 x;
short result;
for (x = 0; x < size; x++) {
result = sample_update(pvt, *iref, *isig);
*isig++ = result;
++iref;
}
}
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
/* Reset hang counter to avoid adjustments after
initial forced training */
pvt->nonupdate_dwell = pvt->taps << 1;
if (pos >= pvt->taps)
return 1;
pvt->fir_taps32[pos] = val << 17;
pvt->fir_taps16[pos] = val << 1;
if (++pos >= pvt->taps)
return 1;
else
return 0;
}
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
}
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
return 0;
}
static void __exit mod_exit(void)
{
dahdi_unregister_echocan_factory(&my_factory);
}
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_DESCRIPTION("DAHDI 'SEC2' Echo Canceler");
MODULE_AUTHOR("Steve Underwood <steveu@coppice.org>");
MODULE_LICENSE("GPL");
module_init(mod_init);
module_exit(mod_exit);

View File

@ -0,0 +1,486 @@
/*
* Transcoder Interface for DAHDI
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2006-2008, Digium, Inc.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/page-flags.h>
#include <asm/io.h>
#include <dahdi/kernel.h>
static int debug;
/* The registration list contains transcoders in the order in which they were
* registered. */
static LIST_HEAD(registration_list);
/* The active list is sorted by the most recently used transcoder is last. This
* is used as a simplistic way to spread the load amongst the different hardware
* transcoders in the system. */
static LIST_HEAD(active_list);
static spinlock_t translock = SPIN_LOCK_UNLOCKED;
EXPORT_SYMBOL(dahdi_transcoder_register);
EXPORT_SYMBOL(dahdi_transcoder_unregister);
EXPORT_SYMBOL(dahdi_transcoder_alert);
EXPORT_SYMBOL(dahdi_transcoder_alloc);
EXPORT_SYMBOL(dahdi_transcoder_free);
struct dahdi_transcoder *dahdi_transcoder_alloc(int numchans)
{
struct dahdi_transcoder *tc;
unsigned int x;
size_t size = sizeof(*tc) + (sizeof(tc->channels[0]) * numchans);
if (!(tc = kmalloc(size, GFP_KERNEL)))
return NULL;
memset(tc, 0, size);
strcpy(tc->name, "<unspecified>");
INIT_LIST_HEAD(&tc->registration_list_node);
INIT_LIST_HEAD(&tc->active_list_node);
tc->numchannels = numchans;
for (x=0; x < tc->numchannels; x++) {
init_waitqueue_head(&tc->channels[x].ready);
tc->channels[x].parent = tc;
}
WARN_ON(!dahdi_transcode_fops);
/* Individual transcoders should supply their own file_operations for
* write and read. But they will by default use the file_operations
* provided by the dahdi_transcode layer. */
memcpy(&tc->fops, dahdi_transcode_fops, sizeof(*dahdi_transcode_fops));
return tc;
}
void dahdi_transcoder_free(struct dahdi_transcoder *tc)
{
kfree(tc);
}
/* Returns 1 if the item is on the list pointed to by head, otherwise, returns
* 0 */
static int is_on_list(struct list_head *entry, struct list_head *head)
{
struct list_head *cur;
list_for_each(cur, head) {
if (cur == entry) return 1;
}
return 0;
}
/* Register a transcoder */
int dahdi_transcoder_register(struct dahdi_transcoder *tc)
{
spin_lock(&translock);
BUG_ON(is_on_list(&tc->registration_list_node, &registration_list));
list_add_tail(&tc->registration_list_node, &registration_list);
list_add_tail(&tc->active_list_node, &active_list);
spin_unlock(&translock);
printk(KERN_INFO "%s: Registered codec translator '%s' " \
"with %d transcoders (srcs=%08x, dsts=%08x)\n",
THIS_MODULE->name, tc->name, tc->numchannels,
tc->srcfmts, tc->dstfmts);
return 0;
}
/* Unregister a transcoder */
int dahdi_transcoder_unregister(struct dahdi_transcoder *tc)
{
int res = -EINVAL;
/* \todo Perhaps we should check to make sure there isn't a channel
* that is still in use? */
spin_lock(&translock);
if (!is_on_list(&tc->registration_list_node, &registration_list)) {
spin_unlock(&translock);
printk(KERN_WARNING "%s: Failed to unregister %s, which is " \
"not currently registered.\n", THIS_MODULE->name, tc->name);
return -EINVAL;
}
list_del_init(&tc->registration_list_node);
list_del_init(&tc->active_list_node);
spin_unlock(&translock);
printk(KERN_INFO "Unregistered codec translator '%s' with %d " \
"transcoders (srcs=%08x, dsts=%08x)\n",
tc->name, tc->numchannels, tc->srcfmts, tc->dstfmts);
res = 0;
return res;
}
/* Alert a transcoder */
int dahdi_transcoder_alert(struct dahdi_transcoder_channel *chan)
{
wake_up_interruptible(&chan->ready);
return 0;
}
static int dahdi_tc_open(struct inode *inode, struct file *file)
{
const struct file_operations *original_fops;
BUG_ON(!dahdi_transcode_fops);
original_fops = file->f_op;
file->f_op = dahdi_transcode_fops;
file->private_data = NULL;
/* Under normal operation, this releases the reference on the DAHDI
* module that was created when the file was opened. dahdi_open is
* responsible for taking a reference out on this module before
* calling this function. */
module_put(original_fops->owner);
return 0;
}
static void dtc_release(struct dahdi_transcoder_channel *chan)
{
BUG_ON(!chan);
if (chan->parent && chan->parent->release) {
chan->parent->release(chan);
}
dahdi_tc_clear_busy(chan);
}
static int dahdi_tc_release(struct inode *inode, struct file *file)
{
struct dahdi_transcoder_channel *chan = file->private_data;
/* There will not be a transcoder channel associated with this file if
* the ALLOCATE ioctl never succeeded.
*/
if (chan) {
dtc_release(chan);
}
return 0;
}
/* Find a free channel on the transcoder and mark it busy. */
static inline struct dahdi_transcoder_channel *
get_free_channel(struct dahdi_transcoder *tc,
const struct dahdi_transcoder_formats *fmts)
{
struct dahdi_transcoder_channel *chan;
int i;
/* Should be called with the translock held. */
#ifdef CONFIG_SMP
WARN_ON(!spin_is_locked(&translock));
#endif
for (i = 0; i < tc->numchannels; i++) {
chan = &tc->channels[i];
if (!dahdi_tc_is_busy(chan)) {
if (!dahdi_tc_is_built(chan)) {
dahdi_tc_set_busy(chan);
return chan;
} else {
/* If the channel is already built, we must
* make sure that it can support the formats
* that we're interested in. */
if ((fmts->srcfmt|fmts->dstfmt) == chan->built_fmts) {
dahdi_tc_set_busy(chan);
return chan;
}
}
}
}
return NULL;
}
/* Search the list for a transcoder that supports the specified format, and
* allocate and return an available channel on it.
*
* Returns either a pointer to the allocated channel, -EBUSY if the format is
* supported but all the channels are busy, or -ENODEV if there are not any
* transcoders that support the formats.
*/
static struct dahdi_transcoder_channel *
__find_free_channel(struct list_head *list, const struct dahdi_transcoder_formats *fmts)
{
struct dahdi_transcoder *tc;
struct dahdi_transcoder_channel *chan = NULL;
unsigned int match = 0;
list_for_each_entry(tc, list, active_list_node) {
if ((tc->dstfmts & fmts->dstfmt) && (tc->srcfmts & fmts->srcfmt)) {
/* We found a transcoder that can handle our formats.
* Now look for an available channel. */
match = 1;
if ((chan = get_free_channel(tc, fmts))) {
/* transcoder tc has a free channel. In order
* to spread the load among available
* transcoders (when there are more than one
* transcoder in the system) we'll move tc
* to the end of the list. */
list_move_tail(&tc->active_list_node, list);
return chan;
}
}
}
return (void*)((long)((match) ? -EBUSY : -ENODEV));
}
static long dahdi_tc_allocate(struct file *file, unsigned long data)
{
struct dahdi_transcoder_channel *chan = NULL;
struct dahdi_transcoder_formats fmts;
if (copy_from_user(&fmts, (__user const void *) data, sizeof(fmts))) {
return -EFAULT;
}
spin_lock(&translock);
chan = __find_free_channel(&active_list, &fmts);
spin_unlock(&translock);
if (IS_ERR(chan)) {
return PTR_ERR(chan);
}
/* Every transcoder channel must be associated with a parent
* transcoder. */
BUG_ON(!chan->parent);
chan->srcfmt = fmts.srcfmt;
chan->dstfmt = fmts.dstfmt;
if (file->private_data) {
/* This open file is moving to a new channel. Cleanup and
* close the old channel here. */
dtc_release(file->private_data);
}
file->private_data = chan;
if (chan->parent->fops.owner != file->f_op->owner) {
if (!try_module_get(chan->parent->fops.owner)) {
/* Failed to get a reference on the driver for the
* actual transcoding hardware. */
return -EINVAL;
}
/* Release the reference on the existing driver. */
module_put(file->f_op->owner);
file->f_op = &chan->parent->fops;
}
if (file->f_flags & O_NONBLOCK) {
dahdi_tc_set_nonblock(chan);
} else {
dahdi_tc_clear_nonblock(chan);
}
/* Actually reset the transcoder channel */
if (chan->parent->allocate)
return chan->parent->allocate(chan);
return -EINVAL;
}
static long dahdi_tc_getinfo(unsigned long data)
{
struct dahdi_transcoder_info info;
struct dahdi_transcoder *cur;
struct dahdi_transcoder *tc = NULL;
unsigned int count = 0;
if (copy_from_user(&info, (__user const void *) data, sizeof(info))) {
return -EFAULT;
}
spin_lock(&translock);
list_for_each_entry(cur, &registration_list, registration_list_node) {
if (info.tcnum == count++) {
tc = cur;
break;
}
}
spin_unlock(&translock);
if (!tc) {
return -ENOSYS;
}
dahdi_copy_string(info.name, tc->name, sizeof(info.name));
info.numchannels = tc->numchannels;
info.srcfmts = tc->srcfmts;
info.dstfmts = tc->dstfmts;
return copy_to_user((__user void *) data, &info, sizeof(info)) ? -EFAULT : 0;
}
static ssize_t dahdi_tc_write(struct file *file, __user const char *usrbuf, size_t count, loff_t *ppos)
{
if (file->private_data) {
/* file->private_data will not be NULL if DAHDI_TC_ALLOCATE was
* called, and therefore indicates that the transcoder driver
* did not export a read function. */
WARN_ON(1);
return -ENOSYS;
} else {
printk(KERN_INFO "%s: Attempt to write to unallocated " \
"channel.\n", THIS_MODULE->name);
return -EINVAL;
}
}
static ssize_t dahdi_tc_read(struct file *file, __user char *usrbuf, size_t count, loff_t *ppos)
{
if (file->private_data) {
/* file->private_data will not be NULL if DAHDI_TC_ALLOCATE was
* called, and therefore indicates that the transcoder driver
* did not export a write function. */
WARN_ON(1);
return -ENOSYS;
} else {
printk(KERN_INFO "%s: Attempt to read from unallocated " \
"channel.\n", THIS_MODULE->name);
return -EINVAL;
}
}
static long dahdi_tc_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
{
switch (cmd) {
case DAHDI_TC_ALLOCATE:
return dahdi_tc_allocate(file, data);
case DAHDI_TC_GETINFO:
return dahdi_tc_getinfo(data);
case DAHDI_TRANSCODE_OP:
/* This is a deprecated call from the previous transcoder
* interface, which was all routed through the dahdi_ioctl in
* dahdi-base.c, and this ioctl request was used to indicate
* that the call should be forwarded to this function. Now
* when the file is opened, the f_ops pointer is updated to
* point directly to this function, and we don't need a
* general indication that the ioctl is destined for the
* transcoder.
*
* I'm keeping this ioctl here in order to explain why there
* might be a hole in the ioctl numbering scheme in the header
* files.
*/
printk(KERN_WARNING "%s: DAHDI_TRANSCODE_OP is no longer " \
"supported. Please call DAHDI_TC ioctls directly.\n",
THIS_MODULE->name);
return -EINVAL;
default:
return -EINVAL;
};
}
#ifndef HAVE_UNLOCKED_IOCTL
static int dahdi_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
{
return (int)dahdi_tc_unlocked_ioctl(file, cmd, data);
}
#endif
static int dahdi_tc_mmap(struct file *file, struct vm_area_struct *vma)
{
printk(KERN_ERR "%s: mmap interface deprecated.\n", THIS_MODULE->name);
return -ENOSYS;
}
static unsigned int dahdi_tc_poll(struct file *file, struct poll_table_struct *wait_table)
{
int ret;
struct dahdi_transcoder_channel *chan = file->private_data;
if (!chan) {
/* This is because the DAHDI_TC_ALLOCATE ioctl was not called
* before calling poll, which is invalid. */
return -EINVAL;
}
poll_wait(file, &chan->ready, wait_table);
ret = dahdi_tc_is_busy(chan) ? 0 : POLLPRI;
ret |= dahdi_tc_is_built(chan) ? POLLOUT : 0;
ret |= dahdi_tc_is_data_waiting(chan) ? POLLIN : 0;
return ret;
}
static struct file_operations __dahdi_transcode_fops = {
.owner = THIS_MODULE,
.open = dahdi_tc_open,
.release = dahdi_tc_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_tc_unlocked_ioctl,
#else
.ioctl = dahdi_tc_ioctl,
#endif
.read = dahdi_tc_read,
.write = dahdi_tc_write,
.poll = dahdi_tc_poll,
.mmap = dahdi_tc_mmap,
};
static struct dahdi_chardev transcode_chardev = {
.name = "transcode",
.minor = 250,
};
static int dahdi_transcode_init(void)
{
int res;
if (dahdi_transcode_fops) {
printk(KERN_WARNING "dahdi_transcode_fops already set.\n");
return -EBUSY;
}
dahdi_transcode_fops = &__dahdi_transcode_fops;
if ((res = dahdi_register_chardev(&transcode_chardev)))
return res;
printk(KERN_INFO "%s: Loaded.\n", THIS_MODULE->name);
return 0;
}
static void dahdi_transcode_cleanup(void)
{
dahdi_unregister_chardev(&transcode_chardev);
dahdi_transcode_fops = NULL;
printk(KERN_DEBUG "%s: Unloaded.\n", THIS_MODULE->name);
}
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_DESCRIPTION("DAHDI Transcoder Support");
MODULE_AUTHOR("Mark Spencer <markster@digium.com>");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
module_init(dahdi_transcode_init);
module_exit(dahdi_transcode_cleanup);

View File

@ -0,0 +1,32 @@
.EXPORT_ALL_VARIABLES:
MODULES= \
hdlc_cisco hdlc_generic hdlc_raw syncppp \
hdlc_fr hdlc_ppp hdlc_raw_eth
PWD=$(shell pwd)
MODULESO:=$(MODULES:%=%.o)
MODULESKO:=$(MODULES:%=%.ko)
KMAKE = $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)
KMAKE_INST = $(KMAKE) \
INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install
obj-m := $(MODULESO)
#obj-m:=hdlc_raw.o hdlc_cisco.o
#obj-m := hdlc_cisco.o hdlc_cisco.mod.o hdlc_fr.o hdlc_generic.o hdlc_ppp.o hdlc_raw.o hdlc_raw_eth.o hdlc_raw.mod.o hdlc_x25.o
all:
@echo "You don't want to do make here. Do it from up above"
clean:
$(KMAKE) clean
install: $(MODULESKO)
$(KMAKE_INST)
datamods:
@echo "To build: $(obj-m)"
@echo $(KSRC)
@if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi
$(KMAKE) modules

View File

@ -0,0 +1,335 @@
/*
* Generic HDLC support routines for Linux
* Cisco HDLC support
*
* Copyright (C) 2000 - 2003 Krzysztof Halasa <khc@pm.waw.pl>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/pkt_sched.h>
#include <linux/inetdevice.h>
#include <linux/lapb.h>
#include <linux/rtnetlink.h>
#include <linux/hdlc.h>
#undef DEBUG_HARD_HEADER
#define CISCO_MULTICAST 0x8F /* Cisco multicast address */
#define CISCO_UNICAST 0x0F /* Cisco unicast address */
#define CISCO_KEEPALIVE 0x8035 /* Cisco keepalive protocol */
#define CISCO_SYS_INFO 0x2000 /* Cisco interface/system info */
#define CISCO_ADDR_REQ 0 /* Cisco address request */
#define CISCO_ADDR_REPLY 1 /* Cisco address reply */
#define CISCO_KEEPALIVE_REQ 2 /* Cisco keepalive request */
static int cisco_hard_header(struct sk_buff *skb, struct net_device *dev,
u16 type, void *daddr, void *saddr,
unsigned int len)
{
hdlc_header *data;
#ifdef DEBUG_HARD_HEADER
printk(KERN_DEBUG "%s: cisco_hard_header called\n", dev->name);
#endif
skb_push(skb, sizeof(hdlc_header));
data = (hdlc_header*)skb->data;
if (type == CISCO_KEEPALIVE)
data->address = CISCO_MULTICAST;
else
data->address = CISCO_UNICAST;
data->control = 0;
data->protocol = htons(type);
return sizeof(hdlc_header);
}
static void cisco_keepalive_send(struct net_device *dev, u32 type,
u32 par1, u32 par2)
{
struct sk_buff *skb;
cisco_packet *data;
skb = dev_alloc_skb(sizeof(hdlc_header) + sizeof(cisco_packet));
if (!skb) {
printk(KERN_WARNING
"%s: Memory squeeze on cisco_keepalive_send()\n",
dev->name);
return;
}
skb_reserve(skb, 4);
cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0);
data = (cisco_packet*)(skb->data + 4);
data->type = htonl(type);
data->par1 = htonl(par1);
data->par2 = htonl(par2);
data->rel = 0xFFFF;
/* we will need do_div here if 1000 % HZ != 0 */
data->time = htonl((jiffies - INITIAL_JIFFIES) * (1000 / HZ));
skb_put(skb, sizeof(cisco_packet));
skb->priority = TC_PRIO_CONTROL;
skb->dev = dev;
skb->nh.raw = skb->data;
dev_queue_xmit(skb);
}
static __be16 cisco_type_trans(struct sk_buff *skb, struct net_device *dev)
{
hdlc_header *data = (hdlc_header*)skb->data;
if (skb->len < sizeof(hdlc_header))
return __constant_htons(ETH_P_HDLC);
if (data->address != CISCO_MULTICAST &&
data->address != CISCO_UNICAST)
return __constant_htons(ETH_P_HDLC);
switch(data->protocol) {
case __constant_htons(ETH_P_IP):
case __constant_htons(ETH_P_IPX):
case __constant_htons(ETH_P_IPV6):
skb_pull(skb, sizeof(hdlc_header));
return data->protocol;
default:
return __constant_htons(ETH_P_HDLC);
}
}
static int cisco_rx(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
hdlc_device *hdlc = dev_to_hdlc(dev);
hdlc_header *data = (hdlc_header*)skb->data;
cisco_packet *cisco_data;
struct in_device *in_dev;
u32 addr, mask;
if (skb->len < sizeof(hdlc_header))
goto rx_error;
if (data->address != CISCO_MULTICAST &&
data->address != CISCO_UNICAST)
goto rx_error;
switch(ntohs(data->protocol)) {
case CISCO_SYS_INFO:
/* Packet is not needed, drop it. */
dev_kfree_skb_any(skb);
return NET_RX_SUCCESS;
case CISCO_KEEPALIVE:
if (skb->len != sizeof(hdlc_header) + CISCO_PACKET_LEN &&
skb->len != sizeof(hdlc_header) + CISCO_BIG_PACKET_LEN) {
printk(KERN_INFO "%s: Invalid length of Cisco "
"control packet (%d bytes)\n",
dev->name, skb->len);
goto rx_error;
}
cisco_data = (cisco_packet*)(skb->data + sizeof(hdlc_header));
switch(ntohl (cisco_data->type)) {
case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */
in_dev = dev->ip_ptr;
addr = 0;
mask = ~0; /* is the mask correct? */
if (in_dev != NULL) {
struct in_ifaddr **ifap = &in_dev->ifa_list;
while (*ifap != NULL) {
if (strcmp(dev->name,
(*ifap)->ifa_label) == 0) {
addr = (*ifap)->ifa_local;
mask = (*ifap)->ifa_mask;
break;
}
ifap = &(*ifap)->ifa_next;
}
cisco_keepalive_send(dev, CISCO_ADDR_REPLY,
addr, mask);
}
dev_kfree_skb_any(skb);
return NET_RX_SUCCESS;
case CISCO_ADDR_REPLY:
printk(KERN_INFO "%s: Unexpected Cisco IP address "
"reply\n", dev->name);
goto rx_error;
case CISCO_KEEPALIVE_REQ:
hdlc->state.cisco.rxseq = ntohl(cisco_data->par1);
if (hdlc->state.cisco.request_sent &&
ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) {
hdlc->state.cisco.last_poll = jiffies;
if (!hdlc->state.cisco.up) {
u32 sec, min, hrs, days;
sec = ntohl(cisco_data->time) / 1000;
min = sec / 60; sec -= min * 60;
hrs = min / 60; min -= hrs * 60;
days = hrs / 24; hrs -= days * 24;
printk(KERN_INFO "%s: Link up (peer "
"uptime %ud%uh%um%us)\n",
dev->name, days, hrs,
min, sec);
#if 0
netif_carrier_on(dev);
#endif
hdlc->state.cisco.up = 1;
}
}
dev_kfree_skb_any(skb);
return NET_RX_SUCCESS;
} /* switch(keepalive type) */
} /* switch(protocol) */
printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name,
data->protocol);
dev_kfree_skb_any(skb);
return NET_RX_DROP;
rx_error:
hdlc->stats.rx_errors++; /* Mark error */
dev_kfree_skb_any(skb);
return NET_RX_DROP;
}
static void cisco_timer(unsigned long arg)
{
struct net_device *dev = (struct net_device *)arg;
hdlc_device *hdlc = dev_to_hdlc(dev);
if (hdlc->state.cisco.up &&
time_after(jiffies, hdlc->state.cisco.last_poll +
hdlc->state.cisco.settings.timeout * HZ)) {
hdlc->state.cisco.up = 0;
printk(KERN_INFO "%s: Link down\n", dev->name);
#if 0
netif_carrier_off(dev);
#endif
}
cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ,
++hdlc->state.cisco.txseq,
hdlc->state.cisco.rxseq);
hdlc->state.cisco.request_sent = 1;
hdlc->state.cisco.timer.expires = jiffies +
hdlc->state.cisco.settings.interval * HZ;
hdlc->state.cisco.timer.function = cisco_timer;
hdlc->state.cisco.timer.data = arg;
add_timer(&hdlc->state.cisco.timer);
}
static void cisco_start(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
hdlc->state.cisco.up = 0;
hdlc->state.cisco.request_sent = 0;
hdlc->state.cisco.txseq = hdlc->state.cisco.rxseq = 0;
init_timer(&hdlc->state.cisco.timer);
hdlc->state.cisco.timer.expires = jiffies + HZ; /*First poll after 1s*/
hdlc->state.cisco.timer.function = cisco_timer;
hdlc->state.cisco.timer.data = (unsigned long)dev;
add_timer(&hdlc->state.cisco.timer);
}
static void cisco_stop(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
del_timer_sync(&hdlc->state.cisco.timer);
#if 0
if (netif_carrier_ok(dev))
netif_carrier_off(dev);
#endif
hdlc->state.cisco.up = 0;
hdlc->state.cisco.request_sent = 0;
}
int hdlc_cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
{
cisco_proto __user *cisco_s = ifr->ifr_settings.ifs_ifsu.cisco;
const size_t size = sizeof(cisco_proto);
cisco_proto new_settings;
hdlc_device *hdlc = dev_to_hdlc(dev);
int result;
switch (ifr->ifr_settings.type) {
case IF_GET_PROTO:
ifr->ifr_settings.type = IF_PROTO_CISCO;
if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(cisco_s, &hdlc->state.cisco.settings, size))
return -EFAULT;
return 0;
case IF_PROTO_CISCO:
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(dev->flags & IFF_UP)
return -EBUSY;
if (copy_from_user(&new_settings, cisco_s, size))
return -EFAULT;
if (new_settings.interval < 1 ||
new_settings.timeout < 2)
return -EINVAL;
result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
if (result)
return result;
hdlc_proto_detach(hdlc);
memcpy(&hdlc->state.cisco.settings, &new_settings, size);
memset(&hdlc->proto, 0, sizeof(hdlc->proto));
hdlc->proto.start = cisco_start;
hdlc->proto.stop = cisco_stop;
hdlc->proto.netif_rx = cisco_rx;
hdlc->proto.type_trans = cisco_type_trans;
hdlc->proto.id = IF_PROTO_CISCO;
dev->hard_start_xmit = hdlc->xmit;
dev->hard_header = cisco_hard_header;
dev->hard_header_cache = NULL;
dev->type = ARPHRD_CISCO;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->addr_len = 0;
return 0;
}
return -EINVAL;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,355 @@
/*
* Generic HDLC support routines for Linux
*
* Copyright (C) 1999 - 2005 Krzysztof Halasa <khc@pm.waw.pl>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
* Currently supported:
* * raw IP-in-HDLC
* * Cisco HDLC
* * Frame Relay with ANSI or CCITT LMI (both user and network side)
* * PPP
* * X.25
*
* Use sethdlc utility to set line parameters, protocol and PVCs
*
* How does it work:
* - proto.open(), close(), start(), stop() calls are serialized.
* The order is: open, [ start, stop ... ] close ...
* - proto.start() and stop() are called with spin_lock_irq held.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/pkt_sched.h>
#include <linux/inetdevice.h>
#include <linux/lapb.h>
#include <linux/rtnetlink.h>
#include <linux/hdlc.h>
static const char* version = "HDLC support module revision 1.18";
#undef DEBUG_LINK
static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
{
if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
return -EINVAL;
dev->mtu = new_mtu;
return 0;
}
static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
{
return hdlc_stats(dev);
}
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *p, struct net_device *orig_dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
if (hdlc->proto.netif_rx)
return hdlc->proto.netif_rx(skb);
hdlc->stats.rx_dropped++; /* Shouldn't happen */
dev_kfree_skb(skb);
return NET_RX_DROP;
}
static void __hdlc_set_carrier_on(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
if (hdlc->proto.start)
return hdlc->proto.start(dev);
#if 0
#ifdef DEBUG_LINK
if (netif_carrier_ok(dev))
printk(KERN_ERR "hdlc_set_carrier_on(): already on\n");
#endif
netif_carrier_on(dev);
#endif
}
static void __hdlc_set_carrier_off(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
if (hdlc->proto.stop)
return hdlc->proto.stop(dev);
#if 0
#ifdef DEBUG_LINK
if (!netif_carrier_ok(dev))
printk(KERN_ERR "hdlc_set_carrier_off(): already off\n");
#endif
netif_carrier_off(dev);
#endif
}
void hdlc_set_carrier(int on, struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
unsigned long flags;
on = on ? 1 : 0;
#ifdef DEBUG_LINK
printk(KERN_DEBUG "hdlc_set_carrier %i\n", on);
#endif
spin_lock_irqsave(&hdlc->state_lock, flags);
if (hdlc->carrier == on)
goto carrier_exit; /* no change in DCD line level */
#ifdef DEBUG_LINK
printk(KERN_INFO "%s: carrier %s\n", dev->name, on ? "ON" : "off");
#endif
hdlc->carrier = on;
if (!hdlc->open)
goto carrier_exit;
if (hdlc->carrier) {
printk(KERN_INFO "%s: Carrier detected\n", dev->name);
__hdlc_set_carrier_on(dev);
} else {
printk(KERN_INFO "%s: Carrier lost\n", dev->name);
__hdlc_set_carrier_off(dev);
}
carrier_exit:
spin_unlock_irqrestore(&hdlc->state_lock, flags);
}
/* Must be called by hardware driver when HDLC device is being opened */
int hdlc_open(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
#ifdef DEBUG_LINK
printk(KERN_DEBUG "hdlc_open() carrier %i open %i\n",
hdlc->carrier, hdlc->open);
#endif
if (hdlc->proto.id == -1)
return -ENOSYS; /* no protocol attached */
if (hdlc->proto.open) {
int result = hdlc->proto.open(dev);
if (result)
return result;
}
spin_lock_irq(&hdlc->state_lock);
if (hdlc->carrier) {
printk(KERN_INFO "%s: Carrier detected\n", dev->name);
__hdlc_set_carrier_on(dev);
} else
printk(KERN_INFO "%s: No carrier\n", dev->name);
hdlc->open = 1;
spin_unlock_irq(&hdlc->state_lock);
return 0;
}
/* Must be called by hardware driver when HDLC device is being closed */
void hdlc_close(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
#ifdef DEBUG_LINK
printk(KERN_DEBUG "hdlc_close() carrier %i open %i\n",
hdlc->carrier, hdlc->open);
#endif
spin_lock_irq(&hdlc->state_lock);
hdlc->open = 0;
if (hdlc->carrier)
__hdlc_set_carrier_off(dev);
spin_unlock_irq(&hdlc->state_lock);
if (hdlc->proto.close)
hdlc->proto.close(dev);
}
#ifndef CONFIG_HDLC_RAW
#define hdlc_raw_ioctl(dev, ifr) -ENOSYS
#endif
#ifndef CONFIG_HDLC_RAW_ETH
#define hdlc_raw_eth_ioctl(dev, ifr) -ENOSYS
#endif
#ifndef CONFIG_HDLC_PPP
#define hdlc_ppp_ioctl(dev, ifr) -ENOSYS
#endif
#ifndef CONFIG_HDLC_CISCO
#define hdlc_cisco_ioctl(dev, ifr) -ENOSYS
#endif
#ifndef CONFIG_HDLC_FR
#define hdlc_fr_ioctl(dev, ifr) -ENOSYS
#endif
#ifndef CONFIG_HDLC_X25
#define hdlc_x25_ioctl(dev, ifr) -ENOSYS
#endif
int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
unsigned int proto;
if (cmd != SIOCWANDEV)
return -EINVAL;
switch(ifr->ifr_settings.type) {
case IF_PROTO_HDLC:
case IF_PROTO_HDLC_ETH:
case IF_PROTO_PPP:
case IF_PROTO_CISCO:
case IF_PROTO_FR:
case IF_PROTO_X25:
proto = ifr->ifr_settings.type;
break;
default:
proto = hdlc->proto.id;
}
switch(proto) {
case IF_PROTO_HDLC: return hdlc_raw_ioctl(dev, ifr);
case IF_PROTO_HDLC_ETH: return hdlc_raw_eth_ioctl(dev, ifr);
case IF_PROTO_PPP: return hdlc_ppp_ioctl(dev, ifr);
case IF_PROTO_CISCO: return hdlc_cisco_ioctl(dev, ifr);
case IF_PROTO_FR: return hdlc_fr_ioctl(dev, ifr);
case IF_PROTO_X25: return hdlc_x25_ioctl(dev, ifr);
default: return -EINVAL;
}
}
static void hdlc_setup(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
dev->get_stats = hdlc_get_stats;
dev->change_mtu = hdlc_change_mtu;
dev->mtu = HDLC_MAX_MTU;
dev->type = ARPHRD_RAWHDLC;
dev->hard_header_len = 16;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
hdlc->proto.id = -1;
hdlc->proto.detach = NULL;
hdlc->carrier = 1;
hdlc->open = 0;
spin_lock_init(&hdlc->state_lock);
}
struct net_device *alloc_hdlcdev(void *priv)
{
struct net_device *dev;
dev = alloc_netdev(sizeof(hdlc_device), "hdlc%d", hdlc_setup);
if (dev)
dev_to_hdlc(dev)->priv = priv;
return dev;
}
int register_hdlc_device(struct net_device *dev)
{
int result = dev_alloc_name(dev, "hdlc%d");
if (result < 0)
return result;
result = register_netdev(dev);
if (result != 0)
return -EIO;
#if 0
if (netif_carrier_ok(dev))
netif_carrier_off(dev); /* no carrier until DCD goes up */
#endif
return 0;
}
void unregister_hdlc_device(struct net_device *dev)
{
rtnl_lock();
hdlc_proto_detach(dev_to_hdlc(dev));
unregister_netdevice(dev);
rtnl_unlock();
}
MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
MODULE_DESCRIPTION("HDLC support module");
MODULE_LICENSE("GPL v2");
EXPORT_SYMBOL(hdlc_open);
EXPORT_SYMBOL(hdlc_close);
EXPORT_SYMBOL(hdlc_set_carrier);
EXPORT_SYMBOL(hdlc_ioctl);
EXPORT_SYMBOL(alloc_hdlcdev);
EXPORT_SYMBOL(register_hdlc_device);
EXPORT_SYMBOL(unregister_hdlc_device);
static struct packet_type hdlc_packet_type = {
.type = __constant_htons(ETH_P_HDLC),
.func = hdlc_rcv,
};
static int __init hdlc_module_init(void)
{
printk(KERN_INFO "%s\n", version);
dev_add_pack(&hdlc_packet_type);
return 0;
}
static void __exit hdlc_module_exit(void)
{
dev_remove_pack(&hdlc_packet_type);
}
module_init(hdlc_module_init);
module_exit(hdlc_module_exit);

View File

@ -0,0 +1,114 @@
/*
* Generic HDLC support routines for Linux
* Point-to-point protocol support
*
* Copyright (C) 1999 - 2003 Krzysztof Halasa <khc@pm.waw.pl>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/pkt_sched.h>
#include <linux/inetdevice.h>
#include <linux/lapb.h>
#include <linux/rtnetlink.h>
#include <linux/hdlc.h>
static int ppp_open(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
void *old_ioctl;
int result;
dev->priv = &hdlc->state.ppp.syncppp_ptr;
hdlc->state.ppp.syncppp_ptr = &hdlc->state.ppp.pppdev;
hdlc->state.ppp.pppdev.dev = dev;
old_ioctl = dev->do_ioctl;
hdlc->state.ppp.old_change_mtu = dev->change_mtu;
sppp_attach(&hdlc->state.ppp.pppdev);
/* sppp_attach nukes them. We don't need syncppp's ioctl */
dev->do_ioctl = old_ioctl;
hdlc->state.ppp.pppdev.sppp.pp_flags &= ~PP_CISCO;
dev->type = ARPHRD_PPP;
result = sppp_open(dev);
if (result) {
sppp_detach(dev);
return result;
}
return 0;
}
static void ppp_close(struct net_device *dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
sppp_close(dev);
sppp_detach(dev);
dev->rebuild_header = NULL;
dev->change_mtu = hdlc->state.ppp.old_change_mtu;
dev->mtu = HDLC_MAX_MTU;
dev->hard_header_len = 16;
}
static __be16 ppp_type_trans(struct sk_buff *skb, struct net_device *dev)
{
return __constant_htons(ETH_P_WAN_PPP);
}
int hdlc_ppp_ioctl(struct net_device *dev, struct ifreq *ifr)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
int result;
switch (ifr->ifr_settings.type) {
case IF_GET_PROTO:
ifr->ifr_settings.type = IF_PROTO_PPP;
return 0; /* return protocol only, no settable parameters */
case IF_PROTO_PPP:
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(dev->flags & IFF_UP)
return -EBUSY;
/* no settable parameters */
result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
if (result)
return result;
hdlc_proto_detach(hdlc);
memset(&hdlc->proto, 0, sizeof(hdlc->proto));
hdlc->proto.open = ppp_open;
hdlc->proto.close = ppp_close;
hdlc->proto.type_trans = ppp_type_trans;
hdlc->proto.id = IF_PROTO_PPP;
dev->hard_start_xmit = hdlc->xmit;
dev->hard_header = NULL;
dev->type = ARPHRD_PPP;
dev->addr_len = 0;
return 0;
}
return -EINVAL;
}

View File

@ -0,0 +1,89 @@
/*
* Generic HDLC support routines for Linux
* HDLC support
*
* Copyright (C) 1999 - 2003 Krzysztof Halasa <khc@pm.waw.pl>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/pkt_sched.h>
#include <linux/inetdevice.h>
#include <linux/lapb.h>
#include <linux/rtnetlink.h>
#include <linux/hdlc.h>
static __be16 raw_type_trans(struct sk_buff *skb, struct net_device *dev)
{
return __constant_htons(ETH_P_IP);
}
int hdlc_raw_ioctl(struct net_device *dev, struct ifreq *ifr)
{
raw_hdlc_proto __user *raw_s = ifr->ifr_settings.ifs_ifsu.raw_hdlc;
const size_t size = sizeof(raw_hdlc_proto);
raw_hdlc_proto new_settings;
hdlc_device *hdlc = dev_to_hdlc(dev);
int result;
switch (ifr->ifr_settings.type) {
case IF_GET_PROTO:
ifr->ifr_settings.type = IF_PROTO_HDLC;
if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(raw_s, &hdlc->state.raw_hdlc.settings, size))
return -EFAULT;
return 0;
case IF_PROTO_HDLC:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (dev->flags & IFF_UP)
return -EBUSY;
if (copy_from_user(&new_settings, raw_s, size))
return -EFAULT;
if (new_settings.encoding == ENCODING_DEFAULT)
new_settings.encoding = ENCODING_NRZ;
if (new_settings.parity == PARITY_DEFAULT)
new_settings.parity = PARITY_CRC16_PR1_CCITT;
result = hdlc->attach(dev, new_settings.encoding,
new_settings.parity);
if (result)
return result;
hdlc_proto_detach(hdlc);
memcpy(&hdlc->state.raw_hdlc.settings, &new_settings, size);
memset(&hdlc->proto, 0, sizeof(hdlc->proto));
hdlc->proto.type_trans = raw_type_trans;
hdlc->proto.id = IF_PROTO_HDLC;
dev->hard_start_xmit = hdlc->xmit;
dev->hard_header = NULL;
dev->type = ARPHRD_RAWHDLC;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->addr_len = 0;
return 0;
}
return -EINVAL;
}

View File

@ -0,0 +1,107 @@
/*
* Generic HDLC support routines for Linux
* HDLC Ethernet emulation support
*
* Copyright (C) 2002-2003 Krzysztof Halasa <khc@pm.waw.pl>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/pkt_sched.h>
#include <linux/random.h>
#include <linux/inetdevice.h>
#include <linux/lapb.h>
#include <linux/rtnetlink.h>
#include <linux/etherdevice.h>
#include <linux/hdlc.h>
static int eth_tx(struct sk_buff *skb, struct net_device *dev)
{
int pad = ETH_ZLEN - skb->len;
if (pad > 0) { /* Pad the frame with zeros */
int len = skb->len;
if (skb_tailroom(skb) < pad)
if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC)) {
hdlc_stats(dev)->tx_dropped++;
dev_kfree_skb(skb);
return 0;
}
skb_put(skb, pad);
memset(skb->data + len, 0, pad);
}
return dev_to_hdlc(dev)->xmit(skb, dev);
}
int hdlc_raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
{
raw_hdlc_proto __user *raw_s = ifr->ifr_settings.ifs_ifsu.raw_hdlc;
const size_t size = sizeof(raw_hdlc_proto);
raw_hdlc_proto new_settings;
hdlc_device *hdlc = dev_to_hdlc(dev);
int result;
void *old_ch_mtu;
int old_qlen;
switch (ifr->ifr_settings.type) {
case IF_GET_PROTO:
ifr->ifr_settings.type = IF_PROTO_HDLC_ETH;
if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(raw_s, &hdlc->state.raw_hdlc.settings, size))
return -EFAULT;
return 0;
case IF_PROTO_HDLC_ETH:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (dev->flags & IFF_UP)
return -EBUSY;
if (copy_from_user(&new_settings, raw_s, size))
return -EFAULT;
if (new_settings.encoding == ENCODING_DEFAULT)
new_settings.encoding = ENCODING_NRZ;
if (new_settings.parity == PARITY_DEFAULT)
new_settings.parity = PARITY_CRC16_PR1_CCITT;
result = hdlc->attach(dev, new_settings.encoding,
new_settings.parity);
if (result)
return result;
hdlc_proto_detach(hdlc);
memcpy(&hdlc->state.raw_hdlc.settings, &new_settings, size);
memset(&hdlc->proto, 0, sizeof(hdlc->proto));
hdlc->proto.type_trans = eth_type_trans;
hdlc->proto.id = IF_PROTO_HDLC_ETH;
dev->hard_start_xmit = eth_tx;
old_ch_mtu = dev->change_mtu;
old_qlen = dev->tx_queue_len;
ether_setup(dev);
dev->change_mtu = old_ch_mtu;
dev->tx_queue_len = old_qlen;
memcpy(dev->dev_addr, "\x00\x01", 2);
get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2);
return 0;
}
return -EINVAL;
}

File diff suppressed because it is too large Load Diff

47
drivers/dahdi/digits.h Normal file
View File

@ -0,0 +1,47 @@
/*
* DAHDI Telephony
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#ifndef _DIGITS_H
#define _DIGITS_H
#define DEFAULT_DTMF_LENGTH 100 * DAHDI_CHUNKSIZE
#define DEFAULT_MFR1_LENGTH 68 * DAHDI_CHUNKSIZE
#define DEFAULT_MFR2_LENGTH 100 * DAHDI_CHUNKSIZE
#define PAUSE_LENGTH 500 * DAHDI_CHUNKSIZE
/* At the end of silence, the tone stops */
static struct dahdi_tone dtmf_silence = {
.tonesamples = DEFAULT_DTMF_LENGTH,
};
/* At the end of silence, the tone stops */
static struct dahdi_tone mfr1_silence = {
.tonesamples = DEFAULT_MFR1_LENGTH,
};
/* At the end of silence, the tone stops */
static struct dahdi_tone mfr2_silence = {
.tonesamples = DEFAULT_MFR2_LENGTH,
};
/* A pause in the dialing */
static struct dahdi_tone tone_pause = {
.tonesamples = PAUSE_LENGTH,
};
#endif

103
drivers/dahdi/ecdis.h Normal file
View File

@ -0,0 +1,103 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* ec_disable_detector.h - A detector which should eventually meet the
* G.164/G.165 requirements for detecting the
* 2100Hz echo cancellor disable tone.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 Steve Underwood
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include "biquad.h"
#define FALSE 0
#define TRUE (!FALSE)
static inline void echo_can_disable_detector_init (echo_can_disable_detector_state_t *det)
{
/* Elliptic notch */
/* This is actually centred at 2095Hz, but gets the balance we want, due
to the asymmetric walls of the notch */
biquad2_init (&det->notch,
(int32_t) (-0.7600000*32768.0),
(int32_t) (-0.1183852*32768.0),
(int32_t) (-0.5104039*32768.0),
(int32_t) ( 0.1567596*32768.0),
(int32_t) ( 1.0000000*32768.0));
det->channel_level = 0;
det->notch_level = 0;
det->tone_present = FALSE;
det->tone_cycle_duration = 0;
det->good_cycles = 0;
det->hit = 0;
}
/*- End of function --------------------------------------------------------*/
static inline int echo_can_disable_detector_update (echo_can_disable_detector_state_t *det,
int16_t amp)
{
int16_t notched;
notched = biquad2 (&det->notch, amp);
/* Estimate the overall energy in the channel, and the energy in
the notch (i.e. overall channel energy - tone energy => noise).
Use abs instead of multiply for speed (is it really faster?).
Damp the overall energy a little more for a stable result.
Damp the notch energy a little less, so we don't damp out the
blip every time the phase reverses */
det->channel_level += ((abs(amp) - det->channel_level) >> 5);
det->notch_level += ((abs(notched) - det->notch_level) >> 4);
if (det->channel_level >= 70) {
/* There is adequate energy in the channel. Is it mostly at 2100Hz? */
if (det->notch_level*6 < det->channel_level) {
det->tone_cycle_duration++;
/* The notch says yes, so we have the tone. */
if (!det->tone_present) {
/* Do we get a kick every 450+-25ms? */
if ((det->tone_cycle_duration >= (425 * 8)) &&
(det->tone_cycle_duration <= (475 * 8))) {
/* It's ANS/PR (CED with polarity reversals), so wait
for at least three cycles before returning a hit. */
det->good_cycles++;
if (det->good_cycles > 2)
det->hit = TRUE;
}
det->tone_cycle_duration = 0;
det->tone_present = TRUE;
} else if (det->tone_cycle_duration >= 600 * 8) {
/* It's ANS (CED without polarity reversals)
so return a hit. */
det->hit = TRUE;
}
} else {
det->tone_present = FALSE;
}
} else {
det->tone_present = FALSE;
det->tone_cycle_duration = 0;
det->good_cycles = 0;
}
return det->hit;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

129
drivers/dahdi/fir.h Normal file
View File

@ -0,0 +1,129 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* fir.h - General telephony FIR routines
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2002 Steve Underwood
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#if !defined(_FIR_H_)
#define _FIR_H_
typedef struct
{
int taps;
int curr_pos;
int16_t *coeffs;
int16_t *history;
} fir16_state_t;
typedef struct
{
int taps;
int curr_pos;
int32_t *coeffs;
int16_t *history;
} fir32_state_t;
static inline void fir16_create (fir16_state_t *fir,
int16_t *coeffs,
int taps)
{
fir->taps = taps;
fir->curr_pos = taps - 1;
fir->coeffs = coeffs;
fir->history = kmalloc(taps*sizeof (int16_t), GFP_KERNEL);
if (fir->history)
memset (fir->history, '\0', taps*sizeof (int16_t));
}
/*- End of function --------------------------------------------------------*/
static inline void fir16_free (fir16_state_t *fir)
{
kfree(fir->history);
}
/*- End of function --------------------------------------------------------*/
static inline int16_t fir16 (fir16_state_t *fir, int16_t sample)
{
int i;
int offset1;
int offset2;
int32_t y;
fir->history[fir->curr_pos] = sample;
offset2 = fir->curr_pos + 1;
offset1 = fir->taps - offset2;
y = 0;
for (i = fir->taps - 1; i >= offset1; i--)
y += fir->coeffs[i]*fir->history[i - offset1];
for ( ; i >= 0; i--)
y += fir->coeffs[i]*fir->history[i + offset2];
if (fir->curr_pos <= 0)
fir->curr_pos = fir->taps;
fir->curr_pos--;
return y >> 15;
}
/*- End of function --------------------------------------------------------*/
static inline void fir32_create (fir32_state_t *fir,
int32_t *coeffs,
int taps)
{
fir->taps = taps;
fir->curr_pos = taps - 1;
fir->coeffs = coeffs;
fir->history = kmalloc(taps*sizeof (int16_t), GFP_KERNEL);
if (fir->history)
memset (fir->history, '\0', taps*sizeof (int16_t));
}
/*- End of function --------------------------------------------------------*/
static inline void fir32_free (fir32_state_t *fir)
{
kfree(fir->history);
}
/*- End of function --------------------------------------------------------*/
static inline int16_t fir32 (fir32_state_t *fir, int16_t sample)
{
int i;
int offset1;
int offset2;
int32_t y;
fir->history[fir->curr_pos] = sample;
offset2 = fir->curr_pos + 1;
offset1 = fir->taps - offset2;
y = 0;
for (i = fir->taps - 1; i >= offset1; i--)
y += fir->coeffs[i]*fir->history[i - offset1];
for ( ; i >= 0; i--)
y += fir->coeffs[i]*fir->history[i + offset2];
if (fir->curr_pos <= 0)
fir->curr_pos = fir->taps;
fir->curr_pos--;
return y >> 15;
}
/*- End of function --------------------------------------------------------*/
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -0,0 +1,177 @@
#
# DAHDI
#
# Makefile for firmware downloading/installation
#
# Copyright (C) 2007-2010, Digium, Inc.
#
# Joshua Colp <jcolp@digium.com>
#
#
# See http://www.asterisk.org for more information about
# the Asterisk project. Please do not directly contact
# any of the maintainers of this project for assistance;
# the project provides a web site, mailing lists and IRC
# channels for your use.
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2 as published by the
# Free Software Foundation. See the LICENSE file included with
# this program for more details.
#
.PHONY: dist-clean clean all uninstall have_download install object-build hotplug-install hotplug-dirs hotplug-uninstall make_firmware_object firmware-loaders
OCT6114_064_VERSION:=1.05.01
OCT6114_128_VERSION:=1.05.01
TC400M_VERSION:=MR6.12
VPMADT032_VERSION:=1.25.0
HX8_VERSION:=2.06
FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M FIRMWARE-HX8
# Firmware files should use the naming convention: dahdi-fw-<base name>-<sub name>-<version> or dahdi-fw-<base name>-<version>
# First example: dahdi-fw-oct6114-064-1.05.01
# This means this is version 1.05.01 of the oct6114-064 firmware
# Second example: dahdi-fw-tc400m-MR5.6
# This means this is version MR5.6 of the tc400m firmware
# Build a list of firmware package filenames we need
FIRMWARE:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-TC400M=dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-HX8=dahdi-fw-hx8-$(HX8_VERSION).tar.gz)
FWLOADERS:=dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz
# Build a list of object files if hotplug will not be used
OBJECT_FILES:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064.o)
OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128.o)
OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400M=dahdi-fw-tc400m.o)
OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-HX8=dahdi-fw-hx8.o)
# Force usage of wget, for now
DOWNLOAD=wget
WGET=wget
# If "fetch" is used, --continue is not a valid option.
ifeq ($(WGET),wget)
WGET_ARGS:=--continue
endif
all: $(FIRMWARE)
# Clean up any downloaded/extracted firmware packages
dist-clean: clean
rm -f dahdi-fw-*.bin
rm -f dahdi-fw-*.tar.gz
rm -f dahdi-fwload-*.tar.gz
rm -f make_firmware_object
# Clean up anything we built
clean:
rm -f dahdi-fw-*.o
# Download and extract firmware tarballs
dahdi-fw-%.tar.gz:
@if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.$(subst .tar.gz,,$*) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.$(subst .tar.gz,,$*) ] ); then \
echo "Attempting to download $@"; \
if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \
if test ! -f $@; then exit 1; fi; \
(cat $@ | gzip -d | tar -xof -) \
fi
firmware-loaders: $(FWLOADERS)
.PHONY: dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz
dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz:
@if test ! -f $@; then echo "Attempting to download $@"; $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \
if test ! -f $@; then exit 1; fi; \
(cd ../../..; cat drivers/dahdi/firmware/$@ | gzip -d | tar -xof -)
# Create object files suitable for linking against
object-build: $(FIRMWARE) $(OBJECT_FILES)
$(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware:
mkdir -p $@
# Install all downloaded firmware images for hotplug usage
hotplug-install: $(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware $(FIRMWARE)
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-oct6114-064.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-oct6114-064.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-064-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION)
@install -m 644 dahdi-fw-oct6114-064.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-064-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-064-$(OCT6114_064_VERSION)
else
@echo "Firmware dahdi-fw-oct6114-064.bin is already installed with required version $(OCT6114_064_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-oct6114-128.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-oct6114-128.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-128-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION)
@install -m 644 dahdi-fw-oct6114-128.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-128-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-128-$(OCT6114_128_VERSION)
else
@echo "Firmware dahdi-fw-oct6114-128.bin is already installed with required version $(OCT6114_128_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-tc400m.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-tc400m.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-tc400m-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION)
@install -m 644 dahdi-fw-tc400m.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-tc400m-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION)
else
@echo "Firmware dahdi-fw-tc400m.bin is already installed with required version $(TC400M_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-hx8-$(HX8_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-hx8-$(HX8_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-hx8.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-hx8.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-hx8-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-hx8-$(HX8_VERSION)
@install -m 644 dahdi-fw-hx8.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-hx8-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-hx8-$(HX8_VERSION)
else
@echo "Firmware dahdi-fw-hx8.bin is already installed with required version $(HX8_VERSION)"
endif
# Uninstall any installed dahdi firmware images from hotplug firmware directories
hotplug-uninstall:
if [ -d $(DESTDIR)/usr/lib/hotplug/firmware ]; then \
rm -f $(DESTDIR)/usr/lib/hotplug/firmware/dahdi-fw-*.bin; \
rm -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw*; \
fi
if [ -d $(DESTDIR)/lib/firmware ]; then \
rm -f $(DESTDIR)/lib/firmware/dahdi-fw-*.bin; \
rm -f $(DESTDIR)/lib/firmware/.dahdi-fw*; \
fi
make_firmware_object: make_firmware_object.in ../dahdi-base.o
@export BFDNAME=`LANG=C objdump -f ../dahdi-base.o | grep -e "dahdi-base.o:" | sed "s/.*file format \(.*\)/\1/"`; \
export BFDARCH=`LANG=C objdump -f ../dahdi-base.o | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"`; \
sed -e s/BFDNAME/$${BFDNAME}/ -e s/BFDARCH/$${BFDARCH}/ $< > $@
@chmod +x $@
# Build object file of an oct6114 064 firmware image for linking
dahdi-fw-oct6114-064.o: dahdi-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz dahdi-fw-oct6114-064.bin make_firmware_object
@echo Making firmware object file for dahdi-fw-oct6114-064.bin
./make_firmware_object dahdi-fw-oct6114-064.bin $@
# Build object file of an oct6114 128 firmware image for linking
dahdi-fw-oct6114-128.o: dahdi-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz dahdi-fw-oct6114-128.bin make_firmware_object
@echo Making firmware object file for dahdi-fw-oct6114-128.bin
./make_firmware_object dahdi-fw-oct6114-128.bin $@
# Build object file of a TC400M firmware image for linking
dahdi-fw-tc400m.o: dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz dahdi-fw-tc400m.bin make_firmware_object
@echo Making firmware object file for dahdi-fw-tc400m.bin
./make_firmware_object dahdi-fw-tc400m.bin $@

View File

@ -0,0 +1,8 @@
#!/bin/sh -e
# make an object file from a raw binary firmware file
# arguments:
# 1 - firmware file
# 2 - output file
objcopy -I binary ${1} -B BFDARCH -O BFDNAME ${2} --rename-section .data=.rodata,alloc,load,data,contents,readonly

587
drivers/dahdi/fxo_modes.h Normal file
View File

@ -0,0 +1,587 @@
/*
* FXO port mode settings for various regions
*
* Copyright (C) 2008 Digium, Inc.
*
* extracted from wctdm.c by
* Kevin P. Fleming <kpfleming@digium.com>
*
* All rights reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#ifndef _FXO_MODES_H
#define _FXO_MODES_H
static struct fxo_mode {
char *name;
int ohs;
int ohs2;
int rz;
int rt;
int ilim;
int dcv;
int mini;
int acim;
int ring_osc;
int ring_x;
unsigned int battdebounce; /* in milliseconds */
unsigned int battalarm; /* in milliseconds */
unsigned int battthresh; /* unknown units */
} fxo_modes[] =
{
/* US, Canada */
{ .name = "FCC",
.rt = 1,
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
/* Austria, Belgium, Denmark, Finland, France, Germany,
Greece, Iceland, Ireland, Italy, Luxembourg, Netherlands,
Norway, Portugal, Spain, Sweden, Switzerland, and UK */
{ .name = "TBR21",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.ring_osc = 0x7e6c,
.ring_x = 0x023a,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "ARGENTINA",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "AUSTRALIA",
.ohs = 1,
.mini = 0x3,
.acim = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "AUSTRIA",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "BAHRAIN",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "BELGIUM",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "BRAZIL",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "BULGARIA",
.ilim = 1,
.dcv = 0x3,
.mini = 0x0,
.acim = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "CANADA",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "CHILE",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "CHINA",
.mini = 0x3,
.acim = 0xf,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "COLOMBIA",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "CROATIA",
.ilim = 1,
.dcv = 0x3,
.mini = 0,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "CYPRUS",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "CZECH",
.ilim = 1,
.dcv = 0x3,
.mini = 0,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "DENMARK",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "ECUADOR",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "EGYPT",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "ELSALVADOR",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "FINLAND",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "FRANCE",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.mini = 0,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "GERMANY",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "GREECE",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "GUAM",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "HONGKONG",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "HUNGARY",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "ICELAND",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "INDIA",
.dcv = 0x3,
.acim = 0x4,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "INDONESIA",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "IRELAND",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "ISRAEL",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "ITALY",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "JAPAN",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "JORDAN",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "KAZAKHSTAN",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "KUWAIT",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "LATVIA",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "LEBANON",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "LUXEMBOURG",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "MACAO",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
/* Current loop >= 20ma */
{ .name = "MALAYSIA",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "MALTA",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "MEXICO",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "MOROCCO",
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "NETHERLANDS",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "NEWZEALAND",
.dcv = 0x3,
.acim = 0x4,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "NIGERIA",
.ilim = 0x1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "NORWAY",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "OMAN",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "PAKISTAN",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "PERU",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "PHILIPPINES",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "POLAND",
.rz = 1,
.rt = 1,
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "PORTUGAL",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "ROMANIA",
.dcv = 3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "RUSSIA",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SAUDIARABIA",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SINGAPORE",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SLOVAKIA",
.dcv = 0x3,
.acim = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SLOVENIA",
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SOUTHAFRICA",
.ohs = 1,
.rz = 1,
.dcv = 0x3,
.acim = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SOUTHKOREA",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SPAIN",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SWEDEN",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SWITZERLAND",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x2,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "SYRIA",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "TAIWAN",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "THAILAND",
.mini = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "UAE",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "UK",
.ohs2 = 1,
.ilim = 1,
.dcv = 0x3,
.acim = 0x5,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "USA",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
{ .name = "YEMEN",
.dcv = 0x3,
.battdebounce = 64,
.battalarm = 1000,
.battthresh = 3,
},
};
#endif /* _FXO_MODES_H */

View File

@ -0,0 +1,223 @@
/*
* DAHDI Telephony Interface to Digium High-Performance Echo Canceller
*
* Copyright (C) 2006-2008 Digium, Inc.
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ctype.h>
#include <linux/moduleparam.h>
#include <dahdi/kernel.h>
static int debug;
#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
#define debug_printk(level, fmt, args...) if (debug >= level) printk(KERN_DEBUG "%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
#include "hpec_user.h"
#include "hpec.h"
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, __u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
static const struct dahdi_echocan_factory my_factory = {
.name = "HPEC",
.owner = THIS_MODULE,
.echocan_create = echo_can_create,
};
static const struct dahdi_echocan_features my_features = {
.NLP_automatic = 1,
.CED_tx_detect = 1,
.CED_rx_detect = 1,
};
static const struct dahdi_echocan_ops my_ops = {
.name = "HPEC",
.echocan_free = echo_can_free,
.echocan_process = echo_can_process,
.echocan_traintap = echo_can_traintap,
};
struct ec_pvt {
struct hpec_state *hpec;
struct dahdi_echocan_state dahdi;
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
static int __attribute__((regparm(0), format(printf, 1, 2))) logger(const char *format, ...)
{
int res;
va_list args;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
va_start(args, format);
res = vprintk(format, args);
va_end(args);
#else
char buf[256];
va_start(args, format);
res = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
printk(KERN_INFO "%s" buf);
#endif
return res;
}
static void *memalloc(size_t len)
{
return kmalloc(len, GFP_KERNEL);
}
static void memfree(void *ptr)
{
kfree(ptr);
}
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
hpec_channel_free(pvt->hpec);
kfree(pvt);
}
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, __u32 size)
{
struct ec_pvt *pvt = dahdi_to_pvt(ec);
hpec_channel_update(pvt->hpec, isig, iref);
}
DECLARE_MUTEX(license_lock);
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct ec_pvt *pvt;
if (ecp->param_count > 0) {
printk(KERN_WARNING "HPEC does not support parameters; failing request\n");
return -EINVAL;
}
pvt = kzalloc(sizeof(*pvt), GFP_KERNEL);
if (!pvt)
return -ENOMEM;
pvt->dahdi.ops = &my_ops;
pvt->dahdi.features = my_features;
if (down_interruptible(&license_lock))
return -ENOTTY;
pvt->hpec = hpec_channel_alloc(ecp->tap_length);
up(&license_lock);
if (!pvt->hpec) {
kfree(pvt);
*ec = NULL;
return -ENOTTY;
} else {
*ec = &pvt->dahdi;
return 0;
}
}
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
{
return 1;
}
static int hpec_license_ioctl(unsigned int cmd, unsigned long data)
{
struct hpec_challenge challenge;
struct hpec_license license;
int result = 0;
switch (cmd) {
case DAHDI_EC_LICENSE_CHALLENGE:
if (down_interruptible(&license_lock))
return -EINTR;
memset(&challenge, 0, sizeof(challenge));
if (hpec_license_challenge(&challenge))
result = -ENODEV;
if (!result && copy_to_user((unsigned char *) data, &challenge, sizeof(challenge)))
result = -EFAULT;
up(&license_lock);
return result;
case DAHDI_EC_LICENSE_RESPONSE:
if (down_interruptible(&license_lock))
return -EINTR;
if (copy_from_user(&license, (unsigned char *) data, sizeof(license)))
result = -EFAULT;
if (!result && hpec_license_check(&license))
result = -EACCES;
up(&license_lock);
return result;
default:
return -ENOSYS;
}
}
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
}
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
hpec_init(logger, debug, DAHDI_CHUNKSIZE, memalloc, memfree);
dahdi_set_hpec_ioctl(hpec_license_ioctl);
return 0;
}
static void __exit mod_exit(void)
{
dahdi_unregister_echocan_factory(&my_factory);
dahdi_set_hpec_ioctl(NULL);
hpec_shutdown();
}
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_DESCRIPTION("DAHDI High Performance Echo Canceller");
MODULE_AUTHOR("Kevin P. Fleming <kpfleming@digium.com>");
MODULE_LICENSE("Digium Commercial");
module_init(mod_init);
module_exit(mod_exit);

46
drivers/dahdi/hpec/hpec.h Normal file
View File

@ -0,0 +1,46 @@
/*
* DAHDI Telephony Interface to Digium High-Performance Echo Canceller
*
* Copyright (C) 2006 Digium, Inc.
*
* All rights reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#if !defined(_HPEC_H)
#define _HPEC_H
struct hpec_state;
void __attribute__((regparm(0))) hpec_init(int __attribute__((regparm(0), format(printf, 1, 2))) (*logger)(const char *format, ...),
unsigned int debug,
unsigned int chunk_size,
void * (*memalloc)(size_t len),
void (*memfree)(void *ptr));
void __attribute__((regparm(0))) hpec_shutdown(void);
int __attribute__((regparm(0))) hpec_license_challenge(struct hpec_challenge *challenge);
int __attribute__((regparm(0))) hpec_license_check(struct hpec_license *license);
struct hpec_state __attribute__((regparm(0))) *hpec_channel_alloc(unsigned int len);
void __attribute__((regparm(0))) hpec_channel_free(struct hpec_state *channel);
void __attribute__((regparm(0))) hpec_channel_update(struct hpec_state *channel, short *isig, const short *iref);
#endif /* !defined(_HPEC_H) */

View File

@ -0,0 +1,39 @@
/*
* DAHDI Telephony Interface to Digium High-Performance Echo Canceller
*
* Copyright (C) 2006 Digium, Inc.
*
* All rights reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#if !defined(_HPEC_USER_H)
#define _HPEC_USER_H
struct hpec_challenge {
__u8 challenge[16];
};
struct hpec_license {
__u32 numchannels;
__u8 userinfo[256];
__u8 response[16];
};
#define DAHDI_EC_LICENSE_CHALLENGE _IOR(DAHDI_CODE, 60, struct hpec_challenge)
#define DAHDI_EC_LICENSE_RESPONSE _IOW(DAHDI_CODE, 61, struct hpec_license)
#endif /* !defined(_HPEC_USER_H) */

84
drivers/dahdi/makefw.c Normal file
View File

@ -0,0 +1,84 @@
/* Xilinx firmware convertor program.
*
* Written by Jim Dixon <jim@lambdatel.com>.
*
* Copyright (C) 2001 Jim Dixon / Zapata Telephony.
* Copyright (C) 2001-2008 Digium, Inc.
*
* All rights reserved.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SWATH 12
int main(int argc, char *argv[])
{
FILE *fp;
int i,j,nbytes;
unsigned char c;
char buf[300];
if (argc < 3)
{
puts("Usage... makefw filename.rbt array_name");
exit(1);
}
fp = fopen(argv[1],"r");
if (!fp)
{
perror("bit file open");
exit(1);
}
nbytes = 0;
printf("static unsigned char %s[] = {\n",argv[2]);
i = 0;
while(fgets(buf,sizeof(buf) - 1,fp))
{
if (!buf[0]) continue;
if (buf[strlen(buf) - 1] < ' ') buf[strlen(buf) - 1] = 0;
if (!buf[0]) continue;
if (buf[strlen(buf) - 1] < ' ') buf[strlen(buf) - 1] = 0;
if (!buf[0]) continue;
if (strlen(buf) < 32) continue;
if ((buf[0] != '0') && (buf[0] != '1')) continue;
c = 0;
for(j = 0; buf[j]; j++)
{
if (buf[j] > '0') c |= 1 << (j & 7);
if ((j & 7) == 7)
{
nbytes++;
if (i) printf(",");
printf("0x%02x",c);
if (i++ == SWATH) {
printf(",\n");
i = 0;
}
c = 0;
}
}
}
printf("\n};\n\n");
fprintf(stderr,"Loaded %d bytes from file\n",nbytes);
fclose(fp);
exit(0);
}

View File

@ -0,0 +1,38 @@
CFLAGS=-V3.4 -ffunction-sections -I/lib/modules/$(shell uname -r)/build/include -Iinclude -Ioctdeviceapi -Ioctdeviceapi/oct6100api -DGFP_ATOMIC=0 -Dkmalloc=calloc -Dkfree=free
LDFLAGS=-V3.4 -Wl,-Map -Wl,test.map -Wl,--gc-sections
APIDIR=octdeviceapi/oct6100api/oct6100_api
OCTASIC_OBJS=$(APIDIR)/oct6100_adpcm_chan.o \
$(APIDIR)/oct6100_channel.o \
$(APIDIR)/oct6100_chip_open.o \
$(APIDIR)/oct6100_chip_stats.o \
$(APIDIR)/oct6100_conf_bridge.o \
$(APIDIR)/oct6100_debug.o \
$(APIDIR)/oct6100_events.o \
$(APIDIR)/oct6100_interrupts.o \
$(APIDIR)/oct6100_memory.o \
$(APIDIR)/oct6100_miscellaneous.o \
$(APIDIR)/oct6100_mixer.o \
$(APIDIR)/oct6100_phasing_tsst.o \
$(APIDIR)/oct6100_playout_buf.o \
$(APIDIR)/oct6100_remote_debug.o \
$(APIDIR)/oct6100_tlv.o \
$(APIDIR)/oct6100_tone_detection.o \
$(APIDIR)/oct6100_tsi_cnct.o \
$(APIDIR)/oct6100_tsst.o \
$(APIDIR)/oct6100_user.o \
apilib/bt/octapi_bt0.o \
apilib/largmath/octapi_largmath.o \
apilib/llman/octapi_llman.o
all: test
test.o: test.c
test: test.o $(OCTASIC_OBJS)
clean:
rm -rf test test.o
rm -rf $(OCTASIC_OBJS)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,93 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: octapi_bt0_private.h
Copyright (c) 2001 Octasic Inc. All rights reserved.
Description:
Library used to manage a binary tree of variable max size. Library is
made to use one block of contiguous memory to manage the tree.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 11 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCTAPI_BT0_PRIVATE_H__
#define __OCTAPI_BT0_PRIVATE_H__
#include "octdef.h"
#define OCTAPI_BT0_LKEY_LARGER 0x0
#define OCTAPI_BT0_LKEY_SMALLER 0x1
#define OCTAPI_BT0_LKEY_EQUAL 0x2
typedef struct __OCTAPI_BT0_LINK__
{
UINT32 node_number;
UINT32 depth;
} OCTAPI_BT0_LINK;
typedef struct __OCTAPI_BT0_NODE__
{
UINT32 next_free_node; /* Number of the next node in the free node link-list.*/
OCTAPI_BT0_LINK l[2]; /* 0 = left link; 1 = right link.*/
} OCTAPI_BT0_NODE;
typedef struct __OCTAPI_BT0__
{
UINT32 number_of_items; /* Number of items on total that can be allocated in the tree.*/
UINT32 key_size; /* Size is in UINT32s*/
UINT32 data_size; /* Size is in UINT32s*/
/* Empty node linked-list:*/
UINT32 next_free_node; /* 0xFFFFFFFF means that no nodes are free.*/
/* Tree as such:*/
OCTAPI_BT0_NODE * node; /* Array of nodes (number_of_items in size).*/
/* Tree root:*/
OCTAPI_BT0_LINK root_link;
/* Associated key structure*/
UINT32 * key; /* Array of keys associated to NODEs.*/
/* Associated data structure.*/
UINT32 * data; /* Array of data associated to NODEs.*/
UINT32 invalid_value;
UINT32 no_smaller_key;
} OCTAPI_BT0;
void OctApiBt0CorrectPointers( OCTAPI_BT0 * bb );
UINT32 OctApiBt0AddNode2( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, UINT32 new_node_number );
UINT32 OctApiBt0AddNode3( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, UINT32 *p_new_node_number );
UINT32 OctApiBt0AddNode4(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number, UINT32 *p_prev_node_number, UINT32 state );
UINT32 OctApiBt0KeyCompare( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey );
void OctApiBt0UpdateLinkDepth( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link );
void OctApiBt0Rebalance( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link );
void OctApiBt0ExternalHeavy( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link );
UINT32 OctApiBt0RemoveNode2( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link );
#endif /*__OCTAPI_BT0_PRIVATE_H__*/

View File

@ -0,0 +1,628 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: octapi_largmath.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Library used to perform arithmetic on integer values of an integer multiple
of 32-bits.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 10 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#include "apilib/octapi_largmath.h"
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: OctApiLmAdd.
|
| Description: This function adds 2 numbers, a and b. Number a is
| (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long. The
| result is (zlen + 1) * 32 bits long. It the function succeeds it returns
| GENERIC_OK, else GENERIC_ERROR.
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| *a UINT32 The array containing the first number.
| alen USHORT The length of array a, minus 1 (0 - 99).
| *b UINT32 The array containing the second number.
| blen USHORT The length of array b, minus 1 (0 - 99).
| *z UINT32 The array containing the resulting number.
| zlen USHORT The length of array z, minus 1 (0 - 99).
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmAdd
UINT32 OctApiLmAdd(UINT32 * a,USHORT alen,UINT32 * b,USHORT blen,UINT32 * z, USHORT zlen)
{
USHORT i;
UINT32 temp;
UINT32 carry=0;
UINT32 aprim;
UINT32 bprim;
/* Check for array lengths.*/
if (alen > zlen || blen > zlen) return(OCTAPI_LM_ARRAY_SIZE_MISMATCH);
for(i=0;i<=zlen;i++)
{
if (i <= alen) aprim = *(a+i); else aprim = 0;
if (i <= blen) bprim = *(b+i); else bprim = 0;
temp = aprim + bprim + carry;
/* Calculate carry for next time.*/
if (carry == 0)
if (temp < aprim) carry = 1; else carry = 0;
else
if (temp <= aprim) carry = 1; else carry = 0;
/* Write new value.*/
*(z+i) = temp;
}
/* Check for overflow.*/
if (carry == 1) return(OCTAPI_LM_OVERFLOW);
/* All is well.*/
return(GENERIC_OK);
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: OctApiLmSubtract.
|
| Description: This function subtracts 2 numbers, a and b. Number a is
| (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long. The result
| is (zlen + 1) * 32 bits long. It the function succeeds it returns
| GENERIC_OK, else GENERIC_ERROR.
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| *a UINT32 The array containing the first number.
| alen USHORT The length of array a, minus 1 (0 - 99).
| *bneg UINT32 The array containing the second number.
| blen USHORT The length of array b, minus 1 (0 - 99).
| *z UINT32 The array containing the resulting number.
| zlen USHORT The length of array z, minus 1 (0 - 99).
| *neg USHORT Indicates if the result is negative
| (TRUE/FALSE).
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmSubtract
UINT32 OctApiLmSubtract(UINT32 * a,USHORT alen,UINT32 * bneg,USHORT blen,UINT32 * z,USHORT zlen,USHORT * neg)
{
USHORT i;
UINT32 temp;
UINT32 carry=1;
UINT32 aprim;
UINT32 bprim;
/* Check for array lengths.*/
if (alen > zlen || blen > zlen) return(OCTAPI_LM_ARRAY_SIZE_MISMATCH);
for(i=0;i<=zlen;i++)
{
if (i <= alen) aprim = *(a+i); else aprim = 0;
if (i <= blen) bprim = ~(*(bneg+i)); else bprim = 0xFFFFFFFF;
temp = aprim + bprim + carry;
/* Calculate carry for next time.*/
if (carry == 0)
if (temp < aprim) carry = 1; else carry = 0;
else
if (temp <= aprim) carry = 1; else carry = 0;
/* Write new value.*/
*(z+i) = temp;
}
/* Check for overflow, which means negative number!*/
if (carry == 0)
{
/* Number is not of right neg. Invert and add one to correct neg.*/
for(i=0;i<=zlen;i++)
*(z+i) = ~(*(z+i));
temp = 1;
OctApiLmAdd(&temp,0,z,zlen,z,zlen);
*neg = TRUE;
return(GENERIC_OK);
}
/* Result is positive.*/
*neg = FALSE;
return(GENERIC_OK);
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: OctApiLmCompare.
|
| Description: This function compares two numbers (arrays) of equal lengths.
| Number a is (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long. The result
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| *a UINT32 The array containing the first number.
| alen USHORT The length of array a, minus 1 (0 - 99).
| *b UINT32 The array containing the second number.
| blen USHORT The length of array b, minus 1 (0 - 99).
| *neg USHORT Result of compare.
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmCompare
UINT32 OctApiLmCompare(UINT32 * a,USHORT alen,UINT32 * bneg,USHORT blen,USHORT * neg)
{
USHORT i;
UINT32 temp;
UINT32 carry=1;
UINT32 aprim;
UINT32 bprim;
UINT32 zlen;
/* Set zlen to alen or blen (which ever is longer)*/
if (alen < blen)
zlen = blen;
else
zlen = alen;
for(i=0;i<=zlen;i++)
{
if (i <= alen) aprim = *(a+i); else aprim = 0;
if (i <= blen) bprim = ~(*(bneg+i)); else bprim = 0xFFFFFFFF;
temp = aprim + bprim + carry;
/* Calculate carry for next time.*/
if (carry == 0)
if (temp < aprim) carry = 1; else carry = 0;
else
if (temp <= aprim) carry = 1; else carry = 0;
}
/* Check for overflow, which means negative number!*/
if (carry == 0)
{
*neg = TRUE;
return(GENERIC_OK);
}
/* Result is positive.*/
*neg = FALSE;
return(GENERIC_OK);
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: OctApiLmSubtract.
|
| Description: This function multiplies 2 numbers, a and b. Number a and
| b are both (ablen + 1) * 32 bits long. The result is twice as
| long. If the functions succeeds if returns GENERIC_OK,
| else GENERIC_ERROR.
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| *a UINT32 The array containing the first number.
| *b UINT32 The array containing the second number.
| ablen USHORT The length of arrays a and b, minus 1 (0 - 99).
| *z UINT32 The array containing the resulting number.
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmMultiply
UINT32 OctApiLmMultiply(UINT32 * a,UINT32 * b,USHORT ablen,UINT32 * z)
{
USHORT i,j,k;
USHORT nos;
UINT32 lownum;
UINT32 highnum;
USHORT longnumi;
USHORT longnumj;
USHORT indentw,indentl;
/* Caculate number of shorts in a and b.*/
nos = (USHORT)((ablen+1) * 2);
/* Clear answer word.*/
for(i=0;i<nos;i++)
*(z+i) = 0;
{
USHORT optimizea, optimizeb;
USHORT l;
optimizea = TRUE;
optimizeb = TRUE;
for(l = 1; l < ablen+1; l++)
{
if(*(a+l) != 0)
optimizea = FALSE;
if(*(b+l) != 0)
optimizeb = FALSE;
}
if(*a > OCTAPI_LM_MAX_OPTIMIZE_MUL)
optimizea = FALSE;
if(*b > OCTAPI_LM_MAX_OPTIMIZE_MUL)
optimizeb = FALSE;
if(optimizea == TRUE)
{
for(l = 0; l < *a; l++)
OctApiLmAdd(z, (USHORT)(nos-1), b, ablen, z, (USHORT)(nos-1));
return(GENERIC_OK);
}
if(optimizeb == TRUE)
{
for(l = 0; l < *b; l++)
OctApiLmAdd(z, (USHORT)(nos-1), a, ablen, z, (USHORT)(nos-1));
return(GENERIC_OK);
}
}
for(i=0;i<nos;i++)
{
longnumi = (USHORT)( i/2 );
/* One iteration per short in a.*/
if ((i%2) == 0)
lownum = *(a+longnumi) & 0xFFFF; /* Even word. Lower part of long.*/
else
lownum = *(a+longnumi)>>16; /* Odd word. Upper part of long.*/
for(j=0;j<nos;j++)
{
UINT32 product;
longnumj = (USHORT)( j/2 );
/* One iteration per short in a.*/
if ((j%2) == 0)
highnum = *(b+longnumj) & 0xFFFF; /* Even word. Lower part of long.*/
else
highnum = *(b+longnumj)>>16; /* Odd word. Upper part of long.*/
/* Find the word indent of the answer. 0 = no indent. 1 = one word indent.*/
indentw = (USHORT)( j+i );
indentl = (USHORT)( indentw / 2 );
/* Multiply both numbers.*/
product = highnum * lownum;
/* After multiplying both numbers, add result to end result.*/
if ((indentw % 2) == 0) /* Even word boundary, addition in one shot!*/
{
UINT32 carry=0;
UINT32 temp;
UINT32 addme;
for(k=indentl;k<nos;k++)
{
if (k==indentl) addme = product; else addme = 0;
temp = *(z+k) + addme + carry;
/* Calculate carry for next time.*/
if (carry == 0)
if (temp < addme) carry = 1; else carry = 0;
else
if (temp <= addme) carry = 1; else carry = 0;
/* Set value.*/
*(z+k) = temp;
}
/* Carry should always be 0.*/
if (carry == 1) return(GENERIC_ERROR);
}
else /* Odd word boundary, addition in two shots.*/
{
UINT32 carry=0;
UINT32 temp;
UINT32 addme;
for(k=indentl;k<nos;k++)
{
if (k==indentl) addme = product<<16;
else if (k==(indentl+1)) addme = product>>16;
else addme = 0;
temp = *(z+k) + addme + carry;
/* Calculate carry for next time.*/
if (carry == 0)
if (temp < addme) carry = 1; else carry = 0;
else
if (temp <= addme) carry = 1; else carry = 0;
/* Set value.*/
*(z+k) = temp;
}
/* Carry should always be 0.*/
if (carry == 1) return(GENERIC_ERROR);
}
}
}
return(GENERIC_OK);
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: OctApiLmDivide.
|
| Description: This function divides the number n by the number d. The
| quotient is placed in q and the remainder in r. The arrays
| n, d, q and r are all of the same length, namely (ndqrlen + 1).
| If the functions succeeds if returns GENERIC_OK, else
| GENERIC_ERROR.
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| *a UINT32 The array containing the first number.
| *b UINT32 The array containing the second number.
| ablen USHORT The length of arrays a and b, minus 1 (0 - 99).
| *z UINT32 The array containing the resulting number.
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmDivide
UINT32 OctApiLmDivide(UINT32 * n,UINT32 * d,UINT32 * q,UINT32 * r,USHORT ndqrlen)
{
/* Proceedure for division:*/
/* r = n*/
/* q = 0*/
/* shift = initial_denominator_shift (for upper '1's to be in same bit position).*/
/* d <<= shift;*/
/* Start loop:*/
/* compare r and d*/
/* if r > d then*/
/* r -= d;*/
/* write a '1' to bit "shift" of array q.*/
/* end if;*/
/* if shift == 0 then*/
/* return;*/
/* else*/
/* shift--;*/
/* d>>=1;*/
/* goto "Start loop:"*/
/* end if;*/
UINT32 i;
UINT32 result;
USHORT shift,n_msb,d_msb;
USHORT neg;
USHORT ConditionFlag = TRUE;
/* r = n*/
for(i=0;i<=ndqrlen;i++)
*(r+i) = *(n+i);
/* q = 0*/
for(i=0;i<=ndqrlen;i++)
*(q+i) = 0;
/* shift = initial_denominator_shift (for upper '1's to be in same bit position).*/
result = OctApiLmGetMsb(d,ndqrlen,&d_msb);
if (result != GENERIC_OK) return(result);
result = OctApiLmGetMsb(n,ndqrlen,&n_msb);
if (result != GENERIC_OK) return(result);
if (d_msb == 0xFFFF) /* Division by 0.*/
return(OCTAPI_LM_DIVISION_BY_ZERO);
if (n_msb == 0xFFFF) /* 0/n, returns 0 R 0.*/
return(GENERIC_OK);
if (n_msb < d_msb) /* x/y, where x is smaller than y, returns 0 R x.*/
return(GENERIC_OK);
shift = (USHORT)( n_msb - d_msb );
/* Shift d to match n highest bit position.*/
result = OctApiLmShiftn(d,ndqrlen,TRUE,shift);
if (result != GENERIC_OK) return(result);
/* Start loop:*/
while( ConditionFlag == TRUE )
{
/* compare r and d*/
result = OctApiLmCompare(r,ndqrlen,d,ndqrlen,&neg);
if (result != GENERIC_OK) return(result);
if (neg == FALSE) /* Subtraction can be done(do it).*/
{
/* r -= d;*/
result = OctApiLmSubtract(r,ndqrlen,d,ndqrlen,r,ndqrlen,&neg);
if (result != GENERIC_OK) return(result);
/* write a '1' to bit "shift" of array q.*/
*(q+(shift/32)) |= (UINT32)0x1 << (shift%32);
}
/* if shift == 0 then*/
/* return;*/
if (shift == 0) return(GENERIC_OK);
/* shift--;*/
/* d>>=1;*/
/* goto "Start loop:"*/
shift--;
OctApiLmShiftRight1(d,ndqrlen);
}
return(GENERIC_OK);
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: octapi_lm_shifright1.
|
| Description: The function is for internal use only.
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| N/A.
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmShiftRight1
UINT32 OctApiLmShiftRight1(UINT32 * a,USHORT alen)
{
UINT32 i;
/* Start with lower long and move up by one long each time,*/
/* shifting each long to the right by one bit. The upper bit*/
/* of the next long will have to be concatenated each time a*/
/* loop is executed. For the last long, leave the highest bit*/
/* intact.*/
for(i=0;i<alen;i++)
{
*(a+i)>>=1; /* Shift long by one to the right.*/
*(a+i)|=*(a+i+1)<<31;
}
*(a+alen)>>=1; /* Shift last long, leaving it's highest bit at 0.*/
return(GENERIC_OK);
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: OctApiLmShiftn.
|
| Description: The function is for internal use only.
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| N/A.
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmShiftn
UINT32 OctApiLmShiftn(UINT32 * a,USHORT alen,USHORT shiftleft,USHORT shiftn)
{
UINT32 i;
USHORT long_offset;
USHORT bit_offset;
long_offset = (USHORT)( shiftn / 32 );
bit_offset = (USHORT)( shiftn % 32 );
if (shiftleft == TRUE) /* Shift left.*/
{
for(i=alen;i<=alen;i--)
{
/* Fill upper bits of long.*/
if (i >= long_offset)
*(a+i) = *(a+i-long_offset) << bit_offset;
else
*(a+i) = 0;
/* Fill lower bits of long.*/
if (i > long_offset && bit_offset != 0)
*(a+i) |= *(a+i-long_offset-1) >> (32-bit_offset);
}
}
else /* Shift right.*/
{
for(i=0;i<=alen;i++)
{
/* Fill lower bits of long.*/
if ((alen-i) >= long_offset)
*(a+i) = *(a+i+long_offset) >> bit_offset;
else
*(a+i) = 0;
/* Fill upper bits of long.*/
if ((alen-i) > long_offset && bit_offset != 0)
*(a+i) |= *(a+i+long_offset+1) << (32-bit_offset);
}
}
return(GENERIC_OK);
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
| API UTILITIES
|
| Function: OctApiLmGetMsb.
|
| Description: The function is for internal use only.
|
| -----------------------------------------------------------------------
| | Variable | Type | Description
| -----------------------------------------------------------------------
| N/A.
|
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_OctApiLmGetMsb
UINT32 OctApiLmGetMsb(UINT32 * a,USHORT alen,USHORT * msb_pos)
{
UINT32 i,j;
UINT32 x;
for(i=alen;i<=alen;i--)
{
if (*(a+i) == 0) continue;
x = *(a+i);
for(j=31;j<=31;j--)
{
/* Test for bit being '1'.*/
if ((x & 0x80000000) != 0)
{
*msb_pos=(USHORT)(j+(32*i));
return(GENERIC_OK);
}
/* Shift bit one bit position, and try again.*/
x<<=1;
}
}
/* MSB not found.*/
*msb_pos = 0xFFFF;
return(GENERIC_OK);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,206 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: octapi_llman_private.h
Copyright (c) 2001 Octasic Inc. All rights reserved.
Description:
Library used to manage allocation tables and linked lists. The library is
made such that only a block of contiguous memory is needed for the
management of the linked list/allocation table.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 13 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCTAPI_LLMAN_PRIVATE_H__
#define __OCTAPI_LLMAN_PRIVATE_H__
#include "octdef.h"
/**************************************** llm_alloc section **********************************************/
/* Most basic linked list model.
LLM_STR contains a list of "number_of_items" that
are each "unassigned" or "assigned". When requesting
a new element, llm_alloc must choose an "unassigned"
element. An element that is deallocated will be last
to be allocated.
*/
typedef struct _LLM_ALLOC
{
UINT32 *linked_list; /* Each item is either used (0xFFFFFFFE)*/
/* or unused (pointer to next unused item, 0xFFFFFFFF means last item reached).*/
UINT32 next_avail_num; /* Points to the next available item in linked list. (0xFFFFFFFF means none available)*/
UINT32 number_of_items; /* Total number of items in linked list.*/
UINT32 allocated_items; /* Allocated items in linked list.*/
} LLM_ALLOC;
typedef struct _TLLM_ALLOC_NODE_
{
UINT32 value; /* Each item is either used (0xFFFFFFFE)*/
/* or unused (pointer to next unused item, 0xFFFFFFFF means last item reached).*/
UINT32 timeout[2]; /* Timeout value that must be exceeded for the node to be considered free again.*/
} TLLM_ALLOC_NODE;
typedef struct _TLLM_ALLOC_
{
TLLM_ALLOC_NODE *linked_list; /* List of nodes used by the link list.*/
UINT32 next_avail_num; /* Points to the next available item in linked list. (0xFFFFFFFF means none available)*/
UINT32 number_of_items; /* Total number of items in linked list.*/
UINT32 allocated_items; /* Allocated items in linked list.*/
UINT32 number_of_timeout; /* Number of block currently in timeout.*/
UINT32 next_timeout_num; /* Points to the next block currently in timeout.*/
UINT32 last_timeout_num; /* Last node of the timeout list.*/
UINT32 last_known_time[2]; /* last known time.*/
} TLLM_ALLOC;
/*
void octapi_llm_alloc_build_structure(void *l, LLM_ALLOC ** ls);
*/
/**************************************** llm_alloc section **********************************************/
/**************************************** llm_list section **********************************************/
/* This section contains memory structures and functions used
to maintain a variable number of lists (FIFOs) that each
have a variable amount of items. A total amount of items
can be assigned through-out all the lists. Each item in
each list contains a UINT32 specified by the software using
the lists. Each used item in the list is accessible through
it's position in the list. */
typedef struct _LLM_LIST_HEAD
{
UINT32 list_length; /* Current number of items in the list.*/
/* 0xFFFFFFFF means that the list is not used.*/
UINT32 head_pointer; /* Number of the item in the item pool that is the first of this list.*/
/* 0xFFFFFFFF indicates end-of-list link.*/
UINT32 tail_pointer; /* Number of the item in the item pool that is the last of this list.*/
/* Item cache (pointer within the list of the last accessed item):*/
UINT32 cache_item_number; /* Number of the last accessed item in the list. 0xFFFFFFFF indicates invalid cache.*/
UINT32 cache_item_pointer; /* Number of the last accessed item in the item pool.*/
} LLM_LIST_HEAD;
typedef struct _LLM_LIST_ITEM
{
UINT32 forward_link; /* Number of the item in the item pool that is next in this list.*/
/* 0xFFFFFFFF indicates end-of-list link.*/
/* User item info (variable size)*/
UINT32 user_info[1];
} LLM_LIST_ITEM;
typedef struct _LLM_LIST
{
UINT32 user_info_bytes; /* In bytes, size of the user info in a single item.*/
UINT32 user_info_size; /* In bytes, size of the user info in a single item.*/
UINT32 item_size;
UINT32 head_alloc_size;
UINT32 total_items;
UINT32 assigned_items;
UINT32 total_lists;
UINT32 assigned_lists;
UINT32 next_empty_item; /* Contains a pointer to the next empty item in the*/
/* item pool.*/
/* Table of all the possible list heads:*/
LLM_LIST_HEAD * lh;
void * list_head_alloc; /* LLM_ALLOC structure used for list head allocation!*/
/* Table of the list items:*/
LLM_LIST_ITEM * li;
} LLM_LIST;
/**********************************************************************************/
/* These structures are are used by the Llm2 functions to creates lists of ordered
items based on a key given by the user when a new node is inserted in a list. */
typedef struct _LLM2_LIST_HEAD
{
UINT32 list_length; /* Current number of items in the list.*/
/* 0xFFFFFFFF means that the list is not used.*/
UINT32 head_pointer; /* Number of the item in the item pool that is the first of this list.*/
/* 0xFFFFFFFF indicates end-of-list link.*/
UINT32 tail_pointer; /* Number of the item in the item pool that is the last of this list.*/
} LLM2_LIST_HEAD;
typedef struct _LLM2_LIST_ITEM
{
UINT32 forward_link; /* Number of the item in the item pool that is next in this list.*/
/* 0xFFFFFFFF indicates end-of-list link.*/
UINT32 key; /* Key used to order the entries.*/
/* User item info (variable size)*/
UINT32 user_info[1];
} LLM2_LIST_ITEM;
typedef struct _LLM2_LIST
{
UINT32 user_info_bytes; /* In bytes, size of the user info in a single item.*/
UINT32 user_info_size; /* In bytes, size of the user info in a single item.*/
UINT32 item_size;
UINT32 head_alloc_size;
UINT32 total_items;
UINT32 assigned_items;
UINT32 total_lists;
UINT32 assigned_lists;
UINT32 next_empty_item; /* Contains a pointer to the next empty item in the*/
/* item pool.*/
/* Table of all the possible list heads:*/
LLM2_LIST_HEAD * lh;
void * list_head_alloc; /* LLM_ALLOC structure used for list head allocation!*/
/* Table of the list items:*/
LLM2_LIST_ITEM * li;
} LLM2_LIST;
/*void octapi_llm_list_build_structure(void *l, LLM_LIST ** ls);*/
LLM_LIST_ITEM * OctApiLlmListGetItemPointer( LLM_LIST * ls, UINT32 item_number );
LLM2_LIST_ITEM * OctApiLlm2ListGetItemPointer( LLM2_LIST * ls, UINT32 item_number );
UINT32 OctApiTllmCheckTimeoutList( TLLM_ALLOC *ls, UINT32 current_time[2] );
VOID * OctApiLlmMemCpy( VOID *f_pvDestination, const VOID * f_pvSource, UINT32 f_ulSize );
/**************************************** llm_list section **********************************************/
#endif /*__OCTAPI_LLMAN_PRIVATE_H__*/

View File

@ -0,0 +1,51 @@
#!/usr/bin/php
<?php
/*
* Written by Jared Smith and Kevin P. Fleming
*
* Copyright (C) 2006, Jared Smith and Digium, Inc.
*
*/
# create an array of all the different prefixes you want to match on,
# as Perl-compatible regular expressions
# (yes, this is a stupid example, as the second one is just a simplified
# version of the first, but it's just an example)
$prefixes = array('\.text\.Oct');
$fp = fopen('test.map','r');
while (!feof($fp))
{
# Loop until we find the top of section we want
while ($line = fgets($fp))
{
if (preg_match('/Discarded input sections/i',$line))
{
break;
}
}
# Now loop until we find the next section
while ($line = fgets($fp))
{
if (preg_match('/Memory Configuration/i',$line))
{
# we found it!
break;
}
foreach ($prefixes as $prefix)
{
if (preg_match("/$prefix/i",$line))
{
preg_match("/Oct.*/", $line, $matches);
$line2 = fgets($fp);
echo "#define SKIP_".$matches[0]." 1\n";
break;
}
}
}
}
fclose($fp);
?>

View File

@ -0,0 +1,75 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: octapi_bt0.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Library used to manage a binary tree of variable max size. Library is
made to use one block of contiguous memory to manage the tree.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 11 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCTAPI_BT0_H__
#define __OCTAPI_BT0_H__
#include "octdef.h"
#define OCTAPI_BT0_BASE 0xFFFF0000
#define OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32 OCTAPI_BT0_BASE+0x0001
#define OCTAPI_BT0_DATA_SIZE_NOT_MUTLIPLE_OF_UINT32 OCTAPI_BT0_BASE+0x0002
#define OCTAPI_BT0_MALLOC_FAILED OCTAPI_BT0_BASE+0x0003
#define OCTAPI_BT0_NO_NODES_AVAILABLE OCTAPI_BT0_BASE+0x0004
#define OCTAPI_BT0_KEY_ALREADY_IN_TREE OCTAPI_BT0_BASE+0x0005
#define OCTAPI_BT0_KEY_NOT_IN_TREE OCTAPI_BT0_BASE+0x0006
/* Possible result for Find Or Add function. */
#define OCTAPI0_BT0_NODE_FOUND 0
#define OCTAPI0_BT0_NODE_ADDDED 1
#define OCTAPI_BT0_NO_SMALLER_KEY 0xAAAAAAAA
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define octapi_bt0_get_size( number_of_items, key_size, data_size, b_size ) OctApiBt0GetSize( (UINT32) number_of_items,(UINT32) key_size, (UINT32) data_size, (PUINT32) b_size )
#define octapi_bt0_init( b, number_of_items, key_size, data_size ) OctApiBt0Init( (void **) b,(UINT32) number_of_items,(UINT32) key_size, (UINT32) data_size )
#define octapi_bt0_add_node( b, key, data ) OctApiBt0AddNode( (void *) b,(void *) key,(void **) data )
#define octapi_bt0_remove_node( b, key ) OctApiBt0RemoveNode( (void *) b,(void *) key )
#define octapi_bt0_query_node( b, key, data ) OctApiBt0QueryNode( (void *) b,(void *) key,(void **) data )
#define octapi_bt0_get_first_node( b, key, data ) OctApiBt0GetFirstNode( (void *) b,(void **) key, (void **) data )
UINT32 OctApiBt0GetSize( UINT32 number_of_items, UINT32 key_size, UINT32 data_size, UINT32 * b_size );
UINT32 OctApiBt0Init( void ** b, UINT32 number_of_items, UINT32 key_size, UINT32 data_size );
UINT32 OctApiBt0AddNode( void * b, void * key, void ** data );
UINT32 OctApiBt0RemoveNode( void * b, void * key );
UINT32 OctApiBt0QueryNode( void * b, void * key, void ** data );
UINT32 OctApiBt0GetFirstNode( void * b, void ** key, void ** data );
UINT32 OctApiBt0FindOrAddNode( void * b, void * key, void ** data, UINT32 *fnct_result );
UINT32 OctApiBt0AddNodeReportPrevNodeData( void * b, void * key, void ** data, void ** prev_data, UINT32 *fnct_result );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /*__OCTAPI_BT0_H__*/

View File

@ -0,0 +1,69 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: octapi_largmath.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Library used to perform arithmetic on integer values of an integer multiple
of 32-bits.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 6 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCTAPI_LARGMATH_H__
#define __OCTAPI_LARGMATH_H__
#include "octdef.h"
#define OCTAPI_LM_DIVISION_BY_ZERO 0xFFFF
#define OCTAPI_LM_OVERFLOW 0xFFFE
#define OCTAPI_LM_ARRAY_SIZE_MISMATCH 0xFFFD
#define OCTAPI_LM_MAX_OPTIMIZE_MUL 10
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define octapi_lm_add( a, alen, b, blen, z, zlen ) OctApiLmAdd( (PUINT32) a, (USHORT) alen, (PUINT32) b, (USHORT) blen, (PUINT32) z, (USHORT) zlen )
#define octapi_lm_subtract( a, alen, bneg, blen, z, zlen, neg ) OctApiLmSubtract( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (PUINT32) z, (USHORT) zlen, (USHORT*) neg )
#define octapi_lm_compare( a, alen, bneg, blen, neg ) OctApiLmCompare( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (USHORT*) neg )
#define octapi_lm_multiply( a, b, ablen, z ) OctApiLmMultiply( (PUINT32) a, (PUINT32) b, (USHORT) ablen, (PUINT32) z )
#define octapi_lm_divide( n, d, q, r, ndqrlen ) OctApiLmDivide( (PUINT32) n, (PUINT32) d, (PUINT32) q, (PUINT32) r, (USHORT) ndqrlen )
#define octapi_lm_shiftright1( a, alen ) OctApiLmShiftRight1( (PUINT32) a, (USHORT) alen )
#define octapi_lm_shiftn( a, alen, shiftleft, shiftn ) OctApiLmShiftn( (PUINT32) a, (USHORT) alen, (USHORT) shiftleft, (USHORT) shiftn )
#define octapi_lm_getmsb( a, alen, msb_pos ) OctApiLmGetMsb( (PUINT32) a, (USHORT) alen, (USHORT*) msb_pos )
UINT32 OctApiLmAdd( PUINT32 a, USHORT alen, PUINT32 b, USHORT blen, PUINT32 z, USHORT zlen );
UINT32 OctApiLmSubtract( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUINT32 z, USHORT zlen, PUSHORT neg );
UINT32 OctApiLmCompare( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUSHORT neg );
UINT32 OctApiLmMultiply( PUINT32 a, PUINT32 b, USHORT ablen, PUINT32 z );
UINT32 OctApiLmDivide( PUINT32 n, PUINT32 d, PUINT32 q, PUINT32 r, USHORT ndqrlen );
UINT32 OctApiLmShiftRight1( PUINT32 a, USHORT alen );
UINT32 OctApiLmShiftn( PUINT32 a, USHORT alen, USHORT shiftleft, USHORT shiftn );
UINT32 OctApiLmGetMsb( PUINT32 a, USHORT alen, PUSHORT msb_pos );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __OCTAPI_LARGMATH_H__ */

View File

@ -0,0 +1,142 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: octapi_llman.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Library used to manage allocation tables and linked lists. The library is
made such that only a block of contiguous memory is needed for the
management of the linked list/allocation table.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 8 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCTAPI_LLMAN_H__
#define __OCTAPI_LLMAN_H__
#include "octdef.h"
/* Error defines. */
#define OCTAPI_LLM_MEMORY_NOT_ALLOCATED 0xFFFFFFFF
#define OCTAPI_LLM_NO_STRUCTURES_LEFT 0xFFFFFFFE
#define OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE 0xFFFFFFFD
#define OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED 0xFFFFFFFC
#define OCTAPI_LLM_ELEMENT_NOT_FOUND 0xFFFFFFFB
#define OCTAPI_LLM_LIST_EMPTY 0xFFFFFFFA
#define OCTAPI_LLM_INVALID_LIST_HANDLE 0xFFFFFFF9
#define OCTAPI_LLM_TREE_NODE_ABSENT 0xFFFFFFF8
#define OCTAPI_LLM_INTERNAL_ERROR0 0xFFFFFFF7
#define OCTAPI_LLM_INTERNAL_ERROR1 0xFFFFFFF6
#define OCTAPI_LLM_INVALID_PARAMETER 0xFFFFFFF5
#define OCTAPI_LLM2_MEMORY_NOT_ALLOCATED 0xFEFFFFFF
#define OCTAPI_LLM2_NO_STRUCTURES_LEFT 0xFEFFFFFE
#define OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE 0xFEFFFFFD
#define OCTAPI_LLM2_ELEMENT_ALREADY_ASSIGNED 0xFEFFFFFC
#define OCTAPI_LLM2_ELEMENT_NOT_FOUND 0xFEFFFFFB
#define OCTAPI_LLM2_LIST_EMPTY 0xFEFFFFFA
#define OCTAPI_LLM2_INVALID_LIST_HANDLE 0xFEFFFFF9
#define OCTAPI_LLM2_TREE_NODE_ABSENT 0xFEFFFFF8
#define OCTAPI_LLM2_INTERNAL_ERROR0 0xFEFFFFF7
#define OCTAPI_LLM2_INTERNAL_ERROR1 0xFEFFFFF6
#define OCTAPI_LLM2_INVALID_PARAMETER 0xFEFFFFF5
/* Other defines. */
#define OCTAPI_LLM_LIST_APPEND 0xFFFFFFFF
#define OCTAPI_LLM2_INSERT_ERROR 0xFFFFFFFF
#define OCTAPI_LLM2_INSERT_FIRST_NODE 0xFFFF0000
#define OCTAPI_LLM2_INSERT_LIST_NODE 0xFFFF0001
#define OCTAPI_LLM2_INSERT_LAST_NODE 0xFFFF0002
#define OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE 0xFFFF0003
#define OCTAPI_LLM2_REMOVE_ERROR 0xFFFFFFFF
#define OCTAPI_LLM2_REMOVE_FIRST_NODE 0xFFFF0004
#define OCTAPI_LLM2_REMOVE_LIST_NODE 0xFFFF0005
#define OCTAPI_LLM2_REMOVE_LAST_NODE 0xFFFF0006
#define OCTAPI_LLM2_REMOVE_BEFORE_LAST_NODE 0xFFFF0007
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define octapi_llm_alloc_get_size( number_of_items, l_size ) OctapiLlmAllocGetSize( (UINT32) number_of_items,(PUINT32) l_size )
#define octapi_llm_alloc_init( l, number_of_items ) OctapiLlmAllocInit( (PVOID*) l,(UINT32) number_of_items )
#define octapi_llm_alloc_info( l, allocated_items, available_items ) OctapiLlmAllocInfo( (PVOID) l, (PUINT32) allocated_items, (PUINT32) available_items )
#define octapi_llm_alloc_alloc( l, blocknum ) OctapiLlmAllocAlloc( (PVOID) l, (PUINT32) blocknum )
#define octapi_llm_alloc_dealloc( l, blocknum ) OctapiLlmAllocDealloc( (PVOID) l,(UINT32) blocknum )
#define octapi_llm_list_get_size( number_of_items, number_of_lists, user_info_size, l_size ) OctApiLlmListGetSize( (UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size,(PUINT32) l_size )
#define octapi_llm_list_init( l, number_of_items, number_of_lists, user_info_size ) OctApiLlmListInit( (PVOID*) l,(UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size )
#define octapi_llm_list_info( l, allocated_lists, allocated_items, free_lists, free_items ) OctApiLlmListInfo( (PVOID) l,(PUINT32) allocated_lists,(PUINT32) allocated_items,(PUINT32) free_lists,(PUINT32) free_items )
#define octapi_llm_list_create( l, list_handle ) OctApiLlmListCreate( (PVOID) l,(PUINT32) list_handle )
#define octapi_llm_list_create_full( l, list_length, plist_handle ) OctApiLlmListCreateFull( (PVOID) l, (UINT32) list_length, (PUINT32) plist_handle )
#define octapi_llm_list_append_items( l, list_handle, num_items ) OctApiLlmListAppendItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items )
#define octapi_llm_list_append_and_set_items( l, list_handle, num_items, data_list ) OctApiLlmListAppendAndSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items, (PVOID) data_list )
#define octapi_llm_list_delete( l, list_handle ) OctApiLlmListDelete( (PVOID) l,(UINT32) list_handle )
#define octapi_llm_list_length( l, list_handle, number_of_items_in_list ) OctApiLlmListLength( (PVOID) l,(UINT32) list_handle, (PUINT32) number_of_items_in_list )
#define octapi_llm_list_insert_item( l, list_handle, item_number, item_data_pnt ) OctApiLlmListInsertItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt )
#define octapi_llm_list_remove_item( l, list_handle, item_number ) OctApiLlmListRemoveItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number )
#define octapi_llm_list_item_data( l, list_handle, item_number, item_data_pnt ) OctApiLlmListItemData( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt )
#define octapi_llm_list_copy_data( l, list_handle, start_item, data_length, pdata_list ) OctApiLlmListCopyData( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list )
#define octapi_llm_list_set_items( l, list_handle, start_item, data_length, pdata_list ) OctApiLlmListSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list )
/* Alloc man. */
UINT32 OctapiLlmAllocGetSize( UINT32 number_of_items,PUINT32 l_size );
UINT32 OctapiLlmAllocInit( PVOID* l,UINT32 number_of_items );
UINT32 OctapiLlmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items );
UINT32 OctapiLlmAllocAlloc( PVOID l, PUINT32 blocknum );
UINT32 OctapiLlmAllocDealloc( PVOID l,UINT32 blocknum );
/* Time managed alloc man. */
UINT32 OctApiTllmAllocGetSize( UINT32 number_of_items, PUINT32 l_size );
UINT32 OctApiTllmAllocInit( PVOID* l, UINT32 number_of_items );
UINT32 OctApiTllmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items );
UINT32 OctApiTllmAllocAlloc( PVOID l, PUINT32 blocknum, UINT32 current_time[2] );
UINT32 OctApiTllmAllocDealloc( PVOID l, UINT32 blocknum, UINT32 timeout_value, UINT32 current_time[2] );
/* List man. */
UINT32 OctApiLlmListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size );
UINT32 OctApiLlmListInit( PVOID* l, UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size );
UINT32 OctApiLlmListInfo( PVOID l, PUINT32 allocated_lists, PUINT32 allocated_items, PUINT32 free_lists, PUINT32 free_items );
UINT32 OctApiLlmListCreate( PVOID l, PUINT32 list_handle );
UINT32 OctApiLlmListCreateFull( PVOID l, UINT32 list_length, UINT32* plist_handle );
UINT32 OctApiLlmListAppendItems( PVOID l, UINT32 list_handle, UINT32 num_items );
UINT32 OctApiLlmListAppendAndSetItems( PVOID l, UINT32 list_handle, UINT32 num_items, PVOID data_list );
UINT32 OctApiLlmListDelete( PVOID l, UINT32 list_handle );
UINT32 OctApiLlmListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list );
UINT32 OctApiLlmListInsertItem( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt );
UINT32 OctApiLlmListRemoveItem( PVOID l, UINT32 list_handle, UINT32 item_number );
UINT32 OctApiLlmListItemData( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt );
UINT32 OctApiLlmListCopyData( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list );
UINT32 OctApiLlmListSetItems( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list );
/* Second list manager using a key to order info in the list. */
UINT32 OctApiLlm2ListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size );
UINT32 OctApiLlm2ListInit( PVOID* l,UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size );
UINT32 OctApiLlm2ListCreate( PVOID l, PUINT32 list_handle );
UINT32 OctApiLlm2ListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list );
UINT32 OctApiLlm2ListInsertItem(void * l, UINT32 list_handle, UINT32 item_key, void ** item_data_pnt, void ** prev_item_data_pnt, void ** prev_prev_item_data_pnt, PUINT32 insert_status_pnt );
UINT32 OctApiLlm2ListRemoveItem(void * l, UINT32 list_handle, UINT32 item_key, PUINT32 prev_item_key_pnt, PUINT32 prev_prev_item_key_pnt, PUINT32 remove_status_pnt );
UINT32 OctApiLlm2ListItemData( PVOID l, UINT32 list_handle, UINT32 item_key, PVOID* item_data_pnt, PUINT32 item_number );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __OCTAPI_LLMAN_H__ */

View File

@ -0,0 +1,297 @@
/* Define macros here to suppress functions from the API being built */
#if 1
#define SKIP_Oct6100AdpcmChanOpenDef 1
#define SKIP_Oct6100AdpcmChanOpen 1
#define SKIP_Oct6100AdpcmChanCloseDef 1
#define SKIP_Oct6100AdpcmChanClose 1
#define SKIP_Oct6100AdpcmChanOpenSer 1
#define SKIP_Oct6100ApiCheckAdpcmChanParams 1
#define SKIP_Oct6100ApiReserveAdpcmChanResources 1
#define SKIP_Oct6100ApiWriteAdpcmChanStructs 1
#define SKIP_Oct6100ApiUpdateAdpcmChanEntry 1
#define SKIP_Oct6100AdpcmChanCloseSer 1
#define SKIP_Oct6100ApiAssertAdpcmChanParams 1
#define SKIP_Oct6100ApiInvalidateAdpcmChanStructs 1
#define SKIP_Oct6100ApiReleaseAdpcmChanResources 1
#define SKIP_Oct6100ApiReserveAdpcmChanEntry 1
#define SKIP_Oct6100ApiReleaseAdpcmChanEntry 1
#define SKIP_Oct6100ChannelCloseDef 1
#define SKIP_Oct6100ChannelClose 1
#define SKIP_Oct6100ChannelCreateBiDirDef 1
#define SKIP_Oct6100ChannelCreateBiDir 1
#define SKIP_Oct6100ChannelDestroyBiDirDef 1
#define SKIP_Oct6100ChannelDestroyBiDir 1
#define SKIP_Oct6100ChannelBroadcastTsstAddDef 1
#define SKIP_Oct6100ChannelBroadcastTsstAdd 1
#define SKIP_Oct6100ChannelBroadcastTsstRemove 1
#define SKIP_Oct6100ChannelGetStatsDef 1
#define SKIP_Oct6100ChannelGetStats 1
#define SKIP_Oct6100ChannelMuteDef 1
#define SKIP_Oct6100ChannelMute 1
#define SKIP_Oct6100ChannelUnMuteDef 1
#define SKIP_Oct6100ChannelUnMute 1
#define SKIP_Oct6100ChannelCloseSer 1
#define SKIP_Oct6100ApiAssertChannelParams 1
#define SKIP_Oct6100ApiInvalidateChannelStructs 1
#define SKIP_Oct6100ApiReleaseChannelResources 1
#define SKIP_Oct6100ChannelBroadcastTsstAddSer 1
#define SKIP_Oct6100ApiCheckChanTsstAddParams 1
#define SKIP_Oct6100ApiReserveTsstAddResources 1
#define SKIP_Oct6100ApiWriteTsstAddStructs 1
#define SKIP_Oct6100ApiUpdateTsstAddChanEntry 1
#define SKIP_Oct6100ApiChannelGetStatsSer 1
#define SKIP_Oct6100ApiReserveBiDirChanEntry 1
#define SKIP_Oct6100ApiReleaseBiDirChanEntry 1
#define SKIP_Oct6100ApiRetrieveNlpConfDword 1
#define SKIP_Oct6100ApiSaveNlpConfDword 1
#define SKIP_Oct6100ChannelCreateBiDirSer 1
#define SKIP_Oct6100ApiCheckChannelCreateBiDirParams 1
#define SKIP_Oct6100ApiReserveChannelCreateBiDirResources 1
#define SKIP_Oct6100ApiWriteChannelCreateBiDirStructs 1
#define SKIP_Oct6100ApiUpdateBiDirChannelEntry 1
#define SKIP_Oct6100ChannelDestroyBiDirSer 1
#define SKIP_Oct6100ApiAssertDestroyBiDirChanParams 1
#define SKIP_Oct6100ApiInvalidateBiDirChannelStructs 1
#define SKIP_Oct6100ApiReleaseBiDirChannelResources 1
#define SKIP_Oct6100ApiOctFloatToDbEnergyByte 1
#define SKIP_Oct6100ApiOctFloatToDbEnergyHalf 1
#define SKIP_Oct6100ChannelMuteSer 1
#define SKIP_Oct6100ApiAssertChannelMuteParams 1
#define SKIP_Oct6100ChannelUnMuteSer 1
#define SKIP_Oct6100ApiAssertChannelUnMuteParams 1
#define SKIP_Oct6100ApiMuteSinWithFeatures 1
#define SKIP_Oct6100ApiMuteChannelPorts 1
#define SKIP_Oct6100CreateLocalInstanceDef 1
#define SKIP_Oct6100CreateLocalInstance 1
#define SKIP_Oct6100DestroyLocalInstanceDef 1
#define SKIP_Oct6100DestroyLocalInstance 1
#define SKIP_Oct6100GetHwRevisionDef 1
#define SKIP_Oct6100GetHwRevision 1
#define SKIP_Oct6100FreeResourcesDef 1
#define SKIP_Oct6100FreeResources 1
#define SKIP_Oct6100ProductionBistDef 1
#define SKIP_Oct6100ProductionBist 1
#define SKIP_Oct6100ApiGetVersionDef 1
#define SKIP_Oct6100ApiGetVersion 1
#define SKIP_Oct6100FreeResourcesSer 1
#define SKIP_Oct6100ProductionBistSer 1
#define SKIP_Oct6100ChipGetStatsDef 1
#define SKIP_Oct6100ChipGetStats 1
#define SKIP_Oct6100ChipGetImageInfoDef 1
#define SKIP_Oct6100ChipGetImageInfo 1
#define SKIP_Oct6100ChipGetStatsSer 1
#define SKIP_Oct6100ConfBridgeOpenDef 1
#define SKIP_Oct6100ConfBridgeOpen 1
#define SKIP_Oct6100ConfBridgeClose 1
#define SKIP_Oct6100ConfBridgeChanAddDef 1
#define SKIP_Oct6100ConfBridgeChanAdd 1
#define SKIP_Oct6100ConfBridgeChanRemove 1
#define SKIP_Oct6100ConfBridgeChanMuteDef 1
#define SKIP_Oct6100ConfBridgeChanMute 1
#define SKIP_Oct6100ConfBridgeChanUnMuteDef 1
#define SKIP_Oct6100ConfBridgeChanUnMute 1
#define SKIP_Oct6100ConfBridgeDominantSpeakerSetDef 1
#define SKIP_Oct6100ConfBridgeDominantSpeakerSet 1
#define SKIP_Oct6100ConfBridgeMaskChangeDef 1
#define SKIP_Oct6100ConfBridgeMaskChange 1
#define SKIP_Oct6100ConfBridgeGetStatsDef 1
#define SKIP_Oct6100ConfBridgeGetStats 1
#define SKIP_Oct6100ConfBridgeOpenSer 1
#define SKIP_Oct6100ApiCheckBridgeParams 1
#define SKIP_Oct6100ApiReserveBridgeResources 1
#define SKIP_Oct6100ApiUpdateBridgeEntry 1
#define SKIP_Oct6100ConfBridgeChanAddSer 1
#define SKIP_Oct6100ApiCheckBridgeAddParams 1
#define SKIP_Oct6100ApiReserveBridgeAddResources 1
#define SKIP_Oct6100ApiBridgeEventAdd 1
#define SKIP_Oct6100ApiBridgeAddParticipantToChannel 1
#define SKIP_Oct6100ConfBridgeChanMuteSer 1
#define SKIP_Oct6100ApiCheckBridgeMuteParams 1
#define SKIP_Oct6100ApiUpdateBridgeMuteResources 1
#define SKIP_Oct6100ConfBridgeChanUnMuteSer 1
#define SKIP_Oct6100ApiCheckBridgeUnMuteParams 1
#define SKIP_Oct6100ApiUpdateBridgeUnMuteResources 1
#define SKIP_Oct6100ConfBridgeDominantSpeakerSetSer 1
#define SKIP_Oct6100ApiCheckBridgeDominantSpeakerParams 1
#define SKIP_Oct6100ApiUpdateBridgeDominantSpeakerResources 1
#define SKIP_Oct6100ConfBridgeMaskChangeSer 1
#define SKIP_Oct6100ApiCheckBridgeMaskChangeParams 1
#define SKIP_Oct6100ApiUpdateMaskModifyResources 1
#define SKIP_Oct6100ApiBridgeUpdateMask 1
#define SKIP_Oct6100ConfBridgeGetStatsSer 1
#define SKIP_Oct6100ApiReserveBridgeEntry 1
#define SKIP_Oct6100ApiReserveFlexConfParticipantEntry 1
#define SKIP_Oct6100DebugSelectChannelDef 1
#define SKIP_Oct6100DebugSelectChannel 1
#define SKIP_Oct6100DebugGetDataDef 1
#define SKIP_Oct6100DebugGetData 1
#define SKIP_Oct6100DebugSelectChannelSer 1
#define SKIP_Oct6100DebugGetDataSer 1
#define SKIP_Oct6100BufferPlayoutGetEventDef 1
#define SKIP_Oct6100BufferPlayoutGetEvent 1
#define SKIP_Oct6100BufferPlayoutGetEventSer 1
#define SKIP_Oct6100InterruptConfigureDef 1
#define SKIP_Oct6100InterruptConfigure 1
#define SKIP_Oct6100ApiReserveBufferPlayoutMemoryNode 1
#define SKIP_Oct6100ApiReleaseBufferPlayoutMemoryNode 1
#define SKIP_Oct6100ApiReserveBufferPlayoutMemory 1
#define SKIP_Oct6100ApiReleaseBufferPlayoutMemory 1
#define SKIP_Oct6100ApiCreateFeatureMask 1
#define SKIP_Oct6100MixerCopyEventCreateDef 1
#define SKIP_Oct6100MixerCopyEventCreate 1
#define SKIP_Oct6100MixerCopyEventDestroyDef 1
#define SKIP_Oct6100MixerCopyEventDestroy 1
#define SKIP_Oct6100MixerCopyEventCreateSer 1
#define SKIP_Oct6100ApiCheckCopyEventCreateParams 1
#define SKIP_Oct6100ApiReserveCopyEventCreateResources 1
#define SKIP_Oct6100ApiWriteCopyEventCreateStructs 1
#define SKIP_Oct6100ApiUpdateCopyEventCreateEntry 1
#define SKIP_Oct6100MixerCopyEventDestroySer 1
#define SKIP_Oct6100ApiAssertCopyEventDestroyParams 1
#define SKIP_Oct6100ApiInvalidateCopyEventStructs 1
#define SKIP_Oct6100ApiReleaseCopyEventResources 1
#define SKIP_Oct6100ApiReserveCopyEventEntry 1
#define SKIP_Oct6100ApiReleaseCopyEventEntry 1
#define SKIP_Oct6100PhasingTsstOpenDef 1
#define SKIP_Oct6100PhasingTsstOpen 1
#define SKIP_Oct6100PhasingTsstCloseDef 1
#define SKIP_Oct6100PhasingTsstClose 1
#define SKIP_Oct6100PhasingTsstOpenSer 1
#define SKIP_Oct6100ApiCheckPhasingParams 1
#define SKIP_Oct6100ApiReservePhasingResources 1
#define SKIP_Oct6100ApiWritePhasingStructs 1
#define SKIP_Oct6100ApiUpdatePhasingEntry 1
#define SKIP_Oct6100PhasingTsstCloseSer 1
#define SKIP_Oct6100ApiAssertPhasingParams 1
#define SKIP_Oct6100ApiInvalidatePhasingStructs 1
#define SKIP_Oct6100ApiReleasePhasingResources 1
#define SKIP_Oct6100ApiReservePhasingEntry 1
#define SKIP_Oct6100ApiReleasePhasingEntry 1
#define SKIP_Oct6100BufferPlayoutLoadDef 1
#define SKIP_Oct6100BufferPlayoutLoad 1
#define SKIP_Oct6100BufferPlayoutLoadBlockInitDef 1
#define SKIP_Oct6100BufferPlayoutLoadBlockInit 1
#define SKIP_Oct6100BufferPlayoutLoadBlockDef 1
#define SKIP_Oct6100BufferPlayoutLoadBlock 1
#define SKIP_Oct6100BufferPlayoutUnloadDef 1
#define SKIP_Oct6100BufferPlayoutUnload 1
#define SKIP_Oct6100BufferPlayoutAddDef 1
#define SKIP_Oct6100BufferPlayoutAdd 1
#define SKIP_Oct6100BufferPlayoutStartDef 1
#define SKIP_Oct6100BufferPlayoutStart 1
#define SKIP_Oct6100BufferPlayoutStop 1
#define SKIP_Oct6100BufferLoadSer 1
#define SKIP_Oct6100BufferLoadBlockInitSer 1
#define SKIP_Oct6100BufferLoadBlockSer 1
#define SKIP_Oct6100ApiCheckBufferParams 1
#define SKIP_Oct6100ApiCheckBufferLoadBlockParams 1
#define SKIP_Oct6100ApiReserveBufferResources 1
#define SKIP_Oct6100ApiWriteBufferInMemory 1
#define SKIP_Oct6100ApiUpdateBufferEntry 1
#define SKIP_Oct6100BufferUnloadSer 1
#define SKIP_Oct6100ApiAssertBufferParams 1
#define SKIP_Oct6100ApiReleaseBufferResources 1
#define SKIP_Oct6100BufferPlayoutAddSer 1
#define SKIP_Oct6100ApiCheckPlayoutAddParams 1
#define SKIP_Oct6100ApiWriteBufferAddStructs 1
#define SKIP_Oct6100BufferPlayoutStartSer 1
#define SKIP_Oct6100ApiCheckPlayoutStartParams 1
#define SKIP_Oct6100ApiWriteChanPlayoutStructs 1
#define SKIP_Oct6100ApiReserveBufPlayoutListEntry 1
#define SKIP_Oct6100ApiReleaseBufPlayoutListEntry 1
#define SKIP_Oct6100RemoteDebugDef 1
#define SKIP_Oct6100RemoteDebug 1
#define SKIP_Oct6100ApiCheckEndianDetectField 1
#define SKIP_Oct6100ApiCalculateChecksum 1
#define SKIP_Oct6100ApiFormResponsePkt 1
#define SKIP_Oct6100ApiCheckPktCommands 1
#define SKIP_Oct6100ApiExecutePktCommands 1
#define SKIP_Oct6100ApiCheckSessionNum 1
#define SKIP_Oct6100ApiRpcReadWord 1
#define SKIP_Oct6100ApiRpcReadBurst 1
#define SKIP_Oct6100ApiRpcReadArray 1
#define SKIP_Oct6100ApiRpcWriteWord 1
#define SKIP_Oct6100ApiRpcWriteSmear 1
#define SKIP_Oct6100ApiRpcWriteBurst 1
#define SKIP_Oct6100ApiRpcSetHotChannel 1
#define SKIP_Oct6100ApiRpcGetDebugChanIndex 1
#define SKIP_Oct6100ApiRpcDisconnect 1
#define SKIP_Oct6100ToneDetectionDisable 1
#define SKIP_Oct6100TsiCnctOpenDef 1
#define SKIP_Oct6100TsiCnctOpen 1
#define SKIP_Oct6100TsiCnctCloseDef 1
#define SKIP_Oct6100TsiCnctClose 1
#define SKIP_Oct6100TsiCnctOpenSer 1
#define SKIP_Oct6100ApiCheckTsiParams 1
#define SKIP_Oct6100ApiReserveTsiResources 1
#define SKIP_Oct6100ApiWriteTsiStructs 1
#define SKIP_Oct6100ApiUpdateTsiEntry 1
#define SKIP_Oct6100TsiCnctCloseSer 1
#define SKIP_Oct6100ApiAssertTsiParams 1
#define SKIP_Oct6100ApiInvalidateTsiStructs 1
#define SKIP_Oct6100ApiReleaseTsiResources 1
#define SKIP_Oct6100ApiReserveTsiCnctEntry 1
#define SKIP_Oct6100ApiReleaseTsiCnctEntry 1
#define SKIP_Oct6100UserDriverWriteOs 1
#define SKIP_Oct6100UserDriverWriteSmearOs 1
#define SKIP_Oct6100UserDriverWriteBurstOs 1
#define SKIP_Oct6100UserDriverReadOs 1
#define SKIP_Oct6100UserDriverReadBurstOs 1
#define SKIP_OctApiBt0AddNode 1
#define SKIP_OctApiBt0AddNode2 1
#define SKIP_OctApiBt0AddNode3 1
#define SKIP_OctApiBt0AddNode4 1
#define SKIP_OctApiBt0KeyCompare 1
#define SKIP_OctApiBt0UpdateLinkDepth 1
#define SKIP_OctApiBt0Rebalance 1
#define SKIP_OctApiBt0ExternalHeavy 1
#define SKIP_OctApiBt0RemoveNode2 1
#define SKIP_OctApiBt0RemoveNode3 1
#define SKIP_OctApiBt0RemoveNode 1
#define SKIP_OctApiBt0QueryNode2 1
#define SKIP_OctApiBt0QueryNode 1
#define SKIP_OctApiBt0GetFirstNode 1
#define SKIP_OctApiBt0FindOrAddNode 1
#define SKIP_OctApiBt0AddNodeReportPrevNodeData 1
#define SKIP_OctApiLmCompare 1
#define SKIP_OctApiLmMultiply 1
#define SKIP_OctApiLmDivide 1
#define SKIP_OctApiLmShiftRight1 1
#define SKIP_OctApiLmShiftn 1
#define SKIP_OctApiLmGetMsb 1
#define SKIP_OctApiTllmAllocGetSize 1
#define SKIP_OctApiTllmAllocInit 1
#define SKIP_OctApiTllmAllocInfo 1
#define SKIP_OctApiTllmAllocAlloc 1
#define SKIP_OctApiTllmAllocDealloc 1
#define SKIP_OctApiTllmCheckTimeoutList 1
#define SKIP_OctApiLlmListGetSize 1
#define SKIP_OctApiLlmListGetItemPointer 1
#define SKIP_OctApiLlmListInit 1
#define SKIP_OctApiLlmListInfo 1
#define SKIP_OctApiLlmListCreate 1
#define SKIP_OctApiLlmListDelete 1
#define SKIP_OctApiLlmListLength 1
#define SKIP_OctApiLlmListItemData 1
#define SKIP_OctApiLlmListInsertItem 1
#define SKIP_OctApiLlmListCreateFull 1
#define SKIP_OctApiLlmListAppendItems 1
#define SKIP_OctApiLlmListAppendAndSetItems 1
#define SKIP_OctApiLlmListSetItems 1
#define SKIP_OctApiLlmListCopyData 1
#define SKIP_OctApiLlmListRemoveItem 1
#define SKIP_OctApiLlm2ListGetSize 1
#define SKIP_OctApiLlm2ListGetItemPointer 1
#define SKIP_OctApiLlm2ListInit 1
#define SKIP_OctApiLlm2ListCreate 1
#define SKIP_OctApiLlm2ListDelete 1
#define SKIP_OctApiLlm2ListLength 1
#define SKIP_OctApiLlm2ListItemData 1
#define SKIP_OctApiLlm2ListInsertItem 1
#define SKIP_OctApiLlm2ListRemoveItem 1
#define SKIP_OctApiLlmMemCpy 1
#endif

View File

@ -0,0 +1,74 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_adpcm_chan_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_adpcm_chan.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_adpcm_chan_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 6 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_ADPCM_CHAN_INST_H__
#define __OCT6100_ADPCM_CHAN_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_ADPCM_CHAN_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Count used to manage entry handles allocated to user. */
UINT8 byEntryOpenCnt;
/* TSI chariot memory entry. */
UINT16 usTsiMemIndex;
/* ADPCM memory entry. */
UINT16 usAdpcmMemIndex;
/* Input and output timeslot information. */
UINT16 usInputTimeslot;
UINT16 usInputStream;
UINT8 byInputNumTssts;
UINT8 byInputPcmLaw;
UINT16 usOutputTimeslot;
UINT16 usOutputStream;
UINT8 byOutputNumTssts;
UINT8 byOutputPcmLaw;
/* Internal info for quick access to structures associated to this TSI cnct. */
UINT16 usInputTsstIndex;
UINT16 usOutputTsstIndex;
} tOCT6100_API_ADPCM_CHAN, *tPOCT6100_API_ADPCM_CHAN;
#endif /* __OCT6100_ADPCM_CHAN_INST_H__ */

View File

@ -0,0 +1,90 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_adpcm_chan_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_adpcm_chan.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_adpcm_chan_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 5 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_ADPCM_CHAN_PUB_H__
#define __OCT6100_ADPCM_CHAN_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_ADPCM_CHAN_OPEN_
{
PUINT32 pulChanHndl;
UINT32 ulInputTimeslot;
UINT32 ulInputStream;
UINT32 ulInputNumTssts;
UINT32 ulInputPcmLaw;
UINT32 ulOutputTimeslot;
UINT32 ulOutputStream;
UINT32 ulOutputNumTssts;
UINT32 ulOutputPcmLaw;
UINT32 ulChanMode; /* Encoding or decoding. */
UINT32 ulEncodingRate;
UINT32 ulDecodingRate;
UINT32 ulAdpcmNibblePosition;
} tOCT6100_ADPCM_CHAN_OPEN, *tPOCT6100_ADPCM_CHAN_OPEN;
typedef struct _OCT6100_ADPCM_CHAN_CLOSE_
{
UINT32 ulChanHndl;
} tOCT6100_ADPCM_CHAN_CLOSE, *tPOCT6100_ADPCM_CHAN_CLOSE;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100AdpcmChanOpenDef(
OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen );
UINT32 Oct6100AdpcmChanOpen(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen );
UINT32 Oct6100AdpcmChanCloseDef(
OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose );
UINT32 Oct6100AdpcmChanClose(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose );
#endif /* __OCT6100_ADPCM_CHAN_PUB_H__ */

View File

@ -0,0 +1,84 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_api.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Header file containing all definitions used throughout the API.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 23 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_API_H__
#define __OCT6100_API_H__
#ifdef __cplusplus
extern "C" {
#endif
/***************************** INCLUDE FILES *******************************/
#include "octdef.h"
#include "oct6100_defines.h"
#include "oct6100_errors.h"
#include "oct6100_apiud.h"
#include "oct6100_tlv_inst.h"
#include "oct6100_chip_stats_inst.h"
#include "oct6100_tsi_cnct_inst.h"
#include "oct6100_mixer_inst.h"
#include "oct6100_events_inst.h"
#include "oct6100_tone_detection_inst.h"
#include "oct6100_conf_bridge_inst.h"
#include "oct6100_playout_buf_inst.h"
#include "oct6100_adpcm_chan_inst.h"
#include "oct6100_phasing_tsst_inst.h"
#include "oct6100_channel_inst.h"
#include "oct6100_interrupts_inst.h"
#include "oct6100_remote_debug_inst.h"
#include "oct6100_debug_inst.h"
#include "oct6100_chip_open_inst.h"
#include "oct6100_api_inst.h"
#include "oct6100_interrupts_pub.h"
#include "oct6100_tsi_cnct_pub.h"
#include "oct6100_events_pub.h"
#include "oct6100_tone_detection_pub.h"
#include "oct6100_mixer_pub.h"
#include "oct6100_conf_bridge_pub.h"
#include "oct6100_playout_buf_pub.h"
#include "oct6100_channel_pub.h"
#include "oct6100_remote_debug_pub.h"
#include "oct6100_debug_pub.h"
#include "oct6100_chip_open_pub.h"
#include "oct6100_chip_stats_pub.h"
#include "oct6100_adpcm_chan_pub.h"
#include "oct6100_phasing_tsst_pub.h"
#ifdef __cplusplus
}
#endif
#endif /* __OCT6100_API_H__ */

View File

@ -0,0 +1,138 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_api_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing the definition of the API instance structure.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 40 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_API_INST_H__
#define __OCT6100_API_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_SHARED_INFO_
{
/* Local copy of chip configuration structure. */
tOCT6100_API_CHIP_CONFIG ChipConfig;
/* Miscellaneous calculations and mapping of static structures in external memory. */
tOCT6100_API_MISCELLANEOUS MiscVars;
tOCT6100_API_MEMORY_MAP MemoryMap;
/* Error stats structure. */
tOCT6100_API_CHIP_ERROR_STATS ErrorStats;
tOCT6100_API_CHIP_STATS ChipStats;
/* Mixer information. */
tOCT6100_API_MIXER MixerInfo;
/* Image breakdown information. */
tOCT6100_API_IMAGE_REGION ImageRegion[ cOCT6100_MAX_IMAGE_REGION ];
tOCT6100_API_IMAGE_INFO ImageInfo;
/* Configuration and management of interrupts. */
tOCT6100_API_INTRPT_CONFIG IntrptConfig;
tOCT6100_API_INTRPT_MANAGE IntrptManage;
/* Remote debugging. */
tOCT6100_API_REMOTE_DEBUG_INFO RemoteDebugInfo;
/* Chip debugging information. */
tOCT6100_API_DEBUG DebugInfo;
/* Management variables of software and hardware buffers. */
tOCT6100_API_SOFT_BUFS SoftBufs;
/* Caller buffer playout memory management structure. */
tOCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO PlayoutInfo;
UINT32 ulChannelListOfst;
UINT32 ulChannelAllocOfst;
UINT32 ulConversionMemoryAllocOfst;
UINT32 ulTsiMemoryAllocOfst;
UINT32 ulExtraTsiMemoryAllocOfst;
UINT32 ulEchoMemoryAllocOfst;
UINT32 ulTsstAllocOfst;
UINT32 ulTsstListOfst;
UINT32 ulTsstListAllocOfst;
UINT32 ulTsiCnctListOfst;
UINT32 ulTsiCnctAllocOfst;
UINT32 ulMixerEventListOfst;
UINT32 ulMixerEventAllocOfst;
UINT32 ulCopyEventListOfst;
UINT32 ulCopyEventAllocOfst;
UINT32 ulBiDirChannelListOfst;
UINT32 ulBiDirChannelAllocOfst;
UINT32 ulConfBridgeListOfst;
UINT32 ulConfBridgeAllocOfst;
UINT32 ulFlexConfParticipantListOfst;
UINT32 ulFlexConfParticipantAllocOfst;
UINT32 ulPlayoutBufListOfst;
UINT32 ulPlayoutBufAllocOfst;
UINT32 ulPlayoutBufMemoryNodeListOfst;
UINT32 ulAdpcmChanListOfst;
UINT32 ulAdpcmChanAllocOfst;
UINT32 ulPhasingTsstListOfst;
UINT32 ulPhasingTsstAllocOfst;
} tOCT6100_SHARED_INFO, *tPOCT6100_SHARED_INFO;
typedef struct _OCT6100_INSTANCE_API_
{
/* Pointer to portion of API instance structure shared amongst all processes. */
tPOCT6100_SHARED_INFO pSharedInfo;
/* Pointer to user-supplied, process context structure. The structure is
a parameter to all user-supplied functions. */
PVOID pProcessContext;
/* Handles to all serialization objects used by the API. */
tOCT6100_USER_SERIAL_OBJECT ulApiSerObj;
} tOCT6100_INSTANCE_API, *tPOCT6100_INSTANCE_API;
#endif /* __OCT6100_API_INST_H__ */

View File

@ -0,0 +1,69 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_apimi.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
This file contains the declaration of all functions exported from the
APIMI block. The APIMI block contains only one function:
Oct6100InterruptMask.
The function is used to mask out the interrupt pin of the chip. This
function is used when a deferred procedure call treats the interrupt (new
interrupts must not be generated until the signalled interrupt is treated).
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 6 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_APIMI_H__
#define __OCT6100_APIMI_H__
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/***************************** INCLUDE FILES *******************************/
#include "octdef.h"
/***************************** TYPES ***************************************/
typedef struct _OCT6100_INTERRUPT_MASK_
{
UINT32 ulUserChipIndex;
PVOID pProcessContext;
} tOCT6100_INTERRUPT_MASK, *tPOCT6100_INTERRUPT_MASK;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100InterruptMaskDef(
OUT tPOCT6100_INTERRUPT_MASK f_pInterruptMask );
UINT32 Oct6100InterruptMask(
IN tPOCT6100_INTERRUPT_MASK f_pInterruptMask );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __OCT6100_APIMI_H__ */

View File

@ -0,0 +1,312 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_apiud.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Header file containing the definitions and prototypes that are to be
completed by the user.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 16 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_APIUD_H__
#define __OCT6100_APIUD_H__
/***************************** INCLUDE FILES *******************************/
#include "octdef.h"
/***************************** DEFINES *************************************/
/* Determines the maximum length of a burst of reads/writes. This value must
be in the range 8 - 1024. This value obtains best performance if set to
a power of 2 (i.e. 2^n). */
#define cOCT6100_MAX_RW_ACCESSES 32
/* The define used to specify that the Oct6100SeizeSerializeObject function
is not to return until the specified serialization object has been seized. */
#define cOCT6100_WAIT_INFINITELY 0xFFFFFFFF
/* Compile option: enabling this compile option inserts code to check every
call to a user provided function to make sure the function parameters
are not changed, as required by the API specification. */
#define cOCT6100_USER_FUNCTION_CHECK
#define cOCT6100_GET_TIME_FAILED_0 0xFFFF0000
#define cOCT6100_GET_TIME_FAILED_1 0xFFFF0001
#define cOCT6100_GET_TIME_FAILED_2 0xFFFF0002
#define cOCT6100_GET_TIME_FAILED_3 0xFFFF0003
#define cOCT6100_GET_TIME_FAILED_4 0xFFFF0004
#define cOCT6100_CREATE_SERIAL_FAILED_0 0xFFFF0010
#define cOCT6100_CREATE_SERIAL_FAILED_1 0xFFFF0011
#define cOCT6100_CREATE_SERIAL_FAILED_2 0xFFFF0012
#define cOCT6100_CREATE_SERIAL_FAILED_3 0xFFFF0013
#define cOCT6100_CREATE_SERIAL_FAILED_4 0xFFFF0014
#define cOCT6100_DESTROY_SERIAL_FAILED_0 0xFFFF0020
#define cOCT6100_DESTROY_SERIAL_FAILED_1 0xFFFF0021
#define cOCT6100_DESTROY_SERIAL_FAILED_2 0xFFFF0022
#define cOCT6100_DESTROY_SERIAL_FAILED_3 0xFFFF0023
#define cOCT6100_DESTROY_SERIAL_FAILED_4 0xFFFF0024
#define cOCT6100_INVALID_SERIAL_HANDLE_0 0xFFFF0030
#define cOCT6100_INVALID_SERIAL_HANDLE_1 0xFFFF0031
#define cOCT6100_INVALID_SERIAL_HANDLE_2 0xFFFF0032
#define cOCT6100_INVALID_SERIAL_HANDLE_3 0xFFFF0033
#define cOCT6100_INVALID_SERIAL_HANDLE_4 0xFFFF0034
#define cOCT6100_RELEASE_SERIAL_FAILED_0 0xFFFF0040
#define cOCT6100_RELEASE_SERIAL_FAILED_1 0xFFFF0041
#define cOCT6100_RELEASE_SERIAL_FAILED_2 0xFFFF0042
#define cOCT6100_RELEASE_SERIAL_FAILED_3 0xFFFF0043
#define cOCT6100_RELEASE_SERIAL_FAILED_4 0xFFFF0044
#define cOCT6100_SEIZE_SERIAL_FAILED_0 0xFFFF0050
#define cOCT6100_SEIZE_SERIAL_FAILED_1 0xFFFF0051
#define cOCT6100_SEIZE_SERIAL_FAILED_2 0xFFFF0052
#define cOCT6100_SEIZE_SERIAL_FAILED_3 0xFFFF0053
#define cOCT6100_SEIZE_SERIAL_FAILED_4 0xFFFF0054
#define cOCT6100_DRIVER_WRITE_FAILED_0 0xFFFF0060
#define cOCT6100_DRIVER_WRITE_FAILED_1 0xFFFF0061
#define cOCT6100_DRIVER_WRITE_FAILED_2 0xFFFF0062
#define cOCT6100_DRIVER_WRITE_FAILED_3 0xFFFF0063
#define cOCT6100_DRIVER_WRITE_FAILED_4 0xFFFF0064
#define cOCT6100_DRIVER_WSMEAR_FAILED_0 0xFFFF0070
#define cOCT6100_DRIVER_WSMEAR_FAILED_1 0xFFFF0071
#define cOCT6100_DRIVER_WSMEAR_FAILED_2 0xFFFF0072
#define cOCT6100_DRIVER_WSMEAR_FAILED_3 0xFFFF0073
#define cOCT6100_DRIVER_WSMEAR_FAILED_4 0xFFFF0074
#define cOCT6100_DRIVER_WBURST_FAILED_0 0xFFFF0080
#define cOCT6100_DRIVER_WBURST_FAILED_1 0xFFFF0081
#define cOCT6100_DRIVER_WBURST_FAILED_2 0xFFFF0082
#define cOCT6100_DRIVER_WBURST_FAILED_3 0xFFFF0083
#define cOCT6100_DRIVER_WBURST_FAILED_4 0xFFFF0084
#define cOCT6100_DRIVER_READ_FAILED_0 0xFFFF0090
#define cOCT6100_DRIVER_READ_FAILED_1 0xFFFF0091
#define cOCT6100_DRIVER_READ_FAILED_2 0xFFFF0092
#define cOCT6100_DRIVER_READ_FAILED_3 0xFFFF0093
#define cOCT6100_DRIVER_READ_FAILED_4 0xFFFF0094
#define cOCT6100_DRIVER_RBURST_FAILED_0 0xFFFF00A0
#define cOCT6100_DRIVER_RBURST_FAILED_1 0xFFFF00A1
#define cOCT6100_DRIVER_RBURST_FAILED_2 0xFFFF00A2
#define cOCT6100_DRIVER_RBURST_FAILED_3 0xFFFF00A3
#define cOCT6100_DRIVER_RBURST_FAILED_4 0xFFFF00A4
/***************************** TYPES ***************************************/
/*Change this type if your platform uses 64bits semaphores/locks */
typedef UINT32 tOCT6100_USER_SERIAL_OBJECT;
typedef struct _OCT6100_GET_TIME_
{
PVOID pProcessContext;
UINT32 aulWallTimeUs[ 2 ];
} tOCT6100_GET_TIME, *tPOCT6100_GET_TIME;
typedef struct _OCT6100_CREATE_SERIALIZE_OBJECT_
{
PVOID pProcessContext;
PSZ pszSerialObjName;
tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl;
} tOCT6100_CREATE_SERIALIZE_OBJECT, *tPOCT6100_CREATE_SERIALIZE_OBJECT;
typedef struct _OCT6100_DESTROY_SERIALIZE_OBJECT_
{
PVOID pProcessContext;
tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl;
} tOCT6100_DESTROY_SERIALIZE_OBJECT, *tPOCT6100_DESTROY_SERIALIZE_OBJECT;
typedef struct _OCT6100_SEIZE_SERIALIZE_OBJECT_
{
PVOID pProcessContext;
tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl;
UINT32 ulTryTimeMs;
} tOCT6100_SEIZE_SERIALIZE_OBJECT, *tPOCT6100_SEIZE_SERIALIZE_OBJECT;
typedef struct _OCT6100_RELEASE_SERIALIZE_OBJECT_
{
PVOID pProcessContext;
tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl;
} tOCT6100_RELEASE_SERIALIZE_OBJECT, *tPOCT6100_RELEASE_SERIALIZE_OBJECT;
typedef struct _OCT6100_WRITE_PARAMS_
{
PVOID pProcessContext;
UINT32 ulUserChipId;
UINT32 ulWriteAddress;
UINT16 usWriteData;
} tOCT6100_WRITE_PARAMS, *tPOCT6100_WRITE_PARAMS;
typedef struct _OCT6100_WRITE_SMEAR_PARAMS_
{
PVOID pProcessContext;
UINT32 ulUserChipId;
UINT32 ulWriteAddress;
UINT32 ulWriteLength;
UINT16 usWriteData;
} tOCT6100_WRITE_SMEAR_PARAMS, *tPOCT6100_WRITE_SMEAR_PARAMS;
typedef struct _OCT6100_WRITE_BURST_PARAMS_
{
PVOID pProcessContext;
UINT32 ulUserChipId;
UINT32 ulWriteAddress;
UINT32 ulWriteLength;
PUINT16 pusWriteData;
} tOCT6100_WRITE_BURST_PARAMS, *tPOCT6100_WRITE_BURST_PARAMS;
typedef struct _OCT6100_READ_PARAMS_
{
PVOID pProcessContext;
UINT32 ulUserChipId;
UINT32 ulReadAddress;
PUINT16 pusReadData;
} tOCT6100_READ_PARAMS, *tPOCT6100_READ_PARAMS;
typedef struct _OCT6100_READ_BURST_PARAMS_
{
PVOID pProcessContext;
UINT32 ulUserChipId;
UINT32 ulReadAddress;
UINT32 ulReadLength;
PUINT16 pusReadData;
} tOCT6100_READ_BURST_PARAMS, *tPOCT6100_READ_BURST_PARAMS;
/************************** FUNCTION PROTOTYPES *****************************/
/* Time function. */
UINT32 Oct6100UserGetTime(
IN OUT tPOCT6100_GET_TIME f_pTime );
/* Memory management functions. */
UINT32 Oct6100UserMemSet(
IN PVOID f_pAddress,
IN UINT32 f_ulPattern,
IN UINT32 f_ulLength );
UINT32 Oct6100UserMemCopy(
IN PVOID f_pDestination,
IN const void *f_pSource,
IN UINT32 f_ulLength );
/* Serialization functions. */
UINT32 Oct6100UserCreateSerializeObject(
IN OUT tPOCT6100_CREATE_SERIALIZE_OBJECT f_pCreate);
UINT32 Oct6100UserDestroySerializeObject(
IN tPOCT6100_DESTROY_SERIALIZE_OBJECT f_pDestroy);
UINT32 Oct6100UserSeizeSerializeObject(
IN tPOCT6100_SEIZE_SERIALIZE_OBJECT f_pSeize);
UINT32 Oct6100UserReleaseSerializeObject(
IN tPOCT6100_RELEASE_SERIALIZE_OBJECT f_pRelease);
/* Read/Write functions.*/
UINT32 Oct6100UserDriverWriteApi(
IN tPOCT6100_WRITE_PARAMS f_pWriteParams );
UINT32 Oct6100UserDriverWriteOs(
IN tPOCT6100_WRITE_PARAMS f_pWriteParams );
UINT32 Oct6100UserDriverWriteSmearApi(
IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams );
UINT32 Oct6100UserDriverWriteSmearOs(
IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams );
UINT32 Oct6100UserDriverWriteBurstApi(
IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams );
UINT32 Oct6100UserDriverWriteBurstOs(
IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams );
UINT32 Oct6100UserDriverReadApi(
IN OUT tPOCT6100_READ_PARAMS f_pReadParams );
UINT32 Oct6100UserDriverReadOs(
IN OUT tPOCT6100_READ_PARAMS f_pReadParams );
UINT32 Oct6100UserDriverReadBurstApi(
IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams );
UINT32 Oct6100UserDriverReadBurstOs(
IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams );
#endif /* __OCT6100_APIUD_H__ */

View File

@ -0,0 +1,389 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_channel_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_channel.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_channel_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 90 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CHANNEL_INST_H__
#define __OCT6100_CHANNEL_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_CHANNEL_TDM_
{
/* Laws. */
UINT8 byRinPcmLaw;
UINT8 bySinPcmLaw;
UINT8 byRoutPcmLaw;
UINT8 bySoutPcmLaw;
/* RIN port. */
UINT16 usRinTimeslot;
UINT16 usRinStream;
/* SIN port. */
UINT16 usSinTimeslot;
UINT16 usSinStream;
/* ROUT port. */
UINT16 usRoutTimeslot;
UINT16 usRoutStream;
/* SOUT port. */
UINT16 usSoutTimeslot;
UINT16 usSoutStream;
/* ROUT broadcast info. */
UINT16 usRoutBrdcastTsstFirstEntry;
UINT16 usRoutBrdcastTsstNumEntry;
/* SOUT broadcast info. */
UINT16 usSoutBrdcastTsstFirstEntry;
UINT16 usSoutBrdcastTsstNumEntry;
UINT8 byRinNumTssts;
UINT8 bySinNumTssts;
UINT8 byRoutNumTssts;
UINT8 bySoutNumTssts;
} tOCT6100_API_CHANNEL_TDM, *tPOCT6100_API_CHANNEL_TDM;
typedef struct _OCT6100_API_CHANNEL_VQE_
{
UINT8 fEnableNlp;
UINT8 fEnableTailDisplacement;
UINT16 usTailDisplacement;
UINT16 usTailLength;
UINT8 fSinDcOffsetRemoval;
UINT8 fRinDcOffsetRemoval;
UINT8 fRinLevelControl;
UINT8 fSoutLevelControl;
UINT8 fRinAutomaticLevelControl;
UINT8 fSoutAutomaticLevelControl;
OCT_INT8 chRinAutomaticLevelControlTargetDb;
OCT_INT8 chSoutAutomaticLevelControlTargetDb;
UINT8 fRinHighLevelCompensation;
OCT_INT8 chRinHighLevelCompensationThresholdDb;
UINT8 bySoutAutomaticListenerEnhancementGainDb;
UINT8 fSoutNaturalListenerEnhancement;
UINT8 fSoutAdaptiveNoiseReduction;
UINT8 fDtmfToneRemoval;
UINT8 fAcousticEcho;
UINT8 byComfortNoiseMode;
UINT8 byNonLinearityBehaviorA;
UINT8 byNonLinearityBehaviorB;
OCT_INT8 chRinLevelControlGainDb;
OCT_INT8 chSoutLevelControlGainDb;
OCT_INT8 chDefaultErlDb;
OCT_INT8 chAecDefaultErlDb;
UINT8 fRoutNoiseReduction;
OCT_INT8 chRoutNoiseReductionLevelGainDb;
OCT_INT8 chAnrSnrEnhancementDb;
UINT8 fEnableMusicProtection;
UINT8 fIdleCodeDetection;
UINT8 byAnrVoiceNoiseSegregation;
UINT8 bySoutNaturalListenerEnhancementGainDb;
UINT16 usToneDisablerVqeActivationDelay;
UINT16 usAecTailLength;
UINT8 byDoubleTalkBehavior;
UINT8 fSoutNoiseBleaching;
UINT8 fSoutConferencingNoiseReduction;
} tOCT6100_API_CHANNEL_VQE, *tPOCT6100_API_CHANNEL_VQE;
typedef struct _OCT6100_API_CHANNEL_CODEC_
{
UINT8 byAdpcmNibblePosition;
UINT8 fEnableSilenceSuppression;
UINT8 byEncoderPort;
UINT8 byEncodingRate;
UINT8 byDecoderPort;
UINT8 byDecodingRate;
UINT8 byPhase;
UINT8 byPhasingType;
} tOCT6100_API_CHANNEL_CODEC, *tPOCT6100_API_CHANNEL_CODEC;
typedef struct _OCT6100_API_CHANNEL_
{
/*=======================================================================*/
/* Channel configuration. */
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Count used to manage entry handles allocated to user. */
UINT8 byEntryOpenCnt;
/* Is this a bidirectionnal channel? */
UINT8 fBiDirChannel;
/* Enable tone disabler? */
UINT8 fEnableToneDisabler;
/* TSI chariot memory entry for the Rin/Rout stream. */
UINT16 usRinRoutTsiMemIndex;
/* TSI chariot memory entry for the Sin/Sout stream. */
UINT16 usSinSoutTsiMemIndex;
/* Additional TSI entry used to temporarily store the SIN signal. */
UINT16 usExtraSinTsiMemIndex;
UINT16 usExtraSinTsiDependencyCnt;
/* Additional TSI entry used to temporarily store the RIN signal. */
UINT16 usExtraRinTsiMemIndex;
UINT16 usExtraRinTsiDependencyCnt;
/* Conversion chariot memory entry. */
UINT16 usRinRoutConversionMemIndex;
UINT16 usSinSoutConversionMemIndex;
/* TSST control memory entry. */
UINT16 usRinTsstIndex;
UINT16 usSinTsstIndex;
UINT16 usRoutTsstIndex;
UINT16 usSoutTsstIndex;
/* SSPX memory entry. */
UINT16 usEchoMemIndex;
/* Active mixer events count to test for last event. */
UINT16 usMixerEventCnt;
/* User channel ID, transparently passed to the user. */
UINT32 ulUserChanId;
/* Copy events. */
UINT16 usSinCopyEventIndex;
UINT16 usSoutCopyEventIndex;
/* Silence events. */
UINT16 usRinSilenceEventIndex;
UINT16 usSinSilenceEventIndex;
/* TDM configuration. */
tOCT6100_API_CHANNEL_TDM TdmConfig;
/* VQE configuration. */
tOCT6100_API_CHANNEL_VQE VqeConfig;
/* Current echo operation mode. */
UINT8 byEchoOperationMode;
/* Currently muted ports. */
UINT16 usMutedPorts;
/*=======================================================================*/
/*=======================================================================*/
/* Statistics section. */
INT16 sComfortNoiseLevel;
UINT16 usCurrentEchoDelay;
UINT16 usMaxEchoDelay;
UINT16 usNumEchoPathChanges;
UINT16 usNumEchoPathChangesOfst;
INT16 sCurrentERL;
INT16 sCurrentERLE;
INT16 sMaxERL;
INT16 sMaxERLE;
INT16 sRinLevel;
INT16 sSinLevel;
INT16 sRinAppliedGain;
INT16 sSoutAppliedGain;
UINT8 byToneDisablerStatus;
/*=======================================================================*/
/*=======================================================================*/
/* Bridge information. */
UINT16 usBridgeIndex;
UINT8 fMute;
UINT8 fTap;
UINT8 fBeingTapped;
UINT8 fCopyEventCreated;
UINT16 usLoadEventIndex;
UINT16 usSubStoreEventIndex;
UINT16 usFlexConfParticipantIndex;
UINT16 usTapBridgeIndex;
UINT16 usTapChanIndex;
/*=======================================================================*/
/*=======================================================================*/
/* Buffer playout information. */
UINT32 ulRinBufWritePtr;
UINT32 ulRinBufSkipPtr;
UINT8 fSoutBufPlaying;
UINT8 fRinBufPlaying;
UINT8 fRinBufPlayoutNotifyOnStop;
UINT8 fRinBufPlayoutRepeatUsed;
UINT32 ulSoutBufWritePtr;
UINT32 ulSoutBufSkipPtr;
UINT8 fSoutBufPlayoutNotifyOnStop;
UINT8 fSoutBufPlayoutRepeatUsed;
UINT8 fRinHardStop;
UINT8 fSoutHardStop;
UINT32 ulRinUserBufPlayoutEventId;
UINT32 ulSoutUserBufPlayoutEventId;
UINT8 byRinPlayoutStopEventType;
UINT8 bySoutPlayoutStopEventType;
UINT8 fRinBufAdded;
UINT8 fSoutBufAdded;
UINT8 fBufPlayoutActive;
/*=======================================================================*/
/*=======================================================================*/
/* Copy events information. */
/* Number of copy events created. */
UINT16 usCopyEventCnt;
/*=======================================================================*/
/*=======================================================================*/
/* Extended tone detection info. */
/* Enable extended tone detection. */
UINT8 fEnableExtToneDetection;
UINT16 usExtToneChanIndex;
UINT16 usExtToneMixerIndex;
UINT16 usExtToneTsiIndex;
/* Mode of operation of the channel based on the extended tone detection configuration. */
UINT32 ulExtToneChanMode;
/*=======================================================================*/
/* Tone detection state. */
/* This array is configured as follow. */
/* Index 0 contain event 0 to 31 and Index 1 contains event 32 - 55 */
UINT32 aulToneConf[ 2 ];
UINT32 ulLastSSToneDetected;
UINT32 ulLastSSToneTimestamp;
/*=======================================================================*/
/*=======================================================================*/
/* Index of the phasing TSST */
UINT16 usPhasingTsstIndex;
/* State of the codec structure associated to this channel. */
UINT8 fSinSoutCodecActive;
UINT8 fRinRoutCodecActive;
/* Codec configuration. */
tOCT6100_API_CHANNEL_CODEC CodecConfig;
/*=======================================================================*/
/* Nlp Conf Dword, index 0 contains the dword where the dword is located. and
index 1 is the actual value of the dword.*/
UINT32 aulNlpConfDword[ cOCT6100_MAX_NLP_CONF_DWORD ][ 2 ];
} tOCT6100_API_CHANNEL, *tPOCT6100_API_CHANNEL;
typedef struct _OCT6100_API_BIDIR_CHANNEL_
{
UINT16 usFirstChanIndex;
UINT16 usSecondChanIndex;
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Count used to manage entry handles allocated to user. */
UINT8 byEntryOpenCnt;
} tOCT6100_API_BIDIR_CHANNEL, *tPOCT6100_API_BIDIR_CHANNEL;
#endif /* __OCT6100_CHANNEL_INST_H__ */

View File

@ -0,0 +1,547 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_channel_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_channel.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_channel_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 84 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CHANNEL_PUB_H__
#define __OCT6100_CHANNEL_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
/* Channel open structures. */
typedef struct _OCT6100_CHANNEL_OPEN_TDM_
{
UINT32 ulRinNumTssts;
UINT32 ulSinNumTssts;
UINT32 ulRoutNumTssts;
UINT32 ulSoutNumTssts;
UINT32 ulSinTimeslot;
UINT32 ulSinStream;
UINT32 ulSinPcmLaw;
UINT32 ulSoutTimeslot;
UINT32 ulSoutStream;
UINT32 ulSoutPcmLaw;
UINT32 ulRinTimeslot;
UINT32 ulRinStream;
UINT32 ulRinPcmLaw;
UINT32 ulRoutTimeslot;
UINT32 ulRoutStream;
UINT32 ulRoutPcmLaw;
} tOCT6100_CHANNEL_OPEN_TDM, *tPOCT6100_CHANNEL_OPEN_TDM;
typedef struct _OCT6100_CHANNEL_OPEN_VQE_
{
BOOL fEnableNlp;
BOOL fEnableTailDisplacement;
UINT32 ulTailDisplacement;
UINT32 ulTailLength;
BOOL fSinDcOffsetRemoval;
BOOL fRinDcOffsetRemoval;
BOOL fRinLevelControl;
BOOL fSoutLevelControl;
BOOL fRinAutomaticLevelControl;
BOOL fSoutAutomaticLevelControl;
BOOL fRinHighLevelCompensation;
BOOL fAcousticEcho;
BOOL fSoutAdaptiveNoiseReduction;
BOOL fDtmfToneRemoval;
BOOL fSoutNoiseBleaching;
BOOL fSoutConferencingNoiseReduction;
UINT32 ulComfortNoiseMode;
UINT32 ulNonLinearityBehaviorA;
UINT32 ulNonLinearityBehaviorB;
INT32 lRinLevelControlGainDb;
INT32 lSoutLevelControlGainDb;
INT32 lRinAutomaticLevelControlTargetDb;
INT32 lSoutAutomaticLevelControlTargetDb;
INT32 lRinHighLevelCompensationThresholdDb;
INT32 lDefaultErlDb;
INT32 lAecDefaultErlDb;
UINT32 ulAecTailLength;
UINT32 ulSoutAutomaticListenerEnhancementGainDb;
UINT32 ulSoutNaturalListenerEnhancementGainDb;
BOOL fSoutNaturalListenerEnhancement;
BOOL fRoutNoiseReduction;
INT32 lRoutNoiseReductionLevelGainDb;
INT32 lAnrSnrEnhancementDb;
UINT32 ulAnrVoiceNoiseSegregation;
UINT32 ulDoubleTalkBehavior;
UINT32 ulToneDisablerVqeActivationDelay;
BOOL fEnableMusicProtection;
BOOL fIdleCodeDetection;
} tOCT6100_CHANNEL_OPEN_VQE, *tPOCT6100_CHANNEL_OPEN_VQE;
typedef struct _OCT6100_CHANNEL_OPEN_CODEC_
{
UINT32 ulAdpcmNibblePosition;
UINT32 ulEncoderPort;
UINT32 ulEncodingRate;
UINT32 ulDecoderPort;
UINT32 ulDecodingRate;
BOOL fEnableSilenceSuppression;
UINT32 ulPhase;
UINT32 ulPhasingType;
UINT32 ulPhasingTsstHndl;
} tOCT6100_CHANNEL_OPEN_CODEC, *tPOCT6100_CHANNEL_OPEN_CODEC;
typedef struct _OCT6100_CHANNEL_OPEN_
{
PUINT32 pulChannelHndl;
UINT32 ulUserChanId;
UINT32 ulEchoOperationMode;
BOOL fEnableToneDisabler;
BOOL fEnableExtToneDetection;
tOCT6100_CHANNEL_OPEN_TDM TdmConfig;
tOCT6100_CHANNEL_OPEN_VQE VqeConfig;
tOCT6100_CHANNEL_OPEN_CODEC CodecConfig;
} tOCT6100_CHANNEL_OPEN, *tPOCT6100_CHANNEL_OPEN;
/* Channel close structure. */
typedef struct _OCT6100_CHANNEL_CLOSE_
{
UINT32 ulChannelHndl;
} tOCT6100_CHANNEL_CLOSE, *tPOCT6100_CHANNEL_CLOSE;
/* Channel modify structures. */
typedef struct _OCT6100_CHANNEL_MODIFY_TDM_
{
UINT32 ulRinNumTssts;
UINT32 ulSinNumTssts;
UINT32 ulRoutNumTssts;
UINT32 ulSoutNumTssts;
UINT32 ulSinTimeslot;
UINT32 ulSinStream;
UINT32 ulSinPcmLaw;
UINT32 ulSoutTimeslot;
UINT32 ulSoutStream;
UINT32 ulSoutPcmLaw;
UINT32 ulRinTimeslot;
UINT32 ulRinStream;
UINT32 ulRinPcmLaw;
UINT32 ulRoutTimeslot;
UINT32 ulRoutStream;
UINT32 ulRoutPcmLaw;
} tOCT6100_CHANNEL_MODIFY_TDM, *tPOCT6100_CHANNEL_MODIFY_TDM;
typedef struct _OCT6100_CHANNEL_MODIFY_VQE_
{
BOOL fEnableNlp;
BOOL fEnableTailDisplacement;
UINT32 ulTailDisplacement;
BOOL fSinDcOffsetRemoval;
BOOL fRinDcOffsetRemoval;
BOOL fRinLevelControl;
BOOL fSoutLevelControl;
BOOL fRinAutomaticLevelControl;
BOOL fSoutAutomaticLevelControl;
BOOL fRinHighLevelCompensation;
BOOL fAcousticEcho;
BOOL fSoutAdaptiveNoiseReduction;
BOOL fDtmfToneRemoval;
BOOL fSoutConferencingNoiseReduction;
BOOL fSoutNoiseBleaching;
UINT32 ulNonLinearityBehaviorA;
UINT32 ulNonLinearityBehaviorB;
UINT32 ulComfortNoiseMode;
INT32 lRinLevelControlGainDb;
INT32 lSoutLevelControlGainDb;
INT32 lRinAutomaticLevelControlTargetDb;
INT32 lSoutAutomaticLevelControlTargetDb;
INT32 lRinHighLevelCompensationThresholdDb;
INT32 lDefaultErlDb;
INT32 lAecDefaultErlDb;
UINT32 ulAecTailLength;
UINT32 ulSoutAutomaticListenerEnhancementGainDb;
UINT32 ulSoutNaturalListenerEnhancementGainDb;
BOOL fSoutNaturalListenerEnhancement;
BOOL fRoutNoiseReduction;
INT32 lRoutNoiseReductionLevelGainDb;
INT32 lAnrSnrEnhancementDb;
UINT32 ulAnrVoiceNoiseSegregation;
UINT32 ulDoubleTalkBehavior;
UINT32 ulToneDisablerVqeActivationDelay;
BOOL fEnableMusicProtection;
BOOL fIdleCodeDetection;
} tOCT6100_CHANNEL_MODIFY_VQE, *tPOCT6100_CHANNEL_MODIFY_VQE;
typedef struct _OCT6100_CHANNEL_MODIFY_CODEC_
{
UINT32 ulEncoderPort;
UINT32 ulEncodingRate;
UINT32 ulDecoderPort;
UINT32 ulDecodingRate;
BOOL fEnableSilenceSuppression;
UINT32 ulPhase;
UINT32 ulPhasingType;
UINT32 ulPhasingTsstHndl;
} tOCT6100_CHANNEL_MODIFY_CODEC, *tPOCT6100_CHANNEL_MODIFY_CODEC;
typedef struct _OCT6100_CHANNEL_MODIFY_
{
UINT32 ulChannelHndl;
UINT32 ulUserChanId;
UINT32 ulEchoOperationMode;
BOOL fEnableToneDisabler;
BOOL fApplyToAllChannels;
BOOL fDisableToneDetection;
BOOL fStopBufferPlayout;
BOOL fRemoveConfBridgeParticipant;
BOOL fRemoveBroadcastTssts;
BOOL fTdmConfigModified; /* TRUE/FALSE */
BOOL fVqeConfigModified; /* TRUE/FALSE */
BOOL fCodecConfigModified; /* TRUE/FALSE */
tOCT6100_CHANNEL_MODIFY_TDM TdmConfig;
tOCT6100_CHANNEL_MODIFY_VQE VqeConfig;
tOCT6100_CHANNEL_MODIFY_CODEC CodecConfig;
} tOCT6100_CHANNEL_MODIFY, *tPOCT6100_CHANNEL_MODIFY;
typedef struct _OCT6100_CHANNEL_BROADCAST_TSST_ADD_
{
UINT32 ulChannelHndl;
UINT32 ulPort;
UINT32 ulTimeslot;
UINT32 ulStream;
} tOCT6100_CHANNEL_BROADCAST_TSST_ADD, *tPOCT6100_CHANNEL_BROADCAST_TSST_ADD;
typedef struct _OCT6100_CHANNEL_BROADCAST_TSST_REMOVE_
{
UINT32 ulChannelHndl;
UINT32 ulPort;
UINT32 ulTimeslot;
UINT32 ulStream;
BOOL fRemoveAll;
} tOCT6100_CHANNEL_BROADCAST_TSST_REMOVE, *tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE;
/* Channel open structures.*/
typedef struct _OCT6100_CHANNEL_STATS_TDM_
{
UINT32 ulMaxBroadcastTssts;
UINT32 ulNumRoutBroadcastTssts;
BOOL fMoreRoutBroadcastTssts;
UINT32 ulNumSoutBroadcastTssts;
BOOL fMoreSoutBroadcastTssts;
UINT32 ulSinNumTssts;
UINT32 ulSoutNumTssts;
UINT32 ulRinNumTssts;
UINT32 ulRoutNumTssts;
UINT32 ulSinTimeslot;
UINT32 ulSinStream;
UINT32 ulSinPcmLaw;
UINT32 ulSoutTimeslot;
UINT32 ulSoutStream;
UINT32 ulSoutPcmLaw;
PUINT32 pulSoutBroadcastTimeslot;
PUINT32 pulSoutBroadcastStream;
UINT32 ulRinTimeslot;
UINT32 ulRinStream;
UINT32 ulRinPcmLaw;
UINT32 ulRoutTimeslot;
UINT32 ulRoutStream;
UINT32 ulRoutPcmLaw;
PUINT32 pulRoutBroadcastTimeslot;
PUINT32 pulRoutBroadcastStream;
} tOCT6100_CHANNEL_STATS_TDM, *tPOCT6100_CHANNEL_STATS_TDM;
typedef struct _OCT6100_CHANNEL_STATS_VQE_
{
BOOL fEnableNlp;
BOOL fEnableTailDisplacement;
UINT32 ulTailDisplacement;
UINT32 ulTailLength;
BOOL fSinDcOffsetRemoval;
BOOL fRinDcOffsetRemoval;
BOOL fRinLevelControl;
BOOL fSoutLevelControl;
BOOL fRinAutomaticLevelControl;
BOOL fSoutAutomaticLevelControl;
BOOL fRinHighLevelCompensation;
BOOL fAcousticEcho;
BOOL fSoutAdaptiveNoiseReduction;
BOOL fDtmfToneRemoval;
BOOL fSoutConferencingNoiseReduction;
BOOL fSoutNoiseBleaching;
UINT32 ulComfortNoiseMode;
UINT32 ulNonLinearityBehaviorA;
UINT32 ulNonLinearityBehaviorB;
INT32 lRinLevelControlGainDb;
INT32 lSoutLevelControlGainDb;
INT32 lRinAutomaticLevelControlTargetDb;
INT32 lSoutAutomaticLevelControlTargetDb;
INT32 lRinHighLevelCompensationThresholdDb;
INT32 lDefaultErlDb;
INT32 lAecDefaultErlDb;
UINT32 ulAecTailLength;
UINT32 ulSoutAutomaticListenerEnhancementGainDb;
UINT32 ulSoutNaturalListenerEnhancementGainDb;
BOOL fSoutNaturalListenerEnhancement;
BOOL fRoutNoiseReduction;
INT32 lRoutNoiseReductionLevelGainDb;
INT32 lAnrSnrEnhancementDb;
UINT32 ulAnrVoiceNoiseSegregation;
UINT32 ulDoubleTalkBehavior;
UINT32 ulToneDisablerVqeActivationDelay;
BOOL fEnableMusicProtection;
BOOL fIdleCodeDetection;
} tOCT6100_CHANNEL_STATS_VQE, *tPOCT6100_CHANNEL_STATS_VQE;
typedef struct _OCT6100_CHANNEL_STATS_CODEC_
{
UINT32 ulAdpcmNibblePosition;
UINT32 ulEncoderPort;
UINT32 ulEncodingRate;
UINT32 ulDecoderPort;
UINT32 ulDecodingRate;
BOOL fEnableSilenceSuppression;
UINT32 ulPhase;
UINT32 ulPhasingType;
UINT32 ulPhasingTsstHndl;
} tOCT6100_CHANNEL_STATS_CODEC, *tPOCT6100_CHANNEL_STATS_CODEC;
typedef struct _OCT6100_CHANNEL_STATS_
{
BOOL fResetStats;
UINT32 ulChannelHndl;
UINT32 ulUserChanId;
UINT32 ulEchoOperationMode;
BOOL fEnableToneDisabler;
UINT32 ulMutePortsMask;
BOOL fEnableExtToneDetection;
tOCT6100_CHANNEL_STATS_TDM TdmConfig;
tOCT6100_CHANNEL_STATS_VQE VqeConfig;
tOCT6100_CHANNEL_STATS_CODEC CodecConfig;
/* Real stats. */
UINT32 ulNumEchoPathChanges;
UINT32 ulToneDisablerStatus;
INT32 lCurrentERL;
INT32 lCurrentERLE;
UINT32 ulCurrentEchoDelay;
INT32 lMaxERL;
INT32 lMaxERLE;
UINT32 ulMaxEchoDelay;
INT32 lRinLevel;
INT32 lSinLevel;
INT32 lRinAppliedGain;
INT32 lSoutAppliedGain;
INT32 lComfortNoiseLevel;
BOOL fEchoCancellerConverged;
BOOL fSinVoiceDetected;
} tOCT6100_CHANNEL_STATS, *tPOCT6100_CHANNEL_STATS;
typedef struct _OCT6100_CHANNEL_CREATE_BIDIR_
{
PUINT32 pulBiDirChannelHndl;
UINT32 ulFirstChannelHndl;
UINT32 ulSecondChannelHndl;
} tOCT6100_CHANNEL_CREATE_BIDIR, *tPOCT6100_CHANNEL_CREATE_BIDIR;
typedef struct _OCT6100_CHANNEL_DESTROY_BIDIR_
{
UINT32 ulBiDirChannelHndl;
} tOCT6100_CHANNEL_DESTROY_BIDIR, *tPOCT6100_CHANNEL_DESTROY_BIDIR;
typedef struct _OCT6100_CHANNEL_MUTE_
{
UINT32 ulChannelHndl;
UINT32 ulPortMask;
} tOCT6100_CHANNEL_MUTE, *tPOCT6100_CHANNEL_MUTE;
typedef struct _OCT6100_CHANNEL_UNMUTE_
{
UINT32 ulChannelHndl;
UINT32 ulPortMask;
} tOCT6100_CHANNEL_UNMUTE, *tPOCT6100_CHANNEL_UNMUTE;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100ChannelOpenDef(
OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen );
UINT32 Oct6100ChannelOpen(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen );
UINT32 Oct6100ChannelCloseDef(
OUT tPOCT6100_CHANNEL_CLOSE f_pChannelClose );
UINT32 Oct6100ChannelClose(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_CLOSE f_pChannelClose );
UINT32 Oct6100ChannelModifyDef(
OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify );
UINT32 Oct6100ChannelModify(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify );
UINT32 Oct6100ChannelBroadcastTsstAddDef(
OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd );
UINT32 Oct6100ChannelBroadcastTsstAdd(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd );
UINT32 Oct6100ChannelBroadcastTsstRemoveDef(
OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove );
UINT32 Oct6100ChannelBroadcastTsstRemove(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove );
UINT32 Oct6100ChannelGetStatsDef(
OUT tPOCT6100_CHANNEL_STATS f_pChannelStats );
UINT32 Oct6100ChannelGetStats(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats );
UINT32 Oct6100ChannelCreateBiDirDef(
OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir );
UINT32 Oct6100ChannelCreateBiDir(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir );
UINT32 Oct6100ChannelDestroyBiDirDef(
OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir );
UINT32 Oct6100ChannelDestroyBiDir(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir );
UINT32 Oct6100ChannelMuteDef(
OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute );
UINT32 Oct6100ChannelMute(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute );
UINT32 Oct6100ChannelUnMuteDef(
OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute );
UINT32 Oct6100ChannelUnMute(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute );
#endif /* __OCT6100_CHANNEL_PUB_H__ */

View File

@ -0,0 +1,517 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_chip_open_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_chip_open.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_chip_open_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 122 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CHIP_OPEN_INST_H__
#define __OCT6100_CHIP_OPEN_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_CHIP_CONFIG_
{
UINT32 ulUserChipId;
PVOID pProcessContext;
unsigned char const *pbyImageFile; /* Byte pointer to the image file to be uploaded into the chip. */
UINT32 ulImageSize; /* Size of the image file (in bytes). */
UINT32 ulMemClkFreq;
UINT32 ulUpclkFreq; /* 33.33 or 66.66 MHz. */
UINT8 fEnableMemClkOut; /* TRUE/FALSE */
UINT8 fMultiProcessSystem;
UINT8 byMemoryType; /* SDRAM or DDR */
UINT8 byNumMemoryChips; /* Number of memory chips present. */
UINT32 ulMemoryChipSize; /* The size of the memory chips. */
UINT16 usMaxRwAccesses;
UINT16 usTailDisplacement;
/* Resource allocation parameters. */
UINT16 usMaxChannels;
UINT16 usMaxBiDirChannels;
UINT32 aulTdmStreamFreqs[ cOCT6100_TDM_STREAM_MAX_GROUPS ];
UINT8 byMaxTdmStreams;
UINT8 byTdmSampling;
UINT8 fEnableFastH100Mode;
UINT8 fEnableAcousticEcho; /* Acoustic echo enabled. */
UINT16 ausTimestampTimeslots[ 4 ];
UINT16 ausTimestampStreams[ 4 ];
UINT8 fUseSynchTimestamp;
/* Debug feature used to record stream information from a channel.*/
UINT8 fEnableChannelRecording;
UINT16 usMaxRemoteDebugSessions;
UINT8 byInterruptPolarity;
UINT16 usMaxTsiCncts;
UINT8 fEnableExtToneDetection;
UINT8 fEnable2100StopEvent;
UINT16 usMaxConfBridges;
UINT16 usMaxFlexibleConfParticipants;
UINT16 usMaxPlayoutBuffers;
/* Playout event software buffer size. */
UINT32 ulSoftBufPlayoutEventsBufSize;
/* Soft buffer size. */
UINT32 ulSoftToneEventsBufSize;
UINT16 usMaxPhasingTssts;
UINT16 usMaxAdpcmChannels;
UINT8 fEnableProductionBist;
UINT32 ulProductionBistMode;
UINT32 ulNumProductionBistLoops;
} tOCT6100_API_CHIP_CONFIG, *tPOCT6100_API_CHIP_CONFIG;
typedef struct _OCT6100_API_MISCELLANEOUS_
{
/* Total size of external memories. */
UINT32 ulTotalMemSize;
UINT32 ulH100SlaveMode;
/* Mclk frequency generated by the chip. */
UINT32 ulMclkFreq;
/* Array of UINT32s used to perform a burst of writes (avoids having to
allocate on the stack. The size of this array MUST NOT CHANGE (it's
used everywhere). */
UINT16 ausSuperArray[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ];
UINT16 ausSuperArray1[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ];
UINT16 ausSuperArray2[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ];
/* Chip ID and revision.*/
UINT16 usChipId;
UINT16 usChipRevision;
/* Lsu CPU access variables.*/
UINT16 usCpuLsuWritePtr;
UINT16 usCodepoint;
/* Max number of channel supported.*/
UINT16 usMaxNumberOfChannels;
UINT16 usMaxH100Speed;
UINT16 usTdmClkBoundary;
UINT16 usNumBridgesOpened;
UINT16 usFirstBridge;
} tOCT6100_API_MISCELLANEOUS, *tPOCT6100_API_MISCELLANEOUS;
typedef struct _OCT6100_API_MEMORY_MAP_
{
/*-----------------------------------------------------------------------------*/
/* Structure contained in external memory. */
/* Memory mapping filled using TLV information from the chip. */
/* Main channel memory. */
UINT32 ulChanMainMemBase;
UINT32 ulChanMainMemSize;
UINT32 ulChanMainIoMemOfst;
UINT32 ulChanMainRinCBMemOfst;
UINT32 ulChanMainRinCBMemSize;
UINT32 ulChanMainSinCBMemOfst;
UINT32 ulChanMainSinCBMemSize;
UINT32 ulChanMainSoutCBMemOfst;
UINT32 ulChanMainSoutCBMemSize;
/* Free memory base address. */
UINT32 ulFreeMemBaseAddress;
/* Root channel config offset. */
UINT32 ulChanRootConfOfst;
/* Playout buffer info. */
UINT32 ulChanMainRinPlayoutMemOfst;
UINT32 ulChanMainRinPlayoutMemSize;
UINT32 ulChanMainSoutPlayoutMemOfst;
UINT32 ulChanMainSoutPlayoutMemSize;
/* Channel Stats location */
UINT32 ulChanMainIoStatsOfst;
UINT32 ulChanMainIoStatsSize;
/* Buffer playout fields. */
tOCT6100_TLV_OFFSET PlayoutRinWritePtrOfst;
tOCT6100_TLV_OFFSET PlayoutRinIgnoreSkipCleanOfst;
tOCT6100_TLV_OFFSET PlayoutRinSkipPtrOfst;
tOCT6100_TLV_OFFSET PlayoutSoutWritePtrOfst;
tOCT6100_TLV_OFFSET PlayoutSoutIgnoreSkipCleanOfst;
tOCT6100_TLV_OFFSET PlayoutSoutSkipPtrOfst;
tOCT6100_TLV_OFFSET PlayoutRinReadPtrOfst;
tOCT6100_TLV_OFFSET PlayoutSoutReadPtrOfst;
tOCT6100_TLV_OFFSET PlayoutRinHardSkipOfst;
tOCT6100_TLV_OFFSET PlayoutSoutHardSkipOfst;
/* Adaptive noise reduction. */
tOCT6100_TLV_OFFSET AdaptiveNoiseReductionOfst;
/* DC offset removal. */
tOCT6100_TLV_OFFSET RinDcOffsetRemovalOfst;
tOCT6100_TLV_OFFSET SinDcOffsetRemovalOfst;
/* Level control. */
tOCT6100_TLV_OFFSET RinLevelControlOfst;
tOCT6100_TLV_OFFSET SoutLevelControlOfst;
/* Auto level control. */
tOCT6100_TLV_OFFSET RinAutoLevelControlTargetOfst;
tOCT6100_TLV_OFFSET SoutAutoLevelControlTargetOfst;
/* High level compensation. */
tOCT6100_TLV_OFFSET RinHighLevelCompensationThresholdOfst;
tOCT6100_TLV_OFFSET SoutHighLevelCompensationThresholdOfst;
/* Auto level control and high level compensation status. */
tOCT6100_TLV_OFFSET AlcHlcStatusOfst;
/* Confort Noise Mode. */
tOCT6100_TLV_OFFSET ComfortNoiseModeOfst;
/* NLP control field. */
tOCT6100_TLV_OFFSET NlpControlFieldOfst;
/* VAD control field offset.*/
tOCT6100_TLV_OFFSET VadControlFieldOfst;
/* NLP Trivial field offset. */
tOCT6100_TLV_OFFSET NlpTrivialFieldOfst;
/* Acoustic echo field offset. */
tOCT6100_TLV_OFFSET AecFieldOfst;
/* Acoustic echo default ERL field offset. */
tOCT6100_TLV_OFFSET AecDefaultErlFieldOfst;
/* Non-linearity behavior A and B field offset. */
tOCT6100_TLV_OFFSET PcmLeakFieldOfst;
tOCT6100_TLV_OFFSET NlpConvCapFieldOfst;
/* Default ERL field offset. */
tOCT6100_TLV_OFFSET DefaultErlFieldOfst;
/* Tone Removal field offset.*/
tOCT6100_TLV_OFFSET ToneRemovalFieldOfst;
/* Channel config fields offset. */
tOCT6100_TLV_OFFSET ChanMainIoMaxEchoPointOfst;
tOCT6100_TLV_OFFSET TailDisplEnableOfst;
/* Pouch fields offset. */
tOCT6100_TLV_OFFSET PouchBootInstructionOfst;
tOCT6100_TLV_OFFSET PouchBootResultOfst;
tOCT6100_TLV_OFFSET PouchTailDisplOfst;
/* 2100 Hz Auto disabling fields offset. */
tOCT6100_TLV_OFFSET ToneDisablerControlOfst;
/* Conferencing dominant speaker field offset. */
tOCT6100_TLV_OFFSET DominantSpeakerFieldOfst;
/* Conferencing noise reduction field offset. */
tOCT6100_TLV_OFFSET ConferencingNoiseReductionOfst;
/* Per channel tail displacement field offset. */
tOCT6100_TLV_OFFSET PerChanTailDisplacementFieldOfst;
/* Per channel tail length field offset. */
tOCT6100_TLV_OFFSET PerChanTailLengthFieldOfst;
/* AF control/echo cancellation bypass. */
tOCT6100_TLV_OFFSET AftControlOfst;
/* Voice detected stat field offset. */
tOCT6100_TLV_OFFSET SinVoiceDetectedStatOfst;
/* Rin currently applied gain field offset. */
tOCT6100_TLV_OFFSET RinAppliedGainStatOfst;
/* Sout currently applied gain field offset. */
tOCT6100_TLV_OFFSET SoutAppliedGainStatOfst;
/* Adaptive listener enhancement field offset. */
tOCT6100_TLV_OFFSET AdaptiveAleOfst;
/* Rin NR field offset. */
tOCT6100_TLV_OFFSET RinAnrOfst;
/* Rin NR value field offset. */
tOCT6100_TLV_OFFSET RinAnrValOfst;
/* Sin Mute field offset. */
tOCT6100_TLV_OFFSET SinMuteOfst;
/* Rin Mute field offset. */
tOCT6100_TLV_OFFSET RinMuteOfst;
/* Sout ANR SNR enhancement offset. */
tOCT6100_TLV_OFFSET AnrSnrEnhancementOfst;
/* Sout ANR voice-noise segregation offset. */
tOCT6100_TLV_OFFSET AnrVoiceNoiseSegregationOfst;
/* Tone disabler VQE activation delay offset. */
tOCT6100_TLV_OFFSET ToneDisablerVqeActivationDelayOfst;
/* AF tail displacement value configuration offset. */
tOCT6100_TLV_OFFSET AfTailDisplacementFieldOfst;
/* Pouch counter field offset. */
tOCT6100_TLV_OFFSET PouchCounterFieldOfst;
/* Acoustic echo tail length. */
tOCT6100_TLV_OFFSET AecTailLengthFieldOfst;
/* Is ISR called field offset. */
tOCT6100_TLV_OFFSET IsIsrCalledFieldOfst;
/* Music protection enable field offset. */
tOCT6100_TLV_OFFSET MusicProtectionFieldOfst;
/* Rin port energy level statistics field offset. */
tOCT6100_TLV_OFFSET RinEnergyStatFieldOfst;
/* Sout port energy level statistics field offset. */
tOCT6100_TLV_OFFSET SoutEnergyStatFieldOfst;
/* Double talk behavior field offset. */
tOCT6100_TLV_OFFSET DoubleTalkBehaviorFieldOfst;
/* Idle code detection field offset. */
tOCT6100_TLV_OFFSET IdleCodeDetectionFieldOfst;
/* TSI memory mapping information.*/
UINT32 ulNumTsiEntries;
/*-----------------------------------------------------------------------------*/
} tOCT6100_API_MEMORY_MAP, *tPOCT6100_API_MEMORY_MAP;
typedef struct _OCT6100_API_SOFT_BUFS_
{
/* To avoid compilation errors. */
UINT32 ulDummyVariable;
/* Tone events buffer pointers. */
UINT32 ulToneEventBufferWritePtr;
UINT32 ulToneEventBufferReadPtr;
UINT32 ulToneEventBufferSize;
UINT32 ulToneEventBufferMemOfst;
UINT32 ulToneEventBufferOverflowCnt;
/* Playout events buffer pointers. */
UINT32 ulBufPlayoutEventBufferWritePtr;
UINT32 ulBufPlayoutEventBufferReadPtr;
UINT32 ulBufPlayoutEventBufferSize;
UINT32 ulBufPlayoutEventBufferMemOfst;
UINT32 ulBufPlayoutEventBufferOverflowCnt;
} tOCT6100_API_SOFT_BUFS, *tPOCT6100_API_SOFT_BUFS;
typedef struct _OCT6100_API_IMAGE_REGION_
{
UINT32 ulPart1Size;
UINT32 ulPart2Size;
UINT32 ulClockInfo;
UINT32 ulReserved;
UINT32 ulPart1BaseAddress;
UINT32 ulPart2BaseAddress;
} tOCT6100_API_IMAGE_REGION, *tPOCT6100_API_IMAGE_REGION;
typedef struct _OCT6100_API_IMAGE_INFO_
{
UINT8 fBufferPlayout;
UINT8 fAdaptiveNoiseReduction;
UINT8 fRinDcOffsetRemoval;
UINT8 fSinDcOffsetRemoval;
UINT8 fRinAutoLevelControl;
UINT8 fSoutAutoLevelControl;
UINT8 fRinHighLevelCompensation;
UINT8 fSoutHighLevelCompensation;
UINT8 fAlcHlcStatus;
UINT8 fComfortNoise;
UINT8 fNlpControl;
UINT8 fSilenceSuppression;
UINT8 fToneDisabler;
UINT8 fTailDisplacement;
UINT8 fPerChannelTailDisplacement;
UINT8 fAcousticEcho;
UINT8 fAecEnabled;
UINT8 fToneRemoval;
UINT8 fDefaultErl;
UINT8 fMaxEchoPoint;
UINT8 fNonLinearityBehaviorA;
UINT8 fNonLinearityBehaviorB;
UINT8 fAecDefaultErl;
UINT8 fAdpcm;
UINT8 fConferencing;
UINT8 fConferencingNoiseReduction;
UINT8 fMusicProtection;
UINT8 fDominantSpeakerEnabled;
UINT8 fAftControl;
UINT8 fSinVoiceDetectedStat;
UINT8 fRinAppliedGainStat;
UINT8 fSoutAppliedGainStat;
UINT8 fListenerEnhancement;
UINT8 fRoutNoiseReduction;
UINT8 fRoutNoiseReductionLevel;
UINT8 fRinMute;
UINT8 fSinMute;
UINT8 fAnrSnrEnhancement;
UINT8 fAnrVoiceNoiseSegregation;
UINT8 fRinBufferPlayoutHardSkip;
UINT8 fSoutBufferPlayoutHardSkip;
UINT16 usMaxNumberOfChannels;
UINT8 fPerChannelTailLength;
UINT8 fToneDisablerVqeActivationDelay;
UINT32 ulToneProfileNumber;
UINT16 usMaxTailDisplacement;
UINT16 usMaxTailLength;
UINT8 byNumToneDetectors;
UINT8 byMaxNumberPlayoutEvents;
UINT8 fAfTailDisplacement;
UINT8 fAecTailLength;
UINT8 fMusicProtectionConfiguration;
UINT8 byImageType;
UINT8 fBufferPlayoutSkipInEvents;
UINT8 fSoutNoiseBleaching;
UINT8 fRinEnergyStat;
UINT8 fSoutEnergyStat;
UINT8 fDoubleTalkBehavior;
UINT8 fDoubleTalkBehaviorFieldOfst;
UINT8 fIdleCodeDetection;
UINT8 fIdleCodeDetectionConfiguration;
UINT8 fSinLevel;
UINT8 szVersionNumber[ cOCT6100_VERSION_NUMBER_MAX_SIZE ];
UINT32 ulBuildId;
tOCT6100_TLV_TONE_INFO aToneInfo[ cOCT6100_MAX_TONE_EVENT ];
} tOCT6100_API_IMAGE_INFO, *tPOCT6100_API_IMAGE_INFO;
typedef struct _OCT6100_API_MIXER_
{
/* Pointer to the various event region. */
UINT16 usFirstSoutCopyEventPtr;
UINT16 usLastSoutCopyEventPtr;
UINT16 usFirstBridgeEventPtr;
UINT16 usLastBridgeEventPtr;
UINT16 usFirstSinCopyEventPtr;
UINT16 usLastSinCopyEventPtr;
/* Recording event info. */
UINT16 usRecordCopyEventIndex;
UINT16 usRecordSinEventIndex;
} tOCT6100_API_MIXER, tPOCT6100_API_MIXER;
typedef struct _OCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO_
{
/* Next node to be checked for free memory. */
UINT32 ulRovingNode;
/* First unused node in the unused list. */
UINT32 ulFirstUnusedNode;
/* Last unused node in the unused list. */
UINT32 ulLastUnusedNode;
/* Count of unused nodes. */
UINT32 ulUnusedNodeCnt;
} tOCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO, *tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO;
#endif /* __OCT6100_CHIP_OPEN_INST_H__ */

View File

@ -0,0 +1,241 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_chip_open_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_chip_open.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_chip_open_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 54 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CHIP_OPEN_PUB_H__
#define __OCT6100_CHIP_OPEN_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_CHIP_OPEN_
{
UINT32 ulUserChipId;
BOOL fMultiProcessSystem;
PVOID pProcessContext;
UINT32 ulMaxRwAccesses;
unsigned char const *pbyImageFile; /* Byte pointer to the image file to be uploaded into the chip. */
UINT32 ulImageSize; /* Size of the image file (in bytes). */
UINT32 ulMemClkFreq; /* 10 - 133.3 MHz. */
UINT32 ulUpclkFreq; /* 1 - 66.6 MHz. */
BOOL fEnableMemClkOut;
UINT32 ulMemoryType; /* SDRAM or DDR type external memory. */
UINT32 ulNumMemoryChips; /* Number of memory chips present. */
UINT32 ulMemoryChipSize; /* The size of the memory chips. */
UINT32 ulTailDisplacement; /* Tail displacement supported by the chip. */
BOOL fEnableAcousticEcho;/* Acoustic echo cancellation enabled. */
/* Resource allocation parameters. */
UINT32 ulMaxChannels;
UINT32 ulMaxTsiCncts;
UINT32 ulMaxBiDirChannels;
UINT32 ulMaxConfBridges;
UINT32 ulMaxFlexibleConfParticipants;
UINT32 ulMaxPlayoutBuffers;
UINT32 ulMaxPhasingTssts;
UINT32 ulMaxAdpcmChannels;
BOOL fUseSynchTimestamp;
UINT32 aulTimestampTimeslots[ 4 ];
UINT32 aulTimestampStreams[ 4 ];
UINT32 ulInterruptPolarity;
tOCT6100_INTERRUPT_CONFIGURE InterruptConfig;
UINT32 aulTdmStreamFreqs[ cOCT6100_TDM_STREAM_MAX_GROUPS ];
UINT32 ulMaxTdmStreams;
UINT32 ulTdmSampling;
BOOL fEnableFastH100Mode;
UINT32 ulSoftToneEventsBufSize; /* In events. */
BOOL fEnableExtToneDetection;
BOOL fEnable2100StopEvent;
UINT32 ulSoftBufferPlayoutEventsBufSize; /* In events. */
UINT32 ulMaxRemoteDebugSessions;
BOOL fEnableChannelRecording;
BOOL fEnableProductionBist;
UINT32 ulProductionBistMode;
UINT32 ulNumProductionBistLoops;
} tOCT6100_CHIP_OPEN, *tPOCT6100_CHIP_OPEN;
typedef struct _OCT6100_GET_INSTANCE_SIZE_
{
UINT32 ulApiInstanceSize;
} tOCT6100_GET_INSTANCE_SIZE, *tPOCT6100_GET_INSTANCE_SIZE;
typedef struct _OCT6100_CHIP_CLOSE_
{
UINT32 ulDummyVariable;
} tOCT6100_CHIP_CLOSE, *tPOCT6100_CHIP_CLOSE;
typedef struct _OCT6100_CREATE_LOCAL_INSTANCE_
{
tPOCT6100_INSTANCE_API pApiInstShared;
tPOCT6100_INSTANCE_API pApiInstLocal;
PVOID pProcessContext;
UINT32 ulUserChipId;
} tOCT6100_CREATE_LOCAL_INSTANCE, *tPOCT6100_CREATE_LOCAL_INSTANCE;
typedef struct _OCT6100_DESTROY_LOCAL_INSTANCE_
{
UINT32 ulDummy;
} tOCT6100_DESTROY_LOCAL_INSTANCE, *tPOCT6100_DESTROY_LOCAL_INSTANCE;
typedef struct _OCT6100_GET_HW_REVISION_
{
UINT32 ulUserChipId;
PVOID pProcessContext;
UINT32 ulRevisionNum;
} tOCT6100_GET_HW_REVISION, *tPOCT6100_GET_HW_REVISION;
typedef struct _OCT6100_FREE_RESOURCES_
{
BOOL fFreeTsiConnections;
BOOL fFreeConferenceBridges;
BOOL fFreePlayoutBuffers;
BOOL fFreePhasingTssts;
BOOL fFreeAdpcmChannels;
} tOCT6100_FREE_RESOURCES, *tPOCT6100_FREE_RESOURCES;
typedef struct _OCT6100_PRODUCTION_BIST_
{
UINT32 ulCurrentAddress;
UINT32 ulCurrentLoop;
UINT32 ulCurrentTest;
UINT32 ulBistStatus;
UINT32 ulFailedAddress;
UINT32 ulReadValue;
UINT32 ulExpectedValue;
} tOCT6100_PRODUCTION_BIST, *tPOCT6100_PRODUCTION_BIST;
typedef struct _OCT6100_API_GET_VERSION_
{
UINT8 achApiVersion[ cOCT6100_API_VERSION_STRING_LENGTH ];
} tOCT6100_API_GET_VERSION, *tPOCT6100_API_GET_VERSION;
typedef struct _OCT6100_API_GET_CAPACITY_PINS_
{
UINT32 ulUserChipId;
PVOID pProcessContext;
UINT32 ulMemoryType; /* SDRAM or DDR type external memory. */
BOOL fEnableMemClkOut;
UINT32 ulMemClkFreq;
UINT32 ulCapacityValue;
} tOCT6100_API_GET_CAPACITY_PINS, *tPOCT6100_API_GET_CAPACITY_PINS;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100ChipOpenDef(
OUT tPOCT6100_CHIP_OPEN f_pChipOpen );
UINT32 Oct6100ChipOpen(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHIP_OPEN f_pChipOpen );
UINT32 Oct6100ChipCloseDef(
OUT tPOCT6100_CHIP_CLOSE f_pChipClose );
UINT32 Oct6100ChipClose(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CHIP_CLOSE f_pChipClose );
UINT32 Oct6100GetInstanceSizeDef(
OUT tPOCT6100_GET_INSTANCE_SIZE f_pInstanceSize );
UINT32 Oct6100GetInstanceSize(
IN OUT tPOCT6100_CHIP_OPEN f_pChipOpen,
IN OUT tPOCT6100_GET_INSTANCE_SIZE f_pInstanceSize );
UINT32 Oct6100CreateLocalInstanceDef(
OUT tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal );
UINT32 Oct6100CreateLocalInstance(
IN OUT tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal );
UINT32 Oct6100DestroyLocalInstanceDef(
OUT tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal );
UINT32 Oct6100DestroyLocalInstance(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal );
UINT32 Oct6100ApiGetVersionDef(
OUT tPOCT6100_API_GET_VERSION f_pApiGetVersion );
UINT32 Oct6100ApiGetVersion(
IN OUT tPOCT6100_API_GET_VERSION f_pApiGetVersion );
UINT32 Oct6100GetHwRevisionDef(
OUT tPOCT6100_GET_HW_REVISION f_pRevision );
UINT32 Oct6100GetHwRevision(
IN OUT tPOCT6100_GET_HW_REVISION f_pRevision );
UINT32 Oct6100FreeResourcesDef(
OUT tPOCT6100_FREE_RESOURCES f_pFreeResources );
UINT32 Oct6100FreeResources(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_FREE_RESOURCES f_pFreeResources );
UINT32 Oct6100ProductionBistDef(
OUT tPOCT6100_PRODUCTION_BIST f_pProductionBist );
UINT32 Oct6100ProductionBist(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_PRODUCTION_BIST f_pProductionBist );
UINT32 Oct6100ApiGetCapacityPinsDef(
tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins);
UINT32 Oct6100ApiGetCapacityPins(
tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins );
#endif /* __OCT6100_CHIP_OPEN_PUB_H__ */

View File

@ -0,0 +1,84 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_chip_stats_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_chip_stats.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_chip_stats_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 21 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CHIP_STATS_INST_H__
#define __OCT6100_CHIP_STATS_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_CHIP_ERROR_STATS_
{
UINT8 fFatalChipError;
UINT32 ulInternalReadTimeoutCnt;
UINT32 ulSdramRefreshTooLateCnt;
UINT32 ulPllJitterErrorCnt;
/* Internal tone detector error counter. */
UINT32 ulToneDetectorErrorCnt;
UINT32 ulOverflowToneEventsCnt;
UINT32 ulH100OutOfSyncCnt;
UINT32 ulH100ClkABadCnt;
UINT32 ulH100ClkBBadCnt;
UINT32 ulH100FrameABadCnt;
} tOCT6100_API_CHIP_ERROR_STATS, *tPOCT6100_API_CHIP_ERROR_STATS;
typedef struct _OCT6100_API_CHIP_STATS_
{
UINT16 usNumberChannels;
UINT16 usNumberBiDirChannels;
UINT16 usNumberTsiCncts;
UINT16 usNumberConfBridges;
UINT16 usNumberPlayoutBuffers;
UINT16 usNumEcChanUsingMixer;
UINT32 ulPlayoutMemUsed;
UINT16 usNumberActiveBufPlayoutPorts;
UINT16 usNumberPhasingTssts;
UINT16 usNumberAdpcmChans;
} tOCT6100_API_CHIP_STATS, *tPOCT6100_API_CHIP_STATS;
#endif /* __OCT6100_CHIP_STATS_INST_H__ */

View File

@ -0,0 +1,150 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_chip_stats_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_chip_stats.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_chip_stats_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 59 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CHIP_STATS_PUB_H__
#define __OCT6100_CHIP_STATS_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_CHIP_STATS_
{
BOOL fResetChipStats;
UINT32 ulNumberChannels;
UINT32 ulNumberTsiCncts;
UINT32 ulNumberConfBridges;
UINT32 ulNumberPlayoutBuffers;
UINT32 ulPlayoutFreeMemSize;
UINT32 ulNumberPhasingTssts;
UINT32 ulNumberAdpcmChannels;
UINT32 ulH100OutOfSynchCount;
UINT32 ulH100ClockABadCount;
UINT32 ulH100FrameABadCount;
UINT32 ulH100ClockBBadCount;
UINT32 ulInternalReadTimeoutCount;
UINT32 ulSdramRefreshTooLateCount;
UINT32 ulPllJitterErrorCount;
UINT32 ulOverflowToneEventsCount;
UINT32 ulSoftOverflowToneEventsCount;
UINT32 ulSoftOverflowBufferPlayoutEventsCount;
} tOCT6100_CHIP_STATS, *tPOCT6100_CHIP_STATS;
typedef struct _OCT6100_CHIP_TONE_INFO_
{
UINT32 ulToneID;
UINT32 ulDetectionPort;
UINT8 aszToneName[ cOCT6100_TLV_MAX_TONE_NAME_SIZE ];
} tOCT6100_CHIP_TONE_INFO, *tPOCT6100_CHIP_TONE_INFO;
typedef struct _OCT6100_CHIP_IMAGE_INFO_
{
BOOL fBufferPlayout;
BOOL fAdaptiveNoiseReduction;
BOOL fSoutNoiseBleaching;
BOOL fAutoLevelControl;
BOOL fHighLevelCompensation;
BOOL fSilenceSuppression;
BOOL fAdpcm;
BOOL fConferencing;
BOOL fConferencingNoiseReduction;
BOOL fDominantSpeaker;
BOOL fAcousticEcho;
BOOL fAecTailLength;
BOOL fToneRemoval;
BOOL fDefaultErl;
BOOL fNonLinearityBehaviorA;
BOOL fNonLinearityBehaviorB;
BOOL fPerChannelTailDisplacement;
BOOL fPerChannelTailLength;
BOOL fListenerEnhancement;
BOOL fRoutNoiseReduction;
BOOL fRoutNoiseReductionLevel;
BOOL fAnrSnrEnhancement;
BOOL fAnrVoiceNoiseSegregation;
BOOL fToneDisablerVqeActivationDelay;
BOOL fMusicProtection;
BOOL fDoubleTalkBehavior;
BOOL fIdleCodeDetection;
BOOL fSinLevel;
UINT32 ulMaxChannels;
UINT32 ulNumTonesAvailable;
UINT32 ulToneProfileNumber;
UINT32 ulMaxTailDisplacement;
UINT32 ulMaxTailLength;
UINT32 ulDebugEventSize;
UINT32 ulMaxPlayoutEvents;
UINT32 ulImageType;
UINT8 szVersionNumber[ cOCT6100_VERSION_NUMBER_MAX_SIZE ];
UINT32 ulBuildId;
tOCT6100_CHIP_TONE_INFO aToneInfo[ cOCT6100_MAX_TONE_EVENT ];
} tOCT6100_CHIP_IMAGE_INFO, *tPOCT6100_CHIP_IMAGE_INFO;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100ChipGetStatsDef(
OUT tPOCT6100_CHIP_STATS f_pChipStats );
UINT32 Oct6100ChipGetStats(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_CHIP_STATS f_pChipStats );
UINT32 Oct6100ChipGetImageInfoDef(
OUT tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo );
UINT32 Oct6100ChipGetImageInfo(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
OUT tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo );
#endif /* __OCT6100_CHIP_STATS_PUB_H__ */

View File

@ -0,0 +1,104 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_conf_bridge_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_conf_bridge.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_conf_bridge_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 19 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CONF_BRIDGE_INST_H__
#define __OCT6100_CONF_BRIDGE_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_CONF_BRIDGE_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Entry counter for the resources. */
UINT8 byEntryOpenCnt;
/* Next bridge pointer. */
UINT16 usNextBridgePtr;
/* Previous bridge pointer. */
UINT16 usPrevBridgePtr;
/* Number of clients connected to the bridge. */
UINT16 usNumClients;
/* Store the index of the load event, to diffentiate him form the accumulate. */
UINT16 usLoadIndex;
/* Pointer to the first bridge events.*/
UINT16 usFirstLoadEventPtr;
UINT16 usFirstSubStoreEventPtr;
UINT16 usLastSubStoreEventPtr;
/* Pointer to the silence load event, if it exists. */
UINT16 usSilenceLoadEventPtr;
/* Flag specifying whether the dominant speaker is set or not. */
UINT16 usDominantSpeakerChanIndex;
UINT8 fDominantSpeakerSet;
/* Flag specifying if this is flexible conferencing bridge. */
UINT8 fFlexibleConferencing;
/* Number of clients being tapped. */
UINT16 usNumTappedClients;
} tOCT6100_API_CONF_BRIDGE, *tPOCT6100_API_CONF_BRIDGE;
typedef struct _OCT6100_API_FLEX_CONF_PARTICIPANT_
{
/* Input port of the conferencing for this participant. */
UINT32 ulInputPort;
/* Whether the flexible mixer has been created. */
UINT8 fFlexibleMixerCreated;
/* Listener mask ( who can hear us ). */
UINT32 ulListenerMask;
/* Our index in the listener mask. */
UINT32 ulListenerMaskIndex;
/* Mixer event indexes for this participant's mixer. */
UINT16 ausLoadOrAccumulateEventIndex[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ];
} tOCT6100_API_FLEX_CONF_PARTICIPANT, *tPOCT6100_API_FLEX_CONF_PARTICIPANT;
#endif /* __OCT6100_CONF_BRIDGE_INST_H__ */

View File

@ -0,0 +1,169 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_conf_bridge_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_conf_bridge.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_conf_bridge_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 22 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_CONF_BRIDGE_PUB_H__
#define __OCT6100_CONF_BRIDGE_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_CONF_BRIDGE_OPEN_
{
PUINT32 pulConfBridgeHndl; /* Handle returned when the bridge is opened. */
BOOL fFlexibleConferencing;
} tOCT6100_CONF_BRIDGE_OPEN, *tPOCT6100_CONF_BRIDGE_OPEN;
typedef struct _OCT6100_CONF_BRIDGE_CLOSE_
{
UINT32 ulConfBridgeHndl;
} tOCT6100_CONF_BRIDGE_CLOSE, *tPOCT6100_CONF_BRIDGE_CLOSE;
typedef struct _OCT6100_CONF_BRIDGE_CHAN_ADD_
{
UINT32 ulConfBridgeHndl;
UINT32 ulChannelHndl;
UINT32 ulInputPort;
UINT32 ulListenerMaskIndex;
UINT32 ulListenerMask;
BOOL fMute;
UINT32 ulTappedChannelHndl;
} tOCT6100_CONF_BRIDGE_CHAN_ADD, *tPOCT6100_CONF_BRIDGE_CHAN_ADD;
typedef struct _OCT6100_CONF_BRIDGE_CHAN_REMOVE_
{
UINT32 ulConfBridgeHndl;
UINT32 ulChannelHndl;
BOOL fRemoveAll;
} tOCT6100_CONF_BRIDGE_CHAN_REMOVE, *tPOCT6100_CONF_BRIDGE_CHAN_REMOVE;
typedef struct _OCT6100_CONF_BRIDGE_CHAN_MUTE_
{
UINT32 ulChannelHndl;
} tOCT6100_CONF_BRIDGE_CHAN_MUTE, *tPOCT6100_CONF_BRIDGE_CHAN_MUTE;
typedef struct _OCT6100_CONF_BRIDGE_CHAN_UNMUTE_
{
UINT32 ulChannelHndl;
} tOCT6100_CONF_BRIDGE_CHAN_UNMUTE, *tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE;
typedef struct _OCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET_
{
UINT32 ulConfBridgeHndl;
UINT32 ulChannelHndl;
} tOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET, *tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET;
typedef struct _OCT6100_CONF_BRIDGE_MASK_CHANGE_
{
UINT32 ulChannelHndl;
UINT32 ulNewListenerMask;
} tOCT6100_CONF_BRIDGE_MASK_CHANGE, *tPOCT6100_CONF_BRIDGE_MASK_CHANGE;
typedef struct _OCT6100_CONF_BRIDGE_STATS_
{
UINT32 ulConfBridgeHndl;
UINT32 ulNumChannels;
UINT32 ulNumTappedChannels;
BOOL fFlexibleConferencing;
} tOCT6100_CONF_BRIDGE_STATS, *tPOCT6100_CONF_BRIDGE_STATS;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100ConfBridgeOpenDef(
OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen );
UINT32 Oct6100ConfBridgeOpen(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen );
UINT32 Oct6100ConfBridgeCloseDef(
OUT tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose );
UINT32 Oct6100ConfBridgeClose(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose );
UINT32 Oct6100ConfBridgeChanAddDef(
OUT tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd );
UINT32 Oct6100ConfBridgeChanAdd(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd );
UINT32 Oct6100ConfBridgeChanRemoveDef(
OUT tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove );
UINT32 Oct6100ConfBridgeChanRemove(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove );
UINT32 Oct6100ConfBridgeChanMuteDef(
OUT tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute );
UINT32 Oct6100ConfBridgeChanMute(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute );
UINT32 Oct6100ConfBridgeChanUnMuteDef(
OUT tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute );
UINT32 Oct6100ConfBridgeChanUnMute(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute );
UINT32 Oct6100ConfBridgeDominantSpeakerSetDef(
OUT tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker );
UINT32 Oct6100ConfBridgeDominantSpeakerSet(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker );
UINT32 Oct6100ConfBridgeMaskChangeDef(
OUT tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange );
UINT32 Oct6100ConfBridgeMaskChange(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange );
UINT32 Oct6100ConfBridgeGetStatsDef(
OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats );
UINT32 Oct6100ConfBridgeGetStats(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats );
#endif /* __OCT6100_CONF_BRIDGE_PUB_H__ */

View File

@ -0,0 +1,124 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_debug_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_debug.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_debug_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 10 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_DEBUG_INST_H__
#define __OCT6100_DEBUG_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_DEBUG_
{
/* Information from the TLVs. */
UINT32 ulDebugEventSize;
UINT32 ulMatrixBaseAddress;
UINT32 ulDebugChanStatsByteSize;
UINT32 ulDebugChanLiteStatsByteSize;
UINT32 ulHotChannelSelectBaseAddress;
UINT32 ulMatrixTimestampBaseAddress;
UINT32 ulAfWritePtrByteOffset;
UINT32 ulRecordedPcmEventByteSize;
UINT32 ulMatrixWpBaseAddress;
/* Pouch counter presence in the image. */
UINT8 fPouchCounter;
/* Record channel indexes. */
UINT16 usRecordMemIndex;
UINT16 usRecordChanIndex;
UINT16 usRecordRinRoutTsiMemIndex;
UINT16 usRecordSinSoutTsiMemIndex;
/* Debug channel information.*/
UINT16 usCurrentDebugChanIndex;
/* Matrix event mask. */
UINT16 usMatrixCBMask;
/* If data is being dumped now. */
UINT8 fDebugDataBeingDumped;
/* Index of the last event retrieved. */
UINT16 usLastDebugEventIndex;
/* Number of events to retrieve. */
UINT16 usNumEvents;
/* Chip debug event write ptr. */
UINT16 usChipDebugEventWritePtr;
/* Hot channel read data. */
UINT16 ausHotChannelData[ 2 ];
/* Last PCM sample index. */
UINT32 ulLastPcmSampleIndex;
/* Last AF log read pointer. */
UINT16 usLastAfLogReadPtr;
/* AF log hardware write pointer. */
UINT16 usAfLogWritePtr;
/* Last tone event index retrieved. */
UINT16 usLastToneEventIndex;
/* Whether the image version string has been copied in the user buffer. */
BOOL fImageVersionCopied;
/* Whether the api version string has been copied in the user buffer. */
BOOL fApiVersionCopied;
/* Total number of bytes that will be returned for the current dump. */
UINT32 ulDebugDataTotalNumBytes;
/* Field to detect if the ISR is called present? */
BOOL fIsIsrCalledField;
/* Remaining number of bytes that will be returned for the current dump. */
UINT32 ulDebugDataRemainingNumBytes;
/* AF events control block size. */
UINT32 ulAfEventCbByteSize;
/* Current user selected data mode. Must be kept constant throughout a debug session. */
UINT32 ulCurrentGetDataMode;
} tOCT6100_API_DEBUG, *tPOCT6100_API_DEBUG;
#endif /* __OCT6100_DEBUG_INST_H__ */

View File

@ -0,0 +1,76 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_debug_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_debug.c. All elements defined in this file are for public
usage of the API.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 14 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_DEBUG_PUB_H__
#define __OCT6100_DEBUG_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_DEBUG_SELECT_CHANNEL_
{
UINT32 ulChannelHndl;
} tOCT6100_DEBUG_SELECT_CHANNEL, *tPOCT6100_DEBUG_SELECT_CHANNEL;
typedef struct _OCT6100_DEBUG_GET_DATA_
{
UINT32 ulGetDataMode;
UINT32 ulGetDataContent;
UINT32 ulRemainingNumBytes;
UINT32 ulTotalNumBytes;
UINT32 ulMaxBytes;
UINT32 ulValidNumBytes;
PUINT8 pbyData;
} tOCT6100_DEBUG_GET_DATA, *tPOCT6100_DEBUG_GET_DATA;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100DebugSelectChannelDef(
OUT tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan );
UINT32 Oct6100DebugSelectChannel(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan );
UINT32 Oct6100DebugGetDataDef(
OUT tPOCT6100_DEBUG_GET_DATA f_pGetData );
UINT32 Oct6100DebugGetData(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData );
#endif /* __OCT6100_DEBUG_PUB_H__ */

View File

@ -0,0 +1,670 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_defines.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Header file containing all defines used throughout the API.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.7
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 171 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_DEFINES_H__
#define __OCT6100_DEFINES_H__
/***************************** INCLUDE FILES *******************************/
#include "octdef.h"
/***************************** DEFINES *************************************/
/* 32-bits values. */
#define cOCT6100_FFFFFFFF 0xFFFFFFFF
#define cOCT6100_FFFFFFFE 0xFFFFFFFE
#define cOCT6100_7FFFFFFF 0x7FFFFFFF
/* 16-bits values. */
#define cOCT6100_FFFD 0xFFFD
#define cOCT6100_FFFE 0xFFFE
#define cOCT6100_FFFF 0xFFFF
#define cOCT6100_7FFF 0x7FFF
/* 8-bits values. */
#define cOCT6100_FF 0xFF
#define cOCT6100_CURRENT_VALUE cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_CHIP_ID cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_HANDLE cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_TIMESLOT cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_STREAM cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_VALUE cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_STAT cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_STAT_W cOCT6100_FFFF
#define cOCT6100_INVALID_PCM_LAW cOCT6100_FF
#define cOCT6100_INVALID_EVENT cOCT6100_FFFF
#define cOCT6100_INVALID_INDEX cOCT6100_FFFF
#define cOCT6100_INVALID_TONE cOCT6100_FFFFFFFF
#define cOCT6100_INVALID_PORT cOCT6100_FF
#define cOCT6100_AUTO_SELECT cOCT6100_FFFFFFFE
#define cOCT6100_AUTO_SELECT_TAIL cOCT6100_FFFE
#define cOCT6100_INVALID_BOOL 2
#define cOCT6100_KEEP_PREVIOUS_SETTING 0x70100000
#define cOCT6100_INVALID_SIGNED_STAT cOCT6100_7FFFFFFF
#define cOCT6100_INVALID_SIGNED_STAT_W cOCT6100_7FFF
#define cOCT6100_INVALID_ECHO_DELAY 0x400
#define cOCT6100_SIZE_128 128
#define cOCT6100_SIZE_256 256
#define cOCT6100_SIZE_512 512
#define cOCT6100_SIZE_1K 1024
#define cOCT6100_SIZE_2K 2048
#define cOCT6100_SIZE_4K 4096
#define cOCT6100_SIZE_8K 8192
#define cOCT6100_SIZE_16K 16384
#define cOCT6100_SIZE_32K 32768
#define cOCT6100_SIZE_64K 65536
#define cOCT6100_SIZE_128K 131072
#define cOCT6100_SIZE_256K 262144
#define cOCT6100_SIZE_512K 524288
#define cOCT6100_SIZE_1M 1048576
#define cOCT6100_SIZE_2M 2097152
#define cOCT6100_SIZE_4M 4194304
#define cOCT6100_SIZE_8M 8388608
#define cOCT6100_SIZE_16M 16777216
#define cOCT6100_SIZE_32M 33554432
#define cOCT6100_SIZE_64M 67108864
#define cOCT6100_SIZE_128M 134217728
#define cOCT6100_SIZE_256M 268435456
#define cOCT6100_SIZE_512M 536870912
#define cOCT6100_SIZE_1G 1073741824
#define cOCT6100_SIZE_2G 2147483648
#define cOCT6100_HNDL_TAG_MASK 0xFF000000
#define cOCT6100_HNDL_INDEX_MASK 0x0000FFFF
#define cOCT6100_ENTRY_OPEN_CNT_MASK 0x000000FF
#define cOCT6100_ENTRY_OPEN_CNT_SHIFT 16
#define cOCT6100_HNDL_TAG_INVALID 0xFF000000
#define cOCT6100_HNDL_TAG_CHANNEL 0x01000000
#define cOCT6100_HNDL_TAG_TSI_CNCT 0x02000000
#define cOCT6100_HNDL_TAG_CONF_BRIDGE 0x03000000
#define cOCT6100_HNDL_TAG_PHASING_TSST 0x04000000
#define cOCT6100_HNDL_TAG_BIDIR_CHANNEL 0x05000000
#define cOCT6100_HNDL_TAG_COPY_EVENT 0x06000000
#define cOCT6100_HNDL_TAG_ADPCM_CHANNEL 0x07000000
#define cOCT6100_INVALID_HANDLE_TYPE cOCT6100_INVALID_VALUE
#define cOCT6100_MEMORY_ROUND_SIZE 16
#define mOCT6100_ROUND_MEMORY_SIZE( ulMemorySize, ulTempVar ) \
if ((ulTempVar = ulMemorySize % cOCT6100_MEMORY_ROUND_SIZE) != 0) \
ulMemorySize += cOCT6100_MEMORY_ROUND_SIZE - ulTempVar;
#define mOCT6100_ROUND_ADDRESS( ulAddress, ulBoundary, ulTempVar ) \
if ((ulTempVar = ulAddress % ulBoundary) != 0) \
ulAddress += ulBoundary - ulTempVar;
#define cOCT6100_INTERNAL_CLOCK_SOURCE 0
#define cOCT6100_EXTERNAL_CLOCK_SOURCE 1
#define cOCT6100_ACTIVE_HIGH_POLARITY 0
#define cOCT6100_ACTIVE_LOW_POLARITY 1
#define cOCT6100_TDM_SAMPLE_AT_3_QUARTERS 0
#define cOCT6100_TDM_SAMPLE_AT_RISING_EDGE 1
#define cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE 2
#define cOCT6100_TDM_STREAM_FREQ_2MHZ 0
#define cOCT6100_TDM_STREAM_FREQ_4MHZ 1
#define cOCT6100_TDM_STREAM_FREQ_8MHZ 2
#define cOCT6100_TDM_STREAM_FREQ_16MHZ 3
#define cOCT6100_TDM_STREAM_MAX_GROUPS 8
#define cOCT6100_PCM_U_LAW 0
#define cOCT6100_PCM_A_LAW 1
#define cOCT6100_PCM_UNCHANGED 2
#define cOCT6100_ADPCM_ENCODED 3
#define cOCT6100_INTERRUPT_DISABLE 0
#define cOCT6100_INTERRUPT_NO_TIMEOUT 1
#define cOCT6100_INTERRUPT_TIMEOUT 2
#define cOCT6100_NUMBER_TSSTS_1 1
#define cOCT6100_NUMBER_TSSTS_2 2
#define cOCT6100_G711_64KBPS 1
#define cOCT6100_G726_40KBPS 2
#define cOCT6100_G726_32KBPS 3
#define cOCT6100_G726_24KBPS 4
#define cOCT6100_G726_16KBPS 5
#define cOCT6100_G727_40KBPS_4_1 6
#define cOCT6100_G727_40KBPS_3_2 7
#define cOCT6100_G727_40KBPS_2_3 8
#define cOCT6100_G727_32KBPS_4_0 9
#define cOCT6100_G727_32KBPS_3_1 10
#define cOCT6100_G727_32KBPS_2_2 11
#define cOCT6100_G727_24KBPS_3_0 12
#define cOCT6100_G727_24KBPS_2_1 13
#define cOCT6100_G727_16KBPS_2_0 14
#define cOCT6100_G726_ENCODED 15
#define cOCT6100_G711_G726_ENCODED 16
#define cOCT6100_G711_G727_2C_ENCODED 17
#define cOCT6100_G711_G727_3C_ENCODED 18
#define cOCT6100_G711_G727_4C_ENCODED 19
#define cOCT6100_G727_2C_ENCODED 20
#define cOCT6100_G727_3C_ENCODED 21
#define cOCT6100_G727_4C_ENCODED 22
#define cOCT6100_ADPCM_IN_HIGH_BITS 0
#define cOCT6100_ADPCM_IN_LOW_BITS 1
/* The values of these defines must not change. */
#define cOCT6100_H100_TRACKA 0
#define cOCT6100_H100_TRACKB 1
#define cOCT6100_H100_TRACKA_FALLBACKB 2
#define cOCT6100_H100_TRACKB_FALLBACKA 3
#define cOCT6100_H100_DISABLED 4
#define cOCT6100_H100_MASTERA 5
#define cOCT6100_H100_BACKUPA 6
#define cOCT6100_H100_MASTERB 7
#define cOCT6100_H100_BACKUPB 8
#define cOCT6100_FREE_TSST 0
#define cOCT6100_RX_TSST 16
#define cOCT6100_TX_TSST 32
#define cOCT6100_INTRPT_ACTIVE 0
#define cOCT6100_INTRPT_WILL_TIMEOUT 1
#define cOCT6100_INTRPT_IN_TIMEOUT 2
#define cOCT6100_INTRPT_DISABLED 3
#define cOCT6100_EXTERNAL_MEM_BIST_TIMEOUT 1000000
/* Clocks defines */
#define cOCT6100_UPCLK_FREQ_33_33_MHZ 33333333
#define cOCT6100_MCLK_FREQ_133_MHZ 133000000
#define cOCT6100_MCLK_FREQ_125_MHZ 125000000
#define cOCT6100_MCLK_FREQ_117_MHZ 117000000
#define cOCT6100_MCLK_FREQ_108_MHZ 108000000
#define cOCT6100_MCLK_FREQ_100_MHZ 100000000
#define cOCT6100_MCLK_FREQ_92_MHZ 92000000
#define cOCT6100_MCLK_FREQ_83_MHZ 83000000
#define cOCT6100_MCLK_FREQ_75_MHZ 75000000
/* Tone buffer defines.*/
#define cOCT6100_MAX_NUM_TONE_BUFFERS 1344
#define cOCT6100_MAX_TONES_PER_CALL 32
/* Memory defines.*/
#define cOCT6100_MEM_TYPE_SDR 0
#define cOCT6100_MEM_TYPE_DDR 1
#define cOCT6100_MEM_TYPE_SDR_PLL_BYPASS 2
#define cOCT6100_MEMORY_CHIP_SIZE_8MB cOCT6100_SIZE_8M
#define cOCT6100_MEMORY_CHIP_SIZE_16MB cOCT6100_SIZE_16M
#define cOCT6100_MEMORY_CHIP_SIZE_32MB cOCT6100_SIZE_32M
#define cOCT6100_MEMORY_CHIP_SIZE_64MB cOCT6100_SIZE_64M
#define cOCT6100_MEMORY_CHIP_SIZE_128MB cOCT6100_SIZE_128M
#define cOCT6100_MAX_NUM_MEMORY_CHIP 2
#define cOCT6100_16MB_MEMORY_BANKS 0
#define cOCT6100_32MB_MEMORY_BANKS 1
#define cOCT6100_64MB_MEMORY_BANKS 2
#define cOCT6100_128MB_MEMORY_BANKS 3
#define cOCT6100_1_MEMORY_BANKS 0
#define cOCT6100_2_MEMORY_BANKS 1
#define cOCT6100_3_MEMORY_BANKS 2
#define cOCT6100_4_MEMORY_BANKS 3
/* Chip open defines.*/
#define cOCT6100_INTERNAL_TONE_ARRAY_SIZE 256 /* in words.*/
#define cOCT6100_INTERNAL_SUPER_ARRAY_SIZE 1024 /* in words.*/
/* Internal memory mapping.*/
/*=======================================================================*/
#define cOCT6100_TSST_CONTROL_MEM_BASE 0x26000
#define cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE 2 /* Each entries are 2 bytes.*/
#define cOCT6100_TSST_CONTROL_MEM_INPUT_TSST 0x0800
#define cOCT6100_TSST_CONTROL_MEM_OUTPUT_TSST 0x2000
#define cOCT6100_TSST_CONTROL_MEM_PCM_LAW_OFFSET 12
#define cOCT6100_TSST_CONTROL_MEM_NIBBLE_POS_OFFSET 11
#define cOCT6100_TSST_CONTROL_MEM_TSST_NUM_OFFSET 12
#define cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK 0x7FF
#define cOCT6100_TSST_CONTROL_PHASING_TSST_BASE_ENTRY 1344
#define cOCT6100_TSST_CONTROL_TIMESTAMP_BASE_ENTRY 1516
/*=======================================================================*/
#define cOCT6100_CONVERSION_CONTROL_MEM_BASE 0x28000
/* Each entries are 8 bytes but an 8 bytes mixer entry is located inbetween each entry.*/
#define cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE 16
#define cOCT6100_CONVERSION_CONTROL_MEM_ENCODER 0x0000
#define cOCT6100_CONVERSION_CONTROL_MEM_DECODER 0x8000
#define cOCT6100_CONVERSION_CONTROL_MEM_ACTIVATE_ENTRY 0x8000
#define cOCT6100_CONVERSION_CONTROL_MEM_RST_ON_NEXT_FR 0x8000
#define cOCT6100_CONVERSION_CONTROL_MEM_PHASE_OFFSET 12
#define cOCT6100_CONVERSION_CONTROL_MEM_NIBBLE_POS_OFFSET 9
#define cOCT6100_CONVERSION_CONTROL_MEM_COMP_OFFSET 11
#define cOCT6100_CONVERSION_CONTROL_MEM_LAW_OFFSET 8
#define cOCT6100_CONVERSION_CONTROL_MEM_SIL_SUP_OFFSET 8
#define cOCT6100_CONVERSION_CONTROL_PHASE_SIZE_BASE_ADD 0x5400
/*=======================================================================*/
#define cOCT6100_MIXER_CONTROL_MEM_BASE 0x28008
/* Each entries are 8 bytes but an 8 bytes mixer entry is located inbetween each entry.*/
#define cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE 16
#define cOCT6100_MIXER_CONTROL_MEM_SUB_STORE 0xA000
#define cOCT6100_MIXER_CONTROL_MEM_STORE 0x8000
#define cOCT6100_MIXER_CONTROL_MEM_LOAD 0x4000
#define cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE 0x6000
#define cOCT6100_MIXER_CONTROL_MEM_COPY 0x2000
#define cOCT6100_MIXER_CONTROL_MEM_NO_OP 0x0000
#define cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET 11
#define cOCT6100_MIXER_HEAD_NODE 0
#define cOCT6100_MIXER_TAIL_NODE 1
#define cOCT6100_MIXER_RECORD_COPY_NODE 2
/*=======================================================================*/
#define cOCT6100_ECHO_CONTROL_MEM_BASE 0x14000
#define cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE 4 /* Each entries are 8 bytes.*/
#define cOCT6100_ECHO_CONTROL_MEM_ACTIVATE_ENTRY 0x8000
#define cOCT6100_ECHO_CONTROL_MEM_EXTERNAL_AF_CTRL 0x2000
#define cOCT6100_ECHO_CONTROL_MEM_DEBUG_OFFSET 14
#define cOCT6100_ECHO_CONTROL_MEM_AF_CONTROL 14
#define cOCT6100_ECHO_CONTROL_MEM_INPUT_LAW_OFFSET 12
#define cOCT6100_ECHO_CONTROL_MEM_OUTPUT_LAW_OFFSET 11
#define cOCT6100_ECHO_CONTROL_MEM_TSI_MEM_MASK 0x7FF
/*=======================================================================*/
#define cOCT6100_ST_CONTROL_MEM_BASE 0x2000000
#define cOCT6100_ST_CONTROL_MEM_ENTRY_SIZE 16 /* Each entries are 8 bytes.*/
/*=======================================================================*/
#define cOCT6100_PART1_BASE 0x00080000
#define cOCT6100_PART1_CPU_LSU_CB_BASE cOCT6100_PART1_BASE+0x0000E3C0 /* 8 * 8 = 64 bytes */
#define cOCT6100_PART1_HW_LSU_CB_BASE cOCT6100_PART1_BASE+0x0000E400 /* 8 * 128 = 1K byte */
#define cOCT6100_PART1_END_STATICS_BASE cOCT6100_PART1_BASE+0x0000E9F0 /* 912 bytes available for your viewing pleasure. */
#define cOCT6100_PART1_API_SCRATCH_PAD cOCT6100_PART1_END_STATICS_BASE+4+(12*8)
#define cOCT6100_PART1_EGO_REG cOCT6100_PART1_BASE+0x0007FF00
/* External Memory mapping. */
#define cOCT6100_EXTERNAL_MEM_BLOCK_SIZE 1024
#define cOCT6100_EXTERNAL_MEM_BASE_ADDRESS 0x08000000
#define cOCT6100_TLV_BASE ( 0x00016000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS )
#define cOCT6100_CHANNEL_ROOT_BASE ( 0x00020000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS )
#define cOCT6100_PGSP_EVENT_OUT_BASE ( 0x002C0000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS )
#define cOCT6100_POUCH_BASE ( 0x002E0000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS )
#define cOCT6100_IMAGE_FILE_BASE ( 0x00300000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS )
#define cOCT6100_CHANNEL_ROOT_SIZE 4096
#define cOCT6100_CHANNEL_ROOT_TOTAL_SIZE ( 672 * cOCT6100_CHANNEL_ROOT_SIZE )
#define cOCT6100_PGSP_EVENT_OUT_SIZE 131072
#define cOCT6100_PGSP_TONE_EVENT_SIZE 0x40
#define cOCT6100_IMAGE_FILE_SIZE 0x100000
#define cOCT6100_MATRIX_TIMESTAMP_DWORD_ADD cOCT6100_POUCH_BASE + 0x8
#define cOCT6100_MATRIX_CHAN_SELECT_DWORD_ADD cOCT6100_POUCH_BASE + 0x14
#define cOCT6100_MATRIX_WRITE_PTR_DWORD_ADD cOCT6100_POUCH_BASE + 0x4
#define cOCT6100_MATRIX_PLL_JITTER_COUNT_ADD cOCT6100_POUCH_BASE + 0x1C
#define cOCT6100_MATRIX_DWORD_BASE cOCT6100_POUCH_BASE + 0xE0000
#define cOCT6100_CHANNEL_ROOT_GLOBAL_CONF_OFFSET 0x0000
#define cOCT6100_NUM_WORDS_PER_TONE_EVENT 32
#define cOCT6100_NUM_PGSP_EVENT_OUT 2048
#define cOCT6100_VALID_TONE_EVENT 0x8000
#define cOCT6100_LOCAL_TIMESTAMP_INCREMENT 32 /* 4 ms increment. */
#define cOCT6100_ABSOLUTE_MAX_NUM_PGSP_EVENT_OUT 65535
#define cOCT6100_MIN_TIMESLOT_FOR_TIMESTAMP 5
/*=======================================================================*/
#define cOCT6100_GSC_PGSP_CONTEXT_BASE_ADD_OFFSET 0x0C
#define cOCT6100_GSC_PGSP_INIT_CONTEXT_BASE_ADD_OFFSET 0x10
#define cOCT6100_GSC_RIN_CIRC_BUFFER_BASE_ADD_OFFSET 0x14
#define cOCT6100_GSC_SIN_CIRC_BUFFER_BASE_ADD_OFFSET 0x18
#define cOCT6100_GSC_SOUT_CIRC_BUFFER_BASE_ADD_OFFSET 0x1C
#define cOCT6100_GSC_BUFFER_LAW_OFFSET 27
/*=======================================================================*/
#define cOCT6100_CH_MAIN_PGSP_CONTEXT_OFFSET 0x00000
#define cOCT6100_CH_MAIN_TONE_EVENT_OFFSET 0x00488
/*=======================================================================*/
#define cOCT6100_PLAYOUT_EVENT_REPEAT_OFFSET 31
#define cOCT6100_PLAYOUT_EVENT_LAW_OFFSET 30
#define cOCT6100_PLAYOUT_EVENT_MIX_OFFSET 28
#define cOCT6100_PLAYOUT_EVENT_LOOP_TIMES_OFFSET 27
#define cOCT6100_PLAYOUT_EVENT_GAIN_OFFSET 24
#define cOCT6100_PLAYOUT_EVENT_MEM_SIZE 16
/* Image related defines.*/
#define cOCT6100_MIN_IMAGE_SIZE 0x001000
#define cOCT6100_MAX_IMAGE_SIZE 0x100000
#define cOCT6100_MAX_IMAGE_REGION 60
#define cOCT6100_IMAGE_AF_CST_OFFSET 0x1000;
/* Max defines.*/
#define cOCT6100_MAX_ECHO_CHANNELS 672
#define cOCT6100_MAX_TSI_CNCTS 1530
#define cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS ( 3328 + 6 )
#define cOCT6100_MAX_PLAYOUT_BUFFERS ( 1344 + cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS )
#define cOCT6100_MAX_CONF_BRIDGE 672
#define cOCT6100_MAX_FLEX_CONF_PARTICIPANTS cOCT6100_MAX_ECHO_CHANNELS
#define cOCT6100_MAX_PHASING_TSST 16
#define cOCT6100_MAX_ADPCM_CHANNELS 672
#define cOCT6100_NUM_TSI_B4_PHASING 1344
#define cOCT6100_TOTAL_TSI_CONTROL_MEM_ENTRY 1534
#define cOCT6100_MAX_TSI_CONTROL_MEM_ENTRY 1344
#define cOCT6100_MAX_ECHO_CONTROL_MEM_ENTRY 672
#define cOCT6100_MAX_TSI_B4_TIMESTAMP 172
#define cOCT6100_TSI_MEM_FOR_TIMESTAMP 4
#define cOCT6100_API_EXT_TONE_EXTRA_TSI 1533
/* Echo channel ports */
#define cOCT6100_CHANNEL_PORT_RIN 0
#define cOCT6100_CHANNEL_PORT_ROUT 1
#define cOCT6100_CHANNEL_PORT_SIN 2
#define cOCT6100_CHANNEL_PORT_SOUT 3
#define cOCT6100_CHANNEL_PORT_ROUT_SOUT 4
#define cOCT6100_NO_ENCODING 10
#define cOCT6100_NO_DECODING 11
/* Buffer playout defines */
#define cOCT6100_NO_SKIP 0
#define cOCT6100_BUFFER_PLAYOUT_MIN_SIZE 1024
#define cOCT6100_DEFAULT_TIMESTAMP 0
#define cOCT6100_MIXING_0_DB 0
#define cOCT6100_MIXING_MINUS_6_DB 1
#define cOCT6100_MIXING_MINUS_12_DB 2
#define cOCT6100_MIXING_MUTE 3
#define cOCT6100_PLAYOUT_GAIN 0x41000000
#define cOCT6100_PLAYOUT_EVENT 1
#define cOCT6100_MINIMUM_BUFFER_SIZE 64
#define cOCT6100_BUFFER_SIZE_GRANULARITY 16
#define cOCT6100_REPEAT_INFINITELY cOCT6100_INVALID_VALUE
#define cOCT6100_REPEAT_MAX 32767
#define cOCT6100_SAMPLES_PER_MS 8
/* For the playout events. */
#define cOCT6100_MAX_BUFFER_PLAYOUT_EVENT_PER_CALL 32
#define cOCT6100_MIN_BUFFER_PLAYOUT_EVENT 128
#define cOCT6100_MAX_BUFFER_PLAYOUT_EVENT 65535
/* Event types */
#define cOCT6100_BUFFER_PLAYOUT_EVENT_INVALID cOCT6100_INVALID_VALUE
#define cOCT6100_BUFFER_PLAYOUT_EVENT_STOP 1
/* Phasing defines.*/
#define cOCT6100_SINGLE_PHASING 0
#define cOCT6100_DUAL_PHASING 1
#define cOCT6100_NO_PHASING 2
/* Echo canceller mode.*/
#define cOCT6100_ELECTRIC_EC 0
#define cOCT6100_ELECTRIC_EC_DISPLACEMENT 1
#define cOCT6100_ACCOUSTIC_ES 2
/* Echo control modes.*/
#define cOCT6100_ECHO_OP_MODE_NORMAL 0
#define cOCT6100_ECHO_OP_MODE_HT_FREEZE 1
#define cOCT6100_ECHO_OP_MODE_HT_RESET 2
#define cOCT6100_ECHO_OP_MODE_POWER_DOWN 3
#define cOCT6100_ECHO_OP_MODE_EXTERNAL 4
#define cOCT6100_ECHO_OP_MODE_NO_ECHO 5
#define cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION 6
#define cOCT6100_ECHO_OP_MODE_G169_ALC cOCT6100_ECHO_OP_MODE_NO_ECHO
/* 2100 Hz disabling configuration. */
#define cOCT6100_NEVER_DISABLED 0
#define cOCT6100_G164_2100_HZ 1
#define cOCT6100_G165_2100_HZ_WITH_PHASE_REV 2
/* TSST defines.*/
#define cOCT6100_UNASSIGNED cOCT6100_FFFD
#define cOCT6100_MAX_TSSTS 4096
#define cOCT6100_TWO_TSSTS_INDEX_MASK 0x8000
#define cOCT6100_TSST_INDEX_MASK 0x7FFF
#define cOCT6100_INPUT_TSST 0
#define cOCT6100_OUTPUT_TSST 1
/* Conference bridges defines.*/
#define cOCT6100_MAX_MIXER_EVENTS 1344
#define cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE 32
#define cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED 672
#define cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL cOCT6100_FFFFFFFE
/* Conversion memory defines.*/
#define cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS 1344
/* Tone detection defines.*/
#define cOCT6100_MAX_TONE_NUMBER 55
/* Register definition and address. */
#define cOCT6100_TONE_EVENT_WRITE_PTR_REG 0x722
#define cOCT6100_TONE_EVENT_READ_PTR_REG 0x720
/* Special Signaling tone IDs. */
#define cOCT6100_TONE_SIN_SYSTEM7_2000 0x20000023
#define cOCT6100_TONE_SIN_SYSTEM7_1780 0x20000024
#define cOCT6100_TONE_ROUT_G168_2100GB_ON 0x10000000
#define cOCT6100_TONE_ROUT_G168_2100GB_WSPR 0x10000002
#define cOCT6100_TONE_ROUT_G168_1100GB_ON 0x10000004
#define cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_A 0x10000005
#define cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_B 0x10000006
#define cOCT6100_TONE_ROUT_G168_2100GB_WSPR_WIDE 0x10000008
#define cOCT6100_TONE_SOUT_G168_2100GB_ON 0x40000000
#define cOCT6100_TONE_SOUT_G168_2100GB_WSPR 0x40000002
#define cOCT6100_TONE_SOUT_G168_1100GB_ON 0x40000004
#define cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_A 0x40000005
#define cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_B 0x40000006
#define cOCT6100_TONE_SOUT_G168_2100GB_WSPR_WIDE 0x40000008
#define cOCT6100_TONE_SIN_SYSTEM5_2400 0x20000020
#define cOCT6100_TONE_SIN_SYSTEM5_2600 0x20000021
#define cOCT6100_TONE_SIN_SYSTEM5_2400_2600 0x20000022
#define cOCT6100_CHIP_ID_REVISION_REG 0x17E
/* BOOT type. */
#define cOCT6100_AF_BOOT_TYPE 0x5
#define cOCT6100_PRODUCTION_BOOT_TYPE 0x7
#define cOCT6100_PRODUCTION_SHORT_BOOT_TYPE 0x8
/*Production Bist Modes*/
#define cOCT6100_PRODUCTION_BIST_STANDARD 0x0
#define cOCT6100_PRODUCTION_BIST_SHORT 0x1
/* Interrupt register masks.*/
#define cOCT6100_INTRPT_MASK_REG_102H 0x0001
#define cOCT6100_INTRPT_MASK_REG_202H 0x1C01
#define cOCT6100_INTRPT_MASK_REG_302H 0xF100
#define cOCT6100_INTRPT_MASK_REG_502H 0x0002
#define cOCT6100_INTRPT_MASK_REG_702H 0x0002
#define cOCT6100_DECODER_MEMORY_OFFSET 672
/* Debug defines.*/
#define cOCT6100_DEBUG_MAX_READ_LENGTH 10240
#define cOCT6100_DEBUG_SOUT_MAX_READ_LENGTH 2560
#define cOCT6100_DEBUG_CHAN_RECORD_INDEX 64
#define cOCT6100_DEBUG_RECORD_BUFFER_BYTE_SIZE 0x20000
#define cOCT6100_DEBUG_RECORD_MATRIX_SIZE 0x8000
#define cOCT6100_DEBUG_RECORD_READ_DATA_BYTE_SIZE 1024
#define cOCT6100_DEBUG_RECORD_BLOCK_BYTE_SIZE 0x1000
/* Tone event defines.*/
#define cOCT6100_MAX_TONE_EVENT 56
#define cOCT6100_TONE_PRESENT 0
#define cOCT6100_TONE_STOP 1
#define cOCT6100_TONE_REFRESH 2
/* TLV defines.*/
#define cOCT6100_TLV_MAX_ADDRESS 0x10000000
#define cOCT6100_TLV_MAX_TONE_NAME_SIZE 64
#define cOCT6100_VERSION_NUMBER_MAX_SIZE 1016
/* Echo Tail defines.*/
#define cOCT6100_TAIL_LENGTH_32MS 32
#define cOCT6100_TAIL_LENGTH_64MS 64
#define cOCT6100_TAIL_LENGTH_128MS 128
#define cOCT6100_MAX_ECHO_TAIL_DISPLACEMENT 5600 /* In milliseconds */
/* Generic loop counter.*/
#define cOCT6100_MAX_LOOP 0x2000
/* CPU boot timeout counter. */
#define cOCT6100_MAX_LOOP_CPU_TIMEOUT 0x20000
/* Automatic level control */
#define cOCT6100_PASS_THROUGH_LEVEL_CONTROL 0x90
/* Channel stats debug info */
#define cOCT6100_DEBUG_CHAN_STATS_EVENT_BYTE_SIZE 1024
#define cOCT6100_DEBUG_CHAN_STATS_LITE_EVENT_BYTE_SIZE 720
/* Image start string define */
#define cOCT6100_IMAGE_START_STRING "EDS3_IMAGE_NAME"
/* Tone image info defines.*/
#define cOCT6100_TONE_INFO_START_STRING "[ToneDetectorInfo]"
#define cOCT6100_TONE_INFO_STOP_STRING "[~ToneDetectorInfo]"
#define cOCT6100_TONE_INFO_EVENT_STRING "TONEEVENT=0x"
#define cOCT6100_MAX_NLP_CONF_DWORD 20
/* Tail displacement info.*/
#define cOCT6100_MAX_TAIL_DISPLACEMENT 896
/* Comfort noise define */
#define cOCT6100_COMFORT_NOISE_NORMAL 0x0
#define cOCT6100_COMFORT_NOISE_EXTENDED 0x3
#define cOCT6100_COMFORT_NOISE_OFF 0x2
#define cOCT6100_COMFORT_NOISE_FAST_LATCH 0x1
/* Mixer event type.*/
#define cOCT6100_EVENT_TYPE_SOUT_COPY 0x0
#define cOCT6100_EVENT_TYPE_SIN_COPY 0x1
/* Tone disabler status.*/
#define cOCT6100_TONE_DISABLER_EC_ENABLED 0
#define cOCT6100_TONE_DISABLER_EC_DISABLED 1
/* ADPCM Channel defines */
#define cOCT6100_ADPCM_ENCODING 0
#define cOCT6100_ADPCM_DECODING 1
/* Double talk behavior modes. */
#define cOCT6100_DOUBLE_TALK_BEH_NORMAL 0x0
#define cOCT6100_DOUBLE_TALK_BEH_LESS_AGGRESSIVE 0x1
/* Api Version string length.*/
#define cOCT6100_API_VERSION_STRING_LENGTH 32
/* Extended tone detection information. */
#define cOCT6100_API_EXT_TONE_DISABLED 0
#define cOCT6100_API_EXT_TONE_SIN_PORT_MODE 1
#define cOCT6100_API_EXT_TONE_RIN_PORT_MODE 2
/* Mute/UnMute defines. */
#define cOCT6100_CHANNEL_MUTE_PORT_NONE 0x00
#define cOCT6100_CHANNEL_MUTE_PORT_RIN 0x01
#define cOCT6100_CHANNEL_MUTE_PORT_ROUT 0x02
#define cOCT6100_CHANNEL_MUTE_PORT_SIN 0x04
#define cOCT6100_CHANNEL_MUTE_PORT_SOUT 0x08
#define cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES 0x10
/* Debug get data dump modes. */
#define cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE 0x0
#define cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE 0x1
#define cOCT6100_DEBUG_GET_DATA_MODE_16S 0x2
#define cOCT6100_DEBUG_GET_DATA_MODE_120S 0x3
/* Debug get data dump content. */
#define cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE 0x0 /* Full binary dump to be sent for support. */
#define cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM 0x1 /* Only Rin PCM stream data. */
#define cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM 0x2 /* Only Sin PCM stream data. */
#define cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM 0x3 /* Only Sout PCM stream data. */
#define cOCT6100_BIST_IN_PROGRESS 0x0
#define cOCT6100_BIST_CONFIGURATION_FAILED 0x1
#define cOCT6100_BIST_STATUS_CRC_FAILED 0x2
#define cOCT6100_BIST_MEMORY_FAILED 0x3
#define cOCT6100_BIST_SUCCESS 0x4
/* Image types. */
#define cOCT6100_IMAGE_TYPE_WIRELINE 0x0
#define cOCT6100_IMAGE_TYPE_COMBINED 0x1
/* Fatal general error types. */
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_1 0x0001
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_2 0x0002
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_3 0x0004
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_4 0x0008
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_5 0x0010
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_6 0x0020
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_7 0x0040
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_8 0x0080
#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_9 0x0100
#endif /* __OCT6100_DEFINES_H__ */

View File

@ -0,0 +1,838 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_errors.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
Header file containing all defines used for error codes.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 205 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_ERRORS_H__
#define __OCT6100_ERRORS_H__
/***************************** INCLUDE FILES *******************************/
#include "octdef.h"
/***************************** DEFINES *************************************/
#define cOCT6100_ERR_OK 0x00000000
#define cOCT6100_ERR_BASE 0x00100000
#define cOCT6100_NOT_SUPPORTED_BASE (0xFF000 + cOCT6100_ERR_BASE)
/* Not supported defines. */
#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_DEBUG_RECORD (0x00000 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLP_CONTROL (0x00001 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_BKG_NOISE_FREEZE (0x00002 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_DC_OFFSET_REM (0x00003 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_DC_OFFSET_REM (0x00004 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_AUTO_LC (0x00005 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SOUT_AUTO_LC (0x00006 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR (0x00007 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_DISPLACEMENT (0x00008 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ENCODING (0x00009 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DECODING (0x0000A + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_LAW_TRANSLATION (0x0000B + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO (0x0000C + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DEFAULT_ERL (0x0000D + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DOUBLE_TALK (0x0000E + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NON_LINEARITY_B (0x0000F + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_AEC_DEFAULT_ERL (0x00010 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_HIGH_LEVEL_COMP (0x00011 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_PER_CHAN_TAIL (0x00012 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIL_SUP (0x00013 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_ACOUSTIC_ECHO (0x00014 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_TAIL_DISPLACEMENT_VALUE (0x00015 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_MAX_ECHO_CHANNELS_VALUE (0x00016 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ALE (0x00017 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLE (0x00018 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NR (0x00019 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_MUTE_FEATURES (0x0001A + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SNR_ENHANCEMENT (0x0001B + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SEGREGATION (0x0001C + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_USE_SYNCH_TIMESTAMP (0x0001D + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_LENGTH (0x0001E + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY (0x0001F + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH (0x00020 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_MUSIC_PROTECTION (0x00021 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_DEBUG_DATA_MODE_120S (0x00022 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_TONE_NOT_PRESENT_IN_FIRMWARE (0x00023 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_DOUBLE_TALK_BEHAVIOR_MODE (0x00024 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION (0x00025 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION_CONFIG (0x00026 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NOISE_REDUCTION_GAIN (0x0002B + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_BUFFER_PLAYOUT (0x00100 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_CNR (0x00101 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CONF_BRIDGE (0x00102 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CALLER_ID (0x00104 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NOISE_BLEACHING (0x00105 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_REMOVAL (0x00300 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_NOT_SUPPORTED_DOMINANT_SPEAKER (0x00301 + cOCT6100_NOT_SUPPORTED_BASE)
#define cOCT6100_ERR_OPEN_INVALID_DEVICE (0x03000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INSUFFICIENT_EXTERNAL_MEMORY (0x03001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MEMORY_CHIP_SIZE (0x03002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_UP_CLK_FREQ (0x03003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_USER_CHIP_ID (0x03004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MULTI_PROCESS_SYSTEM (0x03005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_RW_ACCESSES (0x03006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_IMAGE_SIZE (0x03007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_IMAGE_FILE (0x03008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MEM_CLK_FREQ (0x03009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MEMORY_CHIPS_NUMBER (0x0300A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TOTAL_MEMORY_SIZE (0x0300B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_USE_SYNCH_TIMESTAMP (0x0300C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TIMESTAMP_STREAM (0x0300D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TIMESTAMP_TIMESLOT (0x0300E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TIMESTAMP_TSSTS (0x0300F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TDM_STREAM_FREQS (0x03010 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TDM_SAMPLING (0x03011 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_FAST_H100_MODE (0x03012 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_ECHO_CHANNELS (0x03013 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_PLAYOUT_BUFFERS (0x03014 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_TSI_CNCTS (0x03015 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_PHASING_TSSTS (0x03016 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_EXTERNAL_MEM_BIST_FAILED (0x03017 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_EXTERNAL_MEM_BIST_TIMEOUT (0x03018 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_SDRAM_BIST_FAILED (0x03019 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_CORRUPTED_IMAGE (0x0301A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR (0x0301B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_SOFT_TONE_EVENT_SIZE (0x0301C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INTERRUPT_POLARITY (0x0301D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_FATAL_GENERAL_CONFIG (0x0301E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_REMOTE_DEBUG_SESSIONS (0x0301F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ENABLE_MEM_CLK_OUT (0x03020 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_TDM_STREAM (0x03021 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_CONF_BRIDGES (0x03022 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_AF_CPU_TIMEOUT (0x03024 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MEMORY_TYPE (0x03025 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_FATAL_MEMORY_CONFIG (0x03026 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ERROR_MEMORY_CONFIG (0x03027 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_CONFIG (0x03028 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ERROR_H100_CONFIG (0x03029 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_FATAL_MEMORY_TIMEOUT (0x0302A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ERROR_MEMORY_TIMEOUT (0x0302B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_TIMEOUT (0x0302C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ERROR_H100_TIMEOUT (0x0302D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_IMAGE_WRITE_FAILED (0x0302E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_CRC_ERROR (0x0302F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_EGO_TIMEOUT (0x03030 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_SOFT_DEBUG_EVENT_BUF_SIZE (0x03031 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TONE_INFO_START_TAG_NOT_FOUND (0x03032 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TONE_INFO_STOP_TAG_NOT_FOUND (0x03033 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INVALID_TONE_EVENT (0x03034 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INVALID_TONE_NAME (0x03035 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INVALID_EVENT_NUMBER_SIZE (0x03036 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INTERNAL_MEMORY_BIST (0x03037 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_TAIL_DISPLACEMENT (0x03038 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_DEBUG_CHANNEL_RECORDING (0x03039 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_BIDIR_CHANNELS (0x0303A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_FUNCTIONAL_BIST_FAILED (0x0303C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_ADPCM_CHANNELS (0x0303E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ENABLE_EXT_TONE_DETECTION (0x03040 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_SOFT_PLAYOUT_STOP_EVENT_SIZE (0x03041 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS (0x03042 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ENABLE_ACOUSTIC_ECHO (0x03043 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_USER_WRITE_BURST_FAILED (0x03045 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_USER_WRITE_SMEAR_FAILED (0x03046 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_USER_READ_BURST_FAILED (0x03047 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_MAX_FLEXIBLE_CONF_PARTICIPANTS (0x03048 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_DEBUG_MEM_INDEX (0x03051 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ENABLE_CALLER_ID (0x03052 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_CALLER_ID_PLAYOUT_BUFFERS (0x03053 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ENABLE_PRODUCTION_BIST (0x03055 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_ACTIVATED (0x03056 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_NUM_PRODUCTION_BIST_LOOPS (0x03057 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_PRODUCTION_BOOT_FAILED (0x03058 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_CONF_FAILED (0x03059 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_POUCH_ERROR (0x0305A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_INVALID_TLV_LENGTH (0x0305B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_MODE (0x0305C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_OPEN_ENABLE_2100_STOP_EVENT (0x03060 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CAP_PINS_INVALID_CHIP_STATE (0x03081 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CAP_PINS_INVALID_CAPACITY_VALUE (0x03082 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_ALL_CHANNELS_ARE_OPENED (0x04000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_DISABLED (0x04001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE (0x04002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_INPUT_TIMESLOT (0x04003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_INPUT_STREAM (0x04004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_OUTPUT_TIMESLOT (0x04005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_OUTPUT_STREAM (0x04006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_INPUT_PCM_LAW (0x04007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_TIMESLOT (0x04008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_STREAM (0x04009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_TSST_RESERVED (0x0400A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_NOT_OPEN (0x0400B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_ASSOCIATED_TSST_RESERVED (0x0400C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSI_CNCT_NO_MORE_TSI_AVAILABLE (0x0400D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED (0x05000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_PATTERN (0x05001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_TOO_SMALL (0x05002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_PCM_LAW (0x05003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ALL_BUFFERS_OPEN (0x05004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE (0x05005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX (0x05006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN (0x05007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ACTIVE_DEPENDENCIES (0x05008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID (0x05009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN (0x0500A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ROUT_PORT_PLAYING (0x0500B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_SOUT_PORT_PLAYING (0x0500C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_PORT_INVALID (0x0500D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT (0x0500E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL (0x0500F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT (0x05010 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_MIXING (0x05011 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_STOP_CLEANLY (0x05012 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED (0x05013 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_WRITE_BYTE_COUNT (0x05015 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ECHO_OP_MODE (0x05016 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_LENGTH_INVALID (0x05017 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_OFFSET_INVALID (0x05018 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_RESET (0x05019 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_BUF_EMPTY (0x0501A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_MAX_EVENT (0x0501B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_DISABLED (0x0501C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_NOTIFY_ON_STOP (0x0501D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ALLOW_ACTIVE (0x0501E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_STILL_ACTIVE (0x0501F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_REPEAT_USED (0x05020 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_NLP_DISABLED (0x05021 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_ZERO (0x05022 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_NO_MEMORY (0x05023 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_POINT_NOT_FOUND (0x05024 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT_COUNT (0x05025 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_GAIN_DB (0x05026 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_BUFFER_PLAYOUT_LIST_EMPTY (0x05027 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MEMORY_ALL_TSI_MEM_ENTRY_RESERVED (0x06000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MEMORY_ALL_ECHO_MEM_ENTRY_RESERVED (0x06002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MEMORY_EXTERNAL_MEMORY_FULL (0x06003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MEMORY_ALL_CONVERSION_MEM_ENTRY_RESERVED (0x06004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DISABLED (0x07000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_INVALID_HANDLE (0x07001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_NUM_TSSTS (0x07002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_NUM_TSSTS (0x07003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_NUM_TSSTS (0x07004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_NUM_TSSTS (0x07005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_TIMESLOT (0x07006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_STREAM (0x07007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_TIMESLOT (0x07008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_STREAM (0x07009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT (0x0700A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_STREAM (0x0700B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT (0x0700C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_STREAM (0x0700D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_MISSING_TSST (0x07012 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIL_SUP_ENABLE (0x07013 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_PHASING_TYPE (0x07014 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE (0x07015 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_PHASING_TSST_NOT_OPEN (0x07016 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_PHASING_INVALID_PHASE (0x07017 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DEBUG (0x07018 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE (0x0701F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_DC_OFFSET_REM (0x07020 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_DC_OFFSET_REM (0x07021 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL (0x07022 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL (0x07023 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL_GAIN (0x07024 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL_GAIN (0x07025 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_ADAPT_NOISE_REDUCTION (0x07026 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ALL_CHANNELS_ARE_OPENED (0x07027 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_NOT_OPEN (0x07029 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ADPCM_NIBBLE (0x0702A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_ADD_PORT (0x0702B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_ADD_TIMESLOT (0x0702C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_ADD_STREAM (0x0702D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_INVALID (0x0702E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_PCM_LAW (0x0702F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_PCM_LAW (0x07030 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_PCM_LAW (0x07031 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_PCM_LAW (0x07032 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DECODER_PORT (0x07033 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ENCODER_PORT (0x07034 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DECODING_RATE (0x07035 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ENCODING_RATE (0x07036 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ENABLE_NLP (0x07037 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_COMFORT_NOISE_MODE (0x07038 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_PHASING_TSST_REQUIRED (0x07039 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIL_SUP_INVALID_ENCODER_PORT (0x0703A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_MODIFY_CODEC_CONFIG (0x0703B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_MODIFY_VQE_CONFIG (0x0703C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_MODIFY_TDM_CONFIG (0x0703D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_RIN_PORT_INVALID (0x0703E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_SIN_PORT_INVALID (0x0703F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_PORT (0x07041 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_TIMESLOT (0x07042 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_STREAM (0x07043 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_INVALID_TSST (0x07044 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_GET_STATS_MAX_BROADCAST_TSST (0x07045 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_TIMESLOT (0x07046 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_STREAM (0x07047 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_TIMESLOT (0x07048 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_STREAM (0x07049 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ACTIVE_DEPENDENCIES (0x0704A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TONE_DISABLER_ENABLE (0x0704B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TAIL_LENGTH (0x07053 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT (0x07054 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_INVALID_RIN_CB_SIZE (0x07058 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_NO_BROADCAST_TSST (0x07059 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_INVALID_CODEC_POSITION (0x0705A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_STATS_RESET (0x0705B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ENABLE_TAIL_DISPLACEMENT (0x0705C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE (0x0705E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE (0x0705F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE (0x07060 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED (0x07061 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ALREADY_BIDIR (0x07062 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ALL_BIDIR_CHANNELS_ARE_OPENED (0x07063 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_FIRST_CHAN_SOUT_PORT (0x07064 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_FIRST_CHAN_RIN_PORT (0x07065 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SECOND_CHAN_SOUT_PORT (0x07066 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SECOND_CHAN_RIN_PORT (0x07067 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_BIDIR_PCM_LAW (0x07068 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_BIDIR_CHAN_NOT_OPEN (0x07069 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION (0x0706A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION (0x0706B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL (0x0706C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_NO_VALID_TDM_CLOCKS (0x0706E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_OUT_OF_TSI_MEMORY (0x07073 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TONE_REMOVAL (0x07075 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO (0x07077 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DEFAULT_ERL (0x07079 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DOUBLE_TALK (0x0707B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_PHASE_TYPE_REQUIRED (0x0707C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIL_SUP_NLP_MUST_BE_ENABLED (0x0707D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ENABLE_EXT_TONE_DETECTION (0x0707E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DECODER_PORT (0x0707F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DISABLED (0x07080 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_NON_LINEARITY_B (0x07082 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_FIRST_CHAN_IN_CONFERENCE (0x07083 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SECOND_CHAN_IN_CONFERENCE (0x07084 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT_CANNOT_MODIFY (0x07085 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_NON_LINEARITY_B_CANNOT_MODIFY (0x07086 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_NOT_ENABLED (0x07087 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_BIDIR_DISABLED (0x0708B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT_INVALID (0x0708D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_PER_CHAN_TAIL_DISPLACEMENT (0x0708E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_CONFERENCE_NOISE_REDUCTION (0x0708F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_AEC_DEFAULT_ERL (0x07092 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED (0x07093 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL (0x07094 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL (0x07095 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_TARGET (0x07096 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_TARGET (0x07097 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_MANUAL (0x07098 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_MANUAL (0x07099 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP (0x0709A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_HIGH_LEVEL_COMP (0x0709C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_MANUAL (0x0709D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_THRESHOLD (0x0709E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_MUTE_MASK (0x0709F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_MUTE_MASK_SIN (0x070A0 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ALE_RATIO (0x070A1 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_NLE_FLAG (0x070A2 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ALE_NLE_SIMULTANEOUSLY (0x070A3 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION (0x070A4 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ANR_SNR_ENHANCEMENT (0x070A5 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ANR_SEGREGATION (0x070A6 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_NLE_RATIO (0x070A7 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_APPLY_TO_ALL_CHANNELS (0x070A8 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_STREAM_UNASSIGN (0x070A9 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT_UNASSIGN (0x070AA + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_STREAM_UNASSIGN (0x070AB + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_TIMESLOT_UNASSIGN (0x070AC + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_STREAM_UNASSIGN (0x070AD + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT_UNASSIGN (0x070AE + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_STREAM_UNASSIGN (0x070AF + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SIN_TIMESLOT_UNASSIGN (0x070B0 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DISABLE_TONE_DETECTION (0x070B1 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_STOP_BUFFER_PLAYOUT (0x070B2 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_REMOVE_CONF_BRIDGE_PARTICIPANT (0x070B3 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_REMOVE_BROADCAST_TSSTS (0x070B4 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY (0x070B5 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_OUT_OF_MIXER_EVENTS (0x070B8 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH (0x070B9 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ENABLE_MUSIC_PROTECTION (0x070BA + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_TAIL_LENGTH_INVALID (0x070BB + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_SUM (0x070BC + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_DOUBLE_TALK_MODE (0x070BD + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING (0x070BE + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING_NR (0x070BF + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ANR_CNR_SIMULTANEOUSLY (0x070C0 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_IDLE_CODE_DETECTION (0x070C1 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_MUST_ENABLE_TONE_DISABLER (0x070C2 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_REQUIRED (0x070C5 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_REQUIRED (0x070C6 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_AUTO_LEVEL_CONTROL_REQUIRED (0x070C8 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_COMFORT_NOISE_REQUIRED (0x070CB + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION_GAIN (0x070CC + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_ALL_ENTRIES_ARE_OPENED (0x08000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_DISABLED (0x08001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE (0x08002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_TIMESLOT (0x08003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_STREAM (0x08004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_PHASING_LENGTH (0x08005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_NOT_OPEN (0x08006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PHASING_TSST_ACTIVE_DEPENDENCIES (0x08007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE (0x09000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_DISABLED (0x09001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN (0x09002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_ACTIVE_DEPENDENCIES (0x09003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE (0x09004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND (0x09005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_ALL_BUFFERS_OPEN (0x09006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_INVALID_HANDLE (0x09007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE (0x09008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_MUTE (0x09009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE (0x0900A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_ALREADY_MUTED (0x0900B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_NOT_MUTED (0x0900C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_CODEC_ACTIVE (0x0900D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_MIXER_FULL (0x0900E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ALREADY_ON_BRIDGE (0x0900F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_ALL (0x09010 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_EXT_TONE_ENABLED (0x09011 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_INVALID_INPUT_PORT (0x09012 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_DOMINANT_SPEAKER (0x09013 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_BIDIR (0x09015 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CNR_MUST_BE_ENABLED (0x09016 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_NLP_MUST_BE_ENABLED (0x09017 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF (0x09018 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_PARTICIPANT_CNT (0x09019 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_MASK_INDEX (0x0901A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_ALL_BUFFERS_OPEN (0x0901B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_DISABLED (0x0901C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_INDEX_USED (0x0901D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_SIMPLE_BRIDGE (0x0901E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_COPY_EVENTS (0x0901F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE (0x09020 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_TAP_NOT_SUPPORTED (0x09021 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_BRIDGE (0x09022 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY (0x09023 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_SAME_BRIDGE (0x09024 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_TAP_SOUT_ONLY (0x09025 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_ALREADY_TAPPED (0x09026 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE (0x09027 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION (0x09028 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MISC_CANNOT_ROUND_UP_NUMBER (0x0A000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MISC_ASCII_CONVERSION_FAILED (0x0A001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID (0x0B000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TONE_DETECTION_CHANNEL_NOT_OPEN (0x0B001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TONE_DETECTION_TONE_NUMBER_INVALID (0x0B002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED (0x0B003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED (0x0B004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TONE_DETECTION_TONE_NOT_AVAILABLE (0x0B005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TONE_DETECTION_DISABLE_ALL (0x0B006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_EVENTS_GET_TONE_RESET_BUFS (0x0C000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY (0x0C001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_EVENTS_MAX_TONES (0x0C002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_RW_ERROR (0x0D000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_NOT_ACTIVE (0x0D001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_FATAL_GENERAL_CONFIG (0x0D002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_FATAL_MEMORY_CONFIG (0x0D003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_CONFIG (0x0D004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_CONFIG (0x0D005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_H100_ERROR_CONFIG (0x0D006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_FATAL_GENERAL_TIMEOUT (0x0D007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_FATAL_MEMORY_TIMEOUT (0x0D008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_TIMEOUT (0x0D009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_TIMEOUT (0x0D00A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_H100_ERROR_TIMEOUT (0x0D00B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_AF_TIMESTAMP_READ_TIMEOUT (0x0D00C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_INTRPTS_NLP_TIMESTAMP_READ_TIMEOUT (0x0D00D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSST_TIMESLOT (0x0E000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSST_STREAM (0x0E001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSST_TSST_RESERVED (0x0E002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSST_ASSOCIATED_TSST_RESERVED (0x0E003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TSST_ALL_TSSTS_ARE_OPENED (0x0E004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MULTIPROC_API_INST_SHARED (0x10000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MULTIPROC_API_INST_LOCAL (0x10001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_CHANNEL_INVALID_HANDLE (0x11000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_PORT (0x11001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_READ_LENGTH (0x11002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_SOUT_READ_LENGTH (0x11003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_READ_DATA (0x11004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_GET_EVENTS_RESET_BUFS (0x11005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_GET_EVENTS_BUF_EMPTY (0x11006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RECORD_RIN_PTR_INVALID (0x11007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RECORD_SIN_PTR_INVALID (0x11008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RECORD_ROUT_PTR_INVALID (0x11009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RECORD_SOUT_PTR_INVALID (0x1100A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RECORD_RAW_DATA_PTR_INVALID (0x1100B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RECORD_LENGTH_INVALID (0x1100C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RECORD_NO_CHAN_SELECTED (0x1100D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_PCM_LAW (0x1100E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_CHANNEL_RECORDING_DISABLED (0x1100F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_GET_DATA_MAX_BYTES (0x11010 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_GET_DATA_PTR_INVALID (0x11011 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_RC_CHANNEL_RECORDING_DISABLED (0x11012 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_GET_DATA_MODE (0x11013 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_CHANNEL_IN_POWER_DOWN (0x11014 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_GET_DATA_CONTENT (0x11015 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_DEBUG_GET_DATA_MODE_CANNOT_CHANGE (0x11016 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_ALL_COPY_EVENT_ENTRY_OPENED (0x12000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE (0x12001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE (0x12002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE (0x12003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_SOURCE_PORT (0x12004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_DESTINATION_PORT (0x12005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_EVENT_NOT_OPEN (0x12006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_SOURCE_ADPCM_RESOURCES_ACTIVATED (0x12007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_DEST_ADPCM_RESOURCES_ACTIVATED (0x12008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED (0x12009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_DISABLED (0x13000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE (0x13001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_INPUT_TIMESLOT (0x13002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_INPUT_STREAM (0x13003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_TIMESLOT (0x13004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_STREAM (0x13005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_INPUT_NUM_TSSTS (0x13006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_NUM_TSSTS (0x13007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_INPUT_PCM_LAW (0x13008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_MODE (0x13009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_ENCODING_RATE (0x1300A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_DECODING_RATE (0x1300B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_INCOMPATIBLE_NUM_TSSTS (0x1300C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_NO_MORE_TSI_AVAILABLE (0x1300D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_PCM_LAW (0x1300E + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_ADPCM_NIBBLE_POSITION (0x1300F + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_NOT_OPEN (0x13010 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_ADPCM_CHAN_ALL_ADPCM_CHAN_ARE_OPENED (0x13011 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_CHIP_STATS_RESET (0x14000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_PRODUCTION_BIST_DISABLED (0x16000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_PAYLOAD (0x2C000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_PAYLOAD (0x2C001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH (0x2C002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_LENGTH (0x2C003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_ENDIAN_DETECTION_FIELD (0x2C004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_CHECKSUM (0x2C005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR (0x2C006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_ALL_SESSIONS_OPEN (0x2C007 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_INVALID_PACKET (0x2C008 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_TRANSACTION_ANSWERED (0x2C009 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_INAVLID_SESSION_NUMBER (0x2C00A + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_INVALID_HOT_CHAN_INDEX (0x2C00B + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_DISABLED (0x2C00C + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_REMOTEDEBUG_INVALID_RPC_COMMAND_NUM (0x2C00D + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_TLV_TIMEOUT (0x31000 + cOCT6100_ERR_BASE)
/* Fatal errors must always be greater or equal to 0xE000. */
#define cOCT6100_ERR_FATAL (0xDE000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_WRITE_API (0xDE000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_WRITE_EXT_API (0xDE001 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_WRITE_SMEAR_API (0xDE002 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_WRITE_BURST_API (0xDE003 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_READ_API (0xDE004 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_READ_BURST_API (0xDE005 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_READ_DEBUG_API (0xDE006 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_DRIVER_WRITE_ARRAY_API (0xDE007 + cOCT6100_ERR_BASE)
#define cOCT6100_FATAL_BASE (0xDF000 + cOCT6100_ERR_BASE)
#define cOCT6100_ERR_FATAL_0 (0x00000 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_1 (0x00001 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_2 (0x00002 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_3 (0x00003 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_4 (0x00004 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_5 (0x00005 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_6 (0x00006 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_7 (0x00007 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_8 (0x00008 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_9 (0x00009 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A (0x0000A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B (0x0000B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C (0x0000C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D (0x0000D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E (0x0000E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_F (0x0000F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_10 (0x00010 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_11 (0x00011 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_12 (0x00012 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_13 (0x00013 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_14 (0x00014 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_15 (0x00015 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_16 (0x00016 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_17 (0x00017 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_18 (0x00018 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_19 (0x00019 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_1A (0x0001A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_1B (0x0001B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_1C (0x0001C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_1D (0x0001D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_1E (0x0001E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_1F (0x0001F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_20 (0x00020 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_21 (0x00021 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_22 (0x00022 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_23 (0x00023 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_24 (0x00024 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_25 (0x00025 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_26 (0x00026 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_27 (0x00027 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_28 (0x00028 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_29 (0x00029 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_2A (0x0002A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_2B (0x0002B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_2C (0x0002C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_2D (0x0002D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_2E (0x0002E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_2F (0x0002F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_30 (0x00030 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_31 (0x00031 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_32 (0x00032 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_33 (0x00033 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_34 (0x00034 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_35 (0x00035 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_36 (0x00036 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_37 (0x00037 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_38 (0x00038 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_39 (0x00039 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_3A (0x0003A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_3B (0x0003B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_3C (0x0003C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_3D (0x0003D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_3E (0x0003E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_3F (0x0003F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_40 (0x00040 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_41 (0x00041 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_42 (0x00042 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_43 (0x00043 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_44 (0x00044 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_45 (0x00045 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_46 (0x00046 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_47 (0x00047 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_48 (0x00048 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_49 (0x00049 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_4A (0x0004A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_4B (0x0004B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_4C (0x0004C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_4D (0x0004D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_4E (0x0004E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_4F (0x0004F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_50 (0x00050 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_51 (0x00051 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_52 (0x00052 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_53 (0x00053 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_54 (0x00054 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_55 (0x00055 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_56 (0x00056 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_57 (0x00057 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_58 (0x00058 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_59 (0x00059 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_5A (0x0005A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_5B (0x0005B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_5C (0x0005C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_5D (0x0005D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_5E (0x0005E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_5F (0x0005F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_60 (0x00060 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_61 (0x00061 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_62 (0x00062 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_63 (0x00063 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_64 (0x00064 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_65 (0x00065 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_66 (0x00066 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_67 (0x00067 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_68 (0x00068 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_69 (0x00069 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_6A (0x0006A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_6B (0x0006B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_6C (0x0006C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_6D (0x0006D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_6E (0x0006E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_6F (0x0006F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_70 (0x00070 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_71 (0x00071 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_72 (0x00072 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_73 (0x00073 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_74 (0x00074 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_75 (0x00075 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_76 (0x00076 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_77 (0x00077 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_78 (0x00078 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_79 (0x00079 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_7A (0x0007A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_7B (0x0007B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_7C (0x0007C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_7D (0x0007D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_7E (0x0007E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_7F (0x0007F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_80 (0x00080 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_81 (0x00081 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_82 (0x00082 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_83 (0x00083 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_84 (0x00084 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_85 (0x00085 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_86 (0x00086 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_87 (0x00087 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_88 (0x00088 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_89 (0x00089 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_8A (0x0008A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_8B (0x0008B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_8C (0x0008C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_8D (0x0008D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_8E (0x0008E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_8F (0x0008F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_90 (0x00090 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_91 (0x00091 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_92 (0x00092 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_93 (0x00093 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_94 (0x00094 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_95 (0x00095 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_96 (0x00096 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_97 (0x00097 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_98 (0x00098 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_99 (0x00099 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_9A (0x0009A + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_9B (0x0009B + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_9C (0x0009C + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_9D (0x0009D + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_9E (0x0009E + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_9F (0x0009F + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A0 (0x000A0 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A1 (0x000A1 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A2 (0x000A2 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A3 (0x000A3 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A4 (0x000A4 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A5 (0x000A5 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A6 (0x000A6 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A7 (0x000A7 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A8 (0x000A8 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_A9 (0x000A9 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_AA (0x000AA + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_AB (0x000AB + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_AC (0x000AC + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_AD (0x000AD + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_AE (0x000AE + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_AF (0x000AF + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B0 (0x000B0 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B1 (0x000B1 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B2 (0x000B2 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B3 (0x000B3 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B4 (0x000B4 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B5 (0x000B5 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B6 (0x000B6 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B7 (0x000B7 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B8 (0x000B8 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_B9 (0x000B9 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_BA (0x000BA + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_BB (0x000BB + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_BC (0x000BC + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_BD (0x000BD + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_BE (0x000BE + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_BF (0x000BF + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C0 (0x000C0 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C1 (0x000C1 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C2 (0x000C2 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C3 (0x000C3 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C4 (0x000C4 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C5 (0x000C5 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C6 (0x000C6 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C7 (0x000C7 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C8 (0x000C8 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_C9 (0x000C9 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_CA (0x000CA + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_CB (0x000CB + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_CC (0x000CC + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_CD (0x000CD + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_CE (0x000CE + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_CF (0x000CF + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D0 (0x000D0 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D1 (0x000D1 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D2 (0x000D2 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D3 (0x000D3 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D4 (0x000D4 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D5 (0x000D5 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D6 (0x000D6 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D7 (0x000D7 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D8 (0x000D8 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_D9 (0x000D9 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_DA (0x000DA + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_DB (0x000DB + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_DC (0x000DC + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_DD (0x000DD + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_DE (0x000DE + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_DF (0x000DF + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E0 (0x000E0 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E1 (0x000E1 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E2 (0x000E2 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E3 (0x000E3 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E4 (0x000E4 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E5 (0x000E5 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E6 (0x000E6 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E7 (0x000E7 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E8 (0x000E8 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_E9 (0x000E9 + cOCT6100_FATAL_BASE)
#define cOCT6100_ERR_FATAL_EA (0x000EA + cOCT6100_FATAL_BASE)
#endif /* __OCT6100_ERRORS_H__ */

View File

@ -0,0 +1,69 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_events_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_events.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_events_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 12 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_EVENTS_INST_H__
#define __OCT6100_EVENTS_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_TONE_EVENT_
{
UINT32 ulChannelHandle;
UINT32 ulUserChanId;
UINT32 ulToneDetected; /* Tone number of the tone detected. */
UINT32 ulTimestamp;
UINT32 ulEventType;
UINT32 ulExtToneDetectionPort;
} tOCT6100_API_TONE_EVENT, *tPOCT6100_API_TONE_EVENT;
typedef struct _OCT6100_API_BUFFER_PLAYOUT_EVENT_
{
UINT32 ulChannelHandle;
UINT32 ulUserChanId;
UINT32 ulChannelPort;
UINT32 ulTimestamp;
UINT32 ulUserEventId;
UINT32 ulEventType;
} tOCT6100_API_BUFFER_PLAYOUT_EVENT, *tPOCT6100_API_BUFFER_PLAYOUT_EVENT;
#endif /* __OCT6100_EVENTS_INST_H__ */

View File

@ -0,0 +1,111 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_events_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_events.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_events_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 14 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_EVENTS_PUB_H__
#define __OCT6100_EVENTS_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_TONE_EVENT_
{
UINT32 ulChannelHndl;
UINT32 ulUserChanId;
UINT32 ulToneDetected;
UINT32 ulTimestamp;
UINT32 ulEventType;
UINT32 ulExtToneDetectionPort;
} tOCT6100_TONE_EVENT, *tPOCT6100_TONE_EVENT;
typedef struct _OCT6100_EVENT_GET_TONE_
{
BOOL fMoreEvents;
BOOL fResetBufs;
UINT32 ulMaxToneEvent;
UINT32 ulNumValidToneEvent;
tPOCT6100_TONE_EVENT pToneEvent;
} tOCT6100_EVENT_GET_TONE, *tPOCT6100_EVENT_GET_TONE;
typedef struct _OCT6100_BUFFER_PLAYOUT_EVENT_
{
UINT32 ulChannelHndl;
UINT32 ulUserChanId;
UINT32 ulChannelPort;
UINT32 ulTimestamp;
UINT32 ulUserEventId;
UINT32 ulEventType;
} tOCT6100_BUFFER_PLAYOUT_EVENT, *tPOCT6100_BUFFER_PLAYOUT_EVENT;
typedef struct _OCT6100_BUFFER_PLAYOUT_GET_EVENT_
{
BOOL fMoreEvents;
BOOL fResetBufs;
UINT32 ulMaxEvent;
UINT32 ulNumValidEvent;
tPOCT6100_BUFFER_PLAYOUT_EVENT pBufferPlayoutEvent;
} tOCT6100_BUFFER_PLAYOUT_GET_EVENT, *tPOCT6100_BUFFER_PLAYOUT_GET_EVENT;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100EventGetToneDef(
OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone );
UINT32 Oct6100EventGetTone(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone );
UINT32 Oct6100BufferPlayoutGetEventDef(
OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent );
UINT32 Oct6100BufferPlayoutGetEvent(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent );
#endif /* __OCT6100_EVENTS_PUB_H__ */

View File

@ -0,0 +1,134 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_interrupts_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_interrupts.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_interrupts_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 16 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_INTERRUPTS_INST_H__
#define __OCT6100_INTERRUPTS_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_INTRPT_CONFIG_
{
/* The configuration of each group of interrupts. Each can have one of the
following values:
cOCT6100_INTRPT_DISABLE,
cOCT6100_INTRPT_NO_TIMEOUT,
cOCT6100_INTRPT_TIMEOUT. */
UINT8 byFatalGeneralConfig;
UINT8 byFatalMemoryConfig;
UINT8 byErrorMemoryConfig;
UINT8 byErrorOverflowToneEventsConfig;
UINT8 byErrorH100Config;
/* The timeout value for each interrupt group, if the corresponding
configuration variable is set to cOCT6100_INTRPT_TIMEOUT. This
value is kept in mclk cycles. */
UINT32 ulFatalMemoryTimeoutMclk;
UINT32 ulErrorMemoryTimeoutMclk;
UINT32 ulErrorOverflowToneEventsTimeoutMclk;
UINT32 ulErrorH100TimeoutMclk;
} tOCT6100_API_INTRPT_CONFIG, *tPOCT6100_API_INTRPT_CONFIG;
typedef struct _OCT6100_API_INTRPT_MANAGE_
{
/* Number of mclk cycles in 1ms. */
UINT32 ulNumMclkCyclesIn1Ms;
/* Whether the mclk interrupt is active. */
UINT8 fMclkIntrptActive;
UINT32 ulNextMclkIntrptTimeHigh;
UINT32 ulNextMclkIntrptTimeLow;
/* Mclk time read from registers. */
UINT32 ulRegMclkTimeHigh;
UINT32 ulRegMclkTimeLow;
/* Used by the interrupt service routine. */
UINT16 usRegister102h;
UINT16 usRegister202h;
UINT16 usRegister302h;
UINT16 usRegister502h;
UINT16 usRegister702h;
/* The state of each interrupt group. Can be one of the following:
cOCT6100_INTRPT_ACTIVE,
cOCT6100_INTRPT_WILL_TIMEOUT,
cOCT6100_INTRPT_IN_TIMEOUT,
cOCT6100_INTRPT_WILL_DISABLED. */
UINT16 byFatalGeneralState;
UINT16 byFatalMemoryState;
UINT16 byErrorMemoryState;
UINT16 byErrorOverflowToneEventsState;
UINT16 byErrorH100State;
/* The time at which each disabled interrupt was disabled, in mclk cycles. */
UINT32 ulFatalMemoryDisableMclkHigh;
UINT32 ulFatalMemoryDisableMclkLow;
UINT32 ulErrorMemoryDisableMclkHigh;
UINT32 ulErrorMemoryDisableMclkLow;
UINT32 ulErrorOverflowToneEventsDisableMclkHigh;
UINT32 ulErrorOverflowToneEventsDisableMclkLow;
UINT32 ulErrorH100DisableMclkHigh;
UINT32 ulErrorH100DisableMclkLow;
/* The time at which each disabled interrupt group is to be reenabled,
in number of mclk cycles. */
UINT32 ulFatalGeneralEnableMclkHigh;
UINT32 ulFatalGeneralEnableMclkLow;
UINT32 ulFatalMemoryEnableMclkHigh;
UINT32 ulFatalMemoryEnableMclkLow;
UINT32 ulErrorMemoryEnableMclkHigh;
UINT32 ulErrorMemoryEnableMclkLow;
UINT32 ulErrorOverflowToneEventsEnableMclkHigh;
UINT32 ulErrorOverflowToneEventsEnableMclkLow;
UINT32 ulErrorH100EnableMclkHigh;
UINT32 ulErrorH100EnableMclkLow;
/* If this is set, buffer playout events are pending. */
UINT8 fBufferPlayoutEventsPending;
/* If this is set, tone events are pending. */
UINT8 fToneEventsPending;
UINT8 fIsrCalled;
} tOCT6100_API_INTRPT_MANAGE, *tPOCT6100_API_INTRPT_MANAGE;
#endif /* __OCT6100_INTERRUPTS_INST_H__ */

View File

@ -0,0 +1,102 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_interrupts_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_interrupts.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_interrupts_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 23 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_INTERRUPTS_PUB_H__
#define __OCT6100_INTERRUPTS_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_INTERRUPT_CONFIGURE_
{
UINT32 ulFatalGeneralConfig;
UINT32 ulFatalMemoryConfig;
UINT32 ulErrorMemoryConfig;
UINT32 ulErrorOverflowToneEventsConfig;
UINT32 ulErrorH100Config;
UINT32 ulFatalMemoryTimeout;
UINT32 ulErrorMemoryTimeout;
UINT32 ulErrorOverflowToneEventsTimeout;
UINT32 ulErrorH100Timeout;
} tOCT6100_INTERRUPT_CONFIGURE, *tPOCT6100_INTERRUPT_CONFIGURE;
typedef struct _OCT6100_INTERRUPT_FLAGS_
{
BOOL fFatalGeneral;
UINT32 ulFatalGeneralFlags;
BOOL fFatalReadTimeout;
BOOL fErrorRefreshTooLate;
BOOL fErrorPllJitter;
BOOL fErrorOverflowToneEvents;
BOOL fErrorH100OutOfSync;
BOOL fErrorH100ClkA;
BOOL fErrorH100ClkB;
BOOL fErrorH100FrameA;
BOOL fToneEventsPending;
BOOL fBufferPlayoutEventsPending;
BOOL fApiSynch;
} tOCT6100_INTERRUPT_FLAGS, *tPOCT6100_INTERRUPT_FLAGS;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100InterruptConfigureDef(
OUT tPOCT6100_INTERRUPT_CONFIGURE f_pConfigInts );
UINT32 Oct6100InterruptConfigure(
IN tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_INTERRUPT_CONFIGURE f_pConfigInts );
UINT32 Oct6100InterruptServiceRoutineDef(
OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags );
UINT32 Oct6100InterruptServiceRoutine(
IN tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags );
#endif /* __OCT6100_INTERRUPTS_PUB_H__ */

View File

@ -0,0 +1,86 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_mixer_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_mixer.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_mixer_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 13 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_MIXER_INST_H__
#define __OCT6100_MIXER_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_MIXER_EVENT_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Type of the event.*/
UINT16 usEventType;
/* Source channel index */
UINT16 usSourceChanIndex;
/* Destination channel index */
UINT16 usDestinationChanIndex;
/* Pointer to the next entry.*/
UINT16 usNextEventPtr;
} tOCT6100_API_MIXER_EVENT, *tPOCT6100_API_MIXER_EVENT;
typedef struct _OCT6100_API_COPY_EVENT_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Count used to manage entry handles allocated to user. */
UINT8 byEntryOpenCnt;
/* Source + destination ports. */
UINT8 bySourcePort;
UINT8 byDestinationPort;
/* Index of the channels associated to this event.*/
UINT16 usSourceChanIndex;
UINT16 usDestinationChanIndex;
UINT16 usMixerEventIndex;
} tOCT6100_API_COPY_EVENT, *tPOCT6100_API_COPY_EVENT;
#endif /* __OCT6100_MIXER_INST_H__ */

View File

@ -0,0 +1,77 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_mixer_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_mixer.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_mixer_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 7 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_MIXER_PUB_H__
#define __OCT6100_MIXER_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_COPY_EVENT_CREATE_
{
PUINT32 pulCopyEventHndl;
UINT32 ulSourceChanHndl;
UINT32 ulSourcePort;
UINT32 ulDestinationChanHndl;
UINT32 ulDestinationPort;
} tOCT6100_COPY_EVENT_CREATE, *tPOCT6100_COPY_EVENT_CREATE;
typedef struct _OCT6100_COPY_EVENT_DESTROY_
{
UINT32 ulCopyEventHndl;
} tOCT6100_COPY_EVENT_DESTROY, *tPOCT6100_COPY_EVENT_DESTROY;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100MixerCopyEventCreateDef(
OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate );
UINT32 Oct6100MixerCopyEventCreate(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate );
UINT32 Oct6100MixerCopyEventDestroyDef(
OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy );
UINT32 Oct6100MixerCopyEventDestroy(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy );
#endif /* __OCT6100_MIXER_PUB_H__ */

View File

@ -0,0 +1,68 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_phasing_tsst_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_phasing_tsst.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_phasing_tsst_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 11 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_PHASING_TSST_INST_H__
#define __OCT6100_PHASING_TSST_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_PHASING_TSST_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Count used to manage entry handles allocated to user. */
UINT8 byEntryOpenCnt;
/* Count of number of resources connected in some way to this buffer. */
UINT16 usDependencyCnt;
/* TDM timeslot and stream where the counter is read. */
UINT16 usStream;
UINT16 usTimeslot;
/* Length of the phasing TSST counter. */
UINT16 usPhasingLength;
/* TSST control index where the counter comes from. */
UINT16 usPhasingTsstIndex;
} tOCT6100_API_PHASING_TSST, *tPOCT6100_API_PHASING_TSST;
#endif /* __OCT6100_PHASING_TSST_INST_H__ */

View File

@ -0,0 +1,78 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_phasing_tsst_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_phasing_tsst.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_phasing_tsst_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 10 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_PHASING_TSST_PUB_H__
#define __OCT6100_PHASING_TSST_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_PHASING_TSST_OPEN_
{
PUINT32 pulPhasingTsstHndl;
UINT32 ulPhasingLength;
UINT32 ulTimeslot;
UINT32 ulStream;
} tOCT6100_PHASING_TSST_OPEN, *tPOCT6100_PHASING_TSST_OPEN;
typedef struct _OCT6100_PHASING_TSST_CLOSE_
{
UINT32 ulPhasingTsstHndl;
} tOCT6100_PHASING_TSST_CLOSE, *tPOCT6100_PHASING_TSST_CLOSE;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100PhasingTsstOpenDef(
OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen );
UINT32 Oct6100PhasingTsstOpen(
IN tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen );
UINT32 Oct6100PhasingTsstCloseDef(
OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose );
UINT32 Oct6100PhasingTsstClose(
IN tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose );
#endif /* __OCT6100_PHASING_TSST_PUB_H__ */

View File

@ -0,0 +1,88 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_playout_buf_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_playout_buf.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_playout_buf_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 10 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_PLAYOUT_BUF_INST_H__
#define __OCT6100_PLAYOUT_BUF_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
#define mOCT6100_GET_BUFFER_MEMORY_NODE_LIST_PNT( pSharedInfo, pList ) \
pList = ( tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufMemoryNodeListOfst );
#define mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \
pEntry = (( tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufMemoryNodeListOfst)) + ulIndex;
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE_
{
/* Next node. */
UINT32 ulNext;
/* Previous node. */
UINT32 ulPrevious;
/* Start address of this node. */
UINT32 ulStartAddress;
/* Size of this node. */
UINT32 ulSize;
/* Allocated node? Free node? */
UINT8 fAllocated;
} tOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE, *tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE;
typedef struct _OCT6100_API_BUFFER_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Pcm law of the buffer. */
UINT8 byBufferPcmLaw;
/* Number of channels currently playing this buffer.*/
UINT16 usDependencyCnt;
/* Length of the buffer ( in bytes ).*/
UINT32 ulBufferSize;
/* Address in external memory of the buffer. */
UINT32 ulBufferBase;
} tOCT6100_API_BUFFER, *tPOCT6100_API_BUFFER;
#endif /* __OCT6100_PLAYOUT_BUF_INST_H__ */

View File

@ -0,0 +1,183 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_playout_buf_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_playout_buf.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_playout_buf_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 21 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_PLAYOUT_BUF_PUB_H__
#define __OCT6100_PLAYOUT_BUF_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_BUFFER_LOAD_
{
PUINT32 pulBufferIndex; /* Index identifying the buffer. */
PUINT32 pulPlayoutFreeMemSize; /* Amount of free memory available for other buffers. */
PUINT8 pbyBufferPattern; /* A byte pointer pointing to a valid buffer to be loaded into the chip's external memory. */
UINT32 ulBufferSize; /* Size of the buffer loaded into external memory. */
UINT32 ulBufferPcmLaw; /* Buffer PCM law. */
} tOCT6100_BUFFER_LOAD, *tPOCT6100_BUFFER_LOAD;
typedef struct _OCT6100_BUFFER_LOAD_BLOCK_INIT_
{
PUINT32 pulBufferIndex; /* Index identifying the buffer. */
PUINT32 pulPlayoutFreeMemSize; /* Amount of free memory available for other buffers. */
UINT32 ulBufferSize; /* Size of the buffer to be loaded in memory. This space will be reserved. */
UINT32 ulBufferPcmLaw; /* Buffer PCM law. */
} tOCT6100_BUFFER_LOAD_BLOCK_INIT, *tPOCT6100_BUFFER_LOAD_BLOCK_INIT;
typedef struct _OCT6100_BUFFER_LOAD_BLOCK_
{
UINT32 ulBufferIndex; /* Index identifying the buffer. */
/* Offset, in bytes, of the first byte in the block to be loaded. */
/* This offset is with respect to the beginning of the buffer. */
/* This value must be modulo 2 */
UINT32 ulBlockOffset;
/* Size of the block to be loaded into external memory. */
/* This value must be modulo 2. */
UINT32 ulBlockLength;
/* A pointer pointing to a valid buffer block to be loaded */
/* into the chip's external memory. This is a pointer to the entire */
/* buffer. The API uses the ulBlockOffset and ulBlockLength to index */
/* within this buffer and obtain the block to be loaded. */
PUINT8 pbyBufferPattern;
} tOCT6100_BUFFER_LOAD_BLOCK, *tPOCT6100_BUFFER_LOAD_BLOCK;
typedef struct _OCT6100_BUFFER_UNLOAD_
{
UINT32 ulBufferIndex; /* Index identifying the buffer. */
} tOCT6100_BUFFER_UNLOAD, *tPOCT6100_BUFFER_UNLOAD;
typedef struct _OCT6100_BUFFER_PLAYOUT_ADD_
{
UINT32 ulChannelHndl; /* Echo cancelling channel on which to play the buffer. */
UINT32 ulBufferIndex; /* Index identifying the buffer. */
UINT32 ulPlayoutPort; /* Selected channel port where to play to tone. */
UINT32 ulMixingMode; /* Weither or not the voice stream will be muted while playing the buffer. */
INT32 lGainDb; /* Gain applied to the buffer that will be played on the specified port. */
BOOL fRepeat; /* Use ulRepeatCount variable. */
UINT32 ulRepeatCount; /* Number of times to repeat playing the selected buffer. */
UINT32 ulDuration; /* Duration in millisecond that this buffer should play. Setting this overrides fRepeat. */
UINT32 ulBufferLength; /* Length of the buffer to play (starting at the beginning), AUTO_SELECT for all. */
} tOCT6100_BUFFER_PLAYOUT_ADD, *tPOCT6100_BUFFER_PLAYOUT_ADD;
typedef struct _OCT6100_BUFFER_PLAYOUT_START_
{
UINT32 ulChannelHndl; /* Echo cancelling channel on which to play the buffer. */
UINT32 ulPlayoutPort; /* Selected channel port where to play to tone. */
BOOL fNotifyOnPlayoutStop; /* Check if the buffers have finished playing on this channel/port. */
/* The events are queued in a soft buffer that the user must empty regularly. */
UINT32 ulUserEventId; /* Returned to the user when the playout is finished and the user has set the fNotifyOnPlayoutStop flag. */
BOOL fAllowStartWhileActive; /* Use this to add buffers to something that is already playing on the channel/port. */
} tOCT6100_BUFFER_PLAYOUT_START, *tPOCT6100_BUFFER_PLAYOUT_START;
typedef struct _OCT6100_BUFFER_PLAYOUT_STOP_
{
UINT32 ulChannelHndl; /* Echo cancelling channel on which to play the buffer. */
UINT32 ulPlayoutPort; /* Selected channel port where to play to tone. */
BOOL fStopCleanly; /* Whether or not the skip will be clean. */
PBOOL pfAlreadyStopped; /* Whether playout was already stopped or not. */
PBOOL pfNotifyOnPlayoutStop; /* Whether the user chosed to receive an event on playout stop. */
} tOCT6100_BUFFER_PLAYOUT_STOP, *tPOCT6100_BUFFER_PLAYOUT_STOP;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100BufferPlayoutLoadDef(
OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad );
UINT32 Oct6100BufferPlayoutLoad(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad );
UINT32 Oct6100BufferPlayoutLoadBlockInitDef(
OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit );
UINT32 Oct6100BufferPlayoutLoadBlockInit(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit );
UINT32 Oct6100BufferPlayoutLoadBlockDef(
OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock );
UINT32 Oct6100BufferPlayoutLoadBlock(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock );
UINT32 Oct6100BufferPlayoutUnloadDef(
OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload );
UINT32 Oct6100BufferPlayoutUnload(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload );
UINT32 Oct6100BufferPlayoutAddDef(
OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd );
UINT32 Oct6100BufferPlayoutAdd(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd );
UINT32 Oct6100BufferPlayoutStartDef(
OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart );
UINT32 Oct6100BufferPlayoutStart(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart );
UINT32 Oct6100BufferPlayoutStopDef(
OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop );
UINT32 Oct6100BufferPlayoutStop(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop );
#endif /* __OCT6100_PLAYOUT_BUF_PUB_H__ */

View File

@ -0,0 +1,73 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_remote_debug_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_remote_debug.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_remote_debug_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 6 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_REMOTE_DEBUG_INST_H__
#define __OCT6100_REMOTE_DEBUG_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_REMOTE_DEBUG_INFO_
{
UINT32 ulSessionTreeOfst;
UINT32 ulSessionListOfst;
UINT32 ulSessionListHead;
UINT32 ulSessionListTail;
UINT32 ulPktCacheOfst;
UINT32 ulDataBufOfst;
UINT32 ulNumSessionsOpen;
UINT32 ulMaxSessionsOpen;
} tOCT6100_API_REMOTE_DEBUG_INFO, *tPOCT6100_API_REMOTE_DEBUG_INFO;
typedef struct _OCT6100_API_REMOTE_DEBUG_SESSION_
{
UINT32 ulSessionNum;
UINT32 ulTransactionNum;
UINT32 ulPktRetryNum;
UINT32 ulPktByteSize;
UINT32 aulLastPktTime[ 2 ];
UINT32 ulForwardLink;
UINT32 ulBackwardLink;
} tOCT6100_API_REMOTE_DEBUG_SESSION, *tPOCT6100_API_REMOTE_DEBUG_SESSION;
#endif /* __OCT6100_REMOTE_DEBUG_INST_H__ */

View File

@ -0,0 +1,64 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_remote_debug_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_remote_debug.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_remote_debug_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 6 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_REMOTE_DEBUG_PUB_H__
#define __OCT6100_REMOTE_DEBUG_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_REMOTE_DEBUG_
{
PUINT32 pulReceivedPktPayload;
UINT32 ulReceivedPktLength;
PUINT32 pulResponsePktPayload;
UINT32 ulMaxResponsePktLength;
UINT32 ulResponsePktLength;
} tOCT6100_REMOTE_DEBUG, *tPOCT6100_REMOTE_DEBUG;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100RemoteDebugDef(
OUT tPOCT6100_REMOTE_DEBUG f_pRemoteDebug );
UINT32 Oct6100RemoteDebug(
IN OUT tPOCT6100_INSTANCE_API f_pApiInst,
IN OUT tPOCT6100_REMOTE_DEBUG f_pRemoteDebug );
#endif /* __OCT6100_REMOTE_DEBUG_PUB_H__ */

View File

@ -0,0 +1,72 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_tlv_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_tlv.c. All elements defined in this file are for public
usage of the API. All instate elements are defined in the
oct6100_tlv_inst.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 7 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_TLV_INST_H__
#define __OCT6100_TLV_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_TLV_OFFSET_
{
/* The dword offset contain the number of dword from a base address to reach the desired dword.
i.e. usDwordOffset = (total bit offset) / 32; */
UINT16 usDwordOffset;
/* The bit offset will contain the bit offset required to right shift the DWORD read and obtain
the desired value. This field is depend on the field size.
i.e. byBitOffset = 31 - ((total bit offset) % 32) - byFieldSize; */
UINT8 byBitOffset;
UINT8 byFieldSize;
} tOCT6100_TLV_OFFSET, *tPOCT6100_TLV_OFFSET;
typedef struct _OCT6100_TLV_TONE_INFO_
{
UINT32 ulToneID;
UINT32 ulDetectionPort;
UINT8 aszToneName[ cOCT6100_TLV_MAX_TONE_NAME_SIZE ];
} tOCT6100_TLV_TONE_INFO, *tPOCT6100_TLV_TONE_INFO;
#endif /* __OCT6100_TLV_INST_H__ */

View File

@ -0,0 +1,46 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_tone_detection_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_tone_detection_buf.c. All elements defined in this file are for
public usage of the API. All private elements are defined in the
oct6100_tone_detection_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 8 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_TONE_DETECTION_INST_H__
#define __OCT6100_TONE_DETECTION_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
#endif /* __OCT6100_TONE_DETECTION_INST_H__ */

View File

@ -0,0 +1,74 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_tone_detection_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_tone_detection.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_tone_detection_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 10 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_TONE_DETECTION_PUB_H__
#define __OCT6100_TONE_DETECTION_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_TONE_DETECTION_ENABLE_
{
UINT32 ulChannelHndl;
UINT32 ulToneNumber;
} tOCT6100_TONE_DETECTION_ENABLE, *tPOCT6100_TONE_DETECTION_ENABLE;
typedef struct _OCT6100_TONE_DETECTION_DISABLE_
{
UINT32 ulChannelHndl;
UINT32 ulToneNumber;
BOOL fDisableAll;
} tOCT6100_TONE_DETECTION_DISABLE, *tPOCT6100_TONE_DETECTION_DISABLE;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100ToneDetectionEnableDef(
OUT tPOCT6100_TONE_DETECTION_ENABLE f_pBufferLoad );
UINT32 Oct6100ToneDetectionEnable(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_TONE_DETECTION_ENABLE f_pBufferLoad );
UINT32 Oct6100ToneDetectionDisableDef(
OUT tPOCT6100_TONE_DETECTION_DISABLE f_pBufferUnload );
UINT32 Oct6100ToneDetectionDisable(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_TONE_DETECTION_DISABLE f_pBufferUnload );
#endif /* __OCT6100_TONE_DETECTION_PUB_H__ */

View File

@ -0,0 +1,70 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_tsi_cnct_inst.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_tsi_cnct.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_tsi_cnct_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 9 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_TSI_CNCT_INST_H__
#define __OCT6100_TSI_CNCT_INST_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_API_TSI_CNCT_
{
/* Flag specifying whether the entry is used or not. */
UINT8 fReserved;
/* Count used to manage entry handles allocated to user. */
UINT8 byEntryOpenCnt;
/* Input PCM law. */
UINT8 byInputPcmLaw;
/* TSI chariot memory entry. */
UINT16 usTsiMemIndex;
/* Input and output timeslot information. */
UINT16 usInputTimeslot;
UINT16 usInputStream;
UINT16 usOutputTimeslot;
UINT16 usOutputStream;
/* Internal info for quick access to structures associated to this TSI cnct. */
UINT16 usInputTsstIndex;
UINT16 usOutputTsstIndex;
} tOCT6100_API_TSI_CNCT, *tPOCT6100_API_TSI_CNCT;
#endif /* __OCT6100_TSI_CNCT_INST_H__ */

View File

@ -0,0 +1,76 @@
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_tsi_cnct_pub.h
Copyright (c) 2001-2007 Octasic Inc.
Description:
File containing all defines, macros, and structures pertaining to the file
oct6100_tsi_cnct.c. All elements defined in this file are for public
usage of the API. All private elements are defined in the
oct6100_tsi_cnct_priv.h file.
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API 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.
The OCT6100 GPL API 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 the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 11 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#ifndef __OCT6100_TSI_CNCT_PUB_H__
#define __OCT6100_TSI_CNCT_PUB_H__
/***************************** INCLUDE FILES *******************************/
/***************************** DEFINES *************************************/
/***************************** TYPES ***************************************/
typedef struct _OCT6100_TSI_CNCT_OPEN_
{
PUINT32 pulTsiCnctHndl;
UINT32 ulInputTimeslot;
UINT32 ulInputStream;
UINT32 ulOutputTimeslot;
UINT32 ulOutputStream;
} tOCT6100_TSI_CNCT_OPEN, *tPOCT6100_TSI_CNCT_OPEN;
typedef struct _OCT6100_TSI_CNCT_CLOSE_
{
UINT32 ulTsiCnctHndl;
} tOCT6100_TSI_CNCT_CLOSE, *tPOCT6100_TSI_CNCT_CLOSE;
/************************** FUNCTION PROTOTYPES *****************************/
UINT32 Oct6100TsiCnctOpenDef(
OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen );
UINT32 Oct6100TsiCnctOpen(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen );
UINT32 Oct6100TsiCnctCloseDef(
OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose );
UINT32 Oct6100TsiCnctClose(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose );
#endif /* __OCT6100_TSI_CNCT_PUB_H__ */

Some files were not shown because too many files have changed in this diff Show More