commit 37d7fa7261d9738e285e70f874ad439974a98151 Author: magnum88 Date: Tue Jun 4 19:03:30 2024 +0200 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..7ba0b98 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +DatvRx +=============== + +Digital Tv HamRadio under Linux +V2.0 +============================ + + +## Version en production 2.0 + +## 2.0 + + +Récupérer le ZIP,
+Ou télécharger le repo
+```git clone http://fra1od.freeboxos.fr:3000/magnum88/DatvRx ```
+Il vous reste à installer les dépendenses
+```pip install -r requierement.txt```
+ +puis compiler longmynd s’il ne marchera pas
+dans le répertoire longmynd
+`` +sudo apt-get install libusb-1.0-0-dev libasound2-dev tstools +make +``
+revenir dans le répertoire DatvRx
+copier le fichier
+dans /etc/udev/rules.d/
+donc
+``` +sudo cp minitiouner.rules /etc/udev/rules.d/ +```
+et enfin lancer le programme
+puis faire ./main.py
+ + +73
+Xavier + diff --git a/config.json b/config.json new file mode 100755 index 0000000..d7e0f2f --- /dev/null +++ b/config.json @@ -0,0 +1,7 @@ +{"IP": "127.0.0.1", +"PORT": "4321", +"DEV": "/dev/ttyUSB0", +"FREQ": "1049", +"F1": "9", +"F2": "250", +"SR": "333"} \ No newline at end of file diff --git a/icon.ico b/icon.ico new file mode 100755 index 0000000..787ed93 Binary files /dev/null and b/icon.ico differ diff --git a/img/aprs_ico2.png b/img/aprs_ico2.png new file mode 100755 index 0000000..e37a64e Binary files /dev/null and b/img/aprs_ico2.png differ diff --git a/img/btnjaune.gif b/img/btnjaune.gif new file mode 100755 index 0000000..6eb732b Binary files /dev/null and b/img/btnjaune.gif differ diff --git a/img/btnjaunesmall.gif b/img/btnjaunesmall.gif new file mode 100755 index 0000000..2cdec2a Binary files /dev/null and b/img/btnjaunesmall.gif differ diff --git a/img/btnrouge.gif b/img/btnrouge.gif new file mode 100755 index 0000000..88bb583 Binary files /dev/null and b/img/btnrouge.gif differ diff --git a/img/btnrougesmall.gif b/img/btnrougesmall.gif new file mode 100755 index 0000000..43d0724 Binary files /dev/null and b/img/btnrougesmall.gif differ diff --git a/img/btnvert.gif b/img/btnvert.gif new file mode 100755 index 0000000..f82f893 Binary files /dev/null and b/img/btnvert.gif differ diff --git a/img/btnvertsmall.gif b/img/btnvertsmall.gif new file mode 100755 index 0000000..d8fcc2b Binary files /dev/null and b/img/btnvertsmall.gif differ diff --git a/img/datv_ico.png b/img/datv_ico.png new file mode 100755 index 0000000..ef59b62 Binary files /dev/null and b/img/datv_ico.png differ diff --git a/img/icone.ico b/img/icone.ico new file mode 100755 index 0000000..c9aa028 Binary files /dev/null and b/img/icone.ico differ diff --git a/img/nosignal.png b/img/nosignal.png new file mode 100644 index 0000000..f60da74 Binary files /dev/null and b/img/nosignal.png differ diff --git a/img/test.png b/img/test.png new file mode 100644 index 0000000..0d5a190 Binary files /dev/null and b/img/test.png differ diff --git a/longmynd/.gitignore b/longmynd/.gitignore new file mode 100755 index 0000000..ff4a5ea --- /dev/null +++ b/longmynd/.gitignore @@ -0,0 +1,5 @@ +*~ +*.swp +*.o +longmynd +fake_read diff --git a/longmynd/.travis.yml b/longmynd/.travis.yml new file mode 100755 index 0000000..d5e0562 --- /dev/null +++ b/longmynd/.travis.yml @@ -0,0 +1,31 @@ +## Travis CI Configuration file + +matrix: + include: + # Ubuntu 16.04 + - os: linux + dist: xenial + # Ubuntu 18.04 + - os: linux + dist: bionic +language: c + +# Install dependencies +before_install: + - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + - sudo apt-get update -q + # Build dependencies + - sudo apt-get install libusb-1.0-0-dev libasound2-dev -y + # Test Matrix dependencies + - sudo apt-get install gcc-5 gcc-6 gcc-7 gcc-8 gcc-9 -y + +# Only grab latest git commit (no need for history) +git: + depth: 1 + +script: + - make clean && make werror GCC=gcc-5 + - make clean && make werror GCC=gcc-6 + - make clean && make werror GCC=gcc-7 + - make clean && make werror GCC=gcc-8 + - make clean && make werror GCC=gcc-9 \ No newline at end of file diff --git a/longmynd/LICENSE b/longmynd/LICENSE new file mode 100755 index 0000000..94a9ed0 --- /dev/null +++ b/longmynd/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/longmynd/Makefile b/longmynd/Makefile new file mode 100755 index 0000000..6750211 --- /dev/null +++ b/longmynd/Makefile @@ -0,0 +1,40 @@ +BIN = longmynd +SRC = main.c nim.c ftdi.c stv0910.c stv0910_utils.c stvvglna.c stvvglna_utils.c stv6120.c stv6120_utils.c ftdi_usb.c fifo.c udp.c beep.c ts.c +OBJ = ${SRC:.c=.o} + +ifndef CC +CC = gcc +endif +COPT = -O3 -march=native -mtune=native +CFLAGS += -Wall -Wextra -Wpedantic -Wunused -DVERSION=\"${VER}\" -pthread -D_GNU_SOURCE +LDFLAGS += -lusb-1.0 -lm -lasound + +all: ${BIN} fake_read + +debug: COPT = -Og +debug: CFLAGS += -ggdb -fno-omit-frame-pointer +debug: all + +werror: CFLAGS += -Werror +werror: all + +fake_read: + @echo " CC "$@ + @${CC} fake_read.c -o $@ + +$(BIN): ${OBJ} + @echo " LD "$@ + @${CC} ${COPT} ${CFLAGS} -o $@ ${OBJ} ${LDFLAGS} + +%.o: %.c + @echo " CC "$< + @${CC} ${COPT} ${CFLAGS} -c -fPIC -o $@ $< + +clean: + @rm -rf ${BIN} fake_read ${OBJ} + +tags: + @ctags * + +.PHONY: all clean + diff --git a/longmynd/README.md b/longmynd/README.md new file mode 100755 index 0000000..81a2d69 --- /dev/null +++ b/longmynd/README.md @@ -0,0 +1,154 @@ +# Longmynd [![Build Status](https://travis-ci.org/myorangedragon/longmynd.svg?branch=master)](https://travis-ci.org/myorangedragon/longmynd) + +An Open Source Linux ATV Receiver. + +Copyright 2019 Heather Lomond + +## Dependencies + + sudo apt-get install libusb-1.0-0-dev libasound2-dev tstools + +To run longmynd without requiring root, unplug the minitiouner and then install the udev rules file with: + + sudo cp minitiouner.rules /etc/udev/rules.d/ + +## Compile + + make + +## Run + +Please refer to the longmynd manual page via: + +``` +man -l longmynd.1 +``` + +## Standalone + +If running longmynd standalone (i.e. not integrated with the Portsdown software), you must create the status FIFO and (if you plan to use it) the TS FIFO: + +``` +mkfifo longmynd_main_status +mkfifo longmynd_main_ts +``` + +The test harness `fake_read` or a similar process must be running to consume the output of the status FIFO: + +``` +./fake_read & +``` + +A video player (e.g. VLC) must be running to consume the output of the TS FIFO. + +## Output + + The status fifo is filled with status information as and when it becomes available. + The format of the status information is: + + $n,m + + Where: + n = identifier integer of Status message + m = integer value associated with this status message + + And the values of n and m are defined as: + + ID Meaning Value and Units + ============================================================================================== + 1 State 0: initialising + 1: searching + 2: found headers + 3: locked on a DVB-S signal + 4: locked on a DVB-S2 signal + 2 LNA Gain On devices that have LNA Amplifiers this represents the two gain + sent as N, where n = (lna_gain<<5) | lna_vgo + Though not actually linear, n can be usefully treated as a single + byte representing the gain of the amplifier + 3 Puncture Rate During a search this is the pucture rate that is being trialled + When locked this is the pucture rate detected in the stream + Sent as a single value, n, where the pucture rate is n/(n+1) + 4 I Symbol Power Measure of the current power being seen in the I symbols + 5 Q Symbol Power Measure of the current power being seen in the Q symbols + 6 Carrier Frequency During a search this is the carrier frequency being trialled + When locked this is the Carrier Frequency detected in the stream + Sent in KHz + 7 I Constellation Single signed byte representing the voltage of a sampled I point + 8 Q Constellation Single signed byte representing the voltage of a sampled Q point + 9 Symbol Rate During a search this is the symbol rate being trialled + When locked this is the symbol rate detected in the stream + 10 Viterbi Error Rate Viterbi correction rate as a percentage * 100 + 11 BER Bit Error Rate as a Percentage * 100 + 12 MER Modulation Error Ratio in dB * 10 + 13 Service Provider TS Service Provider Name + 14 Service TS Service Name + 15 Null Ratio Ratio of Nulls in TS as percentage + 16 ES PID Elementary Stream PID (repeated as pair with 17 for each ES) + 17 ES Type Elementary Stream Type (repeated as pair with 16 for each ES) + 18 MODCOD Received Modulation & Coding Rate. See MODCOD Lookup Table below + 19 Short Frames 1 if received signal is using Short Frames, 0 otherwise (DVB-S2 only) + 20 Pilot Symbols 1 if received signal is using Pilot Symbols, 0 otherwise (DVB-S2 only) + 21 LDPC Error Count LDPC Corrected Errors in last frame (DVB-S2 only) + 22 BCH Error Count BCH Corrected Errors in last frame (DVB-S2 only) + 23 BCH Uncorrected 1 if some BCH-detected errors were not able to be corrected, 0 otherwise (DVB-S2 only) + 24 LNB Voltage Enabled 1 if LNB Voltage Supply is enabled, 0 otherwise (LNB Voltage Supply requires add-on board) + 25 LNB H Polarisation 1 if LNB Voltage Supply is configured for Horizontal Polarisation (18V), 0 otherwise (LNB Voltage Supply requires add-on board) + + +### MODCOD Lookup + +### DVB-S +``` +0: QPSK 1/2 +1: QPSK 2/3 +2: QPSK 3/4 +3: QPSK 5/6 +4: QPSK 6/7 +5: QPSK 7/8 +``` + +#### DVB-S2 +``` +0: DummyPL +1: QPSK 1/4 +2: QPSK 1/3 +3: QPSK 2/5 +4: QPSK 1/2 +5: QPSK 3/5 +6: QPSK 2/3 +7: QPSK 3/4 +8: QPSK 4/5 +9: QPSK 5/6 +10: QPSK 8/9 +11: QPSK 9/10 +12: 8PSK 3/5 +13: 8PSK 2/3 +14: 8PSK 3/4 +15: 8PSK 5/6 +16: 8PSK 8/9 +17: 8PSK 9/10 +18: 16APSK 2/3 +19: 16APSK 3/4 +20: 16APSK 4/5 +21: 16APSK 5/6 +22: 16APSK 8/9 +23: 16APSK 9/10 +24: 32APSK 3/4 +25: 32APSK 4/5 +26: 32APSK 5/6 +27: 32APSK 8/9 +28: 32APSK 9/10 +``` + +## License + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + Longmynd 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 longmynd. If not, see . diff --git a/longmynd/beep.c b/longmynd/beep.c new file mode 100755 index 0000000..7f94e42 --- /dev/null +++ b/longmynd/beep.c @@ -0,0 +1,328 @@ +/* + * Copyright (C) 2000-2004 James Courtier-Dutton + * Copyright (C) 2005 Nathan Hurst + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ALSA_PCM_NEW_HW_PARAMS_API +#define ALSA_PCM_NEW_SW_PARAMS_API +#include +#include +#include + +#include "main.h" +#include "errors.h" + +static void generate_sine(uint8_t *frames, int count, double *_phase, double _freq, unsigned int _rate, unsigned int _channels, bool _enable) { + double phase = *_phase; + double max_phase = 1.0 / _freq; + double step = 1.0 / (double)_rate; + double res = 0.0; + unsigned int chn; + int32_t ires; + int16_t *samp16 = (int16_t*) frames; + + while (count-- > 0) { + for(chn = 0; chn < _channels; chn++) { + // SND_PCM_FORMAT_S16_LE: + if(_enable) + { + res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */ + } + ires = res; + *samp16++ = ires >> 16; + } + + phase += step; + if (phase >= max_phase) + phase -= max_phase; + } + + *_phase = phase; +} + +static int set_hwparams( + snd_pcm_t *handle, + snd_pcm_hw_params_t *params, + snd_pcm_access_t access, + snd_pcm_format_t format, + unsigned int rate, + unsigned int channels, + snd_pcm_uframes_t *buffer_size, + snd_pcm_uframes_t *period_size) { + unsigned int rrate; + int err; + snd_pcm_uframes_t period_size_min; + snd_pcm_uframes_t period_size_max; + snd_pcm_uframes_t buffer_size_min; + snd_pcm_uframes_t buffer_size_max; + unsigned int period_time = 0; /* period time in us */ + unsigned int buffer_time = 0; /* ring buffer length in us */ + unsigned int nperiods = 4; /* number of periods */ + + /* choose all parameters */ + err = snd_pcm_hw_params_any(handle, params); + if (err < 0) { + fprintf(stderr, "Broken configuration for playback: no configurations available: %s\n", snd_strerror(err)); + return err; + } + + /* set the interleaved read/write format */ + err = snd_pcm_hw_params_set_access(handle, params, access); + if (err < 0) { + fprintf(stderr, "Access type not available for playback: %s\n", snd_strerror(err)); + return err; + } + + /* set the sample format */ + err = snd_pcm_hw_params_set_format(handle, params, format); + if (err < 0) { + fprintf(stderr, "Sample format not available for playback: %s\n", snd_strerror(err)); + return err; + } + + /* set the count of channels */ + err = snd_pcm_hw_params_set_channels(handle, params, channels); + if (err < 0) { + fprintf(stderr, "Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err)); + return err; + } + + /* set the stream rate */ + rrate = rate; + err = snd_pcm_hw_params_set_rate(handle, params, rate, 0); + if (err < 0) { + fprintf(stderr, "Rate %iHz not available for playback: %s\n", rate, snd_strerror(err)); + return err; + } + + if (rrate != rate) { + fprintf(stderr, "Rate doesn't match (requested %iHz, get %iHz, err %d)\n", rate, rrate, err); + return -EINVAL; + } + + //printf(_("Rate set to %iHz (requested %iHz)\n"), rrate, rate); + /* set the buffer time */ + err = snd_pcm_hw_params_get_buffer_size_min(params, &buffer_size_min); + err = snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size_max); + err = snd_pcm_hw_params_get_period_size_min(params, &period_size_min, NULL); + err = snd_pcm_hw_params_get_period_size_max(params, &period_size_max, NULL); + //printf(_("Buffer size range from %lu to %lu\n"),buffer_size_min, buffer_size_max); + //printf(_("Period size range from %lu to %lu\n"),period_size_min, period_size_max); + if (period_time > 0) { + //printf(_("Requested period time %u us\n"), period_time); + err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, NULL); + if (err < 0) { + fprintf(stderr, "Unable to set period time %u us for playback: %s\n", + period_time, snd_strerror(err)); + return err; + } + } + if (buffer_time > 0) { + //printf(_("Requested buffer time %u us\n"), buffer_time); + err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, NULL); + if (err < 0) { + fprintf(stderr, "Unable to set buffer time %u us for playback: %s\n", + buffer_time, snd_strerror(err)); + return err; + } + } + if (! buffer_time && ! period_time) { + //buffer_size = buffer_size_max; + //buffer_size = buffer_size_min; + *buffer_size = 2048; + if (! period_time) + *buffer_size = (*buffer_size / nperiods) * nperiods; + //printf(_("Using max buffer size %lu\n"), buffer_size); + //printf(_("Using min buffer size %lu\n"), *buffer_size); + err = snd_pcm_hw_params_set_buffer_size_near(handle, params, buffer_size); + if (err < 0) { + fprintf(stderr, "Unable to set buffer size %lu for playback: %s\n", + *buffer_size, snd_strerror(err)); + return err; + } + } + if (! buffer_time || ! period_time) { + //printf(_("Periods = %u\n"), nperiods); + err = snd_pcm_hw_params_set_periods_near(handle, params, &nperiods, NULL); + if (err < 0) { + fprintf(stderr, "Unable to set nperiods %u for playback: %s\n", + nperiods, snd_strerror(err)); + return err; + } + } + + /* write the parameters to device */ + err = snd_pcm_hw_params(handle, params); + if (err < 0) { + fprintf(stderr, "Unable to set hw params for playback: %s\n", snd_strerror(err)); + return err; + } + + snd_pcm_hw_params_get_buffer_size(params, buffer_size); + snd_pcm_hw_params_get_period_size(params, period_size, NULL); + //printf(_("was set period_size = %lu\n"),*period_size); + //printf(_("was set buffer_size = %lu\n"),*buffer_size); + if (2*(*period_size) > *buffer_size) { + fprintf(stderr, "buffer to small, could not use\n"); + return -EINVAL; + } + + return 0; +} + +static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *period_size) { + int err; + + /* get the current swparams */ + err = snd_pcm_sw_params_current(handle, swparams); + if (err < 0) { + fprintf(stderr, "Unable to determine current swparams for playback: %s\n", snd_strerror(err)); + return err; + } + + /* start the transfer when a buffer is full */ + err = snd_pcm_sw_params_set_start_threshold(handle, swparams, *buffer_size - *period_size); + if (err < 0) { + fprintf(stderr, "Unable to set start threshold mode for playback: %s\n", snd_strerror(err)); + return err; + } + + /* allow the transfer when at least period_size frames can be processed */ + err = snd_pcm_sw_params_set_avail_min(handle, swparams, *period_size); + if (err < 0) { + fprintf(stderr, "Unable to set avail min for playback: %s\n", snd_strerror(err)); + return err; + } + + /* write the parameters to the playback device */ + err = snd_pcm_sw_params(handle, swparams); + if (err < 0) { + fprintf(stderr, "Unable to set sw params for playback: %s\n", snd_strerror(err)); + return err; + } + + return 0; +} + +void *loop_beep(void *arg) { + thread_vars_t *thread_vars = (thread_vars_t *)arg; + uint8_t *err = &thread_vars->thread_err; + + while(*err == ERROR_NONE && *thread_vars->main_err_ptr == ERROR_NONE){ + + if(thread_vars->config->beep_enabled){ + + snd_pcm_t *handle; + int error; + snd_pcm_hw_params_t *hwparams; + snd_pcm_sw_params_t *swparams; + + snd_pcm_hw_params_alloca(&hwparams); + snd_pcm_sw_params_alloca(&swparams); + + char *device = "default"; /* playback device */ + snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ + unsigned int rate = 48000; /* stream rate */ + unsigned int channels = 2; /* count of channels */ + snd_pcm_uframes_t buffer_size; + snd_pcm_uframes_t period_size; + + if ((error = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { + printf("Playback open error: %d,%s\n", error,snd_strerror(error)); + *err = ERROR_THREAD_ERROR; + return NULL; + } + + if ((error = set_hwparams(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED, format, rate, channels, &buffer_size, &period_size)) < 0) { + printf("Setting of hwparams failed: %s\n", snd_strerror(error)); + snd_pcm_close(handle); + *err = ERROR_THREAD_ERROR; + return NULL; + } + if ((error = set_swparams(handle, swparams, &buffer_size, &period_size)) < 0) { + printf("Setting of swparams failed: %s\n", snd_strerror(error)); + snd_pcm_close(handle); + *err = ERROR_THREAD_ERROR; + return NULL; + } + + uint8_t *frames; + frames = malloc(snd_pcm_frames_to_bytes(handle, period_size)); + + if (frames == NULL) { + fprintf(stderr, "No enough memory\n"); + *err = ERROR_THREAD_ERROR; + return NULL; + } + + snd_pcm_prepare(handle); + + double freq = 400.0; + double phase = 0.0; + + if(thread_vars->status->modulation_error_rate > 0 && thread_vars->status->modulation_error_rate <= 310) + { + freq = 700.0 * (exp((200+(10*thread_vars->status->modulation_error_rate))/1127.0)-1.0); + } + generate_sine(frames, period_size, &phase, freq, rate, channels, (thread_vars->status->state == STATE_DEMOD_S2)); + + /* Start playback */ + snd_pcm_writei(handle, frames, period_size); + snd_pcm_start(handle); + + snd_pcm_sframes_t avail; + + while(*err == ERROR_NONE && *thread_vars->main_err_ptr == ERROR_NONE && thread_vars->config->beep_enabled){ + /* Wait until device is ready for more data */ + if(snd_pcm_wait(handle, 100)) + { + avail = snd_pcm_avail_update(handle); + if(avail < 0 && avail == -32) + { + /* Handle underrun */ + snd_pcm_prepare(handle); + } + while (avail >= (snd_pcm_sframes_t)period_size) + { + if(thread_vars->status->modulation_error_rate > 0 && thread_vars->status->modulation_error_rate <= 310) + { + freq = 700.0 * (exp((200+(10*thread_vars->status->modulation_error_rate))/1127.0)-1.0); + } + + generate_sine(frames, period_size, &phase, freq, rate, channels, (thread_vars->status->state == STATE_DEMOD_S2)); + while (snd_pcm_writei(handle, frames, period_size) < 0) + { + /* Handle underrun */ + snd_pcm_prepare(handle); + } + avail = snd_pcm_avail_update(handle); + } + } + } + + /* Stop Playback */ + snd_pcm_drop(handle); + + /* Empty buffer */ + snd_pcm_drain(handle); + + free(frames); + snd_pcm_close(handle); + } + + usleep(10*1000); // 10ms + + } + + return NULL; +} \ No newline at end of file diff --git a/longmynd/beep.h b/longmynd/beep.h new file mode 100755 index 0000000..91e6fd6 --- /dev/null +++ b/longmynd/beep.h @@ -0,0 +1,28 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: beep.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef BEEP_H +#define BEEP_H + +void *loop_beep(void *arg); + +#endif + diff --git a/longmynd/errors.h b/longmynd/errors.h new file mode 100755 index 0000000..be23333 --- /dev/null +++ b/longmynd/errors.h @@ -0,0 +1,78 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: errors.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef ERRORS_H +#define ERRORS_H + +/* possible error states */ +#define ERROR_NONE 0 +#define ERROR_ARGS 1 +#define ERROR_ARGS_INPUT 2 +#define ERROR_STATE 3 +#define ERROR_DEMOD_STATE 4 +#define ERROR_FTDI_READ_HIGH 5 +#define ERROR_READ_DEMOD 6 +#define ERROR_WRITE_DEMOD 7 +#define ERROR_READ_OTHER 8 +#define ERROR_WRITE_OTHER 9 +#define ERROR_FTDI_USB_INIT_LIBUSB 101 +#define ERROR_FTDI_USB_VID_PID 102 +#define ERROR_FTDI_USB_CLAIM 103 +#define ERROR_FTDI_USB_I2C_WRITE 104 +#define ERROR_FTDI_USB_I2C_READ 105 +#define ERROR_FTDI_USB_CMD 106 +#define ERROR_FTDI_USB_INIT 107 +#define ERROR_FTDI_SYNC_AA 10 +#define ERROR_FTDI_SYNC_AB 11 +#define ERROR_NIM_INIT 12 +#define ERROR_LNA_ID 13 +#define ERROR_TUNER_ID 14 +#define ERROR_TUNER_LOCK_TIMEOUT 15 +#define ERROR_TUNER_CAL_TIMEOUT 16 +#define ERROR_TUNER_CAL_LOWPASS_TIMEOUT 17 +#define ERROR_I2C_NO_ACK 18 +#define ERROR_FTDI_I2C_WRITE_LEN 19 +#define ERROR_FTDI_I2C_READ_LEN 20 +#define ERROR_MPSSE 21 +#define ERROR_DEMOD_INIT 22 +#define ERROR_BAD_DEMOD_HUNT_STATE 23 +#define ERROR_TS_FIFO_WRITE 24 +#define ERROR_OPEN_TS_FIFO 25 +#define ERROR_TS_FIFO_CREATE 26 +#define ERROR_STATUS_FIFO_CREATE 27 +#define ERROR_OPEN_STATUS_FIFO 28 +#define ERROR_TS_FIFO_CLOSE 29 +#define ERROR_STATUS_FIFO_CLOSE 30 +#define ERROR_USB_TS_READ 31 +#define ERROR_LNA_AGC_TIMEOUT 32 +#define ERROR_DEMOD_PLL_TIMEOUT 33 +#define ERROR_FTDI_USB_DEVICE_LIST 34 +#define ERROR_FTDI_USB_BAD_DEVICE_NUM 35 +#define ERROR_FTDI_USB_DEVICE_NUM_OPEN 36 +#define ERROR_UDP_WRITE 37 +#define ERROR_UDP_SOCKET_OPEN 38 +#define ERROR_UDP_CLOSE 39 +#define ERROR_VITERBI_PUNCTURE_RATE 40 +#define ERROR_TS_BUFFER_MALLOC 41 +#define ERROR_THREAD_ERROR 41 + +#endif + diff --git a/longmynd/fake_read.c b/longmynd/fake_read.c new file mode 100755 index 0000000..0afb461 --- /dev/null +++ b/longmynd/fake_read.c @@ -0,0 +1,32 @@ +/* pretends to be a portsdown */ +#include +#include +#include +#include +#include +#include + +int main() { + int num; + int ret; + + int fd_status_fifo; + + char status_message[14]; + + /* Open status FIFO for read only */ + ret=mkfifo("longmynd_main_status", 0666); + fd_status_fifo = open("longmynd_main_status", O_RDONLY); + if (fd_status_fifo<0) printf("Failed to open status fifo\n"); + + printf("Listening\n"); + + while (1) { + num=read(fd_status_fifo, status_message, 1); + status_message[num]='\0'; + if (num>0) printf("%s",status_message); + } + close(fd_status_fifo); + return 0; +} + diff --git a/longmynd/fifo.c b/longmynd/fifo.c new file mode 100755 index 0000000..f52328e --- /dev/null +++ b/longmynd/fifo.c @@ -0,0 +1,203 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: fifo.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - linux fifo handlers for the transport stream (TS) and the status stream (status) */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "errors.h" +#include "fifo.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- GLOBALS ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +int fd_ts_fifo; +int fd_status_fifo; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t fifo_ts_write(uint8_t *buffer, uint32_t len) { +/* -------------------------------------------------------------------------------------------------- */ +/* takes a buffer and writes out the contents to the ts fifo but removes the unwanted bytes */ +/* *buffer: the buffer that contains the data to be sent */ +/* len: the length (number of bytes) of data to be sent */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + int ret; + int32_t remaining_len; /* note it is signed so can go negative */ + uint32_t write_size; + + remaining_len=len; + /* we need to loop round sending 510 byte chunks so that we can skip the 2 extra bytes put in by */ + /* the FTDI chip every 512 bytes of USB message */ + while (remaining_len>0) { + if (remaining_len>510) { + /* calculate where to start in the buffer and how many bytes to send */ + write_size=510; + ret=write(fd_ts_fifo, &buffer[len-remaining_len], write_size); + /* note we skip over the 2 bytes inserted by the FTDI */ + remaining_len-=512; + } else { + write_size=remaining_len; + ret=write(fd_ts_fifo, &buffer[len-remaining_len], write_size); + remaining_len-=write_size; /* should be 0 if all went well */ + } + if (ret!=(int)write_size) { + printf("ERROR: ts fifo write\n"); + err=ERROR_TS_FIFO_WRITE; + break; + } + } + + /* if someting went bad with our calcs, remaining will not be 0 */ + if ((err==ERROR_NONE) && (remaining_len!=0)) { + printf("ERROR: ts fifo write incorrect number of bytes\n"); + err=ERROR_TS_FIFO_WRITE; + } + + if (err!=ERROR_NONE) printf("ERROR: fifo ts write\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t fifo_status_write(uint8_t message, uint32_t data) { +/* -------------------------------------------------------------------------------------------------- */ +/* *message: the string to write out that identifies the status message */ +/* data: an integer to be sent out (as a decimal number string) */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + int ret; + char status_message[30]; + + sprintf(status_message, "$%i,%i\n", message, data); + ret=write(fd_status_fifo, status_message, strlen(status_message)); + if (ret!=(int)strlen(status_message)) { + printf("ERROR: status fifo write\n"); + err=ERROR_TS_FIFO_WRITE; + } + + if (err!=ERROR_NONE) printf("ERROR: fifo status write\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t fifo_status_string_write(uint8_t message, char *data) { +/* -------------------------------------------------------------------------------------------------- */ +/* *message: the string to write out that identifies the status message */ +/* data: an integer to be sent out (as a decimal number string) */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + int ret; + char status_message[5+128]; + + sprintf(status_message, "$%i,%s\n", message, data); + ret=write(fd_status_fifo, status_message, strlen(status_message)); + if (ret!=(int)strlen(status_message)) { + printf("ERROR: status fifo write\n"); + err=ERROR_TS_FIFO_WRITE; + } + + if (err!=ERROR_NONE) printf("ERROR: fifo status write\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +static uint8_t fifo_init(int *fd_ptr, char *fifo_path) { +/* -------------------------------------------------------------------------------------------------- */ +/* initialises the ts and status fifos */ +/* ts_fifo: the name of the fifo to use for the TS */ +/* status_fifo: the name of the fifo to use for the status output */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + printf("Flow: Fifo Init\n"); + + /* if we are using the TS FIFO then set it up first */ + *fd_ptr = open(fifo_path, O_WRONLY); + if (err==ERROR_NONE) { + if (*fd_ptr<0) { + printf("ERROR: Failed to open fifo %s\n",fifo_path); + err=ERROR_OPEN_TS_FIFO; + } else printf(" Status: opened fifo ok\n"); + } + + if (err!=ERROR_NONE) printf("ERROR: fifo init\n"); + + return err; +} + +uint8_t fifo_ts_init(char *fifo_path) { + return fifo_init(&fd_ts_fifo, fifo_path); +} + +uint8_t fifo_status_init(char *fifo_path) { + return fifo_init(&fd_status_fifo, fifo_path); +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t fifo_close(bool ignore_ts_fifo) { +/* ------------------------------------------------------------------------------------------------- */ +/* closes the fifo's */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + int ret; + + if (!ignore_ts_fifo) { + ret=close(fd_ts_fifo); + if (ret!=0) { + printf("ERROR: ts fifo close\n"); + err=ERROR_TS_FIFO_CLOSE; + } + } + + ret=close(fd_status_fifo); + if (ret!=0) { + printf("ERROR: status fifo close\n"); + err=ERROR_STATUS_FIFO_CLOSE; + } + + if (err!=ERROR_NONE) printf("ERROR: fifo close\n"); + + return err; +} + diff --git a/longmynd/fifo.h b/longmynd/fifo.h new file mode 100755 index 0000000..9a6ecb3 --- /dev/null +++ b/longmynd/fifo.h @@ -0,0 +1,35 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: fifo.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef FIFO_H +#define FIFO_H + +#include + +uint8_t fifo_ts_write(uint8_t*, uint32_t); +uint8_t fifo_status_write(uint8_t, uint32_t); +uint8_t fifo_status_string_write(uint8_t, char*); +uint8_t fifo_ts_init(char *fifo_path); +uint8_t fifo_status_init(char *fifo_path); +uint8_t fifo_close(bool); + +#endif + diff --git a/longmynd/ftdi.c b/longmynd/ftdi.c new file mode 100755 index 0000000..fcf2ffd --- /dev/null +++ b/longmynd/ftdi.c @@ -0,0 +1,528 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: ftdi.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - implements all the ftdi i2c accessing routines apart from the usb stuff */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include "ftdi.h" +#include "ftdi_usb.h" +#include "nim.h" +#include "errors.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- DEFINES ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +#define FTDI_VID 0x0403 +#define FTDI_PID 0x6010 + +#define FTDI_NUM_TRIES 10 +#define FTDI_STOP_START_REPEATS 4 +#define FTDI_RDWR_TIMEOUT 100 +#define MSB_FALLING_EDGE_CLOCK_BYTE_IN 0x24 +#define MSB_FALLING_EDGE_CLOCK_BYTE_OUT 0x11 +#define MSB_RISING_EDGE_CLOCK_BIT_IN 0x22 +#define MSB_FAILING_EDGE_CLOCK_BIT_IN 0x26 + +/* +FTDI GPIO Pins +LSB + - AC0: NIM Reset + - AC1: TS2SYNC + - AC2: + - AC3: + - AC4: LNB Bias Enable + - AC5: + - AC6: + - AC7: LNB Bias Voltage Select +MSB +*/ + +#define FTDI_GPIO_PINID_NIM_RESET 0 +#define FTDI_GPIO_PINID_TS2SYNC 1 +#define FTDI_GPIO_PINID_LNB_BIAS_ENABLE 4 +#define FTDI_GPIO_PINID_LNB_BIAS_VSEL 7 + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- GLOBALS ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +static int num_bytes_to_send = 0; +static uint8_t out_buffer[256]; + +/* Default GPIO value 0x6f = 0b01101111 = LNB Bias Off, LNB Voltage 12V, NIM not reset */ +static uint8_t ftdi_gpio_value = 0x6f; + +/* Default GPIO direction 0xf1 = 0b11110001 = LNB pins, NIM Reset are outputs, TS2SYNC is input (0 for in and 1 for out) */ +static uint8_t ftdi_gpio_direction = 0xf1; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_setup_ftdi_io(void){ +/* -------------------------------------------------------------------------------------------------- */ +/* sets up the IO stages of the FTDI and syncs the comms */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint8_t *in_buffer; + uint8_t old_in_buffer=0; + int i; + int clock_divisor = 0x0095; + + printf("Flow: FTDI setup io\n"); + + /* note we don't accumulate errors for this bit as we are trying to sync */ + /* first we send out a byte to act as our sync */ + num_bytes_to_send = 0; + out_buffer[num_bytes_to_send++] = 0xAA; + if (err==ERROR_NONE) ftdi_usb_i2c_write(out_buffer, num_bytes_to_send); + num_bytes_to_send = 0; + /* next we keep reading it until we get it back, and the reply before it */ + for (i=0; i> 8) & 0xFF; + if (err==ERROR_NONE) err=ftdi_usb_i2c_write(out_buffer, num_bytes_to_send); + num_bytes_to_send = 0; + usleep(30000); + + out_buffer[num_bytes_to_send++] = 0x85; + if (err==ERROR_NONE) err=ftdi_usb_i2c_write(out_buffer, num_bytes_to_send); + num_bytes_to_send = 0; + + /* need to wait a while for it to work */ + usleep(30000); + + if (err!=ERROR_NONE) printf("ERROR: set mpsse mode\n"); + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_i2c_set_start(void) { +/* -------------------------------------------------------------------------------------------------- */ +/* sets the i2c start condition on the i2c bus */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + int count; + + + for (count=0; count>8); + err|=ftdi_i2c_send_byte_check_ack(reg&0xff); + if (err==ERROR_NONE) break; + } + + if (err==ERROR_NONE) { + /* Read back the contents of that register */ + for(i=0; i>8); + err|=ftdi_i2c_send_byte_check_ack(reg&0xff); + err|=ftdi_i2c_send_byte_check_ack(val); + err|=ftdi_i2c_set_stop(); + err|=ftdi_i2c_output(); + if (err==ERROR_NONE) break; + } + + timeout++; + + } while ((err!=ERROR_NONE) && (timeout!=FTDI_RDWR_TIMEOUT)); + + if (err!=ERROR_NONE) printf("ERROR: i2c write reg16 0x%.2x, 0x%.4x, 0x%.2x\n",addr,reg, val); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_i2c_read_reg8(uint8_t addr, uint8_t reg, uint8_t *val) { +/* -------------------------------------------------------------------------------------------------- */ +/* read an i2c 8 bit register from the nim */ +/* addr: the i2c bus address to access */ +/* reg: the i2c register to read */ +/* *val: the return value for the register we have read */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + int i; + int timeout=0; + + do { + for (i=0; i */ +/* -------------------------------------------------------------------------------------------------- */ +{ + printf("Flow: FTDI GPIO Write: pin %d -> value %d\n", pin_id, (int)pin_value); + + if(pin_value) + { + ftdi_gpio_value |= (1 << pin_id); + } + else + { + ftdi_gpio_value &= ~(1 << pin_id); + } + + num_bytes_to_send = 0; + out_buffer[num_bytes_to_send++] = 0x82; /* aka. MPSSE_CMD_SET_DATA_BITS_HIGHBYTE */ + out_buffer[num_bytes_to_send++] = ftdi_gpio_value; + out_buffer[num_bytes_to_send++] = ftdi_gpio_direction; + + ftdi_usb_i2c_write(out_buffer, num_bytes_to_send); + + num_bytes_to_send = 0; + + return ERROR_NONE; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_nim_reset(void) +/* -------------------------------------------------------------------------------------------------- */ +/* toggle the reset line on the nim */ +/* -------------------------------------------------------------------------------------------------- */ +{ + printf("Flow: FTDI nim reset\n"); + + ftdi_gpio_write(FTDI_GPIO_PINID_NIM_RESET, 0); + usleep(10000); + + ftdi_gpio_write(FTDI_GPIO_PINID_NIM_RESET, 1); + usleep(10000); + + return ERROR_NONE; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_set_polarisation_supply(bool supply_enable, bool supply_horizontal) +/* -------------------------------------------------------------------------------------------------- */ +/* Controls RT5047A LNB Power Supply IC, fitted to an additional board. */ +/* -------------------------------------------------------------------------------------------------- */ +{ + if(supply_enable) { + /* Set Voltage */ + if(supply_horizontal) { + ftdi_gpio_write(FTDI_GPIO_PINID_LNB_BIAS_VSEL, 1); + } + else { + ftdi_gpio_write(FTDI_GPIO_PINID_LNB_BIAS_VSEL, 0); + } + /* Then enable output */ + ftdi_gpio_write(FTDI_GPIO_PINID_LNB_BIAS_ENABLE, 1); + } + else { + /* Disable output */ + ftdi_gpio_write(FTDI_GPIO_PINID_LNB_BIAS_ENABLE, 0); + } + + return ERROR_NONE; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_init(uint8_t usb_bus, uint8_t usb_addr) { +/* -------------------------------------------------------------------------------------------------- */ +/* initialises the ftdi module on the minitiouner */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + + printf("Flow: FTDI init\n"); + + err=ftdi_usb_init_i2c(usb_bus, usb_addr, FTDI_VID, FTDI_PID); + if (err==ERROR_NONE) err=ftdi_usb_set_mpsse_mode_i2c(); + if (err==ERROR_NONE) err=ftdi_usb_init_ts(usb_bus, usb_addr, FTDI_VID, FTDI_PID); + if (err==ERROR_NONE) err=ftdi_usb_set_mpsse_mode_ts(); + if (err==ERROR_NONE) err=ftdi_setup_ftdi_io(); + if (err==ERROR_NONE) err=ftdi_nim_reset(); + + if (err!=ERROR_NONE) printf("ERROR: FTDI init\n"); + + return err; +} + diff --git a/longmynd/ftdi.h b/longmynd/ftdi.h new file mode 100755 index 0000000..e2a02eb --- /dev/null +++ b/longmynd/ftdi.h @@ -0,0 +1,40 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: ftdi.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef FTDI_H +#define FTDI_H + +#include +#include + +uint8_t ftdi_init(uint8_t, uint8_t); +uint8_t ftdi_set_polarisation_supply(bool, bool); +uint8_t ftdi_send_byte(uint8_t); +uint8_t ftdi_read(uint8_t*,uint8_t*); +uint8_t ftdi_read_highbyte(uint8_t*); +uint8_t ftdi_write_highbyte(uint8_t, uint8_t); + +uint8_t ftdi_i2c_read_reg16 (uint8_t, uint16_t, uint8_t*); +uint8_t ftdi_i2c_read_reg8 (uint8_t, uint8_t, uint8_t*); +uint8_t ftdi_i2c_write_reg16(uint8_t, uint16_t, uint8_t ); +uint8_t ftdi_i2c_write_reg8 (uint8_t, uint8_t, uint8_t ); + +#endif diff --git a/longmynd/ftdi_usb.c b/longmynd/ftdi_usb.c new file mode 100755 index 0000000..1b1395e --- /dev/null +++ b/longmynd/ftdi_usb.c @@ -0,0 +1,376 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: ftdi_usb.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - here we have all the usb interactions with the ftdi module */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include "errors.h" +#include "ftdi_usb.h" +#include "ftdi.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- DEFINES ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +#define FTDI_USB_READ_RETRIES 2 + +/* Requests */ +#define SIO_RESET_REQUEST SIO_RESET +#define SIO_SET_BAUDRATE_REQUEST SIO_SET_BAUD_RATE +#define SIO_SET_DATA_REQUEST SIO_SET_DATA +#define SIO_SET_FLOW_CTRL_REQUEST SIO_SET_FLOW_CTRL +#define SIO_SET_MODEM_CTRL_REQUEST SIO_MODEM_CTRL +#define SIO_POLL_MODEM_STATUS_REQUEST 0x05 +#define SIO_SET_EVENT_CHAR_REQUEST 0x06 +#define SIO_SET_ERROR_CHAR_REQUEST 0x07 +#define SIO_SET_LATENCY_TIMER_REQUEST 0x09 +#define SIO_GET_LATENCY_TIMER_REQUEST 0x0A +#define SIO_SET_BITMODE_REQUEST 0x0B +#define SIO_READ_PINS_REQUEST 0x0C +#define SIO_READ_EEPROM_REQUEST 0x90 +#define SIO_WRITE_EEPROM_REQUEST 0x91 +#define SIO_ERASE_EEPROM_REQUEST 0x92 + +#define LATENCY_MS 16 + +#define SIO_RESET 0 /* Reset the port */ +#define SIO_MODEM_CTRL 1 /* Set the modem control register */ +#define SIO_SET_FLOW_CTRL 2 /* Set flow control register */ +#define SIO_SET_BAUD_RATE 3 /* Set baud rate */ +#define SIO_SET_DATA 4 /* Set the data characteristics of the port */ + +#define SIO_RESET_SIO 0 +#define SIO_RESET_PURGE_RX 1 +#define SIO_RESET_PURGE_TX 2 + +#define FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT) +#define FTDI_DEVICE_IN_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN) + +#define FTDI_RX_CHUNK_SIZE 4096 +#define FTDI_TX_CHUNK_SIZE 4096 + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- GLOBALS ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +uint8_t rx_chunk[FTDI_RX_CHUNK_SIZE]; + +/* MPSSE bitbang modes */ +enum ftdi_mpsse_mode +{ + BITMODE_RESET = 0x00, /* switch off bitbang mode, back to regular serial/FIFO */ + BITMODE_BITBANG= 0x01, /* classical asynchronous bitbang mode, introduced with B-type chips */ + BITMODE_MPSSE = 0x02, /* MPSSE mode, available on 2232x chips */ + BITMODE_SYNCBB = 0x04, /* synchronous bitbang mode, available on 2232x and R-type chips */ + BITMODE_MCU = 0x08, /* MCU Host Bus Emulation mode, available on 2232x chips */ + /* CPU-style fifo mode gets set via EEPROM */ + BITMODE_OPTO = 0x10, /* Fast Opto-Isolated Serial Interface Mode, available on 2232x chips */ + BITMODE_CBUS = 0x20, /* Bitbang on CBUS pins of R-type chips, configure in EEPROM before */ + BITMODE_SYNCFF = 0x40, /* Single Channel Synchronous FIFO mode, available on 2232H chips */ +}; + +static libusb_device_handle *usb_device_handle_i2c; // interface 0, endpoints: 0x81, 0x02 +static libusb_device_handle *usb_device_handle_ts; // interface 1, endpoints: 0x83, 0x04 +static libusb_context *usb_context_i2c; +static libusb_context *usb_context_ts; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_usb_i2c_write( uint8_t *buffer, uint8_t len ){ +/* -------------------------------------------------------------------------------------------------- */ +/* writes data out to the usb */ +/* *buffer: the buffer containing the data to be written out */ +/* len: the number of bytes to send */ +/* return : error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + int sent=0; + int res; + + res=libusb_bulk_transfer(usb_device_handle_i2c, 0x02, buffer, len, &sent, USB_TIMEOUT); + if (res<0) { + printf("ERROR: USB Cmd Write failure %d\n",res); + err=ERROR_FTDI_USB_CMD; + } + + if ((err==ERROR_NONE) && (sent!=len)) { + printf("ERROR: i2c write incorrect num bytes sent=%i, len=%i\n",sent,len); + err=ERROR_FTDI_I2C_WRITE_LEN; + } + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t ftdi_usb_i2c_read( uint8_t **buffer) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads one byte from the usb and returns it. Keeping any other data bytes for later */ +/* Note: we only ever need to read one byte of actual data so we can avoid data copying by using the */ +/* internal buffers of the usb reads to keep the data */ +/* *buffer: iretruned as a pointer the the actual data read into the usb */ +/* len: the number of bytes to read */ +/* return : error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + static int rxed=0; + static int posn=0; + int res; + int n; + + /* if we have unused characters in the buffer then use them up first */ + if (posn!=rxed) { + *buffer=&rx_chunk[posn++]; + } else { + /* if we couldn't do it with data we already have then get a new buffer */ + /* the data may not be available immediatly so try a few times until it appears (or we error) */ + for (n=0; n2) break; + } + /* check we didn't timeout */ + if (n==FTDI_USB_READ_RETRIES) err=ERROR_FTDI_I2C_READ_LEN; + else if (err==ERROR_NONE) { + /* once we have good data, use it to fulfil the request */ + posn=2; + *buffer=&rx_chunk[posn++]; + } + } + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +static uint8_t ftdi_usb_set_mpsse_mode(libusb_device_handle *_device_handle){ +/* -------------------------------------------------------------------------------------------------- */ +/* setup the FTDI USB interface and MPSEE mode */ +/* return : error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint16_t val; + int res; + uint8_t err=ERROR_NONE; + + printf("Flow: FTDI set mpsse mode\n"); + + /* clear out the receive buffers */ + if ((res=libusb_control_transfer(_device_handle, FTDI_DEVICE_OUT_REQTYPE, SIO_RESET_REQUEST, + SIO_RESET_PURGE_RX, 1, NULL, 0, USB_TIMEOUT))<0) { + printf("ERROR: USB RX Purge failed %d",res); + err=ERROR_MPSSE; + } + + /* clear out the transmit buffers */ + if ((res=libusb_control_transfer(_device_handle, FTDI_DEVICE_OUT_REQTYPE, SIO_RESET_REQUEST, + SIO_RESET_PURGE_TX, 1, NULL, 0, USB_TIMEOUT))<0) { + printf("ERROR: USB TX Purge failed %d",res); + err=ERROR_MPSSE; + } + if ((res=libusb_control_transfer(_device_handle, FTDI_DEVICE_OUT_REQTYPE, SIO_RESET_REQUEST, + SIO_RESET_SIO, 1, NULL, 0, USB_TIMEOUT))<0) { + printf("ERROR: USB Reset failed %d",res); + err=ERROR_MPSSE; + } + + /* set the latence of the bus */ + if ((res=libusb_control_transfer(_device_handle, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_LATENCY_TIMER_REQUEST, + LATENCY_MS, 1, NULL, 0, USB_TIMEOUT))<0) { + printf("ERROR: USB Set Latency failed %d",res); + err=ERROR_MPSSE; + } + + /* set the bit modes */ + val = (BITMODE_RESET<<8); + if ((res=libusb_control_transfer(_device_handle, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_BITMODE_REQUEST, + val, 1, NULL, 0, USB_TIMEOUT))<0) { + printf("USB Reset Bitmode failed %d\n",res); + err=ERROR_MPSSE; + } + + val = (BITMODE_MPSSE<<8); + if ((res=libusb_control_transfer(_device_handle, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_BITMODE_REQUEST, + val, 1, NULL, 0, USB_TIMEOUT))<0) { + printf("USB Set MPSSE failed %d\n",res); + err=ERROR_MPSSE; + } + + usleep(1000); + + return err; + +} + +uint8_t ftdi_usb_set_mpsse_mode_i2c(void){ + return ftdi_usb_set_mpsse_mode(usb_device_handle_i2c); +} + +uint8_t ftdi_usb_set_mpsse_mode_ts(void){ + return ftdi_usb_set_mpsse_mode(usb_device_handle_ts); +} + +/* -------------------------------------------------------------------------------------------------- */ +static uint8_t ftdi_usb_init(libusb_context **usb_context_ptr, libusb_device_handle **usb_device_handle_ptr, int interface_num, uint8_t usb_bus, uint8_t usb_addr, uint16_t vid, uint16_t pid) { +/* -------------------------------------------------------------------------------------------------- */ +/* initialise the usb device of choice (or via vid/pid if no USB selected) */ +/* return : error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + ssize_t count; + libusb_device **usb_device_list; + int error_code; + struct libusb_device_descriptor usb_descriptor; + libusb_device *usb_candidate_device; + uint8_t usb_device_count; + + printf("Flow: FTDI USB init\n"); + + if (libusb_init(usb_context_ptr)<0) { + printf("ERROR: Unable to initialise LIBUSB\n"); + err=ERROR_FTDI_USB_INIT_LIBUSB; + } + + /* turn on debug */ + #if LIBUSB_API_VERSION >= 0x01000106 + libusb_set_option(*usb_context_ptr, LIBUSB_LOG_LEVEL_INFO); + #else + libusb_set_debug(*usb_context_ptr, LIBUSB_LOG_LEVEL_INFO); + #endif + + /* now we need to decide if we are opening by VID and PID or by device number */ + if ((err==ERROR_NONE) && (usb_bus==0) && (usb_addr==0)) { + /* if we are using vid and pid it is easy */ + if ((*usb_device_handle_ptr = libusb_open_device_with_vid_pid(*usb_context_ptr, vid, pid))==NULL) { + printf("ERROR: Unable to open device with VID and PID\n"); + printf(" Is the USB cable plugged in?\n"); + err=ERROR_FTDI_USB_VID_PID; + } + + /* if we are finding by usb device number then we have to take a look at the IDs to check we are */ + /* being asked to open the right one. sTto do this we get a list of all the USB devices on the system */ + } else if (err==ERROR_NONE) { + printf("Flow: Searching for bus/device=%i,%i\n",usb_bus,usb_addr); + count=libusb_get_device_list(*usb_context_ptr, &usb_device_list); + if (count<=0) { + printf("ERROR: failed to get the list of devices\n"); + err=ERROR_FTDI_USB_DEVICE_LIST; + } + + if (err==ERROR_NONE) { + /* we need to find the device we have been told to use */ + for (usb_device_count=0; usb_device_count. +*/ + +#ifndef FTDI_USB_H +#define FTDI_USB_H + +#include +#include +#include + +/* Definitions for flow control */ +#define USB_TIMEOUT 5000 +#define USB_FAST_TIMEOUT 500 + +uint8_t ftdi_usb_i2c_write( uint8_t *, uint8_t); +uint8_t ftdi_usb_i2c_read( uint8_t **); +uint8_t ftdi_usb_set_mpsse_mode_i2c(void); +uint8_t ftdi_usb_set_mpsse_mode_ts(void); +uint8_t ftdi_usb_ts_read(uint8_t *, uint16_t *, uint32_t); +uint8_t ftdi_usb_init_i2c(uint8_t, uint8_t, uint16_t, uint16_t); +uint8_t ftdi_usb_init_ts(uint8_t, uint8_t, uint16_t, uint16_t); + +#endif + diff --git a/longmynd/gosrv.sh b/longmynd/gosrv.sh new file mode 100755 index 0000000..63dd412 --- /dev/null +++ b/longmynd/gosrv.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# 2023 F4IYT + +PATHBIN="longmynd" +PATHOSBIN="/usr/bin/" +#echo "1=$1 2=$2 3=$3 4=$4" +#exit 0 + +if [ -z "$1" ] +then + ip="127.0.0.1" +else + ip=$1 +fi + +if [ -z "$2" ] +then + port="1234" +else + port=$2 +fi + +if [ -z "$3" ] +then + freq=$((10491500-9750000)) +else + freq=$(($3-9750000)) +fi + +if [ -z "$4" ] +then + symb=1500 +else + symb=$4 +fi + + +pkexec $PATHBIN/stopsrv.sh + +mkfifo fifo.264 +mkfifo longmynd_main_ts +mkfifo longmynd_main_status + +$PATHBIN/fake_read & + +# Version to display via UDP on a remote machine +$PATHBIN/longmynd -i $ip $port $freq $symb & + diff --git a/longmynd/longmynd.1 b/longmynd/longmynd.1 new file mode 100755 index 0000000..77f2353 --- /dev/null +++ b/longmynd/longmynd.1 @@ -0,0 +1,69 @@ +.TH LONGMYND 1 +.SH NAME +longmynd \- Outputs transport streams from the Minitiouner DVB-S/S2 demodulator +.SH SYNOPSIS +.B longmynd \fR[\fB\-u\fR \fIUSB_BUS USB_DEVICE\fR] + [\fB\-i\fR \fIMAIN_IP_ADDR\fR \fIMAIN_PORT\fR | \fB\-t\fR \fIMAIN_TS_FIFO\fR] + [\fB\-I\fR \fISTATUS_IP_ADDR\fR \fISTATUS_PORT\fR | \fB\-s\fR \fIMAIN_STATUS_FIFO\fR] + [\fB\-w\fR] [\fB\-b\fR] [\fB\-p\fR \fIh\fR | \fB\-p\fR \fIv\fR] + \fIMAIN_FREQ\fR \fIMAIN_SR\fR +.IR +.SH DESCRIPTION +.B longmynd +Interfaces to the Minitiouner hardware to search for and demodulate a DVB-S or DVB-S2 stream. This stream can be output either to a local FIFO (using the default or -t option) or to an IP address/port via UDP. + +The Main TS stream is the one coming out of the Primary FTDI Board. +.SH OPTIONS +.TP +.BR \-u " " \fIUSB_BUS\fR " " \fIUSB_DEVICE\fR +Sets the USB Bus and USB Device Number of the required Minitiouner in a multi device system. +Default uses the first detected Minitiouner. +.TP +.BR \-i " " \fIIP_ADDR\fR " " \fIPORT\fR +If UDP output is required (instead of the default FIFO output), this option sets the IP Address and Port to send the Main TS Stream to. +Default is to use a FIFO for Main TS Stream. +.TP +.BR \-I " " \fIIP_ADDR\fR " " \fIPORT\fR +If UDP output is required (instead of the default FIFO output), this option sets the IP Address and Port to send the Main Status Stream to. +Default is to use a FIFO for Main Status Stream. +.TP +.BR \-t " " \fITS_FIFO\fR +Sets the name of the Main TS Stream output FIFO. +Default is "./longmynd_main_ts". +.TP +.BR \-s " " \fISTATUS_FIFO\fR +Sets the name of the Status output FIFO. +Default is "./longmynd_main_status". +.TP +.BR \-w +If selected, this option swaps over the RF input so that the Main TS Stream is fed from the BOTTOM F-Type of the NIM. +Default uses the TOP RF input for the Main TS stream. +.TP +.BR \-b +If selected, this option enables a tone audio output that will be present when DVB-S2 is being demodulated, and will increase in pitch for an increase in MER, to aid pointing. +By default this option is disabled. +.TP +.BR \-p " " \fIh\fR " "| " "\-p " " \fIv\fR +Controls and enables the LNB supply voltage output when an RT5047A LNB Voltage Regulator is fitted. +"-p v" will set 13V output (Vertical Polarisation), "-p h" will set 18V output (Horizontal Polarisation). +By default the RT5047A output is disabled. +.TP +.BR \fIMAIN_FREQ\fR +specifies the starting frequency (in KHz) of the Main TS Stream search algorithm". +.TP +.BR \fIMAIN_SR\fR +specifies the starting Symbol Rate (in KSPS) of the Main TS Stream search algorithm". + +.SH EXAMPLES +.TP +longmynd 2000 2000 +will find the first available Minitiouner, search for a 2MHz TS Stream at 2MSPS on the TOP RF input, output the TS to a FIFO called "longmynd_main_ts" and the status to a FIFO called "longmynd_main_status". +.TP +longmynd -w 2000 2000 +As above but uses the BOTTOM RF input. +.TP +longmynd -u 1 4 2000 2000 +As above but will attempt to find a minitiouner at usb device 4 on usb bus 1. +.TP +longmynd -i 192.168.1.1 87 2000 2000 +As above but any TS output will be to IP address 192.168.1.1 on port 87 diff --git a/longmynd/main.c b/longmynd/main.c new file mode 100755 index 0000000..10d0d82 --- /dev/null +++ b/longmynd/main.c @@ -0,0 +1,775 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: main.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - the top level (main) and command line procesing */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include "main.h" +#include "ftdi.h" +#include "stv0910.h" +#include "stv0910_regs.h" +#include "stv0910_utils.h" +#include "stv6120.h" +#include "stvvglna.h" +#include "nim.h" +#include "errors.h" +#include "fifo.h" +#include "ftdi_usb.h" +#include "udp.h" +#include "beep.h" +#include "ts.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- DEFINES ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +/* Milliseconds between each i2c control loop */ +#define I2C_LOOP_MS 100 + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- GLOBALS ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +static longmynd_config_t longmynd_config = { + .new = false, + .mutex = PTHREAD_MUTEX_INITIALIZER +}; + +static longmynd_status_t longmynd_status = { + .service_name = "\0", + .service_provider_name = "\0", + .last_updated_monotonic = 0, + .mutex = PTHREAD_MUTEX_INITIALIZER, + .signal = PTHREAD_COND_INITIALIZER +}; + +static pthread_t thread_ts_parse; +static pthread_t thread_ts; +static pthread_t thread_i2c; +static pthread_t thread_beep; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint64_t timestamp_ms(void) { +/* -------------------------------------------------------------------------------------------------- */ +/* Returns the current unix timestamp in milliseconds */ +/* return: unix timestamp in milliseconds */ +/* -------------------------------------------------------------------------------------------------- */ + struct timespec tp; + + if(clock_gettime(CLOCK_REALTIME, &tp) != 0) + { + return 0; + } + + return (uint64_t) tp.tv_sec * 1000 + tp.tv_nsec / 1000000; +} + +void config_set_frequency(uint32_t frequency) +{ + if (frequency <= 2450000 && frequency >= 144000) + { + pthread_mutex_lock(&longmynd_config.mutex); + + longmynd_config.freq_requested = frequency; + longmynd_config.new = true; + + pthread_mutex_unlock(&longmynd_config.mutex); + } +} + +void config_set_symbolrate(uint32_t symbolrate) +{ + if (symbolrate <= 27500 && symbolrate >= 33) + { + pthread_mutex_lock(&longmynd_config.mutex); + + longmynd_config.sr_requested = symbolrate; + longmynd_config.new = true; + + pthread_mutex_unlock(&longmynd_config.mutex); + } +} + +void config_set_frequency_and_symbolrate(uint32_t frequency, uint32_t symbolrate) +{ + if (frequency <= 2450000 && frequency >= 144000 + && symbolrate <= 27500 && symbolrate >= 33) + { + pthread_mutex_lock(&longmynd_config.mutex); + + longmynd_config.freq_requested = frequency; + longmynd_config.sr_requested = symbolrate; + longmynd_config.new = true; + + pthread_mutex_unlock(&longmynd_config.mutex); + } +} + +void config_set_lnbv(bool enabled, bool horizontal) +{ + pthread_mutex_lock(&longmynd_config.mutex); + + longmynd_config.polarisation_supply = enabled; + longmynd_config.polarisation_horizontal = horizontal; + longmynd_config.new = true; + + pthread_mutex_unlock(&longmynd_config.mutex); +} + +/* -------------------------------------------------------------------------------------------------- */ +uint64_t monotonic_ms(void) { +/* -------------------------------------------------------------------------------------------------- */ +/* Returns current value of a monotonic timer in milliseconds */ +/* return: monotonic timer in milliseconds */ +/* -------------------------------------------------------------------------------------------------- */ + struct timespec tp; + + if(clock_gettime(CLOCK_MONOTONIC, &tp) != 0) + { + return 0; + } + + return (uint64_t) tp.tv_sec * 1000 + tp.tv_nsec / 1000000; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t process_command_line(int argc, char *argv[], longmynd_config_t *config) { +/* -------------------------------------------------------------------------------------------------- */ +/* processes the command line arguments, sets up the parameters in main from them and error checks */ +/* All the required parameters are passed in */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint8_t param; + bool main_usb_set=false; + bool ts_ip_set=false; + bool ts_fifo_set=false; + bool status_ip_set=false; + bool status_fifo_set=false; + + /* Defaults */ + config->port_swap = false; + config->beep_enabled = false; + config->device_usb_addr = 0; + config->device_usb_bus = 0; + config->ts_use_ip = false; + strcpy(config->ts_fifo_path, "longmynd_main_ts"); + config->status_use_ip = false; + strcpy(config->status_fifo_path, "longmynd_main_status"); + config->polarisation_supply=false; + char polarisation_str[8]; + + param=1; + while (paramdevice_usb_bus =(uint8_t)strtol(argv[param++],NULL,10); + config->device_usb_addr=(uint8_t)strtol(argv[param ],NULL,10); + main_usb_set=true; + break; + case 'i': + strncpy(config->ts_ip_addr,argv[param++], 16); + config->ts_ip_port=(uint16_t)strtol(argv[param],NULL,10); + config->ts_use_ip=true; + ts_ip_set = true; + break; + case 't': + strncpy(config->status_fifo_path, argv[param], 128); + ts_fifo_set=true; + break; + case 'I': + strncpy(config->status_ip_addr,argv[param++], 16); + config->status_ip_port=(uint16_t)strtol(argv[param],NULL,10); + config->status_use_ip=true; + status_ip_set = true; + break; + case 's': + strncpy(config->status_fifo_path, argv[param], 128); + status_fifo_set=true; + break; + case 'p': + strncpy(polarisation_str, argv[param], 8); + config->polarisation_supply=true; + break; + case 'w': + config->port_swap=true; + param--; /* there is no data for this so go back */ + break; + case 'b': + config->beep_enabled=true; + param--; /* there is no data for this so go back */ + break; + } + } + param++; + } + + if ((argc-param)<2) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Main Frequency and Main Symbol Rate not found.\n"); + } + + if (err==ERROR_NONE) { + config->freq_requested =(uint32_t)strtol(argv[param++],NULL,10); + if(config->freq_requested==0) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Main Frequency not in a valid format.\n"); + } + + config->sr_requested =(uint32_t)strtol(argv[param ],NULL,10); + if(config->sr_requested==0) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Main Symbol Rate not in a valid format.\n"); + } + } + + /* Process LNB Voltage Supply parameter */ + if (err==ERROR_NONE && config->polarisation_supply) { + if(0 == strcasecmp("h", polarisation_str)) { + config->polarisation_horizontal=true; + } + else if(0 == strcasecmp("v", polarisation_str)) { + config->polarisation_horizontal=false; + } + else { + config->polarisation_supply = false; + err=ERROR_ARGS_INPUT; + printf("ERROR: Polarisation voltage supply parameter not recognised\n"); + } + } + + if (err==ERROR_NONE) { + if (config->freq_requested>2450000) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Freq must be <= 2450 MHz\n"); + } else if (config->freq_requested<144) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Freq_must be >= 144 MHz\n"); + } else if (config->sr_requested>27500) { + err=ERROR_ARGS_INPUT; + printf("ERROR: SR must be <= 27 Msymbols/s\n"); + } else if (config->sr_requested<33) { + err=ERROR_ARGS_INPUT; + printf("ERROR: SR must be >= 33 Ksymbols/s\n"); + } else if (ts_ip_set && ts_fifo_set) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Cannot set TS FIFO and TS IP address\n"); + } else if (status_ip_set && status_fifo_set) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Cannot set Status FIFO and Status IP address\n"); + } else if (config->ts_use_ip && config->status_use_ip && (config->ts_ip_port == config->status_ip_port) && (0==strcmp(config->ts_ip_addr, config->status_ip_addr))) { + err=ERROR_ARGS_INPUT; + printf("ERROR: Cannot set Status IP & Port identical to TS IP & Port\n"); + } else { /* err==ERROR_NONE */ + printf(" Status: Main Frequency=%i KHz\n",config->freq_requested); + printf(" Main Symbol Rate=%i KSymbols/s\n",config->sr_requested); + if (!main_usb_set) printf(" Using First Minitiouner detected on USB\n"); + else printf(" USB bus/device=%i,%i\n",config->device_usb_bus,config->device_usb_addr); + if (!config->ts_use_ip) printf(" Main TS output to FIFO=%s\n",config->ts_fifo_path); + else printf(" Main TS output to IP=%s:%i\n",config->ts_ip_addr,config->ts_ip_port); + if (!config->status_use_ip) printf(" Main Status output to FIFO=%s\n",config->status_fifo_path); + else printf(" Main Status output to IP=%s:%i\n",config->status_ip_addr,config->status_ip_port); + if (config->port_swap) printf(" NIM inputs are swapped (Main now refers to BOTTOM F-Type\n"); + else printf(" Main refers to TOP F-Type\n"); + if (config->beep_enabled) printf(" MER Beep enabled\n"); + if (config->polarisation_supply) printf(" Polarisation Voltage Supply enabled: %s\n", (config->polarisation_horizontal ? "H, 18V" : "V, 13V")); + } + } + + if (err!=ERROR_NONE) { + printf("Please refer to the longmynd manual page via:\n"); + printf(" man -l longmynd.1\n"); + } + + config->new = true; + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t do_report(longmynd_status_t *status) { +/* -------------------------------------------------------------------------------------------------- */ +/* interrogates the demodulator to find the interesting info to report */ +/* status: the state struct */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + /* LNAs if present */ + if (status->lna_ok) { + uint8_t lna_gain, lna_vgo; + if (err==ERROR_NONE) stvvglna_read_agc(NIM_INPUT_TOP, &lna_gain, &lna_vgo); + status->lna_gain = (lna_gain<<5) | lna_vgo; + } + + /* I,Q powers */ + if (err==ERROR_NONE) err=stv0910_read_power(STV0910_DEMOD_TOP, &status->power_i, &status->power_q); + + /* constellations */ + if (err==ERROR_NONE) { + for (uint8_t count=0; countconstellation[count][0], &status->constellation[count][1]); + } + } + + /* puncture rate */ + if (err==ERROR_NONE) err=stv0910_read_puncture_rate(STV0910_DEMOD_TOP, &status->puncture_rate); + + /* carrier frequency offset we are trying */ + if (err==ERROR_NONE) err=stv0910_read_car_freq(STV0910_DEMOD_TOP, &status->frequency_offset); + + /* symbol rate we are trying */ + if (err==ERROR_NONE) err=stv0910_read_sr(STV0910_DEMOD_TOP, &status->symbolrate); + + /* viterbi error rate */ + if (err==ERROR_NONE) err=stv0910_read_err_rate(STV0910_DEMOD_TOP, &status->viterbi_error_rate); + + /* BER */ + if (err==ERROR_NONE) err=stv0910_read_ber(STV0910_DEMOD_TOP, &status->bit_error_rate); + + /* BCH Uncorrected Flag */ + if (err==ERROR_NONE) err=stv0910_read_errors_bch_uncorrected(STV0910_DEMOD_TOP, &status->errors_bch_uncorrected); + + /* BCH Error Count */ + if (err==ERROR_NONE) err=stv0910_read_errors_bch_count(STV0910_DEMOD_TOP, &status->errors_bch_count); + + /* LDPC Error Count */ + if (err==ERROR_NONE) err=stv0910_read_errors_ldpc_count(STV0910_DEMOD_TOP, &status->errors_ldpc_count); + + /* MER */ + if(status->state==STATE_DEMOD_S || status->state==STATE_DEMOD_S2) { + if (err==ERROR_NONE) err=stv0910_read_mer(STV0910_DEMOD_TOP, &status->modulation_error_rate); + } else { + status->modulation_error_rate = 0; + } + + /* MODCOD, Short Frames, Pilots */ + if (err==ERROR_NONE) err=stv0910_read_modcod_and_type(STV0910_DEMOD_TOP, &status->modcod, &status->short_frame, &status->pilots); + if(status->state!=STATE_DEMOD_S2) { + /* short frames & pilots only valid for S2 DEMOD state */ + status->short_frame = 0; + status->pilots = 0; + } + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +void *loop_i2c(void *arg) { +/* -------------------------------------------------------------------------------------------------- */ +/* Runs a loop to configure and monitor the Minitiouner Receiver */ +/* Configuration is read from the configuration struct */ +/* Status is written to the status struct */ +/* -------------------------------------------------------------------------------------------------- */ + thread_vars_t *thread_vars=(thread_vars_t *)arg; + longmynd_status_t *status=(longmynd_status_t *)thread_vars->status; + uint8_t *err = &thread_vars->thread_err; + + *err=ERROR_NONE; + + longmynd_config_t config_cpy; + longmynd_status_t status_cpy; + + uint64_t last_i2c_loop = timestamp_ms(); + while (*err==ERROR_NONE && *thread_vars->main_err_ptr==ERROR_NONE) { + /* Receiver State Machine Loop Timer */ + do { + /* Sleep for at least 10ms */ + usleep(10*1000); + } while (timestamp_ms() < (last_i2c_loop + I2C_LOOP_MS)); + + /* Check if there's a new config */ + if(thread_vars->config->new) + { + /* Lock config struct */ + pthread_mutex_lock(&thread_vars->config->mutex); + /* Clone status struct locally */ + memcpy(&config_cpy, thread_vars->config, sizeof(longmynd_config_t)); + /* Clear new config flag */ + thread_vars->config->new = false; + /* Set flag to clear ts buffer */ + thread_vars->config->ts_reset = true; + pthread_mutex_unlock(&thread_vars->config->mutex); + + status_cpy.frequency_requested = config_cpy.freq_requested; + /* init all the modules */ + if (*err==ERROR_NONE) *err=nim_init(); + /* we are only using the one demodulator so set the other to 0 to turn it off */ + if (*err==ERROR_NONE) *err=stv0910_init(config_cpy.sr_requested,0); + /* we only use one of the tuners in STV6120 so freq for tuner 2=0 to turn it off */ + if (*err==ERROR_NONE) *err=stv6120_init(config_cpy.freq_requested,0,config_cpy.port_swap); + /* we turn on the LNA we want and turn the other off (if they exist) */ + if (*err==ERROR_NONE) *err=stvvglna_init(NIM_INPUT_TOP, (config_cpy.port_swap) ? STVVGLNA_OFF : STVVGLNA_ON, &status_cpy.lna_ok); + if (*err==ERROR_NONE) *err=stvvglna_init(NIM_INPUT_BOTTOM, (config_cpy.port_swap) ? STVVGLNA_ON : STVVGLNA_OFF, &status_cpy.lna_ok); + + if (*err!=ERROR_NONE) printf("ERROR: failed to init a device - is the NIM powered on?\n"); + + /* Enable/Disable polarisation voltage supply */ + if (*err==ERROR_NONE) *err=ftdi_set_polarisation_supply(config_cpy.polarisation_supply, config_cpy.polarisation_horizontal); + if (*err==ERROR_NONE) { + status_cpy.polarisation_supply = config_cpy.polarisation_supply; + status_cpy.polarisation_horizontal = config_cpy.polarisation_horizontal; + } + + /* now start the whole thing scanning for the signal */ + if (*err==ERROR_NONE) { + *err=stv0910_start_scan(STV0910_DEMOD_TOP); + status_cpy.state=STATE_DEMOD_HUNTING; + } + } + + /* Main receiver state machine */ + switch(status_cpy.state) { + case STATE_DEMOD_HUNTING: + if (*err==ERROR_NONE) *err=do_report(&status_cpy); + /* process state changes */ + if (*err==ERROR_NONE) *err=stv0910_read_scan_state(STV0910_DEMOD_TOP, &status_cpy.demod_state); + if (status_cpy.demod_state==DEMOD_FOUND_HEADER) { + status_cpy.state=STATE_DEMOD_FOUND_HEADER; + } + else if (status_cpy.demod_state==DEMOD_S2) { + status_cpy.state=STATE_DEMOD_S2; + } + else if (status_cpy.demod_state==DEMOD_S) { + status_cpy.state=STATE_DEMOD_S; + } + else if ((status_cpy.demod_state!=DEMOD_HUNTING) && (*err==ERROR_NONE)) { + printf("ERROR: demodulator returned a bad scan state\n"); + *err=ERROR_BAD_DEMOD_HUNT_STATE; /* not allowed to have any other states */ + } /* no need for another else, all states covered */ + break; + + case STATE_DEMOD_FOUND_HEADER: + if (*err==ERROR_NONE) *err=do_report(&status_cpy); + /* process state changes */ + *err=stv0910_read_scan_state(STV0910_DEMOD_TOP, &status_cpy.demod_state); + if (status_cpy.demod_state==DEMOD_HUNTING) { + status_cpy.state=STATE_DEMOD_HUNTING; + } + else if (status_cpy.demod_state==DEMOD_S2) { + status_cpy.state=STATE_DEMOD_S2; + } + else if (status_cpy.demod_state==DEMOD_S) { + status_cpy.state=STATE_DEMOD_S; + } + else if ((status_cpy.demod_state!=DEMOD_FOUND_HEADER) && (*err==ERROR_NONE)) { + printf("ERROR: demodulator returned a bad scan state\n"); + *err=ERROR_BAD_DEMOD_HUNT_STATE; /* not allowed to have any other states */ + } /* no need for another else, all states covered */ + break; + + case STATE_DEMOD_S2: + if (*err==ERROR_NONE) *err=do_report(&status_cpy); + /* process state changes */ + *err=stv0910_read_scan_state(STV0910_DEMOD_TOP, &status_cpy.demod_state); + if (status_cpy.demod_state==DEMOD_HUNTING) { + status_cpy.state=STATE_DEMOD_HUNTING; + } + else if (status_cpy.demod_state==DEMOD_FOUND_HEADER) { + status_cpy.state=STATE_DEMOD_FOUND_HEADER; + } + else if (status_cpy.demod_state==DEMOD_S) { + status_cpy.state=STATE_DEMOD_S; + } + else if ((status_cpy.demod_state!=DEMOD_S2) && (*err==ERROR_NONE)) { + printf("ERROR: demodulator returned a bad scan state\n"); + *err=ERROR_BAD_DEMOD_HUNT_STATE; /* not allowed to have any other states */ + } /* no need for another else, all states covered */ + break; + + case STATE_DEMOD_S: + if (*err==ERROR_NONE) *err=do_report(&status_cpy); + /* process state changes */ + *err=stv0910_read_scan_state(STV0910_DEMOD_TOP, &status_cpy.demod_state); + if (status_cpy.demod_state==DEMOD_HUNTING) { + status_cpy.state=STATE_DEMOD_HUNTING; + } + else if (status_cpy.demod_state==DEMOD_FOUND_HEADER) { + status_cpy.state=STATE_DEMOD_FOUND_HEADER; + } + else if (status_cpy.demod_state==DEMOD_S2) { + status_cpy.state=STATE_DEMOD_S2; + } + else if ((status_cpy.demod_state!=DEMOD_S) && (*err==ERROR_NONE)) { + printf("ERROR: demodulator returned a bad scan state\n"); + *err=ERROR_BAD_DEMOD_HUNT_STATE; /* not allowed to have any other states */ + } /* no need for another else, all states covered */ + break; + + default: + *err=ERROR_STATE; /* we should never get here so panic if we do */ + break; + } + + /* Copy local status data over global object */ + pthread_mutex_lock(&status->mutex); + + /* Copy out other vars */ + status->state = status_cpy.state; + status->demod_state = status_cpy.demod_state; + status->lna_ok = status_cpy.lna_ok; + status->lna_gain = status_cpy.lna_gain; + status->power_i = status_cpy.power_i; + status->power_q = status_cpy.power_q; + status->frequency_requested = status_cpy.frequency_requested; + status->frequency_offset = status_cpy.frequency_offset; + status->polarisation_supply = status_cpy.polarisation_supply; + status->polarisation_horizontal = status_cpy.polarisation_horizontal; + status->symbolrate = status_cpy.symbolrate; + status->viterbi_error_rate = status_cpy.viterbi_error_rate; + status->bit_error_rate = status_cpy.bit_error_rate; + status->modulation_error_rate = status_cpy.modulation_error_rate; + status->errors_bch_uncorrected = status_cpy.errors_bch_uncorrected; + status->errors_bch_count = status_cpy.errors_bch_count; + status->errors_ldpc_count = status_cpy.errors_ldpc_count; + memcpy(status->constellation, status_cpy.constellation, (sizeof(uint8_t) * NUM_CONSTELLATIONS * 2)); + status->puncture_rate = status_cpy.puncture_rate; + status->modcod = status_cpy.modcod; + status->short_frame = status_cpy.short_frame; + status->pilots = status_cpy.pilots; + + /* Set monotonic value to signal new data */ + status->last_updated_monotonic = monotonic_ms(); + /* Trigger pthread signal */ + pthread_cond_signal(&status->signal); + pthread_mutex_unlock(&status->mutex); + + last_i2c_loop = timestamp_ms(); + } + return NULL; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t status_all_write(longmynd_status_t *status, uint8_t (*status_write)(uint8_t, uint32_t), uint8_t (*status_string_write)(uint8_t, char*)) { +/* -------------------------------------------------------------------------------------------------- */ +/* Reads the past status struct out to the passed write function */ +/* Returns: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + /* Main status */ + if (err==ERROR_NONE) err=status_write(STATUS_STATE,status->state); + /* LNAs if present */ + if (status->lna_ok) { + if (err==ERROR_NONE) err=status_write(STATUS_LNA_GAIN,status->lna_gain); + } + /* I,Q powers */ + if (err==ERROR_NONE) err=status_write(STATUS_POWER_I, status->power_i); + if (err==ERROR_NONE) err=status_write(STATUS_POWER_Q, status->power_q); + /* constellations */ + for (uint8_t count=0; countconstellation[count][0]); + if (err==ERROR_NONE) err=status_write(STATUS_CONSTELLATION_Q, status->constellation[count][1]); + } + /* puncture rate */ + if (err==ERROR_NONE) err=status_write(STATUS_PUNCTURE_RATE, status->puncture_rate); + /* carrier frequency offset we are trying */ + /* note we now have the offset, so we need to add in the freq we tried to set it to */ + if (err==ERROR_NONE) err=status_write(STATUS_CARRIER_FREQUENCY, (uint32_t)(status->frequency_requested+(status->frequency_offset/1000))); + /* LNB Voltage Supply Enabled: true / false */ + if (err==ERROR_NONE) err=status_write(STATUS_LNB_SUPPLY, status->polarisation_supply); + /* LNB Voltage Supply is Horizontal Polarisation: true / false */ + if (err==ERROR_NONE) err=status_write(STATUS_LNB_POLARISATION_H, status->polarisation_horizontal); + /* symbol rate we are trying */ + if (err==ERROR_NONE) err=status_write(STATUS_SYMBOL_RATE, status->symbolrate); + /* viterbi error rate */ + if (err==ERROR_NONE) err=status_write(STATUS_VITERBI_ERROR_RATE, status->viterbi_error_rate); + /* BER */ + if (err==ERROR_NONE) err=status_write(STATUS_BER, status->bit_error_rate); + /* MER */ + if (err==ERROR_NONE) err=status_write(STATUS_MER, status->modulation_error_rate); + /* BCH Uncorrected Errors Flag */ + if (err==ERROR_NONE) err=status_write(STATUS_ERRORS_BCH_UNCORRECTED, status->errors_bch_uncorrected); + /* BCH Corrected Errors Count */ + if (err==ERROR_NONE) err=status_write(STATUS_ERRORS_BCH_COUNT, status->errors_bch_count); + /* LDPC Corrected Errors Count */ + if (err==ERROR_NONE) err=status_write(STATUS_ERRORS_LDPC_COUNT, status->errors_ldpc_count); + /* Service Name */ + if (err==ERROR_NONE) err=status_string_write(STATUS_SERVICE_NAME, status->service_name); + /* Service Provider Name */ + if (err==ERROR_NONE) err=status_string_write(STATUS_SERVICE_PROVIDER_NAME, status->service_provider_name); + /* TS Null Percentage */ + if (err==ERROR_NONE) err=status_write(STATUS_TS_NULL_PERCENTAGE, status->ts_null_percentage); + /* TS Elementary Stream PIDs */ + for (uint8_t count=0; countts_elementary_streams[count][0] > 0) + { + if (err==ERROR_NONE) err=status_write(STATUS_ES_PID, status->ts_elementary_streams[count][0]); + if (err==ERROR_NONE) err=status_write(STATUS_ES_TYPE, status->ts_elementary_streams[count][1]); + } + } + /* MODCOD */ + if (err==ERROR_NONE) err=status_write(STATUS_MODCOD, status->modcod); + /* Short Frames */ + if (err==ERROR_NONE) err=status_write(STATUS_SHORT_FRAME, status->short_frame); + /* Pilots */ + if (err==ERROR_NONE) err=status_write(STATUS_PILOTS, status->pilots); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +int main(int argc, char *argv[]) { +/* -------------------------------------------------------------------------------------------------- */ +/* command line processing */ +/* module initialisation */ +/* Print out of status information to requested interface, triggered by pthread condition variable */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t (*status_write)(uint8_t,uint32_t); + uint8_t (*status_string_write)(uint8_t,char*); + + printf("Flow: main\n"); + + err=process_command_line(argc, argv, &longmynd_config); + + /* first setup the fifos, udp socket, ftdi and usb */ + if(longmynd_config.status_use_ip) { + if (err==ERROR_NONE) err=udp_status_init(longmynd_config.status_ip_addr, longmynd_config.status_ip_port); + status_write = udp_status_write; + status_string_write = udp_status_string_write; + } else { + if (err==ERROR_NONE) err=fifo_status_init(longmynd_config.status_fifo_path); + status_write = fifo_status_write; + status_string_write = fifo_status_string_write; + } + + if (err==ERROR_NONE) err=ftdi_init(longmynd_config.device_usb_bus, longmynd_config.device_usb_addr); + + thread_vars_t thread_vars_ts = { + .main_err_ptr = &err, + .thread_err = ERROR_NONE, + .config = &longmynd_config, + .status = &longmynd_status + }; + + if(0 != pthread_create(&thread_ts, NULL, loop_ts, (void *)&thread_vars_ts)) + { + fprintf(stderr, "Error creating loop_ts pthread\n"); + } + else + { + pthread_setname_np(thread_ts, "TS Transport"); + } + + thread_vars_t thread_vars_ts_parse = { + .main_err_ptr = &err, + .thread_err = ERROR_NONE, + .config = &longmynd_config, + .status = &longmynd_status + }; + + if(0 != pthread_create(&thread_ts_parse, NULL, loop_ts_parse, (void *)&thread_vars_ts_parse)) + { + fprintf(stderr, "Error creating loop_ts_parse pthread\n"); + } + else + { + pthread_setname_np(thread_ts_parse, "TS Parse"); + } + + thread_vars_t thread_vars_i2c = { + .main_err_ptr = &err, + .thread_err = ERROR_NONE, + .config = &longmynd_config, + .status = &longmynd_status + }; + + if(0 != pthread_create(&thread_i2c, NULL, loop_i2c, (void *)&thread_vars_i2c)) + { + fprintf(stderr, "Error creating loop_i2c pthread\n"); + } + else + { + pthread_setname_np(thread_i2c, "Receiver"); + } + + thread_vars_t thread_vars_beep = { + .main_err_ptr = &err, + .thread_err = ERROR_NONE, + .config = &longmynd_config, + .status = &longmynd_status + }; + + if(0 != pthread_create(&thread_beep, NULL, loop_beep, (void *)&thread_vars_beep)) + { + fprintf(stderr, "Error creating loop_beep pthread\n"); + } + else + { + pthread_setname_np(thread_beep, "Beep Audio"); + } + + uint64_t last_status_sent_monotonic = 0; + longmynd_status_t longmynd_status_cpy; + + while (err==ERROR_NONE) { + /* Test if new status data is available */ + if(longmynd_status.last_updated_monotonic != last_status_sent_monotonic) { + /* Acquire lock on global status struct */ + pthread_mutex_lock(&longmynd_status.mutex); + /* Clone status struct locally */ + memcpy(&longmynd_status_cpy, &longmynd_status, sizeof(longmynd_status_t)); + /* Release lock on global status struct */ + pthread_mutex_unlock(&longmynd_status.mutex); + + /* Send all status via configured output interface from local copy */ + err=status_all_write(&longmynd_status_cpy, status_write, status_string_write); + + /* Update monotonic timestamp last sent */ + last_status_sent_monotonic = longmynd_status_cpy.last_updated_monotonic; + } else { + /* Sleep 10ms */ + usleep(10*1000); + } + /* Check for errors on threads */ + if(err==ERROR_NONE && + (thread_vars_ts.thread_err!=ERROR_NONE + || thread_vars_ts_parse.thread_err!=ERROR_NONE + || thread_vars_beep.thread_err!=ERROR_NONE + || thread_vars_i2c.thread_err!=ERROR_NONE)) { + err=ERROR_THREAD_ERROR; + } + } + + /* Exited, wait for child threads to exit */ + pthread_join(thread_ts_parse, NULL); + pthread_join(thread_ts, NULL); + pthread_join(thread_i2c, NULL); + pthread_join(thread_beep, NULL); + + return err; +} diff --git a/longmynd/main.h b/longmynd/main.h new file mode 100755 index 0000000..539fec3 --- /dev/null +++ b/longmynd/main.h @@ -0,0 +1,146 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: main.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef MAIN_H +#define MAIN_H + +#include +#include +#include +#include + +/* states of the main loop state machine */ +#define STATE_INIT 0 +#define STATE_DEMOD_HUNTING 1 +#define STATE_DEMOD_FOUND_HEADER 2 +#define STATE_DEMOD_S 3 +#define STATE_DEMOD_S2 4 + +/* define the various status reports */ +#define STATUS_STATE 1 +#define STATUS_LNA_GAIN 2 +#define STATUS_PUNCTURE_RATE 3 +#define STATUS_POWER_I 4 +#define STATUS_POWER_Q 5 +#define STATUS_CARRIER_FREQUENCY 6 +#define STATUS_CONSTELLATION_I 7 +#define STATUS_CONSTELLATION_Q 8 +#define STATUS_SYMBOL_RATE 9 +#define STATUS_VITERBI_ERROR_RATE 10 +#define STATUS_BER 11 +#define STATUS_MER 12 +#define STATUS_SERVICE_NAME 13 +#define STATUS_SERVICE_PROVIDER_NAME 14 +#define STATUS_TS_NULL_PERCENTAGE 15 +#define STATUS_ES_PID 16 +#define STATUS_ES_TYPE 17 +#define STATUS_MODCOD 18 +#define STATUS_SHORT_FRAME 19 +#define STATUS_PILOTS 20 +#define STATUS_ERRORS_LDPC_COUNT 21 +#define STATUS_ERRORS_BCH_COUNT 22 +#define STATUS_ERRORS_BCH_UNCORRECTED 23 +#define STATUS_LNB_SUPPLY 24 +#define STATUS_LNB_POLARISATION_H 25 + +/* The number of constellation peeks we do for each background loop */ +#define NUM_CONSTELLATIONS 16 + +#define NUM_ELEMENT_STREAMS 16 + +typedef struct { + bool port_swap; + uint8_t port; + uint32_t freq_requested; + uint32_t sr_requested; + bool beep_enabled; + + uint8_t device_usb_bus; + uint8_t device_usb_addr; + + bool ts_use_ip; + bool ts_reset; + char ts_fifo_path[128]; + char ts_ip_addr[16]; + int ts_ip_port; + + bool status_use_ip; + char status_fifo_path[128]; + char status_ip_addr[16]; + int status_ip_port; + + bool polarisation_supply; + bool polarisation_horizontal; // false -> 13V, true -> 18V + + bool new; + pthread_mutex_t mutex; +} longmynd_config_t; + +typedef struct { + uint8_t state; + uint8_t demod_state; + bool lna_ok; + uint16_t lna_gain; + uint8_t power_i; + uint8_t power_q; + uint32_t frequency_requested; + int32_t frequency_offset; + bool polarisation_supply; + bool polarisation_horizontal; // false -> 13V, true -> 18V + uint32_t symbolrate; + uint32_t viterbi_error_rate; // DVB-S1 + uint32_t bit_error_rate; // DVB-S2 + uint32_t modulation_error_rate; // DVB-S2 + bool errors_bch_uncorrected; + uint32_t errors_bch_count; + uint32_t errors_ldpc_count; + uint8_t constellation[NUM_CONSTELLATIONS][2]; // { i, q } + uint8_t puncture_rate; + char service_name[255]; + char service_provider_name[255]; + uint8_t ts_null_percentage; + uint16_t ts_elementary_streams[NUM_ELEMENT_STREAMS][2]; // { pid, type } + uint32_t modcod; + bool short_frame; + bool pilots; + + uint64_t last_updated_monotonic; + pthread_mutex_t mutex; + pthread_cond_t signal; +} longmynd_status_t; + +typedef struct { + uint8_t *main_state_ptr; + uint8_t *main_err_ptr; + uint8_t thread_err; + longmynd_config_t *config; + longmynd_status_t *status; +} thread_vars_t; + +uint64_t timestamp_ms(void); + +void config_set_frequency(uint32_t frequency); +void config_set_symbolrate(uint32_t symbolrate); +void config_set_frequency_and_symbolrate(uint32_t frequency, uint32_t symbolrate); +void config_set_lnbv(bool enabled, bool horizontal); + +#endif + diff --git a/longmynd/minitiouner.rules b/longmynd/minitiouner.rules new file mode 100755 index 0000000..a0499fe --- /dev/null +++ b/longmynd/minitiouner.rules @@ -0,0 +1,7 @@ +# Install with `sudo cp minitiouner.rules /etc/udev/rules.d/` +# then unplug and replug the minitiouner + +# Minitiouner uses FT2232H/D default VID/PID, but it's own product string. +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="USB <-> NIM tuner", MODE:="0666" +# Minitiouner Express uses different product string +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="MiniTiouner-Express", MODE:="0666" diff --git a/longmynd/nim.c b/longmynd/nim.c new file mode 100755 index 0000000..902c1d0 --- /dev/null +++ b/longmynd/nim.c @@ -0,0 +1,207 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: nim.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - handlers for the nim module itself */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include "nim.h" +#include "ftdi.h" +#include "errors.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- GLOBALS ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +/* The tuner and LNAs are accessed by turning on the I2C bus repeater in the demodulator + this reduces the noise on the tuner I2C lines as they are inactive when the repeater + is turned off. We need to keep track of this when we access the NIM */ +bool repeater_on; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t nim_read_demod(uint16_t reg, uint8_t *val) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads a demodulator register and takes care of the i2c bus repeater */ +/* reg: which demod register to read */ +/* val: where to put the result */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + /* if we are not using the tuner or lna any more then we can turn off + the repeater to reduce noise + this is bit 7 of the Px_I2CRPT register. Other bits define I2C speed etc. */ + if (repeater_on) { + repeater_on=false; + err=nim_write_demod(0xf12a,0x38); + } + if (err==ERROR_NONE) err=ftdi_i2c_read_reg16(NIM_DEMOD_ADDR,reg,val); + if (err!=ERROR_NONE) printf("ERROR: demod read 0x%.4x\n",reg); + + /* note we don't turn the repeater off as there might be other r/w to tuner/LNAs */ + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t nim_write_demod(uint16_t reg, uint8_t val) { +/* -------------------------------------------------------------------------------------------------- */ +/* writes to a demodulator register and takes care of the i2c bus repeater */ +/* reg: which demod register to write to */ +/* val: what to write to it */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + if (repeater_on) { + repeater_on=false; + err=nim_write_demod(0xf12a,0x38); + } + if (err==ERROR_NONE) err=ftdi_i2c_write_reg16(NIM_DEMOD_ADDR,reg,val); + if (err!=ERROR_NONE) printf("ERROR: demod write 0x%.4x, 0x%.2x\n",reg,val); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t nim_read_lna(uint8_t lna_addr, uint8_t reg, uint8_t *val) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads from the specified lna taking care of the i2c bus repeater */ +/* lna_addr: i2c address of the lna to access */ +/* reg: which lna register to read */ +/* val: where to put the result */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + if (!repeater_on) { + err=nim_write_demod(0xf12a,0xb8); + repeater_on=true; + } + if (err==ERROR_NONE) err=ftdi_i2c_read_reg8(lna_addr,reg,val); + if (err!=ERROR_NONE) printf("ERROR: lna read 0x%.2x, 0x%.2x\n",lna_addr,reg); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t nim_write_lna(uint8_t lna_addr, uint8_t reg, uint8_t val) { +/* -------------------------------------------------------------------------------------------------- */ +/* writes to the specified lna taking care of the i2c bus repeater */ +/* lna_addr: i2c address of the lna to access */ +/* reg: which lna register to write to */ +/* val: what to write to it */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + if (!repeater_on) { + err=nim_write_demod(0xf12a,0xb8); + repeater_on=true; + } + if (err==ERROR_NONE) err=ftdi_i2c_write_reg8(lna_addr,reg,val); + if (err!=ERROR_NONE) printf("ERROR: lna write 0x%.2x, 0x%.2x,0x%.2x\n",lna_addr,reg,val); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t nim_read_tuner(uint8_t reg, uint8_t *val) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads from the stv0910 (tuner) taking care of the i2c bus repeater */ +/* reg: which tuner register to read from */ +/* val: where to put the result */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + if (!repeater_on) { + err=nim_write_demod(0xf12a,0xb8); + repeater_on=true; + } + if (err==ERROR_NONE) err=ftdi_i2c_read_reg8(NIM_TUNER_ADDR,reg,val); + if (err!=ERROR_NONE) printf("ERROR: tuner read 0x%.2x\n",reg); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t nim_write_tuner(uint8_t reg, uint8_t val) { +/* -------------------------------------------------------------------------------------------------- */ +/* writes to the stv0910 (tuner) taking care of the i2c bus repeater */ +/* reg: which tuner register to write to */ +/* val: what to write to it */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + if (!repeater_on) { + err=nim_write_demod(0xf12a,0xb8); + repeater_on=true; + } + if (err==ERROR_NONE) err=ftdi_i2c_write_reg8(NIM_TUNER_ADDR,reg,val); + if (err!=ERROR_NONE) printf("ERROR: tuner write %i,%i\n",reg,val); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t nim_init() { +/* -------------------------------------------------------------------------------------------------- */ +/* initialises the nim (at the highest level) */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint8_t val; + + printf("Flow: NIM init\n"); + + repeater_on = false; + + /* check we can read and write a register */ + /* check to see if we can write and readback to a demod register */ + if (err==ERROR_NONE) err=nim_write_demod(0xf536,0xaa); /* random reg with alternating bits */ + if (err==ERROR_NONE) err=nim_read_demod(0xf536,&val); + if (err==ERROR_NONE) { + if (val!=0xaa) { /* check alternating bits ok */ + printf("ERROR: nim_init didn't r/w to the modulator\n"); + err=ERROR_NIM_INIT; + } + } + + /* we always want to start with the i2c repeater turned off */ + if (err!=ERROR_NONE) err=nim_write_demod(0xf12a,0x38); + + if (err!=ERROR_NONE) printf("ERROR: nim_init\n"); + + return err; +} + diff --git a/longmynd/nim.h b/longmynd/nim.h new file mode 100755 index 0000000..eb7136e --- /dev/null +++ b/longmynd/nim.h @@ -0,0 +1,48 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: nim.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef NIM_H +#define NIM_H + +#include "stvvglna.h" +#include + +#define NIM_DEMOD_ADDR 0xd2 +#define NIM_TUNER_ADDR 0xc0 +#define NIM_LNA_0_ADDR STVVGLNA_I2C_ADDR3 +#define NIM_LNA_1_ADDR STVVGLNA_I2C_ADDR0 + +#define NIM_TUNER_XTAL 30000 /* in KHz */ +#define NIM_DEMOD_MCLK 135000000 /* in Hz */ + +#define NIM_INPUT_TOP 1 +#define NIM_INPUT_BOTTOM 2 + +uint8_t nim_init(); +uint8_t nim_send_d0(); +uint8_t nim_read_tuner (uint8_t, uint8_t*); +uint8_t nim_write_tuner(uint8_t, uint8_t ); +uint8_t nim_read_demod (uint16_t, uint8_t*); +uint8_t nim_write_demod(uint16_t, uint8_t ); +uint8_t nim_read_lna (uint8_t, uint8_t, uint8_t*); +uint8_t nim_write_lna (uint8_t, uint8_t, uint8_t ); + +#endif diff --git a/longmynd/stopsrv.sh b/longmynd/stopsrv.sh new file mode 100755 index 0000000..cf387b2 --- /dev/null +++ b/longmynd/stopsrv.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# 2023 F4IYT + +if [ -e fifo.264 ] +then + rm fifo.264 +fi +if [ -e longmynd_main_status ] +then + rm longmynd_main_* + rm flux.datv + killall fake_read + killall longmynd + +fi + +exit 0 diff --git a/longmynd/stv0910.c b/longmynd/stv0910.c new file mode 100755 index 0000000..1d3fecc --- /dev/null +++ b/longmynd/stv0910.c @@ -0,0 +1,684 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv0910.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - the demodulator support routines (STV0910) */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include "stv0910.h" +#include "stv0910_regs.h" +#include "stv0910_utils.h" +#include "nim.h" +#include "errors.h" +#include "stv0910_regs_init.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_car_freq(uint8_t demod, int32_t *cf) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads the current carrier frequency and return it (in Hz) */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* car_freq: signed place to store the answer */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t val_h, val_m, val_l; + double car_offset_freq; + + /* first off we read in the carrier offset as a signed number */ + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? + RSTV0910_P2_CFR2 : RSTV0910_P1_CFR2, &val_h); /* high byte*/ + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? + RSTV0910_P2_CFR1 : RSTV0910_P1_CFR1, &val_m); /* mid */ + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? + RSTV0910_P2_CFR0 : RSTV0910_P1_CFR0, &val_l); /* low */ + /* since this is a 24 bit signed value, we need to build it as a 24 bit value, shift it up to the top + to get a 32 bit signed value, then convert it to a double */ + car_offset_freq=(double)(int32_t)((((uint32_t)val_h<<16) + ((uint32_t)val_m<< 8) + ((uint32_t)val_l )) << 8); + /* carrier offset freq (MHz)= mclk (MHz) * CFR/2^24. But we have the extra 256 in there from the sign shift */ + /* so in Hz we need: */ + car_offset_freq=135000000*car_offset_freq/256.0/256.0/256.0/256.0; + + *cf=(int32_t)car_offset_freq; + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read carrier frequency\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_constellation(uint8_t demod, uint8_t *i, uint8_t *q) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads an I,Q pair from the constellation monitor registers */ +/* i,q: places to store the results */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_ISYMB : RSTV0910_P1_ISYMB, i); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_QSYMB : RSTV0910_P1_QSYMB, q); + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read constellation\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_sr(uint8_t demod, uint32_t *found_sr) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads the currently detected symbol rate */ +/* found_sr: place to store the result */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + double sr; + uint8_t val_h, val_mu, val_ml, val_l; + uint8_t err; + + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_SFR3 : RSTV0910_P1_SFR3, &val_h); /* high byte */ + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_SFR2 : RSTV0910_P1_SFR2, &val_mu); /* mid upper */ + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_SFR1 : RSTV0910_P1_SFR1, &val_ml); /* mid lower */ + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_SFR0 : RSTV0910_P1_SFR0, &val_l); /* low byte */ + sr=((uint32_t)val_h << 24) + + ((uint32_t)val_mu << 16) + + ((uint32_t)val_ml << 8) + + ((uint32_t)val_l ); + /* sr (MHz) = ckadc (MHz) * SFR/2^32. So in Symbols per Second we need */ + sr=135000000*sr/256.0/256.0/256.0/256.0; + *found_sr=(uint32_t)sr; + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read symbol rate\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_puncture_rate(uint8_t demod, uint8_t *rate) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads teh detected viterbi punctuation rate */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* rate: place to store the result */ +/* The single byta, n, represents a rate=n/n+1 */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t val; + + err=stv0910_read_reg_field(demod==STV0910_DEMOD_TOP ? FSTV0910_P2_VIT_CURPUN : FSTV0910_P1_VIT_CURPUN, &val); + switch (val) { + case STV0910_PUNCTURE_1_2: *rate=1; break; + case STV0910_PUNCTURE_2_3: *rate=2; break; + case STV0910_PUNCTURE_3_4: *rate=3; break; + case STV0910_PUNCTURE_5_6: *rate=5; break; + case STV0910_PUNCTURE_6_7: *rate=6; break; + case STV0910_PUNCTURE_7_8: *rate=7; break; + default: err=ERROR_VITERBI_PUNCTURE_RATE; break; + } + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read puncture rate\n"); + + return err; +} + + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_power(uint8_t demod, uint8_t *power_i, uint8_t *power_q) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads the power registers in the Demodulator and returns the results */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* power_i, power_q: places to store the results */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + + /*power=1/4.ADC */ + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_POWERI : RSTV0910_P1_POWERI, power_i); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_POWERQ : RSTV0910_P1_POWERQ, power_q); + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read power\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_err_rate(uint8_t demod, uint32_t *vit_errs) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads the viterbi error rate registers */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* vit_errs: place to store the result */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t val; + + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_VERROR : RSTV0910_P1_VERROR, &val); + /* 0=perfect, 0xff=6.23 %errors (errs/4096) */ + /* note there is a problem in the datasheet here as it says 255/2048=6.23% */ + /* to report an integer we will report in 100 * the percentage, so 623=6.23% */ + /* also want to round up to the nearest integer just to be pedantic */ + *vit_errs=((((uint32_t)val)*100000/4096)+5)/10; + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read viterbi error rate\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_ber(uint8_t demod, uint32_t *ber) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads the number of bytes processed by the FEC, the number of error bits and then calculates BER */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* ber: place to store the result */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t high, mid_u, mid_m, mid_l, low; + double cpt; + double errs; + + /* first we trigger a buffer transfer and read the byte counter 40 bits */ + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERCPT4 : RSTV0910_P1_FBERCPT4, &high); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERCPT3 : RSTV0910_P1_FBERCPT3, &mid_u); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERCPT2 : RSTV0910_P1_FBERCPT2, &mid_m); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERCPT1 : RSTV0910_P1_FBERCPT1, &mid_l); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERCPT0 : RSTV0910_P1_FBERCPT0, &low); + cpt=(double)high*256.0*256.0*256.0*256.0 + (double)mid_u*256.0*256.0*256.0 + (double)mid_m*256.0*256.0 + + (double)mid_l*256.0 + (double)low; + + /* we have already triggered the register buffer transfer, so now we we read the bit error from them */ + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERERR2 : RSTV0910_P1_FBERERR2, &high); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERERR1 : RSTV0910_P1_FBERERR1, &mid_m); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_FBERERR0 : RSTV0910_P1_FBERERR0, &low); + errs=(double)high*256.0*256.0 + (double)mid_m*256.0 + (double)low; + + *ber=(uint32_t)(10000.0*errs/(cpt*8.0)); + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read BER\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_mer(uint8_t demod, uint32_t *mer) { +/* -------------------------------------------------------------------------------------------------- */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* mer: place to store the result */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t high, low; + + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_NOSRAMPOS : RSTV0910_P1_NOSRAMPOS, &high); + if (err==ERROR_NONE) err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_NOSRAMVAL : RSTV0910_P1_NOSRAMVAL, &low); + + if(((high >> 2) & 0x01) == 1) + { + /* Px_NOSRAM_CNRVAL is valid */ + *mer = ((high & 0x03) << 8) | low; + } + else + { + *mer = 0; + if (err==ERROR_NONE) err=stv0910_write_reg_field(demod==STV0910_DEMOD_TOP ? FSTV0910_P2_NOSRAM_ACTIVATION : FSTV0910_P1_NOSRAM_ACTIVATION, 0x02); + } + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read DVBS2 MER\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_errors_bch_uncorrected(uint8_t demod, bool *errors_bch_uncorrected) { +/* -------------------------------------------------------------------------------------------------- */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read*/ +/* errors_bch_uncorrected: place to store the result */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t result; + + /* This parameter appears to be total, not for an individual demodulator */ + (void)demod; + + err=stv0910_read_reg_field(FSTV0910_ERRORFLAG, &result); + + if(result == 0) { + *errors_bch_uncorrected = true; + } + else { + *errors_bch_uncorrected = false; + } + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read BCH Errors Uncorrected\n"); + + return err; +} + + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_errors_bch_count(uint8_t demod, uint32_t *errors_bch_count) { +/* -------------------------------------------------------------------------------------------------- */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* errors_bch_count: place to store the result */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t result; + + /* This parameter appears to be total, not for an individual demodulator */ + (void)demod; + + err=stv0910_read_reg_field(FSTV0910_BCH_ERRORS_COUNTER, &result); + + *errors_bch_count = (uint32_t)result; + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read BCH Errors Count\n"); + + return err; +} + + + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_errors_ldpc_count(uint8_t demod, uint32_t *errors_ldpc_count) { +/* -------------------------------------------------------------------------------------------------- */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* errors_ldpc_count: place to store the result */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t high, low; + + /* This parameter appears to be total, not for an individual demodulator */ + (void)demod; + + err=stv0910_read_reg_field(FSTV0910_LDPC_ERRORS1, &high); + if (err==ERROR_NONE) err=stv0910_read_reg_field(FSTV0910_LDPC_ERRORS0, &low); + + *errors_ldpc_count = (uint32_t)high << 8 | (uint32_t)low; + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read LDPC Errors Count\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_modcod_and_type(uint8_t demod, uint32_t *modcod, bool *short_frame, bool *pilots) { +/* -------------------------------------------------------------------------------------------------- */ +/* Note that MODCODs are different in DVBS and DVBS2. Also short_frame and pilots only valid for S2 */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* modcod: place to store the result */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t regval; + + err=stv0910_read_reg(demod==STV0910_DEMOD_TOP ? RSTV0910_P2_DMDMODCOD : RSTV0910_P1_DMDMODCOD, ®val); + + *modcod = (regval & 0x7c) >> 2; + *short_frame = (regval & 0x02) >> 1; + *pilots = regval & 0x01; + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read MODCOD\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_setup_clocks() { +/* -------------------------------------------------------------------------------------------------- */ +/* sequence is: */ +/* DIRCLK=0 (the hw clock selection pin) */ +/* RESETB (the hw reset pin) transits from low to high at least 3ms after power stabilises */ +/* disable demodulators (done in register initialisation) */ +/* standby=1 (done in register initialisation) */ +/* set NCOURSE etc. (PLL regs, also done in reg init) */ +/* STANDBY=0 (turn on PLL) */ +/* SYNCTRL:BYPASSPLLCORE=0 (turn on clocks) */ +/* wait for lock bit to go high */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint32_t ndiv; + uint32_t odf; + uint32_t idf; + uint32_t f_phi; + uint32_t f_xtal; + uint8_t cp; + uint8_t lock=0; + uint16_t timeout=0; + + printf("Flow: STV0910 set MCLK\n"); + + /* 800MHz < Fvco < 1800MHz */ + /* Fvco = (ExtClk * 2 * NDIV) / IDF */ + /* (400 * IDF) / ExtClk < NDIV < (900 * IDF) / ExtClk */ + + /* ODF forced to 4 otherwise desynchronization of digital and analog clock which result */ + /* in a bad calculated symbolrate */ + odf=4; + /* IDF forced to 1 : Optimal value */ + idf=1; + if (err==ERROR_NONE) err=stv0910_write_reg_field(FSTV0910_ODF, odf); + if (err==ERROR_NONE) err=stv0910_write_reg_field(FSTV0910_IDF, idf); + + f_xtal=NIM_TUNER_XTAL/1000; /* in MHz */ + f_phi=135000000/1000000; + ndiv=(f_phi * odf * idf) / f_xtal; + if (err==ERROR_NONE) err=stv0910_write_reg_field(FSTV0910_N_DIV, ndiv); + + /* Set CP according to NDIV */ + cp=7; + if (err==ERROR_NONE) err=stv0910_write_reg_field(FSTV0910_CP, cp); + + /* turn on all the clocks */ + if (err==ERROR_NONE) err=stv0910_write_reg_field(FSTV0910_STANDBY, 0); + + /* derive clocks from PLL */ + if (err==ERROR_NONE) err=stv0910_write_reg_field(FSTV0910_BYPASSPLLCORE, 0); + + /* wait for PLL to lock */ + do { + timeout++; + if (timeout==STV0910_PLL_LOCK_TIMEOUT) { + err=ERROR_DEMOD_PLL_TIMEOUT; + printf("ERROR: STV0910 pll lock timeout\n"); + } + if (err==ERROR_NONE) stv0910_read_reg_field(FSTV0910_PLLLOCK, &lock); + } while ((err==ERROR_NONE) && (lock==0)); + + if (err!=ERROR_NONE) printf("ERROR: STV0910 set MCLK\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_setup_equalisers(uint8_t demod) { +/* -------------------------------------------------------------------------------------------------- */ +/* 2 parts DFE, FFE */ +/* DFE: update speed is in EQUALCFG.PX_MU_EQUALDFE. */ +/* turn it on with EQUAL_ON and freeze with PX_MU_EQUALDFE=0 */ +/* FFE: update speed is in FFECFGPX_MU_EQUALFFE. */ +/* turn it on with EQUALFFE_ON and freeze with PX_MU_EQUALFFE=0 */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + + printf("Flow: Setup equlaizers %i\n", demod); + + return ERROR_NONE; +} + + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_setup_carrier_loop(uint8_t demod) { +/* -------------------------------------------------------------------------------------------------- */ +/* 3 stages: */ +/* course: */ +/* CARFREQ sets speed and precision */ +/* limitsd are in CFRUP and CFRLOW */ +/* step size in CFRINC */ +/* fine: */ +/* CARFREQ_BETA_FREQ defines time constant */ +/* once course is done, phase tracking loop is used, ACLC and BCLC define loop parameters */ +/* if DVBS not resolved, attempts to reolve DVB-S2 headers as defined in CARHDR.K_FREQ_HDR */ +/* tracking: */ +/* seperate alpha a beta for DVBS (ACLC and BCLC) and DVB-S2 (Alpha in CLC2S2Q and */ +/* beta in ACLC2S28) */ +/* lock detect: */ +/* DVBS LDI has accumulator. compared to threshold (LDT, LDT2) and the results are */ +/* in DSTATUS.CAR_LOCK */ +/* when lock bit is set, freq detector is disabled amd starts phase tracking. */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + + printf("Flow: Setup carrier loop %i\n", demod); + + /* start at 0 offset */ + err=stv0910_write_reg((demod==STV0910_DEMOD_TOP ? RSTV0910_P2_CFRINIT0 : RSTV0910_P1_CFRINIT0), 0); + if (err==ERROR_NONE) err=stv0910_write_reg((demod==STV0910_DEMOD_TOP ? RSTV0910_P2_CFRINIT1 : RSTV0910_P1_CFRINIT1), 0); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_setup_timing_loop(uint8_t demod, uint32_t sr) { +/* -------------------------------------------------------------------------------------------------- */ +/* coarse aquisition */ +/* put in coarse mode in TMGCFG2 (regs init) */ +/* put in auto mode TMGCFG3 (regs init) */ +/* set SFRUPRATIO, SFTLOWRATIO (regs init) */ +/* set so that when boundary reached scan is inverted (regs init) */ +/* set to keep looking indefinitely (regs init) */ +/* DVBS alpha and beta are used */ +/* observe where it is at with KREFTMG2 */ +/* fine aquisition */ +/* coarse search defines the fine scanning range automtically */ +/* go to fine mode TMGCFG2 */ +/* SFRSTEP.SFR_SCANSTEP defines fineness of scan */ +/* tracking */ +/* it now loads loop parameters */ +/* seperate alphas and betas for DVBS and SVB-S2: */ +/* DVBS TMGALPHA_EXP TIMGBETA_EXP in RTC */ +/* iDVB-S2 TMGALPHAS2_EXP and TMGBETA2_EXP in RTCS2 */ +/* when lock achieved timing offset is in TMGREG */ +/* timing offset can be cancelled out (ie TMGREG set to zero and SFR adjusted accordingly */ +/* */ +/* lock indicator is DSTATUS maximised when locked. */ +/* need to optimise lock thresholds to optimise lock stability */ +/* lock indicator is filtered with time constant: TMGCFG.TMGLOCK_BETA */ +/* this is compared to 2 thresholds TMGTHRISE_TMGLOCK_THRISE and TMGTHFALL.TMGLOCK_THFALL in order */ +/* to issue TMGCLOCK_QUALITY[1:0] which is a 2 bit lock indicator with hysterisis in DSTATUS. */ +/* lock is when TMGLOCK>TMGLOCK_THRISE (in TMGLOCK_QUALITY) */ +/* loss of lock is when TMGLOCK < TTMGLOCK_THFALL in TMGLOCK_QUALITY */ +/* */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint16_t sr_reg; + + printf("Flow: Setup timing loop %i\n", demod); + + /* SR (MHz) = ckadc (135MHz) * SFRINIT / 2^16 */ + /* we have sr in KHz, ckadc in MHz) */ + sr_reg=(uint16_t)((((uint32_t)sr) << 16) / 135 / 1000); + + if (err==ERROR_NONE) err=stv0910_write_reg((demod==STV0910_DEMOD_TOP ? RSTV0910_P2_SFRINIT1 : RSTV0910_P1_SFRINIT0), + (uint8_t)(sr_reg >> 8) ); + if (err==ERROR_NONE) err=stv0910_write_reg((demod==STV0910_DEMOD_TOP ? RSTV0910_P2_SFRINIT0 : RSTV0910_P1_SFRINIT1), + (uint8_t)(sr_reg & 0xFF) ); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_setup_ts(uint8_t demod) { +/* -------------------------------------------------------------------------------------------------- */ +/* format with or without sync and header bytes TSINSDELH */ +/* output rate manual or auto adjust */ +/* control with TSCFX */ +/* serial or paralled TSCFGH.PxTSFIFO_SERIAL (serial is on D7) 2 control bits */ +/* configure bus to low impedance (high Z on reset) OUTCFG */ +/* DPN (data valid/parity negated) is high when FEC is outputting data */ +/* low when redundant data is out[ut eq parity data or rate regulation stuffing bits) */ +/* Data is regulated by CLKOUT and DPN: either data valid or envelope. */ +/* data valid uses continuous clock and select valid data using DPN */ +/* envelope: DPN still indicates valid data and then punctured clock for rate regulation */ +/* TSCFGH.TSFIFO_DVBCI=1 for data and 0 for envelope. */ +/* CLKOUT polarity bit XOR, OUTCFG2.TS/2_CLKOUT_XOR=0 valid rising (=1 for falling). */ +/* TSFIFOMANSPEED controlls data rate (padding). 0x11 manual, 0b00 fully auto. speed is TSSPEE */ +/* if need square clock, TSCFGH.TSFIFO_DUTY50. */ +/* parallel mode is ST back end. CLKOUT held (TSCFGH.TSINFO_DBCI) for unknown data section */ +/* or DVB-CI: DRN is help (CLKOUTnCFG.CLKOUT_XOR) for unknown data section */ +/* in both STRUT is high for first byte of packet */ +/* rate compensation is TSCFGH.TSFIFO_DVBCI */ +/* */ +/* All of this is set in the register init. */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + printf("Flow: Setup ts %i\n", demod); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_start_scan(uint8_t demod) { +/* -------------------------------------------------------------------------------------------------- */ +/* demodulator search sequence is: */ +/* setup the timing loop */ +/* setup the carrier loop */ +/* set initial carrier offset CFRINIT for best guess carrier search */ +/* set initial symbol ratea SFRINIT for best guess blind search */ +/* set manual mode for CFRINC to be used - make it small */ +/* write DMDISTATE to AER = 1 - blind search with best guess */ +/* auto mode for symbol rate will be +/25% SFRUPRATIO and SFRLOWRATIO define this number. */ +/* SFRUP1:AUTO_GUP=1 for auto (and SFRLOW1:AUTO_GLOW=1) */ +/* cold start carrier and sr unknown but use best guess (0x01) */ +/* */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + printf("Flow: STV0910 start scan\n"); + + if (err==ERROR_NONE) err=stv0910_write_reg((demod==STV0910_DEMOD_TOP ? RSTV0910_P2_DMDISTATE : RSTV0910_P1_DMDISTATE), + STV0910_SCAN_BLIND_BEST_GUESS); + + if (err!=ERROR_NONE) printf("ERROR: STV0910 start scan\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_scan_state(uint8_t demod, uint8_t *state) { +/* -------------------------------------------------------------------------------------------------- */ +/* simply reads out the demodulator states for the given demodulator */ +/* demod: STV0910_DEMOD_TOP | STV0910_DEMOD_BOTTOM: which demodulator is being read */ +/* return: error state */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + if (err==ERROR_NONE) err=stv0910_read_reg_field((demod==STV0910_DEMOD_TOP ? + FSTV0910_P2_HEADER_MODE : FSTV0910_P1_HEADER_MODE), state); + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read scan state\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_init_regs() { +/* -------------------------------------------------------------------------------------------------- */ +/* reads all the initial values for all the demodulator registers and sets them up */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t val1; + uint8_t val2; + uint8_t err; + uint16_t i=0; + + printf("Flow: stv0910 init regs\n"); + + /* first we check on the IDs */ + err=nim_read_demod(0xf100, &val1); + if (err==ERROR_NONE) err=nim_read_demod(0xf101, &val2); + printf(" Status: STV0910 MID = 0x%.2x, DID = 0x%.2x\n", val1, val2); + if ((val1!=0x51) || (val2!=0x20)) { + printf("ERROR: read the wrong stv0910 MID/DID"); + return ERROR_DEMOD_INIT; + } + + /* next we initialise all the registers in the list */ + do { + if (err==ERROR_NONE) err=stv0910_write_reg(STV0910DefVal[i].reg, STV0910DefVal[i].val); + } + while (STV0910DefVal[i++].reg!=RSTV0910_TSTTSRS); + + /* finally (from ST example code) reset the LDPC decoder */ + if (err==ERROR_NONE) err=stv0910_write_reg(RSTV0910_TSTRES0, 0x80); + if (err==ERROR_NONE) err=stv0910_write_reg(RSTV0910_TSTRES0, 0x00); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_init(uint32_t sr1, uint32_t sr2) { +/* -------------------------------------------------------------------------------------------------- */ +/* demodulator search sequence is: */ +/* setup the carrier loop */ +/* set initial carrier offset CFRINIT for best guess carrier search */ +/* set manual mode for CFRINC to be used - make it small */ +/* setup the timing loop */ +/* set initial symbol rate SFRINIT */ +/* auto mode for symbol rate will be +/25% SFRUPRATIO and SFRLOWRATIO define this number. */ +/* SFRUP1:AUTO_GUP=1 for auto (and SFRLOW1:AUTO_GLOW=1) */ +/* write DMDISTATE to AER = 1 - blind search with best guess (SR and carrier unknown) */ +/* FLYWHEEL_CPT: when 0xf DVB-S2 is locked in DMDFLYW (also int stus bits */ +/* sr_top : the symbol rate to initialise the top demodulator to (0=disable) */ +/* sr_bottom: the symbol rate to initialise the bottom demodulator to (0=disable) */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + printf("Flow: STV0910 init\n"); + + /* first we stop the demodulators in case they are already running */ + if (err==ERROR_NONE) err=stv0910_write_reg(RSTV0910_P1_DMDISTATE, 0x1c); + if (err==ERROR_NONE) err=stv0910_write_reg(RSTV0910_P2_DMDISTATE, 0x1c); + + /* do the non demodulator specific stuff */ + if (err==ERROR_NONE) err=stv0910_init_regs(); + if (err==ERROR_NONE) err=stv0910_setup_clocks(); + + /* now we do the inits for each specific demodulator */ + if (sr1!=0) { + if (err==ERROR_NONE) err=stv0910_setup_equalisers(STV0910_DEMOD_TOP); + if (err==ERROR_NONE) err=stv0910_setup_carrier_loop(STV0910_DEMOD_TOP); + if (err==ERROR_NONE) err=stv0910_setup_timing_loop(STV0910_DEMOD_TOP, sr1); + } + + if (sr2!=0) { + if (err==ERROR_NONE) err=stv0910_setup_equalisers(STV0910_DEMOD_BOTTOM); + if (err==ERROR_NONE) err=stv0910_setup_carrier_loop(STV0910_DEMOD_BOTTOM); + if (err==ERROR_NONE) err=stv0910_setup_timing_loop(STV0910_DEMOD_BOTTOM, sr2); + } + + if (err!=ERROR_NONE) printf("ERROR: STV0910 init\n"); + + return err; +} + diff --git a/longmynd/stv0910.h b/longmynd/stv0910.h new file mode 100755 index 0000000..0b915b9 --- /dev/null +++ b/longmynd/stv0910.h @@ -0,0 +1,69 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv0910.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STV0910_H +#define STV0910_H + +#include + +#define DEMOD_HUNTING 0 +#define DEMOD_FOUND_HEADER 1 +#define DEMOD_S2 2 +#define DEMOD_S 3 + +#define STV0910_PLL_LOCK_TIMEOUT 100 + +#define STV0910_SCAN_BLIND_BEST_GUESS 0x15 + +#define STV0910_DEMOD_TOP 1 +#define STV0910_DEMOD_BOTTOM 2 + +#define STV0910_PUNCTURE_1_2 0x0d +#define STV0910_PUNCTURE_2_3 0x12 +#define STV0910_PUNCTURE_3_4 0x15 +#define STV0910_PUNCTURE_5_6 0x18 +#define STV0910_PUNCTURE_6_7 0x19 +#define STV0910_PUNCTURE_7_8 0x1a + +uint8_t stv0910_read_car_freq(uint8_t, int32_t*); +uint8_t stv0910_read_constellation(uint8_t, uint8_t*, uint8_t*); +uint8_t stv0910_read_sr(uint8_t demod, uint32_t*); +uint8_t stv0910_read_puncture_rate(uint8_t, uint8_t*); +uint8_t stv0910_read_power(uint8_t, uint8_t*, uint8_t*); +uint8_t stv0910_read_err_rate(uint8_t, uint32_t*); +uint8_t stv0910_read_ber(uint8_t, uint32_t*); +uint8_t stv0910_read_dvbs2_mer(uint8_t, uint32_t*); +uint8_t stv0910_read_errors_bch_uncorrected(uint8_t demod, bool *errors_bch_uncorrected); +uint8_t stv0910_read_errors_bch_count(uint8_t demod, uint32_t *errors_bch_count); +uint8_t stv0910_read_errors_ldpc_count(uint8_t demod, uint32_t *errors_ldpc_count); +uint8_t stv0910_read_mer(uint8_t, uint32_t*); +uint8_t stv0910_read_modcod_and_type(uint8_t, uint32_t*, bool*, bool*); +uint8_t stv0910_init(uint32_t, uint32_t); +uint8_t stv0910_init_regs(void); +uint8_t stv0910_setup_timing_loop(uint8_t, uint32_t); +uint8_t stv0910_setup_carrier_loop(uint8_t); +uint8_t stv0910_read_scan_state(uint8_t, uint8_t *); +uint8_t stv0910_start_scan(uint8_t); +uint8_t stv0910_setup_search_params(uint8_t); +uint8_t stv0910_setup_clocks(); + +#endif + diff --git a/longmynd/stv0910_regs.h b/longmynd/stv0910_regs.h new file mode 100755 index 0000000..e4f8493 --- /dev/null +++ b/longmynd/stv0910_regs.h @@ -0,0 +1,4790 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv0910_regs.h */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - the top level (main) and command line procesing */ +/* Copyright 2019 Heather Lomond */ +/* (c) 2013 Digital Devices GmbH Germany. All rights reserved */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* + * @DVB-S/DVB-S2 STMicroelectronics STV0900 register definitions + * Author Manfred Voelkel, August 2013 + * (c) 2013 Digital Devices GmbH Germany. All rights reserved + * + * ======================================================================= + * Registers Declaration (Internal ST, All Applications ) + * ------------------------- + * Each register (RSTV0910__XXXXX) is defined by its address (2 bytes). + * Each field (FSTV0910__XXXXX) is defined as follow: + * [register address -- 2bytes][field offset -- 4 bits][unused -- 3 bits] + * [field sign -- 1 bit][field mask -- 1byte] + * ======================================================================= + */ + +#ifndef STV0910_REGS_H +#define STV0910_REGS_H + +/* MID */ +#define RSTV0910_MID 0xf100 +#define FSTV0910_MCHIP_IDENT 0xf10040f0 +#define FSTV0910_MRELEASE 0xf100000f + +/* DID */ +#define RSTV0910_DID 0xf101 +#define FSTV0910_DEVICE_ID 0xf10100ff + +/* DACR1 */ +#define RSTV0910_DACR1 0xf113 +#define FSTV0910_DAC_MODE 0xf11350e0 +#define FSTV0910_DAC_VALUE1 0xf113000f + +/* DACR2 */ +#define RSTV0910_DACR2 0xf114 +#define FSTV0910_DAC_VALUE0 0xf11400ff + +/* PADCFG */ +#define RSTV0910_PADCFG 0xf11a +#define FSTV0910_AGCRF2_OPD 0xf11a3008 +#define FSTV0910_AGCRF2_XOR 0xf11a2004 +#define FSTV0910_AGCRF1_OPD 0xf11a1002 +#define FSTV0910_AGCRF1_XOR 0xf11a0001 + +/* OUTCFG2 */ +#define RSTV0910_OUTCFG2 0xf11b +#define FSTV0910_TS2_ERROR_XOR 0xf11b7080 +#define FSTV0910_TS2_DPN_XOR 0xf11b6040 +#define FSTV0910_TS2_STROUT_XOR 0xf11b5020 +#define FSTV0910_TS2_CLOCKOUT_XOR 0xf11b4010 +#define FSTV0910_TS1_ERROR_XOR 0xf11b3008 +#define FSTV0910_TS1_DPN_XOR 0xf11b2004 +#define FSTV0910_TS1_STROUT_XOR 0xf11b1002 +#define FSTV0910_TS1_CLOCKOUT_XOR 0xf11b0001 + +/* OUTCFG */ +#define RSTV0910_OUTCFG 0xf11c +#define FSTV0910_TS2_OUTSER_HZ 0xf11c5020 +#define FSTV0910_TS1_OUTSER_HZ 0xf11c4010 +#define FSTV0910_TS2_OUTPAR_HZ 0xf11c3008 +#define FSTV0910_TS1_OUTPAR_HZ 0xf11c2004 +#define FSTV0910_TS_SERDATA0 0xf11c1002 + +/* IRQSTATUS3 */ +#define RSTV0910_IRQSTATUS3 0xf120 +#define FSTV0910_SPLL_LOCK 0xf1205020 +#define FSTV0910_SSTREAM_LCK_1 0xf1204010 +#define FSTV0910_SSTREAM_LCK_2 0xf1203008 +#define FSTV0910_SDVBS1_PRF_2 0xf1201002 +#define FSTV0910_SDVBS1_PRF_1 0xf1200001 + +/* IRQSTATUS2 */ +#define RSTV0910_IRQSTATUS2 0xf121 +#define FSTV0910_SSPY_ENDSIM_1 0xf1217080 +#define FSTV0910_SSPY_ENDSIM_2 0xf1216040 +#define FSTV0910_SPKTDEL_ERROR_2 0xf1214010 +#define FSTV0910_SPKTDEL_LOCKB_2 0xf1213008 +#define FSTV0910_SPKTDEL_LOCK_2 0xf1212004 +#define FSTV0910_SPKTDEL_ERROR_1 0xf1211002 +#define FSTV0910_SPKTDEL_LOCKB_1 0xf1210001 + +/* IRQSTATUS1 */ +#define RSTV0910_IRQSTATUS1 0xf122 +#define FSTV0910_SPKTDEL_LOCK_1 0xf1227080 +#define FSTV0910_SFEC_LOCKB_2 0xf1226040 +#define FSTV0910_SFEC_LOCK_2 0xf1225020 +#define FSTV0910_SFEC_LOCKB_1 0xf1224010 +#define FSTV0910_SFEC_LOCK_1 0xf1223008 +#define FSTV0910_SDEMOD_LOCKB_2 0xf1222004 +#define FSTV0910_SDEMOD_LOCK_2 0xf1221002 +#define FSTV0910_SDEMOD_IRQ_2 0xf1220001 + +/* IRQSTATUS0 */ +#define RSTV0910_IRQSTATUS0 0xf123 +#define FSTV0910_SDEMOD_LOCKB_1 0xf1237080 +#define FSTV0910_SDEMOD_LOCK_1 0xf1236040 +#define FSTV0910_SDEMOD_IRQ_1 0xf1235020 +#define FSTV0910_SBCH_ERRFLAG 0xf1234010 +#define FSTV0910_SDISEQC2_IRQ 0xf1232004 +#define FSTV0910_SDISEQC1_IRQ 0xf1230001 + +/* IRQMASK3 */ +#define RSTV0910_IRQMASK3 0xf124 +#define FSTV0910_MPLL_LOCK 0xf1245020 +#define FSTV0910_MSTREAM_LCK_1 0xf1244010 +#define FSTV0910_MSTREAM_LCK_2 0xf1243008 +#define FSTV0910_MDVBS1_PRF_2 0xf1241002 +#define FSTV0910_MDVBS1_PRF_1 0xf1240001 + +/* IRQMASK2 */ +#define RSTV0910_IRQMASK2 0xf125 +#define FSTV0910_MSPY_ENDSIM_1 0xf1257080 +#define FSTV0910_MSPY_ENDSIM_2 0xf1256040 +#define FSTV0910_MPKTDEL_ERROR_2 0xf1254010 +#define FSTV0910_MPKTDEL_LOCKB_2 0xf1253008 +#define FSTV0910_MPKTDEL_LOCK_2 0xf1252004 +#define FSTV0910_MPKTDEL_ERROR_1 0xf1251002 +#define FSTV0910_MPKTDEL_LOCKB_1 0xf1250001 + +/* IRQMASK1 */ +#define RSTV0910_IRQMASK1 0xf126 +#define FSTV0910_MPKTDEL_LOCK_1 0xf1267080 +#define FSTV0910_MFEC_LOCKB_2 0xf1266040 +#define FSTV0910_MFEC_LOCK_2 0xf1265020 +#define FSTV0910_MFEC_LOCKB_1 0xf1264010 +#define FSTV0910_MFEC_LOCK_1 0xf1263008 +#define FSTV0910_MDEMOD_LOCKB_2 0xf1262004 +#define FSTV0910_MDEMOD_LOCK_2 0xf1261002 +#define FSTV0910_MDEMOD_IRQ_2 0xf1260001 + +/* IRQMASK0 */ +#define RSTV0910_IRQMASK0 0xf127 +#define FSTV0910_MDEMOD_LOCKB_1 0xf1277080 +#define FSTV0910_MDEMOD_LOCK_1 0xf1276040 +#define FSTV0910_MDEMOD_IRQ_1 0xf1275020 +#define FSTV0910_MBCH_ERRFLAG 0xf1274010 +#define FSTV0910_MDISEQC2_IRQ 0xf1272004 +#define FSTV0910_MDISEQC1_IRQ 0xf1270001 + +/* I2CCFG */ +#define RSTV0910_I2CCFG 0xf129 +#define FSTV0910_I2C_FASTMODE 0xf1293008 +#define FSTV0910_I2CADDR_INC 0xf1290003 + +/* P1_I2CRPT */ +#define RSTV0910_P1_I2CRPT 0xf12a +#define FSTV0910_P1_I2CT_ON 0xf12a7080 +#define FSTV0910_P1_ENARPT_LEVEL 0xf12a4070 +#define FSTV0910_P1_SCLT_DELAY 0xf12a3008 +#define FSTV0910_P1_STOP_ENABLE 0xf12a2004 +#define FSTV0910_P1_STOP_SDAT2SDA 0xf12a1002 + +/* P2_I2CRPT */ +#define RSTV0910_P2_I2CRPT 0xf12b +#define FSTV0910_P2_I2CT_ON 0xf12b7080 +#define FSTV0910_P2_ENARPT_LEVEL 0xf12b4070 +#define FSTV0910_P2_SCLT_DELAY 0xf12b3008 +#define FSTV0910_P2_STOP_ENABLE 0xf12b2004 +#define FSTV0910_P2_STOP_SDAT2SDA 0xf12b1002 + +/* GPIO0CFG */ +#define RSTV0910_GPIO0CFG 0xf140 +#define FSTV0910_GPIO0_OPD 0xf1407080 +#define FSTV0910_GPIO0_CONFIG 0xf140107e +#define FSTV0910_GPIO0_XOR 0xf1400001 + +/* GPIO1CFG */ +#define RSTV0910_GPIO1CFG 0xf141 +#define FSTV0910_GPIO1_OPD 0xf1417080 +#define FSTV0910_GPIO1_CONFIG 0xf141107e +#define FSTV0910_GPIO1_XOR 0xf1410001 + +/* GPIO2CFG */ +#define RSTV0910_GPIO2CFG 0xf142 +#define FSTV0910_GPIO2_OPD 0xf1427080 +#define FSTV0910_GPIO2_CONFIG 0xf142107e +#define FSTV0910_GPIO2_XOR 0xf1420001 + +/* GPIO3CFG */ +#define RSTV0910_GPIO3CFG 0xf143 +#define FSTV0910_GPIO3_OPD 0xf1437080 +#define FSTV0910_GPIO3_CONFIG 0xf143107e +#define FSTV0910_GPIO3_XOR 0xf1430001 + +/* GPIO4CFG */ +#define RSTV0910_GPIO4CFG 0xf144 +#define FSTV0910_GPIO4_OPD 0xf1447080 +#define FSTV0910_GPIO4_CONFIG 0xf144107e +#define FSTV0910_GPIO4_XOR 0xf1440001 + +/* GPIO5CFG */ +#define RSTV0910_GPIO5CFG 0xf145 +#define FSTV0910_GPIO5_OPD 0xf1457080 +#define FSTV0910_GPIO5_CONFIG 0xf145107e +#define FSTV0910_GPIO5_XOR 0xf1450001 + +/* GPIO6CFG */ +#define RSTV0910_GPIO6CFG 0xf146 +#define FSTV0910_GPIO6_OPD 0xf1467080 +#define FSTV0910_GPIO6_CONFIG 0xf146107e +#define FSTV0910_GPIO6_XOR 0xf1460001 + +/* GPIO7CFG */ +#define RSTV0910_GPIO7CFG 0xf147 +#define FSTV0910_GPIO7_OPD 0xf1477080 +#define FSTV0910_GPIO7_CONFIG 0xf147107e +#define FSTV0910_GPIO7_XOR 0xf1470001 + +/* GPIO8CFG */ +#define RSTV0910_GPIO8CFG 0xf148 +#define FSTV0910_GPIO8_OPD 0xf1487080 +#define FSTV0910_GPIO8_CONFIG 0xf148107e +#define FSTV0910_GPIO8_XOR 0xf1480001 + +/* GPIO9CFG */ +#define RSTV0910_GPIO9CFG 0xf149 +#define FSTV0910_GPIO9_OPD 0xf1497080 +#define FSTV0910_GPIO9_CONFIG 0xf149107e +#define FSTV0910_GPIO9_XOR 0xf1490001 + +/* GPIO10CFG */ +#define RSTV0910_GPIO10CFG 0xf14a +#define FSTV0910_GPIO10_OPD 0xf14a7080 +#define FSTV0910_GPIO10_CONFIG 0xf14a107e +#define FSTV0910_GPIO10_XOR 0xf14a0001 + +/* GPIO11CFG */ +#define RSTV0910_GPIO11CFG 0xf14b +#define FSTV0910_GPIO11_OPD 0xf14b7080 +#define FSTV0910_GPIO11_CONFIG 0xf14b107e +#define FSTV0910_GPIO11_XOR 0xf14b0001 + +/* GPIO12CFG */ +#define RSTV0910_GPIO12CFG 0xf14c +#define FSTV0910_GPIO12_OPD 0xf14c7080 +#define FSTV0910_GPIO12_CONFIG 0xf14c107e +#define FSTV0910_GPIO12_XOR 0xf14c0001 + +/* GPIO13CFG */ +#define RSTV0910_GPIO13CFG 0xf14d +#define FSTV0910_GPIO13_OPD 0xf14d7080 +#define FSTV0910_GPIO13_CONFIG 0xf14d107e +#define FSTV0910_GPIO13_XOR 0xf14d0001 + +/* GPIO14CFG */ +#define RSTV0910_GPIO14CFG 0xf14e +#define FSTV0910_GPIO14_OPD 0xf14e7080 +#define FSTV0910_GPIO14_CONFIG 0xf14e107e +#define FSTV0910_GPIO14_XOR 0xf14e0001 + +/* GPIO15CFG */ +#define RSTV0910_GPIO15CFG 0xf14f +#define FSTV0910_GPIO15_OPD 0xf14f7080 +#define FSTV0910_GPIO15_CONFIG 0xf14f107e +#define FSTV0910_GPIO15_XOR 0xf14f0001 + +/* GPIO16CFG */ +#define RSTV0910_GPIO16CFG 0xf150 +#define FSTV0910_GPIO16_OPD 0xf1507080 +#define FSTV0910_GPIO16_CONFIG 0xf150107e +#define FSTV0910_GPIO16_XOR 0xf1500001 + +/* GPIO17CFG */ +#define RSTV0910_GPIO17CFG 0xf151 +#define FSTV0910_GPIO17_OPD 0xf1517080 +#define FSTV0910_GPIO17_CONFIG 0xf151107e +#define FSTV0910_GPIO17_XOR 0xf1510001 + +/* GPIO18CFG */ +#define RSTV0910_GPIO18CFG 0xf152 +#define FSTV0910_GPIO18_OPD 0xf1527080 +#define FSTV0910_GPIO18_CONFIG 0xf152107e +#define FSTV0910_GPIO18_XOR 0xf1520001 + +/* GPIO19CFG */ +#define RSTV0910_GPIO19CFG 0xf153 +#define FSTV0910_GPIO19_OPD 0xf1537080 +#define FSTV0910_GPIO19_CONFIG 0xf153107e +#define FSTV0910_GPIO19_XOR 0xf1530001 + +/* GPIO20CFG */ +#define RSTV0910_GPIO20CFG 0xf154 +#define FSTV0910_GPIO20_OPD 0xf1547080 +#define FSTV0910_GPIO20_CONFIG 0xf154107e +#define FSTV0910_GPIO20_XOR 0xf1540001 + +/* GPIO21CFG */ +#define RSTV0910_GPIO21CFG 0xf155 +#define FSTV0910_GPIO21_OPD 0xf1557080 +#define FSTV0910_GPIO21_CONFIG 0xf155107e +#define FSTV0910_GPIO21_XOR 0xf1550001 + +/* GPIO22CFG */ +#define RSTV0910_GPIO22CFG 0xf156 +#define FSTV0910_GPIO22_OPD 0xf1567080 +#define FSTV0910_GPIO22_CONFIG 0xf156107e +#define FSTV0910_GPIO22_XOR 0xf1560001 + +/* STRSTATUS1 */ +#define RSTV0910_STRSTATUS1 0xf16a +#define FSTV0910_STRSTATUS_SEL2 0xf16a40f0 +#define FSTV0910_STRSTATUS_SEL1 0xf16a000f + +/* STRSTATUS2 */ +#define RSTV0910_STRSTATUS2 0xf16b +#define FSTV0910_STRSTATUS_SEL4 0xf16b40f0 +#define FSTV0910_STRSTATUS_SEL3 0xf16b000f + +/* STRSTATUS3 */ +#define RSTV0910_STRSTATUS3 0xf16c +#define FSTV0910_STRSTATUS_SEL6 0xf16c40f0 +#define FSTV0910_STRSTATUS_SEL5 0xf16c000f + +/* FSKTFC2 */ +#define RSTV0910_FSKTFC2 0xf170 +#define FSTV0910_FSKT_KMOD 0xf17020fc +#define FSTV0910_FSKT_CAR2 0xf1700003 + +/* FSKTFC1 */ +#define RSTV0910_FSKTFC1 0xf171 +#define FSTV0910_FSKT_CAR1 0xf17100ff + +/* FSKTFC0 */ +#define RSTV0910_FSKTFC0 0xf172 +#define FSTV0910_FSKT_CAR0 0xf17200ff + +/* FSKTDELTAF1 */ +#define RSTV0910_FSKTDELTAF1 0xf173 +#define FSTV0910_FSKT_DELTAF1 0xf173000f + +/* FSKTDELTAF0 */ +#define RSTV0910_FSKTDELTAF0 0xf174 +#define FSTV0910_FSKT_DELTAF0 0xf17400ff + +/* FSKTCTRL */ +#define RSTV0910_FSKTCTRL 0xf175 +#define FSTV0910_FSKT_PINSEL 0xf1757080 +#define FSTV0910_FSKT_EN_SGN 0xf1756040 +#define FSTV0910_FSKT_MOD_SGN 0xf1755020 +#define FSTV0910_FSKT_MOD_EN 0xf175201c +#define FSTV0910_FSKT_DACMODE 0xf1750003 + +/* FSKRFC2 */ +#define RSTV0910_FSKRFC2 0xf176 +#define FSTV0910_FSKR_DETSGN 0xf1766040 +#define FSTV0910_FSKR_OUTSGN 0xf1765020 +#define FSTV0910_FSKR_KAGC 0xf176201c +#define FSTV0910_FSKR_CAR2 0xf1760003 + +/* FSKRFC1 */ +#define RSTV0910_FSKRFC1 0xf177 +#define FSTV0910_FSKR_CAR1 0xf17700ff + +/* FSKRFC0 */ +#define RSTV0910_FSKRFC0 0xf178 +#define FSTV0910_FSKR_CAR0 0xf17800ff + +/* FSKRK1 */ +#define RSTV0910_FSKRK1 0xf179 +#define FSTV0910_FSKR_K1_EXP 0xf17950e0 +#define FSTV0910_FSKR_K1_MANT 0xf179001f + +/* FSKRK2 */ +#define RSTV0910_FSKRK2 0xf17a +#define FSTV0910_FSKR_K2_EXP 0xf17a50e0 +#define FSTV0910_FSKR_K2_MANT 0xf17a001f + +/* FSKRAGCR */ +#define RSTV0910_FSKRAGCR 0xf17b +#define FSTV0910_FSKR_OUTCTL 0xf17b60c0 +#define FSTV0910_FSKR_AGC_REF 0xf17b003f + +/* FSKRAGC */ +#define RSTV0910_FSKRAGC 0xf17c +#define FSTV0910_FSKR_AGC_ACCU 0xf17c00ff + +/* FSKRALPHA */ +#define RSTV0910_FSKRALPHA 0xf17d +#define FSTV0910_FSKR_ALPHA_EXP 0xf17d201c +#define FSTV0910_FSKR_ALPHA_M 0xf17d0003 + +/* FSKRPLTH1 */ +#define RSTV0910_FSKRPLTH1 0xf17e +#define FSTV0910_FSKR_BETA 0xf17e40f0 +#define FSTV0910_FSKR_PLL_TRESH1 0xf17e000f + +/* FSKRPLTH0 */ +#define RSTV0910_FSKRPLTH0 0xf17f +#define FSTV0910_FSKR_PLL_TRESH0 0xf17f00ff + +/* FSKRDF1 */ +#define RSTV0910_FSKRDF1 0xf180 +#define FSTV0910_FSKR_OUT 0xf1807080 +#define FSTV0910_FSKR_STATE 0xf1805060 +#define FSTV0910_FSKR_DELTAF1 0xf180001f + +/* FSKRDF0 */ +#define RSTV0910_FSKRDF0 0xf181 +#define FSTV0910_FSKR_DELTAF0 0xf18100ff + +/* FSKRSTEPP */ +#define RSTV0910_FSKRSTEPP 0xf182 +#define FSTV0910_FSKR_STEP_PLUS 0xf18200ff + +/* FSKRSTEPM */ +#define RSTV0910_FSKRSTEPM 0xf183 +#define FSTV0910_FSKR_STEP_MINUS 0xf18300ff + +/* FSKRDET1 */ +#define RSTV0910_FSKRDET1 0xf184 +#define FSTV0910_FSKR_DETECT 0xf1847080 +#define FSTV0910_FSKR_CARDET_ACCU1 0xf184000f + +/* FSKRDET0 */ +#define RSTV0910_FSKRDET0 0xf185 +#define FSTV0910_FSKR_CARDET_ACCU0 0xf18500ff + +/* FSKRDTH1 */ +#define RSTV0910_FSKRDTH1 0xf186 +#define FSTV0910_FSKR_CARLOSS_THRESH1 0xf18640f0 +#define FSTV0910_FSKR_CARDET_THRESH1 0xf186000f + +/* FSKRDTH0 */ +#define RSTV0910_FSKRDTH0 0xf187 +#define FSTV0910_FSKR_CARDET_THRESH0 0xf18700ff + +/* FSKRLOSS */ +#define RSTV0910_FSKRLOSS 0xf188 +#define FSTV0910_FSKR_CARLOSS_THRESH0 0xf18800ff + +/* NCOARSE */ +#define RSTV0910_NCOARSE 0xf1b3 +#define FSTV0910_CP 0xf1b330f8 +#define FSTV0910_IDF 0xf1b30007 + +/* NCOARSE1 */ +#define RSTV0910_NCOARSE1 0xf1b4 +#define FSTV0910_N_DIV 0xf1b400ff + +/* NCOARSE2 */ +#define RSTV0910_NCOARSE2 0xf1b5 +#define FSTV0910_ODF 0xf1b5003f + +/* SYNTCTRL */ +#define RSTV0910_SYNTCTRL 0xf1b6 +#define FSTV0910_STANDBY 0xf1b67080 +#define FSTV0910_BYPASSPLLCORE 0xf1b66040 +#define FSTV0910_STOP_PLL 0xf1b63008 +#define FSTV0910_OSCI_E 0xf1b61002 + +/* FILTCTRL */ +#define RSTV0910_FILTCTRL 0xf1b7 +#define FSTV0910_INV_CLKFSK 0xf1b71002 +#define FSTV0910_BYPASS_APPLI 0xf1b70001 + +/* PLLSTAT */ +#define RSTV0910_PLLSTAT 0xf1b8 +#define FSTV0910_PLLLOCK 0xf1b80001 + +/* STOPCLK1 */ +#define RSTV0910_STOPCLK1 0xf1c2 +#define FSTV0910_INV_CLKADCI2 0xf1c22004 +#define FSTV0910_INV_CLKADCI1 0xf1c20001 + +/* STOPCLK2 */ +#define RSTV0910_STOPCLK2 0xf1c3 +#define FSTV0910_STOP_DVBS2FEC2 0xf1c35020 +#define FSTV0910_STOP_DVBS2FEC 0xf1c34010 +#define FSTV0910_STOP_DVBS1FEC2 0xf1c33008 +#define FSTV0910_STOP_DVBS1FEC 0xf1c32004 +#define FSTV0910_STOP_DEMOD2 0xf1c31002 +#define FSTV0910_STOP_DEMOD 0xf1c30001 + +/* PREGCTL */ +#define RSTV0910_PREGCTL 0xf1c8 +#define FSTV0910_REG3V3TO2V5_POFF 0xf1c87080 + +/* TSTTNR0 */ +#define RSTV0910_TSTTNR0 0xf1df +#define FSTV0910_FSK_PON 0xf1df2004 + +/* TSTTNR1 */ +#define RSTV0910_TSTTNR1 0xf1e0 +#define FSTV0910_ADC1_PON 0xf1e01002 + +/* TSTTNR2 */ +#define RSTV0910_TSTTNR2 0xf1e1 +#define FSTV0910_I2C_DISEQC_PON 0xf1e15020 +#define FSTV0910_DISEQC_CLKDIV 0xf1e1000f + +/* TSTTNR3 */ +#define RSTV0910_TSTTNR3 0xf1e2 +#define FSTV0910_ADC2_PON 0xf1e21002 + +/* P2_IQCONST */ +#define RSTV0910_P2_IQCONST 0xf200 +#define FSTV0910_P2_CONSTEL_SELECT 0xf2005060 +#define FSTV0910_P2_IQSYMB_SEL 0xf200001f + +/* P2_NOSCFG */ +#define RSTV0910_P2_NOSCFG 0xf201 +#define FSTV0910_P2_DUMMYPL_NOSDATA 0xf2015020 +#define FSTV0910_P2_NOSPLH_BETA 0xf2013018 +#define FSTV0910_P2_NOSDATA_BETA 0xf2010007 + +/* P2_ISYMB */ +#define RSTV0910_P2_ISYMB 0xf202 +#define FSTV0910_P2_I_SYMBOL 0xf20201ff + +/* P2_QSYMB */ +#define RSTV0910_P2_QSYMB 0xf203 +#define FSTV0910_P2_Q_SYMBOL 0xf20301ff + +/* P2_AGC1CFG */ +#define RSTV0910_P2_AGC1CFG 0xf204 +#define FSTV0910_P2_DC_FROZEN 0xf2047080 +#define FSTV0910_P2_DC_CORRECT 0xf2046040 +#define FSTV0910_P2_AMM_FROZEN 0xf2045020 +#define FSTV0910_P2_AMM_CORRECT 0xf2044010 +#define FSTV0910_P2_QUAD_FROZEN 0xf2043008 +#define FSTV0910_P2_QUAD_CORRECT 0xf2042004 + +/* P2_AGC1CN */ +#define RSTV0910_P2_AGC1CN 0xf206 +#define FSTV0910_P2_AGC1_LOCKED 0xf2067080 +#define FSTV0910_P2_AGC1_MINPOWER 0xf2064010 +#define FSTV0910_P2_AGCOUT_FAST 0xf2063008 +#define FSTV0910_P2_AGCIQ_BETA 0xf2060007 + +/* P2_AGC1REF */ +#define RSTV0910_P2_AGC1REF 0xf207 +#define FSTV0910_P2_AGCIQ_REF 0xf20700ff + +/* P2_IDCCOMP */ +#define RSTV0910_P2_IDCCOMP 0xf208 +#define FSTV0910_P2_IAVERAGE_ADJ 0xf20801ff + +/* P2_QDCCOMP */ +#define RSTV0910_P2_QDCCOMP 0xf209 +#define FSTV0910_P2_QAVERAGE_ADJ 0xf20901ff + +/* P2_POWERI */ +#define RSTV0910_P2_POWERI 0xf20a +#define FSTV0910_P2_POWER_I 0xf20a00ff + +/* P2_POWERQ */ +#define RSTV0910_P2_POWERQ 0xf20b +#define FSTV0910_P2_POWER_Q 0xf20b00ff + +/* P2_AGC1AMM */ +#define RSTV0910_P2_AGC1AMM 0xf20c +#define FSTV0910_P2_AMM_VALUE 0xf20c00ff + +/* P2_AGC1QUAD */ +#define RSTV0910_P2_AGC1QUAD 0xf20d +#define FSTV0910_P2_QUAD_VALUE 0xf20d01ff + +/* P2_AGCIQIN1 */ +#define RSTV0910_P2_AGCIQIN1 0xf20e +#define FSTV0910_P2_AGCIQ_VALUE1 0xf20e00ff + +/* P2_AGCIQIN0 */ +#define RSTV0910_P2_AGCIQIN0 0xf20f +#define FSTV0910_P2_AGCIQ_VALUE0 0xf20f00ff + +/* P2_DEMOD */ +#define RSTV0910_P2_DEMOD 0xf210 +#define FSTV0910_P2_MANUALS2_ROLLOFF 0xf2107080 +#define FSTV0910_P2_SPECINV_CONTROL 0xf2104030 +#define FSTV0910_P2_MANUALSX_ROLLOFF 0xf2102004 +#define FSTV0910_P2_ROLLOFF_CONTROL 0xf2100003 + +/* P2_DMDMODCOD */ +#define RSTV0910_P2_DMDMODCOD 0xf211 +#define FSTV0910_P2_MANUAL_MODCOD 0xf2117080 +#define FSTV0910_P2_DEMOD_MODCOD 0xf211207c +#define FSTV0910_P2_DEMOD_TYPE 0xf2110003 + +/* P2_DSTATUS */ +#define RSTV0910_P2_DSTATUS 0xf212 +#define FSTV0910_P2_CAR_LOCK 0xf2127080 +#define FSTV0910_P2_TMGLOCK_QUALITY 0xf2125060 +#define FSTV0910_P2_LOCK_DEFINITIF 0xf2123008 +#define FSTV0910_P2_OVADC_DETECT 0xf2120001 + +/* P2_DSTATUS2 */ +#define RSTV0910_P2_DSTATUS2 0xf213 +#define FSTV0910_P2_DEMOD_DELOCK 0xf2137080 +#define FSTV0910_P2_MODCODRQ_SYNCTAG 0xf2135020 +#define FSTV0910_P2_POLYPH_SATEVENT 0xf2134010 +#define FSTV0910_P2_AGC1_NOSIGNALACK 0xf2133008 +#define FSTV0910_P2_AGC2_OVERFLOW 0xf2132004 +#define FSTV0910_P2_CFR_OVERFLOW 0xf2131002 +#define FSTV0910_P2_GAMMA_OVERUNDER 0xf2130001 + +/* P2_DMDCFGMD */ +#define RSTV0910_P2_DMDCFGMD 0xf214 +#define FSTV0910_P2_DVBS2_ENABLE 0xf2147080 +#define FSTV0910_P2_DVBS1_ENABLE 0xf2146040 +#define FSTV0910_P2_SCAN_ENABLE 0xf2144010 +#define FSTV0910_P2_CFR_AUTOSCAN 0xf2143008 +#define FSTV0910_P2_TUN_RNG 0xf2140003 + +/* P2_DMDCFG2 */ +#define RSTV0910_P2_DMDCFG2 0xf215 +#define FSTV0910_P2_S1S2_SEQUENTIAL 0xf2156040 +#define FSTV0910_P2_INFINITE_RELOCK 0xf2154010 + +/* P2_DMDISTATE */ +#define RSTV0910_P2_DMDISTATE 0xf216 +#define FSTV0910_P2_I2C_NORESETDMODE 0xf2167080 +#define FSTV0910_P2_I2C_DEMOD_MODE 0xf216001f + +/* P2_DMDT0M */ +#define RSTV0910_P2_DMDT0M 0xf217 +#define FSTV0910_P2_DMDT0_MIN 0xf21700ff + +/* P2_DMDSTATE */ +#define RSTV0910_P2_DMDSTATE 0xf21b +#define FSTV0910_P2_HEADER_MODE 0xf21b5060 + +/* P2_DMDFLYW */ +#define RSTV0910_P2_DMDFLYW 0xf21c +#define FSTV0910_P2_I2C_IRQVAL 0xf21c40f0 +#define FSTV0910_P2_FLYWHEEL_CPT 0xf21c000f + +/* P2_DSTATUS3 */ +#define RSTV0910_P2_DSTATUS3 0xf21d +#define FSTV0910_P2_CFR_ZIGZAG 0xf21d7080 +#define FSTV0910_P2_DEMOD_CFGMODE 0xf21d5060 +#define FSTV0910_P2_GAMMA_LOWBAUDRATE 0xf21d4010 + +/* P2_DMDCFG3 */ +#define RSTV0910_P2_DMDCFG3 0xf21e +#define FSTV0910_P2_NOSTOP_FIFOFULL 0xf21e3008 + +/* P2_DMDCFG4 */ +#define RSTV0910_P2_DMDCFG4 0xf21f +#define FSTV0910_P2_DIS_VITLOCK 0xf21f7080 +#define FSTV0910_P2_DIS_CLKENABLE 0xf21f2004 + +/* P2_CORRELMANT */ +#define RSTV0910_P2_CORRELMANT 0xf220 +#define FSTV0910_P2_CORREL_MANT 0xf22000ff + +/* P2_CORRELABS */ +#define RSTV0910_P2_CORRELABS 0xf221 +#define FSTV0910_P2_CORREL_ABS 0xf22100ff + +/* P2_CORRELEXP */ +#define RSTV0910_P2_CORRELEXP 0xf222 +#define FSTV0910_P2_CORREL_ABSEXP 0xf22240f0 +#define FSTV0910_P2_CORREL_EXP 0xf222000f + +/* P2_PLHMODCOD */ +#define RSTV0910_P2_PLHMODCOD 0xf224 +#define FSTV0910_P2_SPECINV_DEMOD 0xf2247080 +#define FSTV0910_P2_PLH_MODCOD 0xf224207c +#define FSTV0910_P2_PLH_TYPE 0xf2240003 + +/* P2_DMDREG */ +#define RSTV0910_P2_DMDREG 0xf225 +#define FSTV0910_P2_DECIM_PLFRAMES 0xf2250001 + +/* P2_AGCNADJ */ +#define RSTV0910_P2_AGCNADJ 0xf226 +#define FSTV0910_P2_RADJOFF_AGC2 0xf2267080 +#define FSTV0910_P2_RADJOFF_AGC1 0xf2266040 +#define FSTV0910_P2_AGC_NADJ 0xf226013f + +/* P2_AGCKS */ +#define RSTV0910_P2_AGCKS 0xf227 +#define FSTV0910_P2_RSADJ_MANUALCFG 0xf2277080 +#define FSTV0910_P2_RSADJ_CCMMODE 0xf2276040 +#define FSTV0910_P2_RADJ_SPSK 0xf227013f + +/* P2_AGCKQ */ +#define RSTV0910_P2_AGCKQ 0xf228 +#define FSTV0910_P2_RADJON_DVBS1 0xf2286040 +#define FSTV0910_P2_RADJ_QPSK 0xf228013f + +/* P2_AGCK8 */ +#define RSTV0910_P2_AGCK8 0xf229 +#define FSTV0910_P2_RADJ_8PSK 0xf229013f + +/* P2_AGCK16 */ +#define RSTV0910_P2_AGCK16 0xf22a +#define FSTV0910_P2_R2ADJOFF_16APSK 0xf22a6040 +#define FSTV0910_P2_R1ADJOFF_16APSK 0xf22a5020 +#define FSTV0910_P2_RADJ_16APSK 0xf22a011f + +/* P2_AGCK32 */ +#define RSTV0910_P2_AGCK32 0xf22b +#define FSTV0910_P2_R3ADJOFF_32APSK 0xf22b7080 +#define FSTV0910_P2_R2ADJOFF_32APSK 0xf22b6040 +#define FSTV0910_P2_R1ADJOFF_32APSK 0xf22b5020 +#define FSTV0910_P2_RADJ_32APSK 0xf22b011f + +/* P2_AGC2O */ +#define RSTV0910_P2_AGC2O 0xf22c +#define FSTV0910_P2_CSTENV_MODE 0xf22c60c0 +#define FSTV0910_P2_AGC2_COEF 0xf22c0007 + +/* P2_AGC2REF */ +#define RSTV0910_P2_AGC2REF 0xf22d +#define FSTV0910_P2_AGC2_REF 0xf22d00ff + +/* P2_AGC1ADJ */ +#define RSTV0910_P2_AGC1ADJ 0xf22e +#define FSTV0910_P2_AGC1_ADJUSTED 0xf22e007f + +/* P2_AGCRSADJ */ +#define RSTV0910_P2_AGCRSADJ 0xf22f +#define FSTV0910_P2_RS_ADJUSTED 0xf22f007f + +/* P2_AGCRQADJ */ +#define RSTV0910_P2_AGCRQADJ 0xf230 +#define FSTV0910_P2_RQ_ADJUSTED 0xf230007f + +/* P2_AGCR8ADJ */ +#define RSTV0910_P2_AGCR8ADJ 0xf231 +#define FSTV0910_P2_R8_ADJUSTED 0xf231007f + +/* P2_AGCR1ADJ */ +#define RSTV0910_P2_AGCR1ADJ 0xf232 +#define FSTV0910_P2_R1_ADJUSTED 0xf232007f + +/* P2_AGCR2ADJ */ +#define RSTV0910_P2_AGCR2ADJ 0xf233 +#define FSTV0910_P2_R2_ADJUSTED 0xf233007f + +/* P2_AGCR3ADJ */ +#define RSTV0910_P2_AGCR3ADJ 0xf234 +#define FSTV0910_P2_R3_ADJUSTED 0xf234007f + +/* P2_AGCREFADJ */ +#define RSTV0910_P2_AGCREFADJ 0xf235 +#define FSTV0910_P2_AGC2REF_ADJUSTED 0xf235007f + +/* P2_AGC2I1 */ +#define RSTV0910_P2_AGC2I1 0xf236 +#define FSTV0910_P2_AGC2_INTEGRATOR1 0xf23600ff + +/* P2_AGC2I0 */ +#define RSTV0910_P2_AGC2I0 0xf237 +#define FSTV0910_P2_AGC2_INTEGRATOR0 0xf23700ff + +/* P2_CARCFG */ +#define RSTV0910_P2_CARCFG 0xf238 +#define FSTV0910_P2_ROTAON 0xf2382004 +#define FSTV0910_P2_PH_DET_ALGO 0xf2380003 + +/* P2_ACLC */ +#define RSTV0910_P2_ACLC 0xf239 +#define FSTV0910_P2_CAR_ALPHA_MANT 0xf2394030 +#define FSTV0910_P2_CAR_ALPHA_EXP 0xf239000f + +/* P2_BCLC */ +#define RSTV0910_P2_BCLC 0xf23a +#define FSTV0910_P2_CAR_BETA_MANT 0xf23a4030 +#define FSTV0910_P2_CAR_BETA_EXP 0xf23a000f + +/* P2_ACLCS2 */ +#define RSTV0910_P2_ACLCS2 0xf23b +#define FSTV0910_P2_CARS2_APLHA_MANTISSE 0xf23b4030 +#define FSTV0910_P2_CARS2_ALPHA_EXP 0xf23b000f + +/* P2_BCLCS2 */ +#define RSTV0910_P2_BCLCS2 0xf23c +#define FSTV0910_P2_CARS2_BETA_MANTISSE 0xf23c4030 +#define FSTV0910_P2_CARS2_BETA_EXP 0xf23c000f + +/* P2_CARFREQ */ +#define RSTV0910_P2_CARFREQ 0xf23d +#define FSTV0910_P2_KC_COARSE_EXP 0xf23d40f0 +#define FSTV0910_P2_BETA_FREQ 0xf23d000f + +/* P2_CARHDR */ +#define RSTV0910_P2_CARHDR 0xf23e +#define FSTV0910_P2_K_FREQ_HDR 0xf23e00ff + +/* P2_LDT */ +#define RSTV0910_P2_LDT 0xf23f +#define FSTV0910_P2_CARLOCK_THRES 0xf23f01ff + +/* P2_LDT2 */ +#define RSTV0910_P2_LDT2 0xf240 +#define FSTV0910_P2_CARLOCK_THRES2 0xf24001ff + +/* P2_CFRICFG */ +#define RSTV0910_P2_CFRICFG 0xf241 +#define FSTV0910_P2_NEG_CFRSTEP 0xf2410001 + +/* P2_CFRUP1 */ +#define RSTV0910_P2_CFRUP1 0xf242 +#define FSTV0910_P2_CFR_UP1 0xf24201ff + +/* P2_CFRUP0 */ +#define RSTV0910_P2_CFRUP0 0xf243 +#define FSTV0910_P2_CFR_UP0 0xf24300ff + +/* P2_CFRIBASE1 */ +#define RSTV0910_P2_CFRIBASE1 0xf244 +#define FSTV0910_P2_CFRINIT_BASE1 0xf24400ff + +/* P2_CFRIBASE0 */ +#define RSTV0910_P2_CFRIBASE0 0xf245 +#define FSTV0910_P2_CFRINIT_BASE0 0xf24500ff + +/* P2_CFRLOW1 */ +#define RSTV0910_P2_CFRLOW1 0xf246 +#define FSTV0910_P2_CFR_LOW1 0xf24601ff + +/* P2_CFRLOW0 */ +#define RSTV0910_P2_CFRLOW0 0xf247 +#define FSTV0910_P2_CFR_LOW0 0xf24700ff + +/* P2_CFRINIT1 */ +#define RSTV0910_P2_CFRINIT1 0xf248 +#define FSTV0910_P2_CFR_INIT1 0xf24801ff + +/* P2_CFRINIT0 */ +#define RSTV0910_P2_CFRINIT0 0xf249 +#define FSTV0910_P2_CFR_INIT0 0xf24900ff + +/* P2_CFRINC1 */ +#define RSTV0910_P2_CFRINC1 0xf24a +#define FSTV0910_P2_MANUAL_CFRINC 0xf24a7080 +#define FSTV0910_P2_CFR_INC1 0xf24a003f + +/* P2_CFRINC0 */ +#define RSTV0910_P2_CFRINC0 0xf24b +#define FSTV0910_P2_CFR_INC0 0xf24b00ff + +/* P2_CFR2 */ +#define RSTV0910_P2_CFR2 0xf24c +#define FSTV0910_P2_CAR_FREQ2 0xf24c01ff + +/* P2_CFR1 */ +#define RSTV0910_P2_CFR1 0xf24d +#define FSTV0910_P2_CAR_FREQ1 0xf24d00ff + +/* P2_CFR0 */ +#define RSTV0910_P2_CFR0 0xf24e +#define FSTV0910_P2_CAR_FREQ0 0xf24e00ff + +/* P2_LDI */ +#define RSTV0910_P2_LDI 0xf24f +#define FSTV0910_P2_LOCK_DET_INTEGR 0xf24f01ff + +/* P2_TMGCFG */ +#define RSTV0910_P2_TMGCFG 0xf250 +#define FSTV0910_P2_TMGLOCK_BETA 0xf25060c0 +#define FSTV0910_P2_DO_TIMING_CORR 0xf2504010 +#define FSTV0910_P2_TMG_MINFREQ 0xf2500003 + +/* P2_RTC */ +#define RSTV0910_P2_RTC 0xf251 +#define FSTV0910_P2_TMGALPHA_EXP 0xf25140f0 +#define FSTV0910_P2_TMGBETA_EXP 0xf251000f + +/* P2_RTCS2 */ +#define RSTV0910_P2_RTCS2 0xf252 +#define FSTV0910_P2_TMGALPHAS2_EXP 0xf25240f0 +#define FSTV0910_P2_TMGBETAS2_EXP 0xf252000f + +/* P2_TMGTHRISE */ +#define RSTV0910_P2_TMGTHRISE 0xf253 +#define FSTV0910_P2_TMGLOCK_THRISE 0xf25300ff + +/* P2_TMGTHFALL */ +#define RSTV0910_P2_TMGTHFALL 0xf254 +#define FSTV0910_P2_TMGLOCK_THFALL 0xf25400ff + +/* P2_SFRUPRATIO */ +#define RSTV0910_P2_SFRUPRATIO 0xf255 +#define FSTV0910_P2_SFR_UPRATIO 0xf25500ff + +/* P2_SFRLOWRATIO */ +#define RSTV0910_P2_SFRLOWRATIO 0xf256 +#define FSTV0910_P2_SFR_LOWRATIO 0xf25600ff + +/* P2_KTTMG */ +#define RSTV0910_P2_KTTMG 0xf257 +#define FSTV0910_P2_KT_TMG_EXP 0xf25740f0 + +/* P2_KREFTMG */ +#define RSTV0910_P2_KREFTMG 0xf258 +#define FSTV0910_P2_KREF_TMG 0xf25800ff + +/* P2_SFRSTEP */ +#define RSTV0910_P2_SFRSTEP 0xf259 +#define FSTV0910_P2_SFR_SCANSTEP 0xf25940f0 +#define FSTV0910_P2_SFR_CENTERSTEP 0xf259000f + +/* P2_TMGCFG2 */ +#define RSTV0910_P2_TMGCFG2 0xf25a +#define FSTV0910_P2_DIS_AUTOSAMP 0xf25a3008 +#define FSTV0910_P2_SFRRATIO_FINE 0xf25a0001 + +/* P2_KREFTMG2 */ +#define RSTV0910_P2_KREFTMG2 0xf25b +#define FSTV0910_P2_KREF_TMG2 0xf25b00ff + +/* P2_TMGCFG3 */ +#define RSTV0910_P2_TMGCFG3 0xf25d +#define FSTV0910_P2_CONT_TMGCENTER 0xf25d3008 +#define FSTV0910_P2_AUTO_GUP 0xf25d2004 +#define FSTV0910_P2_AUTO_GLOW 0xf25d1002 + +/* P2_SFRINIT1 */ +#define RSTV0910_P2_SFRINIT1 0xf25e +#define FSTV0910_P2_SFR_INIT1 0xf25e00ff + +/* P2_SFRINIT0 */ +#define RSTV0910_P2_SFRINIT0 0xf25f +#define FSTV0910_P2_SFR_INIT0 0xf25f00ff + +/* P2_SFRUP1 */ +#define RSTV0910_P2_SFRUP1 0xf260 +#define FSTV0910_P2_SYMB_FREQ_UP1 0xf26000ff + +/* P2_SFRUP0 */ +#define RSTV0910_P2_SFRUP0 0xf261 +#define FSTV0910_P2_SYMB_FREQ_UP0 0xf26100ff + +/* P2_SFRLOW1 */ +#define RSTV0910_P2_SFRLOW1 0xf262 +#define FSTV0910_P2_SYMB_FREQ_LOW1 0xf26200ff + +/* P2_SFRLOW0 */ +#define RSTV0910_P2_SFRLOW0 0xf263 +#define FSTV0910_P2_SYMB_FREQ_LOW0 0xf26300ff + +/* P2_SFR3 */ +#define RSTV0910_P2_SFR3 0xf264 +#define FSTV0910_P2_SYMB_FREQ3 0xf26400ff + +/* P2_SFR2 */ +#define RSTV0910_P2_SFR2 0xf265 +#define FSTV0910_P2_SYMB_FREQ2 0xf26500ff + +/* P2_SFR1 */ +#define RSTV0910_P2_SFR1 0xf266 +#define FSTV0910_P2_SYMB_FREQ1 0xf26600ff + +/* P2_SFR0 */ +#define RSTV0910_P2_SFR0 0xf267 +#define FSTV0910_P2_SYMB_FREQ0 0xf26700ff + +/* P2_TMGREG2 */ +#define RSTV0910_P2_TMGREG2 0xf268 +#define FSTV0910_P2_TMGREG2 0xf26800ff + +/* P2_TMGREG1 */ +#define RSTV0910_P2_TMGREG1 0xf269 +#define FSTV0910_P2_TMGREG1 0xf26900ff + +/* P2_TMGREG0 */ +#define RSTV0910_P2_TMGREG0 0xf26a +#define FSTV0910_P2_TMGREG0 0xf26a00ff + +/* P2_TMGLOCK1 */ +#define RSTV0910_P2_TMGLOCK1 0xf26b +#define FSTV0910_P2_TMGLOCK_LEVEL1 0xf26b01ff + +/* P2_TMGLOCK0 */ +#define RSTV0910_P2_TMGLOCK0 0xf26c +#define FSTV0910_P2_TMGLOCK_LEVEL0 0xf26c00ff + +/* P2_TMGOBS */ +#define RSTV0910_P2_TMGOBS 0xf26d +#define FSTV0910_P2_ROLLOFF_STATUS 0xf26d60c0 + +/* P2_EQUALCFG */ +#define RSTV0910_P2_EQUALCFG 0xf26f +#define FSTV0910_P2_EQUAL_ON 0xf26f6040 +#define FSTV0910_P2_MU_EQUALDFE 0xf26f0007 + +/* P2_EQUAI1 */ +#define RSTV0910_P2_EQUAI1 0xf270 +#define FSTV0910_P2_EQUA_ACCI1 0xf27001ff + +/* P2_EQUAQ1 */ +#define RSTV0910_P2_EQUAQ1 0xf271 +#define FSTV0910_P2_EQUA_ACCQ1 0xf27101ff + +/* P2_EQUAI2 */ +#define RSTV0910_P2_EQUAI2 0xf272 +#define FSTV0910_P2_EQUA_ACCI2 0xf27201ff + +/* P2_EQUAQ2 */ +#define RSTV0910_P2_EQUAQ2 0xf273 +#define FSTV0910_P2_EQUA_ACCQ2 0xf27301ff + +/* P2_EQUAI3 */ +#define RSTV0910_P2_EQUAI3 0xf274 +#define FSTV0910_P2_EQUA_ACCI3 0xf27401ff + +/* P2_EQUAQ3 */ +#define RSTV0910_P2_EQUAQ3 0xf275 +#define FSTV0910_P2_EQUA_ACCQ3 0xf27501ff + +/* P2_EQUAI4 */ +#define RSTV0910_P2_EQUAI4 0xf276 +#define FSTV0910_P2_EQUA_ACCI4 0xf27601ff + +/* P2_EQUAQ4 */ +#define RSTV0910_P2_EQUAQ4 0xf277 +#define FSTV0910_P2_EQUA_ACCQ4 0xf27701ff + +/* P2_EQUAI5 */ +#define RSTV0910_P2_EQUAI5 0xf278 +#define FSTV0910_P2_EQUA_ACCI5 0xf27801ff + +/* P2_EQUAQ5 */ +#define RSTV0910_P2_EQUAQ5 0xf279 +#define FSTV0910_P2_EQUA_ACCQ5 0xf27901ff + +/* P2_EQUAI6 */ +#define RSTV0910_P2_EQUAI6 0xf27a +#define FSTV0910_P2_EQUA_ACCI6 0xf27a01ff + +/* P2_EQUAQ6 */ +#define RSTV0910_P2_EQUAQ6 0xf27b +#define FSTV0910_P2_EQUA_ACCQ6 0xf27b01ff + +/* P2_EQUAI7 */ +#define RSTV0910_P2_EQUAI7 0xf27c +#define FSTV0910_P2_EQUA_ACCI7 0xf27c01ff + +/* P2_EQUAQ7 */ +#define RSTV0910_P2_EQUAQ7 0xf27d +#define FSTV0910_P2_EQUA_ACCQ7 0xf27d01ff + +/* P2_EQUAI8 */ +#define RSTV0910_P2_EQUAI8 0xf27e +#define FSTV0910_P2_EQUA_ACCI8 0xf27e01ff + +/* P2_EQUAQ8 */ +#define RSTV0910_P2_EQUAQ8 0xf27f +#define FSTV0910_P2_EQUA_ACCQ8 0xf27f01ff + +/* P2_NNOSDATAT1 */ +#define RSTV0910_P2_NNOSDATAT1 0xf280 +#define FSTV0910_P2_NOSDATAT_NORMED1 0xf28000ff + +/* P2_NNOSDATAT0 */ +#define RSTV0910_P2_NNOSDATAT0 0xf281 +#define FSTV0910_P2_NOSDATAT_NORMED0 0xf28100ff + +/* P2_NNOSDATA1 */ +#define RSTV0910_P2_NNOSDATA1 0xf282 +#define FSTV0910_P2_NOSDATA_NORMED1 0xf28200ff + +/* P2_NNOSDATA0 */ +#define RSTV0910_P2_NNOSDATA0 0xf283 +#define FSTV0910_P2_NOSDATA_NORMED0 0xf28300ff + +/* P2_NNOSPLHT1 */ +#define RSTV0910_P2_NNOSPLHT1 0xf284 +#define FSTV0910_P2_NOSPLHT_NORMED1 0xf28400ff + +/* P2_NNOSPLHT0 */ +#define RSTV0910_P2_NNOSPLHT0 0xf285 +#define FSTV0910_P2_NOSPLHT_NORMED0 0xf28500ff + +/* P2_NNOSPLH1 */ +#define RSTV0910_P2_NNOSPLH1 0xf286 +#define FSTV0910_P2_NOSPLH_NORMED1 0xf28600ff + +/* P2_NNOSPLH0 */ +#define RSTV0910_P2_NNOSPLH0 0xf287 +#define FSTV0910_P2_NOSPLH_NORMED0 0xf28700ff + +/* P2_NOSDATAT1 */ +#define RSTV0910_P2_NOSDATAT1 0xf288 +#define FSTV0910_P2_NOSDATAT_UNNORMED1 0xf28800ff + +/* P2_NOSDATAT0 */ +#define RSTV0910_P2_NOSDATAT0 0xf289 +#define FSTV0910_P2_NOSDATAT_UNNORMED0 0xf28900ff + +/* P2_NNOSFRAME1 */ +#define RSTV0910_P2_NNOSFRAME1 0xf28a +#define FSTV0910_P2_NOSFRAME_NORMED1 0xf28a00ff + +/* P2_NNOSFRAME0 */ +#define RSTV0910_P2_NNOSFRAME0 0xf28b +#define FSTV0910_P2_NOSFRAME_NORMED0 0xf28b00ff + +/* P2_NNOSRAD1 */ +#define RSTV0910_P2_NNOSRAD1 0xf28c +#define FSTV0910_P2_NOSRADIAL_NORMED1 0xf28c00ff + +/* P2_NNOSRAD0 */ +#define RSTV0910_P2_NNOSRAD0 0xf28d +#define FSTV0910_P2_NOSRADIAL_NORMED0 0xf28d00ff + +/* P2_NOSCFGF1 */ +#define RSTV0910_P2_NOSCFGF1 0xf28e +#define FSTV0910_P2_LOWNOISE_MESURE 0xf28e7080 +#define FSTV0910_P2_NOS_DELFRAME 0xf28e6040 +#define FSTV0910_P2_NOSDATA_MODE 0xf28e4030 +#define FSTV0910_P2_FRAMESEL_TYPESEL 0xf28e200c +#define FSTV0910_P2_FRAMESEL_TYPE 0xf28e0003 + +/* P2_NOSCFGF2 */ +#define RSTV0910_P2_NOSCFGF2 0xf28f +#define FSTV0910_P2_DIS_NOSPILOTS 0xf28f7080 +#define FSTV0910_P2_FRAMESEL_MODCODSEL 0xf28f5060 +#define FSTV0910_P2_FRAMESEL_MODCOD 0xf28f001f + +/* P2_CAR2CFG */ +#define RSTV0910_P2_CAR2CFG 0xf290 +#define FSTV0910_P2_ROTA2ON 0xf2902004 +#define FSTV0910_P2_PH_DET_ALGO2 0xf2900003 + +/* P2_CFR2CFR1 */ +#define RSTV0910_P2_CFR2CFR1 0xf291 +#define FSTV0910_P2_EN_S2CAR2CENTER 0xf2915020 +#define FSTV0910_P2_CFR2TOCFR1_BETA 0xf2910007 + +/* P2_CAR3CFG */ +#define RSTV0910_P2_CAR3CFG 0xf292 +#define FSTV0910_P2_CARRIER23_MODE 0xf29260c0 +#define FSTV0910_P2_CAR3INTERM_DVBS1 0xf2925020 +#define FSTV0910_P2_ABAMPLIF_MODE 0xf2923018 +#define FSTV0910_P2_CARRIER3_ALPHA3DL 0xf2920007 + +/* P2_CFR22 */ +#define RSTV0910_P2_CFR22 0xf293 +#define FSTV0910_P2_CAR2_FREQ2 0xf29301ff + +/* P2_CFR21 */ +#define RSTV0910_P2_CFR21 0xf294 +#define FSTV0910_P2_CAR2_FREQ1 0xf29400ff + +/* P2_CFR20 */ +#define RSTV0910_P2_CFR20 0xf295 +#define FSTV0910_P2_CAR2_FREQ0 0xf29500ff + +/* P2_ACLC2S2Q */ +#define RSTV0910_P2_ACLC2S2Q 0xf297 +#define FSTV0910_P2_ENAB_SPSKSYMB 0xf2977080 +#define FSTV0910_P2_CAR2S2_Q_ALPH_M 0xf2974030 +#define FSTV0910_P2_CAR2S2_Q_ALPH_E 0xf297000f + +/* P2_ACLC2S28 */ +#define RSTV0910_P2_ACLC2S28 0xf298 +#define FSTV0910_P2_CAR2S2_8_ALPH_M 0xf2984030 +#define FSTV0910_P2_CAR2S2_8_ALPH_E 0xf298000f + +/* P2_ACLC2S216A */ +#define RSTV0910_P2_ACLC2S216A 0xf299 +#define FSTV0910_P2_CAR2S2_16A_ALPH_M 0xf2994030 +#define FSTV0910_P2_CAR2S2_16A_ALPH_E 0xf299000f + +/* P2_ACLC2S232A */ +#define RSTV0910_P2_ACLC2S232A 0xf29a +#define FSTV0910_P2_CAR2S2_32A_ALPH_M 0xf29a4030 +#define FSTV0910_P2_CAR2S2_32A_ALPH_E 0xf29a000f + +/* P2_BCLC2S2Q */ +#define RSTV0910_P2_BCLC2S2Q 0xf29c +#define FSTV0910_P2_CAR2S2_Q_BETA_M 0xf29c4030 +#define FSTV0910_P2_CAR2S2_Q_BETA_E 0xf29c000f + +/* P2_BCLC2S28 */ +#define RSTV0910_P2_BCLC2S28 0xf29d +#define FSTV0910_P2_CAR2S2_8_BETA_M 0xf29d4030 +#define FSTV0910_P2_CAR2S2_8_BETA_E 0xf29d000f + +/* P2_BCLC2S216A */ +#define RSTV0910_P2_BCLC2S216A 0xf29e +#define FSTV0910_P2_DVBS2S216A_NIP 0xf29e7080 +#define FSTV0910_P2_CAR2S2_16A_BETA_M 0xf29e4030 +#define FSTV0910_P2_CAR2S2_16A_BETA_E 0xf29e000f + +/* P2_BCLC2S232A */ +#define RSTV0910_P2_BCLC2S232A 0xf29f +#define FSTV0910_P2_DVBS2S232A_NIP 0xf29f7080 +#define FSTV0910_P2_CAR2S2_32A_BETA_M 0xf29f4030 +#define FSTV0910_P2_CAR2S2_32A_BETA_E 0xf29f000f + +/* P2_PLROOT2 */ +#define RSTV0910_P2_PLROOT2 0xf2ac +#define FSTV0910_P2_PLSCRAMB_MODE 0xf2ac200c +#define FSTV0910_P2_PLSCRAMB_ROOT2 0xf2ac0003 + +/* P2_PLROOT1 */ +#define RSTV0910_P2_PLROOT1 0xf2ad +#define FSTV0910_P2_PLSCRAMB_ROOT1 0xf2ad00ff + +/* P2_PLROOT0 */ +#define RSTV0910_P2_PLROOT0 0xf2ae +#define FSTV0910_P2_PLSCRAMB_ROOT0 0xf2ae00ff + +/* P2_MODCODLST0 */ +#define RSTV0910_P2_MODCODLST0 0xf2b0 +#define FSTV0910_P2_NACCES_MODCODCH 0xf2b00001 + +/* P2_MODCODLST1 */ +#define RSTV0910_P2_MODCODLST1 0xf2b1 +#define FSTV0910_P2_SYMBRATE_FILTER 0xf2b13008 +#define FSTV0910_P2_NRESET_MODCODLST 0xf2b12004 +#define FSTV0910_P2_DIS_32PSK_9_10 0xf2b10003 + +/* P2_MODCODLST2 */ +#define RSTV0910_P2_MODCODLST2 0xf2b2 +#define FSTV0910_P2_DIS_32PSK_8_9 0xf2b240f0 +#define FSTV0910_P2_DIS_32PSK_5_6 0xf2b2000f + +/* P2_MODCODLST3 */ +#define RSTV0910_P2_MODCODLST3 0xf2b3 +#define FSTV0910_P2_DIS_32PSK_4_5 0xf2b340f0 +#define FSTV0910_P2_DIS_32PSK_3_4 0xf2b3000f + +/* P2_MODCODLST4 */ +#define RSTV0910_P2_MODCODLST4 0xf2b4 +#define FSTV0910_P2_DUMMYPL_PILOT 0xf2b47080 +#define FSTV0910_P2_DUMMYPL_NOPILOT 0xf2b46040 +#define FSTV0910_P2_DIS_16PSK_9_10 0xf2b44030 +#define FSTV0910_P2_DIS_16PSK_8_9 0xf2b4000f + +/* P2_MODCODLST5 */ +#define RSTV0910_P2_MODCODLST5 0xf2b5 +#define FSTV0910_P2_DIS_16PSK_5_6 0xf2b540f0 +#define FSTV0910_P2_DIS_16PSK_4_5 0xf2b5000f + +/* P2_MODCODLST6 */ +#define RSTV0910_P2_MODCODLST6 0xf2b6 +#define FSTV0910_P2_DIS_16PSK_3_4 0xf2b640f0 +#define FSTV0910_P2_DIS_16PSK_2_3 0xf2b6000f + +/* P2_MODCODLST7 */ +#define RSTV0910_P2_MODCODLST7 0xf2b7 +#define FSTV0910_P2_MODCOD_NNOSFILTER 0xf2b77080 +#define FSTV0910_P2_DIS_8PSK_9_10 0xf2b74030 +#define FSTV0910_P2_DIS_8PSK_8_9 0xf2b7000f + +/* P2_MODCODLST8 */ +#define RSTV0910_P2_MODCODLST8 0xf2b8 +#define FSTV0910_P2_DIS_8PSK_5_6 0xf2b840f0 +#define FSTV0910_P2_DIS_8PSK_3_4 0xf2b8000f + +/* P2_MODCODLST9 */ +#define RSTV0910_P2_MODCODLST9 0xf2b9 +#define FSTV0910_P2_DIS_8PSK_2_3 0xf2b940f0 +#define FSTV0910_P2_DIS_8PSK_3_5 0xf2b9000f + +/* P2_MODCODLSTA */ +#define RSTV0910_P2_MODCODLSTA 0xf2ba +#define FSTV0910_P2_NOSFILTER_LIMITE 0xf2ba7080 +#define FSTV0910_P2_DIS_QPSK_9_10 0xf2ba4030 +#define FSTV0910_P2_DIS_QPSK_8_9 0xf2ba000f + +/* P2_MODCODLSTB */ +#define RSTV0910_P2_MODCODLSTB 0xf2bb +#define FSTV0910_P2_DIS_QPSK_5_6 0xf2bb40f0 +#define FSTV0910_P2_DIS_QPSK_4_5 0xf2bb000f + +/* P2_MODCODLSTC */ +#define RSTV0910_P2_MODCODLSTC 0xf2bc +#define FSTV0910_P2_DIS_QPSK_3_4 0xf2bc40f0 +#define FSTV0910_P2_DIS_QPSK_2_3 0xf2bc000f + +/* P2_MODCODLSTD */ +#define RSTV0910_P2_MODCODLSTD 0xf2bd +#define FSTV0910_P2_DIS_QPSK_3_5 0xf2bd40f0 +#define FSTV0910_P2_DIS_QPSK_1_2 0xf2bd000f + +/* P2_MODCODLSTE */ +#define RSTV0910_P2_MODCODLSTE 0xf2be +#define FSTV0910_P2_DIS_QPSK_2_5 0xf2be40f0 +#define FSTV0910_P2_DIS_QPSK_1_3 0xf2be000f + +/* P2_MODCODLSTF */ +#define RSTV0910_P2_MODCODLSTF 0xf2bf +#define FSTV0910_P2_DIS_QPSK_1_4 0xf2bf40f0 +#define FSTV0910_P2_DEMOD_INVMODLST 0xf2bf3008 +#define FSTV0910_P2_DEMODOUT_ENABLE 0xf2bf2004 +#define FSTV0910_P2_DDEMOD_NSET 0xf2bf1002 +#define FSTV0910_P2_MODCOD_NSTOCK 0xf2bf0001 + +/* P2_GAUSSR0 */ +#define RSTV0910_P2_GAUSSR0 0xf2c0 +#define FSTV0910_P2_EN_CCIMODE 0xf2c07080 +#define FSTV0910_P2_R0_GAUSSIEN 0xf2c0007f + +/* P2_CCIR0 */ +#define RSTV0910_P2_CCIR0 0xf2c1 +#define FSTV0910_P2_CCIDETECT_PLHONLY 0xf2c17080 +#define FSTV0910_P2_R0_CCI 0xf2c1007f + +/* P2_CCIQUANT */ +#define RSTV0910_P2_CCIQUANT 0xf2c2 +#define FSTV0910_P2_CCI_BETA 0xf2c250e0 +#define FSTV0910_P2_CCI_QUANT 0xf2c2001f + +/* P2_CCITHRES */ +#define RSTV0910_P2_CCITHRES 0xf2c3 +#define FSTV0910_P2_CCI_THRESHOLD 0xf2c300ff + +/* P2_CCIACC */ +#define RSTV0910_P2_CCIACC 0xf2c4 +#define FSTV0910_P2_CCI_VALUE 0xf2c400ff + +/* P2_DSTATUS4 */ +#define RSTV0910_P2_DSTATUS4 0xf2c5 +#define FSTV0910_P2_RAINFADE_DETECT 0xf2c57080 +#define FSTV0910_P2_NOTHRES2_FAIL 0xf2c56040 +#define FSTV0910_P2_NOTHRES1_FAIL 0xf2c55020 +#define FSTV0910_P2_DMDPROG_ERROR 0xf2c52004 +#define FSTV0910_P2_CSTENV_DETECT 0xf2c51002 +#define FSTV0910_P2_DETECTION_TRIAX 0xf2c50001 + +/* P2_DMDRESCFG */ +#define RSTV0910_P2_DMDRESCFG 0xf2c6 +#define FSTV0910_P2_DMDRES_RESET 0xf2c67080 +#define FSTV0910_P2_DMDRES_STRALL 0xf2c63008 +#define FSTV0910_P2_DMDRES_NEWONLY 0xf2c62004 +#define FSTV0910_P2_DMDRES_NOSTORE 0xf2c61002 + +/* P2_DMDRESADR */ +#define RSTV0910_P2_DMDRESADR 0xf2c7 +#define FSTV0910_P2_DMDRES_VALIDCFR 0xf2c76040 +#define FSTV0910_P2_DMDRES_MEMFULL 0xf2c74030 +#define FSTV0910_P2_DMDRES_RESNBR 0xf2c7000f + +/* P2_DMDRESDATA7 */ +#define RSTV0910_P2_DMDRESDATA7 0xf2c8 +#define FSTV0910_P2_DMDRES_DATA7 0xf2c800ff + +/* P2_DMDRESDATA6 */ +#define RSTV0910_P2_DMDRESDATA6 0xf2c9 +#define FSTV0910_P2_DMDRES_DATA6 0xf2c900ff + +/* P2_DMDRESDATA5 */ +#define RSTV0910_P2_DMDRESDATA5 0xf2ca +#define FSTV0910_P2_DMDRES_DATA5 0xf2ca00ff + +/* P2_DMDRESDATA4 */ +#define RSTV0910_P2_DMDRESDATA4 0xf2cb +#define FSTV0910_P2_DMDRES_DATA4 0xf2cb00ff + +/* P2_DMDRESDATA3 */ +#define RSTV0910_P2_DMDRESDATA3 0xf2cc +#define FSTV0910_P2_DMDRES_DATA3 0xf2cc00ff + +/* P2_DMDRESDATA2 */ +#define RSTV0910_P2_DMDRESDATA2 0xf2cd +#define FSTV0910_P2_DMDRES_DATA2 0xf2cd00ff + +/* P2_DMDRESDATA1 */ +#define RSTV0910_P2_DMDRESDATA1 0xf2ce +#define FSTV0910_P2_DMDRES_DATA1 0xf2ce00ff + +/* P2_DMDRESDATA0 */ +#define RSTV0910_P2_DMDRESDATA0 0xf2cf +#define FSTV0910_P2_DMDRES_DATA0 0xf2cf00ff + +/* P2_FFEI1 */ +#define RSTV0910_P2_FFEI1 0xf2d0 +#define FSTV0910_P2_FFE_ACCI1 0xf2d001ff + +/* P2_FFEQ1 */ +#define RSTV0910_P2_FFEQ1 0xf2d1 +#define FSTV0910_P2_FFE_ACCQ1 0xf2d101ff + +/* P2_FFEI2 */ +#define RSTV0910_P2_FFEI2 0xf2d2 +#define FSTV0910_P2_FFE_ACCI2 0xf2d201ff + +/* P2_FFEQ2 */ +#define RSTV0910_P2_FFEQ2 0xf2d3 +#define FSTV0910_P2_FFE_ACCQ2 0xf2d301ff + +/* P2_FFEI3 */ +#define RSTV0910_P2_FFEI3 0xf2d4 +#define FSTV0910_P2_FFE_ACCI3 0xf2d401ff + +/* P2_FFEQ3 */ +#define RSTV0910_P2_FFEQ3 0xf2d5 +#define FSTV0910_P2_FFE_ACCQ3 0xf2d501ff + +/* P2_FFEI4 */ +#define RSTV0910_P2_FFEI4 0xf2d6 +#define FSTV0910_P2_FFE_ACCI4 0xf2d601ff + +/* P2_FFEQ4 */ +#define RSTV0910_P2_FFEQ4 0xf2d7 +#define FSTV0910_P2_FFE_ACCQ4 0xf2d701ff + +/* P2_FFECFG */ +#define RSTV0910_P2_FFECFG 0xf2d8 +#define FSTV0910_P2_EQUALFFE_ON 0xf2d86040 +#define FSTV0910_P2_EQUAL_USEDSYMB 0xf2d84030 +#define FSTV0910_P2_MU_EQUALFFE 0xf2d80007 + +/* P2_TNRCFG2 */ +#define RSTV0910_P2_TNRCFG2 0xf2e1 +#define FSTV0910_P2_TUN_IQSWAP 0xf2e17080 + +/* P2_SMAPCOEF7 */ +#define RSTV0910_P2_SMAPCOEF7 0xf300 +#define FSTV0910_P2_DIS_QSCALE 0xf3007080 +#define FSTV0910_P2_SMAPCOEF_Q_LLR12 0xf300017f + +/* P2_SMAPCOEF6 */ +#define RSTV0910_P2_SMAPCOEF6 0xf301 +#define FSTV0910_P2_DIS_AGC2SCALE 0xf3017080 +#define FSTV0910_P2_ADJ_8PSKLLR1 0xf3012004 +#define FSTV0910_P2_OLD_8PSKLLR1 0xf3011002 +#define FSTV0910_P2_DIS_AB8PSK 0xf3010001 + +/* P2_SMAPCOEF5 */ +#define RSTV0910_P2_SMAPCOEF5 0xf302 +#define FSTV0910_P2_DIS_8SCALE 0xf3027080 +#define FSTV0910_P2_SMAPCOEF_8P_LLR23 0xf302017f + +/* P2_SMAPCOEF4 */ +#define RSTV0910_P2_SMAPCOEF4 0xf303 +#define FSTV0910_P2_SMAPCOEF_16APSK_LLR12 0xf303017f + +/* P2_SMAPCOEF3 */ +#define RSTV0910_P2_SMAPCOEF3 0xf304 +#define FSTV0910_P2_SMAPCOEF_16APSK_LLR34 0xf304017f + +/* P2_SMAPCOEF2 */ +#define RSTV0910_P2_SMAPCOEF2 0xf305 +#define FSTV0910_P2_SMAPCOEF_32APSK_R2R3 0xf30541f0 +#define FSTV0910_P2_SMAPCOEF_32APSK_LLR2 0xf305010f + +/* P2_SMAPCOEF1 */ +#define RSTV0910_P2_SMAPCOEF1 0xf306 +#define FSTV0910_P2_DIS_16SCALE 0xf3067080 +#define FSTV0910_P2_SMAPCOEF_32_LLR34 0xf306017f + +/* P2_SMAPCOEF0 */ +#define RSTV0910_P2_SMAPCOEF0 0xf307 +#define FSTV0910_P2_DIS_32SCALE 0xf3077080 +#define FSTV0910_P2_SMAPCOEF_32_LLR15 0xf307017f + +/* P2_NOSTHRES1 */ +#define RSTV0910_P2_NOSTHRES1 0xf309 +#define FSTV0910_P2_NOS_THRESHOLD1 0xf30900ff + +/* P2_NOSTHRES2 */ +#define RSTV0910_P2_NOSTHRES2 0xf30a +#define FSTV0910_P2_NOS_THRESHOLD2 0xf30a00ff + +/* P2_NOSDIFF1 */ +#define RSTV0910_P2_NOSDIFF1 0xf30b +#define FSTV0910_P2_NOSTHRES1_DIFF 0xf30b00ff + +/* P2_RAINFADE */ +#define RSTV0910_P2_RAINFADE 0xf30c +#define FSTV0910_P2_NOSTHRES_DATAT 0xf30c7080 +#define FSTV0910_P2_RAINFADE_CNLIMIT 0xf30c4070 +#define FSTV0910_P2_RAINFADE_TIMEOUT 0xf30c0007 + +/* P2_NOSRAMCFG */ +#define RSTV0910_P2_NOSRAMCFG 0xf30d +#define FSTV0910_P2_NOSRAM_ACTIVATION 0xf30d4030 +#define FSTV0910_P2_NOSRAM_CNRONLY 0xf30d3008 +#define FSTV0910_P2_NOSRAM_LGNCNR1 0xf30d0007 + +/* P2_NOSRAMPOS */ +#define RSTV0910_P2_NOSRAMPOS 0xf30e +#define FSTV0910_P2_NOSRAM_LGNCNR0 0xf30e40f0 +#define FSTV0910_P2_NOSRAM_VALIDE 0xf30e2004 +#define FSTV0910_P2_NOSRAM_CNRVAL1 0xf30e0003 + +/* P2_NOSRAMVAL */ +#define RSTV0910_P2_NOSRAMVAL 0xf30f +#define FSTV0910_P2_NOSRAM_CNRVAL0 0xf30f00ff + +/* P2_DMDPLHSTAT */ +#define RSTV0910_P2_DMDPLHSTAT 0xf320 +#define FSTV0910_P2_PLH_STATISTIC 0xf32000ff + +/* P2_LOCKTIME3 */ +#define RSTV0910_P2_LOCKTIME3 0xf322 +#define FSTV0910_P2_DEMOD_LOCKTIME3 0xf32200ff + +/* P2_LOCKTIME2 */ +#define RSTV0910_P2_LOCKTIME2 0xf323 +#define FSTV0910_P2_DEMOD_LOCKTIME2 0xf32300ff + +/* P2_LOCKTIME1 */ +#define RSTV0910_P2_LOCKTIME1 0xf324 +#define FSTV0910_P2_DEMOD_LOCKTIME1 0xf32400ff + +/* P2_LOCKTIME0 */ +#define RSTV0910_P2_LOCKTIME0 0xf325 +#define FSTV0910_P2_DEMOD_LOCKTIME0 0xf32500ff + +/* P2_VITSCALE */ +#define RSTV0910_P2_VITSCALE 0xf332 +#define FSTV0910_P2_NVTH_NOSRANGE 0xf3327080 +#define FSTV0910_P2_VERROR_MAXMODE 0xf3326040 +#define FSTV0910_P2_NSLOWSN_LOCKED 0xf3323008 +#define FSTV0910_P2_DIS_RSFLOCK 0xf3321002 + +/* P2_FECM */ +#define RSTV0910_P2_FECM 0xf333 +#define FSTV0910_P2_DSS_DVB 0xf3337080 +#define FSTV0910_P2_DSS_SRCH 0xf3334010 +#define FSTV0910_P2_SYNCVIT 0xf3331002 +#define FSTV0910_P2_IQINV 0xf3330001 + +/* P2_VTH12 */ +#define RSTV0910_P2_VTH12 0xf334 +#define FSTV0910_P2_VTH12 0xf33400ff + +/* P2_VTH23 */ +#define RSTV0910_P2_VTH23 0xf335 +#define FSTV0910_P2_VTH23 0xf33500ff + +/* P2_VTH34 */ +#define RSTV0910_P2_VTH34 0xf336 +#define FSTV0910_P2_VTH34 0xf33600ff + +/* P2_VTH56 */ +#define RSTV0910_P2_VTH56 0xf337 +#define FSTV0910_P2_VTH56 0xf33700ff + +/* P2_VTH67 */ +#define RSTV0910_P2_VTH67 0xf338 +#define FSTV0910_P2_VTH67 0xf33800ff + +/* P2_VTH78 */ +#define RSTV0910_P2_VTH78 0xf339 +#define FSTV0910_P2_VTH78 0xf33900ff + +/* P2_VITCURPUN */ +#define RSTV0910_P2_VITCURPUN 0xf33a +#define FSTV0910_P2_VIT_CURPUN 0xf33a001f + +/* P2_VERROR */ +#define RSTV0910_P2_VERROR 0xf33b +#define FSTV0910_P2_REGERR_VIT 0xf33b00ff + +/* P2_PRVIT */ +#define RSTV0910_P2_PRVIT 0xf33c +#define FSTV0910_P2_DIS_VTHLOCK 0xf33c6040 +#define FSTV0910_P2_E7_8VIT 0xf33c5020 +#define FSTV0910_P2_E6_7VIT 0xf33c4010 +#define FSTV0910_P2_E5_6VIT 0xf33c3008 +#define FSTV0910_P2_E3_4VIT 0xf33c2004 +#define FSTV0910_P2_E2_3VIT 0xf33c1002 +#define FSTV0910_P2_E1_2VIT 0xf33c0001 + +/* P2_VAVSRVIT */ +#define RSTV0910_P2_VAVSRVIT 0xf33d +#define FSTV0910_P2_AMVIT 0xf33d7080 +#define FSTV0910_P2_FROZENVIT 0xf33d6040 +#define FSTV0910_P2_SNVIT 0xf33d4030 +#define FSTV0910_P2_TOVVIT 0xf33d200c +#define FSTV0910_P2_HYPVIT 0xf33d0003 + +/* P2_VSTATUSVIT */ +#define RSTV0910_P2_VSTATUSVIT 0xf33e +#define FSTV0910_P2_PRFVIT 0xf33e4010 +#define FSTV0910_P2_LOCKEDVIT 0xf33e3008 + +/* P2_VTHINUSE */ +#define RSTV0910_P2_VTHINUSE 0xf33f +#define FSTV0910_P2_VIT_INUSE 0xf33f00ff + +/* P2_KDIV12 */ +#define RSTV0910_P2_KDIV12 0xf340 +#define FSTV0910_P2_K_DIVIDER_12 0xf340007f + +/* P2_KDIV23 */ +#define RSTV0910_P2_KDIV23 0xf341 +#define FSTV0910_P2_K_DIVIDER_23 0xf341007f + +/* P2_KDIV34 */ +#define RSTV0910_P2_KDIV34 0xf342 +#define FSTV0910_P2_K_DIVIDER_34 0xf342007f + +/* P2_KDIV56 */ +#define RSTV0910_P2_KDIV56 0xf343 +#define FSTV0910_P2_K_DIVIDER_56 0xf343007f + +/* P2_KDIV67 */ +#define RSTV0910_P2_KDIV67 0xf344 +#define FSTV0910_P2_K_DIVIDER_67 0xf344007f + +/* P2_KDIV78 */ +#define RSTV0910_P2_KDIV78 0xf345 +#define FSTV0910_P2_K_DIVIDER_78 0xf345007f + +/* P2_TSPIDFLT1 */ +#define RSTV0910_P2_TSPIDFLT1 0xf346 +#define FSTV0910_P2_PIDFLT_ADDR 0xf34600ff + +/* P2_TSPIDFLT0 */ +#define RSTV0910_P2_TSPIDFLT0 0xf347 +#define FSTV0910_P2_PIDFLT_DATA 0xf34700ff + +/* P2_PDELCTRL0 */ +#define RSTV0910_P2_PDELCTRL0 0xf34f +#define FSTV0910_P2_ISIOBS_MODE 0xf34f4030 + +/* P2_PDELCTRL1 */ +#define RSTV0910_P2_PDELCTRL1 0xf350 +#define FSTV0910_P2_INV_MISMASK 0xf3507080 +#define FSTV0910_P2_FILTER_EN 0xf3505020 +#define FSTV0910_P2_HYSTEN 0xf3503008 +#define FSTV0910_P2_HYSTSWRST 0xf3502004 +#define FSTV0910_P2_EN_MIS00 0xf3501002 +#define FSTV0910_P2_ALGOSWRST 0xf3500001 + +/* P2_PDELCTRL2 */ +#define RSTV0910_P2_PDELCTRL2 0xf351 +#define FSTV0910_P2_FORCE_CONTINUOUS 0xf3517080 +#define FSTV0910_P2_RESET_UPKO_COUNT 0xf3516040 +#define FSTV0910_P2_USER_PKTDELIN_NB 0xf3515020 +#define FSTV0910_P2_FRAME_MODE 0xf3511002 + +/* P2_HYSTTHRESH */ +#define RSTV0910_P2_HYSTTHRESH 0xf354 +#define FSTV0910_P2_DELIN_LOCKTHRES 0xf35440f0 +#define FSTV0910_P2_DELIN_UNLOCKTHRES 0xf354000f + +/* P2_UPLCCST0 */ +#define RSTV0910_P2_UPLCCST0 0xf358 +#define FSTV0910_P2_UPL_CST0 0xf35830f8 +#define FSTV0910_P2_UPL_MODE 0xf3580007 + +/* P2_ISIENTRY */ +#define RSTV0910_P2_ISIENTRY 0xf35e +#define FSTV0910_P2_ISI_ENTRY 0xf35e00ff + +/* P2_ISIBITENA */ +#define RSTV0910_P2_ISIBITENA 0xf35f +#define FSTV0910_P2_ISI_BIT_EN 0xf35f00ff + +/* P2_MATSTR1 */ +#define RSTV0910_P2_MATSTR1 0xf360 +#define FSTV0910_P2_MATYPE_CURRENT1 0xf36000ff + +/* P2_MATSTR0 */ +#define RSTV0910_P2_MATSTR0 0xf361 +#define FSTV0910_P2_MATYPE_CURRENT0 0xf36100ff + +/* P2_UPLSTR1 */ +#define RSTV0910_P2_UPLSTR1 0xf362 +#define FSTV0910_P2_UPL_CURRENT1 0xf36200ff + +/* P2_UPLSTR0 */ +#define RSTV0910_P2_UPLSTR0 0xf363 +#define FSTV0910_P2_UPL_CURRENT0 0xf36300ff + +/* P2_DFLSTR1 */ +#define RSTV0910_P2_DFLSTR1 0xf364 +#define FSTV0910_P2_DFL_CURRENT1 0xf36400ff + +/* P2_DFLSTR0 */ +#define RSTV0910_P2_DFLSTR0 0xf365 +#define FSTV0910_P2_DFL_CURRENT0 0xf36500ff + +/* P2_SYNCSTR */ +#define RSTV0910_P2_SYNCSTR 0xf366 +#define FSTV0910_P2_SYNC_CURRENT 0xf36600ff + +/* P2_SYNCDSTR1 */ +#define RSTV0910_P2_SYNCDSTR1 0xf367 +#define FSTV0910_P2_SYNCD_CURRENT1 0xf36700ff + +/* P2_SYNCDSTR0 */ +#define RSTV0910_P2_SYNCDSTR0 0xf368 +#define FSTV0910_P2_SYNCD_CURRENT0 0xf36800ff + +/* P2_PDELSTATUS1 */ +#define RSTV0910_P2_PDELSTATUS1 0xf369 +#define FSTV0910_P2_PKTDELIN_DELOCK 0xf3697080 +#define FSTV0910_P2_SYNCDUPDFL_BADDFL 0xf3696040 +#define FSTV0910_P2_UNACCEPTED_STREAM 0xf3694010 +#define FSTV0910_P2_BCH_ERROR_FLAG 0xf3693008 +#define FSTV0910_P2_PKTDELIN_LOCK 0xf3691002 +#define FSTV0910_P2_FIRST_LOCK 0xf3690001 + +/* P2_PDELSTATUS2 */ +#define RSTV0910_P2_PDELSTATUS2 0xf36a +#define FSTV0910_P2_FRAME_MODCOD 0xf36a207c +#define FSTV0910_P2_FRAME_TYPE 0xf36a0003 + +/* P2_BBFCRCKO1 */ +#define RSTV0910_P2_BBFCRCKO1 0xf36b +#define FSTV0910_P2_BBHCRC_KOCNT1 0xf36b00ff + +/* P2_BBFCRCKO0 */ +#define RSTV0910_P2_BBFCRCKO0 0xf36c +#define FSTV0910_P2_BBHCRC_KOCNT0 0xf36c00ff + +/* P2_UPCRCKO1 */ +#define RSTV0910_P2_UPCRCKO1 0xf36d +#define FSTV0910_P2_PKTCRC_KOCNT1 0xf36d00ff + +/* P2_UPCRCKO0 */ +#define RSTV0910_P2_UPCRCKO0 0xf36e +#define FSTV0910_P2_PKTCRC_KOCNT0 0xf36e00ff + +/* P2_PDELCTRL3 */ +#define RSTV0910_P2_PDELCTRL3 0xf36f +#define FSTV0910_P2_NOFIFO_BCHERR 0xf36f5020 +#define FSTV0910_P2_PKTDELIN_DELACMERR 0xf36f4010 + +/* P2_TSSTATEM */ +#define RSTV0910_P2_TSSTATEM 0xf370 +#define FSTV0910_P2_TSDIL_ON 0xf3707080 +#define FSTV0910_P2_TSRS_ON 0xf3705020 +#define FSTV0910_P2_TSDESCRAMB_ON 0xf3704010 +#define FSTV0910_P2_TSFRAME_MODE 0xf3703008 +#define FSTV0910_P2_TS_DISABLE 0xf3702004 +#define FSTV0910_P2_TSACM_MODE 0xf3701002 +#define FSTV0910_P2_TSOUT_NOSYNC 0xf3700001 + +/* P2_TSSTATEL */ +#define RSTV0910_P2_TSSTATEL 0xf371 +#define FSTV0910_P2_TSNOSYNCBYTE 0xf3717080 +#define FSTV0910_P2_TSPARITY_ON 0xf3716040 +#define FSTV0910_P2_TSISSYI_ON 0xf3713008 +#define FSTV0910_P2_TSNPD_ON 0xf3712004 +#define FSTV0910_P2_TSCRC8_ON 0xf3711002 +#define FSTV0910_P2_TSDSS_PACKET 0xf3710001 + +/* P2_TSCFGH */ +#define RSTV0910_P2_TSCFGH 0xf372 +#define FSTV0910_P2_TSFIFO_DVBCI 0xf3727080 +#define FSTV0910_P2_TSFIFO_SERIAL 0xf3726040 +#define FSTV0910_P2_TSFIFO_TEIUPDATE 0xf3725020 +#define FSTV0910_P2_TSFIFO_DUTY50 0xf3724010 +#define FSTV0910_P2_TSFIFO_HSGNLOUT 0xf3723008 +#define FSTV0910_P2_TSFIFO_ERRMODE 0xf3721006 +#define FSTV0910_P2_RST_HWARE 0xf3720001 + +/* P2_TSCFGM */ +#define RSTV0910_P2_TSCFGM 0xf373 +#define FSTV0910_P2_TSFIFO_MANSPEED 0xf37360c0 +#define FSTV0910_P2_TSFIFO_PERMDATA 0xf3735020 +#define FSTV0910_P2_TSFIFO_NONEWSGNL 0xf3734010 +#define FSTV0910_P2_TSFIFO_INVDATA 0xf3730001 + +/* P2_TSCFGL */ +#define RSTV0910_P2_TSCFGL 0xf374 +#define FSTV0910_P2_TSFIFO_BCLKDEL1CK 0xf37460c0 +#define FSTV0910_P2_BCHERROR_MODE 0xf3744030 +#define FSTV0910_P2_TSFIFO_NSGNL2DATA 0xf3743008 +#define FSTV0910_P2_TSFIFO_EMBINDVB 0xf3742004 +#define FSTV0910_P2_TSFIFO_BITSPEED 0xf3740003 + +/* P2_TSSYNC */ +#define RSTV0910_P2_TSSYNC 0xf375 +#define FSTV0910_P2_TSFIFO_SYNCMODE 0xf3753018 + +/* P2_TSINSDELH */ +#define RSTV0910_P2_TSINSDELH 0xf376 +#define FSTV0910_P2_TSDEL_SYNCBYTE 0xf3767080 +#define FSTV0910_P2_TSDEL_XXHEADER 0xf3766040 +#define FSTV0910_P2_TSDEL_DATAFIELD 0xf3764010 +#define FSTV0910_P2_TSINSDEL_RSPARITY 0xf3761002 +#define FSTV0910_P2_TSINSDEL_CRC8 0xf3760001 + +/* P2_TSINSDELM */ +#define RSTV0910_P2_TSINSDELM 0xf377 +#define FSTV0910_P2_TSINS_EMODCOD 0xf3774010 +#define FSTV0910_P2_TSINS_TOKEN 0xf3773008 +#define FSTV0910_P2_TSINS_XXXERR 0xf3772004 +#define FSTV0910_P2_TSINS_MATYPE 0xf3771002 +#define FSTV0910_P2_TSINS_UPL 0xf3770001 + +/* P2_TSINSDELL */ +#define RSTV0910_P2_TSINSDELL 0xf378 +#define FSTV0910_P2_TSINS_DFL 0xf3787080 +#define FSTV0910_P2_TSINS_SYNCD 0xf3786040 +#define FSTV0910_P2_TSINS_BLOCLEN 0xf3785020 +#define FSTV0910_P2_TSINS_SIGPCOUNT 0xf3784010 +#define FSTV0910_P2_TSINS_FIFO 0xf3783008 +#define FSTV0910_P2_TSINS_REALPACK 0xf3782004 +#define FSTV0910_P2_TSINS_TSCONFIG 0xf3781002 +#define FSTV0910_P2_TSINS_LATENCY 0xf3780001 + +/* P2_TSDIVN */ +#define RSTV0910_P2_TSDIVN 0xf379 +#define FSTV0910_P2_TSFIFO_SPEEDMODE 0xf37960c0 +#define FSTV0910_P2_TSFIFO_RISEOK 0xf3790007 + +/* P2_TSCFG4 */ +#define RSTV0910_P2_TSCFG4 0xf37a +#define FSTV0910_P2_TSFIFO_TSSPEEDMODE 0xf37a60c0 + +/* P2_TSSPEED */ +#define RSTV0910_P2_TSSPEED 0xf380 +#define FSTV0910_P2_TSFIFO_OUTSPEED 0xf38000ff + +/* P2_TSSTATUS */ +#define RSTV0910_P2_TSSTATUS 0xf381 +#define FSTV0910_P2_TSFIFO_LINEOK 0xf3817080 +#define FSTV0910_P2_TSFIFO_ERROR 0xf3816040 +#define FSTV0910_P2_TSFIFO_NOSYNC 0xf3814010 +#define FSTV0910_P2_TSREGUL_ERROR 0xf3812004 +#define FSTV0910_P2_DIL_READY 0xf3810001 + +/* P2_TSSTATUS2 */ +#define RSTV0910_P2_TSSTATUS2 0xf382 +#define FSTV0910_P2_TSFIFO_DEMODSEL 0xf3827080 +#define FSTV0910_P2_TSFIFOSPEED_STORE 0xf3826040 +#define FSTV0910_P2_DILXX_RESET 0xf3825020 +#define FSTV0910_P2_SCRAMBDETECT 0xf3821002 + +/* P2_TSBITRATE1 */ +#define RSTV0910_P2_TSBITRATE1 0xf383 +#define FSTV0910_P2_TSFIFO_BITRATE1 0xf38300ff + +/* P2_TSBITRATE0 */ +#define RSTV0910_P2_TSBITRATE0 0xf384 +#define FSTV0910_P2_TSFIFO_BITRATE0 0xf38400ff + +/* P2_TSPACKLEN1 */ +#define RSTV0910_P2_TSPACKLEN1 0xf385 +#define FSTV0910_P2_TSFIFO_PACKCPT 0xf38550e0 + +/* P2_TSDLY2 */ +#define RSTV0910_P2_TSDLY2 0xf389 +#define FSTV0910_P2_SOFFIFO_LATENCY2 0xf389000f + +/* P2_TSDLY1 */ +#define RSTV0910_P2_TSDLY1 0xf38a +#define FSTV0910_P2_SOFFIFO_LATENCY1 0xf38a00ff + +/* P2_TSDLY0 */ +#define RSTV0910_P2_TSDLY0 0xf38b +#define FSTV0910_P2_SOFFIFO_LATENCY0 0xf38b00ff + +/* P2_TSNPDAV */ +#define RSTV0910_P2_TSNPDAV 0xf38c +#define FSTV0910_P2_TSNPD_AVERAGE 0xf38c00ff + +/* P2_TSBUFSTAT2 */ +#define RSTV0910_P2_TSBUFSTAT2 0xf38d +#define FSTV0910_P2_TSISCR_3BYTES 0xf38d7080 +#define FSTV0910_P2_TSISCR_NEWDATA 0xf38d6040 +#define FSTV0910_P2_TSISCR_BUFSTAT2 0xf38d003f + +/* P2_TSBUFSTAT1 */ +#define RSTV0910_P2_TSBUFSTAT1 0xf38e +#define FSTV0910_P2_TSISCR_BUFSTAT1 0xf38e00ff + +/* P2_TSBUFSTAT0 */ +#define RSTV0910_P2_TSBUFSTAT0 0xf38f +#define FSTV0910_P2_TSISCR_BUFSTAT0 0xf38f00ff + +/* P2_TSDEBUGL */ +#define RSTV0910_P2_TSDEBUGL 0xf391 +#define FSTV0910_P2_TSFIFO_ERROR_EVNT 0xf3912004 +#define FSTV0910_P2_TSFIFO_OVERFLOWM 0xf3910001 + +/* P2_TSDLYSET2 */ +#define RSTV0910_P2_TSDLYSET2 0xf392 +#define FSTV0910_P2_SOFFIFO_OFFSET 0xf39260c0 +#define FSTV0910_P2_HYSTERESIS_THRESHOLD 0xf3924030 +#define FSTV0910_P2_SOFFIFO_SYMBOFFS2 0xf392000f + +/* P2_TSDLYSET1 */ +#define RSTV0910_P2_TSDLYSET1 0xf393 +#define FSTV0910_P2_SOFFIFO_SYMBOFFS1 0xf39300ff + +/* P2_TSDLYSET0 */ +#define RSTV0910_P2_TSDLYSET0 0xf394 +#define FSTV0910_P2_SOFFIFO_SYMBOFFS0 0xf39400ff + +/* P2_ERRCTRL1 */ +#define RSTV0910_P2_ERRCTRL1 0xf398 +#define FSTV0910_P2_ERR_SOURCE1 0xf39840f0 +#define FSTV0910_P2_NUM_EVENT1 0xf3980007 + +/* P2_ERRCNT12 */ +#define RSTV0910_P2_ERRCNT12 0xf399 +#define FSTV0910_P2_ERRCNT1_OLDVALUE 0xf3997080 +#define FSTV0910_P2_ERR_CNT12 0xf399007f + +/* P2_ERRCNT11 */ +#define RSTV0910_P2_ERRCNT11 0xf39a +#define FSTV0910_P2_ERR_CNT11 0xf39a00ff + +/* P2_ERRCNT10 */ +#define RSTV0910_P2_ERRCNT10 0xf39b +#define FSTV0910_P2_ERR_CNT10 0xf39b00ff + +/* P2_ERRCTRL2 */ +#define RSTV0910_P2_ERRCTRL2 0xf39c +#define FSTV0910_P2_ERR_SOURCE2 0xf39c40f0 +#define FSTV0910_P2_NUM_EVENT2 0xf39c0007 + +/* P2_ERRCNT22 */ +#define RSTV0910_P2_ERRCNT22 0xf39d +#define FSTV0910_P2_ERRCNT2_OLDVALUE 0xf39d7080 +#define FSTV0910_P2_ERR_CNT22 0xf39d007f + +/* P2_ERRCNT21 */ +#define RSTV0910_P2_ERRCNT21 0xf39e +#define FSTV0910_P2_ERR_CNT21 0xf39e00ff + +/* P2_ERRCNT20 */ +#define RSTV0910_P2_ERRCNT20 0xf39f +#define FSTV0910_P2_ERR_CNT20 0xf39f00ff + +/* P2_FECSPY */ +#define RSTV0910_P2_FECSPY 0xf3a0 +#define FSTV0910_P2_SPY_ENABLE 0xf3a07080 +#define FSTV0910_P2_NO_SYNCBYTE 0xf3a06040 +#define FSTV0910_P2_SERIAL_MODE 0xf3a05020 +#define FSTV0910_P2_UNUSUAL_PACKET 0xf3a04010 +#define FSTV0910_P2_BERMETER_DATAMODE 0xf3a0200c +#define FSTV0910_P2_BERMETER_LMODE 0xf3a01002 +#define FSTV0910_P2_BERMETER_RESET 0xf3a00001 + +/* P2_FSPYCFG */ +#define RSTV0910_P2_FSPYCFG 0xf3a1 +#define FSTV0910_P2_FECSPY_INPUT 0xf3a160c0 +#define FSTV0910_P2_RST_ON_ERROR 0xf3a15020 +#define FSTV0910_P2_ONE_SHOT 0xf3a14010 +#define FSTV0910_P2_I2C_MODE 0xf3a1200c +#define FSTV0910_P2_SPY_HYSTERESIS 0xf3a10003 + +/* P2_FSPYDATA */ +#define RSTV0910_P2_FSPYDATA 0xf3a2 +#define FSTV0910_P2_SPY_STUFFING 0xf3a27080 +#define FSTV0910_P2_SPY_CNULLPKT 0xf3a25020 +#define FSTV0910_P2_SPY_OUTDATA_MODE 0xf3a2001f + +/* P2_FSPYOUT */ +#define RSTV0910_P2_FSPYOUT 0xf3a3 +#define FSTV0910_P2_FSPY_DIRECT 0xf3a37080 +#define FSTV0910_P2_STUFF_MODE 0xf3a30007 + +/* P2_FSTATUS */ +#define RSTV0910_P2_FSTATUS 0xf3a4 +#define FSTV0910_P2_SPY_ENDSIM 0xf3a47080 +#define FSTV0910_P2_VALID_SIM 0xf3a46040 +#define FSTV0910_P2_FOUND_SIGNAL 0xf3a45020 +#define FSTV0910_P2_DSS_SYNCBYTE 0xf3a44010 +#define FSTV0910_P2_RESULT_STATE 0xf3a4000f + +/* P2_FBERCPT4 */ +#define RSTV0910_P2_FBERCPT4 0xf3a8 +#define FSTV0910_P2_FBERMETER_CPT4 0xf3a800ff + +/* P2_FBERCPT3 */ +#define RSTV0910_P2_FBERCPT3 0xf3a9 +#define FSTV0910_P2_FBERMETER_CPT3 0xf3a900ff + +/* P2_FBERCPT2 */ +#define RSTV0910_P2_FBERCPT2 0xf3aa +#define FSTV0910_P2_FBERMETER_CPT2 0xf3aa00ff + +/* P2_FBERCPT1 */ +#define RSTV0910_P2_FBERCPT1 0xf3ab +#define FSTV0910_P2_FBERMETER_CPT1 0xf3ab00ff + +/* P2_FBERCPT0 */ +#define RSTV0910_P2_FBERCPT0 0xf3ac +#define FSTV0910_P2_FBERMETER_CPT0 0xf3ac00ff + +/* P2_FBERERR2 */ +#define RSTV0910_P2_FBERERR2 0xf3ad +#define FSTV0910_P2_FBERMETER_ERR2 0xf3ad00ff + +/* P2_FBERERR1 */ +#define RSTV0910_P2_FBERERR1 0xf3ae +#define FSTV0910_P2_FBERMETER_ERR1 0xf3ae00ff + +/* P2_FBERERR0 */ +#define RSTV0910_P2_FBERERR0 0xf3af +#define FSTV0910_P2_FBERMETER_ERR0 0xf3af00ff + +/* P2_FSPYBER */ +#define RSTV0910_P2_FSPYBER 0xf3b2 +#define FSTV0910_P2_FSPYBER_SYNCBYTE 0xf3b24010 +#define FSTV0910_P2_FSPYBER_UNSYNC 0xf3b23008 +#define FSTV0910_P2_FSPYBER_CTIME 0xf3b20007 + +/* P2_SFERROR */ +#define RSTV0910_P2_SFERROR 0xf3c1 +#define FSTV0910_P2_SFEC_REGERR_VIT 0xf3c100ff + +/* P2_SFECSTATUS */ +#define RSTV0910_P2_SFECSTATUS 0xf3c3 +#define FSTV0910_P2_SFEC_ON 0xf3c37080 +#define FSTV0910_P2_SFEC_OFF 0xf3c36040 +#define FSTV0910_P2_LOCKEDSFEC 0xf3c33008 +#define FSTV0910_P2_SFEC_DELOCK 0xf3c32004 +#define FSTV0910_P2_SFEC_DEMODSEL 0xf3c31002 +#define FSTV0910_P2_SFEC_OVFON 0xf3c30001 + +/* P2_SFKDIV12 */ +#define RSTV0910_P2_SFKDIV12 0xf3c4 +#define FSTV0910_P2_SFECKDIV12_MAN 0xf3c47080 + +/* P2_SFKDIV23 */ +#define RSTV0910_P2_SFKDIV23 0xf3c5 +#define FSTV0910_P2_SFECKDIV23_MAN 0xf3c57080 + +/* P2_SFKDIV34 */ +#define RSTV0910_P2_SFKDIV34 0xf3c6 +#define FSTV0910_P2_SFECKDIV34_MAN 0xf3c67080 + +/* P2_SFKDIV56 */ +#define RSTV0910_P2_SFKDIV56 0xf3c7 +#define FSTV0910_P2_SFECKDIV56_MAN 0xf3c77080 + +/* P2_SFKDIV67 */ +#define RSTV0910_P2_SFKDIV67 0xf3c8 +#define FSTV0910_P2_SFECKDIV67_MAN 0xf3c87080 + +/* P2_SFKDIV78 */ +#define RSTV0910_P2_SFKDIV78 0xf3c9 +#define FSTV0910_P2_SFECKDIV78_MAN 0xf3c97080 + +/* P2_SFSTATUS */ +#define RSTV0910_P2_SFSTATUS 0xf3cc +#define FSTV0910_P2_SFEC_LINEOK 0xf3cc7080 +#define FSTV0910_P2_SFEC_ERROR 0xf3cc6040 +#define FSTV0910_P2_SFEC_DATA7 0xf3cc5020 +#define FSTV0910_P2_SFEC_PKTDNBRFAIL 0xf3cc4010 +#define FSTV0910_P2_TSSFEC_DEMODSEL 0xf3cc3008 +#define FSTV0910_P2_SFEC_NOSYNC 0xf3cc2004 +#define FSTV0910_P2_SFEC_UNREGULA 0xf3cc1002 +#define FSTV0910_P2_SFEC_READY 0xf3cc0001 + +/* P2_SFDLYSET2 */ +#define RSTV0910_P2_SFDLYSET2 0xf3d0 +#define FSTV0910_P2_SFEC_DISABLE 0xf3d01002 + +/* P2_SFERRCTRL */ +#define RSTV0910_P2_SFERRCTRL 0xf3d8 +#define FSTV0910_P2_SFEC_ERR_SOURCE 0xf3d840f0 +#define FSTV0910_P2_SFEC_NUM_EVENT 0xf3d80007 + +/* P2_SFERRCNT2 */ +#define RSTV0910_P2_SFERRCNT2 0xf3d9 +#define FSTV0910_P2_SFERRC_OLDVALUE 0xf3d97080 +#define FSTV0910_P2_SFEC_ERR_CNT2 0xf3d9007f + +/* P2_SFERRCNT1 */ +#define RSTV0910_P2_SFERRCNT1 0xf3da +#define FSTV0910_P2_SFEC_ERR_CNT1 0xf3da00ff + +/* P2_SFERRCNT0 */ +#define RSTV0910_P2_SFERRCNT0 0xf3db +#define FSTV0910_P2_SFEC_ERR_CNT0 0xf3db00ff + +/* P1_IQCONST */ +#define RSTV0910_P1_IQCONST 0xf400 +#define FSTV0910_P1_CONSTEL_SELECT 0xf4005060 +#define FSTV0910_P1_IQSYMB_SEL 0xf400001f + +/* P1_NOSCFG */ +#define RSTV0910_P1_NOSCFG 0xf401 +#define FSTV0910_P1_DUMMYPL_NOSDATA 0xf4015020 +#define FSTV0910_P1_NOSPLH_BETA 0xf4013018 +#define FSTV0910_P1_NOSDATA_BETA 0xf4010007 + +/* P1_ISYMB */ +#define RSTV0910_P1_ISYMB 0xf402 +#define FSTV0910_P1_I_SYMBOL 0xf40201ff + +/* P1_QSYMB */ +#define RSTV0910_P1_QSYMB 0xf403 +#define FSTV0910_P1_Q_SYMBOL 0xf40301ff + +/* P1_AGC1CFG */ +#define RSTV0910_P1_AGC1CFG 0xf404 +#define FSTV0910_P1_DC_FROZEN 0xf4047080 +#define FSTV0910_P1_DC_CORRECT 0xf4046040 +#define FSTV0910_P1_AMM_FROZEN 0xf4045020 +#define FSTV0910_P1_AMM_CORRECT 0xf4044010 +#define FSTV0910_P1_QUAD_FROZEN 0xf4043008 +#define FSTV0910_P1_QUAD_CORRECT 0xf4042004 + +/* P1_AGC1CN */ +#define RSTV0910_P1_AGC1CN 0xf406 +#define FSTV0910_P1_AGC1_LOCKED 0xf4067080 +#define FSTV0910_P1_AGC1_MINPOWER 0xf4064010 +#define FSTV0910_P1_AGCOUT_FAST 0xf4063008 +#define FSTV0910_P1_AGCIQ_BETA 0xf4060007 + +/* P1_AGC1REF */ +#define RSTV0910_P1_AGC1REF 0xf407 +#define FSTV0910_P1_AGCIQ_REF 0xf40700ff + +/* P1_IDCCOMP */ +#define RSTV0910_P1_IDCCOMP 0xf408 +#define FSTV0910_P1_IAVERAGE_ADJ 0xf40801ff + +/* P1_QDCCOMP */ +#define RSTV0910_P1_QDCCOMP 0xf409 +#define FSTV0910_P1_QAVERAGE_ADJ 0xf40901ff + +/* P1_POWERI */ +#define RSTV0910_P1_POWERI 0xf40a +#define FSTV0910_P1_POWER_I 0xf40a00ff + +/* P1_POWERQ */ +#define RSTV0910_P1_POWERQ 0xf40b +#define FSTV0910_P1_POWER_Q 0xf40b00ff + +/* P1_AGC1AMM */ +#define RSTV0910_P1_AGC1AMM 0xf40c +#define FSTV0910_P1_AMM_VALUE 0xf40c00ff + +/* P1_AGC1QUAD */ +#define RSTV0910_P1_AGC1QUAD 0xf40d +#define FSTV0910_P1_QUAD_VALUE 0xf40d01ff + +/* P1_AGCIQIN1 */ +#define RSTV0910_P1_AGCIQIN1 0xf40e +#define FSTV0910_P1_AGCIQ_VALUE1 0xf40e00ff + +/* P1_AGCIQIN0 */ +#define RSTV0910_P1_AGCIQIN0 0xf40f +#define FSTV0910_P1_AGCIQ_VALUE0 0xf40f00ff + +/* P1_DEMOD */ +#define RSTV0910_P1_DEMOD 0xf410 +#define FSTV0910_P1_MANUALS2_ROLLOFF 0xf4107080 +#define FSTV0910_P1_SPECINV_CONTROL 0xf4104030 +#define FSTV0910_P1_MANUALSX_ROLLOFF 0xf4102004 +#define FSTV0910_P1_ROLLOFF_CONTROL 0xf4100003 + +/* P1_DMDMODCOD */ +#define RSTV0910_P1_DMDMODCOD 0xf411 +#define FSTV0910_P1_MANUAL_MODCOD 0xf4117080 +#define FSTV0910_P1_DEMOD_MODCOD 0xf411207c +#define FSTV0910_P1_DEMOD_TYPE 0xf4110003 + +/* P1_DSTATUS */ +#define RSTV0910_P1_DSTATUS 0xf412 +#define FSTV0910_P1_CAR_LOCK 0xf4127080 +#define FSTV0910_P1_TMGLOCK_QUALITY 0xf4125060 +#define FSTV0910_P1_LOCK_DEFINITIF 0xf4123008 +#define FSTV0910_P1_OVADC_DETECT 0xf4120001 + +/* P1_DSTATUS2 */ +#define RSTV0910_P1_DSTATUS2 0xf413 +#define FSTV0910_P1_DEMOD_DELOCK 0xf4137080 +#define FSTV0910_P1_MODCODRQ_SYNCTAG 0xf4135020 +#define FSTV0910_P1_POLYPH_SATEVENT 0xf4134010 +#define FSTV0910_P1_AGC1_NOSIGNALACK 0xf4133008 +#define FSTV0910_P1_AGC2_OVERFLOW 0xf4132004 +#define FSTV0910_P1_CFR_OVERFLOW 0xf4131002 +#define FSTV0910_P1_GAMMA_OVERUNDER 0xf4130001 + +/* P1_DMDCFGMD */ +#define RSTV0910_P1_DMDCFGMD 0xf414 +#define FSTV0910_P1_DVBS2_ENABLE 0xf4147080 +#define FSTV0910_P1_DVBS1_ENABLE 0xf4146040 +#define FSTV0910_P1_SCAN_ENABLE 0xf4144010 +#define FSTV0910_P1_CFR_AUTOSCAN 0xf4143008 +#define FSTV0910_P1_TUN_RNG 0xf4140003 + +/* P1_DMDCFG2 */ +#define RSTV0910_P1_DMDCFG2 0xf415 +#define FSTV0910_P1_S1S2_SEQUENTIAL 0xf4156040 +#define FSTV0910_P1_INFINITE_RELOCK 0xf4154010 + +/* P1_DMDISTATE */ +#define RSTV0910_P1_DMDISTATE 0xf416 +#define FSTV0910_P1_I2C_NORESETDMODE 0xf4167080 +#define FSTV0910_P1_I2C_DEMOD_MODE 0xf416001f + +/* P1_DMDT0M */ +#define RSTV0910_P1_DMDT0M 0xf417 +#define FSTV0910_P1_DMDT0_MIN 0xf41700ff + +/* P1_DMDSTATE */ +#define RSTV0910_P1_DMDSTATE 0xf41b +#define FSTV0910_P1_HEADER_MODE 0xf41b5060 + +/* P1_DMDFLYW */ +#define RSTV0910_P1_DMDFLYW 0xf41c +#define FSTV0910_P1_I2C_IRQVAL 0xf41c40f0 +#define FSTV0910_P1_FLYWHEEL_CPT 0xf41c000f + +/* P1_DSTATUS3 */ +#define RSTV0910_P1_DSTATUS3 0xf41d +#define FSTV0910_P1_CFR_ZIGZAG 0xf41d7080 +#define FSTV0910_P1_DEMOD_CFGMODE 0xf41d5060 +#define FSTV0910_P1_GAMMA_LOWBAUDRATE 0xf41d4010 + +/* P1_DMDCFG3 */ +#define RSTV0910_P1_DMDCFG3 0xf41e +#define FSTV0910_P1_NOSTOP_FIFOFULL 0xf41e3008 + +/* P1_DMDCFG4 */ +#define RSTV0910_P1_DMDCFG4 0xf41f +#define FSTV0910_P1_DIS_VITLOCK 0xf41f7080 +#define FSTV0910_P1_DIS_CLKENABLE 0xf41f2004 + +/* P1_CORRELMANT */ +#define RSTV0910_P1_CORRELMANT 0xf420 +#define FSTV0910_P1_CORREL_MANT 0xf42000ff + +/* P1_CORRELABS */ +#define RSTV0910_P1_CORRELABS 0xf421 +#define FSTV0910_P1_CORREL_ABS 0xf42100ff + +/* P1_CORRELEXP */ +#define RSTV0910_P1_CORRELEXP 0xf422 +#define FSTV0910_P1_CORREL_ABSEXP 0xf42240f0 +#define FSTV0910_P1_CORREL_EXP 0xf422000f + +/* P1_PLHMODCOD */ +#define RSTV0910_P1_PLHMODCOD 0xf424 +#define FSTV0910_P1_SPECINV_DEMOD 0xf4247080 +#define FSTV0910_P1_PLH_MODCOD 0xf424207c +#define FSTV0910_P1_PLH_TYPE 0xf4240003 + +/* P1_DMDREG */ +#define RSTV0910_P1_DMDREG 0xf425 +#define FSTV0910_P1_DECIM_PLFRAMES 0xf4250001 + +/* P1_AGCNADJ */ +#define RSTV0910_P1_AGCNADJ 0xf426 +#define FSTV0910_P1_RADJOFF_AGC2 0xf4267080 +#define FSTV0910_P1_RADJOFF_AGC1 0xf4266040 +#define FSTV0910_P1_AGC_NADJ 0xf426013f + +/* P1_AGCKS */ +#define RSTV0910_P1_AGCKS 0xf427 +#define FSTV0910_P1_RSADJ_MANUALCFG 0xf4277080 +#define FSTV0910_P1_RSADJ_CCMMODE 0xf4276040 +#define FSTV0910_P1_RADJ_SPSK 0xf427013f + +/* P1_AGCKQ */ +#define RSTV0910_P1_AGCKQ 0xf428 +#define FSTV0910_P1_RADJON_DVBS1 0xf4286040 +#define FSTV0910_P1_RADJ_QPSK 0xf428013f + +/* P1_AGCK8 */ +#define RSTV0910_P1_AGCK8 0xf429 +#define FSTV0910_P1_RADJ_8PSK 0xf429013f + +/* P1_AGCK16 */ +#define RSTV0910_P1_AGCK16 0xf42a +#define FSTV0910_P1_R2ADJOFF_16APSK 0xf42a6040 +#define FSTV0910_P1_R1ADJOFF_16APSK 0xf42a5020 +#define FSTV0910_P1_RADJ_16APSK 0xf42a011f + +/* P1_AGCK32 */ +#define RSTV0910_P1_AGCK32 0xf42b +#define FSTV0910_P1_R3ADJOFF_32APSK 0xf42b7080 +#define FSTV0910_P1_R2ADJOFF_32APSK 0xf42b6040 +#define FSTV0910_P1_R1ADJOFF_32APSK 0xf42b5020 +#define FSTV0910_P1_RADJ_32APSK 0xf42b011f + +/* P1_AGC2O */ +#define RSTV0910_P1_AGC2O 0xf42c +#define FSTV0910_P1_CSTENV_MODE 0xf42c60c0 +#define FSTV0910_P1_AGC2_COEF 0xf42c0007 + +/* P1_AGC2REF */ +#define RSTV0910_P1_AGC2REF 0xf42d +#define FSTV0910_P1_AGC2_REF 0xf42d00ff + +/* P1_AGC1ADJ */ +#define RSTV0910_P1_AGC1ADJ 0xf42e +#define FSTV0910_P1_AGC1_ADJUSTED 0xf42e007f + +/* P1_AGCRSADJ */ +#define RSTV0910_P1_AGCRSADJ 0xf42f +#define FSTV0910_P1_RS_ADJUSTED 0xf42f007f + +/* P1_AGCRQADJ */ +#define RSTV0910_P1_AGCRQADJ 0xf430 +#define FSTV0910_P1_RQ_ADJUSTED 0xf430007f + +/* P1_AGCR8ADJ */ +#define RSTV0910_P1_AGCR8ADJ 0xf431 +#define FSTV0910_P1_R8_ADJUSTED 0xf431007f + +/* P1_AGCR1ADJ */ +#define RSTV0910_P1_AGCR1ADJ 0xf432 +#define FSTV0910_P1_R1_ADJUSTED 0xf432007f + +/* P1_AGCR2ADJ */ +#define RSTV0910_P1_AGCR2ADJ 0xf433 +#define FSTV0910_P1_R2_ADJUSTED 0xf433007f + +/* P1_AGCR3ADJ */ +#define RSTV0910_P1_AGCR3ADJ 0xf434 +#define FSTV0910_P1_R3_ADJUSTED 0xf434007f + +/* P1_AGCREFADJ */ +#define RSTV0910_P1_AGCREFADJ 0xf435 +#define FSTV0910_P1_AGC2REF_ADJUSTED 0xf435007f + +/* P1_AGC2I1 */ +#define RSTV0910_P1_AGC2I1 0xf436 +#define FSTV0910_P1_AGC2_INTEGRATOR1 0xf43600ff + +/* P1_AGC2I0 */ +#define RSTV0910_P1_AGC2I0 0xf437 +#define FSTV0910_P1_AGC2_INTEGRATOR0 0xf43700ff + +/* P1_CARCFG */ +#define RSTV0910_P1_CARCFG 0xf438 +#define FSTV0910_P1_ROTAON 0xf4382004 +#define FSTV0910_P1_PH_DET_ALGO 0xf4380003 + +/* P1_ACLC */ +#define RSTV0910_P1_ACLC 0xf439 +#define FSTV0910_P1_CAR_ALPHA_MANT 0xf4394030 +#define FSTV0910_P1_CAR_ALPHA_EXP 0xf439000f + +/* P1_BCLC */ +#define RSTV0910_P1_BCLC 0xf43a +#define FSTV0910_P1_CAR_BETA_MANT 0xf43a4030 +#define FSTV0910_P1_CAR_BETA_EXP 0xf43a000f + +/* P1_ACLCS2 */ +#define RSTV0910_P1_ACLCS2 0xf43b +#define FSTV0910_P1_CARS2_APLHA_MANTISSE 0xf43b4030 +#define FSTV0910_P1_CARS2_ALPHA_EXP 0xf43b000f + +/* P1_BCLCS2 */ +#define RSTV0910_P1_BCLCS2 0xf43c +#define FSTV0910_P1_CARS2_BETA_MANTISSE 0xf43c4030 +#define FSTV0910_P1_CARS2_BETA_EXP 0xf43c000f + +/* P1_CARFREQ */ +#define RSTV0910_P1_CARFREQ 0xf43d +#define FSTV0910_P1_KC_COARSE_EXP 0xf43d40f0 +#define FSTV0910_P1_BETA_FREQ 0xf43d000f + +/* P1_CARHDR */ +#define RSTV0910_P1_CARHDR 0xf43e +#define FSTV0910_P1_K_FREQ_HDR 0xf43e00ff + +/* P1_LDT */ +#define RSTV0910_P1_LDT 0xf43f +#define FSTV0910_P1_CARLOCK_THRES 0xf43f01ff + +/* P1_LDT2 */ +#define RSTV0910_P1_LDT2 0xf440 +#define FSTV0910_P1_CARLOCK_THRES2 0xf44001ff + +/* P1_CFRICFG */ +#define RSTV0910_P1_CFRICFG 0xf441 +#define FSTV0910_P1_NEG_CFRSTEP 0xf4410001 + +/* P1_CFRUP1 */ +#define RSTV0910_P1_CFRUP1 0xf442 +#define FSTV0910_P1_CFR_UP1 0xf44201ff + +/* P1_CFRUP0 */ +#define RSTV0910_P1_CFRUP0 0xf443 +#define FSTV0910_P1_CFR_UP0 0xf44300ff + +/* P1_CFRIBASE1 */ +#define RSTV0910_P1_CFRIBASE1 0xf444 +#define FSTV0910_P1_CFRINIT_BASE1 0xf44400ff + +/* P1_CFRIBASE0 */ +#define RSTV0910_P1_CFRIBASE0 0xf445 +#define FSTV0910_P1_CFRINIT_BASE0 0xf44500ff + +/* P1_CFRLOW1 */ +#define RSTV0910_P1_CFRLOW1 0xf446 +#define FSTV0910_P1_CFR_LOW1 0xf44601ff + +/* P1_CFRLOW0 */ +#define RSTV0910_P1_CFRLOW0 0xf447 +#define FSTV0910_P1_CFR_LOW0 0xf44700ff + +/* P1_CFRINIT1 */ +#define RSTV0910_P1_CFRINIT1 0xf448 +#define FSTV0910_P1_CFR_INIT1 0xf44801ff + +/* P1_CFRINIT0 */ +#define RSTV0910_P1_CFRINIT0 0xf449 +#define FSTV0910_P1_CFR_INIT0 0xf44900ff + +/* P1_CFRINC1 */ +#define RSTV0910_P1_CFRINC1 0xf44a +#define FSTV0910_P1_MANUAL_CFRINC 0xf44a7080 +#define FSTV0910_P1_CFR_INC1 0xf44a003f + +/* P1_CFRINC0 */ +#define RSTV0910_P1_CFRINC0 0xf44b +#define FSTV0910_P1_CFR_INC0 0xf44b00ff + +/* P1_CFR2 */ +#define RSTV0910_P1_CFR2 0xf44c +#define FSTV0910_P1_CAR_FREQ2 0xf44c01ff + +/* P1_CFR1 */ +#define RSTV0910_P1_CFR1 0xf44d +#define FSTV0910_P1_CAR_FREQ1 0xf44d00ff + +/* P1_CFR0 */ +#define RSTV0910_P1_CFR0 0xf44e +#define FSTV0910_P1_CAR_FREQ0 0xf44e00ff + +/* P1_LDI */ +#define RSTV0910_P1_LDI 0xf44f +#define FSTV0910_P1_LOCK_DET_INTEGR 0xf44f01ff + +/* P1_TMGCFG */ +#define RSTV0910_P1_TMGCFG 0xf450 +#define FSTV0910_P1_TMGLOCK_BETA 0xf45060c0 +#define FSTV0910_P1_DO_TIMING_CORR 0xf4504010 +#define FSTV0910_P1_TMG_MINFREQ 0xf4500003 + +/* P1_RTC */ +#define RSTV0910_P1_RTC 0xf451 +#define FSTV0910_P1_TMGALPHA_EXP 0xf45140f0 +#define FSTV0910_P1_TMGBETA_EXP 0xf451000f + +/* P1_RTCS2 */ +#define RSTV0910_P1_RTCS2 0xf452 +#define FSTV0910_P1_TMGALPHAS2_EXP 0xf45240f0 +#define FSTV0910_P1_TMGBETAS2_EXP 0xf452000f + +/* P1_TMGTHRISE */ +#define RSTV0910_P1_TMGTHRISE 0xf453 +#define FSTV0910_P1_TMGLOCK_THRISE 0xf45300ff + +/* P1_TMGTHFALL */ +#define RSTV0910_P1_TMGTHFALL 0xf454 +#define FSTV0910_P1_TMGLOCK_THFALL 0xf45400ff + +/* P1_SFRUPRATIO */ +#define RSTV0910_P1_SFRUPRATIO 0xf455 +#define FSTV0910_P1_SFR_UPRATIO 0xf45500ff + +/* P1_SFRLOWRATIO */ +#define RSTV0910_P1_SFRLOWRATIO 0xf456 +#define FSTV0910_P1_SFR_LOWRATIO 0xf45600ff + +/* P1_KTTMG */ +#define RSTV0910_P1_KTTMG 0xf457 +#define FSTV0910_P1_KT_TMG_EXP 0xf45740f0 + +/* P1_KREFTMG */ +#define RSTV0910_P1_KREFTMG 0xf458 +#define FSTV0910_P1_KREF_TMG 0xf45800ff + +/* P1_SFRSTEP */ +#define RSTV0910_P1_SFRSTEP 0xf459 +#define FSTV0910_P1_SFR_SCANSTEP 0xf45940f0 +#define FSTV0910_P1_SFR_CENTERSTEP 0xf459000f + +/* P1_TMGCFG2 */ +#define RSTV0910_P1_TMGCFG2 0xf45a +#define FSTV0910_P1_DIS_AUTOSAMP 0xf45a3008 +#define FSTV0910_P1_SFRRATIO_FINE 0xf45a0001 + +/* P1_KREFTMG2 */ +#define RSTV0910_P1_KREFTMG2 0xf45b +#define FSTV0910_P1_KREF_TMG2 0xf45b00ff + +/* P1_TMGCFG3 */ +#define RSTV0910_P1_TMGCFG3 0xf45d +#define FSTV0910_P1_CONT_TMGCENTER 0xf45d3008 +#define FSTV0910_P1_AUTO_GUP 0xf45d2004 +#define FSTV0910_P1_AUTO_GLOW 0xf45d1002 + +/* P1_SFRINIT1 */ +#define RSTV0910_P1_SFRINIT1 0xf45e +#define FSTV0910_P1_SFR_INIT1 0xf45e00ff + +/* P1_SFRINIT0 */ +#define RSTV0910_P1_SFRINIT0 0xf45f +#define FSTV0910_P1_SFR_INIT0 0xf45f00ff + +/* P1_SFRUP1 */ +#define RSTV0910_P1_SFRUP1 0xf460 +#define FSTV0910_P1_SYMB_FREQ_UP1 0xf46000ff + +/* P1_SFRUP0 */ +#define RSTV0910_P1_SFRUP0 0xf461 +#define FSTV0910_P1_SYMB_FREQ_UP0 0xf46100ff + +/* P1_SFRLOW1 */ +#define RSTV0910_P1_SFRLOW1 0xf462 +#define FSTV0910_P1_SYMB_FREQ_LOW1 0xf46200ff + +/* P1_SFRLOW0 */ +#define RSTV0910_P1_SFRLOW0 0xf463 +#define FSTV0910_P1_SYMB_FREQ_LOW0 0xf46300ff + +/* P1_SFR3 */ +#define RSTV0910_P1_SFR3 0xf464 +#define FSTV0910_P1_SYMB_FREQ3 0xf46400ff + +/* P1_SFR2 */ +#define RSTV0910_P1_SFR2 0xf465 +#define FSTV0910_P1_SYMB_FREQ2 0xf46500ff + +/* P1_SFR1 */ +#define RSTV0910_P1_SFR1 0xf466 +#define FSTV0910_P1_SYMB_FREQ1 0xf46600ff + +/* P1_SFR0 */ +#define RSTV0910_P1_SFR0 0xf467 +#define FSTV0910_P1_SYMB_FREQ0 0xf46700ff + +/* P1_TMGREG2 */ +#define RSTV0910_P1_TMGREG2 0xf468 +#define FSTV0910_P1_TMGREG2 0xf46800ff + +/* P1_TMGREG1 */ +#define RSTV0910_P1_TMGREG1 0xf469 +#define FSTV0910_P1_TMGREG1 0xf46900ff + +/* P1_TMGREG0 */ +#define RSTV0910_P1_TMGREG0 0xf46a +#define FSTV0910_P1_TMGREG0 0xf46a00ff + +/* P1_TMGLOCK1 */ +#define RSTV0910_P1_TMGLOCK1 0xf46b +#define FSTV0910_P1_TMGLOCK_LEVEL1 0xf46b01ff + +/* P1_TMGLOCK0 */ +#define RSTV0910_P1_TMGLOCK0 0xf46c +#define FSTV0910_P1_TMGLOCK_LEVEL0 0xf46c00ff + +/* P1_TMGOBS */ +#define RSTV0910_P1_TMGOBS 0xf46d +#define FSTV0910_P1_ROLLOFF_STATUS 0xf46d60c0 + +/* P1_EQUALCFG */ +#define RSTV0910_P1_EQUALCFG 0xf46f +#define FSTV0910_P1_EQUAL_ON 0xf46f6040 +#define FSTV0910_P1_MU_EQUALDFE 0xf46f0007 + +/* P1_EQUAI1 */ +#define RSTV0910_P1_EQUAI1 0xf470 +#define FSTV0910_P1_EQUA_ACCI1 0xf47001ff + +/* P1_EQUAQ1 */ +#define RSTV0910_P1_EQUAQ1 0xf471 +#define FSTV0910_P1_EQUA_ACCQ1 0xf47101ff + +/* P1_EQUAI2 */ +#define RSTV0910_P1_EQUAI2 0xf472 +#define FSTV0910_P1_EQUA_ACCI2 0xf47201ff + +/* P1_EQUAQ2 */ +#define RSTV0910_P1_EQUAQ2 0xf473 +#define FSTV0910_P1_EQUA_ACCQ2 0xf47301ff + +/* P1_EQUAI3 */ +#define RSTV0910_P1_EQUAI3 0xf474 +#define FSTV0910_P1_EQUA_ACCI3 0xf47401ff + +/* P1_EQUAQ3 */ +#define RSTV0910_P1_EQUAQ3 0xf475 +#define FSTV0910_P1_EQUA_ACCQ3 0xf47501ff + +/* P1_EQUAI4 */ +#define RSTV0910_P1_EQUAI4 0xf476 +#define FSTV0910_P1_EQUA_ACCI4 0xf47601ff + +/* P1_EQUAQ4 */ +#define RSTV0910_P1_EQUAQ4 0xf477 +#define FSTV0910_P1_EQUA_ACCQ4 0xf47701ff + +/* P1_EQUAI5 */ +#define RSTV0910_P1_EQUAI5 0xf478 +#define FSTV0910_P1_EQUA_ACCI5 0xf47801ff + +/* P1_EQUAQ5 */ +#define RSTV0910_P1_EQUAQ5 0xf479 +#define FSTV0910_P1_EQUA_ACCQ5 0xf47901ff + +/* P1_EQUAI6 */ +#define RSTV0910_P1_EQUAI6 0xf47a +#define FSTV0910_P1_EQUA_ACCI6 0xf47a01ff + +/* P1_EQUAQ6 */ +#define RSTV0910_P1_EQUAQ6 0xf47b +#define FSTV0910_P1_EQUA_ACCQ6 0xf47b01ff + +/* P1_EQUAI7 */ +#define RSTV0910_P1_EQUAI7 0xf47c +#define FSTV0910_P1_EQUA_ACCI7 0xf47c01ff + +/* P1_EQUAQ7 */ +#define RSTV0910_P1_EQUAQ7 0xf47d +#define FSTV0910_P1_EQUA_ACCQ7 0xf47d01ff + +/* P1_EQUAI8 */ +#define RSTV0910_P1_EQUAI8 0xf47e +#define FSTV0910_P1_EQUA_ACCI8 0xf47e01ff + +/* P1_EQUAQ8 */ +#define RSTV0910_P1_EQUAQ8 0xf47f +#define FSTV0910_P1_EQUA_ACCQ8 0xf47f01ff + +/* P1_NNOSDATAT1 */ +#define RSTV0910_P1_NNOSDATAT1 0xf480 +#define FSTV0910_P1_NOSDATAT_NORMED1 0xf48000ff + +/* P1_NNOSDATAT0 */ +#define RSTV0910_P1_NNOSDATAT0 0xf481 +#define FSTV0910_P1_NOSDATAT_NORMED0 0xf48100ff + +/* P1_NNOSDATA1 */ +#define RSTV0910_P1_NNOSDATA1 0xf482 +#define FSTV0910_P1_NOSDATA_NORMED1 0xf48200ff + +/* P1_NNOSDATA0 */ +#define RSTV0910_P1_NNOSDATA0 0xf483 +#define FSTV0910_P1_NOSDATA_NORMED0 0xf48300ff + +/* P1_NNOSPLHT1 */ +#define RSTV0910_P1_NNOSPLHT1 0xf484 +#define FSTV0910_P1_NOSPLHT_NORMED1 0xf48400ff + +/* P1_NNOSPLHT0 */ +#define RSTV0910_P1_NNOSPLHT0 0xf485 +#define FSTV0910_P1_NOSPLHT_NORMED0 0xf48500ff + +/* P1_NNOSPLH1 */ +#define RSTV0910_P1_NNOSPLH1 0xf486 +#define FSTV0910_P1_NOSPLH_NORMED1 0xf48600ff + +/* P1_NNOSPLH0 */ +#define RSTV0910_P1_NNOSPLH0 0xf487 +#define FSTV0910_P1_NOSPLH_NORMED0 0xf48700ff + +/* P1_NOSDATAT1 */ +#define RSTV0910_P1_NOSDATAT1 0xf488 +#define FSTV0910_P1_NOSDATAT_UNNORMED1 0xf48800ff + +/* P1_NOSDATAT0 */ +#define RSTV0910_P1_NOSDATAT0 0xf489 +#define FSTV0910_P1_NOSDATAT_UNNORMED0 0xf48900ff + +/* P1_NNOSFRAME1 */ +#define RSTV0910_P1_NNOSFRAME1 0xf48a +#define FSTV0910_P1_NOSFRAME_NORMED1 0xf48a00ff + +/* P1_NNOSFRAME0 */ +#define RSTV0910_P1_NNOSFRAME0 0xf48b +#define FSTV0910_P1_NOSFRAME_NORMED0 0xf48b00ff + +/* P1_NNOSRAD1 */ +#define RSTV0910_P1_NNOSRAD1 0xf48c +#define FSTV0910_P1_NOSRADIAL_NORMED1 0xf48c00ff + +/* P1_NNOSRAD0 */ +#define RSTV0910_P1_NNOSRAD0 0xf48d +#define FSTV0910_P1_NOSRADIAL_NORMED0 0xf48d00ff + +/* P1_NOSCFGF1 */ +#define RSTV0910_P1_NOSCFGF1 0xf48e +#define FSTV0910_P1_LOWNOISE_MESURE 0xf48e7080 +#define FSTV0910_P1_NOS_DELFRAME 0xf48e6040 +#define FSTV0910_P1_NOSDATA_MODE 0xf48e4030 +#define FSTV0910_P1_FRAMESEL_TYPESEL 0xf48e200c +#define FSTV0910_P1_FRAMESEL_TYPE 0xf48e0003 + +/* P1_NOSCFGF2 */ +#define RSTV0910_P1_NOSCFGF2 0xf48f +#define FSTV0910_P1_DIS_NOSPILOTS 0xf48f7080 +#define FSTV0910_P1_FRAMESEL_MODCODSEL 0xf48f5060 +#define FSTV0910_P1_FRAMESEL_MODCOD 0xf48f001f + +/* P1_CAR2CFG */ +#define RSTV0910_P1_CAR2CFG 0xf490 +#define FSTV0910_P1_ROTA2ON 0xf4902004 +#define FSTV0910_P1_PH_DET_ALGO2 0xf4900003 + +/* P1_CFR2CFR1 */ +#define RSTV0910_P1_CFR2CFR1 0xf491 +#define FSTV0910_P1_EN_S2CAR2CENTER 0xf4915020 +#define FSTV0910_P1_CFR2TOCFR1_BETA 0xf4910007 + +/* P1_CAR3CFG */ +#define RSTV0910_P1_CAR3CFG 0xf492 +#define FSTV0910_P1_CARRIER23_MODE 0xf49260c0 +#define FSTV0910_P1_CAR3INTERM_DVBS1 0xf4925020 +#define FSTV0910_P1_ABAMPLIF_MODE 0xf4923018 +#define FSTV0910_P1_CARRIER3_ALPHA3DL 0xf4920007 + +/* P1_CFR22 */ +#define RSTV0910_P1_CFR22 0xf493 +#define FSTV0910_P1_CAR2_FREQ2 0xf49301ff + +/* P1_CFR21 */ +#define RSTV0910_P1_CFR21 0xf494 +#define FSTV0910_P1_CAR2_FREQ1 0xf49400ff + +/* P1_CFR20 */ +#define RSTV0910_P1_CFR20 0xf495 +#define FSTV0910_P1_CAR2_FREQ0 0xf49500ff + +/* P1_ACLC2S2Q */ +#define RSTV0910_P1_ACLC2S2Q 0xf497 +#define FSTV0910_P1_ENAB_SPSKSYMB 0xf4977080 +#define FSTV0910_P1_CAR2S2_Q_ALPH_M 0xf4974030 +#define FSTV0910_P1_CAR2S2_Q_ALPH_E 0xf497000f + +/* P1_ACLC2S28 */ +#define RSTV0910_P1_ACLC2S28 0xf498 +#define FSTV0910_P1_CAR2S2_8_ALPH_M 0xf4984030 +#define FSTV0910_P1_CAR2S2_8_ALPH_E 0xf498000f + +/* P1_ACLC2S216A */ +#define RSTV0910_P1_ACLC2S216A 0xf499 +#define FSTV0910_P1_CAR2S2_16A_ALPH_M 0xf4994030 +#define FSTV0910_P1_CAR2S2_16A_ALPH_E 0xf499000f + +/* P1_ACLC2S232A */ +#define RSTV0910_P1_ACLC2S232A 0xf49a +#define FSTV0910_P1_CAR2S2_32A_ALPH_M 0xf49a4030 +#define FSTV0910_P1_CAR2S2_32A_ALPH_E 0xf49a000f + +/* P1_BCLC2S2Q */ +#define RSTV0910_P1_BCLC2S2Q 0xf49c +#define FSTV0910_P1_CAR2S2_Q_BETA_M 0xf49c4030 +#define FSTV0910_P1_CAR2S2_Q_BETA_E 0xf49c000f + +/* P1_BCLC2S28 */ +#define RSTV0910_P1_BCLC2S28 0xf49d +#define FSTV0910_P1_CAR2S2_8_BETA_M 0xf49d4030 +#define FSTV0910_P1_CAR2S2_8_BETA_E 0xf49d000f + +/* P1_BCLC2S216A */ +#define RSTV0910_P1_BCLC2S216A 0xf49e +#define FSTV0910_P1_DVBS2S216A_NIP 0xf49e7080 +#define FSTV0910_P1_CAR2S2_16A_BETA_M 0xf49e4030 +#define FSTV0910_P1_CAR2S2_16A_BETA_E 0xf49e000f + +/* P1_BCLC2S232A */ +#define RSTV0910_P1_BCLC2S232A 0xf49f +#define FSTV0910_P1_DVBS2S232A_NIP 0xf49f7080 +#define FSTV0910_P1_CAR2S2_32A_BETA_M 0xf49f4030 +#define FSTV0910_P1_CAR2S2_32A_BETA_E 0xf49f000f + +/* P1_PLROOT2 */ +#define RSTV0910_P1_PLROOT2 0xf4ac +#define FSTV0910_P1_PLSCRAMB_MODE 0xf4ac200c +#define FSTV0910_P1_PLSCRAMB_ROOT2 0xf4ac0003 + +/* P1_PLROOT1 */ +#define RSTV0910_P1_PLROOT1 0xf4ad +#define FSTV0910_P1_PLSCRAMB_ROOT1 0xf4ad00ff + +/* P1_PLROOT0 */ +#define RSTV0910_P1_PLROOT0 0xf4ae +#define FSTV0910_P1_PLSCRAMB_ROOT0 0xf4ae00ff + +/* P1_MODCODLST0 */ +#define RSTV0910_P1_MODCODLST0 0xf4b0 +#define FSTV0910_P1_NACCES_MODCODCH 0xf4b00001 + +/* P1_MODCODLST1 */ +#define RSTV0910_P1_MODCODLST1 0xf4b1 +#define FSTV0910_P1_SYMBRATE_FILTER 0xf4b13008 +#define FSTV0910_P1_NRESET_MODCODLST 0xf4b12004 +#define FSTV0910_P1_DIS_32PSK_9_10 0xf4b10003 + +/* P1_MODCODLST2 */ +#define RSTV0910_P1_MODCODLST2 0xf4b2 +#define FSTV0910_P1_DIS_32PSK_8_9 0xf4b240f0 +#define FSTV0910_P1_DIS_32PSK_5_6 0xf4b2000f + +/* P1_MODCODLST3 */ +#define RSTV0910_P1_MODCODLST3 0xf4b3 +#define FSTV0910_P1_DIS_32PSK_4_5 0xf4b340f0 +#define FSTV0910_P1_DIS_32PSK_3_4 0xf4b3000f + +/* P1_MODCODLST4 */ +#define RSTV0910_P1_MODCODLST4 0xf4b4 +#define FSTV0910_P1_DUMMYPL_PILOT 0xf4b47080 +#define FSTV0910_P1_DUMMYPL_NOPILOT 0xf4b46040 +#define FSTV0910_P1_DIS_16PSK_9_10 0xf4b44030 +#define FSTV0910_P1_DIS_16PSK_8_9 0xf4b4000f + +/* P1_MODCODLST5 */ +#define RSTV0910_P1_MODCODLST5 0xf4b5 +#define FSTV0910_P1_DIS_16PSK_5_6 0xf4b540f0 +#define FSTV0910_P1_DIS_16PSK_4_5 0xf4b5000f + +/* P1_MODCODLST6 */ +#define RSTV0910_P1_MODCODLST6 0xf4b6 +#define FSTV0910_P1_DIS_16PSK_3_4 0xf4b640f0 +#define FSTV0910_P1_DIS_16PSK_2_3 0xf4b6000f + +/* P1_MODCODLST7 */ +#define RSTV0910_P1_MODCODLST7 0xf4b7 +#define FSTV0910_P1_MODCOD_NNOSFILTER 0xf4b77080 +#define FSTV0910_P1_DIS_8PSK_9_10 0xf4b74030 +#define FSTV0910_P1_DIS_8PSK_8_9 0xf4b7000f + +/* P1_MODCODLST8 */ +#define RSTV0910_P1_MODCODLST8 0xf4b8 +#define FSTV0910_P1_DIS_8PSK_5_6 0xf4b840f0 +#define FSTV0910_P1_DIS_8PSK_3_4 0xf4b8000f + +/* P1_MODCODLST9 */ +#define RSTV0910_P1_MODCODLST9 0xf4b9 +#define FSTV0910_P1_DIS_8PSK_2_3 0xf4b940f0 +#define FSTV0910_P1_DIS_8PSK_3_5 0xf4b9000f + +/* P1_MODCODLSTA */ +#define RSTV0910_P1_MODCODLSTA 0xf4ba +#define FSTV0910_P1_NOSFILTER_LIMITE 0xf4ba7080 +#define FSTV0910_P1_DIS_QPSK_9_10 0xf4ba4030 +#define FSTV0910_P1_DIS_QPSK_8_9 0xf4ba000f + +/* P1_MODCODLSTB */ +#define RSTV0910_P1_MODCODLSTB 0xf4bb +#define FSTV0910_P1_DIS_QPSK_5_6 0xf4bb40f0 +#define FSTV0910_P1_DIS_QPSK_4_5 0xf4bb000f + +/* P1_MODCODLSTC */ +#define RSTV0910_P1_MODCODLSTC 0xf4bc +#define FSTV0910_P1_DIS_QPSK_3_4 0xf4bc40f0 +#define FSTV0910_P1_DIS_QPSK_2_3 0xf4bc000f + +/* P1_MODCODLSTD */ +#define RSTV0910_P1_MODCODLSTD 0xf4bd +#define FSTV0910_P1_DIS_QPSK_3_5 0xf4bd40f0 +#define FSTV0910_P1_DIS_QPSK_1_2 0xf4bd000f + +/* P1_MODCODLSTE */ +#define RSTV0910_P1_MODCODLSTE 0xf4be +#define FSTV0910_P1_DIS_QPSK_2_5 0xf4be40f0 +#define FSTV0910_P1_DIS_QPSK_1_3 0xf4be000f + +/* P1_MODCODLSTF */ +#define RSTV0910_P1_MODCODLSTF 0xf4bf +#define FSTV0910_P1_DIS_QPSK_1_4 0xf4bf40f0 +#define FSTV0910_P1_DEMOD_INVMODLST 0xf4bf3008 +#define FSTV0910_P1_DEMODOUT_ENABLE 0xf4bf2004 +#define FSTV0910_P1_DDEMOD_NSET 0xf4bf1002 +#define FSTV0910_P1_MODCOD_NSTOCK 0xf4bf0001 + +/* P1_GAUSSR0 */ +#define RSTV0910_P1_GAUSSR0 0xf4c0 +#define FSTV0910_P1_EN_CCIMODE 0xf4c07080 +#define FSTV0910_P1_R0_GAUSSIEN 0xf4c0007f + +/* P1_CCIR0 */ +#define RSTV0910_P1_CCIR0 0xf4c1 +#define FSTV0910_P1_CCIDETECT_PLHONLY 0xf4c17080 +#define FSTV0910_P1_R0_CCI 0xf4c1007f + +/* P1_CCIQUANT */ +#define RSTV0910_P1_CCIQUANT 0xf4c2 +#define FSTV0910_P1_CCI_BETA 0xf4c250e0 +#define FSTV0910_P1_CCI_QUANT 0xf4c2001f + +/* P1_CCITHRES */ +#define RSTV0910_P1_CCITHRES 0xf4c3 +#define FSTV0910_P1_CCI_THRESHOLD 0xf4c300ff + +/* P1_CCIACC */ +#define RSTV0910_P1_CCIACC 0xf4c4 +#define FSTV0910_P1_CCI_VALUE 0xf4c400ff + +/* P1_DSTATUS4 */ +#define RSTV0910_P1_DSTATUS4 0xf4c5 +#define FSTV0910_P1_RAINFADE_DETECT 0xf4c57080 +#define FSTV0910_P1_NOTHRES2_FAIL 0xf4c56040 +#define FSTV0910_P1_NOTHRES1_FAIL 0xf4c55020 +#define FSTV0910_P1_DMDPROG_ERROR 0xf4c52004 +#define FSTV0910_P1_CSTENV_DETECT 0xf4c51002 +#define FSTV0910_P1_DETECTION_TRIAX 0xf4c50001 + +/* P1_DMDRESCFG */ +#define RSTV0910_P1_DMDRESCFG 0xf4c6 +#define FSTV0910_P1_DMDRES_RESET 0xf4c67080 +#define FSTV0910_P1_DMDRES_STRALL 0xf4c63008 +#define FSTV0910_P1_DMDRES_NEWONLY 0xf4c62004 +#define FSTV0910_P1_DMDRES_NOSTORE 0xf4c61002 + +/* P1_DMDRESADR */ +#define RSTV0910_P1_DMDRESADR 0xf4c7 +#define FSTV0910_P1_DMDRES_VALIDCFR 0xf4c76040 +#define FSTV0910_P1_DMDRES_MEMFULL 0xf4c74030 +#define FSTV0910_P1_DMDRES_RESNBR 0xf4c7000f + +/* P1_DMDRESDATA7 */ +#define RSTV0910_P1_DMDRESDATA7 0xf4c8 +#define FSTV0910_P1_DMDRES_DATA7 0xf4c800ff + +/* P1_DMDRESDATA6 */ +#define RSTV0910_P1_DMDRESDATA6 0xf4c9 +#define FSTV0910_P1_DMDRES_DATA6 0xf4c900ff + +/* P1_DMDRESDATA5 */ +#define RSTV0910_P1_DMDRESDATA5 0xf4ca +#define FSTV0910_P1_DMDRES_DATA5 0xf4ca00ff + +/* P1_DMDRESDATA4 */ +#define RSTV0910_P1_DMDRESDATA4 0xf4cb +#define FSTV0910_P1_DMDRES_DATA4 0xf4cb00ff + +/* P1_DMDRESDATA3 */ +#define RSTV0910_P1_DMDRESDATA3 0xf4cc +#define FSTV0910_P1_DMDRES_DATA3 0xf4cc00ff + +/* P1_DMDRESDATA2 */ +#define RSTV0910_P1_DMDRESDATA2 0xf4cd +#define FSTV0910_P1_DMDRES_DATA2 0xf4cd00ff + +/* P1_DMDRESDATA1 */ +#define RSTV0910_P1_DMDRESDATA1 0xf4ce +#define FSTV0910_P1_DMDRES_DATA1 0xf4ce00ff + +/* P1_DMDRESDATA0 */ +#define RSTV0910_P1_DMDRESDATA0 0xf4cf +#define FSTV0910_P1_DMDRES_DATA0 0xf4cf00ff + +/* P1_FFEI1 */ +#define RSTV0910_P1_FFEI1 0xf4d0 +#define FSTV0910_P1_FFE_ACCI1 0xf4d001ff + +/* P1_FFEQ1 */ +#define RSTV0910_P1_FFEQ1 0xf4d1 +#define FSTV0910_P1_FFE_ACCQ1 0xf4d101ff + +/* P1_FFEI2 */ +#define RSTV0910_P1_FFEI2 0xf4d2 +#define FSTV0910_P1_FFE_ACCI2 0xf4d201ff + +/* P1_FFEQ2 */ +#define RSTV0910_P1_FFEQ2 0xf4d3 +#define FSTV0910_P1_FFE_ACCQ2 0xf4d301ff + +/* P1_FFEI3 */ +#define RSTV0910_P1_FFEI3 0xf4d4 +#define FSTV0910_P1_FFE_ACCI3 0xf4d401ff + +/* P1_FFEQ3 */ +#define RSTV0910_P1_FFEQ3 0xf4d5 +#define FSTV0910_P1_FFE_ACCQ3 0xf4d501ff + +/* P1_FFEI4 */ +#define RSTV0910_P1_FFEI4 0xf4d6 +#define FSTV0910_P1_FFE_ACCI4 0xf4d601ff + +/* P1_FFEQ4 */ +#define RSTV0910_P1_FFEQ4 0xf4d7 +#define FSTV0910_P1_FFE_ACCQ4 0xf4d701ff + +/* P1_FFECFG */ +#define RSTV0910_P1_FFECFG 0xf4d8 +#define FSTV0910_P1_EQUALFFE_ON 0xf4d86040 +#define FSTV0910_P1_EQUAL_USEDSYMB 0xf4d84030 +#define FSTV0910_P1_MU_EQUALFFE 0xf4d80007 + +/* P1_TNRCFG2 */ +#define RSTV0910_P1_TNRCFG2 0xf4e1 +#define FSTV0910_P1_TUN_IQSWAP 0xf4e17080 + +/* P1_SMAPCOEF7 */ +#define RSTV0910_P1_SMAPCOEF7 0xf500 +#define FSTV0910_P1_DIS_QSCALE 0xf5007080 +#define FSTV0910_P1_SMAPCOEF_Q_LLR12 0xf500017f + +/* P1_SMAPCOEF6 */ +#define RSTV0910_P1_SMAPCOEF6 0xf501 +#define FSTV0910_P1_DIS_AGC2SCALE 0xf5017080 +#define FSTV0910_P1_ADJ_8PSKLLR1 0xf5012004 +#define FSTV0910_P1_OLD_8PSKLLR1 0xf5011002 +#define FSTV0910_P1_DIS_AB8PSK 0xf5010001 + +/* P1_SMAPCOEF5 */ +#define RSTV0910_P1_SMAPCOEF5 0xf502 +#define FSTV0910_P1_DIS_8SCALE 0xf5027080 +#define FSTV0910_P1_SMAPCOEF_8P_LLR23 0xf502017f + +/* P1_SMAPCOEF4 */ +#define RSTV0910_P1_SMAPCOEF4 0xf503 +#define FSTV0910_P1_SMAPCOEF_16APSK_LLR12 0xf503017f + +/* P1_SMAPCOEF3 */ +#define RSTV0910_P1_SMAPCOEF3 0xf504 +#define FSTV0910_P1_SMAPCOEF_16APSK_LLR34 0xf504017f + +/* P1_SMAPCOEF2 */ +#define RSTV0910_P1_SMAPCOEF2 0xf505 +#define FSTV0910_P1_SMAPCOEF_32APSK_R2R3 0xf50541f0 +#define FSTV0910_P1_SMAPCOEF_32APSK_LLR2 0xf505010f + +/* P1_SMAPCOEF1 */ +#define RSTV0910_P1_SMAPCOEF1 0xf506 +#define FSTV0910_P1_DIS_16SCALE 0xf5067080 +#define FSTV0910_P1_SMAPCOEF_32_LLR34 0xf506017f + +/* P1_SMAPCOEF0 */ +#define RSTV0910_P1_SMAPCOEF0 0xf507 +#define FSTV0910_P1_DIS_32SCALE 0xf5077080 +#define FSTV0910_P1_SMAPCOEF_32_LLR15 0xf507017f + +/* P1_NOSTHRES1 */ +#define RSTV0910_P1_NOSTHRES1 0xf509 +#define FSTV0910_P1_NOS_THRESHOLD1 0xf50900ff + +/* P1_NOSTHRES2 */ +#define RSTV0910_P1_NOSTHRES2 0xf50a +#define FSTV0910_P1_NOS_THRESHOLD2 0xf50a00ff + +/* P1_NOSDIFF1 */ +#define RSTV0910_P1_NOSDIFF1 0xf50b +#define FSTV0910_P1_NOSTHRES1_DIFF 0xf50b00ff + +/* P1_RAINFADE */ +#define RSTV0910_P1_RAINFADE 0xf50c +#define FSTV0910_P1_NOSTHRES_DATAT 0xf50c7080 +#define FSTV0910_P1_RAINFADE_CNLIMIT 0xf50c4070 +#define FSTV0910_P1_RAINFADE_TIMEOUT 0xf50c0007 + +/* P1_NOSRAMCFG */ +#define RSTV0910_P1_NOSRAMCFG 0xf50d +#define FSTV0910_P1_NOSRAM_ACTIVATION 0xf50d4030 +#define FSTV0910_P1_NOSRAM_CNRONLY 0xf50d3008 +#define FSTV0910_P1_NOSRAM_LGNCNR1 0xf50d0007 + +/* P1_NOSRAMPOS */ +#define RSTV0910_P1_NOSRAMPOS 0xf50e +#define FSTV0910_P1_NOSRAM_LGNCNR0 0xf50e40f0 +#define FSTV0910_P1_NOSRAM_VALIDE 0xf50e2004 +#define FSTV0910_P1_NOSRAM_CNRVAL1 0xf50e0003 + +/* P1_NOSRAMVAL */ +#define RSTV0910_P1_NOSRAMVAL 0xf50f +#define FSTV0910_P1_NOSRAM_CNRVAL0 0xf50f00ff + +/* P1_DMDPLHSTAT */ +#define RSTV0910_P1_DMDPLHSTAT 0xf520 +#define FSTV0910_P1_PLH_STATISTIC 0xf52000ff + +/* P1_LOCKTIME3 */ +#define RSTV0910_P1_LOCKTIME3 0xf522 +#define FSTV0910_P1_DEMOD_LOCKTIME3 0xf52200ff + +/* P1_LOCKTIME2 */ +#define RSTV0910_P1_LOCKTIME2 0xf523 +#define FSTV0910_P1_DEMOD_LOCKTIME2 0xf52300ff + +/* P1_LOCKTIME1 */ +#define RSTV0910_P1_LOCKTIME1 0xf524 +#define FSTV0910_P1_DEMOD_LOCKTIME1 0xf52400ff + +/* P1_LOCKTIME0 */ +#define RSTV0910_P1_LOCKTIME0 0xf525 +#define FSTV0910_P1_DEMOD_LOCKTIME0 0xf52500ff + +/* P1_VITSCALE */ +#define RSTV0910_P1_VITSCALE 0xf532 +#define FSTV0910_P1_NVTH_NOSRANGE 0xf5327080 +#define FSTV0910_P1_VERROR_MAXMODE 0xf5326040 +#define FSTV0910_P1_NSLOWSN_LOCKED 0xf5323008 +#define FSTV0910_P1_DIS_RSFLOCK 0xf5321002 + +/* P1_FECM */ +#define RSTV0910_P1_FECM 0xf533 +#define FSTV0910_P1_DSS_DVB 0xf5337080 +#define FSTV0910_P1_DSS_SRCH 0xf5334010 +#define FSTV0910_P1_SYNCVIT 0xf5331002 +#define FSTV0910_P1_IQINV 0xf5330001 + +/* P1_VTH12 */ +#define RSTV0910_P1_VTH12 0xf534 +#define FSTV0910_P1_VTH12 0xf53400ff + +/* P1_VTH23 */ +#define RSTV0910_P1_VTH23 0xf535 +#define FSTV0910_P1_VTH23 0xf53500ff + +/* P1_VTH34 */ +#define RSTV0910_P1_VTH34 0xf536 +#define FSTV0910_P1_VTH34 0xf53600ff + +/* P1_VTH56 */ +#define RSTV0910_P1_VTH56 0xf537 +#define FSTV0910_P1_VTH56 0xf53700ff + +/* P1_VTH67 */ +#define RSTV0910_P1_VTH67 0xf538 +#define FSTV0910_P1_VTH67 0xf53800ff + +/* P1_VTH78 */ +#define RSTV0910_P1_VTH78 0xf539 +#define FSTV0910_P1_VTH78 0xf53900ff + +/* P1_VITCURPUN */ +#define RSTV0910_P1_VITCURPUN 0xf53a +#define FSTV0910_P1_VIT_CURPUN 0xf53a001f + +/* P1_VERROR */ +#define RSTV0910_P1_VERROR 0xf53b +#define FSTV0910_P1_REGERR_VIT 0xf53b00ff + +/* P1_PRVIT */ +#define RSTV0910_P1_PRVIT 0xf53c +#define FSTV0910_P1_DIS_VTHLOCK 0xf53c6040 +#define FSTV0910_P1_E7_8VIT 0xf53c5020 +#define FSTV0910_P1_E6_7VIT 0xf53c4010 +#define FSTV0910_P1_E5_6VIT 0xf53c3008 +#define FSTV0910_P1_E3_4VIT 0xf53c2004 +#define FSTV0910_P1_E2_3VIT 0xf53c1002 +#define FSTV0910_P1_E1_2VIT 0xf53c0001 + +/* P1_VAVSRVIT */ +#define RSTV0910_P1_VAVSRVIT 0xf53d +#define FSTV0910_P1_AMVIT 0xf53d7080 +#define FSTV0910_P1_FROZENVIT 0xf53d6040 +#define FSTV0910_P1_SNVIT 0xf53d4030 +#define FSTV0910_P1_TOVVIT 0xf53d200c +#define FSTV0910_P1_HYPVIT 0xf53d0003 + +/* P1_VSTATUSVIT */ +#define RSTV0910_P1_VSTATUSVIT 0xf53e +#define FSTV0910_P1_PRFVIT 0xf53e4010 +#define FSTV0910_P1_LOCKEDVIT 0xf53e3008 + +/* P1_VTHINUSE */ +#define RSTV0910_P1_VTHINUSE 0xf53f +#define FSTV0910_P1_VIT_INUSE 0xf53f00ff + +/* P1_KDIV12 */ +#define RSTV0910_P1_KDIV12 0xf540 +#define FSTV0910_P1_K_DIVIDER_12 0xf540007f + +/* P1_KDIV23 */ +#define RSTV0910_P1_KDIV23 0xf541 +#define FSTV0910_P1_K_DIVIDER_23 0xf541007f + +/* P1_KDIV34 */ +#define RSTV0910_P1_KDIV34 0xf542 +#define FSTV0910_P1_K_DIVIDER_34 0xf542007f + +/* P1_KDIV56 */ +#define RSTV0910_P1_KDIV56 0xf543 +#define FSTV0910_P1_K_DIVIDER_56 0xf543007f + +/* P1_KDIV67 */ +#define RSTV0910_P1_KDIV67 0xf544 +#define FSTV0910_P1_K_DIVIDER_67 0xf544007f + +/* P1_KDIV78 */ +#define RSTV0910_P1_KDIV78 0xf545 +#define FSTV0910_P1_K_DIVIDER_78 0xf545007f + +/* P1_TSPIDFLT1 */ +#define RSTV0910_P1_TSPIDFLT1 0xf546 +#define FSTV0910_P1_PIDFLT_ADDR 0xf54600ff + +/* P1_TSPIDFLT0 */ +#define RSTV0910_P1_TSPIDFLT0 0xf547 +#define FSTV0910_P1_PIDFLT_DATA 0xf54700ff + +/* P1_PDELCTRL0 */ +#define RSTV0910_P1_PDELCTRL0 0xf54f +#define FSTV0910_P1_ISIOBS_MODE 0xf54f4030 + +/* P1_PDELCTRL1 */ +#define RSTV0910_P1_PDELCTRL1 0xf550 +#define FSTV0910_P1_INV_MISMASK 0xf5507080 +#define FSTV0910_P1_FILTER_EN 0xf5505020 +#define FSTV0910_P1_HYSTEN 0xf5503008 +#define FSTV0910_P1_HYSTSWRST 0xf5502004 +#define FSTV0910_P1_EN_MIS00 0xf5501002 +#define FSTV0910_P1_ALGOSWRST 0xf5500001 + +/* P1_PDELCTRL2 */ +#define RSTV0910_P1_PDELCTRL2 0xf551 +#define FSTV0910_P1_FORCE_CONTINUOUS 0xf5517080 +#define FSTV0910_P1_RESET_UPKO_COUNT 0xf5516040 +#define FSTV0910_P1_USER_PKTDELIN_NB 0xf5515020 +#define FSTV0910_P1_FRAME_MODE 0xf5511002 + +/* P1_HYSTTHRESH */ +#define RSTV0910_P1_HYSTTHRESH 0xf554 +#define FSTV0910_P1_DELIN_LOCKTHRES 0xf55440f0 +#define FSTV0910_P1_DELIN_UNLOCKTHRES 0xf554000f + +/* P1_UPLCCST0 */ +#define RSTV0910_P1_UPLCCST0 0xf558 +#define FSTV0910_P1_UPL_CST0 0xf55830f8 +#define FSTV0910_P1_UPL_MODE 0xf5580007 + +/* P1_ISIENTRY */ +#define RSTV0910_P1_ISIENTRY 0xf55e +#define FSTV0910_P1_ISI_ENTRY 0xf55e00ff + +/* P1_ISIBITENA */ +#define RSTV0910_P1_ISIBITENA 0xf55f +#define FSTV0910_P1_ISI_BIT_EN 0xf55f00ff + +/* P1_MATSTR1 */ +#define RSTV0910_P1_MATSTR1 0xf560 +#define FSTV0910_P1_MATYPE_CURRENT1 0xf56000ff + +/* P1_MATSTR0 */ +#define RSTV0910_P1_MATSTR0 0xf561 +#define FSTV0910_P1_MATYPE_CURRENT0 0xf56100ff + +/* P1_UPLSTR1 */ +#define RSTV0910_P1_UPLSTR1 0xf562 +#define FSTV0910_P1_UPL_CURRENT1 0xf56200ff + +/* P1_UPLSTR0 */ +#define RSTV0910_P1_UPLSTR0 0xf563 +#define FSTV0910_P1_UPL_CURRENT0 0xf56300ff + +/* P1_DFLSTR1 */ +#define RSTV0910_P1_DFLSTR1 0xf564 +#define FSTV0910_P1_DFL_CURRENT1 0xf56400ff + +/* P1_DFLSTR0 */ +#define RSTV0910_P1_DFLSTR0 0xf565 +#define FSTV0910_P1_DFL_CURRENT0 0xf56500ff + +/* P1_SYNCSTR */ +#define RSTV0910_P1_SYNCSTR 0xf566 +#define FSTV0910_P1_SYNC_CURRENT 0xf56600ff + +/* P1_SYNCDSTR1 */ +#define RSTV0910_P1_SYNCDSTR1 0xf567 +#define FSTV0910_P1_SYNCD_CURRENT1 0xf56700ff + +/* P1_SYNCDSTR0 */ +#define RSTV0910_P1_SYNCDSTR0 0xf568 +#define FSTV0910_P1_SYNCD_CURRENT0 0xf56800ff + +/* P1_PDELSTATUS1 */ +#define RSTV0910_P1_PDELSTATUS1 0xf569 +#define FSTV0910_P1_PKTDELIN_DELOCK 0xf5697080 +#define FSTV0910_P1_SYNCDUPDFL_BADDFL 0xf5696040 +#define FSTV0910_P1_UNACCEPTED_STREAM 0xf5694010 +#define FSTV0910_P1_BCH_ERROR_FLAG 0xf5693008 +#define FSTV0910_P1_PKTDELIN_LOCK 0xf5691002 +#define FSTV0910_P1_FIRST_LOCK 0xf5690001 + +/* P1_PDELSTATUS2 */ +#define RSTV0910_P1_PDELSTATUS2 0xf56a +#define FSTV0910_P1_FRAME_MODCOD 0xf56a207c +#define FSTV0910_P1_FRAME_TYPE 0xf56a0003 + +/* P1_BBFCRCKO1 */ +#define RSTV0910_P1_BBFCRCKO1 0xf56b +#define FSTV0910_P1_BBHCRC_KOCNT1 0xf56b00ff + +/* P1_BBFCRCKO0 */ +#define RSTV0910_P1_BBFCRCKO0 0xf56c +#define FSTV0910_P1_BBHCRC_KOCNT0 0xf56c00ff + +/* P1_UPCRCKO1 */ +#define RSTV0910_P1_UPCRCKO1 0xf56d +#define FSTV0910_P1_PKTCRC_KOCNT1 0xf56d00ff + +/* P1_UPCRCKO0 */ +#define RSTV0910_P1_UPCRCKO0 0xf56e +#define FSTV0910_P1_PKTCRC_KOCNT0 0xf56e00ff + +/* P1_PDELCTRL3 */ +#define RSTV0910_P1_PDELCTRL3 0xf56f +#define FSTV0910_P1_NOFIFO_BCHERR 0xf56f5020 +#define FSTV0910_P1_PKTDELIN_DELACMERR 0xf56f4010 + +/* P1_TSSTATEM */ +#define RSTV0910_P1_TSSTATEM 0xf570 +#define FSTV0910_P1_TSDIL_ON 0xf5707080 +#define FSTV0910_P1_TSRS_ON 0xf5705020 +#define FSTV0910_P1_TSDESCRAMB_ON 0xf5704010 +#define FSTV0910_P1_TSFRAME_MODE 0xf5703008 +#define FSTV0910_P1_TS_DISABLE 0xf5702004 +#define FSTV0910_P1_TSACM_MODE 0xf5701002 +#define FSTV0910_P1_TSOUT_NOSYNC 0xf5700001 + +/* P1_TSSTATEL */ +#define RSTV0910_P1_TSSTATEL 0xf571 +#define FSTV0910_P1_TSNOSYNCBYTE 0xf5717080 +#define FSTV0910_P1_TSPARITY_ON 0xf5716040 +#define FSTV0910_P1_TSISSYI_ON 0xf5713008 +#define FSTV0910_P1_TSNPD_ON 0xf5712004 +#define FSTV0910_P1_TSCRC8_ON 0xf5711002 +#define FSTV0910_P1_TSDSS_PACKET 0xf5710001 + +/* P1_TSCFGH */ +#define RSTV0910_P1_TSCFGH 0xf572 +#define FSTV0910_P1_TSFIFO_DVBCI 0xf5727080 +#define FSTV0910_P1_TSFIFO_SERIAL 0xf5726040 +#define FSTV0910_P1_TSFIFO_TEIUPDATE 0xf5725020 +#define FSTV0910_P1_TSFIFO_DUTY50 0xf5724010 +#define FSTV0910_P1_TSFIFO_HSGNLOUT 0xf5723008 +#define FSTV0910_P1_TSFIFO_ERRMODE 0xf5721006 +#define FSTV0910_P1_RST_HWARE 0xf5720001 + +/* P1_TSCFGM */ +#define RSTV0910_P1_TSCFGM 0xf573 +#define FSTV0910_P1_TSFIFO_MANSPEED 0xf57360c0 +#define FSTV0910_P1_TSFIFO_PERMDATA 0xf5735020 +#define FSTV0910_P1_TSFIFO_NONEWSGNL 0xf5734010 +#define FSTV0910_P1_TSFIFO_INVDATA 0xf5730001 + +/* P1_TSCFGL */ +#define RSTV0910_P1_TSCFGL 0xf574 +#define FSTV0910_P1_TSFIFO_BCLKDEL1CK 0xf57460c0 +#define FSTV0910_P1_BCHERROR_MODE 0xf5744030 +#define FSTV0910_P1_TSFIFO_NSGNL2DATA 0xf5743008 +#define FSTV0910_P1_TSFIFO_EMBINDVB 0xf5742004 +#define FSTV0910_P1_TSFIFO_BITSPEED 0xf5740003 + +/* P1_TSSYNC */ +#define RSTV0910_P1_TSSYNC 0xf575 +#define FSTV0910_P1_TSFIFO_SYNCMODE 0xf5753018 + +/* P1_TSINSDELH */ +#define RSTV0910_P1_TSINSDELH 0xf576 +#define FSTV0910_P1_TSDEL_SYNCBYTE 0xf5767080 +#define FSTV0910_P1_TSDEL_XXHEADER 0xf5766040 +#define FSTV0910_P1_TSDEL_DATAFIELD 0xf5764010 +#define FSTV0910_P1_TSINSDEL_RSPARITY 0xf5761002 +#define FSTV0910_P1_TSINSDEL_CRC8 0xf5760001 + +/* P1_TSINSDELM */ +#define RSTV0910_P1_TSINSDELM 0xf577 +#define FSTV0910_P1_TSINS_EMODCOD 0xf5774010 +#define FSTV0910_P1_TSINS_TOKEN 0xf5773008 +#define FSTV0910_P1_TSINS_XXXERR 0xf5772004 +#define FSTV0910_P1_TSINS_MATYPE 0xf5771002 +#define FSTV0910_P1_TSINS_UPL 0xf5770001 + +/* P1_TSINSDELL */ +#define RSTV0910_P1_TSINSDELL 0xf578 +#define FSTV0910_P1_TSINS_DFL 0xf5787080 +#define FSTV0910_P1_TSINS_SYNCD 0xf5786040 +#define FSTV0910_P1_TSINS_BLOCLEN 0xf5785020 +#define FSTV0910_P1_TSINS_SIGPCOUNT 0xf5784010 +#define FSTV0910_P1_TSINS_FIFO 0xf5783008 +#define FSTV0910_P1_TSINS_REALPACK 0xf5782004 +#define FSTV0910_P1_TSINS_TSCONFIG 0xf5781002 +#define FSTV0910_P1_TSINS_LATENCY 0xf5780001 + +/* P1_TSDIVN */ +#define RSTV0910_P1_TSDIVN 0xf579 +#define FSTV0910_P1_TSFIFO_SPEEDMODE 0xf57960c0 +#define FSTV0910_P1_TSFIFO_RISEOK 0xf5790007 + +/* P1_TSCFG4 */ +#define RSTV0910_P1_TSCFG4 0xf57a +#define FSTV0910_P1_TSFIFO_TSSPEEDMODE 0xf57a60c0 + +/* P1_TSSPEED */ +#define RSTV0910_P1_TSSPEED 0xf580 +#define FSTV0910_P1_TSFIFO_OUTSPEED 0xf58000ff + +/* P1_TSSTATUS */ +#define RSTV0910_P1_TSSTATUS 0xf581 +#define FSTV0910_P1_TSFIFO_LINEOK 0xf5817080 +#define FSTV0910_P1_TSFIFO_ERROR 0xf5816040 +#define FSTV0910_P1_TSFIFO_NOSYNC 0xf5814010 +#define FSTV0910_P1_TSREGUL_ERROR 0xf5812004 +#define FSTV0910_P1_DIL_READY 0xf5810001 + +/* P1_TSSTATUS2 */ +#define RSTV0910_P1_TSSTATUS2 0xf582 +#define FSTV0910_P1_TSFIFO_DEMODSEL 0xf5827080 +#define FSTV0910_P1_TSFIFOSPEED_STORE 0xf5826040 +#define FSTV0910_P1_DILXX_RESET 0xf5825020 +#define FSTV0910_P1_SCRAMBDETECT 0xf5821002 + +/* P1_TSBITRATE1 */ +#define RSTV0910_P1_TSBITRATE1 0xf583 +#define FSTV0910_P1_TSFIFO_BITRATE1 0xf58300ff + +/* P1_TSBITRATE0 */ +#define RSTV0910_P1_TSBITRATE0 0xf584 +#define FSTV0910_P1_TSFIFO_BITRATE0 0xf58400ff + +/* P1_TSPACKLEN1 */ +#define RSTV0910_P1_TSPACKLEN1 0xf585 +#define FSTV0910_P1_TSFIFO_PACKCPT 0xf58550e0 + +/* P1_TSDLY2 */ +#define RSTV0910_P1_TSDLY2 0xf589 +#define FSTV0910_P1_SOFFIFO_LATENCY2 0xf589000f + +/* P1_TSDLY1 */ +#define RSTV0910_P1_TSDLY1 0xf58a +#define FSTV0910_P1_SOFFIFO_LATENCY1 0xf58a00ff + +/* P1_TSDLY0 */ +#define RSTV0910_P1_TSDLY0 0xf58b +#define FSTV0910_P1_SOFFIFO_LATENCY0 0xf58b00ff + +/* P1_TSNPDAV */ +#define RSTV0910_P1_TSNPDAV 0xf58c +#define FSTV0910_P1_TSNPD_AVERAGE 0xf58c00ff + +/* P1_TSBUFSTAT2 */ +#define RSTV0910_P1_TSBUFSTAT2 0xf58d +#define FSTV0910_P1_TSISCR_3BYTES 0xf58d7080 +#define FSTV0910_P1_TSISCR_NEWDATA 0xf58d6040 +#define FSTV0910_P1_TSISCR_BUFSTAT2 0xf58d003f + +/* P1_TSBUFSTAT1 */ +#define RSTV0910_P1_TSBUFSTAT1 0xf58e +#define FSTV0910_P1_TSISCR_BUFSTAT1 0xf58e00ff + +/* P1_TSBUFSTAT0 */ +#define RSTV0910_P1_TSBUFSTAT0 0xf58f +#define FSTV0910_P1_TSISCR_BUFSTAT0 0xf58f00ff + +/* P1_TSDEBUGL */ +#define RSTV0910_P1_TSDEBUGL 0xf591 +#define FSTV0910_P1_TSFIFO_ERROR_EVNT 0xf5912004 +#define FSTV0910_P1_TSFIFO_OVERFLOWM 0xf5910001 + +/* P1_TSDLYSET2 */ +#define RSTV0910_P1_TSDLYSET2 0xf592 +#define FSTV0910_P1_SOFFIFO_OFFSET 0xf59260c0 +#define FSTV0910_P1_HYSTERESIS_THRESHOLD 0xf5924030 +#define FSTV0910_P1_SOFFIFO_SYMBOFFS2 0xf592000f + +/* P1_TSDLYSET1 */ +#define RSTV0910_P1_TSDLYSET1 0xf593 +#define FSTV0910_P1_SOFFIFO_SYMBOFFS1 0xf59300ff + +/* P1_TSDLYSET0 */ +#define RSTV0910_P1_TSDLYSET0 0xf594 +#define FSTV0910_P1_SOFFIFO_SYMBOFFS0 0xf59400ff + +/* P1_ERRCTRL1 */ +#define RSTV0910_P1_ERRCTRL1 0xf598 +#define FSTV0910_P1_ERR_SOURCE1 0xf59840f0 +#define FSTV0910_P1_NUM_EVENT1 0xf5980007 + +/* P1_ERRCNT12 */ +#define RSTV0910_P1_ERRCNT12 0xf599 +#define FSTV0910_P1_ERRCNT1_OLDVALUE 0xf5997080 +#define FSTV0910_P1_ERR_CNT12 0xf599007f + +/* P1_ERRCNT11 */ +#define RSTV0910_P1_ERRCNT11 0xf59a +#define FSTV0910_P1_ERR_CNT11 0xf59a00ff + +/* P1_ERRCNT10 */ +#define RSTV0910_P1_ERRCNT10 0xf59b +#define FSTV0910_P1_ERR_CNT10 0xf59b00ff + +/* P1_ERRCTRL2 */ +#define RSTV0910_P1_ERRCTRL2 0xf59c +#define FSTV0910_P1_ERR_SOURCE2 0xf59c40f0 +#define FSTV0910_P1_NUM_EVENT2 0xf59c0007 + +/* P1_ERRCNT22 */ +#define RSTV0910_P1_ERRCNT22 0xf59d +#define FSTV0910_P1_ERRCNT2_OLDVALUE 0xf59d7080 +#define FSTV0910_P1_ERR_CNT22 0xf59d007f + +/* P1_ERRCNT21 */ +#define RSTV0910_P1_ERRCNT21 0xf59e +#define FSTV0910_P1_ERR_CNT21 0xf59e00ff + +/* P1_ERRCNT20 */ +#define RSTV0910_P1_ERRCNT20 0xf59f +#define FSTV0910_P1_ERR_CNT20 0xf59f00ff + +/* P1_FECSPY */ +#define RSTV0910_P1_FECSPY 0xf5a0 +#define FSTV0910_P1_SPY_ENABLE 0xf5a07080 +#define FSTV0910_P1_NO_SYNCBYTE 0xf5a06040 +#define FSTV0910_P1_SERIAL_MODE 0xf5a05020 +#define FSTV0910_P1_UNUSUAL_PACKET 0xf5a04010 +#define FSTV0910_P1_BERMETER_DATAMODE 0xf5a0200c +#define FSTV0910_P1_BERMETER_LMODE 0xf5a01002 +#define FSTV0910_P1_BERMETER_RESET 0xf5a00001 + +/* P1_FSPYCFG */ +#define RSTV0910_P1_FSPYCFG 0xf5a1 +#define FSTV0910_P1_FECSPY_INPUT 0xf5a160c0 +#define FSTV0910_P1_RST_ON_ERROR 0xf5a15020 +#define FSTV0910_P1_ONE_SHOT 0xf5a14010 +#define FSTV0910_P1_I2C_MODE 0xf5a1200c +#define FSTV0910_P1_SPY_HYSTERESIS 0xf5a10003 + +/* P1_FSPYDATA */ +#define RSTV0910_P1_FSPYDATA 0xf5a2 +#define FSTV0910_P1_SPY_STUFFING 0xf5a27080 +#define FSTV0910_P1_SPY_CNULLPKT 0xf5a25020 +#define FSTV0910_P1_SPY_OUTDATA_MODE 0xf5a2001f + +/* P1_FSPYOUT */ +#define RSTV0910_P1_FSPYOUT 0xf5a3 +#define FSTV0910_P1_FSPY_DIRECT 0xf5a37080 +#define FSTV0910_P1_STUFF_MODE 0xf5a30007 + +/* P1_FSTATUS */ +#define RSTV0910_P1_FSTATUS 0xf5a4 +#define FSTV0910_P1_SPY_ENDSIM 0xf5a47080 +#define FSTV0910_P1_VALID_SIM 0xf5a46040 +#define FSTV0910_P1_FOUND_SIGNAL 0xf5a45020 +#define FSTV0910_P1_DSS_SYNCBYTE 0xf5a44010 +#define FSTV0910_P1_RESULT_STATE 0xf5a4000f + +/* P1_FBERCPT4 */ +#define RSTV0910_P1_FBERCPT4 0xf5a8 +#define FSTV0910_P1_FBERMETER_CPT4 0xf5a800ff + +/* P1_FBERCPT3 */ +#define RSTV0910_P1_FBERCPT3 0xf5a9 +#define FSTV0910_P1_FBERMETER_CPT3 0xf5a900ff + +/* P1_FBERCPT2 */ +#define RSTV0910_P1_FBERCPT2 0xf5aa +#define FSTV0910_P1_FBERMETER_CPT2 0xf5aa00ff + +/* P1_FBERCPT1 */ +#define RSTV0910_P1_FBERCPT1 0xf5ab +#define FSTV0910_P1_FBERMETER_CPT1 0xf5ab00ff + +/* P1_FBERCPT0 */ +#define RSTV0910_P1_FBERCPT0 0xf5ac +#define FSTV0910_P1_FBERMETER_CPT0 0xf5ac00ff + +/* P1_FBERERR2 */ +#define RSTV0910_P1_FBERERR2 0xf5ad +#define FSTV0910_P1_FBERMETER_ERR2 0xf5ad00ff + +/* P1_FBERERR1 */ +#define RSTV0910_P1_FBERERR1 0xf5ae +#define FSTV0910_P1_FBERMETER_ERR1 0xf5ae00ff + +/* P1_FBERERR0 */ +#define RSTV0910_P1_FBERERR0 0xf5af +#define FSTV0910_P1_FBERMETER_ERR0 0xf5af00ff + +/* P1_FSPYBER */ +#define RSTV0910_P1_FSPYBER 0xf5b2 +#define FSTV0910_P1_FSPYBER_SYNCBYTE 0xf5b24010 +#define FSTV0910_P1_FSPYBER_UNSYNC 0xf5b23008 +#define FSTV0910_P1_FSPYBER_CTIME 0xf5b20007 + +/* P1_SFERROR */ +#define RSTV0910_P1_SFERROR 0xf5c1 +#define FSTV0910_P1_SFEC_REGERR_VIT 0xf5c100ff + +/* P1_SFECSTATUS */ +#define RSTV0910_P1_SFECSTATUS 0xf5c3 +#define FSTV0910_P1_SFEC_ON 0xf5c37080 +#define FSTV0910_P1_SFEC_OFF 0xf5c36040 +#define FSTV0910_P1_LOCKEDSFEC 0xf5c33008 +#define FSTV0910_P1_SFEC_DELOCK 0xf5c32004 +#define FSTV0910_P1_SFEC_DEMODSEL 0xf5c31002 +#define FSTV0910_P1_SFEC_OVFON 0xf5c30001 + +/* P1_SFKDIV12 */ +#define RSTV0910_P1_SFKDIV12 0xf5c4 +#define FSTV0910_P1_SFECKDIV12_MAN 0xf5c47080 + +/* P1_SFKDIV23 */ +#define RSTV0910_P1_SFKDIV23 0xf5c5 +#define FSTV0910_P1_SFECKDIV23_MAN 0xf5c57080 + +/* P1_SFKDIV34 */ +#define RSTV0910_P1_SFKDIV34 0xf5c6 +#define FSTV0910_P1_SFECKDIV34_MAN 0xf5c67080 + +/* P1_SFKDIV56 */ +#define RSTV0910_P1_SFKDIV56 0xf5c7 +#define FSTV0910_P1_SFECKDIV56_MAN 0xf5c77080 + +/* P1_SFKDIV67 */ +#define RSTV0910_P1_SFKDIV67 0xf5c8 +#define FSTV0910_P1_SFECKDIV67_MAN 0xf5c87080 + +/* P1_SFKDIV78 */ +#define RSTV0910_P1_SFKDIV78 0xf5c9 +#define FSTV0910_P1_SFECKDIV78_MAN 0xf5c97080 + +/* P1_SFSTATUS */ +#define RSTV0910_P1_SFSTATUS 0xf5cc +#define FSTV0910_P1_SFEC_LINEOK 0xf5cc7080 +#define FSTV0910_P1_SFEC_ERROR 0xf5cc6040 +#define FSTV0910_P1_SFEC_DATA7 0xf5cc5020 +#define FSTV0910_P1_SFEC_PKTDNBRFAIL 0xf5cc4010 +#define FSTV0910_P1_TSSFEC_DEMODSEL 0xf5cc3008 +#define FSTV0910_P1_SFEC_NOSYNC 0xf5cc2004 +#define FSTV0910_P1_SFEC_UNREGULA 0xf5cc1002 +#define FSTV0910_P1_SFEC_READY 0xf5cc0001 + +/* P1_SFDLYSET2 */ +#define RSTV0910_P1_SFDLYSET2 0xf5d0 +#define FSTV0910_P1_SFEC_DISABLE 0xf5d01002 + +/* P1_SFERRCTRL */ +#define RSTV0910_P1_SFERRCTRL 0xf5d8 +#define FSTV0910_P1_SFEC_ERR_SOURCE 0xf5d840f0 +#define FSTV0910_P1_SFEC_NUM_EVENT 0xf5d80007 + +/* P1_SFERRCNT2 */ +#define RSTV0910_P1_SFERRCNT2 0xf5d9 +#define FSTV0910_P1_SFERRC_OLDVALUE 0xf5d97080 +#define FSTV0910_P1_SFEC_ERR_CNT2 0xf5d9007f + +/* P1_SFERRCNT1 */ +#define RSTV0910_P1_SFERRCNT1 0xf5da +#define FSTV0910_P1_SFEC_ERR_CNT1 0xf5da00ff + +/* P1_SFERRCNT0 */ +#define RSTV0910_P1_SFERRCNT0 0xf5db +#define FSTV0910_P1_SFEC_ERR_CNT0 0xf5db00ff + +/* RCCFG2 */ +#define RSTV0910_RCCFG2 0xf600 +#define FSTV0910_TSRCFIFO_DVBCI 0xf6007080 +#define FSTV0910_TSRCFIFO_SERIAL 0xf6006040 +#define FSTV0910_TSRCFIFO_DISABLE 0xf6005020 +#define FSTV0910_TSFIFO_2TORC 0xf6004010 +#define FSTV0910_TSRCFIFO_HSGNLOUT 0xf6003008 +#define FSTV0910_TSRCFIFO_ERRMODE 0xf6001006 + +/* RCCFG1 */ +#define RSTV0910_RCCFG1 0xf601 +#define FSTV0910_TSRCFIFO_MANSPEED 0xf60160c0 +#define FSTV0910_TSRCFIFO_PERMDATA 0xf6015020 +#define FSTV0910_TSRCFIFO_NONEWSGNL 0xf6014010 +#define FSTV0910_TSRCFIFO_INVDATA 0xf6010001 + +/* RCCFG0 */ +#define RSTV0910_RCCFG0 0xf602 +#define FSTV0910_TSRCFIFO_BCLKDEL1CK 0xf60260c0 +#define FSTV0910_TSRCFIFO_DUTY50 0xf6024010 +#define FSTV0910_TSRCFIFO_NSGNL2DATA 0xf6023008 +#define FSTV0910_TSRCFIFO_NPDSGNL 0xf6022004 + +/* RCINSDEL2 */ +#define RSTV0910_RCINSDEL2 0xf603 +#define FSTV0910_TSRCDEL_SYNCBYTE 0xf6037080 +#define FSTV0910_TSRCDEL_XXHEADER 0xf6036040 +#define FSTV0910_TSRCDEL_BBHEADER 0xf6035020 +#define FSTV0910_TSRCDEL_DATAFIELD 0xf6034010 +#define FSTV0910_TSRCINSDEL_ISCR 0xf6033008 +#define FSTV0910_TSRCINSDEL_NPD 0xf6032004 +#define FSTV0910_TSRCINSDEL_RSPARITY 0xf6031002 +#define FSTV0910_TSRCINSDEL_CRC8 0xf6030001 + +/* RCINSDEL1 */ +#define RSTV0910_RCINSDEL1 0xf604 +#define FSTV0910_TSRCINS_BBPADDING 0xf6047080 +#define FSTV0910_TSRCINS_BCHFEC 0xf6046040 +#define FSTV0910_TSRCINS_EMODCOD 0xf6044010 +#define FSTV0910_TSRCINS_TOKEN 0xf6043008 +#define FSTV0910_TSRCINS_XXXERR 0xf6042004 +#define FSTV0910_TSRCINS_MATYPE 0xf6041002 +#define FSTV0910_TSRCINS_UPL 0xf6040001 + +/* RCINSDEL0 */ +#define RSTV0910_RCINSDEL0 0xf605 +#define FSTV0910_TSRCINS_DFL 0xf6057080 +#define FSTV0910_TSRCINS_SYNCD 0xf6056040 +#define FSTV0910_TSRCINS_BLOCLEN 0xf6055020 +#define FSTV0910_TSRCINS_SIGPCOUNT 0xf6054010 +#define FSTV0910_TSRCINS_FIFO 0xf6053008 +#define FSTV0910_TSRCINS_REALPACK 0xf6052004 +#define FSTV0910_TSRCINS_TSCONFIG 0xf6051002 +#define FSTV0910_TSRCINS_LATENCY 0xf6050001 + +/* RCSTATUS */ +#define RSTV0910_RCSTATUS 0xf606 +#define FSTV0910_TSRCFIFO_LINEOK 0xf6067080 +#define FSTV0910_TSRCFIFO_ERROR 0xf6066040 +#define FSTV0910_TSRCREGUL_ERROR 0xf6064010 +#define FSTV0910_TSRCFIFO_DEMODSEL 0xf6063008 +#define FSTV0910_TSRCFIFOSPEED_STORE 0xf6062004 +#define FSTV0910_TSRCSPEED_IMPOSSIBLE 0xf6060001 + +/* RCSPEED */ +#define RSTV0910_RCSPEED 0xf607 +#define FSTV0910_TSRCFIFO_OUTSPEED 0xf60700ff + +/* TSGENERAL */ +#define RSTV0910_TSGENERAL 0xf630 +#define FSTV0910_TSFIFO_DISTS2PAR 0xf6306040 +#define FSTV0910_MUXSTREAM_OUTMODE 0xf6303008 +#define FSTV0910_TSFIFO_PERMPARAL 0xf6301006 + +/* P1_DISIRQCFG */ +#define RSTV0910_P1_DISIRQCFG 0xf700 +#define FSTV0910_P1_ENRXEND 0xf7006040 +#define FSTV0910_P1_ENRXFIFO8B 0xf7005020 +#define FSTV0910_P1_ENTRFINISH 0xf7004010 +#define FSTV0910_P1_ENTIMEOUT 0xf7003008 +#define FSTV0910_P1_ENTXEND 0xf7002004 +#define FSTV0910_P1_ENTXFIFO64B 0xf7001002 +#define FSTV0910_P1_ENGAPBURST 0xf7000001 + +/* P1_DISIRQSTAT */ +#define RSTV0910_P1_DISIRQSTAT 0xf701 +#define FSTV0910_P1_IRQRXEND 0xf7016040 +#define FSTV0910_P1_IRQRXFIFO8B 0xf7015020 +#define FSTV0910_P1_IRQTRFINISH 0xf7014010 +#define FSTV0910_P1_IRQTIMEOUT 0xf7013008 +#define FSTV0910_P1_IRQTXEND 0xf7012004 +#define FSTV0910_P1_IRQTXFIFO64B 0xf7011002 +#define FSTV0910_P1_IRQGAPBURST 0xf7010001 + +/* P1_DISTXCFG */ +#define RSTV0910_P1_DISTXCFG 0xf702 +#define FSTV0910_P1_DISTX_RESET 0xf7027080 +#define FSTV0910_P1_TIM_OFF 0xf7026040 +#define FSTV0910_P1_TIM_CMD 0xf7024030 +#define FSTV0910_P1_ENVELOP 0xf7023008 +#define FSTV0910_P1_DIS_PRECHARGE 0xf7022004 +#define FSTV0910_P1_DISEQC_MODE 0xf7020003 + +/* P1_DISTXSTATUS */ +#define RSTV0910_P1_DISTXSTATUS 0xf703 +#define FSTV0910_P1_TX_FIFO_FULL 0xf7036040 +#define FSTV0910_P1_TX_IDLE 0xf7035020 +#define FSTV0910_P1_GAP_BURST 0xf7034010 +#define FSTV0910_P1_TX_FIFO64B 0xf7033008 +#define FSTV0910_P1_TX_END 0xf7032004 +#define FSTV0910_P1_TR_TIMEOUT 0xf7031002 +#define FSTV0910_P1_TR_FINISH 0xf7030001 + +/* P1_DISTXBYTES */ +#define RSTV0910_P1_DISTXBYTES 0xf704 +#define FSTV0910_P1_TXFIFO_BYTES 0xf70400ff + +/* P1_DISTXFIFO */ +#define RSTV0910_P1_DISTXFIFO 0xf705 +#define FSTV0910_P1_DISEQC_TX_FIFO 0xf70500ff + +/* P1_DISTXF22 */ +#define RSTV0910_P1_DISTXF22 0xf706 +#define FSTV0910_P1_F22TX 0xf70600ff + +/* P1_DISTIMEOCFG */ +#define RSTV0910_P1_DISTIMEOCFG 0xf708 +#define FSTV0910_P1_RXCHOICE 0xf7081006 +#define FSTV0910_P1_TIMEOUT_OFF 0xf7080001 + +/* P1_DISTIMEOUT */ +#define RSTV0910_P1_DISTIMEOUT 0xf709 +#define FSTV0910_P1_TIMEOUT_COUNT 0xf70900ff + +/* P1_DISRXCFG */ +#define RSTV0910_P1_DISRXCFG 0xf70a +#define FSTV0910_P1_DISRX_RESET 0xf70a7080 +#define FSTV0910_P1_EXTENVELOP 0xf70a6040 +#define FSTV0910_P1_PINSELECT 0xf70a3038 +#define FSTV0910_P1_IGNORE_SHORT22K 0xf70a2004 +#define FSTV0910_P1_SIGNED_RXIN 0xf70a1002 +#define FSTV0910_P1_DISRX_ON 0xf70a0001 + +/* P1_DISRXSTAT1 */ +#define RSTV0910_P1_DISRXSTAT1 0xf70b +#define FSTV0910_P1_RXEND 0xf70b7080 +#define FSTV0910_P1_RXACTIVE 0xf70b6040 +#define FSTV0910_P1_RXDETECT 0xf70b5020 +#define FSTV0910_P1_CONTTONE 0xf70b4010 +#define FSTV0910_P1_8BFIFOREADY 0xf70b3008 +#define FSTV0910_P1_FIFOEMPTY 0xf70b2004 + +/* P1_DISRXSTAT0 */ +#define RSTV0910_P1_DISRXSTAT0 0xf70c +#define FSTV0910_P1_RXFAIL 0xf70c7080 +#define FSTV0910_P1_FIFOPFAIL 0xf70c6040 +#define FSTV0910_P1_RXNONBYTE 0xf70c5020 +#define FSTV0910_P1_FIFOOVF 0xf70c4010 +#define FSTV0910_P1_SHORT22K 0xf70c3008 +#define FSTV0910_P1_RXMSGLOST 0xf70c2004 + +/* P1_DISRXBYTES */ +#define RSTV0910_P1_DISRXBYTES 0xf70d +#define FSTV0910_P1_RXFIFO_BYTES 0xf70d001f + +/* P1_DISRXPARITY1 */ +#define RSTV0910_P1_DISRXPARITY1 0xf70e +#define FSTV0910_P1_DISRX_PARITY1 0xf70e00ff + +/* P1_DISRXPARITY0 */ +#define RSTV0910_P1_DISRXPARITY0 0xf70f +#define FSTV0910_P1_DISRX_PARITY0 0xf70f00ff + +/* P1_DISRXFIFO */ +#define RSTV0910_P1_DISRXFIFO 0xf710 +#define FSTV0910_P1_DISEQC_RX_FIFO 0xf71000ff + +/* P1_DISRXDC1 */ +#define RSTV0910_P1_DISRXDC1 0xf711 +#define FSTV0910_P1_DC_VALUE1 0xf7110103 + +/* P1_DISRXDC0 */ +#define RSTV0910_P1_DISRXDC0 0xf712 +#define FSTV0910_P1_DC_VALUE0 0xf71200ff + +/* P1_DISRXF221 */ +#define RSTV0910_P1_DISRXF221 0xf714 +#define FSTV0910_P1_F22RX1 0xf714000f + +/* P1_DISRXF220 */ +#define RSTV0910_P1_DISRXF220 0xf715 +#define FSTV0910_P1_F22RX0 0xf71500ff + +/* P1_DISRXF100 */ +#define RSTV0910_P1_DISRXF100 0xf716 +#define FSTV0910_P1_F100RX 0xf71600ff + +/* P1_DISRXSHORT22K */ +#define RSTV0910_P1_DISRXSHORT22K 0xf71c +#define FSTV0910_P1_SHORT22K_LENGTH 0xf71c001f + +/* P1_ACRPRESC */ +#define RSTV0910_P1_ACRPRESC 0xf71e +#define FSTV0910_P1_ACR_PRESC 0xf71e0007 + +/* P1_ACRDIV */ +#define RSTV0910_P1_ACRDIV 0xf71f +#define FSTV0910_P1_ACR_DIV 0xf71f00ff + +/* P2_DISIRQCFG */ +#define RSTV0910_P2_DISIRQCFG 0xf740 +#define FSTV0910_P2_ENRXEND 0xf7406040 +#define FSTV0910_P2_ENRXFIFO8B 0xf7405020 +#define FSTV0910_P2_ENTRFINISH 0xf7404010 +#define FSTV0910_P2_ENTIMEOUT 0xf7403008 +#define FSTV0910_P2_ENTXEND 0xf7402004 +#define FSTV0910_P2_ENTXFIFO64B 0xf7401002 +#define FSTV0910_P2_ENGAPBURST 0xf7400001 + +/* P2_DISIRQSTAT */ +#define RSTV0910_P2_DISIRQSTAT 0xf741 +#define FSTV0910_P2_IRQRXEND 0xf7416040 +#define FSTV0910_P2_IRQRXFIFO8B 0xf7415020 +#define FSTV0910_P2_IRQTRFINISH 0xf7414010 +#define FSTV0910_P2_IRQTIMEOUT 0xf7413008 +#define FSTV0910_P2_IRQTXEND 0xf7412004 +#define FSTV0910_P2_IRQTXFIFO64B 0xf7411002 +#define FSTV0910_P2_IRQGAPBURST 0xf7410001 + +/* P2_DISTXCFG */ +#define RSTV0910_P2_DISTXCFG 0xf742 +#define FSTV0910_P2_DISTX_RESET 0xf7427080 +#define FSTV0910_P2_TIM_OFF 0xf7426040 +#define FSTV0910_P2_TIM_CMD 0xf7424030 +#define FSTV0910_P2_ENVELOP 0xf7423008 +#define FSTV0910_P2_DIS_PRECHARGE 0xf7422004 +#define FSTV0910_P2_DISEQC_MODE 0xf7420003 + +/* P2_DISTXSTATUS */ +#define RSTV0910_P2_DISTXSTATUS 0xf743 +#define FSTV0910_P2_TX_FIFO_FULL 0xf7436040 +#define FSTV0910_P2_TX_IDLE 0xf7435020 +#define FSTV0910_P2_GAP_BURST 0xf7434010 +#define FSTV0910_P2_TX_FIFO64B 0xf7433008 +#define FSTV0910_P2_TX_END 0xf7432004 +#define FSTV0910_P2_TR_TIMEOUT 0xf7431002 +#define FSTV0910_P2_TR_FINISH 0xf7430001 + +/* P2_DISTXBYTES */ +#define RSTV0910_P2_DISTXBYTES 0xf744 +#define FSTV0910_P2_TXFIFO_BYTES 0xf74400ff + +/* P2_DISTXFIFO */ +#define RSTV0910_P2_DISTXFIFO 0xf745 +#define FSTV0910_P2_DISEQC_TX_FIFO 0xf74500ff + +/* P2_DISTXF22 */ +#define RSTV0910_P2_DISTXF22 0xf746 +#define FSTV0910_P2_F22TX 0xf74600ff + +/* P2_DISTIMEOCFG */ +#define RSTV0910_P2_DISTIMEOCFG 0xf748 +#define FSTV0910_P2_RXCHOICE 0xf7481006 +#define FSTV0910_P2_TIMEOUT_OFF 0xf7480001 + +/* P2_DISTIMEOUT */ +#define RSTV0910_P2_DISTIMEOUT 0xf749 +#define FSTV0910_P2_TIMEOUT_COUNT 0xf74900ff + +/* P2_DISRXCFG */ +#define RSTV0910_P2_DISRXCFG 0xf74a +#define FSTV0910_P2_DISRX_RESET 0xf74a7080 +#define FSTV0910_P2_EXTENVELOP 0xf74a6040 +#define FSTV0910_P2_PINSELECT 0xf74a3038 +#define FSTV0910_P2_IGNORE_SHORT22K 0xf74a2004 +#define FSTV0910_P2_SIGNED_RXIN 0xf74a1002 +#define FSTV0910_P2_DISRX_ON 0xf74a0001 + +/* P2_DISRXSTAT1 */ +#define RSTV0910_P2_DISRXSTAT1 0xf74b +#define FSTV0910_P2_RXEND 0xf74b7080 +#define FSTV0910_P2_RXACTIVE 0xf74b6040 +#define FSTV0910_P2_RXDETECT 0xf74b5020 +#define FSTV0910_P2_CONTTONE 0xf74b4010 +#define FSTV0910_P2_8BFIFOREADY 0xf74b3008 +#define FSTV0910_P2_FIFOEMPTY 0xf74b2004 + +/* P2_DISRXSTAT0 */ +#define RSTV0910_P2_DISRXSTAT0 0xf74c +#define FSTV0910_P2_RXFAIL 0xf74c7080 +#define FSTV0910_P2_FIFOPFAIL 0xf74c6040 +#define FSTV0910_P2_RXNONBYTE 0xf74c5020 +#define FSTV0910_P2_FIFOOVF 0xf74c4010 +#define FSTV0910_P2_SHORT22K 0xf74c3008 +#define FSTV0910_P2_RXMSGLOST 0xf74c2004 + +/* P2_DISRXBYTES */ +#define RSTV0910_P2_DISRXBYTES 0xf74d +#define FSTV0910_P2_RXFIFO_BYTES 0xf74d001f + +/* P2_DISRXPARITY1 */ +#define RSTV0910_P2_DISRXPARITY1 0xf74e +#define FSTV0910_P2_DISRX_PARITY1 0xf74e00ff + +/* P2_DISRXPARITY0 */ +#define RSTV0910_P2_DISRXPARITY0 0xf74f +#define FSTV0910_P2_DISRX_PARITY0 0xf74f00ff + +/* P2_DISRXFIFO */ +#define RSTV0910_P2_DISRXFIFO 0xf750 +#define FSTV0910_P2_DISEQC_RX_FIFO 0xf75000ff + +/* P2_DISRXDC1 */ +#define RSTV0910_P2_DISRXDC1 0xf751 +#define FSTV0910_P2_DC_VALUE1 0xf7510103 + +/* P2_DISRXDC0 */ +#define RSTV0910_P2_DISRXDC0 0xf752 +#define FSTV0910_P2_DC_VALUE0 0xf75200ff + +/* P2_DISRXF221 */ +#define RSTV0910_P2_DISRXF221 0xf754 +#define FSTV0910_P2_F22RX1 0xf754000f + +/* P2_DISRXF220 */ +#define RSTV0910_P2_DISRXF220 0xf755 +#define FSTV0910_P2_F22RX0 0xf75500ff + +/* P2_DISRXF100 */ +#define RSTV0910_P2_DISRXF100 0xf756 +#define FSTV0910_P2_F100RX 0xf75600ff + +/* P2_DISRXSHORT22K */ +#define RSTV0910_P2_DISRXSHORT22K 0xf75c +#define FSTV0910_P2_SHORT22K_LENGTH 0xf75c001f + +/* P2_ACRPRESC */ +#define RSTV0910_P2_ACRPRESC 0xf75e +#define FSTV0910_P2_ACR_PRESC 0xf75e0007 + +/* P2_ACRDIV */ +#define RSTV0910_P2_ACRDIV 0xf75f +#define FSTV0910_P2_ACR_DIV 0xf75f00ff + +/* P1_NBITER_NF1 */ +#define RSTV0910_P1_NBITER_NF1 0xfa00 +#define FSTV0910_P1_NBITER_NF_QPSK_1_4 0xfa0000ff + +/* P1_NBITER_NF2 */ +#define RSTV0910_P1_NBITER_NF2 0xfa01 +#define FSTV0910_P1_NBITER_NF_QPSK_1_3 0xfa0100ff + +/* P1_NBITER_NF3 */ +#define RSTV0910_P1_NBITER_NF3 0xfa02 +#define FSTV0910_P1_NBITER_NF_QPSK_2_5 0xfa0200ff + +/* P1_NBITER_NF4 */ +#define RSTV0910_P1_NBITER_NF4 0xfa03 +#define FSTV0910_P1_NBITER_NF_QPSK_1_2 0xfa0300ff + +/* P1_NBITER_NF5 */ +#define RSTV0910_P1_NBITER_NF5 0xfa04 +#define FSTV0910_P1_NBITER_NF_QPSK_3_5 0xfa0400ff + +/* P1_NBITER_NF6 */ +#define RSTV0910_P1_NBITER_NF6 0xfa05 +#define FSTV0910_P1_NBITER_NF_QPSK_2_3 0xfa0500ff + +/* P1_NBITER_NF7 */ +#define RSTV0910_P1_NBITER_NF7 0xfa06 +#define FSTV0910_P1_NBITER_NF_QPSK_3_4 0xfa0600ff + +/* P1_NBITER_NF8 */ +#define RSTV0910_P1_NBITER_NF8 0xfa07 +#define FSTV0910_P1_NBITER_NF_QPSK_4_5 0xfa0700ff + +/* P1_NBITER_NF9 */ +#define RSTV0910_P1_NBITER_NF9 0xfa08 +#define FSTV0910_P1_NBITER_NF_QPSK_5_6 0xfa0800ff + +/* P1_NBITER_NF10 */ +#define RSTV0910_P1_NBITER_NF10 0xfa09 +#define FSTV0910_P1_NBITER_NF_QPSK_8_9 0xfa0900ff + +/* P1_NBITER_NF11 */ +#define RSTV0910_P1_NBITER_NF11 0xfa0a +#define FSTV0910_P1_NBITER_NF_QPSK_9_10 0xfa0a00ff + +/* P1_NBITER_NF12 */ +#define RSTV0910_P1_NBITER_NF12 0xfa0b +#define FSTV0910_P1_NBITER_NF_8PSK_3_5 0xfa0b00ff + +/* P1_NBITER_NF13 */ +#define RSTV0910_P1_NBITER_NF13 0xfa0c +#define FSTV0910_P1_NBITER_NF_8PSK_2_3 0xfa0c00ff + +/* P1_NBITER_NF14 */ +#define RSTV0910_P1_NBITER_NF14 0xfa0d +#define FSTV0910_P1_NBITER_NF_8PSK_3_4 0xfa0d00ff + +/* P1_NBITER_NF15 */ +#define RSTV0910_P1_NBITER_NF15 0xfa0e +#define FSTV0910_P1_NBITER_NF_8PSK_5_6 0xfa0e00ff + +/* P1_NBITER_NF16 */ +#define RSTV0910_P1_NBITER_NF16 0xfa0f +#define FSTV0910_P1_NBITER_NF_8PSK_8_9 0xfa0f00ff + +/* P1_NBITER_NF17 */ +#define RSTV0910_P1_NBITER_NF17 0xfa10 +#define FSTV0910_P1_NBITER_NF_8PSK_9_10 0xfa1000ff + +/* P1_NBITER_NF18 */ +#define RSTV0910_P1_NBITER_NF18 0xfa11 +#define FSTV0910_P1_NBITER_NF_16APSK_2_3 0xfa1100ff + +/* P1_NBITER_NF19 */ +#define RSTV0910_P1_NBITER_NF19 0xfa12 +#define FSTV0910_P1_NBITER_NF_16APSK_3_4 0xfa1200ff + +/* P1_NBITER_NF20 */ +#define RSTV0910_P1_NBITER_NF20 0xfa13 +#define FSTV0910_P1_NBITER_NF_16APSK_4_5 0xfa1300ff + +/* P1_NBITER_NF21 */ +#define RSTV0910_P1_NBITER_NF21 0xfa14 +#define FSTV0910_P1_NBITER_NF_16APSK_5_6 0xfa1400ff + +/* P1_NBITER_NF22 */ +#define RSTV0910_P1_NBITER_NF22 0xfa15 +#define FSTV0910_P1_NBITER_NF_16APSK_8_9 0xfa1500ff + +/* P1_NBITER_NF23 */ +#define RSTV0910_P1_NBITER_NF23 0xfa16 +#define FSTV0910_P1_NBITER_NF_16APSK_9_10 0xfa1600ff + +/* P1_NBITER_NF24 */ +#define RSTV0910_P1_NBITER_NF24 0xfa17 +#define FSTV0910_P1_NBITER_NF_32APSK_3_4 0xfa1700ff + +/* P1_NBITER_NF25 */ +#define RSTV0910_P1_NBITER_NF25 0xfa18 +#define FSTV0910_P1_NBITER_NF_32APSK_4_5 0xfa1800ff + +/* P1_NBITER_NF26 */ +#define RSTV0910_P1_NBITER_NF26 0xfa19 +#define FSTV0910_P1_NBITER_NF_32APSK_5_6 0xfa1900ff + +/* P1_NBITER_NF27 */ +#define RSTV0910_P1_NBITER_NF27 0xfa1a +#define FSTV0910_P1_NBITER_NF_32APSK_8_9 0xfa1a00ff + +/* P1_NBITER_NF28 */ +#define RSTV0910_P1_NBITER_NF28 0xfa1b +#define FSTV0910_P1_NBITER_NF_32APSK_9_10 0xfa1b00ff + +/* P1_NBITER_SF1 */ +#define RSTV0910_P1_NBITER_SF1 0xfa1c +#define FSTV0910_P1_NBITER_SF_QPSK_1_4 0xfa1c00ff + +/* P1_NBITER_SF2 */ +#define RSTV0910_P1_NBITER_SF2 0xfa1d +#define FSTV0910_P1_NBITER_SF_QPSK_1_3 0xfa1d00ff + +/* P1_NBITER_SF3 */ +#define RSTV0910_P1_NBITER_SF3 0xfa1e +#define FSTV0910_P1_NBITER_SF_QPSK_2_5 0xfa1e00ff + +/* P1_NBITER_SF4 */ +#define RSTV0910_P1_NBITER_SF4 0xfa1f +#define FSTV0910_P1_NBITER_SF_QPSK_1_2 0xfa1f00ff + +/* P1_NBITER_SF5 */ +#define RSTV0910_P1_NBITER_SF5 0xfa20 +#define FSTV0910_P1_NBITER_SF_QPSK_3_5 0xfa2000ff + +/* P1_NBITER_SF6 */ +#define RSTV0910_P1_NBITER_SF6 0xfa21 +#define FSTV0910_P1_NBITER_SF_QPSK_2_3 0xfa2100ff + +/* P1_NBITER_SF7 */ +#define RSTV0910_P1_NBITER_SF7 0xfa22 +#define FSTV0910_P1_NBITER_SF_QPSK_3_4 0xfa2200ff + +/* P1_NBITER_SF8 */ +#define RSTV0910_P1_NBITER_SF8 0xfa23 +#define FSTV0910_P1_NBITER_SF_QPSK_4_5 0xfa2300ff + +/* P1_NBITER_SF9 */ +#define RSTV0910_P1_NBITER_SF9 0xfa24 +#define FSTV0910_P1_NBITER_SF_QPSK_5_6 0xfa2400ff + +/* P1_NBITER_SF10 */ +#define RSTV0910_P1_NBITER_SF10 0xfa25 +#define FSTV0910_P1_NBITER_SF_QPSK_8_9 0xfa2500ff + +/* P1_NBITER_SF12 */ +#define RSTV0910_P1_NBITER_SF12 0xfa26 +#define FSTV0910_P1_NBITER_SF_8PSK_3_5 0xfa2600ff + +/* P1_NBITER_SF13 */ +#define RSTV0910_P1_NBITER_SF13 0xfa27 +#define FSTV0910_P1_NBITER_SF_8PSK_2_3 0xfa2700ff + +/* P1_NBITER_SF14 */ +#define RSTV0910_P1_NBITER_SF14 0xfa28 +#define FSTV0910_P1_NBITER_SF_8PSK_3_4 0xfa2800ff + +/* P1_NBITER_SF15 */ +#define RSTV0910_P1_NBITER_SF15 0xfa29 +#define FSTV0910_P1_NBITER_SF_8PSK_5_6 0xfa2900ff + +/* P1_NBITER_SF16 */ +#define RSTV0910_P1_NBITER_SF16 0xfa2a +#define FSTV0910_P1_NBITER_SF_8PSK_8_9 0xfa2a00ff + +/* P1_NBITER_SF18 */ +#define RSTV0910_P1_NBITER_SF18 0xfa2b +#define FSTV0910_P1_NBITER_SF_16APSK_2_3 0xfa2b00ff + +/* P1_NBITER_SF19 */ +#define RSTV0910_P1_NBITER_SF19 0xfa2c +#define FSTV0910_P1_NBITER_SF_16APSK_3_4 0xfa2c00ff + +/* P1_NBITER_SF20 */ +#define RSTV0910_P1_NBITER_SF20 0xfa2d +#define FSTV0910_P1_NBITER_SF_16APSK_4_5 0xfa2d00ff + +/* P1_NBITER_SF21 */ +#define RSTV0910_P1_NBITER_SF21 0xfa2e +#define FSTV0910_P1_NBITER_SF_16APSK_5_6 0xfa2e00ff + +/* P1_NBITER_SF22 */ +#define RSTV0910_P1_NBITER_SF22 0xfa2f +#define FSTV0910_P1_NBITER_SF_16APSK_8_9 0xfa2f00ff + +/* P1_NBITER_SF24 */ +#define RSTV0910_P1_NBITER_SF24 0xfa30 +#define FSTV0910_P1_NBITER_SF_32APSK_3_4 0xfa3000ff + +/* P1_NBITER_SF25 */ +#define RSTV0910_P1_NBITER_SF25 0xfa31 +#define FSTV0910_P1_NBITER_SF_32APSK_4_5 0xfa3100ff + +/* P1_NBITER_SF26 */ +#define RSTV0910_P1_NBITER_SF26 0xfa32 +#define FSTV0910_P1_NBITER_SF_32APSK_5_6 0xfa3200ff + +/* P1_NBITER_SF27 */ +#define RSTV0910_P1_NBITER_SF27 0xfa33 +#define FSTV0910_P1_NBITER_SF_32APSK_8_9 0xfa3300ff + +/* SELSATUR6 */ +#define RSTV0910_SELSATUR6 0xfa34 +#define FSTV0910_SSAT_SF27 0xfa343008 +#define FSTV0910_SSAT_SF26 0xfa342004 +#define FSTV0910_SSAT_SF25 0xfa341002 +#define FSTV0910_SSAT_SF24 0xfa340001 + +/* SELSATUR5 */ +#define RSTV0910_SELSATUR5 0xfa35 +#define FSTV0910_SSAT_SF22 0xfa357080 +#define FSTV0910_SSAT_SF21 0xfa356040 +#define FSTV0910_SSAT_SF20 0xfa355020 +#define FSTV0910_SSAT_SF19 0xfa354010 +#define FSTV0910_SSAT_SF18 0xfa353008 +#define FSTV0910_SSAT_SF16 0xfa352004 +#define FSTV0910_SSAT_SF15 0xfa351002 +#define FSTV0910_SSAT_SF14 0xfa350001 + +/* SELSATUR4 */ +#define RSTV0910_SELSATUR4 0xfa36 +#define FSTV0910_SSAT_SF13 0xfa367080 +#define FSTV0910_SSAT_SF12 0xfa366040 +#define FSTV0910_SSAT_SF10 0xfa365020 +#define FSTV0910_SSAT_SF9 0xfa364010 +#define FSTV0910_SSAT_SF8 0xfa363008 +#define FSTV0910_SSAT_SF7 0xfa362004 +#define FSTV0910_SSAT_SF6 0xfa361002 +#define FSTV0910_SSAT_SF5 0xfa360001 + +/* SELSATUR3 */ +#define RSTV0910_SELSATUR3 0xfa37 +#define FSTV0910_SSAT_SF4 0xfa377080 +#define FSTV0910_SSAT_SF3 0xfa376040 +#define FSTV0910_SSAT_SF2 0xfa375020 +#define FSTV0910_SSAT_SF1 0xfa374010 +#define FSTV0910_SSAT_NF28 0xfa373008 +#define FSTV0910_SSAT_NF27 0xfa372004 +#define FSTV0910_SSAT_NF26 0xfa371002 +#define FSTV0910_SSAT_NF25 0xfa370001 + +/* SELSATUR2 */ +#define RSTV0910_SELSATUR2 0xfa38 +#define FSTV0910_SSAT_NF24 0xfa387080 +#define FSTV0910_SSAT_NF23 0xfa386040 +#define FSTV0910_SSAT_NF22 0xfa385020 +#define FSTV0910_SSAT_NF21 0xfa384010 +#define FSTV0910_SSAT_NF20 0xfa383008 +#define FSTV0910_SSAT_NF19 0xfa382004 +#define FSTV0910_SSAT_NF18 0xfa381002 +#define FSTV0910_SSAT_NF17 0xfa380001 + +/* SELSATUR1 */ +#define RSTV0910_SELSATUR1 0xfa39 +#define FSTV0910_SSAT_NF16 0xfa397080 +#define FSTV0910_SSAT_NF15 0xfa396040 +#define FSTV0910_SSAT_NF14 0xfa395020 +#define FSTV0910_SSAT_NF13 0xfa394010 +#define FSTV0910_SSAT_NF12 0xfa393008 +#define FSTV0910_SSAT_NF11 0xfa392004 +#define FSTV0910_SSAT_NF10 0xfa391002 +#define FSTV0910_SSAT_NF9 0xfa390001 + +/* SELSATUR0 */ +#define RSTV0910_SELSATUR0 0xfa3a +#define FSTV0910_SSAT_NF8 0xfa3a7080 +#define FSTV0910_SSAT_NF7 0xfa3a6040 +#define FSTV0910_SSAT_NF6 0xfa3a5020 +#define FSTV0910_SSAT_NF5 0xfa3a4010 +#define FSTV0910_SSAT_NF4 0xfa3a3008 +#define FSTV0910_SSAT_NF3 0xfa3a2004 +#define FSTV0910_SSAT_NF2 0xfa3a1002 +#define FSTV0910_SSAT_NF1 0xfa3a0001 + +/* GAINLLR_NF1 */ +#define RSTV0910_GAINLLR_NF1 0xfa40 +#define FSTV0910_GAINLLR_NF_QPSK_1_4 0xfa40007f + +/* GAINLLR_NF2 */ +#define RSTV0910_GAINLLR_NF2 0xfa41 +#define FSTV0910_GAINLLR_NF_QPSK_1_3 0xfa41007f + +/* GAINLLR_NF3 */ +#define RSTV0910_GAINLLR_NF3 0xfa42 +#define FSTV0910_GAINLLR_NF_QPSK_2_5 0xfa42007f + +/* GAINLLR_NF4 */ +#define RSTV0910_GAINLLR_NF4 0xfa43 +#define FSTV0910_GAINLLR_NF_QPSK_1_2 0xfa43007f + +/* GAINLLR_NF5 */ +#define RSTV0910_GAINLLR_NF5 0xfa44 +#define FSTV0910_GAINLLR_NF_QPSK_3_5 0xfa44007f + +/* GAINLLR_NF6 */ +#define RSTV0910_GAINLLR_NF6 0xfa45 +#define FSTV0910_GAINLLR_NF_QPSK_2_3 0xfa45007f + +/* GAINLLR_NF7 */ +#define RSTV0910_GAINLLR_NF7 0xfa46 +#define FSTV0910_GAINLLR_NF_QPSK_3_4 0xfa46007f + +/* GAINLLR_NF8 */ +#define RSTV0910_GAINLLR_NF8 0xfa47 +#define FSTV0910_GAINLLR_NF_QPSK_4_5 0xfa47007f + +/* GAINLLR_NF9 */ +#define RSTV0910_GAINLLR_NF9 0xfa48 +#define FSTV0910_GAINLLR_NF_QPSK_5_6 0xfa48007f + +/* GAINLLR_NF10 */ +#define RSTV0910_GAINLLR_NF10 0xfa49 +#define FSTV0910_GAINLLR_NF_QPSK_8_9 0xfa49007f + +/* GAINLLR_NF11 */ +#define RSTV0910_GAINLLR_NF11 0xfa4a +#define FSTV0910_GAINLLR_NF_QPSK_9_10 0xfa4a007f + +/* GAINLLR_NF12 */ +#define RSTV0910_GAINLLR_NF12 0xfa4b +#define FSTV0910_GAINLLR_NF_8PSK_3_5 0xfa4b007f + +/* GAINLLR_NF13 */ +#define RSTV0910_GAINLLR_NF13 0xfa4c +#define FSTV0910_GAINLLR_NF_8PSK_2_3 0xfa4c007f + +/* GAINLLR_NF14 */ +#define RSTV0910_GAINLLR_NF14 0xfa4d +#define FSTV0910_GAINLLR_NF_8PSK_3_4 0xfa4d007f + +/* GAINLLR_NF15 */ +#define RSTV0910_GAINLLR_NF15 0xfa4e +#define FSTV0910_GAINLLR_NF_8PSK_5_6 0xfa4e007f + +/* GAINLLR_NF16 */ +#define RSTV0910_GAINLLR_NF16 0xfa4f +#define FSTV0910_GAINLLR_NF_8PSK_8_9 0xfa4f007f + +/* GAINLLR_NF17 */ +#define RSTV0910_GAINLLR_NF17 0xfa50 +#define FSTV0910_GAINLLR_NF_8PSK_9_10 0xfa50007f + +/* GAINLLR_NF18 */ +#define RSTV0910_GAINLLR_NF18 0xfa51 +#define FSTV0910_GAINLLR_NF_16APSK_2_3 0xfa51007f + +/* GAINLLR_NF19 */ +#define RSTV0910_GAINLLR_NF19 0xfa52 +#define FSTV0910_GAINLLR_NF_16APSK_3_4 0xfa52007f + +/* GAINLLR_NF20 */ +#define RSTV0910_GAINLLR_NF20 0xfa53 +#define FSTV0910_GAINLLR_NF_16APSK_4_5 0xfa53007f + +/* GAINLLR_NF21 */ +#define RSTV0910_GAINLLR_NF21 0xfa54 +#define FSTV0910_GAINLLR_NF_16APSK_5_6 0xfa54007f + +/* GAINLLR_NF22 */ +#define RSTV0910_GAINLLR_NF22 0xfa55 +#define FSTV0910_GAINLLR_NF_16APSK_8_9 0xfa55007f + +/* GAINLLR_NF23 */ +#define RSTV0910_GAINLLR_NF23 0xfa56 +#define FSTV0910_GAINLLR_NF_16APSK_9_10 0xfa56007f + +/* GAINLLR_NF24 */ +#define RSTV0910_GAINLLR_NF24 0xfa57 +#define FSTV0910_GAINLLR_NF_32APSK_3_4 0xfa57007f + +/* GAINLLR_NF25 */ +#define RSTV0910_GAINLLR_NF25 0xfa58 +#define FSTV0910_GAINLLR_NF_32APSK_4_5 0xfa58007f + +/* GAINLLR_NF26 */ +#define RSTV0910_GAINLLR_NF26 0xfa59 +#define FSTV0910_GAINLLR_NF_32APSK_5_6 0xfa59007f + +/* GAINLLR_NF27 */ +#define RSTV0910_GAINLLR_NF27 0xfa5a +#define FSTV0910_GAINLLR_NF_32APSK_8_9 0xfa5a007f + +/* GAINLLR_NF28 */ +#define RSTV0910_GAINLLR_NF28 0xfa5b +#define FSTV0910_GAINLLR_NF_32APSK_9_10 0xfa5b007f + +/* GAINLLR_SF1 */ +#define RSTV0910_GAINLLR_SF1 0xfa5c +#define FSTV0910_GAINLLR_SF_QPSK_1_4 0xfa5c007f + +/* GAINLLR_SF2 */ +#define RSTV0910_GAINLLR_SF2 0xfa5d +#define FSTV0910_GAINLLR_SF_QPSK_1_3 0xfa5d007f + +/* GAINLLR_SF3 */ +#define RSTV0910_GAINLLR_SF3 0xfa5e +#define FSTV0910_GAINLLR_SF_QPSK_2_5 0xfa5e007f + +/* GAINLLR_SF4 */ +#define RSTV0910_GAINLLR_SF4 0xfa5f +#define FSTV0910_GAINLLR_SF_QPSK_1_2 0xfa5f007f + +/* GAINLLR_SF5 */ +#define RSTV0910_GAINLLR_SF5 0xfa60 +#define FSTV0910_GAINLLR_SF_QPSK_3_5 0xfa60007f + +/* GAINLLR_SF6 */ +#define RSTV0910_GAINLLR_SF6 0xfa61 +#define FSTV0910_GAINLLR_SF_QPSK_2_3 0xfa61007f + +/* GAINLLR_SF7 */ +#define RSTV0910_GAINLLR_SF7 0xfa62 +#define FSTV0910_GAINLLR_SF_QPSK_3_4 0xfa62007f + +/* GAINLLR_SF8 */ +#define RSTV0910_GAINLLR_SF8 0xfa63 +#define FSTV0910_GAINLLR_SF_QPSK_4_5 0xfa63007f + +/* GAINLLR_SF9 */ +#define RSTV0910_GAINLLR_SF9 0xfa64 +#define FSTV0910_GAINLLR_SF_QPSK_5_6 0xfa64007f + +/* GAINLLR_SF10 */ +#define RSTV0910_GAINLLR_SF10 0xfa65 +#define FSTV0910_GAINLLR_SF_QPSK_8_9 0xfa65007f + +/* GAINLLR_SF12 */ +#define RSTV0910_GAINLLR_SF12 0xfa66 +#define FSTV0910_GAINLLR_SF_8PSK_3_5 0xfa66007f + +/* GAINLLR_SF13 */ +#define RSTV0910_GAINLLR_SF13 0xfa67 +#define FSTV0910_GAINLLR_SF_8PSK_2_3 0xfa67007f + +/* GAINLLR_SF14 */ +#define RSTV0910_GAINLLR_SF14 0xfa68 +#define FSTV0910_GAINLLR_SF_8PSK_3_4 0xfa68007f + +/* GAINLLR_SF15 */ +#define RSTV0910_GAINLLR_SF15 0xfa69 +#define FSTV0910_GAINLLR_SF_8PSK_5_6 0xfa69007f + +/* GAINLLR_SF16 */ +#define RSTV0910_GAINLLR_SF16 0xfa6a +#define FSTV0910_GAINLLR_SF_8PSK_8_9 0xfa6a007f + +/* GAINLLR_SF18 */ +#define RSTV0910_GAINLLR_SF18 0xfa6b +#define FSTV0910_GAINLLR_SF_16APSK_2_3 0xfa6b007f + +/* GAINLLR_SF19 */ +#define RSTV0910_GAINLLR_SF19 0xfa6c +#define FSTV0910_GAINLLR_SF_16APSK_3_4 0xfa6c007f + +/* GAINLLR_SF20 */ +#define RSTV0910_GAINLLR_SF20 0xfa6d +#define FSTV0910_GAINLLR_SF_16APSK_4_5 0xfa6d007f + +/* GAINLLR_SF21 */ +#define RSTV0910_GAINLLR_SF21 0xfa6e +#define FSTV0910_GAINLLR_SF_16APSK_5_6 0xfa6e007f + +/* GAINLLR_SF22 */ +#define RSTV0910_GAINLLR_SF22 0xfa6f +#define FSTV0910_GAINLLR_SF_16APSK_8_9 0xfa6f007f + +/* GAINLLR_SF24 */ +#define RSTV0910_GAINLLR_SF24 0xfa70 +#define FSTV0910_GAINLLR_SF_32APSK_3_4 0xfa70007f + +/* GAINLLR_SF25 */ +#define RSTV0910_GAINLLR_SF25 0xfa71 +#define FSTV0910_GAINLLR_SF_32APSK_4_5 0xfa71007f + +/* GAINLLR_SF26 */ +#define RSTV0910_GAINLLR_SF26 0xfa72 +#define FSTV0910_GAINLLR_SF_32APSK_5_6 0xfa72007f + +/* GAINLLR_SF27 */ +#define RSTV0910_GAINLLR_SF27 0xfa73 +#define FSTV0910_GAINLLR_SF_32APSK_8_9 0xfa73007f + +/* CFGEXT */ +#define RSTV0910_CFGEXT 0xfa80 +#define FSTV0910_BYPBCH 0xfa806040 +#define FSTV0910_BYPLDPC 0xfa805020 +#define FSTV0910_SHORTMULT 0xfa802004 + +/* GENCFG */ +#define RSTV0910_GENCFG 0xfa86 +#define FSTV0910_BROADCAST 0xfa864010 +#define FSTV0910_CROSSINPUT 0xfa861002 +#define FSTV0910_DDEMOD 0xfa860001 + +/* LDPCERR1 */ +#define RSTV0910_LDPCERR1 0xfa96 +#define FSTV0910_LDPC_ERRORS1 0xfa9600ff + +/* LDPCERR0 */ +#define RSTV0910_LDPCERR0 0xfa97 +#define FSTV0910_LDPC_ERRORS0 0xfa9700ff + +/* BCHERR */ +#define RSTV0910_BCHERR 0xfa98 +#define FSTV0910_ERRORFLAG 0xfa984010 +#define FSTV0910_BCH_ERRORS_COUNTER 0xfa98000f + +/* P1_MAXEXTRAITER */ +#define RSTV0910_P1_MAXEXTRAITER 0xfab1 +#define FSTV0910_P1_MAX_EXTRA_ITER 0xfab100ff + +/* P2_MAXEXTRAITER */ +#define RSTV0910_P2_MAXEXTRAITER 0xfab6 +#define FSTV0910_P2_MAX_EXTRA_ITER 0xfab600ff + +/* P1_STATUSITER */ +#define RSTV0910_P1_STATUSITER 0xfabc +#define FSTV0910_P1_STATUS_ITER 0xfabc00ff + +/* P1_STATUSMAXITER */ +#define RSTV0910_P1_STATUSMAXITER 0xfabd +#define FSTV0910_P1_STATUS_MAX_ITER 0xfabd00ff + +/* P2_STATUSITER */ +#define RSTV0910_P2_STATUSITER 0xfabe +#define FSTV0910_P2_STATUS_ITER 0xfabe00ff + +/* P2_STATUSMAXITER */ +#define RSTV0910_P2_STATUSMAXITER 0xfabf +#define FSTV0910_P2_STATUS_MAX_ITER 0xfabf00ff + +/* P2_NBITER_NF1 */ +#define RSTV0910_P2_NBITER_NF1 0xfac0 +#define FSTV0910_P2_NBITER_NF_QPSK_1_4 0xfac000ff + +/* P2_NBITER_NF2 */ +#define RSTV0910_P2_NBITER_NF2 0xfac1 +#define FSTV0910_P2_NBITER_NF_QPSK_1_3 0xfac100ff + +/* P2_NBITER_NF3 */ +#define RSTV0910_P2_NBITER_NF3 0xfac2 +#define FSTV0910_P2_NBITER_NF_QPSK_2_5 0xfac200ff + +/* P2_NBITER_NF4 */ +#define RSTV0910_P2_NBITER_NF4 0xfac3 +#define FSTV0910_P2_NBITER_NF_QPSK_1_2 0xfac300ff + +/* P2_NBITER_NF5 */ +#define RSTV0910_P2_NBITER_NF5 0xfac4 +#define FSTV0910_P2_NBITER_NF_QPSK_3_5 0xfac400ff + +/* P2_NBITER_NF6 */ +#define RSTV0910_P2_NBITER_NF6 0xfac5 +#define FSTV0910_P2_NBITER_NF_QPSK_2_3 0xfac500ff + +/* P2_NBITER_NF7 */ +#define RSTV0910_P2_NBITER_NF7 0xfac6 +#define FSTV0910_P2_NBITER_NF_QPSK_3_4 0xfac600ff + +/* P2_NBITER_NF8 */ +#define RSTV0910_P2_NBITER_NF8 0xfac7 +#define FSTV0910_P2_NBITER_NF_QPSK_4_5 0xfac700ff + +/* P2_NBITER_NF9 */ +#define RSTV0910_P2_NBITER_NF9 0xfac8 +#define FSTV0910_P2_NBITER_NF_QPSK_5_6 0xfac800ff + +/* P2_NBITER_NF10 */ +#define RSTV0910_P2_NBITER_NF10 0xfac9 +#define FSTV0910_P2_NBITER_NF_QPSK_8_9 0xfac900ff + +/* P2_NBITER_NF11 */ +#define RSTV0910_P2_NBITER_NF11 0xfaca +#define FSTV0910_P2_NBITER_NF_QPSK_9_10 0xfaca00ff + +/* P2_NBITER_NF12 */ +#define RSTV0910_P2_NBITER_NF12 0xfacb +#define FSTV0910_P2_NBITER_NF_8PSK_3_5 0xfacb00ff + +/* P2_NBITER_NF13 */ +#define RSTV0910_P2_NBITER_NF13 0xfacc +#define FSTV0910_P2_NBITER_NF_8PSK_2_3 0xfacc00ff + +/* P2_NBITER_NF14 */ +#define RSTV0910_P2_NBITER_NF14 0xfacd +#define FSTV0910_P2_NBITER_NF_8PSK_3_4 0xfacd00ff + +/* P2_NBITER_NF15 */ +#define RSTV0910_P2_NBITER_NF15 0xface +#define FSTV0910_P2_NBITER_NF_8PSK_5_6 0xface00ff + +/* P2_NBITER_NF16 */ +#define RSTV0910_P2_NBITER_NF16 0xfacf +#define FSTV0910_P2_NBITER_NF_8PSK_8_9 0xfacf00ff + +/* P2_NBITER_NF17 */ +#define RSTV0910_P2_NBITER_NF17 0xfad0 +#define FSTV0910_P2_NBITER_NF_8PSK_9_10 0xfad000ff + +/* P2_NBITER_NF18 */ +#define RSTV0910_P2_NBITER_NF18 0xfad1 +#define FSTV0910_P2_NBITER_NF_16APSK_2_3 0xfad100ff + +/* P2_NBITER_NF19 */ +#define RSTV0910_P2_NBITER_NF19 0xfad2 +#define FSTV0910_P2_NBITER_NF_16APSK_3_4 0xfad200ff + +/* P2_NBITER_NF20 */ +#define RSTV0910_P2_NBITER_NF20 0xfad3 +#define FSTV0910_P2_NBITER_NF_16APSK_4_5 0xfad300ff + +/* P2_NBITER_NF21 */ +#define RSTV0910_P2_NBITER_NF21 0xfad4 +#define FSTV0910_P2_NBITER_NF_16APSK_5_6 0xfad400ff + +/* P2_NBITER_NF22 */ +#define RSTV0910_P2_NBITER_NF22 0xfad5 +#define FSTV0910_P2_NBITER_NF_16APSK_8_9 0xfad500ff + +/* P2_NBITER_NF23 */ +#define RSTV0910_P2_NBITER_NF23 0xfad6 +#define FSTV0910_P2_NBITER_NF_16APSK_9_10 0xfad600ff + +/* P2_NBITER_NF24 */ +#define RSTV0910_P2_NBITER_NF24 0xfad7 +#define FSTV0910_P2_NBITER_NF_32APSK_3_4 0xfad700ff + +/* P2_NBITER_NF25 */ +#define RSTV0910_P2_NBITER_NF25 0xfad8 +#define FSTV0910_P2_NBITER_NF_32APSK_4_5 0xfad800ff + +/* P2_NBITER_NF26 */ +#define RSTV0910_P2_NBITER_NF26 0xfad9 +#define FSTV0910_P2_NBITER_NF_32APSK_5_6 0xfad900ff + +/* P2_NBITER_NF27 */ +#define RSTV0910_P2_NBITER_NF27 0xfada +#define FSTV0910_P2_NBITER_NF_32APSK_8_9 0xfada00ff + +/* P2_NBITER_NF28 */ +#define RSTV0910_P2_NBITER_NF28 0xfadb +#define FSTV0910_P2_NBITER_NF_32APSK_9_10 0xfadb00ff + +/* P2_NBITER_SF1 */ +#define RSTV0910_P2_NBITER_SF1 0xfadc +#define FSTV0910_P2_NBITER_SF_QPSK_1_4 0xfadc00ff + +/* P2_NBITER_SF2 */ +#define RSTV0910_P2_NBITER_SF2 0xfadd +#define FSTV0910_P2_NBITER_SF_QPSK_1_3 0xfadd00ff + +/* P2_NBITER_SF3 */ +#define RSTV0910_P2_NBITER_SF3 0xfade +#define FSTV0910_P2_NBITER_SF_QPSK_2_5 0xfade00ff + +/* P2_NBITER_SF4 */ +#define RSTV0910_P2_NBITER_SF4 0xfadf +#define FSTV0910_P2_NBITER_SF_QPSK_1_2 0xfadf00ff + +/* P2_NBITER_SF5 */ +#define RSTV0910_P2_NBITER_SF5 0xfae0 +#define FSTV0910_P2_NBITER_SF_QPSK_3_5 0xfae000ff + +/* P2_NBITER_SF6 */ +#define RSTV0910_P2_NBITER_SF6 0xfae1 +#define FSTV0910_P2_NBITER_SF_QPSK_2_3 0xfae100ff + +/* P2_NBITER_SF7 */ +#define RSTV0910_P2_NBITER_SF7 0xfae2 +#define FSTV0910_P2_NBITER_SF_QPSK_3_4 0xfae200ff + +/* P2_NBITER_SF8 */ +#define RSTV0910_P2_NBITER_SF8 0xfae3 +#define FSTV0910_P2_NBITER_SF_QPSK_4_5 0xfae300ff + +/* P2_NBITER_SF9 */ +#define RSTV0910_P2_NBITER_SF9 0xfae4 +#define FSTV0910_P2_NBITER_SF_QPSK_5_6 0xfae400ff + +/* P2_NBITER_SF10 */ +#define RSTV0910_P2_NBITER_SF10 0xfae5 +#define FSTV0910_P2_NBITER_SF_QPSK_8_9 0xfae500ff + +/* P2_NBITER_SF12 */ +#define RSTV0910_P2_NBITER_SF12 0xfae6 +#define FSTV0910_P2_NBITER_SF_8PSK_3_5 0xfae600ff + +/* P2_NBITER_SF13 */ +#define RSTV0910_P2_NBITER_SF13 0xfae7 +#define FSTV0910_P2_NBITER_SF_8PSK_2_3 0xfae700ff + +/* P2_NBITER_SF14 */ +#define RSTV0910_P2_NBITER_SF14 0xfae8 +#define FSTV0910_P2_NBITER_SF_8PSK_3_4 0xfae800ff + +/* P2_NBITER_SF15 */ +#define RSTV0910_P2_NBITER_SF15 0xfae9 +#define FSTV0910_P2_NBITER_SF_8PSK_5_6 0xfae900ff + +/* P2_NBITER_SF16 */ +#define RSTV0910_P2_NBITER_SF16 0xfaea +#define FSTV0910_P2_NBITER_SF_8PSK_8_9 0xfaea00ff + +/* P2_NBITER_SF18 */ +#define RSTV0910_P2_NBITER_SF18 0xfaeb +#define FSTV0910_P2_NBITER_SF_16APSK_2_3 0xfaeb00ff + +/* P2_NBITER_SF19 */ +#define RSTV0910_P2_NBITER_SF19 0xfaec +#define FSTV0910_P2_NBITER_SF_16APSK_3_4 0xfaec00ff + +/* P2_NBITER_SF20 */ +#define RSTV0910_P2_NBITER_SF20 0xfaed +#define FSTV0910_P2_NBITER_SF_16APSK_4_5 0xfaed00ff + +/* P2_NBITER_SF21 */ +#define RSTV0910_P2_NBITER_SF21 0xfaee +#define FSTV0910_P2_NBITER_SF_16APSK_5_6 0xfaee00ff + +/* P2_NBITER_SF22 */ +#define RSTV0910_P2_NBITER_SF22 0xfaef +#define FSTV0910_P2_NBITER_SF_16APSK_8_9 0xfaef00ff + +/* P2_NBITER_SF24 */ +#define RSTV0910_P2_NBITER_SF24 0xfaf0 +#define FSTV0910_P2_NBITER_SF_32APSK_3_4 0xfaf000ff + +/* P2_NBITER_SF25 */ +#define RSTV0910_P2_NBITER_SF25 0xfaf1 +#define FSTV0910_P2_NBITER_SF_32APSK_4_5 0xfaf100ff + +/* P2_NBITER_SF26 */ +#define RSTV0910_P2_NBITER_SF26 0xfaf2 +#define FSTV0910_P2_NBITER_SF_32APSK_5_6 0xfaf200ff + +/* P2_NBITER_SF27 */ +#define RSTV0910_P2_NBITER_SF27 0xfaf3 +#define FSTV0910_P2_NBITER_SF_32APSK_8_9 0xfaf300ff + +/* TSTRES0 */ +#define RSTV0910_TSTRES0 0xff11 +#define FSTV0910_FRESFEC 0xff117080 +#define FSTV0910_FRESSYM1 0xff113008 +#define FSTV0910_FRESSYM2 0xff112004 + +/* TSTOUT */ +#define RSTV0910_TSTOUT 0xff12 +#define FSTV0910_TS 0xff12103e +#define FSTV0910_TEST_OUT 0xff120001 + +/* TSTIN */ +#define RSTV0910_TSTIN 0xff13 +#define FSTV0910_TEST_IN 0xff137080 + +/* P2_TSTDMD */ +#define RSTV0910_P2_TSTDMD 0xff20 +#define FSTV0910_P2_CFRINIT_INVZIGZAG 0xff203008 + +/* P2_TCTL1 */ +#define RSTV0910_P2_TCTL1 0xff24 +#define FSTV0910_P2_TST_IQSYMBSEL 0xff24001f + +/* P2_TCTL4 */ +#define RSTV0910_P2_TCTL4 0xff28 +#define FSTV0910_P2_CFR2TOCFR1_DVBS1 0xff2860c0 + +/* P2_TPKTDELIN */ +#define RSTV0910_P2_TPKTDELIN 0xff37 +#define FSTV0910_P2_CFG_RSPARITYON 0xff377080 + +/* P1_TSTDMD */ +#define RSTV0910_P1_TSTDMD 0xff40 +#define FSTV0910_P1_CFRINIT_INVZIGZAG 0xff403008 + +/* P1_TCTL1 */ +#define RSTV0910_P1_TCTL1 0xff44 +#define FSTV0910_P1_TST_IQSYMBSEL 0xff44001f + +/* P1_TCTL4 */ +#define RSTV0910_P1_TCTL4 0xff48 +#define FSTV0910_P1_CFR2TOCFR1_DVBS1 0xff4860c0 + +/* P1_TPKTDELIN */ +#define RSTV0910_P1_TPKTDELIN 0xff57 +#define FSTV0910_P1_CFG_RSPARITYON 0xff577080 + +/* TSTTSRS */ +#define RSTV0910_TSTTSRS 0xff6d +#define FSTV0910_TSTRS_DISRS2 0xff6d1002 +#define FSTV0910_TSTRS_DISRS1 0xff6d0001 + +/* a count of the number of registers for use in init etc */ +#define STV0910_NBREGS 945 +#define STV0910_NBFIELDS 1818 + +#endif diff --git a/longmynd/stv0910_regs_init.h b/longmynd/stv0910_regs_init.h new file mode 100755 index 0000000..d0b9326 --- /dev/null +++ b/longmynd/stv0910_regs_init.h @@ -0,0 +1,1082 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv0910_regs_init.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STV0910_REGS_INIT_H +#define STV0910_REGS_INIT_H + +typedef struct{ + uint16_t reg; + uint8_t val; +}STReg; + +static STReg STV0910DefVal[STV0910_NBREGS]= +{ + /* SYS registers */ +/* { RSTV0910_MID, 0x51 }, MID R only */ +/* { RSTV0910_DID, 0x20 }, DID R only */ + { RSTV0910_DACR1, 0x00 }, /* DACR1 DAC 1 freq=0, mode=0 */ + { RSTV0910_DACR2, 0x00 }, /* DACR2 DAC 2 freq=0, mode=0 */ + { RSTV0910_PADCFG, 0x05 }, /* PADCFG AGCRF_1 inverted, Push-pull, AGCRF_2 same*/ + { RSTV0910_OUTCFG2, 0x00 }, /* OUTCFG2 all Transport stream signals not inverted */ + { RSTV0910_OUTCFG, 0x00 }, /* OUTCFG TS2 serial pins push-pull, ts1 serial pins push-pull, + ts2 parallel pins push-pull, ts1 parallel pins push-pull + serial data output is D7 */ + { RSTV0910_IRQSTATUS3, 0x00 }, /* IRQSTATUS3 reset all pending IRQs */ + { RSTV0910_IRQSTATUS2, 0x00 }, /* IRQSTATUS2 reset all pending IRQs */ + { RSTV0910_IRQSTATUS1, 0x00 }, /* IRQSTATUS1 reset all pending IRQs */ + { RSTV0910_IRQSTATUS0, 0x00 }, /* IRQSTATUS0 reset all pending IRQs */ + { RSTV0910_IRQMASK3, 0x00 }, /* IRQMASK3 disable all IRQs */ + { RSTV0910_IRQMASK2, 0x00 }, /* IRQMASK2 disable all IRQs*/ + { RSTV0910_IRQMASK1, 0x00 }, /* IRQMASK1 disable all IRQs*/ + { RSTV0910_IRQMASK0, 0x00 }, /* IRQMASK0 disable all IRQs*/ + { RSTV0910_I2CCFG, 0x88 }, /* I2CCFG i2c fastmode enabled, auto inc by 1 */ + { RSTV0910_P1_I2CRPT, 0x38 }, /* P1_I2CRPT was 0x34, updated to 0x38 + P1 repeater off, repeater speed =135/32Mhz, delay on SCL, manual stop + bidirectional SDAT2SDA */ + { RSTV0910_P2_I2CRPT, 0x38 }, /* P2_I2CRPT P2 as above */ + { RSTV0910_GPIO0CFG, 0x82 }, /* GPIO0CFG GPIO 0 push-pull iconfig = 0x01 (force to 1), non inverting */ + { RSTV0910_GPIO1CFG, 0x82 }, /* GPIO1CFG 1 " */ + { RSTV0910_GPIO2CFG, 0x82 }, /* GPIO2CFG 2 " */ + { RSTV0910_GPIO3CFG, 0x82 }, /* GPIO3CFG 3 " */ + { RSTV0910_GPIO4CFG, 0x82 }, /* GPIO4CFG 4 " */ + { RSTV0910_GPIO5CFG, 0x82 }, /* GPIO5CFG was 0x04, updated to 0x82 */ + { RSTV0910_GPIO6CFG, 0x82 }, /* GPIO6CFG was 0x06, updated to 0x82 */ + { RSTV0910_GPIO7CFG, 0x82 }, /* GPIO7CFG 7 " */ + { RSTV0910_GPIO8CFG, 0x82 }, /* GPIO8CFG 8 " */ + { RSTV0910_GPIO9CFG, 0x82 }, /* GPIO9CFG 9 " */ + { RSTV0910_GPIO10CFG, 0x82 }, /* GPIO10CFG 10 " */ + { RSTV0910_GPIO11CFG, 0x82 }, /* GPIO11CFG 11 " */ + { RSTV0910_GPIO12CFG, 0x82 }, /* GPIO12CFG 12 " */ + { RSTV0910_GPIO13CFG, 0x82 }, /* GPIO13CFG 13 " */ + { RSTV0910_GPIO14CFG, 0x82 }, /* GPIO14CFG 14 " */ + { RSTV0910_GPIO15CFG, 0x82 }, /* GPIO15CFG 15 " */ + { RSTV0910_GPIO16CFG, 0x82 }, /* GPIO16CFG 16 " */ + { RSTV0910_GPIO17CFG, 0x82 }, /* GPIO17CFG 17 " */ + { RSTV0910_GPIO18CFG, 0x82 }, /* GPIO18CFG 18 " */ + { RSTV0910_GPIO19CFG, 0x82 }, /* GPIO19CFG 19 " */ + { RSTV0910_GPIO20CFG, 0x82 }, /* GPIO20CFG 20 " */ + { RSTV0910_GPIO21CFG, 0x82 }, /* GPIO21CFG 21 " */ + { RSTV0910_GPIO22CFG, 0x82 }, /* GPIO22CFG 22 " */ + { RSTV0910_STRSTATUS1, 0x60 }, /* STRSTATUS1 was 0x93, updated to 0x60 + gpio2=demod 2 detect iq inversion, + gpio1=demod 1 detect iq inversion */ + { RSTV0910_STRSTATUS2, 0x71 }, /* STRSTATUS2 gpio4=demod 2 lock, gpio3=demod 1 lock */ + { RSTV0910_STRSTATUS3, 0x82 }, /* STRSTATUS3 gpio6=demod 2 failed flag, gpio5=demod 1 failed flag */ + + /* FSK Registers */ + { RSTV0910_FSKTFC2, 0x8c }, /* FSKTFC2 FSK is not being used so can ignore these */ + { RSTV0910_FSKTFC1, 0x45 }, /* FSKTFC1 */ + { RSTV0910_FSKTFC0, 0xc9 }, /* FSKTFC0 */ + { RSTV0910_FSKTDELTAF1, 0x01 }, /* FSKTDELTAF1 */ + { RSTV0910_FSKTDELTAF0, 0x37 }, /* FSKTDELTAF0 */ + { RSTV0910_FSKTCTRL, 0x08 }, /* FSKTCTRL modulator on when FSKTX_EN=1, + FSKTX_OUT=Fc-df (FSKTX_IN=0) = fc+df (FSKTX_IN=1), + modulator enabled by FSKTX_EN input, + fsk modulator output second order sig-delta */ + { RSTV0910_FSKRFC2, 0x10 }, /* FSKRFC2 */ + { RSTV0910_FSKRFC1, 0x45 }, /* FSKRFC1 */ + { RSTV0910_FSKRFC0, 0xc9 }, /* FSKRFC0 */ + { RSTV0910_FSKRK1, 0x38 }, /* FSKRK1 */ + { RSTV0910_FSKRK2, 0x71 }, /* FSKRK2 */ + { RSTV0910_FSKRAGCR, 0x28 }, /* FSKRAGCR */ +/* { RSTV0910_FSKRAGC, 0xff }, FSKRAGC R only */ + { RSTV0910_FSKRALPHA, 0x13 }, /* FSKRALPHA */ + { RSTV0910_FSKRPLTH1, 0x90 }, /* FSKRPLTH1 */ + { RSTV0910_FSKRPLTH0, 0xbe }, /* FSKRPLTH0 */ +/* { RSTV0910_FSKRDF1, 0x80 }, FSKRDF1 R only */ +/* { RSTV0910_FSKRDF0, 0x00 }, FSKRDF0 R Only */ + { RSTV0910_FSKRSTEPP, 0x58 }, /* FSKRSTEPP */ + { RSTV0910_FSKRSTEPM, 0x6f }, /* FSKRSTEPM */ +/* { RSTV0910_FSKRDET1, 0x00 }, FSKRDET1 R only */ +/* { RSTV0910_FSKRDET0, 0x01 }, FSKRDET0 R only */ + { RSTV0910_FSKRDTH1, 0x00 }, /* FSKRDTH1 */ + { RSTV0910_FSKRDTH0, 0xe9 }, /* FSKRDTH0 */ + { RSTV0910_FSKRLOSS, 0x4d }, /* FSKRLOSS */ + + /* clocks and power registers */ + { RSTV0910_NCOARSE, 0x39 }, /* NCOARSE charge pump (CP)=7 (for NDIV from 8 to 71), IDF=1 */ + /* f_mclk2 = 270 MHz, = f_ref * n_div / IDF / 2. f_ref=xtal=30MHz */ + { RSTV0910_NCOARSE1, 0x12 }, /* NCOARSE1 N_DIV = 0x12 */ + { RSTV0910_NCOARSE2, 0x04 }, /* NCOARSE2 ODF=0x4 f_ana = 135MHz = f_ref * n_div / IDF / ODF*/ + { RSTV0910_SYNTCTRL, 0xc2 }, /* SYNTCTRL was 0x02, updated to 0xc2 + stop all clocks except i2c, bypass pll, pll active, osc pad enabled */ + { RSTV0910_FILTCTRL, 0x01 }, /* FILTCTRL filter FSK clock not inverted, if PLL bypassed, clock from CLK1 only */ + { RSTV0910_PLLSTAT, 0x07 }, /* PLLSTAT LSB is PLL lock */ + { RSTV0910_STOPCLK1, 0x00 }, /* STOPCLK1 neither ADC interface clocks are inverted */ + { RSTV0910_STOPCLK2, 0x00 }, /* STOPCLK2 no clocks stopped */ + { RSTV0910_PREGCTL, 0x00 }, /* PREGCTL DCDC 3v3 to 2v5 on */ + { RSTV0910_TSTTNR0, 0x00 }, /* TSTTNR0 was 0x04 updated to 0x00 + FSK analog cell off */ + { RSTV0910_TSTTNR1, 0x44 }, /* TSTTNR1 was 0x46 updated to 0x44 + ADC1 power off. note reset=0x26, upper bits are reserved */ + { RSTV0910_TSTTNR2, 0x4b }, /* TSTTNR2 was 0x6b updated to 0x4b + I2C DiSEqC ADC 1 power off, diseqc clock div = 0xb + f_diseqc = 135MHz/2*(diseq_clk_div+17) = 2.41MHz */ + { RSTV0910_TSTTNR3, 0x46 }, /* TSTTNR3 ADC2 power on. note again reset=0x26 again 0x46 writes to reserved */ + + /* DMD P2 Registers */ + { RSTV0910_P2_IQCONST, 0x00 }, /* P2_IQCONST */ + { RSTV0910_P2_NOSCFG, 0x14 }, /* P2_NOSCFG */ + { RSTV0910_P2_ISYMB, 0x0e }, /* P2_ISYMB */ + { RSTV0910_P2_QSYMB, 0xfc }, /* P2_QSYMB */ + { RSTV0910_P2_AGC1CFG, 0x54 }, /* P2_AGC1CFG */ + { RSTV0910_P2_AGC1CN, 0x99 }, /* P2_AGC1CN */ + { RSTV0910_P2_AGC1REF, 0x58 }, /* P2_AGC1REF */ + { RSTV0910_P2_IDCCOMP, 0x0a }, /* P2_IDCCOMP */ + { RSTV0910_P2_QDCCOMP, 0x09 }, /* P2_QDCCOMP */ + { RSTV0910_P2_POWERI, 0x09 }, /* P2_POWERI */ + { RSTV0910_P2_POWERQ, 0x0a }, /* P2_POWERQ */ + { RSTV0910_P2_AGC1AMM, 0xfd }, /* P2_AGC1AMM */ + { RSTV0910_P2_AGC1QUAD, 0xfd }, /* P2_AGC1QUAD */ + { RSTV0910_P2_AGCIQIN1, 0x00 }, /* P2_AGCIQIN1 */ + { RSTV0910_P2_AGCIQIN0, 0x00 }, /* P2_AGCIQIN0 */ + { RSTV0910_P2_DEMOD, 0x00 }, /* P2_DEMOD */ + { RSTV0910_P2_DMDMODCOD, 0x10 }, /* P2_DMDMODCOD */ + { RSTV0910_P2_DSTATUS, 0x10 }, /* P2_DSTATUS */ + { RSTV0910_P2_DSTATUS2, 0x80 }, /* P2_DSTATUS2 */ + { RSTV0910_P2_DMDCFGMD, 0xc9 }, /* P2_DMDCFGMD */ + { RSTV0910_P2_DMDCFG2, 0x3b }, /* P2_DMDCFG2 */ + { RSTV0910_P2_DMDISTATE, 0x5c }, /* P2_DMDISTATE */ + { RSTV0910_P2_DMDT0M, 0x40 }, /* P2_DMDT0M */ + { RSTV0910_P2_DMDSTATE, 0x1c }, /* P2_DMDSTATE */ + { RSTV0910_P2_DMDFLYW, 0x00 }, /* P2_DMDFLYW */ + { RSTV0910_P2_DSTATUS3, 0x80 }, /* P2_DSTATUS3 */ + { RSTV0910_P2_DMDCFG3, 0x08 }, /* P2_DMDCFG3 */ + { RSTV0910_P2_DMDCFG4, 0x04 }, /* P2_DMDCFG4 */ + { RSTV0910_P2_CORRELMANT, 0x78 }, /* P2_CORRELMANT */ + { RSTV0910_P2_CORRELABS, 0x8C }, /* P2_CORRELABS */ + { RSTV0910_P2_CORRELEXP, 0xaa }, /* P2_CORRELEXP */ + { RSTV0910_P2_PLHMODCOD, 0x10 }, /* P2_PLHMODCOD */ + { RSTV0910_P2_DMDREG, 0x01 }, /* P2_DMDREG */ + { RSTV0910_P2_AGCNADJ, 0x00 }, /* P2_AGCNADJ */ + { RSTV0910_P2_AGCKS, 0x00 }, /* P2_AGCKS */ + { RSTV0910_P2_AGCKQ, 0x00 }, /* P2_AGCKQ */ + { RSTV0910_P2_AGCK8, 0x00 }, /* P2_AGCK8 */ + { RSTV0910_P2_AGCK16, 0x00 }, /* P2_AGCK16 */ + { RSTV0910_P2_AGCK32, 0x00 }, /* P2_AGCK32 */ + { RSTV0910_P2_AGC2O, 0x5b }, /* P2_AGC2O */ + { RSTV0910_P2_AGC2REF, 0x38 }, /* P2_AGC2REF */ + { RSTV0910_P2_AGC1ADJ, 0x58 }, /* P2_AGC1ADJ */ + { RSTV0910_P2_AGCRSADJ, 0x38 }, /* P2_AGCRSADJ */ + { RSTV0910_P2_AGCRQADJ, 0x38 }, /* P2_AGCRQADJ */ + { RSTV0910_P2_AGCR8ADJ, 0x38 }, /* P2_AGCR8ADJ */ + { RSTV0910_P2_AGCR1ADJ, 0x38 }, /* P2_AGCR1ADJ */ + { RSTV0910_P2_AGCR2ADJ, 0x38 }, /* P2_AGCR2ADJ */ + { RSTV0910_P2_AGCR3ADJ, 0x47 }, /* P2_AGCR3ADJ */ + { RSTV0910_P2_AGCREFADJ, 0x38 }, /* P2_AGCREFADJ */ + { RSTV0910_P2_AGC2I1, 0x1c }, /* P2_AGC2I1 */ + { RSTV0910_P2_AGC2I0, 0x74 }, /* P2_AGC2I0 */ + { RSTV0910_P2_CARCFG, 0x46 }, /* P2_CARCFG */ + { RSTV0910_P2_ACLC, 0x2b }, /* P2_ACLC */ + { RSTV0910_P2_BCLC, 0x1a }, /* P2_BCLC */ + { RSTV0910_P2_ACLCS2, 0x00 }, /* P2_ACLCS2 */ + { RSTV0910_P2_BCLCS2, 0x00 }, /* P2_BCLCS2 */ + { RSTV0910_P2_CARFREQ, 0x79 }, /* P2_CARFREQ */ + { RSTV0910_P2_CARHDR, 0x1c }, /* P2_CARHDR */ + { RSTV0910_P2_LDT, 0xd0 }, /* P2_LDT */ + { RSTV0910_P2_LDT2, 0xb8 }, /* P2_LDT2 */ + { RSTV0910_P2_CFRICFG, 0xf9 }, /* P2_CFRICFG */ + { RSTV0910_P2_CFRUP1, 0x0e }, /* P2_CFRUP1 */ + { RSTV0910_P2_CFRUP0, 0x69 }, /* P2_CFRUP0 */ + { RSTV0910_P2_CFRIBASE1, 0x01 }, /* P2_CFRIBASE1 */ + { RSTV0910_P2_CFRIBASE0, 0xf5 }, /* P2_CFRIBASE0 */ + { RSTV0910_P2_CFRLOW1, 0xf1 }, /* P2_CFRLOW1 */ + { RSTV0910_P2_CFRLOW0, 0x97 }, /* P2_CFRLOW0 */ + { RSTV0910_P2_CFRINIT1, 0x01 }, /* P2_CFRINIT1 */ + { RSTV0910_P2_CFRINIT0, 0xf5 }, /* P2_CFRINIT0 */ + { RSTV0910_P2_CFRINC1, 0x03 }, /* P2_CFRINC1 */ + { RSTV0910_P2_CFRINC0, 0x8e }, /* P2_CFRINC0 */ + { RSTV0910_P2_CFR2, 0x01 }, /* P2_CFR2 */ + { RSTV0910_P2_CFR1, 0xf5 }, /* P2_CFR1 */ + { RSTV0910_P2_CFR0, 0x00 }, /* P2_CFR0 */ + { RSTV0910_P2_LDI, 0xb6 }, /* P2_LDI */ + { RSTV0910_P2_TMGCFG, 0xd3 }, /* P2_TMGCFG */ + { RSTV0910_P2_RTC, 0x68 }, /* P2_RTC */ + { RSTV0910_P2_RTCS2, 0x68 }, /* P2_RTCS2 */ + { RSTV0910_P2_TMGTHRISE, 0x1e }, /* P2_TMGTHRISE */ + { RSTV0910_P2_TMGTHFALL, 0x08 }, /* P2_TMGTHFALL */ + { RSTV0910_P2_SFRUPRATIO, 0x20 }, /* P2_SFRUPRATIO */ + { RSTV0910_P2_SFRLOWRATIO, 0xd0 }, /* P2_SFRLOWRATIO */ + { RSTV0910_P2_KTTMG, 0xa0 }, /* P2_KTTMG */ + { RSTV0910_P2_KREFTMG, 0x80 }, /* P2_KREFTMG */ + { RSTV0910_P2_SFRSTEP, 0x88 }, /* P2_SFRSTEP */ + { RSTV0910_P2_TMGCFG2, 0x80 }, /* P2_TMGCFG2 */ + { RSTV0910_P2_KREFTMG2, 0x80 }, /* P2_KREFTMG2 */ + { RSTV0910_P2_TMGCFG3, 0x06 }, /* P2_TMGCFG3 */ + { RSTV0910_P2_SFRINIT1, 0x38 }, /* P2_SFRINIT1 */ + { RSTV0910_P2_SFRINIT0, 0xe3 }, /* P2_SFRINIT0 */ + { RSTV0910_P2_SFRUP1, 0x3f }, /* P2_SFRUP1 */ + { RSTV0910_P2_SFRUP0, 0xff }, /* P2_SFRUP0 */ + { RSTV0910_P2_SFRLOW1, 0x2e }, /* P2_SFRLOW1 */ + { RSTV0910_P2_SFRLOW0, 0x39 }, /* P2_SFRLOW0 */ + { RSTV0910_P2_SFR3, 0x38 }, /* P2_SFR3 */ + { RSTV0910_P2_SFR2, 0xe3 }, /* P2_SFR2 */ + { RSTV0910_P2_SFR1, 0x00 }, /* P2_SFR1 */ + { RSTV0910_P2_SFR0, 0x00 }, /* P2_SFR0 */ + { RSTV0910_P2_TMGREG2, 0x00 }, /* P2_TMGREG2 */ + { RSTV0910_P2_TMGREG1, 0x00 }, /* P2_TMGREG1 */ + { RSTV0910_P2_TMGREG0, 0x00 }, /* P2_TMGREG0 */ + { RSTV0910_P2_TMGLOCK1, 0xe4 }, /* P2_TMGLOCK1 */ + { RSTV0910_P2_TMGLOCK0, 0x00 }, /* P2_TMGLOCK0 */ + { RSTV0910_P2_TMGOBS, 0x10 }, /* P2_TMGOBS */ + { RSTV0910_P2_EQUALCFG, 0x41 }, /* P2_EQUALCFG */ + { RSTV0910_P2_EQUAI1, 0x00 }, /* P2_EQUAI1 */ + { RSTV0910_P2_EQUAQ1, 0x00 }, /* P2_EQUAQ1 */ + { RSTV0910_P2_EQUAI2, 0x00 }, /* P2_EQUAI2 */ + { RSTV0910_P2_EQUAQ2, 0x00 }, /* P2_EQUAQ2 */ + { RSTV0910_P2_EQUAI3, 0x00 }, /* P2_EQUAI3 */ + { RSTV0910_P2_EQUAQ3, 0x00 }, /* P2_EQUAQ3 */ + { RSTV0910_P2_EQUAI4, 0x00 }, /* P2_EQUAI4 */ + { RSTV0910_P2_EQUAQ4, 0x00 }, /* P2_EQUAQ4 */ + { RSTV0910_P2_EQUAI5, 0x00 }, /* P2_EQUAI5 */ + { RSTV0910_P2_EQUAQ5, 0x00 }, /* P2_EQUAQ5 */ + { RSTV0910_P2_EQUAI6, 0x00 }, /* P2_EQUAI6 */ + { RSTV0910_P2_EQUAQ6, 0x00 }, /* P2_EQUAQ6 */ + { RSTV0910_P2_EQUAI7, 0x00 }, /* P2_EQUAI7 */ + { RSTV0910_P2_EQUAQ7, 0x00 }, /* P2_EQUAQ7 */ + { RSTV0910_P2_EQUAI8, 0x00 }, /* P2_EQUAI8 */ + { RSTV0910_P2_EQUAQ8, 0x00 }, /* P2_EQUAQ8 */ + { RSTV0910_P2_NNOSDATAT1, 0xff }, /* P2_NNOSDATAT1 */ + { RSTV0910_P2_NNOSDATAT0, 0xff }, /* P2_NNOSDATAT0 */ + { RSTV0910_P2_NNOSDATA1, 0xff }, /* P2_NNOSDATA1 */ + { RSTV0910_P2_NNOSDATA0, 0xff }, /* P2_NNOSDATA0 */ + { RSTV0910_P2_NNOSPLHT1, 0xff }, /* P2_NNOSPLHT1 */ + { RSTV0910_P2_NNOSPLHT0, 0xff }, /* P2_NNOSPLHT0 */ + { RSTV0910_P2_NNOSPLH1, 0xff }, /* P2_NNOSPLH1 */ + { RSTV0910_P2_NNOSPLH0, 0xff }, /* P2_NNOSPLH0 */ + { RSTV0910_P2_NOSDATAT1, 0xff }, /* P2_NOSDATAT1 */ + { RSTV0910_P2_NOSDATAT0, 0xff }, /* P2_NOSDATAT0 */ + { RSTV0910_P2_NNOSFRAME1, 0xff }, /* P2_NNOSFRAME1 */ + { RSTV0910_P2_NNOSFRAME0, 0xff }, /* P2_NNOSFRAME0 */ + { RSTV0910_P2_NNOSRAD1, 0x00 }, /* P2_NNOSRAD1 */ + { RSTV0910_P2_NNOSRAD0, 0x00 }, /* P2_NNOSRAD0 */ + { RSTV0910_P2_NOSCFGF1, 0x00 }, /* P2_NOSCFGF1 */ + { RSTV0910_P2_NOSCFGF2, 0x00 }, /* P2_NOSCFGF2 */ + { RSTV0910_P2_CAR2CFG, 0x06 }, /* P2_CAR2CFG */ + { RSTV0910_P2_CFR2CFR1, 0xe5 }, /* P2_CFR2CFR1 */ + { RSTV0910_P2_CAR3CFG, 0x02 }, /* P2_CAR3CFG */ + { RSTV0910_P2_CFR22, 0x00 }, /* P2_CFR22 */ + { RSTV0910_P2_CFR21, 0x00 }, /* P2_CFR21 */ + { RSTV0910_P2_CFR20, 0x00 }, /* P2_CFR20 */ + { RSTV0910_P2_ACLC2S2Q, 0x0b }, /* P2_ACLC2S2Q */ + { RSTV0910_P2_ACLC2S28, 0x0a }, /* P2_ACLC2S28 */ + { RSTV0910_P2_ACLC2S216A, 0x49 }, /* P2_ACLC2S216A */ + { RSTV0910_P2_ACLC2S232A, 0x48 }, /* P2_ACLC2S232A */ + { RSTV0910_P2_BCLC2S2Q, 0x84 }, /* P2_BCLC2S2Q */ + { RSTV0910_P2_BCLC2S28, 0x84 }, /* P2_BCLC2S28 */ + { RSTV0910_P2_BCLC2S216A, 0x84 }, /* P2_BCLC2S216A */ + { RSTV0910_P2_BCLC2S232A, 0x84 }, /* P2_BCLC2S232A */ + { RSTV0910_P2_PLROOT2, 0x00 }, /* P2_PLROOT2 */ + { RSTV0910_P2_PLROOT1, 0x00 }, /* P2_PLROOT1 */ + { RSTV0910_P2_PLROOT0, 0x01 }, /* P2_PLROOT0 */ + { RSTV0910_P2_MODCODLST0, 0xff }, /* P2_MODCODLST0 */ + { RSTV0910_P2_MODCODLST1, 0xfc }, /* P2_MODCODLST1 */ + { RSTV0910_P2_MODCODLST2, 0x00 }, /* P2_MODCODLST2 */ + { RSTV0910_P2_MODCODLST3, 0x00 }, /* P2_MODCODLST3 */ + { RSTV0910_P2_MODCODLST4, 0x00 }, /* P2_MODCODLST4 */ + { RSTV0910_P2_MODCODLST5, 0x00 }, /* P2_MODCODLST5 */ + { RSTV0910_P2_MODCODLST6, 0x00 }, /* P2_MODCODLST6 */ + { RSTV0910_P2_MODCODLST7, 0xc0 }, /* P2_MODCODLST7 */ + { RSTV0910_P2_MODCODLST8, 0x00 }, /* P2_MODCODLST8 */ + { RSTV0910_P2_MODCODLST9, 0x00 }, /* P2_MODCODLST9 */ + { RSTV0910_P2_MODCODLSTA, 0xc0 }, /* P2_MODCODLSTA */ + { RSTV0910_P2_MODCODLSTB, 0x00 }, /* P2_MODCODLSTB */ + { RSTV0910_P2_MODCODLSTC, 0x00 }, /* P2_MODCODLSTC */ + { RSTV0910_P2_MODCODLSTD, 0x00 }, /* P2_MODCODLSTD */ + { RSTV0910_P2_MODCODLSTE, 0x00 }, /* P2_MODCODLSTE */ + { RSTV0910_P2_MODCODLSTF, 0x0f }, /* P2_MODCODLSTF */ + { RSTV0910_P2_GAUSSR0, 0x98 }, /* P2_GAUSSR0 */ + { RSTV0910_P2_CCIR0, 0x30 }, /* P2_CCIR0 */ + { RSTV0910_P2_CCIQUANT, 0xac }, /* P2_CCIQUANT */ + { RSTV0910_P2_CCITHRES, 0x50 }, /* P2_CCITHRES */ + { RSTV0910_P2_CCIACC, 0x00 }, /* P2_CCIACC */ + { RSTV0910_P2_DSTATUS4, 0x64 }, /* P2_DSTATUS4 */ + { RSTV0910_P2_DMDRESCFG, 0x29 }, /* P2_DMDRESCFG */ + { RSTV0910_P2_DMDRESADR, 0x00 }, /* P2_DMDRESADR */ + { RSTV0910_P2_DMDRESDATA7, 0x00 }, /* P2_DMDRESDATA7 */ + { RSTV0910_P2_DMDRESDATA6, 0x00 }, /* P2_DMDRESDATA6 */ + { RSTV0910_P2_DMDRESDATA5, 0x00 }, /* P2_DMDRESDATA5 */ + { RSTV0910_P2_DMDRESDATA4, 0x00 }, /* P2_DMDRESDATA4 */ + { RSTV0910_P2_DMDRESDATA3, 0x00 }, /* P2_DMDRESDATA3 */ + { RSTV0910_P2_DMDRESDATA2, 0x00 }, /* P2_DMDRESDATA2 */ + { RSTV0910_P2_DMDRESDATA1, 0x00 }, /* P2_DMDRESDATA1 */ + { RSTV0910_P2_DMDRESDATA0, 0x00 }, /* P2_DMDRESDATA0 */ + { RSTV0910_P2_FFEI1, 0x00 }, /* P2_FFEI1 */ + { RSTV0910_P2_FFEQ1, 0x00 }, /* P2_FFEQ1 */ + { RSTV0910_P2_FFEI2, 0x00 }, /* P2_FFEI2 */ + { RSTV0910_P2_FFEQ2, 0x00 }, /* P2_FFEQ2 */ + { RSTV0910_P2_FFEI3, 0x00 }, /* P2_FFEI3 */ + { RSTV0910_P2_FFEQ3, 0x00 }, /* P2_FFEQ3 */ + { RSTV0910_P2_FFEI4, 0x00 }, /* P2_FFEI4 */ + { RSTV0910_P2_FFEQ4, 0x00 }, /* P2_FFEQ4 */ + { RSTV0910_P2_FFECFG, 0x71 }, /* P2_FFECFG */ + { RSTV0910_P2_TNRCFG2, 0x02 }, /* P2_TNRCFG2 */ + { RSTV0910_P2_SMAPCOEF7, 0x00 }, /* P2_SMAPCOEF7 */ + { RSTV0910_P2_SMAPCOEF6, 0x00 }, /* P2_SMAPCOEF6 */ + { RSTV0910_P2_SMAPCOEF5, 0x00 }, /* P2_SMAPCOEF5 */ + { RSTV0910_P2_SMAPCOEF4, 0x00 }, /* P2_SMAPCOEF4 */ + { RSTV0910_P2_SMAPCOEF3, 0x00 }, /* P2_SMAPCOEF3 */ + { RSTV0910_P2_SMAPCOEF2, 0x00 }, /* P2_SMAPCOEF2 */ + { RSTV0910_P2_SMAPCOEF1, 0x00 }, /* P2_SMAPCOEF1 */ + { RSTV0910_P2_SMAPCOEF0, 0x71 }, /* P2_SMAPCOEF0 */ + { RSTV0910_P2_NOSTHRES1, 0x60 }, /* P2_NOSTHRES1 */ + { RSTV0910_P2_NOSTHRES2, 0x69 }, /* P2_NOSTHRES2 */ + { RSTV0910_P2_NOSDIFF1, 0x80 }, /* P2_NOSDIFF1 */ + { RSTV0910_P2_RAINFADE, 0x35 }, /* P2_RAINFADE */ + { RSTV0910_P2_NOSRAMCFG, 0x28 }, /* P2_NOSRAMCFG */ + { RSTV0910_P2_NOSRAMPOS, 0x26 }, /* P2_NOSRAMPOS */ + { RSTV0910_P2_NOSRAMVAL, 0x86 }, /* P2_NOSRAMVAL */ + { RSTV0910_P2_DMDPLHSTAT, 0x00 }, /* P2_DMDPLHSTAT */ + { RSTV0910_P2_LOCKTIME3, 0xc0 }, /* P2_LOCKTIME3 */ + { RSTV0910_P2_LOCKTIME2, 0xd2 }, /* P2_LOCKTIME2 */ + { RSTV0910_P2_LOCKTIME1, 0x3b }, /* P2_LOCKTIME1 */ + { RSTV0910_P2_LOCKTIME0, 0x46 }, /* P2_LOCKTIME0 */ + /* DVB1 P2 Registers */ + { RSTV0910_P2_VITSCALE, 0x80 }, /* P2_VITSCALE */ + { RSTV0910_P2_FECM, 0x00 }, /* P2_FECM */ + { RSTV0910_P2_VTH12, 0xd7 }, /* P2_VTH12 */ + { RSTV0910_P2_VTH23, 0x85 }, /* P2_VTH23 */ + { RSTV0910_P2_VTH34, 0x58 }, /* P2_VTH34 */ + { RSTV0910_P2_VTH56, 0x3a }, /* P2_VTH56 */ + { RSTV0910_P2_VTH67, 0x34 }, /* P2_VTH67 */ + { RSTV0910_P2_VTH78, 0x28 }, /* P2_VTH78 */ + { RSTV0910_P2_VITCURPUN, 0x0d }, /* P2_VITCURPUN */ + { RSTV0910_P2_VERROR, 0xff }, /* P2_VERROR */ + { RSTV0910_P2_PRVIT, 0x2f }, /* P2_PRVIT */ + { RSTV0910_P2_VAVSRVIT, 0x00 }, /* P2_VAVSRVIT */ + { RSTV0910_P2_VSTATUSVIT, 0xa6 }, /* P2_VSTATUSVIT */ + { RSTV0910_P2_VTHINUSE, 0xd7 }, /* P2_VTHINUSE */ + { RSTV0910_P2_KDIV12, 0x27 }, /* P2_KDIV12 */ + { RSTV0910_P2_KDIV23, 0x32 }, /* P2_KDIV23 */ + { RSTV0910_P2_KDIV34, 0x32 }, /* P2_KDIV34 */ + { RSTV0910_P2_KDIV56, 0x32 }, /* P2_KDIV56 */ + { RSTV0910_P2_KDIV67, 0x32 }, /* P2_KDIV67 */ + { RSTV0910_P2_KDIV78, 0x50 }, /* P2_KDIV78 */ + { RSTV0910_P2_TSPIDFLT1, 0x00 }, /* P2_TSPIDFLT1 */ + { RSTV0910_P2_TSPIDFLT0, 0x00 }, /* P2_TSPIDFLT0 */ + /* DVB2 P2 Registers */ + { RSTV0910_P2_PDELCTRL0, 0x01 }, /* P2_PDELCTRL0 */ + { RSTV0910_P2_PDELCTRL1, 0x00 }, /* P2_PDELCTRL1 */ + { RSTV0910_P2_PDELCTRL2, 0x20 }, /* P2_PDELCTRL2 */ + { RSTV0910_P2_HYSTTHRESH, 0x41 }, /* P2_HYSTTHRESH */ + { RSTV0910_P2_UPLCCST0, 0xe6 }, /* P2_UPLCCST0 */ + { RSTV0910_P2_ISIENTRY, 0x00 }, /* P2_ISIENTRY */ + { RSTV0910_P2_ISIBITENA, 0x00 }, /* P2_ISIBITENA */ + { RSTV0910_P2_MATSTR1, 0xf0 }, /* P2_MATSTR1 */ + { RSTV0910_P2_MATSTR0, 0x00 }, /* P2_MATSTR0 */ + { RSTV0910_P2_UPLSTR1, 0x05 }, /* P2_UPLSTR1 */ + { RSTV0910_P2_UPLSTR0, 0xe0 }, /* P2_UPLSTR0 */ + { RSTV0910_P2_DFLSTR1, 0x7d }, /* P2_DFLSTR1 */ + { RSTV0910_P2_DFLSTR0, 0x80 }, /* P2_DFLSTR0 */ + { RSTV0910_P2_SYNCSTR, 0x47 }, /* P2_SYNCSTR */ + { RSTV0910_P2_SYNCDSTR1, 0x00 }, /* P2_SYNCDSTR1 */ + { RSTV0910_P2_SYNCDSTR0, 0x00 }, /* P2_SYNCDSTR0 */ + { RSTV0910_P2_PDELSTATUS1, 0x94 }, /* P2_PDELSTATUS1 */ + { RSTV0910_P2_PDELSTATUS2, 0x92 }, /* P2_PDELSTATUS2 */ + { RSTV0910_P2_BBFCRCKO1, 0x00 }, /* P2_BBFCRCKO1 */ + { RSTV0910_P2_BBFCRCKO0, 0x00 }, /* P2_BBFCRCKO0 */ + { RSTV0910_P2_UPCRCKO1, 0x00 }, /* P2_UPCRCKO1 */ + { RSTV0910_P2_UPCRCKO0, 0x00 }, /* P2_UPCRCKO0 */ + { RSTV0910_P2_PDELCTRL3, 0x00 }, /* P2_PDELCTRL3 */ + /* TS P2 Registers */ + { RSTV0910_P2_TSSTATEM, 0xf0 }, /* P2_TSSTATEM */ + { RSTV0910_P2_TSSTATEL, 0x12 }, /* P2_TSSTATEL */ + { RSTV0910_P2_TSCFGH, 0x80 }, /* P2_TSCFGH */ + { RSTV0910_P2_TSCFGM, 0x04 }, /* P2_TSCFGM */ + { RSTV0910_P2_TSCFGL, 0x20 }, /* P2_TSCFGL */ + { RSTV0910_P2_TSSYNC, 0x00 }, /* P2_TSSYNC */ + { RSTV0910_P2_TSINSDELH, 0x00 }, /* P2_TSINSDELH */ + { RSTV0910_P2_TSINSDELM, 0x00 }, /* P2_TSINSDELM */ + { RSTV0910_P2_TSINSDELL, 0x00 }, /* P2_TSINSDELL */ + { RSTV0910_P2_TSDIVN, 0x03 }, /* P2_TSDIVN */ + { RSTV0910_P2_TSCFG4, 0x00 }, /* P2_TSCFG4 */ + { RSTV0910_P2_TSSPEED, 0x33 }, /* P2_TSSPEED */ +/* { RSTV0910_P2_TSSTATUS, 0x52 }, P2_TSSTATUS */ + { RSTV0910_P2_TSSTATUS2, 0x02 }, /* P2_TSSTATUS2 */ + { RSTV0910_P2_TSBITRATE1, 0x00 }, /* P2_TSBITRATE1 */ + { RSTV0910_P2_TSBITRATE0, 0x03 }, /* P2_TSBITRATE0 */ + { RSTV0910_P2_TSPACKLEN1, 0x00 }, /* P2_TSPACKLEN1 */ + { RSTV0910_P2_TSDLY2, 0x00 }, /* P2_TSDLY2 */ + { RSTV0910_P2_TSDLY1, 0x00 }, /* P2_TSDLY1 */ + { RSTV0910_P2_TSDLY0, 0x00 }, /* P2_TSDLY0 */ + { RSTV0910_P2_TSNPDAV, 0x00 }, /* P2_TSNPDAV */ + { RSTV0910_P2_TSBUFSTAT2, 0x00 }, /* P2_TSBUFSTAT2 */ + { RSTV0910_P2_TSBUFSTAT1, 0x00 }, /* P2_TSBUFSTAT1 */ + { RSTV0910_P2_TSBUFSTAT0, 0x00 }, /* P2_TSBUFSTAT0 */ + { RSTV0910_P2_TSDEBUGL, 0x04 }, /* P2_TSDEBUGL */ + { RSTV0910_P2_TSDLYSET2, 0x01 }, /* P2_TSDLYSET2 */ + { RSTV0910_P2_TSDLYSET1, 0x18 }, /* P2_TSDLYSET1 */ + { RSTV0910_P2_TSDLYSET0, 0x00 }, /* P2_TSDLYSET0 */ + { RSTV0910_P2_ERRCTRL1, 0x67 }, /* P2_ERRCTRL1 */ + { RSTV0910_P2_ERRCNT12, 0x00 }, /* P2_ERRCNT12 */ + { RSTV0910_P2_ERRCNT11, 0x00 }, /* P2_ERRCNT11 */ + { RSTV0910_P2_ERRCNT10, 0x00 }, /* P2_ERRCNT10 */ + { RSTV0910_P2_ERRCTRL2, 0xc1 }, /* P2_ERRCTRL2 */ + { RSTV0910_P2_ERRCNT22, 0x00 }, /* P2_ERRCNT22 */ + { RSTV0910_P2_ERRCNT21, 0x00 }, /* P2_ERRCNT21 */ + { RSTV0910_P2_ERRCNT20, 0x00 }, /* P2_ERRCNT20 */ + { RSTV0910_P2_FECSPY, 0xa8 }, /* P2_FECSPY */ + { RSTV0910_P2_FSPYCFG, 0x2c }, /* P2_FSPYCFG */ + { RSTV0910_P2_FSPYDATA, 0x3a }, /* P2_FSPYDATA */ + { RSTV0910_P2_FSPYOUT, 0x07 }, /* P2_FSPYOUT */ + { RSTV0910_P2_FSTATUS, 0x00 }, /* P2_FSTATUS */ + { RSTV0910_P2_FBERCPT4, 0x00 }, /* P2_FBERCPT4 */ + { RSTV0910_P2_FBERCPT3, 0x00 }, /* P2_FBERCPT3 */ + { RSTV0910_P2_FBERCPT2, 0x00 }, /* P2_FBERCPT2 */ + { RSTV0910_P2_FBERCPT1, 0x00 }, /* P2_FBERCPT1 */ + { RSTV0910_P2_FBERCPT0, 0x00 }, /* P2_FBERCPT0 */ + { RSTV0910_P2_FBERERR2, 0x00 }, /* P2_FBERERR2 */ + { RSTV0910_P2_FBERERR1, 0x00 }, /* P2_FBERERR1 */ + { RSTV0910_P2_FBERERR0, 0x00 }, /* P2_FBERERR0 */ + { RSTV0910_P2_FSPYBER, 0x12 }, /* P2_FSPYBER */ + { RSTV0910_P2_SFERROR, 0xff }, /* P2_SFERROR */ + /* SFEC P2 Registers */ + { RSTV0910_P2_SFECSTATUS, 0x46 }, /* P2_SFECSTATUS */ + { RSTV0910_P2_SFKDIV12, 0x1f }, /* P2_SFKDIV12 */ + { RSTV0910_P2_SFKDIV23, 0x22 }, /* P2_SFKDIV23 */ + { RSTV0910_P2_SFKDIV34, 0x24 }, /* P2_SFKDIV34 */ + { RSTV0910_P2_SFKDIV56, 0x24 }, /* P2_SFKDIV56 */ + { RSTV0910_P2_SFKDIV67, 0x29 }, /* P2_SFKDIV67 */ + { RSTV0910_P2_SFKDIV78, 0x2c }, /* P2_SFKDIV78 */ + { RSTV0910_P2_SFSTATUS, 0x4e }, /* P2_SFSTATUS */ + { RSTV0910_P2_SFDLYSET2, 0x00 }, /* P2_SFDLYSET2 */ + { RSTV0910_P2_SFERRCTRL, 0x94 }, /* P2_SFERRCTRL */ + { RSTV0910_P2_SFERRCNT2, 0x80 }, /* P2_SFERRCNT2 */ + { RSTV0910_P2_SFERRCNT1, 0x00 }, /* P2_SFERRCNT1 */ + { RSTV0910_P2_SFERRCNT0, 0x00 }, /* P2_SFERRCNT0 */ + + /* DMD P1 Registers */ + { RSTV0910_P1_IQCONST, 0x00 }, /* P1_IQCONST */ + { RSTV0910_P1_NOSCFG, 0x14 }, /* P1_NOSCFG */ + { RSTV0910_P1_ISYMB, 0x0e }, /* P1_ISYMB was 0xfe */ + { RSTV0910_P1_QSYMB, 0xf7 }, /* P1_QSYMB was 0x07 */ + { RSTV0910_P1_AGC1CFG, 0x54 }, /* P1_AGC1CFG */ + { RSTV0910_P1_AGC1CN, 0x99 }, /* P1_AGC1CN */ + { RSTV0910_P1_AGC1REF, 0x58 }, /* P1_AGC1REF */ + { RSTV0910_P1_IDCCOMP, 0x0a }, /* P1_IDCCOMP was 0x09 */ + { RSTV0910_P1_QDCCOMP, 0x09 }, /* P1_QDCCOMP was 0xf6 */ + { RSTV0910_P1_POWERI, 0x09 }, /* P1_POWERI */ + { RSTV0910_P1_POWERQ, 0x0a }, /* P1_POWERQ was 0x09 */ + { RSTV0910_P1_AGC1AMM, 0xfd }, /* P1_AGC1AMM */ + { RSTV0910_P1_AGC1QUAD, 0x05 }, /* P1_AGC1QUAD */ + { RSTV0910_P1_AGCIQIN1, 0x00 }, /* P1_AGCIQIN1 */ + { RSTV0910_P1_AGCIQIN0, 0x00 }, /* P1_AGCIQIN0 */ + /* demodulator registers */ + { RSTV0910_P1_DEMOD, 0x00 }, /* P1_DEMOD auto rolloff, auto spectral inversion, auto DVBs1 rolloff, 35% */ + { RSTV0910_P1_DMDMODCOD, 0x10 }, /* P1_DMDMODCOD mmodcod auto */ +/* { RSTV0910_P1_DSTATUS, 0x10 }, P1_DSTATUS R only */ +/* { RSTV0910_P1_DSTATUS2, 0x80 }, P1_DSTATUS2 R only */ + { RSTV0910_P1_DMDCFGMD, 0xc9 }, /* P1_DMDCFGMD */ + { RSTV0910_P1_DMDCFG2, 0x3b }, /* P1_DMDCFG2 parallel search (DVBS/S2, infinite relock tries, */ + { RSTV0910_P1_DMDISTATE, 0x5c }, /* P1_DMDISTATE */ + { RSTV0910_P1_DMDT0M, 0x40 }, /* P1_DMDT0M */ +/* { RSTV0910_P1_DMDSTATE, 0x1c }, P1_DMDSTATE R only */ +/* { RSTV0910_P1_DMDFLYW, 0x00 }, P1_DMDFLYW R only */ +/* { RSTV0910_P1_DSTATUS3, 0x80 }, P1_DSTATUS3 R only */ + { RSTV0910_P1_DMDCFG3, 0x08 }, /* P1_DMDCFG3 if FIFO is full lose data */ + { RSTV0910_P1_DMDCFG4, 0x04 }, /* P1_DMDCFG4 soft increment of tuner */ + /* correlator registers */ + { RSTV0910_P1_CORRELMANT, 0x78 }, /* P1_CORRELMANT */ + { RSTV0910_P1_CORRELABS, 0x8c }, /* P1_CORRELABS */ + { RSTV0910_P1_CORRELEXP, 0xaa }, /* P1_CORRELEXP */ + { RSTV0910_P1_PLHMODCOD, 0x10 }, /* P1_PLHMODCOD */ + { RSTV0910_P1_DMDREG, 0x01 }, /* P1_DMDREG eliminates 1 frame in 2 if noise high */ + /* AGC regigesters */ + { RSTV0910_P1_AGCNADJ, 0x00 }, /* P1_AGCNADJ */ + { RSTV0910_P1_AGCKS, 0x00 }, /* P1_AGCKS */ + { RSTV0910_P1_AGCKQ, 0x00 }, /* P1_AGCKQ */ + { RSTV0910_P1_AGCK8, 0x00 }, /* P1_AGCK8 */ + { RSTV0910_P1_AGCK16, 0x00 }, /* P1_AGCK16 */ + { RSTV0910_P1_AGCK32, 0x00 }, /* P1_AGCK32 */ + { RSTV0910_P1_AGC2O, 0x5b }, /* P1_AGC2O */ + { RSTV0910_P1_AGC2REF, 0x38 }, /* P1_AGC2REF */ + { RSTV0910_P1_AGC1ADJ, 0x58 }, /* P1_AGC1ADJ */ + { RSTV0910_P1_AGCRSADJ, 0x38 }, /* P1_AGCRSADJ */ + { RSTV0910_P1_AGCRQADJ, 0x38 }, /* P1_AGCRQADJ */ + { RSTV0910_P1_AGCR8ADJ, 0x38 }, /* P1_AGCR8ADJ */ + { RSTV0910_P1_AGCR1ADJ, 0x38 }, /* P1_AGCR1ADJ */ + { RSTV0910_P1_AGCR2ADJ, 0x38 }, /* P1_AGCR2ADJ */ + { RSTV0910_P1_AGCR3ADJ, 0x47 }, /* P1_AGCR3ADJ */ + { RSTV0910_P1_AGCREFADJ, 0x38 }, /* P1_AGCREFADJ */ + { RSTV0910_P1_AGC2I1, 0x1c }, /* P1_AGC2I1 was 0x0b */ + { RSTV0910_P1_AGC2I0, 0x74 }, /* P1_AGC2I0 was 0x61*/ + /* carrier loop registers */ + { RSTV0910_P1_CARCFG, 0x46 }, /* P1_CARCFG de_rotator is active, algorithm=citroes 2 */ + { RSTV0910_P1_ACLC, 0x2b }, /* P1_ACLC alpha=2:0xb mostly fastest DVBS use */ + { RSTV0910_P1_BCLC, 0x1a }, /* P1_BCLC beta=1:0xa DVBS use */ + { RSTV0910_P1_ACLCS2, 0x00 }, /* P1_ACLCS2 */ + { RSTV0910_P1_BCLCS2, 0x00 }, /* P1_BCLCS2 */ + { RSTV0910_P1_CARFREQ, 0x79 }, /* P1_CARFREQ course loop coeff=0x7 (mid) DVBS1 beta freq coeff=0x9 mid */ + { RSTV0910_P1_CARHDR, 0x1c }, /* P1_CARHDR DVBS2 freq_hdr */ + { RSTV0910_P1_LDT, 0xd0 }, /* P1_LDT +ve threshold for lock detect =0xd0 (reset value)*/ + { RSTV0910_P1_LDT2, 0xb8 }, /* P1_LDT2 -ve threshold =0xb8 (reset) */ + { RSTV0910_P1_CFRICFG, 0xf9 }, /* P1_CFRICFG was 0xf8 CFRINIT +ve increments mode */ + { RSTV0910_P1_CFRUP1, 0x0e }, /* P1_CFRUP1 */ + { RSTV0910_P1_CFRUP0, 0x69 }, /* P1_CFRUP0 */ + { RSTV0910_P1_CFRIBASE1, 0x01 }, /* P1_CFRIBASE1 was 0xff */ + { RSTV0910_P1_CFRIBASE0, 0xf5 }, /* P1_CFRIBASE0 was 0x7a */ + { RSTV0910_P1_CFRLOW1, 0xf1 }, /* P1_CFRLOW1 lower limit if not in auto MSByte */ + { RSTV0910_P1_CFRLOW0, 0x97 }, /* P1_CFRLOW0 LSByte */ + { RSTV0910_P1_CFRINIT1, 0x01 }, /* P1_CFRINIT1 was 0xff inital carrier offset MSByte */ + { RSTV0910_P1_CFRINIT0, 0xf5 }, /* P1_CFRINIT0 was 0x7a cfr_init (MHz)=ckadc * CFR_INIT /2^16 LSByte */ + { RSTV0910_P1_CFRINC1, 0x03 }, /* P1_CFRINC1 step size (MHz)=MCLK*CFR_INC/2^13 [13:8} */ + { RSTV0910_P1_CFRINC0, 0x8e }, /* P1_CFRINC0 was 0x10 step size [7:0] + note someting off about spec here .. last 2 bits */ + { RSTV0910_P1_CFR2, 0x01 }, /* P1_CFR2 was 0xff carrier offset (in MHz) - mclk * freq / 2^24 [23:16] */ + { RSTV0910_P1_CFR1, 0xf5 }, /* P1_CFR1 was 0x7a [15:8] */ + { RSTV0910_P1_CFR0, 0x00 }, /* P1_CFR0 [7:0] */ + { RSTV0910_P1_LDI, 0xb6 }, /* P1_LDI carrier lock indicator accumulator. used with LDT/LDT2 to + generate DTSATUS.CAR_LOCK */ + /* timing loop registers */ + { RSTV0910_P1_TMGCFG, 0xd3 }, /* P1_TMGCFG lock indicator fastest, DVBS2 usr SR calculated on 2ns PLHeader + compensate for SR min rate min = 1/2048 MCLK (0.066Msymbols@135MHz) */ + { RSTV0910_P1_RTC, 0x68 }, /* P1_RTC DVBS1 alpha=6 (under mid), beta=8 (mid) */ + { RSTV0910_P1_RTCS2, 0x68 }, /* P1_RTCS2 DVBS2 alpha=6 (under mid), beta=8 (mid) */ + { RSTV0910_P1_TMGTHRISE, 0x1e }, /* P1_TMGTHRISE +ve edge of timing lock indicator used in QUALITY in DSTATUS */ + { RSTV0910_P1_TMGTHFALL, 0x08 }, /* P1_TMGTHFALL -ve edge of timing lock indicator used for QUALITY in DSTATUS */ + { RSTV0910_P1_SFRUPRATIO, 0x20 }, /* P1_SFRUPRATIO was 0x20 updated to 0x01 + ratio=SFR(INIT)*(1+RATIO/256)(course mode) (/65536 in fine mode) + default ratio is 0.125 of SR */ + { RSTV0910_P1_SFRLOWRATIO, 0xd0 }, /* P1_SFRLOWRATIO */ + { RSTV0910_P1_KTTMG, 0xa0 }, /* P1_KTTMG NOT IN DATASHEET */ + { RSTV0910_P1_KREFTMG, 0x80 }, /* P1_KREFTMG refn level for SR course. 0x80=mid level */ + { RSTV0910_P1_SFRSTEP, 0x88 }, /* P1_SFRSTEP scanstep=mid, centerstep=mid */ + { RSTV0910_P1_TMGCFG2, 0x80 }, /* P1_TMGCFG2 */ +/* { RSTV0910_P1_KREFTMG2, 0x80 }, P1_KREFTMG2 R only */ + { RSTV0910_P1_TMGCFG3, 0x06 }, /* P1_TMGCFG3 */ + { RSTV0910_P1_SFRINIT1, 0x38 }, /* P1_SFRINIT1 */ + { RSTV0910_P1_SFRINIT0, 0xe3 }, /* P1_SFRINIT0 */ + { RSTV0910_P1_SFRUP1, 0x3f }, /* P1_SFRUP1 was 0x19 + when in manual mode, upper symbol rate to try MSByte */ + { RSTV0910_P1_SFRUP0, 0xff }, /* P1_SFRUP0 was 0x99 LSByte */ + { RSTV0910_P1_SFRLOW1, 0x2e }, /* P1_SFRLOW1 was 0x12 in manual mode, lower symbol rate to try MSByte */ + { RSTV0910_P1_SFRLOW0, 0x39 }, /* P1_SFRLOW0 was 0x7d LSByte */ + { RSTV0910_P1_SFR3, 0x38 }, /* P1_SFR3 current symbol rate. SR (MHz)=ckadc (135MHz) * SFR/2^32 MSByte */ + { RSTV0910_P1_SFR2, 0xe3 }, /* P1_SFR2 upper mid byte */ + { RSTV0910_P1_SFR1, 0x00 }, /* P1_SFR1 lower mid byte */ + { RSTV0910_P1_SFR0, 0x00 }, /* P1_SFR0 LSByte */ + { RSTV0910_P1_TMGREG2, 0x00 }, /* P1_TMGREG2 timing recovery accumulator, SR offset MSByte */ + { RSTV0910_P1_TMGREG1, 0x00 }, /* P1_TMGREG1 MIDByte */ + { RSTV0910_P1_TMGREG0, 0x00 }, /* P1_TMGREG0 LSByte */ +/* { RSTV0910_P1_TMGLOCK1, 0xe4 }, P1_TMGLOCK1 raw lock info. used to find tmg_lock Quality in DMSTATUS MSB */ +/* { RSTV0910_P1_TMGLOCK0, 0x00 }, P1_TMGLOCK0 LSB */ +/* { RSTV0910_P1_TMGOBS, 0x10 }, P1_TMGOBS timing loop observation: roll off status */ + /* equaliser registers */ + { RSTV0910_P1_EQUALCFG, 0x41 }, /* P1_EQUALCFG */ + { RSTV0910_P1_EQUAI1, 0x00 }, /* P1_EQUAI1 */ + { RSTV0910_P1_EQUAQ1, 0x00 }, /* P1_EQUAQ1 */ + { RSTV0910_P1_EQUAI2, 0x00 }, /* P1_EQUAI2 */ + { RSTV0910_P1_EQUAQ2, 0x00 }, /* P1_EQUAQ2 */ + { RSTV0910_P1_EQUAI3, 0x00 }, /* P1_EQUAI3 */ + { RSTV0910_P1_EQUAQ3, 0x00 }, /* P1_EQUAQ3 */ + { RSTV0910_P1_EQUAI4, 0x00 }, /* P1_EQUAI4 */ + { RSTV0910_P1_EQUAQ4, 0x00 }, /* P1_EQUAQ4 */ + { RSTV0910_P1_EQUAI5, 0x00 }, /* P1_EQUAI5 */ + { RSTV0910_P1_EQUAQ5, 0x00 }, /* P1_EQUAQ5 */ + { RSTV0910_P1_EQUAI6, 0x00 }, /* P1_EQUAI6 */ + { RSTV0910_P1_EQUAQ6, 0x00 }, /* P1_EQUAQ6 */ + { RSTV0910_P1_EQUAI7, 0x00 }, /* P1_EQUAI7 */ + { RSTV0910_P1_EQUAQ7, 0x00 }, /* P1_EQUAQ7 */ + { RSTV0910_P1_EQUAI8, 0x00 }, /* P1_EQUAI8 */ + { RSTV0910_P1_EQUAQ8, 0x00 }, /* P1_EQUAQ8 */ + { RSTV0910_P1_NNOSDATAT1, 0xff }, /* P1_NNOSDATAT1 */ + { RSTV0910_P1_NNOSDATAT0, 0xff }, /* P1_NNOSDATAT0 */ + { RSTV0910_P1_NNOSDATA1, 0xff }, /* P1_NNOSDATA1 */ + { RSTV0910_P1_NNOSDATA0, 0xff }, /* P1_NNOSDATA0 */ + { RSTV0910_P1_NNOSPLHT1, 0xff }, /* P1_NNOSPLHT1 */ + { RSTV0910_P1_NNOSPLHT0, 0xff }, /* P1_NNOSPLHT0 */ + { RSTV0910_P1_NNOSPLH1, 0xff }, /* P1_NNOSPLH1 */ + { RSTV0910_P1_NNOSPLH0, 0xff }, /* P1_NNOSPLH0 */ + { RSTV0910_P1_NOSDATAT1, 0xff }, /* P1_NOSDATAT1 */ + { RSTV0910_P1_NOSDATAT0, 0xff }, /* P1_NOSDATAT0 */ + { RSTV0910_P1_NNOSFRAME1, 0xff }, /* P1_NNOSFRAME1 */ + { RSTV0910_P1_NNOSFRAME0, 0xff }, /* P1_NNOSFRAME0 */ + { RSTV0910_P1_NNOSRAD1, 0x00 }, /* P1_NNOSRAD1 */ + { RSTV0910_P1_NNOSRAD0, 0x00 }, /* P1_NNOSRAD0 */ + { RSTV0910_P1_NOSCFGF1, 0x00 }, /* P1_NOSCFGF1 */ + { RSTV0910_P1_NOSCFGF2, 0x00 }, /* P1_NOSCFGF2 */ + { RSTV0910_P1_CAR2CFG, 0x06 }, /* P1_CAR2CFG */ + { RSTV0910_P1_CFR2CFR1, 0xe5 }, /* P1_CFR2CFR1 */ + { RSTV0910_P1_CAR3CFG, 0x02 }, /* P1_CAR3CFG */ + { RSTV0910_P1_CFR22, 0x00 }, /* P1_CFR22 */ + { RSTV0910_P1_CFR21, 0x00 }, /* P1_CFR21 */ + { RSTV0910_P1_CFR20, 0x00 }, /* P1_CFR20 */ + { RSTV0910_P1_ACLC2S2Q, 0x0b }, /* P1_ACLC2S2Q */ + { RSTV0910_P1_ACLC2S28, 0x0a }, /* P1_ACLC2S28 */ + { RSTV0910_P1_ACLC2S216A, 0x49 }, /* P1_ACLC2S216A */ + { RSTV0910_P1_ACLC2S232A, 0x48 }, /* P1_ACLC2S232A */ + { RSTV0910_P1_BCLC2S2Q, 0x84 }, /* P1_BCLC2S2Q */ + { RSTV0910_P1_BCLC2S28, 0x84 }, /* P1_BCLC2S28 */ + { RSTV0910_P1_BCLC2S216A, 0x84 }, /* P1_BCLC2S216A */ + { RSTV0910_P1_BCLC2S232A, 0x84 }, /* P1_BCLC2S232A */ + { RSTV0910_P1_PLROOT2, 0x00 }, /* P1_PLROOT2 */ + { RSTV0910_P1_PLROOT1, 0x00 }, /* P1_PLROOT1 */ + { RSTV0910_P1_PLROOT0, 0x01 }, /* P1_PLROOT0 */ + { RSTV0910_P1_MODCODLST0, 0xff }, /* P1_MODCODLST0 */ + { RSTV0910_P1_MODCODLST1, 0xfc }, /* P1_MODCODLST1 was 0xcf */ + { RSTV0910_P1_MODCODLST2, 0x00 }, /* P1_MODCODLST2 was 0xff */ + { RSTV0910_P1_MODCODLST3, 0x00 }, /* P1_MODCODLST3 was 0xff */ + { RSTV0910_P1_MODCODLST4, 0x00 }, /* P1_MODCODLST4 */ + { RSTV0910_P1_MODCODLST5, 0x00 }, /* P1_MODCODLST5 */ + { RSTV0910_P1_MODCODLST6, 0x00 }, /* P1_MODCODLST6 */ + { RSTV0910_P1_MODCODLST7, 0xc0 }, /* P1_MODCODLST7 */ + { RSTV0910_P1_MODCODLST8, 0x00 }, /* P1_MODCODLST8 */ + { RSTV0910_P1_MODCODLST9, 0x00 }, /* P1_MODCODLST9 */ + { RSTV0910_P1_MODCODLSTA, 0xc0 }, /* P1_MODCODLSTA */ + { RSTV0910_P1_MODCODLSTB, 0x00 }, /* P1_MODCODLSTB */ + { RSTV0910_P1_MODCODLSTC, 0x00 }, /* P1_MODCODLSTC */ + { RSTV0910_P1_MODCODLSTD, 0x00 }, /* P1_MODCODLSTD */ + { RSTV0910_P1_MODCODLSTE, 0x00 }, /* P1_MODCODLSTE */ + { RSTV0910_P1_MODCODLSTF, 0x0f }, /* P1_MODCODLSTF */ + { RSTV0910_P1_GAUSSR0, 0x98 }, /* P1_GAUSSR0 */ + { RSTV0910_P1_CCIR0, 0x30 }, /* P1_CCIR0 */ + { RSTV0910_P1_CCIQUANT, 0xac }, /* P1_CCIQUANT */ + { RSTV0910_P1_CCITHRES, 0x50 }, /* P1_CCITHRES */ + { RSTV0910_P1_CCIACC, 0x00 }, /* P1_CCIACC */ + { RSTV0910_P1_DSTATUS4, 0x64 }, /* P1_DSTATUS4 */ + { RSTV0910_P1_DMDRESCFG, 0x29 }, /* P1_DMDRESCFG */ + { RSTV0910_P1_DMDRESADR, 0x00 }, /* P1_DMDRESADR */ + { RSTV0910_P1_DMDRESDATA7, 0x00 }, /* P1_DMDRESDATA7 */ + { RSTV0910_P1_DMDRESDATA6, 0x00 }, /* P1_DMDRESDATA6 */ + { RSTV0910_P1_DMDRESDATA5, 0x00 }, /* P1_DMDRESDATA5 */ + { RSTV0910_P1_DMDRESDATA4, 0x00 }, /* P1_DMDRESDATA4 */ + { RSTV0910_P1_DMDRESDATA3, 0x00 }, /* P1_DMDRESDATA3 */ + { RSTV0910_P1_DMDRESDATA2, 0x00 }, /* P1_DMDRESDATA2 */ + { RSTV0910_P1_DMDRESDATA1, 0x00 }, /* P1_DMDRESDATA1 */ + { RSTV0910_P1_DMDRESDATA0, 0x00 }, /* P1_DMDRESDATA0 */ + { RSTV0910_P1_FFEI1, 0x00 }, /* P1_FFEI1 */ + { RSTV0910_P1_FFEQ1, 0x00 }, /* P1_FFEQ1 */ + { RSTV0910_P1_FFEI2, 0x00 }, /* P1_FFEI2 */ + { RSTV0910_P1_FFEQ2, 0x00 }, /* P1_FFEQ2 */ + { RSTV0910_P1_FFEI3, 0x00 }, /* P1_FFEI3 */ + { RSTV0910_P1_FFEQ3, 0x00 }, /* P1_FFEQ3 */ + { RSTV0910_P1_FFEI4, 0x00 }, /* P1_FFEI4 */ + { RSTV0910_P1_FFEQ4, 0x00 }, /* P1_FFEQ4 */ + { RSTV0910_P1_FFECFG, 0x71 }, /* P1_FFECFG */ + /* TUN Register */ + { RSTV0910_P1_TNRCFG2, 0x02 }, /* P1_TNRCFG2 */ + { RSTV0910_P1_SMAPCOEF7, 0x00 }, /* P1_SMAPCOEF7 */ + { RSTV0910_P1_SMAPCOEF6, 0x00 }, /* P1_SMAPCOEF6 */ + { RSTV0910_P1_SMAPCOEF5, 0x00 }, /* P1_SMAPCOEF5 */ + { RSTV0910_P1_SMAPCOEF4, 0x00 }, /* P1_SMAPCOEF4 */ + { RSTV0910_P1_SMAPCOEF3, 0x00 }, /* P1_SMAPCOEF3 */ + { RSTV0910_P1_SMAPCOEF2, 0x00 }, /* P1_SMAPCOEF2 */ + { RSTV0910_P1_SMAPCOEF1, 0x00 }, /* P1_SMAPCOEF1 */ + { RSTV0910_P1_SMAPCOEF0, 0x71 }, /* P1_SMAPCOEF0 */ + { RSTV0910_P1_NOSTHRES1, 0x60 }, /* P1_NOSTHRES1 */ + { RSTV0910_P1_NOSTHRES2, 0x69 }, /* P1_NOSTHRES2 */ + { RSTV0910_P1_NOSDIFF1, 0x80 }, /* P1_NOSDIFF1 */ + { RSTV0910_P1_RAINFADE, 0x35 }, /* P1_RAINFADE */ + { RSTV0910_P1_NOSRAMCFG, 0x28 }, /* P1_NOSRAMCFG */ + { RSTV0910_P1_NOSRAMPOS, 0x26 }, /* P1_NOSRAMPOS */ + { RSTV0910_P1_NOSRAMVAL, 0x86 }, /* P1_NOSRAMVAL */ + { RSTV0910_P1_DMDPLHSTAT, 0x00 }, /* P1_DMDPLHSTAT */ + { RSTV0910_P1_LOCKTIME3, 0xc0 }, /* P1_LOCKTIME3 */ + { RSTV0910_P1_LOCKTIME2, 0xd2 }, /* P1_LOCKTIME2 was 0xd1 */ + { RSTV0910_P1_LOCKTIME1, 0x3b }, /* P1_LOCKTIME1 was 0x05 */ + { RSTV0910_P1_LOCKTIME0, 0x46 }, /* P1_LOCKTIME0 was 0xc8 */ + /* DVB1 P1 Registers */ + { RSTV0910_P1_VITSCALE, 0x80 }, /* P1_VITSCALE */ + { RSTV0910_P1_FECM, 0x00 }, /* P1_FECM */ + { RSTV0910_P1_VTH12, 0xd7 }, /* P1_VTH12 */ + { RSTV0910_P1_VTH23, 0x85 }, /* P1_VTH23 */ + { RSTV0910_P1_VTH34, 0x58 }, /* P1_VTH34 */ + { RSTV0910_P1_VTH56, 0x3a }, /* P1_VTH56 */ + { RSTV0910_P1_VTH67, 0x34 }, /* P1_VTH67 */ + { RSTV0910_P1_VTH78, 0x28 }, /* P1_VTH78 */ + { RSTV0910_P1_VITCURPUN, 0x0d }, /* P1_VITCURPUN */ + { RSTV0910_P1_VERROR, 0xff }, /* P1_VERROR */ + { RSTV0910_P1_PRVIT, 0x2f }, /* P1_PRVIT */ + { RSTV0910_P1_VAVSRVIT, 0x00 }, /* P1_VAVSRVIT */ + { RSTV0910_P1_VSTATUSVIT, 0xa6 }, /* P1_VSTATUSVIT was 0xa4 */ + { RSTV0910_P1_VTHINUSE, 0xd7 }, /* P1_VTHINUSE */ + { RSTV0910_P1_KDIV12, 0x27 }, /* P1_KDIV12 */ + { RSTV0910_P1_KDIV23, 0x32 }, /* P1_KDIV23 */ + { RSTV0910_P1_KDIV34, 0x32 }, /* P1_KDIV34 */ + { RSTV0910_P1_KDIV56, 0x32 }, /* P1_KDIV56 */ + { RSTV0910_P1_KDIV67, 0x32 }, /* P1_KDIV67 */ + { RSTV0910_P1_KDIV78, 0x50 }, /* P1_KDIV78 */ + { RSTV0910_P1_TSPIDFLT1, 0x00 }, /* P1_TSPIDFLT1 */ + { RSTV0910_P1_TSPIDFLT0, 0x00 }, /* P1_TSPIDFLT0 */ + /* DVB2 P1 Registers */ + { RSTV0910_P1_PDELCTRL0, 0x01 }, /* P1_PDELCTRL0 */ + { RSTV0910_P1_PDELCTRL1, 0x00 }, /* P1_PDELCTRL1 */ + { RSTV0910_P1_PDELCTRL2, 0x20 }, /* P1_PDELCTRL2 was 0x00 */ + { RSTV0910_P1_HYSTTHRESH, 0x41 }, /* P1_HYSTTHRESH */ + { RSTV0910_P1_UPLCCST0, 0xe6 }, /* P1_UPLCCST0 */ + { RSTV0910_P1_ISIENTRY, 0x00 }, /* P1_ISIENTRY */ + { RSTV0910_P1_ISIBITENA, 0x00 }, /* P1_ISIBITENA */ + { RSTV0910_P1_MATSTR1, 0xf0 }, /* P1_MATSTR1 */ + { RSTV0910_P1_MATSTR0, 0x00 }, /* P1_MATSTR0 */ + { RSTV0910_P1_UPLSTR1, 0x05 }, /* P1_UPLSTR1 */ + { RSTV0910_P1_UPLSTR0, 0xe0 }, /* P1_UPLSTR0 */ + { RSTV0910_P1_DFLSTR1, 0x7d }, /* P1_DFLSTR1 */ + { RSTV0910_P1_DFLSTR0, 0x80 }, /* P1_DFLSTR0 */ + { RSTV0910_P1_SYNCSTR, 0x47 }, /* P1_SYNCSTR */ + { RSTV0910_P1_SYNCDSTR1, 0x00 }, /* P1_SYNCDSTR1 */ + { RSTV0910_P1_SYNCDSTR0, 0x00 }, /* P1_SYNCDSTR0 */ + { RSTV0910_P1_PDELSTATUS1, 0x94 }, /* P1_PDELSTATUS1 */ + { RSTV0910_P1_PDELSTATUS2, 0x92 }, /* P1_PDELSTATUS2 was 0x12 */ + { RSTV0910_P1_BBFCRCKO1, 0x00 }, /* P1_BBFCRCKO1 */ + { RSTV0910_P1_BBFCRCKO0, 0x00 }, /* P1_BBFCRCKO0 */ + { RSTV0910_P1_UPCRCKO1, 0x00 }, /* P1_UPCRCKO1 */ + { RSTV0910_P1_UPCRCKO0, 0x00 }, /* P1_UPCRCKO0 */ + { RSTV0910_P1_PDELCTRL3, 0x00 }, /* P1_PDELCTRL3 */ + /* TS P1 Registers */ + { RSTV0910_P1_TSSTATEM, 0xf0 }, /* P1_TSSTATEM deinterleaver on, reed-solomon on, descrambler on, + TS enabled, immediate output of data*/ + { RSTV0910_P1_TSSTATEL, 0x12 }, /* P1_TSSTATEL */ + { RSTV0910_P1_TSCFGH, 0x80 }, /* P1_TSCFGH was 0x40 + DVBCI mode, max granularity, parallel output, no headers, + label error packets */ + { RSTV0910_P1_TSCFGM, 0x04 }, /* P1_TSCFGM auto speed, d0-d7 not switched, no invert */ + { RSTV0910_P1_TSCFGL, 0x20 }, /* P1_TSCFGL no delay on clkout, error mode=0b10, d/p=1 suring header and footer + don't load legacy, auto bitspeed */ + { RSTV0910_P1_TSSYNC, 0x00 }, /* P1_TSSYNC */ + { RSTV0910_P1_TSINSDELH, 0x00 }, /* P1_TSINSDELH */ + { RSTV0910_P1_TSINSDELM, 0x00 }, /* P1_TSINSDELM */ + { RSTV0910_P1_TSINSDELL, 0x00 }, /* P1_TSINSDELL */ + { RSTV0910_P1_TSDIVN, 0x03 }, /* P1_TSDIVN */ + { RSTV0910_P1_TSCFG4, 0x00 }, /* P1_TSCFG4 */ + { RSTV0910_P1_TSSPEED, 0x33 }, /* P1_TSSPEED was 0xff */ + { RSTV0910_P1_TSSTATUS, 0x52 }, /* P1_TSSTATUS R Only */ + { RSTV0910_P1_TSSTATUS2, 0x02 }, /* P1_TSSTATUS2 was 0xa8 */ + { RSTV0910_P1_TSBITRATE1, 0x00 }, /* P1_TSBITRATE1 */ + { RSTV0910_P1_TSBITRATE0, 0x03 }, /* P1_TSBITRATE0 */ + { RSTV0910_P1_TSPACKLEN1, 0x00 }, /* P1_TSPACKLEN1 */ + { RSTV0910_P1_TSDLY2, 0x00 }, /* P1_TSDLY2 */ + { RSTV0910_P1_TSDLY1, 0x00 }, /* P1_TSDLY1 */ + { RSTV0910_P1_TSDLY0, 0x00 }, /* P1_TSDLY0 */ + { RSTV0910_P1_TSNPDAV, 0x00 }, /* P1_TSNPDAV */ + { RSTV0910_P1_TSBUFSTAT2, 0x00 }, /* P1_TSBUFSTAT2 */ + { RSTV0910_P1_TSBUFSTAT1, 0x00 }, /* P1_TSBUFSTAT1 */ + { RSTV0910_P1_TSBUFSTAT0, 0x00 }, /* P1_TSBUFSTAT0 */ + { RSTV0910_P1_TSDEBUGL, 0x04 }, /* P1_TSDEBUGL */ + { RSTV0910_P1_TSDLYSET2, 0x01 }, /* P1_TSDLYSET2 */ + { RSTV0910_P1_TSDLYSET1, 0x18 }, /* P1_TSDLYSET1 */ + { RSTV0910_P1_TSDLYSET0, 0x00 }, /* P1_TSDLYSET0 */ + { RSTV0910_P1_ERRCTRL1, 0x67 }, /* P1_ERRCTRL1 */ + { RSTV0910_P1_ERRCNT12, 0x00 }, /* P1_ERRCNT12 */ + { RSTV0910_P1_ERRCNT11, 0x00 }, /* P1_ERRCNT11 */ + { RSTV0910_P1_ERRCNT10, 0x00 }, /* P1_ERRCNT10 */ + { RSTV0910_P1_ERRCTRL2, 0xc1 }, /* P1_ERRCTRL2 */ + { RSTV0910_P1_ERRCNT22, 0x00 }, /* P1_ERRCNT22 */ + { RSTV0910_P1_ERRCNT21, 0x00 }, /* P1_ERRCNT21 */ + { RSTV0910_P1_ERRCNT20, 0x00 }, /* P1_ERRCNT20 */ + { RSTV0910_P1_FECSPY, 0xa8 }, /* P1_FECSPY enable, serial mode, BER, lmode=0, Normal operation */ + { RSTV0910_P1_FSPYCFG, 0x2c }, /* P1_FSPYCFG */ + { RSTV0910_P1_FSPYDATA, 0x3a }, /* P1_FSPYDATA */ + { RSTV0910_P1_FSPYOUT, 0x07 }, /* P1_FSPYOUT */ + { RSTV0910_P1_FSTATUS, 0x00 }, /* P1_FSTATUS */ + { RSTV0910_P1_FBERCPT4, 0x00 }, /* P1_FBERCPT4 */ + { RSTV0910_P1_FBERCPT3, 0x00 }, /* P1_FBERCPT3 */ + { RSTV0910_P1_FBERCPT2, 0x00 }, /* P1_FBERCPT2 */ + { RSTV0910_P1_FBERCPT1, 0x00 }, /* P1_FBERCPT1 */ + { RSTV0910_P1_FBERCPT0, 0x00 }, /* P1_FBERCPT0 */ + { RSTV0910_P1_FBERERR2, 0x00 }, /* P1_FBERERR2 */ + { RSTV0910_P1_FBERERR1, 0x00 }, /* P1_FBERERR1 */ + { RSTV0910_P1_FBERERR0, 0x00 }, /* P1_FBERERR0 */ + { RSTV0910_P1_FSPYBER, 0x12 }, /* P1_FSPYBER was 0x11, set couting to 2^15 bytes */ + { RSTV0910_P1_SFERROR, 0xff }, /* P1_SFERROR */ + /* SFEC P1 Registers */ + { RSTV0910_P1_SFECSTATUS, 0x46 }, /* P1_SFECSTATUS was 0x44 */ + { RSTV0910_P1_SFKDIV12, 0x1f }, /* P1_SFKDIV12 */ + { RSTV0910_P1_SFKDIV23, 0x22 }, /* P1_SFKDIV23 */ + { RSTV0910_P1_SFKDIV34, 0x24 }, /* P1_SFKDIV34 */ + { RSTV0910_P1_SFKDIV56, 0x24 }, /* P1_SFKDIV56 */ + { RSTV0910_P1_SFKDIV67, 0x29 }, /* P1_SFKDIV67 */ + { RSTV0910_P1_SFKDIV78, 0x2c }, /* P1_SFKDIV78 */ + { RSTV0910_P1_SFSTATUS, 0x4e }, /* P1_SFSTATUS was 0x46 */ + { RSTV0910_P1_SFDLYSET2, 0x00 }, /* P1_SFDLYSET2 */ + { RSTV0910_P1_SFERRCTRL, 0x94 }, /* P1_SFERRCTRL */ + { RSTV0910_P1_SFERRCNT2, 0x80 }, /* P1_SFERRCNT2 */ + { RSTV0910_P1_SFERRCNT1, 0x00 }, /* P1_SFERRCNT1 */ + { RSTV0910_P1_SFERRCNT0, 0x00 }, /* P1_SFERRCNT0 */ + + /* RC registers */ + { RSTV0910_RCCFG2, 0x60 }, /* RCCFG2 */ + { RSTV0910_RCCFG1, 0x00 }, /* RCCFG1 */ + { RSTV0910_RCCFG0, 0x00 }, /* RCCFG0 */ + { RSTV0910_RCINSDEL2, 0x00 }, /* RCINSDEL2 */ + { RSTV0910_RCINSDEL1, 0x00 }, /* RCINSDEL1 */ + { RSTV0910_RCINSDEL0, 0x00 }, /* RCINSDEL0 */ + { RSTV0910_RCSTATUS, 0x00 }, /* RCSTATUS */ + { RSTV0910_RCSPEED, 0xff }, /* RCSPEED */ + + { RSTV0910_TSGENERAL, 0x00 }, /* TSGENERAL enable output of second line in parallel line + override tsfifo_permparal and defineline1->TS3, line2->TS2,RCline->TS1 + tsfifo_perparal defines line1-> TS3, line2->TS2, RC LIne->TS1 */ + /* DISEQC P1 Registers */ + { RSTV0910_P1_DISIRQCFG, 0x00 }, /* P1_DISIRQCFG */ +/* { RSTV0910_P1_DISIRQSTAT, 0x00 }, P1_DISIRQSTAT R only */ + { RSTV0910_P1_DISTXCFG, 0x02 }, /* P1_DISTXCFG */ +/* { RSTV0910_P1_DISTXSTATUS, 0x20 }, P1_DISTXSTATUS R only */ +/* { RSTV0910_P1_DISTXBYTES, 0x00 }, P1_DISTXBYTES R only */ + { RSTV0910_P1_DISTXFIFO, 0x00 }, /* P1_DISTXFIFO */ + { RSTV0910_P1_DISTXF22, 0xc0 }, /* P1_DISTXF22 */ + { RSTV0910_P1_DISTIMEOCFG, 0x02 }, /* P1_DISTIMEOCFG */ + { RSTV0910_P1_DISTIMEOUT, 0x8c }, /* P1_DISTIMEOUT */ + { RSTV0910_P1_DISRXCFG, 0x34 }, /* P1_DISRXCFG */ +/* { RSTV0910_P1_DISRXSTAT1, 0x04 }, P1_DISRXSTAT1 R only */ +/* { RSTV0910_P1_DISRXSTAT0, 0x00 }, P1_DISRXSTAT0 R only */ +/* { RSTV0910_P1_DISRXBYTES, 0x00 }, P1_DISRXBYTES R only */ +/* { RSTV0910_P1_DISRXPARITY1, 0x00 }, P1_DISRXPARITY1 R only */ +/* { RSTV0910_P1_DISRXPARITY0, 0x00 }, P1_DISRXPARITY0 R only */ + { RSTV0910_P1_DISRXFIFO, 0x00 }, /* P1_DISRXFIFO */ +/* { RSTV0910_P1_DISRXDC1, 0x03 }, P1_DISRXDC1 R only */ +/* { RSTV0910_P1_DISRXDC0, 0xf1 }, P1_DISRXDC0 R only was 0xf6 */ + { RSTV0910_P1_DISRXF221, 0x01 }, /* P1_DISRXF221 */ + { RSTV0910_P1_DISRXF220, 0x2b }, /* P1_DISRXF220 */ + { RSTV0910_P1_DISRXF100, 0xa9 }, /* P1_DISRXF100 */ + { RSTV0910_P1_DISRXSHORT22K, 0x0f }, /* P1_DISRXSHORT22K */ + + /* P1 aux clock control registers */ + { RSTV0910_P1_ACRPRESC, 0x01 }, /* P1_ACRPRESC auxiliary clock - not used */ + { RSTV0910_P1_ACRDIV, 0x14 }, /* P1_ACRDIV auxiliary clock - not used */ + + /* DISEQC P2 Registers */ + { RSTV0910_P2_DISIRQCFG, 0x00 }, /* P2_DISIRQCFG as above for P2 */ +/* { RSTV0910_P2_DISIRQSTAT, 0x00 }, P2_DISIRQSTAT */ + { RSTV0910_P2_DISTXCFG, 0x02 }, /* P2_DISTXCFG */ +/* { RSTV0910_P2_DISTXSTATUS, 0x20 }, P2_DISTXSTATUS */ +/* { RSTV0910_P2_DISTXBYTES, 0x00 }, P2_DISTXBYTES */ + { RSTV0910_P2_DISTXFIFO, 0x00 }, /* P2_DISTXFIFO */ + { RSTV0910_P2_DISTXF22, 0xc0 }, /* P2_DISTXF22 */ + { RSTV0910_P2_DISTIMEOCFG, 0x02 }, /* P2_DISTIMEOCFG */ + { RSTV0910_P2_DISTIMEOUT, 0x8c }, /* P2_DISTIMEOUT */ + { RSTV0910_P2_DISRXCFG, 0x34 }, /* P2_DISRXCFG */ +/* { RSTV0910_P2_DISRXSTAT1, 0x04 }, P2_DISRXSTAT1 */ +/* { RSTV0910_P2_DISRXSTAT0, 0x00 }, P2_DISRXSTAT0 */ +/* { RSTV0910_P2_DISRXBYTES, 0x00 }, P2_DISRXBYTES */ +/* { RSTV0910_P2_DISRXPARITY1, 0x00 }, P2_DISRXPARITY1 */ +/* { RSTV0910_P2_DISRXPARITY0, 0x00 }, P2_DISRXPARITY0 */ + { RSTV0910_P2_DISRXFIFO, 0x00 }, /* P2_DISRXFIFO */ +/* { RSTV0910_P2_DISRXDC1, 0x03 }, P2_DISRXDC1 */ +/* { RSTV0910_P2_DISRXDC0, 0xf1 }, P2_DISRXDC0 */ + { RSTV0910_P2_DISRXF221, 0x01 }, /* P2_DISRXF221 */ + { RSTV0910_P2_DISRXF220, 0x2b }, /* P2_DISRXF220 */ + { RSTV0910_P2_DISRXF100, 0xa9 }, /* P2_DISRXF100 */ + { RSTV0910_P2_DISRXSHORT22K, 0x0f }, /* P2_DISRXSHORT22K */ + + /* P2 aux clock control registers */ + { RSTV0910_P2_ACRPRESC, 0x01 }, /* P2_ACRPRESC auxiliary clock - not used */ + { RSTV0910_P2_ACRDIV, 0x14 }, /* P2_ACRDIV auxiliary clock - not used */ + + /* P1 NBITER registers */ + { RSTV0910_P1_NBITER_NF1, 0x1c }, /* P1_NBITER_NF1 */ + { RSTV0910_P1_NBITER_NF2, 0x19 }, /* P1_NBITER_NF2 */ + { RSTV0910_P1_NBITER_NF3, 0x17 }, /* P1_NBITER_NF3 */ + { RSTV0910_P1_NBITER_NF4, 0x18 }, /* P1_NBITER_NF4 */ + { RSTV0910_P1_NBITER_NF5, 0x13 }, /* P1_NBITER_NF5 */ + { RSTV0910_P1_NBITER_NF6, 0x19 }, /* P1_NBITER_NF6 */ + { RSTV0910_P1_NBITER_NF7, 0x18 }, /* P1_NBITER_NF7 */ + { RSTV0910_P1_NBITER_NF8, 0x17 }, /* P1_NBITER_NF8 */ + { RSTV0910_P1_NBITER_NF9, 0x16 }, /* P1_NBITER_NF9 */ + { RSTV0910_P1_NBITER_NF10, 0x1c }, /* P1_NBITER_NF10 */ + { RSTV0910_P1_NBITER_NF11, 0x1c }, /* P1_NBITER_NF11 */ + { RSTV0910_P1_NBITER_NF12, 0x13 }, /* P1_NBITER_NF12 */ + { RSTV0910_P1_NBITER_NF13, 0x19 }, /* P1_NBITER_NF13 */ + { RSTV0910_P1_NBITER_NF14, 0x18 }, /* P1_NBITER_NF14 */ + { RSTV0910_P1_NBITER_NF15, 0x16 }, /* P1_NBITER_NF15 */ + { RSTV0910_P1_NBITER_NF16, 0x1c }, /* P1_NBITER_NF16 */ + { RSTV0910_P1_NBITER_NF17, 0x1c }, /* P1_NBITER_NF17 */ + { RSTV0910_P1_NBITER_NF18, 0x19 }, /* P1_NBITER_NF18 */ + { RSTV0910_P1_NBITER_NF19, 0x18 }, /* P1_NBITER_NF19 */ + { RSTV0910_P1_NBITER_NF20, 0x17 }, /* P1_NBITER_NF20 */ + { RSTV0910_P1_NBITER_NF21, 0x16 }, /* P1_NBITER_NF21 */ + { RSTV0910_P1_NBITER_NF22, 0x1c }, /* P1_NBITER_NF22 */ + { RSTV0910_P1_NBITER_NF23, 0x1c }, /* P1_NBITER_NF23 */ + { RSTV0910_P1_NBITER_NF24, 0x18 }, /* P1_NBITER_NF24 */ + { RSTV0910_P1_NBITER_NF25, 0x17 }, /* P1_NBITER_NF25 */ + { RSTV0910_P1_NBITER_NF26, 0x16 }, /* P1_NBITER_NF26 */ + { RSTV0910_P1_NBITER_NF27, 0x1c }, /* P1_NBITER_NF27 */ + { RSTV0910_P1_NBITER_NF28, 0x1c }, /* P1_NBITER_NF28 */ + { RSTV0910_P1_NBITER_SF1, 0x1b }, /* P1_NBITER_SF1 */ + { RSTV0910_P1_NBITER_SF2, 0x19 }, /* P1_NBITER_SF2 */ + { RSTV0910_P1_NBITER_SF3, 0x17 }, /* P1_NBITER_SF3 */ + { RSTV0910_P1_NBITER_SF4, 0x1a }, /* P1_NBITER_SF4 */ + { RSTV0910_P1_NBITER_SF5, 0x13 }, /* P1_NBITER_SF5 */ + { RSTV0910_P1_NBITER_SF6, 0x19 }, /* P1_NBITER_SF6 */ + { RSTV0910_P1_NBITER_SF7, 0x1b }, /* P1_NBITER_SF7 */ + { RSTV0910_P1_NBITER_SF8, 0x1d }, /* P1_NBITER_SF8 */ + { RSTV0910_P1_NBITER_SF9, 0x1b }, /* P1_NBITER_SF9 */ + { RSTV0910_P1_NBITER_SF10, 0x1c }, /* P1_NBITER_SF10 */ + { RSTV0910_P1_NBITER_SF12, 0x13 }, /* P1_NBITER_SF12 */ + { RSTV0910_P1_NBITER_SF13, 0x19 }, /* P1_NBITER_SF13 */ + { RSTV0910_P1_NBITER_SF14, 0x1b }, /* P1_NBITER_SF14 */ + { RSTV0910_P1_NBITER_SF15, 0x1b }, /* P1_NBITER_SF15 */ + { RSTV0910_P1_NBITER_SF16, 0x1c }, /* P1_NBITER_SF16 */ + { RSTV0910_P1_NBITER_SF18, 0x19 }, /* P1_NBITER_SF18 */ + { RSTV0910_P1_NBITER_SF19, 0x1b }, /* P1_NBITER_SF19 */ + { RSTV0910_P1_NBITER_SF20, 0x1d }, /* P1_NBITER_SF20 */ + { RSTV0910_P1_NBITER_SF21, 0x1b }, /* P1_NBITER_SF21 */ + { RSTV0910_P1_NBITER_SF22, 0x1c }, /* P1_NBITER_SF22 */ + { RSTV0910_P1_NBITER_SF24, 0x1b }, /* P1_NBITER_SF24 */ + { RSTV0910_P1_NBITER_SF25, 0x1d }, /* P1_NBITER_SF25 */ + { RSTV0910_P1_NBITER_SF26, 0x1b }, /* P1_NBITER_SF26 */ + { RSTV0910_P1_NBITER_SF27, 0x1c }, /* P1_NBITER_SF27 */ + + { RSTV0910_SELSATUR6, 0x05 }, /* SELSATUR6 */ + { RSTV0910_SELSATUR5, 0x5b }, /* SELSATUR5 */ + { RSTV0910_SELSATUR4, 0x96 }, /* SELSATUR4 */ + { RSTV0910_SELSATUR3, 0x00 }, /* SELSATUR3 */ + { RSTV0910_SELSATUR2, 0x00 }, /* SELSATUR2 */ + { RSTV0910_SELSATUR1, 0x00 }, /* SELSATUR1 */ + { RSTV0910_SELSATUR0, 0x00 }, /* SELSATUR0 */ + { RSTV0910_GAINLLR_NF1, 0x20 }, /* GAINLLR_NF1 */ + { RSTV0910_GAINLLR_NF2, 0x20 }, /* GAINLLR_NF2 */ + { RSTV0910_GAINLLR_NF3, 0x20 }, /* GAINLLR_NF3 */ + { RSTV0910_GAINLLR_NF4, 0x20 }, /* GAINLLR_NF4 */ + { RSTV0910_GAINLLR_NF5, 0x20 }, /* GAINLLR_NF5 */ + { RSTV0910_GAINLLR_NF6, 0x20 }, /* GAINLLR_NF6 */ + { RSTV0910_GAINLLR_NF7, 0x20 }, /* GAINLLR_NF7 */ + { RSTV0910_GAINLLR_NF8, 0x20 }, /* GAINLLR_NF8 */ + { RSTV0910_GAINLLR_NF9, 0x20 }, /* GAINLLR_NF9 */ + { RSTV0910_GAINLLR_NF10, 0x20 }, /* GAINLLR_NF10 */ + { RSTV0910_GAINLLR_NF11, 0x20 }, /* GAINLLR_NF11 */ + { RSTV0910_GAINLLR_NF12, 0x20 }, /* GAINLLR_NF12 */ + { RSTV0910_GAINLLR_NF13, 0x20 }, /* GAINLLR_NF13 */ + { RSTV0910_GAINLLR_NF14, 0x20 }, /* GAINLLR_NF14 */ + { RSTV0910_GAINLLR_NF15, 0x20 }, /* GAINLLR_NF15 */ + { RSTV0910_GAINLLR_NF16, 0x20 }, /* GAINLLR_NF16 */ + { RSTV0910_GAINLLR_NF17, 0x20 }, /* GAINLLR_NF17 */ + { RSTV0910_GAINLLR_NF18, 0x22 }, /* GAINLLR_NF18 */ + { RSTV0910_GAINLLR_NF19, 0x22 }, /* GAINLLR_NF19 */ + { RSTV0910_GAINLLR_NF20, 0x24 }, /* GAINLLR_NF20 */ + { RSTV0910_GAINLLR_NF21, 0x24 }, /* GAINLLR_NF21 */ + { RSTV0910_GAINLLR_NF22, 0x25 }, /* GAINLLR_NF22 */ + { RSTV0910_GAINLLR_NF23, 0x26 }, /* GAINLLR_NF23 */ + { RSTV0910_GAINLLR_NF24, 0x20 }, /* GAINLLR_NF24 */ + { RSTV0910_GAINLLR_NF25, 0x20 }, /* GAINLLR_NF25 */ + { RSTV0910_GAINLLR_NF26, 0x20 }, /* GAINLLR_NF26 */ + { RSTV0910_GAINLLR_NF27, 0x20 }, /* GAINLLR_NF27 */ + { RSTV0910_GAINLLR_NF28, 0x20 }, /* GAINLLR_NF28 */ + { RSTV0910_GAINLLR_SF1, 0x20 }, /* GAINLLR_SF1 */ + { RSTV0910_GAINLLR_SF2, 0x20 }, /* GAINLLR_SF2 */ + { RSTV0910_GAINLLR_SF3, 0x20 }, /* GAINLLR_SF3 */ + { RSTV0910_GAINLLR_SF4, 0x20 }, /* GAINLLR_SF4 */ + { RSTV0910_GAINLLR_SF5, 0x20 }, /* GAINLLR_SF5 */ + { RSTV0910_GAINLLR_SF6, 0x20 }, /* GAINLLR_SF6 */ + { RSTV0910_GAINLLR_SF7, 0x20 }, /* GAINLLR_SF7 */ + { RSTV0910_GAINLLR_SF8, 0x20 }, /* GAINLLR_SF8 */ + { RSTV0910_GAINLLR_SF9, 0x20 }, /* GAINLLR_SF9 */ + { RSTV0910_GAINLLR_SF10, 0x20 }, /* GAINLLR_SF10 */ + { RSTV0910_GAINLLR_SF12, 0x20 }, /* GAINLLR_SF12 */ + { RSTV0910_GAINLLR_SF13, 0x20 }, /* GAINLLR_SF13 */ + { RSTV0910_GAINLLR_SF14, 0x20 }, /* GAINLLR_SF14 */ + { RSTV0910_GAINLLR_SF15, 0x20 }, /* GAINLLR_SF15 */ + { RSTV0910_GAINLLR_SF16, 0x20 }, /* GAINLLR_SF16 */ + { RSTV0910_GAINLLR_SF18, 0x22 }, /* GAINLLR_SF18 */ + { RSTV0910_GAINLLR_SF19, 0x22 }, /* GAINLLR_SF19 */ + { RSTV0910_GAINLLR_SF20, 0x24 }, /* GAINLLR_SF20 */ + { RSTV0910_GAINLLR_SF21, 0x24 }, /* GAINLLR_SF21 */ + { RSTV0910_GAINLLR_SF22, 0x25 }, /* GAINLLR_SF22 */ + { RSTV0910_GAINLLR_SF24, 0x20 }, /* GAINLLR_SF24 */ + { RSTV0910_GAINLLR_SF25, 0x20 }, /* GAINLLR_SF25 */ + { RSTV0910_GAINLLR_SF26, 0x20 }, /* GAINLLR_SF26 */ + { RSTV0910_GAINLLR_SF27, 0x20 }, /* GAINLLR_SF27 */ + { RSTV0910_CFGEXT, 0x02 }, /* CFGEXT */ + { RSTV0910_GENCFG, 0x15 }, /* GENCFG IP is in dual demod mode so both input streams are processed */ +/* { RSTV0910_LDPCERR1, 0x00 }, LDPCERR1 R only : error counter MSByte */ +/* { RSTV0910_LDPCERR0, 0x00 }, LDPCERR0 R only : error counter LSByte */ +/* { RSTV0910_BCHERR, 0x00 }, BCHERR R only : error flag and error counter */ + + { RSTV0910_P1_MAXEXTRAITER, 0x07 }, /* P1_MAXEXTRAITER */ + { RSTV0910_P2_MAXEXTRAITER, 0x07 }, /* P2_MAXEXTRAITER */ + { RSTV0910_P1_STATUSITER, 0x00 }, /* P1_STATUSITER */ + { RSTV0910_P1_STATUSMAXITER, 0x00 }, /* P1_STATUSMAXITER */ + { RSTV0910_P2_STATUSITER, 0x00 }, /* P2_STATUSITER */ + { RSTV0910_P2_STATUSMAXITER, 0x00 }, /* P2_STATUSMAXITER */ + + /* P2 NBITER registers */ + { RSTV0910_P2_NBITER_NF1, 0x1c }, /* P2_NBITER_NF1 */ + { RSTV0910_P2_NBITER_NF2, 0x19 }, /* P2_NBITER_NF2 */ + { RSTV0910_P2_NBITER_NF3, 0x17 }, /* P2_NBITER_NF3 */ + { RSTV0910_P2_NBITER_NF4, 0x18 }, /* P2_NBITER_NF4 */ + { RSTV0910_P2_NBITER_NF5, 0x13 }, /* P2_NBITER_NF5 */ + { RSTV0910_P2_NBITER_NF6, 0x19 }, /* P2_NBITER_NF6 */ + { RSTV0910_P2_NBITER_NF7, 0x18 }, /* P2_NBITER_NF7 */ + { RSTV0910_P2_NBITER_NF8, 0x17 }, /* P2_NBITER_NF8 */ + { RSTV0910_P2_NBITER_NF9, 0x16 }, /* P2_NBITER_NF9 */ + { RSTV0910_P2_NBITER_NF10, 0x1c }, /* P2_NBITER_NF10 */ + { RSTV0910_P2_NBITER_NF11, 0x1c }, /* P2_NBITER_NF11 */ + { RSTV0910_P2_NBITER_NF12, 0x13 }, /* P2_NBITER_NF12 */ + { RSTV0910_P2_NBITER_NF13, 0x19 }, /* P2_NBITER_NF13 */ + { RSTV0910_P2_NBITER_NF14, 0x18 }, /* P2_NBITER_NF14 */ + { RSTV0910_P2_NBITER_NF15, 0x16 }, /* P2_NBITER_NF15 */ + { RSTV0910_P2_NBITER_NF16, 0x1c }, /* P2_NBITER_NF16 */ + { RSTV0910_P2_NBITER_NF17, 0x1c }, /* P2_NBITER_NF17 */ + { RSTV0910_P2_NBITER_NF18, 0x19 }, /* P2_NBITER_NF18 */ + { RSTV0910_P2_NBITER_NF19, 0x18 }, /* P2_NBITER_NF19 */ + { RSTV0910_P2_NBITER_NF20, 0x17 }, /* P2_NBITER_NF20 */ + { RSTV0910_P2_NBITER_NF21, 0x16 }, /* P2_NBITER_NF21 */ + { RSTV0910_P2_NBITER_NF22, 0x1c }, /* P2_NBITER_NF22 */ + { RSTV0910_P2_NBITER_NF23, 0x1c }, /* P2_NBITER_NF23 */ + { RSTV0910_P2_NBITER_NF24, 0x18 }, /* P2_NBITER_NF24 */ + { RSTV0910_P2_NBITER_NF25, 0x17 }, /* P2_NBITER_NF25 */ + { RSTV0910_P2_NBITER_NF26, 0x16 }, /* P2_NBITER_NF26 */ + { RSTV0910_P2_NBITER_NF27, 0x1c }, /* P2_NBITER_NF27 */ + { RSTV0910_P2_NBITER_NF28, 0x1c }, /* P2_NBITER_NF28 */ + { RSTV0910_P2_NBITER_SF1, 0x1b }, /* P2_NBITER_SF1 */ + { RSTV0910_P2_NBITER_SF2, 0x19 }, /* P2_NBITER_SF2 */ + { RSTV0910_P2_NBITER_SF3, 0x17 }, /* P2_NBITER_SF3 */ + { RSTV0910_P2_NBITER_SF4, 0x1a }, /* P2_NBITER_SF4 */ + { RSTV0910_P2_NBITER_SF5, 0x13 }, /* P2_NBITER_SF5 */ + { RSTV0910_P2_NBITER_SF6, 0x19 }, /* P2_NBITER_SF6 */ + { RSTV0910_P2_NBITER_SF7, 0x1b }, /* P2_NBITER_SF7 */ + { RSTV0910_P2_NBITER_SF8, 0x1d }, /* P2_NBITER_SF8 */ + { RSTV0910_P2_NBITER_SF9, 0x1b }, /* P2_NBITER_SF9 */ + { RSTV0910_P2_NBITER_SF10, 0x1c }, /* P2_NBITER_SF10 */ + { RSTV0910_P2_NBITER_SF12, 0x13 }, /* P2_NBITER_SF12 */ + { RSTV0910_P2_NBITER_SF13, 0x19 }, /* P2_NBITER_SF13 */ + { RSTV0910_P2_NBITER_SF14, 0x1b }, /* P2_NBITER_SF14 */ + { RSTV0910_P2_NBITER_SF15, 0x1b }, /* P2_NBITER_SF15 */ + { RSTV0910_P2_NBITER_SF16, 0x1c }, /* P2_NBITER_SF16 */ + { RSTV0910_P2_NBITER_SF18, 0x19 }, /* P2_NBITER_SF18 */ + { RSTV0910_P2_NBITER_SF19, 0x1b }, /* P2_NBITER_SF19 */ + { RSTV0910_P2_NBITER_SF20, 0x1d }, /* P2_NBITER_SF20 */ + { RSTV0910_P2_NBITER_SF21, 0x1b }, /* P2_NBITER_SF21 */ + { RSTV0910_P2_NBITER_SF22, 0x1c }, /* P2_NBITER_SF22 */ + { RSTV0910_P2_NBITER_SF24, 0x1b }, /* P2_NBITER_SF24 */ + { RSTV0910_P2_NBITER_SF25, 0x1d }, /* P2_NBITER_SF25 */ + { RSTV0910_P2_NBITER_SF26, 0x1b }, /* P2_NBITER_SF26 */ + { RSTV0910_P2_NBITER_SF27, 0x1c }, /* P2_NBITER_SF27 */ + + { RSTV0910_TSTRES0, 0x00 }, /* TSTRES0 */ + { RSTV0910_TSTOUT, 0x00 }, /* TSTOUT */ + { RSTV0910_TSTIN, 0x00 }, /* TSTIN */ + + { RSTV0910_P2_TSTDMD, 0x00 }, /* P2_TSTDMD */ + { RSTV0910_P2_TCTL1, 0x00 }, /* P2_TCTL1 */ + /* TST P2 Registers */ + { RSTV0910_P2_TCTL4, 0x00 }, /* P2_TCTL4 */ + { RSTV0910_P2_TPKTDELIN, 0x00 }, /* P2_TPKTDELIN */ + { RSTV0910_P1_TSTDMD, 0x00 }, /* P1_TSTDMD */ + { RSTV0910_P1_TCTL1, 0x00 }, /* P1_TCTL1 */ + /* TST P1 Registers */ + { RSTV0910_P1_TCTL4, 0x00 }, /* P1_TCTL4 */ + { RSTV0910_P1_TPKTDELIN, 0x00 }, /* P1_TPKTDELIN */ + + { RSTV0910_TSTTSRS, 0x00 }, /* TSTTSRS */ +}; + +#endif + diff --git a/longmynd/stv0910_utils.c b/longmynd/stv0910_utils.c new file mode 100755 index 0000000..50388c6 --- /dev/null +++ b/longmynd/stv0910_utils.c @@ -0,0 +1,111 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv0910_utils.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - These routines abstract the register read and writes for the demodulator (STV0910) */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include "stv0910_regs.h" +#include "stv0910_utils.h" +#include "errors.h" +#include "nim.h" + +/* in order to do bitfields efficiently, we need to keep a shadow register set */ +uint8_t stv0910_shadow_regs[STV0910_END_ADDR - STV0910_START_ADDR + 1]; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_write_reg_field(uint32_t field, uint8_t field_val) { +/* -------------------------------------------------------------------------------------------------- */ +/* changes a bitfield of a register using a shadow register array to do the read/modify/write */ +/* field: the #define of the bitfield as given in stv0910_regs.h (from the datasheet) */ +/* field_val: what to set the field to (in the LSBs of the value */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint16_t reg; + uint8_t val; + + /* firsr we need to work out which register to use */ + reg=field >> 16; + /* now we calculate the new value for this reg by reading the shadow array, */ + /* masking out the field we want, and putting the new value in */ + val=((stv0910_shadow_regs[reg-STV0910_START_ADDR] & ~(field & 0xff)) | + (field_val << ((field >> 12) & 0x0f)) ); + /* now we can write the new value back to the demodulator and the shadow registers */ + if (err==ERROR_NONE) err=nim_write_demod(reg, val); + if (err==ERROR_NONE) stv0910_shadow_regs[reg-STV0910_START_ADDR]=val; + + if (err!=ERROR_NONE) printf("ERROR: STV0910 write field\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_reg_field(uint32_t field, uint8_t *field_val) { +/* -------------------------------------------------------------------------------------------------- */ +/* reads a bitfield of a register. This cannot go via the shadows as the regs are volatile */ +/* field: the #define of the bitfield as given in stv0910_regs.h (from the datasheet) */ +/* *field_val: the contents of the field once read */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint8_t val; + + /* we can read the register value first */ + if (err==ERROR_NONE) err=nim_read_demod((uint16_t)(field >> 16), &val); + /* and then do the masks and shifts to get at the specific bits */ + *field_val = ((val) & (field & 0xff)) >> ((field >> 12) & 0x0f); + + if (err!=ERROR_NONE) printf("ERROR: STV0910 read field\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_write_reg(uint16_t reg, uint8_t val) { +/* -------------------------------------------------------------------------------------------------- */ +/* abstracts a hardware register write to the stv0910 */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + + stv0910_shadow_regs[reg-STV0910_START_ADDR]=val; + + return nim_write_demod(reg, val); +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv0910_read_reg(uint16_t reg, uint8_t *val) { +/* -------------------------------------------------------------------------------------------------- */ +/* abstracts a hardware register read from the stv0910 */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + + return nim_read_demod(reg, val); +} + diff --git a/longmynd/stv0910_utils.h b/longmynd/stv0910_utils.h new file mode 100755 index 0000000..f925f49 --- /dev/null +++ b/longmynd/stv0910_utils.h @@ -0,0 +1,34 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv0910_utils.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STV0910_UTILS_H +#define STV0910_UTILS_H + +#define STV0910_START_ADDR RSTV0910_MID +#define STV0910_END_ADDR RSTV0910_TSTTSRS + +uint8_t stv0910_write_reg_field(uint32_t, uint8_t); +uint8_t stv0910_read_reg_field(uint32_t, uint8_t *); +uint8_t stv0910_write_reg(uint16_t, uint8_t); +uint8_t stv0910_read_reg(uint16_t, uint8_t *); + +#endif + diff --git a/longmynd/stv6120.c b/longmynd/stv6120.c new file mode 100755 index 0000000..571e545 --- /dev/null +++ b/longmynd/stv6120.c @@ -0,0 +1,438 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv6120.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - the stv6120 (tuner) specific routines */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include "math.h" +#include +#include +#include +#include "nim.h" +#include "stv6120.h" +#include "stv6120_regs.h" +#include "stv6120_utils.h" +#include "errors.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- GLOBALS ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +/* some globals to make it easier to keep track of register contents across function calls */ +uint8_t rdiv; +uint8_t ctrl7; +uint8_t ctrl8; +uint8_t ctrl16; +uint8_t ctrl17; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- CONSTANTS ---------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* from the datasheet: charge pump data */ +const uint32_t stv6120_icp_lookup[7][3]={ + /* low high icp */ + {2380000, 2472000, 0}, + {2473000, 2700000, 1}, + {2701000, 3021000, 2}, + {3022000, 3387000, 3}, + {3388000, 3845000, 5}, + {3846000, 4394000, 6}, + {4395000, 4760000, 7} +}; + +/* a lookup table for the cutuff freq of the HF filter in MHz */ +const uint16_t stv6120_cfhf[32]={6796, 5828, 4778, 4118, 3513, 3136, 2794, 2562, + 2331, 2169, 2006, 1890, 1771, 1680, 1586, 1514, + 1433, 1374, 1310, 1262, 1208, 1167, 1122, 1087, + 1049, 1018, 983, 956, 926, 902, 875, 854}; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv6120_cal_lowpass(uint8_t tuner) { +/* -------------------------------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint8_t val; + uint16_t timeout; + + printf("Flow: Tuner cal lowpass\n"); + + /* turn on the clock for the low pass filter. This is in ctrl7/16 so we have a shadow for it */ + if (tuner==TUNER_1) err=stv6120_write_reg(STV6120_CTRL7 , ctrl7 & ~(1 << STV6120_CTRL7_RCCLKOFF_SHIFT)); + else err=stv6120_write_reg(STV6120_CTRL16, ctrl16 & ~(1 << STV6120_CTRL7_RCCLKOFF_SHIFT)); + /* now we can do a low pass filter calibration, by setting the CALRCSTRT bit. NOte it is safe to just write to it */ + if (err==ERROR_NONE) err=stv6120_write_reg(tuner==TUNER_1 ? STV6120_STAT1 : STV6120_STAT2, + (STV6120_STAT1_CALRCSTRT_START << STV6120_STAT1_CALRCSTRT_SHIFT)); + /* wait for the bit to be cleared to say cal has finished*/ + if (err==ERROR_NONE) { + timeout=0; + do { + err=stv6120_read_reg(STV6120_STAT1, &val); + timeout++; + if (timeout==STV6120_CAL_TIMEOUT) { + err=ERROR_TUNER_CAL_LOWPASS_TIMEOUT; + printf("ERROR: tuner wait on CAL_lowpass timed out\n"); + } + } while ((err==ERROR_NONE) && ((val & (1< stv6120_icp_lookup[pos++][1]); + icp=stv6120_icp_lookup[pos-1][2]; + + /* lookup the high freq filter cutoff setting as per datasheet */ + cfhf=0; + while ((3*freq/1000) <= stv6120_cfhf[cfhf]) { + cfhf++; + } + cfhf--; /* we are sure it isn't greater then the first array element so this is safe */ + + printf(" Status: tuner:%i, f_vco=0x%x, icp=0x%x, f=0x%x, n=0x%x,\n",tuner,f_vco,icp,f,n); + printf(" rdiv=0x%x, p=0x%x, freq=%i, cfhf=%i\n",rdiv,p,freq,stv6120_cfhf[cfhf]); + + /* now we fill in the PLL and ICP values */ + if (err==ERROR_NONE) err=stv6120_write_reg(tuner==TUNER_1 ? STV6120_CTRL3 : STV6120_CTRL12, + (n & 0x00ff) ); /* set N[7:0] */ + if (err==ERROR_NONE) err=stv6120_write_reg(tuner==TUNER_1 ? STV6120_CTRL4 : STV6120_CTRL13, + ((f & 0x0000007f) << 1) | /* set F[6:0] */ + ((n & 0x0100) >> 8) ); /* N[8] */ + if (err==ERROR_NONE) err=stv6120_write_reg(tuner==TUNER_1 ? STV6120_CTRL5 : STV6120_CTRL14, + ((f & 0x00007f80) >> 7) ); /* set F[14:7] */ + if (err==ERROR_NONE) err=stv6120_write_reg(tuner==TUNER_1 ? STV6120_CTRL6 : STV6120_CTRL15, + ((f & 0x00038000) >> 15) | /* set f[17:15] */ + (icp << STV6120_CTRL6_ICP_SHIFT) | /* ICP[2:0] */ + STV6120_CTRL6_RESERVED ); /* reserved bit */ + + if (tuner==TUNER_1) { + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL7, + (p<0: the frequency to set tuner 1 to */ +/* freq_tuner_2: 0: disable tuner 2 */ +/* >0: the frequency to set tuner 2 to */ +/* swap: false: use TOP input for tuner_1 */ +/* true : use bottom input for tuner_1 */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint8_t k; + + printf("Flow: Tuner init\n"); + + /* note, we always init the tuner from scratch so no need to check if we have already inited it before */ + /* also, the tuner doesn't have much of an ID so no point in checking it */ + + /* we calculate K from F_xtal/(K+16)=1MHz as specified in the datasheet */ + k=NIM_TUNER_XTAL/1000-16; + + /* setup the clocks for both tuners (note rdiv is a global) */ + if (NIM_TUNER_XTAL>=STV6120_RDIV_THRESHOLD) rdiv=1; /* from the data sheet */ + else rdiv=0; + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL1, + (k << STV6120_CTRL1_K_SHIFT) | + (rdiv << STV6120_CTRL1_RDIV_SHIFT) | + (STV6120_CTRL1_OSHAPE_SINE << STV6120_CTRL1_OSHAPE_SHIFT) | + (STV6120_CTRL1_MCLKDIV_4 << STV6120_CTRL1_MCLKDIV_SHIFT) ); + + /* Configure path 1 */ + if (freq_tuner_1>0) { /* we are go on tuner 1 so turn it on */ + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL2, + (STV6120_CTRL2_DCLOOPOFF_ENABLE << STV6120_CTRL2_DCLOOPOFF_SHIFT) | + (STV6120_CTRL2_SDOFF_OFF << STV6120_CTRL2_SDOFF_SHIFT) | + (STV6120_CTRL2_SYN_ON << STV6120_CTRL2_SYN_SHIFT) | + (STV6120_CTRL2_REFOUTSEL_1_25V << STV6120_CTRL2_REFOUTSEL_SHIFT) | + (STV6120_CTRL2_BBGAIN_0DB << STV6120_CTRL2_BBGAIN_SHIFT) ); + + /* CTRL3,4,5,6 are all tuner 1 PLL regs we will set them later */ + + /* turn off rcclk for now */ + if (err==ERROR_NONE) { + ctrl7 = (STV6120_CTRL7_RCCLKOFF_DISABLE << STV6120_CTRL7_RCCLKOFF_SHIFT) | + (STV6120_CTRL7_CF_5MHZ << STV6120_CTRL7_CF_SHIFT) ; + err=stv6120_write_reg(STV6120_CTRL7, ctrl7); + } + + } else { /* we are not going to use path 1 so shut it down */ + + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL2, + (STV6120_CTRL2_DCLOOPOFF_DISABLE << STV6120_CTRL2_DCLOOPOFF_SHIFT) | + (STV6120_CTRL2_SDOFF_ON << STV6120_CTRL2_SDOFF_SHIFT) | + (STV6120_CTRL2_SYN_OFF << STV6120_CTRL2_SYN_SHIFT) | + (STV6120_CTRL2_REFOUTSEL_1_25V << STV6120_CTRL2_REFOUTSEL_SHIFT) | + (STV6120_CTRL2_BBGAIN_0DB << STV6120_CTRL2_BBGAIN_SHIFT) ); + + /* CTRL3,4,5,6 are all tuner 1 PLL regs we will set them later */ + + if (err==ERROR_NONE) { + ctrl7 = (STV6120_CTRL7_RCCLKOFF_DISABLE << STV6120_CTRL7_RCCLKOFF_SHIFT) | + (STV6120_CTRL7_CF_5MHZ << STV6120_CTRL7_CF_SHIFT) ; + err=stv6120_write_reg(STV6120_CTRL7, ctrl7); + } + } + + /* we need to set tcal for both tuners, but we need to remember the state in case we are using tuner 1 later */ + if (err==ERROR_NONE) { + ctrl8 = (STV6120_CTRL8_TCAL_DIV_2 << STV6120_CTRL8_TCAL_SHIFT) | + (STV6120_CTRL8_CALTIME_500US << STV6120_CTRL8_TCAL_SHIFT) ; + err=stv6120_write_reg(STV6120_CTRL8, ctrl8); + } + + /* no need to touch the STAT1 status register for now */ + + /* setup the RF path registers. RFA and RFD are not used. RFB is fed from the TOP NIM input, RFC from the BOTTOM */ + /* if we are swapping these inputs over we need to enable the correct LNAs */ + if (swap) { + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL9, + (STV6120_CTRL9_RFSEL_RFC_IN << STV6120_CTRL9_RFSEL_1_SHIFT) | + (STV6120_CTRL9_RFSEL_RFB_IN << STV6120_CTRL9_RFSEL_2_SHIFT) | + STV6120_CTRL9_RESERVED ); + /* decide on which LNAs are we going to enable */ + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL10, + (( STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNADON_SHIFT) | + ((freq_tuner_2 > 0 ? STV6120_CTRL10_LNA_ON : STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNABON_SHIFT) | + ((freq_tuner_1 > 0 ? STV6120_CTRL10_LNA_ON : STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNACON_SHIFT) | + (( STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNAAON_SHIFT) | + ((freq_tuner_2 > 0 ? STV6120_CTRL10_PATH_ON : STV6120_CTRL10_PATH_OFF) << STV6120_CTRL10_PATHON_2_SHIFT) | + ((freq_tuner_1 > 0 ? STV6120_CTRL10_PATH_ON : STV6120_CTRL10_PATH_OFF) << STV6120_CTRL10_PATHON_1_SHIFT) ); + + } else { + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL9, + (STV6120_CTRL9_RFSEL_RFB_IN << STV6120_CTRL9_RFSEL_1_SHIFT) | + (STV6120_CTRL9_RFSEL_RFC_IN << STV6120_CTRL9_RFSEL_2_SHIFT) | + STV6120_CTRL9_RESERVED ); + /* decide on which LNAs are we going to enable */ + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL10, + (( STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNADON_SHIFT) | + ((freq_tuner_2 > 0 ? STV6120_CTRL10_LNA_ON : STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNACON_SHIFT) | + ((freq_tuner_1 > 0 ? STV6120_CTRL10_LNA_ON : STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNABON_SHIFT) | + (( STV6120_CTRL10_LNA_OFF) << STV6120_CTRL10_LNAAON_SHIFT) | + ((freq_tuner_2 > 0 ? STV6120_CTRL10_PATH_ON : STV6120_CTRL10_PATH_OFF) << STV6120_CTRL10_PATHON_2_SHIFT) | + ((freq_tuner_1 > 0 ? STV6120_CTRL10_PATH_ON : STV6120_CTRL10_PATH_OFF) << STV6120_CTRL10_PATHON_1_SHIFT) ); + } + + /* Configure path 2 */ + if (freq_tuner_2>0) { /* we are go on tuner 2 so turn it on */ + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL11, + (STV6120_CTRL2_DCLOOPOFF_ENABLE << STV6120_CTRL2_DCLOOPOFF_SHIFT) | + (STV6120_CTRL2_SDOFF_OFF << STV6120_CTRL2_SDOFF_SHIFT) | + (STV6120_CTRL2_SYN_ON << STV6120_CTRL2_SYN_SHIFT) | + (STV6120_CTRL2_REFOUTSEL_1_25V << STV6120_CTRL2_REFOUTSEL_SHIFT) | + (STV6120_CTRL2_BBGAIN_6DB << STV6120_CTRL2_BBGAIN_SHIFT) ); + + /* CTRL12, 13, 14, 15 are PLL for tuner 2 */ + + if (err==ERROR_NONE) { + ctrl16 = (STV6120_CTRL7_RCCLKOFF_ENABLE << STV6120_CTRL7_RCCLKOFF_SHIFT) | + (STV6120_CTRL7_CF_5MHZ << STV6120_CTRL7_CF_SHIFT) ; + err=stv6120_write_reg(STV6120_CTRL16, ctrl16); + } + + } else { /* we are not going to use path 1 so shut it down */ + + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL11, + (STV6120_CTRL2_DCLOOPOFF_DISABLE << STV6120_CTRL2_DCLOOPOFF_SHIFT) | + (STV6120_CTRL2_SDOFF_ON << STV6120_CTRL2_SDOFF_SHIFT) | + (STV6120_CTRL2_SYN_OFF << STV6120_CTRL2_SYN_SHIFT) | + (STV6120_CTRL2_REFOUTSEL_1_25V << STV6120_CTRL2_REFOUTSEL_SHIFT) | + (STV6120_CTRL2_BBGAIN_0DB << STV6120_CTRL2_BBGAIN_SHIFT) ); + + /* CTRL12, 13, 14, 15 are PLL for tuner 2 */ + + if (err==ERROR_NONE) { + ctrl16 = (STV6120_CTRL7_RCCLKOFF_DISABLE << STV6120_CTRL7_RCCLKOFF_SHIFT) | + (STV6120_CTRL7_CF_5MHZ << STV6120_CTRL7_CF_SHIFT) ; + err=stv6120_write_reg(STV6120_CTRL16, ctrl16); + } + } + + /* there is no tcal field in CTRL17 but we still need to remember the state in case we are using tuner 2 later */ + if (err==ERROR_NONE) { + ctrl17 = (STV6120_CTRL8_CALTIME_500US << STV6120_CTRL8_TCAL_SHIFT); + err=stv6120_write_reg(STV6120_CTRL17, ctrl8); + } + + /* no need to touch the STAT2 status register for now */ + + /* CTRL18, CTRL19 are test regs so just write in the default */ + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL18,STV6120_CTRL18_DEFAULT); + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL19,STV6120_CTRL19_DEFAULT); + + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL20, + (STV6120_CTRL20_VCOAMP_NORMAL << STV6120_CTRL20_VCOAMP_SHIFT) | + STV6120_CTRL20_RESERVED ); + + /* CTRL21, CTRL22 are test regs so leave alone */ + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL21,STV6120_CTRL21_DEFAULT); + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL22,STV6120_CTRL22_DEFAULT); + + if (err==ERROR_NONE) err=stv6120_write_reg(STV6120_CTRL23, + (STV6120_CTRL20_VCOAMP_NORMAL << STV6120_CTRL20_VCOAMP_SHIFT) | + STV6120_CTRL20_RESERVED ); + + /* now we can calibrate the lowpass filters and setup the PLLs for each tuner required */ + if ((err==ERROR_NONE) && (freq_tuner_1>0)) { + err=stv6120_cal_lowpass(TUNER_1); + if (err==ERROR_NONE) err=stv6120_set_freq(TUNER_1, freq_tuner_1); + } + if ((err==ERROR_NONE) && (freq_tuner_2>0)) { + err=stv6120_cal_lowpass(TUNER_2); + if (err==ERROR_NONE) err=stv6120_set_freq(TUNER_2, freq_tuner_2); + } + + if (err!=ERROR_NONE) printf("ERROR: Failed to init Tuner %i, %i\n",freq_tuner_1, freq_tuner_2); + + return err; +} + + + + +/* -------------------------------------------------------------------------------------------------- */ +void stv6120_print_settings() { +/* -------------------------------------------------------------------------------------------------- */ +/* debug routine to print out all the regsiter values in the tuner */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t val; + + printf("Tuner regs are:\n"); + for(int i=0;i<0x19;i++) { + stv6120_read_reg(i,&val); + printf(" 0x%.2x = 0x%.2x\n",i,val); + } +} + diff --git a/longmynd/stv6120.h b/longmynd/stv6120.h new file mode 100755 index 0000000..98179d1 --- /dev/null +++ b/longmynd/stv6120.h @@ -0,0 +1,46 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv6120.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STV6120_H +#define STV6120_H + +#include + +#define TUNER_LOCKED 0 +#define TUNER_NOT_LOCKED 1 + +#define TUNER_1 0 +#define TUNER_2 1 + +#define STV6120_RDIV_THRESHOLD 27000 +#define STV6120_P_THRESHOLD_1 299000 +#define STV6120_P_THRESHOLD_2 596000 +#define STV6120_P_THRESHOLD_3 1191000 + +#define STV6120_CAL_TIMEOUT 200 + +uint8_t stv6120_init(uint32_t, uint32_t, bool); +uint8_t stv6120_set_freq(uint8_t, uint32_t); +uint8_t stv6120_cal_lowpass(uint8_t); +void stv6120_print_settings(); + +#endif + diff --git a/longmynd/stv6120_regs.h b/longmynd/stv6120_regs.h new file mode 100755 index 0000000..38cb84f --- /dev/null +++ b/longmynd/stv6120_regs.h @@ -0,0 +1,185 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv6120_regs.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STV6120_REGS_H +#define STV6120_REGS_H + +/* common registers toboth tuners */ +#define STV6120_CTRL1 0x00 +#define STV6120_CTRL1_K_SHIFT 3 +#define STV6120_CTRL1_K_MASK 0xf8 +#define STV6120_CTRL1_RDIV_SHIFT 2 +#define STV6120_CTRL1_OSHAPE_SHIFT 1 +#define STV6120_CTRL1_OSHAPE_SINE 0 +#define STV6120_CTRL1_OSHAPE_SQUARE 1 +#define STV6120_CTRL1_MCLKDIV_SHIFT 0 +#define STV6120_CTRL1_MCLKDIV_2 0 +#define STV6120_CTRL1_MCLKDIV_4 1 + +#define STV6120_CTRL2 0x01 +#define STV6120_CTRL2_DCLOOPOFF_SHIFT 7 +#define STV6120_CTRL2_DCLOOPOFF_ENABLE 0 +#define STV6120_CTRL2_DCLOOPOFF_DISABLE 1 +#define STV6120_CTRL2_SDOFF_SHIFT 6 +#define STV6120_CTRL2_SDOFF_OFF 0 +#define STV6120_CTRL2_SDOFF_ON 1 +#define STV6120_CTRL2_SYN_SHIFT 5 +#define STV6120_CTRL2_SYN_OFF 0 +#define STV6120_CTRL2_SYN_ON 1 +#define STV6120_CTRL2_REFOUTSEL_SHIFT 4 +#define STV6120_CTRL2_REFOUTSEL_VCC_DIV_2 0 +#define STV6120_CTRL2_REFOUTSEL_1_25V 1 +#define STV6120_CTRL2_BBGAIN_SHIFT 0 +#define STV6120_CTRL2_BBGAIN_0DB 0x0 +#define STV6120_CTRL2_BBGAIN_2DB 0x1 +#define STV6120_CTRL2_BBGAIN_4DB 0x2 +#define STV6120_CTRL2_BBGAIN_6DB 0x3 +#define STV6120_CTRL2_BBGAIN_8DB 0x4 +#define STV6120_CTRL2_BBGAIN_10DB 0x5 +#define STV6120_CTRL2_BBGAIN_12DB 0x6 +#define STV6120_CTRL2_BBGAIN_14DB 0x7 +#define STV6120_CTRL2_BBGAIN_16DB 0x8 + +/* registers for tuner 1 */ +#define STV6120_CTRL3 0x02 + +#define STV6120_CTRL4 0x03 +#define STV6120_CTRL4_F_6_0_SHIFT 1 +#define STV6120_CTRL4_F_6_0_MASK 0xfe +#define STV6120_CTRL4_N_9_SHIFT 0 + +#define STV6120_CTRL5 0x04 + +#define STV6120_CTRL6 0x05 +#define STV6120_CTRL6_ICP_SHIFT 4 +#define STV6120_CTRL6_ICP_MASK 0x70 +#define STV6120_CTRL6_ICP_300UA 0 +#define STV6120_CTRL6_ICP_325UA 1 +#define STV6120_CTRL6_ICP_360UA 2 +#define STV6120_CTRL6_ICP_400UA 3 +/* note 400uA has 2 definitions */ +#define STV6120_CTRL6_ICP_400UA_2 4 +#define STV6120_CTRL6_ICP_450UA 5 +#define STV6120_CTRL6_ICP_525UA 6 +#define STV6120_CTRL6_ICP_600UA 7 +#define STV6120_CTRL6_F_17_15_SHIFT 0 +#define STV6120_CTRL6_F_17_15_MASK 0x07 +#define STV6120_CTRL6_RESERVED 0x08 + +#define STV6120_CTRL7 0x06 +#define STV6120_CTRL7_RCCLKOFF_SHIFT 7 +#define STV6120_CTRL7_RCCLKOFF_ENABLE 0 +#define STV6120_CTRL7_RCCLKOFF_DISABLE 1 +#define STV6120_CTRL7_PDIV_SHIFT 5 +#define STV6120_CTRL7_CF_SHIFT 0 +#define STV6120_CTRL7_CF_5MHZ 0x00 + +#define STV6120_CTRL8 0x07 +#define STV6120_CTRL8_TCAL_SHIFT 6 +#define STV6120_CTRL8_TCAL_MASK 0xc0 +#define STV6120_CTRL8_TCAL_DIV_1 0 +#define STV6120_CTRL8_TCAL_DIV_2 1 +#define STV6120_CTRL8_TCAL_DIV_4 2 +#define STV6120_CTRL8_TCAL_DIV_8 3 +#define STV6120_CTRL8_CALTIME_SHIFT 5 +#define STV6120_CTRL8_CALTIME_500US 0 +#define STV6120_CTRL8_CALTIME_1MS 1 +#define STV6120_CTRL8_CFHF_SHIFT 0 +#define STV6120_CTRL8_CFHF_MASK 0x1f + +#define STV6120_STAT1 0x08 +#define STV6120_STAT1_CALVCOSTRT_SHIFT 2 +#define STV6120_STAT1_CALVCOSTRT_FINISHED 0 +#define STV6120_STAT1_CALVCOSTRT_START 1 +#define STV6120_STAT1_CALRCSTRT_SHIFT 1 +#define STV6120_STAT1_CALRCSTRT_FINISHED 0 +#define STV6120_STAT1_CALRCSTRT_START 1 +#define STV6120_STAT1_LOCK_SHIFT 0 +#define STV6120_STAT1_LOCK_NOT_IN_LOCK 0 +#define STV6120_STAT1_LOCK_LOCKED 1 +#define STV6120_STAT1_RESERVED 0x08 + +/* refsel fields for both tuners and path select */ +#define STV6120_CTRL9 0x09 +#define STV6120_CTRL9_RFSEL_2_SHIFT 2 +#define STV6120_CTRL9_RFSEL_2_MASK 0x0c +#define STV6120_CTRL9_RFSEL_RFA_IN 0 +#define STV6120_CTRL9_RFSEL_RFB_IN 1 +#define STV6120_CTRL9_RFSEL_RFC_IN 2 +#define STV6120_CTRL9_RFSEL_RFD_IN 3 +#define STV6120_CTRL9_RFSEL_1_SHIFT 0 +#define STV6120_CTRL9_RFSEL_1_MASK 0x03 +#define STV6120_CTRL9 0x09 +#define STV6120_CTRL9_RESERVED 0xf0 + +/* path select for both tuners */ +#define STV6120_CTRL10 0x0a +#define STV6120_CTRL10_DEFAULT 0xbf +#define STV6120_CTRL10_ID_SHIFT 6 +#define STV6120_CTRL10_ID_MASK 0xc0 +#define STV6120_CTRL10_LNADON_SHIFT 5 +#define STV6120_CTRL10_LNACON_SHIFT 4 +#define STV6120_CTRL10_LNA_OFF 0 +#define STV6120_CTRL10_LNA_ON 1 +#define STV6120_CTRL10_LNABON_SHIFT 3 +#define STV6120_CTRL10_LNAAON_SHIFT 2 +#define STV6120_CTRL10_PATHON_2_SHIFT 1 +#define STV6120_CTRL10_PATH_OFF 0 +#define STV6120_CTRL10_PATH_ON 1 +#define STV6120_CTRL10_PATHON_1_SHIFT 0 + +/* Regs CTRL11 to 18 and STAT2 are all Tuner2 regs */ +#define STV6120_CTRL11 0x0b +#define STV6120_CTRL12 0x0c +#define STV6120_CTRL13 0x0d +#define STV6120_CTRL14 0x0e +#define STV6120_CTRL15 0x0f +#define STV6120_CTRL16 0x10 +#define STV6120_CTRL17 0x11 +#define STV6120_STAT2 0x12 + +/* test registers */ +#define STV6120_CTRL18 0x13 +#define STV6120_CTRL18_DEFAULT 0x00 +#define STV6120_CTRL19 0x14 +#define STV6120_CTRL19_DEFAULT 0x00 + +/* vco 1 amplfier and test */ +#define STV6120_CTRL20 0x15 +#define STV6120_CTRL20_VCOAMP_SHIFT 6 +#define STV6120_CTRL20_VCOAMP_MASK 0xc0 +#define STV6120_CTRL20_VCOAMP_AUTO 0 +#define STV6120_CTRL20_VCOAMP_LOW 1 +#define STV6120_CTRL20_VCOAMP_NORMAL 2 +#define STV6120_CTRL20_VCOAMP_VERY_LOW 3 +#define STV6120_CTRL20_RESERVED 0x0c + +/* test registers */ +#define STV6120_CTRL21 0x16 +#define STV6120_CTRL21_DEFAULT 0x00 +#define STV6120_CTRL22 0x17 +#define STV6120_CTRL22_DEFAULT 0x00 + +/* vco 2 amplfier and test */ +#define STV6120_CTRL23 0x18 + +#endif + diff --git a/longmynd/stv6120_utils.c b/longmynd/stv6120_utils.c new file mode 100755 index 0000000..736b93b --- /dev/null +++ b/longmynd/stv6120_utils.c @@ -0,0 +1,32 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv6120_utils.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - abstracting out the tuner (STV6120) register read and write routines */ +/* H.L. Lomond 2018,2019 */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include "nim.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv6120_read_reg(uint8_t reg, uint8_t *val) { +/* -------------------------------------------------------------------------------------------------- */ +/* passes the register read through to the underlying register reading routines */ +/* -------------------------------------------------------------------------------------------------- */ + return nim_read_tuner(reg, val); +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stv6120_write_reg(uint8_t reg, uint8_t val) { +/* -------------------------------------------------------------------------------------------------- */ +/* passes the register write through to the underlying register writing routines */ +/* -------------------------------------------------------------------------------------------------- */ + return nim_write_tuner(reg, val); +} diff --git a/longmynd/stv6120_utils.h b/longmynd/stv6120_utils.h new file mode 100755 index 0000000..c6e04fb --- /dev/null +++ b/longmynd/stv6120_utils.h @@ -0,0 +1,31 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stv6120_utils.h */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - top level (main) and command line procesing */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STV6120_UTILS_H +#define STV6120_UTILS_H + +uint8_t stv6120_read_reg(uint8_t, uint8_t *); +uint8_t stv6120_write_reg(uint8_t, uint8_t); + +#endif + diff --git a/longmynd/stvvglna.c b/longmynd/stvvglna.c new file mode 100755 index 0000000..e3e21b9 --- /dev/null +++ b/longmynd/stvvglna.c @@ -0,0 +1,165 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stvvglna.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - the LNA support routines (STVVGLNA). The Serit NIM has 2 LNAs */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include "stvvglna.h" +#include "nim.h" +#include "stvvglna_regs.h" +#include "stvvglna_utils.h" +#include "errors.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stvvglna_read_agc(uint8_t input, uint8_t *gain, uint8_t *vgo) { +/* -------------------------------------------------------------------------------------------------- */ +/* once we are running, this routine will read the gain and AGC for the LNA specified */ +/* input: NIM_INPUT_TOP | NIM_INPUT_BOTTOM: which LNA is being worked on */ +/* return: error code */ +/* *gain: the gain read from the specified LNA */ +/* *vgo: the vgo read from the specified LNA */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + uint8_t lna_addr; + uint16_t timeout=0; + uint8_t status; + + /* first we decide which LNA to use */ + if (input==NIM_INPUT_TOP) lna_addr=NIM_LNA_0_ADDR; + else lna_addr=NIM_LNA_1_ADDR; + + /* in fully auto, we can read the gain sn SWLNAGAIN and VGO[4:0]. First we get the LNA to measure the */ + /* variable part of the gain for us. Note, it is ok to write 0 to the other bitfields */ + if (err==ERROR_NONE) err=stvvglna_write_reg(lna_addr, STVVGLNA_REG1, + STVVGLNA_REG1_GETAGC_START << STVVGLNA_REG1_GETAGC_SHIFT); + + do { + err=stvvglna_read_reg(lna_addr, STVVGLNA_REG1, &status); /* read out the status */ + timeout++; + if ((err==ERROR_NONE) && (timeout==STVVGLNA_AGC_TIMEOUT)) { + err=ERROR_LNA_AGC_TIMEOUT; + printf("Error: read AGC timeout\n"); + } + } + while ((err==ERROR_NONE) && (((status >> STVVGLNA_REG1_GETAGC_SHIFT) & 1)!=STVVGLNA_REG1_GETAGC_FORCED)); + stvvglna_read_reg(lna_addr, STVVGLNA_REG0, &status); /* read out the RFAGC high and low bits */ + + if (err==ERROR_NONE) err=stvvglna_read_reg(lna_addr, STVVGLNA_REG3, gain); /* read out the gain curves */ + *gain=((*gain & STVVGLNA_REG3_SWLNAGAIN_MASK) >> STVVGLNA_REG3_SWLNAGAIN_SHIFT); + if (err==ERROR_NONE) err=stvvglna_read_reg(lna_addr, STVVGLNA_REG1, vgo); /* read out the Vagc value */ + *vgo=((*vgo & STVVGLNA_REG1_VGO_MASK) >> STVVGLNA_REG1_VGO_SHIFT); + + if (err!=ERROR_NONE) printf("ERROR: Failed LNA aquire AGC %i\n", input); + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stvvglna_init(uint8_t input, uint8_t state, bool *lna_ok) { +/* -------------------------------------------------------------------------------------------------- */ +/* this is the init routine for the LNA */ +/* input: NIM_INPUT_TOP | NIM_INPUT_BOTTOM : specifies which LNA we are processing */ +/* lna_ok: if we find a NIM with an LNA then we set this to true otherwise false */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err; + uint8_t val; + uint8_t lna_addr; + + printf("Flow: LNA init %i\n",input); + + /* first we decide which LNA to use */ + if (input==NIM_INPUT_TOP) lna_addr=NIM_LNA_0_ADDR; + else lna_addr=NIM_LNA_1_ADDR; + + /* now check to see if there is an LNA present */ + err=stvvglna_read_reg(lna_addr, STVVGLNA_REG0, &val); + if (err!=ERROR_NONE) { + printf(" Status: found an older NIM with no LNA\n"); + *lna_ok=false; /* tell caller that there is no LNA */ + err=ERROR_NONE; /* we do not throw an error, just exit init */ + } else { + /* otherwise, lna is there so we go on to us it */ + printf(" Status: found new NIM with LNAs\n"); + *lna_ok=true; + + /* now check it has a good ID */ + if ((val & STVVGLNA_REG0_IDENT_MASK) != STVVGLNA_REG0_IDENT_DEFAULT) { + printf("ERROR: failed to recognise LNA ID %i %i\n",input,val); + err=ERROR_LNA_ID; + } + + if (state==STVVGLNA_ON) { + /* set up the defaults. We are going to use fully automatic mode */ + if (err==ERROR_NONE) err=stvvglna_write_reg(lna_addr,STVVGLNA_REG0, + (STVVGLNA_REG0_AGC_TUPD_FAST << STVVGLNA_REG0_AGC_TUPD_SHIFT) | + (STVVGLNA_REG0_AGC_TLOCK_SLOW << STVVGLNA_REG0_AGC_TLOCK_SHIFT) ); + if (err==ERROR_NONE) err=stvvglna_write_reg(lna_addr,STVVGLNA_REG1, + (STVVGLNA_REG1_LNAGC_PWD_POWER_ON << STVVGLNA_REG1_LNAGC_PWD_SHIFT) | + (STVVGLNA_REG1_GETOFF_ACQUISITION_MODE << STVVGLNA_REG1_GETOFF_SHIFT) | + (STVVGLNA_REG1_GETAGC_FORCED << STVVGLNA_REG1_GETAGC_SHIFT) ); + if (err==ERROR_NONE) err=stvvglna_write_reg(lna_addr,STVVGLNA_REG2, + (STVVGLNA_REG2_PATH_ACTIVE << STVVGLNA_REG2_PATH2OFF_SHIFT) | + (STVVGLNA_REG2_RFAGC_PREF_N20DBM << STVVGLNA_REG2_RFAGC_PREF_SHIFT) | + (STVVGLNA_REG2_PATH_ACTIVE << STVVGLNA_REG2_PATH1OFF_SHIFT) | + (STVVGLNA_REG2_RFAGC_MODE_AUTO_TRACK << STVVGLNA_REG2_RFAGC_MODE_SHIFT) ); + /* note that in REG3 the gain curves (SWLNAGAIN) are read only in fully automatic mod, so no need to write to them */ + if (err==ERROR_NONE) err=stvvglna_write_reg(lna_addr,STVVGLNA_REG3, + (STVVGLNA_REG3_LCAL_17KHZ << STVVGLNA_REG3_LCAL_SHIFT) | + (STVVGLNA_REG3_RFAGC_UPDATE_FORCED << STVVGLNA_REG3_RFAGC_UPDATE_SHIFT) | + (STVVGLNA_REG3_RFAGC_CALSTART_FORCED << STVVGLNA_REG3_RFAGC_CALSTART_SHIFT) ); + } else { /* state==STVVGLAN_OFF so disable it as we are not turning it on */ + if (err==ERROR_NONE) err=stvvglna_write_reg(lna_addr,STVVGLNA_REG2, + (STVVGLNA_REG2_PATH_OFF << STVVGLNA_REG2_PATH2OFF_SHIFT) | + (STVVGLNA_REG2_PATH_OFF << STVVGLNA_REG2_PATH1OFF_SHIFT) ); + } + + } + + if (err!=ERROR_NONE) printf("ERROR: LNA init %i\n",input); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +void stvvglna_read_regs(uint8_t addr) { +/* -------------------------------------------------------------------------------------------------- */ +/* support routine for debug */ +/* addr: the i2c address of the LNA to be dumped */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t val; + + printf("LNA 0x%.2x regs:\n",addr); + for(int i=0; i<4; i++) { + stvvglna_read_reg(addr,i,&val); + printf(" 0x%.2x = 0x%.2x\n",i,val); + } +} diff --git a/longmynd/stvvglna.h b/longmynd/stvvglna.h new file mode 100755 index 0000000..5bd7582 --- /dev/null +++ b/longmynd/stvvglna.h @@ -0,0 +1,37 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stvvglna.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STVVGLNA_H +#define STVVGLNA_H + +#include "stvvglna_regs.h" +#include +#include + +#define STVVGLNA_AGC_TIMEOUT 20 +#define STVVGLNA_OFF 0 +#define STVVGLNA_ON 1 + +uint8_t stvvglna_read_agc(uint8_t, uint8_t *, uint8_t*); +uint8_t stvvglna_init(uint8_t, uint8_t, bool*); +void stvvglna_read_regs (uint8_t); + +#endif diff --git a/longmynd/stvvglna_regs.h b/longmynd/stvvglna_regs.h new file mode 100755 index 0000000..c5853c5 --- /dev/null +++ b/longmynd/stvvglna_regs.h @@ -0,0 +1,112 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stvvglna_regs.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STVVGLNA_REGS_H +#define STVVGLNA_REGS_H + +#define STVVGLNA_I2C_ADDR0 0xc8 +#define STVVGLNA_I2C_ADDR1 0xca +#define STVVGLNA_I2C_ADDR2 0xcc +#define STVVGLNA_I2C_ADDR3 0xce + +#define STVVGLNA_REG0 0x00 +#define STVVGLNA_REG0_IDENT_SHIFT 4 +#define STVVGLNA_REG0_IDENT_MASK 0xf0 +#define STVVGLNA_REG0_IDENT_DEFAULT 0x20 +#define STVVGLNA_REG0_AGC_TUPD_SHIFT 3 +#define STVVGLNA_REG0_AGC_TUPD_FAST 0 +#define STVVGLNA_REG0_AGC_TUPD_SLOW 1 +#define STVVGLNA_REG0_AGC_TLOCK_SHIFT 2 +#define STVVGLNA_REG0_AGC_TLOCK_SLOW 0 +#define STVVGLNA_REG0_AGC_TLOCK_FAST 1 +#define STVVGLNA_REG0_RFAGC_HIGH_SHIFT 1 +#define STVVGLNA_REG0_RFAGC_HIGH_NOT_HIGH 0 +#define STVVGLNA_REG0_RFAGC_HIGH_IS_HIGH 1 +#define STVVGLNA_REG0_RFAGC_LOW_SHIFT 0 +#define STVVGLNA_REG0_RFAGC_LOW_NOT_LOW 0 +#define STVVGLNA_REG0_RFAGC_LOW_IS_LOW 1 + +#define STVVGLNA_REG1 0x01 +#define STVVGLNA_REG1_LNAGC_PWD_SHIFT 7 +#define STVVGLNA_REG1_LNAGC_PWD_POWER_ON 0 +#define STVVGLNA_REG1_LNAGC_PWD_POWER_OFF 1 +#define STVVGLNA_REG1_GETOFF_SHIFT 6 +#define STVVGLNA_REG1_GETOFF_ACQUISITION_MODE 0 +#define STVVGLNA_REG1_GETOFF_VGO_4_0 1 +#define STVVGLNA_REG1_GETAGC_SHIFT 5 +#define STVVGLNA_REG1_GETAGC_FORCED 0 +#define STVVGLNA_REG1_GETAGC_START 1 +#define STVVGLNA_REG1_VGO_SHIFT 0 +#define STVVGLNA_REG1_VGO_MASK 0x1f + +#define STVVGLNA_REG2 0x02 +#define STVVGLNA_REG2_PATH2OFF_SHIFT 7 +#define STVVGLNA_REG2_PATH_ACTIVE 0 +#define STVVGLNA_REG2_PATH_OFF 1 +#define STVVGLNA_REG2_RFAGC_PREF_SHIFT 4 +#define STVVGLNA_REG2_RFAGC_PREF_MASK 0x70 +#define STVVGLNA_REG2_RFAGC_PREF_N25DBM 0x0 +#define STVVGLNA_REG2_RFAGC_PREF_N24DBM 0x1 +#define STVVGLNA_REG2_RFAGC_PREF_N23DBM 0x2 +#define STVVGLNA_REG2_RFAGC_PREF_N22DBM 0x3 +#define STVVGLNA_REG2_RFAGC_PREF_N21DBM 0x4 +#define STVVGLNA_REG2_RFAGC_PREF_N20DBM 0x5 +#define STVVGLNA_REG2_RFAGC_PREF_N19DBM 0x6 +#define STVVGLNA_REG2_RFAGC_PREF_N18DBM 0x7 +#define STVVGLNA_REG2_PATH1OFF_SHIFT 3 +#define STVVGLNA_REG2_RFAGC_MODE_SHIFT 0 +#define STVVGLNA_REG2_RFAGC_MODE_MASK 0x07 +#define STVVGLNA_REG2_RFAGC_MODE_AUTO_TRACK 0x0 +#define STVVGLNA_REG2_RFAGC_MODE_AUTO_REQUEST 0x1 +#define STVVGLNA_REG2_RFAGC_MODE_MINIMAL_GAIN_INTERNAL 0x2 +#define STVVGLNA_REG2_RFAGC_MODE_MAXIMAL_GAIN_INTERNAL 0x3 +#define STVVGLNA_REG2_RFAGC_MODE_EXTERNAL_AGC_EXTERNAL 0x4 +#define STVVGLNA_REG2_RFAGC_MODE_AGC_LOOP_EXTERNAL 0x5 +#define STVVGLNA_REG2_RFAGC_MODE_MINIMAL_AGC_EXTERNAL 0x6 +#define STVVGLNA_REG2_RFAGC_MODE_MAXIMAL_AGC_EXTERNAL 0x7 + + +#define STVVGLNA_REG3 0x03 +#define STVVGLNA_REG3_LCAL_SHIFT 4 +#define STVVGLNA_REG3_LCAL_MASK 0x70 +#define STVVGLNA_REG3_LCAL_68KHZ 0x0 +#define STVVGLNA_REG3_LCAL_34KHZ 0x1 +#define STVVGLNA_REG3_LCAL_17KHZ 0x2 +#define STVVGLNA_REG3_LCAL_8_5KHZ 0x3 +#define STVVGLNA_REG3_LCAL_4_2KHZ 0x4 +#define STVVGLNA_REG3_LCAL_2_1KHZ 0x5 +#define STVVGLNA_REG3_LCAL_1_0KHZ 0x6 +#define STVVGLNA_REG3_LCAL_0_5KHZ 0x7 +#define STVVGLNA_REG3_RFAGC_UPDATE_SHIFT 3 +#define STVVGLNA_REG3_RFAGC_UPDATE_FORCED 0 +#define STVVGLNA_REG3_RFAGC_UPDATE_START 1 +#define STVVGLNA_REG3_RFAGC_CALSTART_SHIFT 2 +#define STVVGLNA_REG3_RFAGC_CALSTART_FORCED 0 +#define STVVGLNA_REG3_RFAGC_CALSTART_START 1 +#define STVVGLNA_REG3_SWLNAGAIN_SHIFT 0 +#define STVVGLNA_REG3_SWLNAGAIN_MASK 0x03 +#define STVVGLNA_REG3_SWLNAGAIN_LOWEST 0x0 +#define STVVGLNA_REG3_SWLNAGAIN_INTERMEDIATE_LOW 0x1 +#define STVVGLNA_REG3_SWLNAGAIN_INTERMEDIATE_HIGH 0x2 +#define STVVGLNA_REG3_SWLNAGAIN_HIGHEST 0x3 + +#endif + diff --git a/longmynd/stvvglna_utils.c b/longmynd/stvvglna_utils.c new file mode 100755 index 0000000..51b9ad3 --- /dev/null +++ b/longmynd/stvvglna_utils.c @@ -0,0 +1,50 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stvvglna_utils.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - abstracting out the lna register read and write routines */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include "nim.h" +#include "stvvglna_regs.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stvvglna_read_reg(uint8_t lna_addr, uint8_t reg, uint8_t *val) { +/* -------------------------------------------------------------------------------------------------- */ +/* passes the register read through to the underlying register reading routines */ +/* -------------------------------------------------------------------------------------------------- */ + return nim_read_lna(lna_addr, reg, val); +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t stvvglna_write_reg(uint8_t lna_addr, uint8_t reg, uint8_t val) { +/* -------------------------------------------------------------------------------------------------- */ +/* passes the register write through to the underlying register writing routines */ +/* -------------------------------------------------------------------------------------------------- */ + return nim_write_lna(lna_addr, reg, val); +} diff --git a/longmynd/stvvglna_utils.h b/longmynd/stvvglna_utils.h new file mode 100755 index 0000000..843e836 --- /dev/null +++ b/longmynd/stvvglna_utils.h @@ -0,0 +1,30 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: stvvglna_utils.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef STVVGLNA_UTILS_H +#define STVVGLNA_UTILS_H + +#include + +uint8_t stvvglna_read_reg(uint8_t, uint8_t, uint8_t *); +uint8_t stvvglna_write_reg(uint8_t, uint8_t, uint8_t); + +#endif diff --git a/longmynd/ts.c b/longmynd/ts.c new file mode 100755 index 0000000..5b43f2b --- /dev/null +++ b/longmynd/ts.c @@ -0,0 +1,548 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: ts.c */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#include + +#include "main.h" +#include "errors.h" +#include "udp.h" +#include "fifo.h" +#include "ftdi.h" +#include "ftdi_usb.h" +#include "ts.h" + +#define TS_FRAME_SIZE 20*512 // 512 is base USB FTDI frame + +#define MAX_PID 8192 + +#define TS_PACKET_SIZE 188 +#define TS_HEADER_SYNC 0x47 + +#define TS_PID_PAT 0x0000 +#define TS_PID_SDT 0x0011 +#define TS_PID_NULL 0x1FFF + +#define TS_TABLE_PAT 0x00 +#define TS_TABLE_PMT 0x02 +#define TS_TABLE_SDT 0x42 + +uint8_t *ts_buffer_ptr = NULL; +bool ts_buffer_waiting; + +typedef struct { + uint8_t *buffer; + uint32_t length; + bool waiting; + pthread_mutex_t mutex; + pthread_cond_t signal; +} longmynd_ts_parse_buffer_t; + +static longmynd_ts_parse_buffer_t longmynd_ts_parse_buffer = { + .buffer = NULL, + .length = 0, + .waiting = false, + .mutex = PTHREAD_MUTEX_INITIALIZER, + .signal = PTHREAD_COND_INITIALIZER +}; + + +/* -------------------------------------------------------------------------------------------------- */ +void *loop_ts(void *arg) { +/* -------------------------------------------------------------------------------------------------- */ +/* Runs a loop to query the Minitiouner TS endpoint, and output it to the requested interface */ +/* -------------------------------------------------------------------------------------------------- */ + thread_vars_t *thread_vars=(thread_vars_t *)arg; + uint8_t *err = &thread_vars->thread_err; + longmynd_config_t *config = thread_vars->config; + + uint8_t *buffer; + uint16_t len=0; + uint8_t (*ts_write)(uint8_t*,uint32_t); + + *err=ERROR_NONE; + + buffer = malloc(TS_FRAME_SIZE); + if(buffer == NULL) + { + *err=ERROR_TS_BUFFER_MALLOC; + } + + if(thread_vars->config->ts_use_ip) { + *err=udp_ts_init(thread_vars->config->ts_ip_addr, thread_vars->config->ts_ip_port); + ts_write = udp_ts_write; + } else { + *err=fifo_ts_init(thread_vars->config->ts_fifo_path); + ts_write = fifo_ts_write; + } + + while(*err == ERROR_NONE && *thread_vars->main_err_ptr == ERROR_NONE){ + /* If reset flag is active (eg. just started or changed station), then clear out the ts buffer */ + if(config->ts_reset) { + do { + if (*err==ERROR_NONE) *err=ftdi_usb_ts_read(buffer, &len, TS_FRAME_SIZE); + } while (*err==ERROR_NONE && len>2); + config->ts_reset = false; + } + + *err=ftdi_usb_ts_read(buffer, &len, TS_FRAME_SIZE); + + /* if there is ts data then we send it out to the required output. But, we have to lose the first 2 bytes */ + /* that are the usual FTDI 2 byte response and not part of the TS */ + if ((*err==ERROR_NONE) && (len>2)) { + ts_write(&buffer[2],len-2); + + if(longmynd_ts_parse_buffer.waiting && longmynd_ts_parse_buffer.buffer != NULL) + { + pthread_mutex_lock(&longmynd_ts_parse_buffer.mutex); + + memcpy(longmynd_ts_parse_buffer.buffer, &buffer[2],len-2); + longmynd_ts_parse_buffer.length = len-2; + pthread_cond_signal(&longmynd_ts_parse_buffer.signal); + longmynd_ts_parse_buffer.waiting = false; + + pthread_mutex_unlock(&longmynd_ts_parse_buffer.mutex); + } + } + } + + free(buffer); + + return NULL; +} + +static const uint32_t crc32_mpeg2_table[256]; + +static uint32_t crc32_mpeg2(uint8_t *data_ptr, size_t length) +{ + uint32_t crc; + + crc = 0xFFFFFFFF; + while (length--) + { + crc = (crc << 8) ^ crc32_mpeg2_table[((crc >> 24) ^ *data_ptr++) & 0xFF]; + } + return crc; +} + +/* -------------------------------------------------------------------------------------------------- */ +void *loop_ts_parse(void *arg) { +/* -------------------------------------------------------------------------------------------------- */ +/* Runs a loop to parse the MPEG-TS */ +/* -------------------------------------------------------------------------------------------------- */ + thread_vars_t *thread_vars=(thread_vars_t *)arg; + uint8_t *err = &thread_vars->thread_err; + *err=ERROR_NONE; + //longmynd_config_t *config = thread_vars->config; + longmynd_status_t *status = thread_vars->status; + + /* TS Processing Vars */ + uint8_t *ts_buffer; + uint32_t ts_buffer_length; + uint8_t *ts_packet_ptr; + uint32_t ts_buffer_length_remaining; + + /* TS Stats Vars */ + uint32_t ts_packet_total_count; + uint32_t ts_packet_null_count; + + /* Generic TS */ + uint32_t ts_pid; + uint32_t ts_adaption_field_flag; + uint32_t ts_adaption_field_length; + uint32_t ts_payload_content_offset; + uint32_t ts_payload_content_length; + uint8_t *ts_payload_ptr; + uint32_t ts_payload_section_length; + + uint32_t ts_payload_crc; + uint32_t ts_payload_crc_c; + + /* PAT */ + //uint32_t ts_pat_programs_count; + //uint32_t ts_pat_program_id; + //uint32_t ts_pat_program_pid; + + /* PMT */ + //uint32_t ts_pmt_pcr_pid; + uint32_t ts_pmt_program_info_length; + uint8_t *ts_pmt_es_ptr; + uint32_t ts_pmt_es_type; + uint32_t ts_pmt_es_pid; + uint32_t ts_pmt_es_info_length; + uint32_t ts_pmt_offset; + uint32_t ts_pmt_index; + + /* SDT */ + uint8_t *ts_packet_sdt_table_ptr; + //uint32_t service_id; + uint8_t *ts_packet_sdt_descriptor_ptr; + //uint32_t descriptor_tag; + //uint32_t descriptor_length; + uint32_t service_provider_name_length; + uint32_t service_name_length; + + ts_buffer = malloc(TS_FRAME_SIZE); + if(ts_buffer == NULL) + { + *err=ERROR_TS_BUFFER_MALLOC; + } + + longmynd_ts_parse_buffer.buffer = ts_buffer; + + struct timespec ts; + + /* Set pthread timer on .signal to use monotonic clock */ + pthread_condattr_t attr; + pthread_condattr_init(&attr); + pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); + pthread_cond_init (&longmynd_ts_parse_buffer.signal, &attr); + pthread_condattr_destroy(&attr); + + while(*err == ERROR_NONE && *thread_vars->main_err_ptr == ERROR_NONE) + { + //ts_pat_program_pid = 0x00; // Updated by PAT parse + + /* Reset Stats */ + ts_packet_total_count = 0; + ts_packet_null_count = 0; + + pthread_mutex_lock(&longmynd_ts_parse_buffer.mutex); + longmynd_ts_parse_buffer.waiting = true; + + while(longmynd_ts_parse_buffer.waiting && *thread_vars->main_err_ptr == ERROR_NONE) + { + /* Set timer for 100ms */ + clock_gettime(CLOCK_MONOTONIC, &ts); + ts.tv_nsec += 100 * 1000000; + + pthread_cond_timedwait(&longmynd_ts_parse_buffer.signal, &longmynd_ts_parse_buffer.mutex, &ts); + } + + pthread_mutex_unlock(&longmynd_ts_parse_buffer.mutex); + + ts_packet_ptr = &ts_buffer[0]; + ts_buffer_length = longmynd_ts_parse_buffer.length; + ts_buffer_length_remaining = ts_buffer_length; + + while(ts_packet_ptr != NULL) + { + if(ts_packet_ptr[0] != TS_HEADER_SYNC) + { + /* Align input to the TS sync byte */ + ts_buffer_length_remaining = ts_buffer_length - (&ts_packet_ptr[0] - &ts_buffer[0]); + + if(ts_buffer_length_remaining <= TS_PACKET_SIZE) + { + /* Nothing more in buffer, force exit */ + ts_packet_ptr = NULL; + continue; + } + + ts_packet_ptr = memchr(ts_packet_ptr, TS_HEADER_SYNC, ts_buffer_length_remaining - TS_PACKET_SIZE); + if(ts_packet_ptr == NULL) + { + continue; + } + } + + ts_pid = (uint32_t)((ts_packet_ptr[1] & 0x1F) << 8) | (uint32_t)ts_packet_ptr[2]; + + ts_packet_total_count++; + + ts_payload_content_offset = 4; + + ts_adaption_field_flag = (uint32_t)(ts_packet_ptr[3] & 0x20) >> 5; + if(ts_adaption_field_flag > 0) + { + ts_adaption_field_length = ts_packet_ptr[4]; + + if(ts_adaption_field_length == 0 + || ts_adaption_field_length > 183) + { + /* Length invalid, packet is likely invalid */ + ts_packet_ptr++; + continue; + } + + ts_payload_content_offset += ts_adaption_field_length; + } + + /* NULL/padding packets */ + if(ts_pid == TS_PID_NULL) + { + ts_packet_null_count++; + + ts_packet_ptr++; + continue; + } + +#if 0 + if(ts_pid == TS_PID_PAT) + { + ts_payload_ptr = (uint8_t *)&ts_packet_ptr[ts_payload_content_offset + 1 + ts_packet_ptr[ts_payload_content_offset]]; + + if(ts_payload_ptr[0] != TS_TABLE_PAT) + { + ts_packet_ptr++; + continue; + } + + ts_payload_section_length = ((uint32_t)(ts_payload_ptr[1] & 0x0F) << 8) | (uint32_t)ts_payload_ptr[2]; + + if(ts_payload_section_length < 1) + { + ts_packet_ptr++; + continue; + } + + ts_payload_crc = ((uint32_t)ts_payload_ptr[ts_payload_section_length-1] << 24) | ((uint32_t)ts_payload_ptr[ts_payload_section_length] << 16) + | ((uint32_t)ts_payload_ptr[ts_payload_section_length+1] << 8) | (uint32_t)ts_payload_ptr[ts_payload_section_length+2]; + + ts_payload_crc_c = crc32_mpeg2(ts_payload_ptr, (ts_payload_section_length-1)); + + if(ts_payload_crc != ts_payload_crc_c) + { + /* CRC Fail */ + ts_packet_ptr++; + continue; + } + + ts_pat_programs_count = (ts_payload_section_length - 9) / 4; + + /* For now, only read the first programme */ + /* TODO: Read all programs here to enable PID parsing of PMT */ + if(ts_pat_programs_count > 0) + { + //ts_pat_program_id = ((uint32_t)ts_payload_ptr[8] << 8) | (uint32_t)ts_payload_ptr[9]; + ts_pat_program_pid = ((uint32_t)(ts_payload_ptr[10] & 0x1F) << 8) | (uint32_t)ts_payload_ptr[11]; + //printf(" - PAT Program PID: %"PRIu32"\n", ts_pat_program_pid); + } + + ts_packet_ptr++; + continue; + } +#endif + if(ts_pid == TS_PID_SDT) + { + ts_payload_content_length = 0; + ts_payload_ptr = (uint8_t *)&ts_packet_ptr[ts_payload_content_offset + 1 + ts_packet_ptr[ts_payload_content_offset]]; + + if(ts_payload_ptr[0] != TS_TABLE_SDT) + { + ts_packet_ptr++; + continue; + } + + ts_payload_section_length = ((uint32_t)(ts_payload_ptr[1] & 0x0F) << 8) | (uint32_t)ts_payload_ptr[2]; + //printf(" - SDT Section Length: %"PRIu32"\n", ts_payload_section_length); + + if(ts_payload_section_length < 1) + { + ts_packet_ptr++; + continue; + } + + ts_payload_crc = ((uint32_t)ts_payload_ptr[ts_payload_section_length-1] << 24) | ((uint32_t)ts_payload_ptr[ts_payload_section_length] << 16) + | ((uint32_t)ts_payload_ptr[ts_payload_section_length+1] << 8) | (uint32_t)ts_payload_ptr[ts_payload_section_length+2]; + + ts_payload_crc_c = crc32_mpeg2(ts_payload_ptr, (ts_payload_section_length-1)); + + if(ts_payload_crc != ts_payload_crc_c) + { + /* CRC Fail */ + ts_packet_ptr++; + continue; + } + + /* Per service */ + ts_packet_sdt_table_ptr = &ts_payload_ptr[11]; + ts_payload_content_length += 11; + + //service_id = ((uint32_t)ts_packet_sdt_table_ptr[0] << 8) | (uint32_t)ts_packet_sdt_table_ptr[1]; + //printf(" - - Service ID: %"PRIu32"\n", service_id); + + /* Per descriptor */ + ts_packet_sdt_descriptor_ptr = &ts_packet_sdt_table_ptr[5]; + ts_payload_content_length += 5; + + //descriptor_tag = (uint32_t)ts_packet_sdt_descriptor_ptr[0]; + //printf(" - - - Descriptor Tag: %"PRIu32"\n", descriptor_tag); + + //descriptor_length = (uint32_t)ts_packet_sdt_descriptor_ptr[1]; + //printf(" - - - Descriptor Length: %"PRIu32"\n", descriptor_length); + + //uint32_t service_type = (uint32_t)ts_packet_sdt_descriptor_ptr[2]; + //printf(" - - - Service Type %"PRIu32"\n", service_type); + + ts_payload_content_length += 3; + + service_provider_name_length = (uint32_t)ts_packet_sdt_descriptor_ptr[3]; + //printf(" - - - Service Provider Name Length %"PRIu32"\n", service_provider_name_length); + //printf(" - - - Service Provider Name: %.*s\n", service_provider_name_length, &ts_packet_sdt_descriptor_ptr[4]); + + service_name_length = (uint32_t)ts_packet_sdt_descriptor_ptr[3+1+service_provider_name_length]; + //printf(" - - - Service Name Length %"PRIu32"\n", service_name_length); + //printf(" - - - Service Name: %.*s\n", service_name_length, &ts_packet_sdt_descriptor_ptr[4+1+service_provider_name_length]); + + pthread_mutex_lock(&status->mutex); + + memcpy(status->service_name, &ts_packet_sdt_descriptor_ptr[4+1+service_provider_name_length], service_name_length); + status->service_name[service_name_length] = '\0'; + + memcpy(status->service_provider_name, &ts_packet_sdt_descriptor_ptr[4], service_provider_name_length); + status->service_provider_name[service_provider_name_length] = '\0'; + + pthread_mutex_unlock(&status->mutex); + + ts_payload_content_length += 1; + ts_payload_content_length += service_provider_name_length; + ts_payload_content_length += 1; + ts_payload_content_length += service_name_length; + + ts_packet_ptr++; + continue; + } + else // if(ts_pat_program_pid !=0x00 && ts_pid == ts_pat_program_pid) /* PMT, once found in PAT */ + { + ts_payload_ptr = (uint8_t *)&ts_packet_ptr[ts_payload_content_offset + 1 + ts_packet_ptr[ts_payload_content_offset]]; + + /* We're not filtering by PID here yet, so we rely on filtering by table ID */ + if(ts_payload_ptr[0] != TS_TABLE_PMT) + { + ts_packet_ptr++; + continue; + } + + ts_payload_section_length = ((uint32_t)(ts_payload_ptr[1] & 0x0F) << 8) | (uint32_t)ts_payload_ptr[2]; + + if(ts_payload_section_length < 1) + { + ts_packet_ptr++; + continue; + } + + ts_payload_crc = ((uint32_t)ts_payload_ptr[ts_payload_section_length-1] << 24) | ((uint32_t)ts_payload_ptr[ts_payload_section_length] << 16) + | ((uint32_t)ts_payload_ptr[ts_payload_section_length+1] << 8) | (uint32_t)ts_payload_ptr[ts_payload_section_length+2]; + + ts_payload_crc_c = crc32_mpeg2(ts_payload_ptr, (ts_payload_section_length-1)); + + if(ts_payload_crc != ts_payload_crc_c) + { + /* CRC Fail */ + ts_packet_ptr++; + continue; + } + + //ts_pmt_pcr_pid = ((uint32_t)(ts_payload_ptr[8] & 0x1F) << 8) | (uint32_t)ts_payload_ptr[9]; + //printf(" - PMT: PCR PID: %"PRIu32"\n", ts_pmt_pcr_pid); + + ts_pmt_program_info_length = ((uint32_t)(ts_payload_ptr[10] & 0x0F) << 8) | (uint32_t)ts_payload_ptr[11]; + //if(ts_pmt_program_info_length > 0) + //{ + // printf(" - PMT Program Info: %.*s\n", ts_pmt_program_info_length, &ts_payload_ptr[12]); + //} + + ts_pmt_offset = 0; + ts_pmt_index = 0; + while((12+1+ts_pmt_program_info_length+ts_pmt_offset) < ts_payload_section_length) + { + ts_pmt_es_ptr = &ts_payload_ptr[12 + ts_pmt_program_info_length + ts_pmt_offset]; + + /* For each elementary PID */ + ts_pmt_es_type = (uint32_t)ts_pmt_es_ptr[0]; + + ts_pmt_es_pid = ((uint32_t)(ts_pmt_es_ptr[1] & 0x1F) << 8) | (uint32_t)ts_pmt_es_ptr[2]; + + ts_pmt_es_info_length = ((uint32_t)(ts_pmt_es_ptr[3] & 0x0F) << 8) | (uint32_t)ts_pmt_es_ptr[4]; + //if(ts_pmt_es_info_length > 0) + //{ + //printf(" - - PMT ES Info: %.*s\n", ts_pmt_es_info_length, &ts_pmt_es_ptr[5]); + //} + + pthread_mutex_lock(&status->mutex); + + status->ts_elementary_streams[ts_pmt_index][0] = ts_pmt_es_pid; + status->ts_elementary_streams[ts_pmt_index][1] = ts_pmt_es_type; + + pthread_mutex_unlock(&status->mutex); + + ts_pmt_offset += (5 + ts_pmt_es_info_length); + ts_pmt_index++; + } + + ts_packet_ptr++; + continue; + } + + ts_packet_ptr++; + } + pthread_mutex_lock(&status->mutex); + + if(ts_packet_total_count > 0) + { + status->ts_null_percentage = (100 * ts_packet_null_count) / ts_packet_total_count; + } + + /* Trigger pthread signal */ + pthread_cond_signal(&status->signal); + + pthread_mutex_unlock(&status->mutex); + } + + free(ts_buffer); + + return NULL; +} + +static const uint32_t crc32_mpeg2_table[256] = { + 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, + 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, + 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, + 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, + 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, + 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, + 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, + 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, + 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, + 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, + 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, + 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, + 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, + 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, + 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, + 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, + 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, + 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, + 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, + 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, + 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, + 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, + 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, + 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, + 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, + 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 +}; \ No newline at end of file diff --git a/longmynd/ts.h b/longmynd/ts.h new file mode 100755 index 0000000..ea46704 --- /dev/null +++ b/longmynd/ts.h @@ -0,0 +1,29 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: ts.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef TS_H +#define TS_H + +void *loop_ts(void *arg); +void *loop_ts_parse(void *arg); + +#endif + diff --git a/longmynd/udp.c b/longmynd/udp.c new file mode 100755 index 0000000..df241bc --- /dev/null +++ b/longmynd/udp.c @@ -0,0 +1,198 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: udp.c */ +/* - an implementation of the Serit NIM controlling software for the MiniTiouner Hardware */ +/* - linux udp handler to send the TS data to a remote display */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- INCLUDES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "errors.h" +#include "udp.h" + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- GLOBALS ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +struct sockaddr_in servaddr_status; +struct sockaddr_in servaddr_ts; +int sockfd_status; +int sockfd_ts; + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- DEFINES ------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +/* ----------------- ROUTINES ----------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t udp_ts_write(uint8_t *buffer, uint32_t len) { +/* -------------------------------------------------------------------------------------------------- */ +/* takes a buffer and writes out the contents to udp socket */ +/* *buffer: the buffer that contains the data to be sent */ +/* len: the length (number of bytes) of data to be sent */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + int32_t remaining_len; /* note it is signed so can go negative */ + uint32_t write_size; + + remaining_len=len; + /* we need to loop round sending 510 byte chunks so that we can skip the 2 extra bytes put in by */ + /* the FTDI chip every 512 bytes of USB message */ + while (remaining_len>0) { + if (remaining_len>510) { + /* calculate where to start in the buffer and how many bytes to send */ + write_size=510; + sendto(sockfd_ts, &buffer[len-remaining_len], write_size, 0, + (const struct sockaddr *) &servaddr_ts, sizeof(struct sockaddr)); + /* note we skip over the 2 bytes inserted by the FTDI */ + remaining_len-=512; + } else { + write_size=remaining_len; + sendto(sockfd_ts, &buffer[len-remaining_len], write_size, 0, + (const struct sockaddr *) &servaddr_ts, sizeof(struct sockaddr)); + remaining_len-=write_size; /* should be 0 if all went well */ + } + } + + /* if someting went bad with our calcs, remaining will not be 0 */ + if ((err==ERROR_NONE) && (remaining_len!=0)) { + printf("ERROR: UDP socket write incorrect number of bytes\n"); + err=ERROR_UDP_WRITE; + } + + if (err!=ERROR_NONE) printf("ERROR: UDP socket ts write\n"); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t udp_status_write(uint8_t message, uint32_t data) { +/* -------------------------------------------------------------------------------------------------- */ +/* takes a buffer and writes out the contents to udp socket */ +/* *buffer: the buffer that contains the data to be sent */ +/* len: the length (number of bytes) of data to be sent */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + char status_message[30]; + + sprintf(status_message, "$%i,%i\n", message, data); + + sendto(sockfd_status, status_message, strlen(status_message), 0, (const struct sockaddr *)&servaddr_status, sizeof(struct sockaddr)); + + return err; +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t udp_status_string_write(uint8_t message, char *data) { +/* -------------------------------------------------------------------------------------------------- */ +/* takes a buffer and writes out the contents to udp socket */ +/* *buffer: the buffer that contains the data to be sent */ +/* len: the length (number of bytes) of data to be sent */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + char status_message[5+128]; + + sprintf(status_message, "$%i,%s\n", message, data); + + sendto(sockfd_status, status_message, strlen(status_message), 0, (const struct sockaddr *)&servaddr_status, sizeof(struct sockaddr)); + + return err; +} + + +/* -------------------------------------------------------------------------------------------------- */ +static uint8_t udp_init(struct sockaddr_in *servaddr_ptr, int *sockfd_ptr, char *udp_ip, int udp_port) { +/* -------------------------------------------------------------------------------------------------- */ +/* initialises the udp socket */ +/* udp_ip: the ip address (as a string) of the socket to open */ +/* udp_port: the UDP port to be opened at the given IP address */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + + printf("Flow: UDP Init\n"); + + /* Creat the socket for IPv4 and UDP */ + if ((*sockfd_ptr = socket(AF_INET, SOCK_DGRAM, 0)) < 0 ) { + printf("ERROR: socket creation failed\n"); + err=ERROR_UDP_SOCKET_OPEN; + } else { + /* setup all the destination fields */ + memset(servaddr_ptr, 0, sizeof(struct sockaddr_in)); + servaddr_ptr->sin_family = AF_INET; + servaddr_ptr->sin_port = htons(udp_port); + servaddr_ptr->sin_addr.s_addr = inet_addr(udp_ip); // INADDR_ANY; + } + if (err!=ERROR_NONE) printf("ERROR: UDP init\n"); + + return err; +} + +uint8_t udp_status_init(char *udp_ip, int udp_port) { + return udp_init(&servaddr_status, &sockfd_status, udp_ip, udp_port); +} + +uint8_t udp_ts_init(char *udp_ip, int udp_port) { + return udp_init(&servaddr_ts, &sockfd_ts, udp_ip, udp_port); +} + +/* -------------------------------------------------------------------------------------------------- */ +uint8_t udp_close(void) { +/* -------------------------------------------------------------------------------------------------- */ +/* closes the udp socket */ +/* return: error code */ +/* -------------------------------------------------------------------------------------------------- */ + uint8_t err=ERROR_NONE; + int ret; + + printf("Flow: UDP Close\n"); + + ret=close(sockfd_ts); + if (ret!=0) { + err=ERROR_UDP_CLOSE; + printf("ERROR: TS UDP close\n"); + } + ret=close(sockfd_status); + if (ret!=0) { + err=ERROR_UDP_CLOSE; + printf("ERROR: Status UDP close\n"); + } + + return err; +} + diff --git a/longmynd/udp.h b/longmynd/udp.h new file mode 100755 index 0000000..3948807 --- /dev/null +++ b/longmynd/udp.h @@ -0,0 +1,37 @@ +/* -------------------------------------------------------------------------------------------------- */ +/* The LongMynd receiver: udp.h */ +/* Copyright 2019 Heather Lomond */ +/* -------------------------------------------------------------------------------------------------- */ +/* + This file is part of longmynd. + + Longmynd is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Longmynd 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 longmynd. If not, see . +*/ + +#ifndef UDP_H +#define UDP_H + +#include + +uint8_t udp_status_init(char *udp_ip, int udp_port); +uint8_t udp_ts_init(char *udp_ip, int udp_port); + +uint8_t udp_status_write(uint8_t message, uint32_t data); +uint8_t udp_status_string_write(uint8_t message, char *data); +uint8_t udp_ts_write(uint8_t *buffer, uint32_t len); + +uint8_t udp_close(void); + +#endif + diff --git a/main.py b/main.py new file mode 100755 index 0000000..21f0694 --- /dev/null +++ b/main.py @@ -0,0 +1,359 @@ +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- +# (c) Xavier 2022 + +# pour débugger… en ligne de commande !-) +# import pdb; pdb.set_trace() + +# DATV + +# for Python3 +from tkinter import * +import tkinter.messagebox +import tkinter.filedialog +import tkinter as tk +import tkinter.ttk as ttk +import os +import time +import json +import shutil +import vlc +import sys +import usb.core +import usb.util + +from PIL import Image, ImageTk +from ffpyplayer.player import MediaPlayer + +import threading +import subprocess +import socket + +import cv2 + +try: + import configparser as configparser +except ImportError: + import ConfigParser as configparser + +# Var +fileconfig = "config.json" +fileflux = "flux.datv" +DEVS = ['/dev/ttyUSB0', '/dev/ttyUSB1', '/dev/ttyUSB2'] +F1 = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] +F2 = ['0', '250', '500', '750'] +SR = ['66', '125', '250', '333', '500', '1000', '1500'] + + +class DATV(tk.Frame): + + def __init__(self, root): + super().__init__(root) + + self.champs = { + 'IP': tk.StringVar(), + 'PORT': tk.StringVar(), + 'DEV': tk.StringVar(), + 'FREQ': tk.StringVar(), + 'F1': tk.StringVar(), + 'F2': tk.StringVar(), + 'SR': tk.StringVar(), + } + self.root = root + self._create_bar() + self.pack() + self.RunVIDEO() + + def lireparam(self): + with open(fileconfig) as mon_fichier: + config = json.load(mon_fichier) + return config + + def ecrireparam(self): + self.StopStream() + jsonString = '{' + cpt = 0 + for v, k in self.champs.items(): + jsonString += '"' + v + '": "' + k.get() + '"' + if cpt < 6: + jsonString += ",\n" + cpt = cpt + 1 + jsonString += '}' + file = open(fileconfig, "w") + file.write(jsonString) + file.close() + self.Clean() + self.RunVIDEO() + + @staticmethod + def firstparam(fileconfig): + jsonString = '{"IP": "127.0.0.1", "PORT": "1234", "DEV": "/dev/ttyUSB0", "FREQ": "10491500", "SR": "1500"}' + file = open(fileconfig, "w") + file.write(jsonString) + file.close() + + def StopStream(self): + #self.Clean() + #self.photo = PhotoImage(file='img/btnjaune.gif') + #espace_image = Canvas(self, width=120, height=120, bg='red') + #espace_image.grid(row=3, columnspan=2, column=0, padx=10, pady=10) + #espace_image.create_image(60, 60, image=self.photo) + os.system('bash longmynd/stopsrv.sh') + + + + def RunStream(self): + self.Clean() + dev = usb.core.find(idVendor=0x0403, idProduct=0x6010) + if dev is not None: + data = self.lireparam() + freq = data['FREQ'] + data['F1'] + data['F2'] + print('IP=' + data['IP'] + ':' + data['PORT'] + ' freq=' + freq + ' SR=' + data['SR']) + os.system('bash ./longmynd/gosrv.sh ' + data['IP'] + ' ' + data['PORT'] + ' ' + freq + ' ' + data['SR'] + '> flux.datv') + time.sleep(2) + + return + else: + self.photo = PhotoImage(file='img/btnrouge.gif') + espace_image = Canvas(self, width=120, height=120, bg='red') + espace_image.grid(row=3, columnspan=2, column=0, padx=10, pady=10) + espace_image.create_image(60, 60, image=self.photo) + return + + def RunVIDEO(self): + + #Stream + self.RunStream() + + # Créer un Canvas pour afficher la vidéo + self.Canvas_video = tk.Canvas(self, bg='black', width=800, height=600) + self.Canvas_video.grid(row=0, column=0, padx=1, pady=1) + #self.photo = PhotoImage(file='nosignal.png') + #self.Canvas_video.create_image(450, 300, image=self.photo) + # Afficher la vidéo UDP + self.RunVLC() + + + def RunVLC(self): + # Créer une instance VLC pour la vidéo + data = self.lireparam() + + # Assurez-vous de gérer les erreurs de création de la fenêtre + try: + self.Instance = vlc.Instance('--no-xlib') + self.player = self.Instance.media_player_new() + + m = self.Instance.media_new(str('udp://@'+data['IP']+':'+data['PORT'])) # Path, unicode + self.player.set_media(m) + + # set the window id where to render VLC's video output + h = self.Canvas_video.winfo_id() # .winfo_visualid()? + self.player.set_xwindow(h) # fails on Windows + self.player.play() # == -1 + + + except Exception as e: + print(f"Erreur de création de la sortie vidéo: {e}") + tk.messagebox.showerror("Erreur VLC", f"Erreur de création de la sortie vidéo: {e}") + + def TestBeacon(self): + self.Clean + self.StopStream() + dev = usb.core.find(idVendor=0x0403, idProduct=0x6010) + if dev is not None: + self.photo = PhotoImage(file='img/btnvert.gif') + espace_image = Canvas(self, width=120, height=120, bg='green') + espace_image.grid(row=3, columnspan=2, column=0, padx=10, pady=10) + espace_image.create_image(60, 60, image=self.photo) + data = self.lireparam() + freq = "10491500" + symb = "1500" + os.system('bash ./longmynd/gosrv.sh ' + data['IP'] + ' ' + data['PORT'] + ' ' + freq + ' ' + symb + '> flux.datv') + time.sleep(5) + + self.RunVIDEO() + return + else: + self.photo = PhotoImage(file='img/btnrouge.gif') + espace_image = Canvas(self, width=120, height=120, bg='red') + espace_image.grid(row=3, columnspan=2, column=0, padx=10, pady=10) + espace_image.create_image(60, 60, image=self.photo) + return + + def Testconnexion(self): + self.Clean() + connected = False + dev = usb.core.find(idVendor=0x0403, idProduct=0x6010) + if dev is not None: + connected = True + if connected: + self.photo = PhotoImage(file='img/btnvert.gif') + espace_image = Canvas(self, width=120, height=120, bg='green') + espace_image.grid(row=3, columnspan=2, column=0, padx=10, pady=10) + espace_image.create_image(60, 60, image=self.photo) + else: + self.photo = PhotoImage(file='img/btnrouge.gif') + espace_image = Canvas(self, width=120, height=120, bg='red') + espace_image.grid(row=3, columnspan=2, column=0, padx=10, pady=10) + espace_image.create_image(60, 60, image=self.photo) + + def Apropos(self): + tk.messagebox.showinfo("A propos", "Reception DATV via Linux...\n Dev F4IYT Xavier\n") + + def Version(self): + tk.messagebox.showinfo("Version", "DATVLin \n(C) 2023 F4IYT Xavier\n2.00") + + def Clean(self): + for c in self.winfo_children(): + c.destroy() + self._create_bar() + + def _create_bar(self): + + logo = PhotoImage(file='img/datv_ico.png') + + menubar = Menu(self) + + self.icon = PhotoImage(file='./img/datv_ico.png') + menubar.add_cascade(label="Command", image=self.icon) + menufichier = Menu(menubar, tearoff=0) + menufichier.add_command(label="Ouvrir memoire", command=app.quit) + menufichier.add_command(label="Enregistrer memoire", command=app.quit) + menufichier.add_separator() + menufichier.add_command(label="Config", command=self._create_config) + menufichier.add_separator() + menufichier.add_command(label="Nettoyer Frame", command=self.Clean) + menufichier.add_command(label="Quitter", command=app.quit) + menubar.add_cascade(label="Fichier", menu=menufichier) + menudatv = Menu(menubar, tearoff=0) + menudatv.add_command(label="Test Connection", command=self.Testconnexion) + menudatv.add_command(label="Test Beacon", command=self.TestBeacon) + menudatv.add_command(label="Run Srv Stream", command=self.RunStream) + menudatv.add_command(label="Stop Srv Stream", command=self.StopStream) + menudatv.add_command(label="Config", command=self._create_config) + + menudatv.add_separator() + menudatv.add_command(label="Run Video Stream", command=self.RunVIDEO) + menudatv.add_command(label="Status DATV Rx", command=run_troisieme_program) + menudatv.add_separator() + menubar.add_cascade(label="DATV", menu=menudatv) + menuaide = Menu(menubar, tearoff=0) + menuaide.add_command(label="A propos", command=self.Apropos) + menuaide.add_command(label="Version", command=self.Version) + menubar.add_cascade(label="Aide", menu=menuaide) + + app.config(menu=menubar) + + def _create_config(self): + self.Clean() + self.champs = { + 'IP': tk.StringVar(), + 'PORT': tk.StringVar(), + 'DEV': tk.StringVar(), + 'FREQ': tk.StringVar(), + 'F1': tk.StringVar(), + 'F2': tk.StringVar(), + 'SR': tk.StringVar(), + + } + data = self.lireparam() + print(data) + + Label0 = Label(self, text='CONFIG SRV STREAM: ') + Label0.grid(column=0, row=0, sticky='w', pady=2) + + Label2 = Label(self, text='IP : ') + Label2.grid(column=0, row=2, sticky='w') + + Champ2 = Entry(self, textvariable=self.champs['IP'], width=16) + Champ2.focus_set() + Champ2.grid(column=1, row=2, sticky='sw', columnspan=3, padx=10) + Champ2.insert(0, data['IP']) + + Label3 = Label(self, text='PORT : ') + Label3.grid(column=9, row=2, sticky='w') + + Champ3 = Entry(self, textvariable=self.champs['PORT'], width=7) + Champ3.focus_set() + Champ3.grid(column=10, row=2, sticky='sw', columnspan=3, padx=10) + Champ3.insert(0, data['PORT']) + + Label4 = Label(self, text='Dev : ') + Label4.grid(column=0, row=3, sticky='w') + + combo = ttk.Combobox(self, values=DEVS, + textvariable=self.champs['DEV'], width=12) + combo['state'] = 'readonly' + combo.set(data['DEV']) + combo.grid(column=1, row=3, columnspan=3) + + Label6 = Label(self, text='Fréquence : ') + Label6.grid(column=0, row=4, sticky='w') + + Champ6 = Entry(self, textvariable=self.champs['FREQ'], width=4) + Champ6.focus_set() + Champ6.grid(column=1, row=4, sticky='sw', columnspan=3, padx=10) + Champ6.insert(0, data['FREQ']) + + combo5 = ttk.Combobox(self, values=F1, + textvariable=self.champs['F1'], width=2) + combo5['state'] = 'readonly' + combo5.set(data['F1']) + combo5.grid(column=3, row=4) + + combo6 = ttk.Combobox(self, values=F2, + textvariable=self.champs['F2'], width=3) + combo6['state'] = 'readonly' + combo6.set(data['F2']) + combo6.grid(column=4, row=4) + + Label7 = Label(self, text='MHz') + Label7.grid(column=6, row=4, sticky='w') + + Label4 = Label(self, text='Symbol : ') + Label4.grid(column=9, row=4, sticky='w') + combo4 = ttk.Combobox(self, values=SR, + textvariable=self.champs['SR'], width=7) + combo4['state'] = 'readonly' + combo4.set(data['SR']) + combo4.grid(column=10, row=4, columnspan=2) + + button = tk.Button(self, text="Valider", command=self.ecrireparam) + button.grid(column=0, row=5) + + button = tk.Button(self, text="Fermer", command=self.Clean) + button.grid(column=2, row=5) + +# Fonction exécutant le second programme +def run_second_program(): + # Commande pour exécuter le second programme, remplacez-la par la commande appropriée + command = ["python3", "waterfall.py"] + proc = subprocess.run(command) + +# Fonction exécutant le troisieme programme +def run_troisieme_program(): + # Commande pour exécuter le second programme, remplacez-la par la commande appropriée + title = "DATV Status" + command = ["gnome-terminal", "--title", title, "--", "./status", ""] + proc = subprocess.run(command) + + +if __name__ == '__main__': + + if not os.path.exists(fileconfig): + firstparam(fileconfig) + print("START INIT") + app = Tk() + app.title("DATV Srv STREAM") + app.geometry("1024x800") + DATV(app) + # Création du thread pour exécuter le second programme + thread = threading.Thread(target=run_second_program) + # Démarrage du thread + thread.start() + + app.mainloop() + os.system('bash longmynd/stopsrv.sh') + #kill(proc.pid) + + diff --git a/manuel.pdf b/manuel.pdf new file mode 100644 index 0000000..3e78990 Binary files /dev/null and b/manuel.pdf differ diff --git a/minitiouner.rules b/minitiouner.rules new file mode 100644 index 0000000..a0499fe --- /dev/null +++ b/minitiouner.rules @@ -0,0 +1,7 @@ +# Install with `sudo cp minitiouner.rules /etc/udev/rules.d/` +# then unplug and replug the minitiouner + +# Minitiouner uses FT2232H/D default VID/PID, but it's own product string. +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="USB <-> NIM tuner", MODE:="0666" +# Minitiouner Express uses different product string +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="MiniTiouner-Express", MODE:="0666" diff --git a/requierement.txt b/requierement.txt new file mode 100644 index 0000000..ed14209 --- /dev/null +++ b/requierement.txt @@ -0,0 +1,7 @@ +tk +Pillow +python-vlc +pyusb +ffpyplayer +opencv-python + diff --git a/status b/status new file mode 100755 index 0000000..9fea4f5 Binary files /dev/null and b/status differ diff --git a/status.py b/status.py new file mode 100644 index 0000000..705233e --- /dev/null +++ b/status.py @@ -0,0 +1,126 @@ +import os +import curses +import time + +MERThreshold = 0 + +def display_percent(stdscr, id, meaning, value): + stdscr.addstr(2+id, 0, f"{meaning}: {float(value)/100:.2f} %\n") + +def display_mer(stdscr, id, meaning, value): + stdscr.addstr(2+id, 0, f"{meaning}: {float(value)/10:.1f} dB (need {MERThreshold:.1f} dB)\n") + +def display_yes_no(stdscr, id, meaning, value): + stdscr.addstr(2+id, 0, f"{meaning}: {'yes' if value != 0 else 'no'}\n") + +def display_state(stdscr, id, meaning, value): + states = [ + "initialising", + "searching", + "found headers", + "DVB-S lock", + "DVB-S2 lock" + ] + if value < len(states): + stdscr.addstr(2+id, 0, f"{meaning}: {states[value]}\n") + else: + stdscr.addstr(2+id, 0, f"{meaning}: {value}\n") + +def display_modcod_s(stdscr, id, meaning, value): + modcods = [ + "QPSK 1/2", + "QPSK 2/3", + "QPSK 3/4", + "QPSK 5/6", + "QPSK 6/7", + "QPSK 7/8" + ] + if value < len(modcods): + stdscr.addstr(2+id, 0, f"{meaning}: {modcods[value]}\n") + else: + stdscr.addstr(2+id, 0, f"{meaning}: {value}\n") + global MERThreshold + MERThreshold = 0 + +def display_modcod_s2(stdscr, id, meaning, value): + modcods = [ + "DummyPL", "QPSK 1/4", "QPSK 1/3", "QPSK 2/5", "QPSK 1/2", "QPSK 3/5", "QPSK 2/3", + "QPSK 3/4", "QPSK 4/5", "QPSK 5/6", "QPSK 8/9", "QPSK 9/10", "8PSK 3/5", "8PSK 2/3", + "8PSK 3/4", "8PSK 5/6", "8PSK 8/9", "8PSK 9/10", "16APSK 2/3", "16APSK 3/4", "16APSK 4/5", + "16APSK 5/6", "16APSK 8/9", "16APSK 9/10", "32APSK 3/4", "32APSK 4/5", "32APSK 5/6", + "32APSK 8/9", "32APSK 9/10" + ] + MER_thresholds = [ + 0, -2.3, -1.2, -0.3, 1.0, 2.3, 3.1, 4.1, 4.7, 5.2, 6.2, 6.5, + 5.5, 6.6, 7.9, 9.4, 10.7, 11.0, 9.0, 10.2, 11.0, 11.6, 12.9, + 13.2, 12.8, 13.7, 14.3, 15.7, 16.1 + ] + if value < len(modcods): + stdscr.addstr(2+id, 0, f"{meaning}: {modcods[value]}\n") + else: + stdscr.addstr(2+id, 0, f"{meaning}: {value}\n") + global MERThreshold + if value < len(MER_thresholds): + MERThreshold = MER_thresholds[value] + else: + MERThreshold = 0 + +def display_status(stdscr, id, value): + meanings = [ + "", "State", "LNA Gain", "Puncture Rate", "I Symbol Power", "Q Symbol Power", + "Carrier Frequency", "I Constellation", "Q Constellation", "Symbol Rate", + "Viterbi Error Rate", "BER", "MER", "Service Provider", "Service", "Null Ratio", + "ES PID", "ES Type", "MODCOD", "Short Frames", "Pilot Symbols", "LDPC Error Count", + "BCH Error Count", "BCH Uncorrected", "LNB Voltage Enabled", "LNB H Polarisation", + "AGC1 Gain", "AGC2 Gain" + ] + if id < len(meanings): + if id in [19, 20, 23, 24, 25]: + display_yes_no(stdscr, id, meanings[id], int(value)) + elif id == 1: + state = int(value) + display_state(stdscr, id, meanings[id], state) + elif id in [10, 11]: + display_percent(stdscr, id, meanings[id], int(value)) + elif id == 12: + display_mer(stdscr, id, meanings[id], int(value)) + elif id == 18: + state = int(value) + if state == 3: + display_modcod_s(stdscr, id, meanings[id], int(value)) + elif state == 4: + display_modcod_s2(stdscr, id, meanings[id], int(value)) + else: + stdscr.addstr(2+id, 0, f"{meanings[id]}: {value}\n") + else: + stdscr.addstr(2+id, 0, f"{id}: {value}\n") + +def main(stdscr): + os.system('clear') + stdscr.addstr(1, 0, "LongMynd DATV Receiver Status\n") + + try: + status_fifo = open("longmynd_main_status", "r") + except Exception as e: + stdscr.addstr(2, 0, f"Failed to open status fifo: {e}\n") + stdscr.refresh() + time.sleep(2) + return + + stdscr.scrollok(True) + stdscr.addstr(2, 0, "Listening\n") + stdscr.refresh() + + while True: + status_message = status_fifo.readline().strip() + if status_message.startswith('$'): + parts = status_message[1:].split(',') + if parts: + n = int(parts[0]) + m_str = parts[1] if len(parts) > 1 else '' + display_status(stdscr, n, m_str) + stdscr.refresh() + +if __name__ == "__main__": + curses.wrapper(main) + diff --git a/waterfall.py b/waterfall.py new file mode 100644 index 0000000..3f9c699 --- /dev/null +++ b/waterfall.py @@ -0,0 +1,189 @@ +#!/usr/bin/python3 +# ZR6TG - Tom - 2022/06/23 + +# basic signals detection code ported from https://github.com/m0dts/QO-100-WB-Live-Tune + +import asyncio +import pygame +import websockets +import os +import pygame.gfxdraw + + +# CONFIGURATION +FFT_URL = "wss://eshail.batc.org.uk/wb/fft" #official batc fft + + + +COL_BG = (20, 29, 43) +COL_SPECTRUM = (217, 127, 43) +COL_TEXT = (224,224,224) + +WIDTH = 800 +HEIGHT = 480 + +class Graphics: + + def __init__(self, width, height): + self.start_freq = 10490.5 + self.width = width + self.height = height + self.x_tab = (self.width-50) /922 + self.font = pygame.font.SysFont('freesans', 20) + self.bigfont = pygame.font.SysFont('freesans', 180) + self.mediumfont = pygame.font.SysFont('freesans', 50) + + + def align_symbolrate(self, width): + if width < 0.002: return 0 + if width < 0.065: return 0.035 + if width < 0.086: return 0.066 + if width < 0.195: return 0.125 + if width < 0.277: return 0.250 + if width < 0.388: return 0.333 + if width < 0.700: return 0.500 + if width < 1.2: return 1.0 + if width < 1.6: return 1.5 + if width < 2.2: return 2 + + return int(width) + + async def find_signals(self, fft_data): + signals = [] + i = 0 + j = 0 + noise_level = 11000 + signal_threshold = 18000 + in_signal = False + start_signal = 0 + end_signal = 0 + mid_signal = 0 + signal_strength = 0 + signal_bw = 0 + signal_freq = 0 + acc = 0 + acc_i = 0 + + i = 2 + while i < len(fft_data): + + if in_signal == False: + if (fft_data[i] + fft_data[i-1] + fft_data[i-2]) / 3 > signal_threshold: + in_signal = True + start_signal = i + else: + if (fft_data[i] + fft_data[i-1] + fft_data[i-2]) / 3 < signal_threshold: + in_signal = False + end_signal = i + + acc = 0 + acc_i = 0 + + j = int(start_signal + (0.3 * ( end_signal - start_signal ))) + + while ( j < start_signal + (0.8 * (end_signal - start_signal))): + acc = acc + fft_data[j] + acc_i = acc_i + 1 + j+=1 + + if acc_i == 0: + in_signal = False + continue + + signal_strength = acc / acc_i + + # find real start + j = start_signal + while (fft_data[j] - noise_level) < 0.75 * (signal_strength - noise_level): + start_signal = j + j+=1 + + # find real end + j = end_signal + end_signal_orig = j + while (fft_data[j] - noise_level) < 0.75 * (signal_strength - noise_level): + end_signal = j + + if j <= 0: + end_signal = end_signal_orig + fake_end = True + break + j -= 1 + + + mid_signal = start_signal + ((end_signal - start_signal)/2) + signal_freq = self.start_freq + (((mid_signal + 1) / (len(fft_data)) * 9)) + signal_bw = self.align_symbolrate((end_signal - start_signal) * (9 / len(fft_data))) + + if signal_bw >= 0.033: + signals.append({'start': start_signal, 'end' : end_signal, 'mid' : mid_signal, 'freq' : signal_freq, 'signal_strength' : signal_strength/255, 'signal_bw' : signal_bw}) + + + + i += 1 + + return signals + + + async def update(self, window, fft): + polygon_data = [] + fft_data = [] + x = 0 + + while ( x < len(fft)-1 ): + db = [fft[x],fft[x+1]] + #y = int.from_bytes(db, 'little')/255 + fft_data.append(int.from_bytes(db, 'little')) + polygon_data.append((25 + (x/2 * self.x_tab),480-int.from_bytes(db, 'little')/255)) + x += 2 + + signals = await self.find_signals(fft_data) + + polygon_data.append((25,480)) + pygame.gfxdraw.filled_polygon(window, polygon_data,COL_SPECTRUM) + pygame.gfxdraw.aapolygon(window, polygon_data,(197,244,103)) + + + + for sig in signals: + text_width, text_height = self.font.size(str(round(sig['freq'],2))) + text = self.font.render(str(round(sig['freq'],2)) + "", True, COL_TEXT) + window.blit(text, (25 + (int(sig['mid']) * self.x_tab) - text_width/2, 480 - int(sig['signal_strength']) - 60)) + text_width, text_height = self.font.size(str(int(sig['signal_bw'] * 1000)) + "Ks") + + text = self.font.render(str(int(sig['signal_bw'] * 1000)) + "Ks", True, COL_TEXT) + window.blit(text, (25 + (int(sig['mid']) * self.x_tab) - text_width/2, 480 - int(sig['signal_strength']) - 40)) + + +class Socket: + def __init__(self): + self.websocket = None + + async def startup(self): + self.websocket = await websockets.connect(FFT_URL) + + async def updateFFT(self): + return await self.websocket.recv() + +async def main(): + + window = pygame.display.set_mode((WIDTH, HEIGHT)) + pygame.mouse.set_visible(False) + + graphics = Graphics(WIDTH, HEIGHT) + socket = Socket() + await socket.startup() + + while True: + + fft = await socket.updateFFT() + window.fill(COL_BG) + await graphics.update(window, fft) + pygame.display.flip() + + + +if __name__ == "__main__": + pygame.init() + asyncio.run(main()) + pygame.quit()