├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── config.h ├── device.h ├── flash ├── hardware ├── AFSK.c ├── AFSK.h ├── Serial.c └── Serial.h ├── images └── .keepdir ├── main.c ├── precompiled ├── MicroModemGP-direct.hex └── MicroModemGP-kiss.hex ├── protocol ├── AX25.c ├── AX25.h ├── HDLC.h ├── KISS.c ├── KISS.h ├── LLP.c └── LLP.h └── util ├── CRC-CCIT.c ├── CRC-CCIT.h ├── FIFO.h ├── constants.h └── time.h /.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | *.project 3 | *.workspace 4 | *.o 5 | *.d 6 | resources 7 | images/*.bin 8 | images/*.s19 9 | images/*.eep 10 | images/*.lss 11 | images/*.map 12 | images/*.elf 13 | images/*.sym 14 | images/*.hex 15 | flashdefault 16 | flashcurrent 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # AVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al. 2 | # Modified (bringing often-changed options to the top) by Elliot Williams 3 | 4 | # make all = Make software and program 5 | # make clean = Clean out built project files. 6 | # make program = Download the hex file to the device, using avrdude. Please 7 | # customize the avrdude settings below first! 8 | 9 | # Microcontroller Type 10 | #MCU = atmega1284p 11 | #MCU = atmega644p 12 | MCU = atmega328p 13 | 14 | # Target file name (without extension). 15 | TARGET = images/MicroModemGP 16 | 17 | # Programming hardware: type avrdude -c ? 18 | # to get a full listing. 19 | AVRDUDE_PROGRAMMER = arduino 20 | 21 | AVRDUDE_PORT = /dev/usb # not really needed for usb 22 | #AVRDUDE_PORT = /dev/parport0 # linux 23 | # AVRDUDE_PORT = lpt1 # windows 24 | 25 | ############# Don't need to change below here for most purposes (Elliot) 26 | 27 | # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. 28 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) 29 | OPT = s 30 | 31 | # Output format. (can be srec, ihex, binary) 32 | FORMAT = ihex 33 | 34 | # List C source files here. (C dependencies are automatically generated.) 35 | #SRC = $(TARGET).c 36 | SRC = main.c hardware/Serial.c hardware/AFSK.c util/CRC-CCIT.c protocol/LLP.c protocol/KISS.c 37 | 38 | # If there is more than one source file, append them above, or modify and 39 | # uncomment the following: 40 | #SRC += foo.c bar.c 41 | 42 | # You can also wrap lines by appending a backslash to the end of the line: 43 | #SRC += baz.c \ 44 | #xyzzy.c 45 | 46 | 47 | 48 | # List Assembler source files here. 49 | # Make them always end in a capital .S. Files ending in a lowercase .s 50 | # will not be considered source files but generated files (assembler 51 | # output from the compiler), and will be deleted upon "make clean"! 52 | # Even though the DOS/Win* filesystem matches both .s and .S the same, 53 | # it will preserve the spelling of the filenames, and gcc itself does 54 | # care about how the name is spelled on its command-line. 55 | ASRC = 56 | 57 | 58 | # List any extra directories to look for include files here. 59 | # Each directory must be seperated by a space. 60 | EXTRAINCDIRS = 61 | 62 | 63 | # Optional compiler flags. 64 | # -g: generate debugging information (for GDB, or for COFF conversion) 65 | # -O*: optimization level 66 | # -f...: tuning, see gcc manual and avr-libc documentation 67 | # -Wall...: warning level 68 | # -Wa,...: tell GCC to pass this to the assembler. 69 | # -ahlms: create assembler listing 70 | CFLAGS = -g -O$(OPT) \ 71 | -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ 72 | -Wall -Wstrict-prototypes \ 73 | -Wa,-adhlns=$(<:.c=.lst) \ 74 | $(patsubst %,-I%,$(EXTRAINCDIRS)) 75 | 76 | 77 | # Set a "language standard" compiler flag. 78 | # Unremark just one line below to set the language standard to use. 79 | # gnu99 = C99 + GNU extensions. See GCC manual for more information. 80 | #CFLAGS += -std=c89 81 | #CFLAGS += -std=gnu89 82 | #CFLAGS += -std=c99 83 | CFLAGS += -std=gnu99 84 | 85 | 86 | 87 | # Optional assembler flags. 88 | # -Wa,...: tell GCC to pass this to the assembler. 89 | # -ahlms: create listing 90 | # -gstabs: have the assembler create line number information; note that 91 | # for use in COFF files, additional information about filenames 92 | # and function names needs to be present in the assembler source 93 | # files -- see avr-libc docs [FIXME: not yet described there] 94 | ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 95 | 96 | 97 | 98 | # Optional linker flags. 99 | # -Wl,...: tell GCC to pass this to linker. 100 | # -Map: create map file 101 | # --cref: add cross reference to map file 102 | LDFLAGS = -Wl,-Map=$(TARGET).map,--cref 103 | 104 | 105 | 106 | # Additional libraries 107 | 108 | # Minimalistic printf version 109 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_min 110 | 111 | # Floating point printf version (requires -lm below) 112 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt 113 | 114 | # -lm = math library 115 | LDFLAGS += -lm 116 | 117 | 118 | # Programming support using avrdude. Settings and variables. 119 | 120 | 121 | AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex 122 | #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep 123 | 124 | AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) 125 | 126 | # Uncomment the following if you want avrdude's erase cycle counter. 127 | # Note that this counter needs to be initialized first using -Yn, 128 | # see avrdude manual. 129 | #AVRDUDE_ERASE += -y 130 | 131 | # Uncomment the following if you do /not/ wish a verification to be 132 | # performed after programming the device. 133 | #AVRDUDE_FLAGS += -V 134 | 135 | # Increase verbosity level. Please use this when submitting bug 136 | # reports about avrdude. See 137 | # to submit bug reports. 138 | #AVRDUDE_FLAGS += -v -v 139 | 140 | #Run while cable attached or don't 141 | AVRDUDE_FLAGS += -E reset #keep chip disabled while cable attached 142 | #AVRDUDE_FLAGS += -E noreset 143 | 144 | #AVRDUDE_WRITE_FLASH = -U lfuse:w:0x04:m #run with 8 Mhz clock 145 | 146 | #AVRDUDE_WRITE_FLASH = -U lfuse:w:0x21:m #run with 1 Mhz clock #default clock mode 147 | 148 | #AVRDUDE_WRITE_FLASH = -U lfuse:w:0x01:m #run with 1 Mhz clock no start up time 149 | 150 | # --------------------------------------------------------------------------- 151 | 152 | # Define programs and commands. 153 | SHELL = sh 154 | 155 | CC = avr-gcc 156 | 157 | OBJCOPY = avr-objcopy 158 | OBJDUMP = avr-objdump 159 | SIZE = avr-size 160 | 161 | 162 | # Programming support using avrdude. 163 | AVRDUDE = avrdude 164 | 165 | 166 | REMOVE = rm -f 167 | COPY = cp 168 | 169 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex 170 | ELFSIZE = $(SIZE) --mcu=$(MCU) -C $(TARGET).elf 171 | 172 | 173 | # Define Messages 174 | # English 175 | MSG_ERRORS_NONE = Firmware compiled successfully! 176 | MSG_BEGIN = Starting build... 177 | MSG_END = -------- Done -------- 178 | MSG_SIZE_BEFORE = Size before: 179 | MSG_SIZE_AFTER = Size after: 180 | MSG_COFF = Converting to AVR COFF: 181 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: 182 | MSG_FLASH = Creating load file for Flash: 183 | MSG_EEPROM = Creating load file for EEPROM: 184 | MSG_EXTENDED_LISTING = Creating Extended Listing: 185 | MSG_SYMBOL_TABLE = Creating Symbol Table: 186 | MSG_LINKING = Linking: 187 | MSG_COMPILING = Compiling: 188 | MSG_ASSEMBLING = Assembling: 189 | MSG_CLEANING = Cleaning project: 190 | 191 | 192 | 193 | 194 | # Define all object files. 195 | OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 196 | 197 | # Define all listing files. 198 | LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) 199 | 200 | # Combine all necessary flags and optional flags. 201 | # Add target processor to flags. 202 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) 203 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) 204 | 205 | 206 | 207 | # Default target: make program! 208 | #all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ 209 | # $(TARGET).lss $(TARGET).sym sizeafter finished end 210 | 211 | all: begin $(TARGET).elf $(TARGET).hex $(TARGET).eep \ 212 | $(TARGET).lss $(TARGET).sym cleanup sizeafter finished 213 | # $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) 214 | 215 | # Eye candy. 216 | # AVR Studio 3.x does not check make's exit code but relies on 217 | # the following magic strings to be generated by the compile job. 218 | begin: 219 | @echo 220 | @echo $(MSG_BEGIN) 221 | 222 | finished: 223 | @echo $(MSG_ERRORS_NONE) 224 | 225 | end: 226 | @echo $(MSG_END) 227 | @echo 228 | 229 | 230 | # Display size of file. 231 | sizebefore: 232 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi 233 | 234 | sizeafter: 235 | @if [ -f $(TARGET).elf ]; then echo; $(ELFSIZE); echo; fi 236 | 237 | 238 | 239 | # Display compiler version information. 240 | gccversion : 241 | @$(CC) --version 242 | 243 | 244 | 245 | 246 | # Convert ELF to COFF for use in debugging / simulating in 247 | # AVR Studio or VMLAB. 248 | COFFCONVERT=$(OBJCOPY) --debugging \ 249 | --change-section-address .data-0x800000 \ 250 | --change-section-address .bss-0x800000 \ 251 | --change-section-address .noinit-0x800000 \ 252 | --change-section-address .eeprom-0x810000 253 | 254 | 255 | coff: $(TARGET).elf 256 | # @echo 257 | # @echo $(MSG_COFF) $(TARGET).cof 258 | @$(COFFCONVERT) -O coff-avr $< $(TARGET).cof 259 | 260 | 261 | extcoff: $(TARGET).elf 262 | # @echo 263 | # @echo $(MSG_EXTENDED_COFF) $(TARGET).cof 264 | @$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof 265 | 266 | 267 | 268 | 269 | # Program the device. 270 | program: $(TARGET).hex $(TARGET).eep 271 | @$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) 272 | 273 | 274 | 275 | 276 | # Create final output files (.hex, .eep) from ELF output file. 277 | %.hex: %.elf 278 | # @echo 279 | # @echo $(MSG_FLASH) $@ 280 | @$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ 281 | 282 | %.eep: %.elf 283 | # @echo 284 | # @echo $(MSG_EEPROM) $@ 285 | # @echo Not generating any EEPROM images 286 | @-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ 287 | 288 | # Create extended listing file from ELF output file. 289 | %.lss: %.elf 290 | # @echo 291 | # @echo $(MSG_EXTENDED_LISTING) $@ 292 | @$(OBJDUMP) -h -S $< > $@ 293 | 294 | # Create a symbol table from ELF output file. 295 | %.sym: %.elf 296 | # @echo 297 | # @echo $(MSG_SYMBOL_TABLE) $@ 298 | @avr-nm -n $< > $@ 299 | 300 | 301 | 302 | # Link: create ELF output file from object files. 303 | .SECONDARY : $(TARGET).elf 304 | .PRECIOUS : $(OBJ) 305 | %.elf: $(OBJ) 306 | @echo $(MSG_LINKING) $@ 307 | @$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) 308 | 309 | 310 | # Compile: create object files from C source files. 311 | %.o : %.c 312 | @echo $(MSG_COMPILING) $< 313 | @$(CC) -c $(ALL_CFLAGS) $< -o $@ 314 | 315 | 316 | # Compile: create assembler files from C source files. 317 | %.s : %.c 318 | @$(CC) -S $(ALL_CFLAGS) $< -o $@ 319 | 320 | 321 | # Assemble: create object files from assembler source files. 322 | %.o : %.S 323 | @echo 324 | @echo $(MSG_ASSEMBLING) $< 325 | @$(CC) -c $(ALL_ASFLAGS) $< -o $@ 326 | 327 | 328 | 329 | # Target: clean project. 330 | clean: clean_list finished 331 | 332 | clean_list : 333 | @echo 334 | @echo $(MSG_CLEANING) 335 | $(REMOVE) $(TARGET).hex 336 | $(REMOVE) $(TARGET).eep 337 | $(REMOVE) $(TARGET).obj 338 | $(REMOVE) $(TARGET).cof 339 | $(REMOVE) $(TARGET).elf 340 | $(REMOVE) $(TARGET).map 341 | $(REMOVE) $(TARGET).obj 342 | $(REMOVE) $(TARGET).a90 343 | $(REMOVE) $(TARGET).sym 344 | $(REMOVE) $(TARGET).lnk 345 | $(REMOVE) $(TARGET).lss 346 | $(REMOVE) $(OBJ) 347 | $(REMOVE) $(LST) 348 | $(REMOVE) $(SRC:.c=.s) 349 | $(REMOVE) $(SRC:.c=.d) 350 | $(REMOVE) *~ 351 | 352 | cleanup: 353 | @$(REMOVE) $(SRC:.c=.s) 354 | @$(REMOVE) $(SRC:.c=.d) 355 | @$(REMOVE) $(LST) 356 | 357 | # Automatically generate C source code dependencies. 358 | # (Code originally taken from the GNU make user manual and modified 359 | # (See README.txt Credits).) 360 | # 361 | # Note that this will work with sh (bash) and sed that is shipped with WinAVR 362 | # (see the SHELL variable defined above). 363 | # This may not work with other shells or other seds. 364 | # 365 | %.d: %.c 366 | @set -e; $(CC) -MM $(ALL_CFLAGS) $< \ 367 | | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ 368 | [ -s $@ ] || rm -f $@ 369 | 370 | 371 | # Remove the '-' if you want to see the dependency files generated. 372 | -include $(SRC:.c=.d) 373 | 374 | 375 | 376 | # Listing of phony targets. 377 | .PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ 378 | clean clean_list program 379 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MicroModemGP 2 | ========== 3 | 4 | MicroModemGP is a general purpose firmware for [MicroModem](http://unsigned.io/micromodem). 5 | 6 | It supports both KISS mode serial connections, and direct serial connection without framing for easy communication with anything with a serial port. 7 | 8 | You can buy a complete modem from [my shop](http://unsigned.io/shop), or you can build one yourself pretty easily. Take a look at the documentation in the [MicroModem](https://github.com/markqvist/MicroModem) repository for information and getting started guides! 9 | 10 | ## Some features 11 | 12 | - Easily send and receive packets over mostly any radio 13 | - Full modulation and demodulation in software 14 | - Flexibility in how received packets are output over serial connection 15 | - Can run with open squelch 16 | - Supports KISS mode for use with programs on a host computer 17 | - 12,8 Hamming-code forward error correction and 12-byte interleaving 18 | - CRC checksum on packets ensure data integrity 19 | - Supports packets with up to 564 bytes of data 20 | 21 | ## Serial connection settings 22 | 23 | By default, the modem uses __9600 baud, 8N1__ serial. The baudrate can be modified in the "device.h" file. 24 | 25 | ## KISS mode or direct serial framing 26 | 27 | You can configure whether to use KISS serial framing or direct serial framing in the "config.h" file. 28 | 29 | When the modem is running in KISS mode, there's really not much more to it than connecting the modem to a computer, opening whatever program you want to use with it, and off you go. 30 | 31 | You can also configure the modem in direct serial framing mode. If using direct serial framing, the firmware uses time-sensitive input, which means that it will buffer serial data as it comes in, and when it has received no data for a few milliseconds, it will start sending whatever it has received. 32 | 33 | If you're manually typing things to the modem from a terminal, you should therefore set your serial terminal program to not send data for every keystroke, but only on new-line, or pressing send or whatever. You can also compile the firmware for KISS mode serial connection, if you have a host program using KISS. If you are using MicroModemGP with [Reticulum](https://github.com/markqvist/Reticulum), use KISS. 34 | 35 | ## Other notes 36 | 37 | The project has been implemented in your normal C with makefile style, and uses AVR Libc. The firmware is compatible with Arduino-based products, although it was not written in the Arduino IDE. 38 | 39 | Visit [my site](http://unsigned.io) for questions, comments and other details. 40 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_H 2 | #define CONFIG_H 3 | 4 | // Choose whether to use KISS or direct 5 | // framing for serial data 6 | #define SERIAL_FRAMING SERIAL_FRAMING_KISS 7 | //#define SERIAL_FRAMING SERIAL_FRAMING_DIRECT 8 | 9 | #endif -------------------------------------------------------------------------------- /device.h: -------------------------------------------------------------------------------- 1 | #include "util/constants.h" 2 | 3 | #ifndef DEVICE_CONFIGURATION 4 | #define DEVICE_CONFIGURATION 5 | 6 | // CPU settings 7 | #define TARGET_CPU m328p 8 | #define F_CPU 16000000 9 | #define FREQUENCY_CORRECTION 0 10 | 11 | // ADC settings 12 | #define OPEN_SQUELCH true 13 | #define ADC_REFERENCE REF_3V3 14 | // OR 15 | //#define ADC_REFERENCE REF_5V 16 | 17 | // Sampling & timer setup 18 | #define CONFIG_AFSK_DAC_SAMPLERATE 9600 19 | 20 | // Don't change this! Change it in 21 | // config.h instead. This is going away 22 | // soon, and only an intermediary thing. 23 | #define SERIAL_PROTOCOL PROTOCOL_KISS 24 | 25 | // Serial settings 26 | #define BAUD 9600 27 | #define SERIAL_DEBUG false 28 | #define TX_MAXWAIT 5UL 29 | 30 | // Port settings 31 | #if TARGET_CPU == m328p 32 | #define DAC_PORT PORTD 33 | #define DAC_DDR DDRD 34 | #define LED_PORT PORTB 35 | #define LED_DDR DDRB 36 | #define ADC_PORT PORTC 37 | #define ADC_DDR DDRC 38 | #endif 39 | 40 | #endif -------------------------------------------------------------------------------- /flash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | avrdude -p $2 -c arduino -P /dev/tty$1 -b 115200 -F -U flash:w:images/MicroModemGP.hex 3 | -------------------------------------------------------------------------------- /hardware/AFSK.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "AFSK.h" 3 | #include "util/time.h" 4 | 5 | extern volatile ticks_t _clock; 6 | extern unsigned long custom_preamble; 7 | extern unsigned long custom_tail; 8 | 9 | bool hw_afsk_dac_isr = false; 10 | bool hw_5v_ref = false; 11 | Afsk *AFSK_modem; 12 | 13 | // Forward declerations 14 | int afsk_getchar(FILE *strem); 15 | int afsk_putchar(char c, FILE *stream); 16 | 17 | void AFSK_hw_refDetect(void) { 18 | // This is manual for now 19 | #if ADC_REFERENCE == REF_5V 20 | hw_5v_ref = true; 21 | #else 22 | hw_5v_ref = false; 23 | #endif 24 | } 25 | 26 | void AFSK_hw_init(void) { 27 | // Set up ADC 28 | 29 | AFSK_hw_refDetect(); 30 | 31 | TCCR1A = 0; 32 | TCCR1B = _BV(CS10) | _BV(WGM13) | _BV(WGM12); 33 | ICR1 = (((CPU_FREQ+FREQUENCY_CORRECTION)) / 9600) - 1; 34 | 35 | if (hw_5v_ref) { 36 | ADMUX = _BV(REFS0) | 0; 37 | } else { 38 | ADMUX = 0; 39 | } 40 | 41 | ADC_DDR &= ~_BV(0); 42 | ADC_PORT &= ~_BV(0); 43 | DIDR0 |= _BV(0); 44 | ADCSRB = _BV(ADTS2) | 45 | _BV(ADTS1) | 46 | _BV(ADTS0); 47 | ADCSRA = _BV(ADEN) | 48 | _BV(ADSC) | 49 | _BV(ADATE)| 50 | _BV(ADIE) | 51 | _BV(ADPS2); 52 | 53 | AFSK_DAC_INIT(); 54 | LED_TX_INIT(); 55 | LED_RX_INIT(); 56 | } 57 | 58 | void AFSK_init(Afsk *afsk) { 59 | // Allocate modem struct memory 60 | memset(afsk, 0, sizeof(*afsk)); 61 | AFSK_modem = afsk; 62 | // Set phase increment 63 | afsk->phaseInc = MARK_INC; 64 | afsk->silentSamples = 0; 65 | 66 | // Initialise FIFO buffers 67 | fifo_init(&afsk->delayFifo, (uint8_t *)afsk->delayBuf, sizeof(afsk->delayBuf)); 68 | fifo_init(&afsk->rxFifo, afsk->rxBuf, sizeof(afsk->rxBuf)); 69 | fifo_init(&afsk->txFifo, afsk->txBuf, sizeof(afsk->txBuf)); 70 | 71 | // Fill delay FIFO with zeroes 72 | for (int i = 0; idelayFifo, 0); 74 | } 75 | 76 | AFSK_hw_init(); 77 | 78 | // Set up streams 79 | FILE afsk_fd = FDEV_SETUP_STREAM(afsk_putchar, afsk_getchar, _FDEV_SETUP_RW); 80 | afsk->fd = afsk_fd; 81 | } 82 | 83 | static void AFSK_txStart(Afsk *afsk) { 84 | if (!afsk->sending) { 85 | afsk->phaseInc = MARK_INC; 86 | afsk->phaseAcc = 0; 87 | afsk->bitstuffCount = 0; 88 | afsk->sending = true; 89 | afsk->sending_data = true; 90 | LED_TX_ON(); 91 | afsk->preambleLength = DIV_ROUND(custom_preamble * BITRATE, 8000); 92 | AFSK_DAC_IRQ_START(); 93 | } 94 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { 95 | afsk->tailLength = DIV_ROUND(custom_tail * BITRATE, 8000); 96 | } 97 | } 98 | 99 | int afsk_putchar(char c, FILE *stream) { 100 | AFSK_txStart(AFSK_modem); 101 | while(fifo_isfull_locked(&AFSK_modem->txFifo)) { /* Wait */ } 102 | fifo_push_locked(&AFSK_modem->txFifo, c); 103 | return 1; 104 | } 105 | 106 | int afsk_getchar(FILE *stream) { 107 | if (fifo_isempty_locked(&AFSK_modem->rxFifo)) { 108 | return EOF; 109 | } else { 110 | return fifo_pop_locked(&AFSK_modem->rxFifo); 111 | } 112 | } 113 | 114 | void AFSK_transmit(char *buffer, size_t size) { 115 | fifo_flush(&AFSK_modem->txFifo); 116 | int i = 0; 117 | while (size--) { 118 | afsk_putchar(buffer[i++], NULL); 119 | } 120 | } 121 | 122 | uint8_t AFSK_dac_isr(Afsk *afsk) { 123 | if (afsk->sampleIndex == 0) { 124 | if (afsk->txBit == 0) { 125 | if (fifo_isempty(&afsk->txFifo) && afsk->tailLength == 0) { 126 | AFSK_DAC_IRQ_STOP(); 127 | afsk->sending = false; 128 | afsk->sending_data = false; 129 | LED_TX_OFF(); 130 | return 0; 131 | } else { 132 | if (!afsk->bitStuff) afsk->bitstuffCount = 0; 133 | afsk->bitStuff = true; 134 | if (afsk->preambleLength == 0) { 135 | if (fifo_isempty(&afsk->txFifo)) { 136 | afsk->sending_data = false; 137 | afsk->tailLength--; 138 | afsk->currentOutputByte = HDLC_FLAG; 139 | } else { 140 | afsk->currentOutputByte = fifo_pop(&afsk->txFifo); 141 | } 142 | } else { 143 | afsk->preambleLength--; 144 | afsk->currentOutputByte = HDLC_FLAG; 145 | } 146 | if (afsk->currentOutputByte == LLP_ESC) { 147 | if (fifo_isempty(&afsk->txFifo)) { 148 | AFSK_DAC_IRQ_STOP(); 149 | afsk->sending = false; 150 | LED_TX_OFF(); 151 | return 0; 152 | } else { 153 | afsk->currentOutputByte = fifo_pop(&afsk->txFifo); 154 | } 155 | } else if (afsk->currentOutputByte == HDLC_FLAG || afsk->currentOutputByte == HDLC_RESET) { 156 | afsk->bitStuff = false; 157 | } 158 | } 159 | afsk->txBit = 0x01; 160 | } 161 | 162 | if (afsk->bitStuff && afsk->bitstuffCount >= BIT_STUFF_LEN) { 163 | afsk->bitstuffCount = 0; 164 | afsk->phaseInc = SWITCH_TONE(afsk->phaseInc); 165 | } else { 166 | if (afsk->currentOutputByte & afsk->txBit) { 167 | afsk->bitstuffCount++; 168 | } else { 169 | afsk->bitstuffCount = 0; 170 | afsk->phaseInc = SWITCH_TONE(afsk->phaseInc); 171 | } 172 | afsk->txBit <<= 1; 173 | } 174 | 175 | afsk->sampleIndex = SAMPLESPERBIT; 176 | } 177 | 178 | afsk->phaseAcc += afsk->phaseInc; 179 | afsk->phaseAcc %= SIN_LEN; 180 | afsk->sampleIndex--; 181 | 182 | return sinSample(afsk->phaseAcc); 183 | } 184 | 185 | static bool hdlcParse(Hdlc *hdlc, bool bit, FIFOBuffer *fifo) { 186 | // Initialise a return value. We start with the 187 | // assumption that all is going to end well :) 188 | bool ret = true; 189 | 190 | // Bitshift our byte of demodulated bits to 191 | // the left by one bit, to make room for the 192 | // next incoming bit 193 | hdlc->demodulatedBits <<= 1; 194 | // And then put the newest bit from the 195 | // demodulator into the byte. 196 | hdlc->demodulatedBits |= bit ? 1 : 0; 197 | 198 | // Now we'll look at the last 8 received bits, and 199 | // check if we have received a HDLC flag (01111110) 200 | if (hdlc->demodulatedBits == HDLC_FLAG) { 201 | // If we have, check that our output buffer is 202 | // not full. 203 | if (!fifo_isfull(fifo)) { 204 | // If it isn't, we'll push the HDLC_FLAG into 205 | // the buffer and indicate that we are now 206 | // receiving data. For bling we also turn 207 | // on the RX LED. 208 | fifo_push(fifo, HDLC_FLAG); 209 | hdlc->receiving = true; 210 | 211 | if (hdlc->dcd_count < DCD_MIN_COUNT) { 212 | hdlc->dcd = false; 213 | hdlc->dcd_count++; 214 | } else { 215 | hdlc->dcd = true; 216 | } 217 | 218 | #if OPEN_SQUELCH == false 219 | LED_RX_ON(); 220 | #endif 221 | } else { 222 | // If the buffer is full, we have a problem 223 | // and abort by setting the return value to 224 | // false and stopping the here. 225 | 226 | ret = false; 227 | hdlc->receiving = false; 228 | hdlc->dcd = false; 229 | hdlc->dcd_count = 0; 230 | } 231 | 232 | // Everytime we receive a HDLC_FLAG, we reset the 233 | // storage for our current incoming byte and bit 234 | // position in that byte. This effectively 235 | // synchronises our parsing to the start and end 236 | // of the received bytes. 237 | hdlc->currentByte = 0; 238 | hdlc->bitIndex = 0; 239 | return ret; 240 | } 241 | 242 | // Check if we have received a RESET flag (01111111) 243 | // In this comparison we also detect when no transmission 244 | // (or silence) is taking place, and the demodulator 245 | // returns an endless stream of zeroes. Due to the NRZ-S 246 | // coding, the actual bits send to this function will 247 | // be an endless stream of ones, which this AND operation 248 | // will also detect. 249 | if ((hdlc->demodulatedBits & HDLC_RESET) == HDLC_RESET) { 250 | // If we have, something probably went wrong at the 251 | // transmitting end, and we abort the reception. 252 | hdlc->receiving = false; 253 | hdlc->dcd = false; 254 | hdlc->dcd_count = 0; 255 | return ret; 256 | } 257 | 258 | // Check the DCD status and set RX LED appropriately 259 | if (hdlc->dcd) { 260 | LED_RX_ON(); 261 | } else { 262 | LED_RX_OFF(); 263 | } 264 | 265 | // If we have not yet seen a HDLC_FLAG indicating that 266 | // a transmission is actually taking place, don't bother 267 | // with anything. 268 | if (!hdlc->receiving) { 269 | hdlc->dcd = false; 270 | hdlc->dcd_count = 0; 271 | 272 | return ret; 273 | } 274 | 275 | // First check if what we are seeing is a stuffed bit. 276 | // Since the different HDLC control characters like 277 | // HDLC_FLAG, HDLC_RESET and such could also occur in 278 | // a normal data stream, we employ a method known as 279 | // "bit stuffing". All control characters have more than 280 | // 5 ones in a row, so if the transmitting party detects 281 | // this sequence in the _data_ to be transmitted, it inserts 282 | // a zero to avoid the receiving party interpreting it as 283 | // a control character. Therefore, if we detect such a 284 | // "stuffed bit", we simply ignore it and wait for the 285 | // next bit to come in. 286 | // 287 | // We do the detection by applying an AND bit-mask to the 288 | // stream of demodulated bits. This mask is 00111111 (0x3f) 289 | // if the result of the operation is 00111110 (0x3e), we 290 | // have detected a stuffed bit. 291 | if ((hdlc->demodulatedBits & 0x3f) == 0x3e) 292 | return ret; 293 | 294 | // If we have an actual 1 bit, push this to the current byte 295 | // If it's a zero, we don't need to do anything, since the 296 | // bit is initialized to zero when we bitshifted earlier. 297 | if (hdlc->demodulatedBits & 0x01) 298 | hdlc->currentByte |= 0x80; 299 | 300 | // Increment the bitIndex and check if we have a complete byte 301 | if (++hdlc->bitIndex >= 8) { 302 | // If we have a HDLC control character, put a AX.25 escape 303 | // in the received data. We know we need to do this, 304 | // because at this point we must have already seen a HDLC 305 | // flag, meaning that this control character is the result 306 | // of a bitstuffed byte that is equal to said control 307 | // character, but is actually part of the data stream. 308 | // By inserting the escape character, we tell the protocol 309 | // layer that this is not an actual control character, but 310 | // data. 311 | if ((hdlc->currentByte == HDLC_FLAG || 312 | hdlc->currentByte == HDLC_RESET || 313 | hdlc->currentByte == LLP_ESC)) { 314 | // We also need to check that our received data buffer 315 | // is not full before putting more data in 316 | if (!fifo_isfull(fifo)) { 317 | fifo_push(fifo, LLP_ESC); 318 | } else { 319 | // If it is, abort and return false 320 | hdlc->receiving = false; 321 | hdlc->dcd = false; 322 | hdlc->dcd_count = 0; 323 | LED_RX_OFF(); 324 | ret = false; 325 | } 326 | } 327 | 328 | // Push the actual byte to the received data FIFO, 329 | // if it isn't full. 330 | if (!fifo_isfull(fifo)) { 331 | fifo_push(fifo, hdlc->currentByte); 332 | } else { 333 | // If it is, well, you know by now! 334 | hdlc->receiving = false; 335 | hdlc->dcd = false; 336 | hdlc->dcd_count = 0; 337 | LED_RX_OFF(); 338 | ret = false; 339 | } 340 | 341 | // Wipe received byte and reset bit index to 0 342 | hdlc->currentByte = 0; 343 | hdlc->bitIndex = 0; 344 | 345 | } else { 346 | // We don't have a full byte yet, bitshift the byte 347 | // to make room for the next bit 348 | hdlc->currentByte >>= 1; 349 | } 350 | 351 | return ret; 352 | } 353 | 354 | 355 | void AFSK_adc_isr(Afsk *afsk, int8_t currentSample) { 356 | // To determine the received frequency, and thereby 357 | // the bit of the sample, we multiply the sample by 358 | // a sample delayed by (samples per bit / 2). 359 | // We then lowpass-filter the samples with a 360 | // Chebyshev filter. The lowpass filtering serves 361 | // to "smooth out" the variations in the samples. 362 | 363 | afsk->iirX[0] = afsk->iirX[1]; 364 | 365 | #if FILTER_CUTOFF == 600 366 | afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) >> 2; 367 | // The above is a simplification of: 368 | // afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) / 3.558147322; 369 | #elif FILTER_CUTOFF == 800 370 | afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) >> 2; 371 | // The above is a simplification of: 372 | // afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) / 2.899043379; 373 | #elif FILTER_CUTOFF == 1200 374 | afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) >> 1; 375 | // The above is a simplification of: 376 | // afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) / 2.228465666; 377 | #elif FILTER_CUTOFF == 1600 378 | afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) >> 1; 379 | // The above is a simplification of: 380 | // afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) / 1.881349100; 381 | #else 382 | #error Unsupported filter cutoff! 383 | #endif 384 | 385 | afsk->iirY[0] = afsk->iirY[1]; 386 | 387 | #if FILTER_CUTOFF == 600 388 | afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + (afsk->iirY[0] >> 1); 389 | // The above is a simplification of a first-order 600Hz chebyshev filter: 390 | // afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + (afsk->iirY[0] * 0.4379097269); 391 | #elif FILTER_CUTOFF == 800 392 | afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + (afsk->iirY[0] / 3); 393 | // The above is a simplification of a first-order 800Hz chebyshev filter: 394 | // afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + (afsk->iirY[0] * 0.3101172565); 395 | #elif FILTER_CUTOFF == 1200 396 | afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + (afsk->iirY[0] / 10); 397 | // The above is a simplification of a first-order 1200Hz chebyshev filter: 398 | // afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + (afsk->iirY[0] * 0.1025215106); 399 | #elif FILTER_CUTOFF == 1600 400 | afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + -1*(afsk->iirY[0] / 17); 401 | // The above is a simplification of a first-order 1600Hz chebyshev filter: 402 | // afsk->iirY[1] = afsk->iirX[0] + afsk->iirX[1] + (afsk->iirY[0] * -0.0630669239); 403 | #else 404 | #error Unsupported filter cutoff! 405 | #endif 406 | 407 | 408 | // We put the sampled bit in a delay-line: 409 | // First we bitshift everything 1 left 410 | afsk->sampledBits <<= 1; 411 | // And then add the sampled bit to our delay line 412 | afsk->sampledBits |= (afsk->iirY[1] > 0) ? 0 : 1; 413 | 414 | // Put the current raw sample in the delay FIFO 415 | fifo_push(&afsk->delayFifo, currentSample); 416 | 417 | // We need to check whether there is a signal transition. 418 | // If there is, we can recalibrate the phase of our 419 | // sampler to stay in sync with the transmitter. A bit of 420 | // explanation is required to understand how this works. 421 | // Since we have PHASE_MAX/PHASE_BITS = 8 samples per bit, 422 | // we employ a phase counter (currentPhase), that increments 423 | // by PHASE_BITS everytime a sample is captured. When this 424 | // counter reaches PHASE_MAX, it wraps around by modulus 425 | // PHASE_MAX. We then look at the last three samples we 426 | // captured and determine if the bit was a one or a zero. 427 | // 428 | // This gives us a "window" looking into the stream of 429 | // samples coming from the ADC. Sort of like this: 430 | // 431 | // Past Future 432 | // 0000000011111111000000001111111100000000 433 | // |________| 434 | // || 435 | // Window 436 | // 437 | // Every time we detect a signal transition, we adjust 438 | // where this window is positioned a little. How much we 439 | // adjust it is defined by PHASE_INC. If our current phase 440 | // phase counter value is less than half of PHASE_MAX (ie, 441 | // the window size) when a signal transition is detected, 442 | // add PHASE_INC to our phase counter, effectively moving 443 | // the window a little bit backward (to the left in the 444 | // illustration), inversely, if the phase counter is greater 445 | // than half of PHASE_MAX, we move it forward a little. 446 | // This way, our "window" is constantly seeking to position 447 | // it's center at the bit transitions. Thus, we synchronise 448 | // our timing to the transmitter, even if it's timing is 449 | // a little off compared to our own. 450 | if (SIGNAL_TRANSITIONED(afsk->sampledBits)) { 451 | if (afsk->currentPhase < PHASE_THRESHOLD) { 452 | afsk->currentPhase += PHASE_INC; 453 | } else { 454 | afsk->currentPhase -= PHASE_INC; 455 | } 456 | afsk->silentSamples = 0; 457 | } else { 458 | afsk->silentSamples++; 459 | } 460 | 461 | // We increment our phase counter 462 | afsk->currentPhase += PHASE_BITS; 463 | 464 | // Check if we have reached the end of 465 | // our sampling window. 466 | if (afsk->currentPhase >= PHASE_MAX) { 467 | // If we have, wrap around our phase 468 | // counter by modulus 469 | afsk->currentPhase %= PHASE_MAX; 470 | 471 | // Bitshift to make room for the next 472 | // bit in our stream of demodulated bits 473 | afsk->actualBits <<= 1; 474 | 475 | // We determine the actual bit value by reading 476 | // the last 3 sampled bits. If there is two or 477 | // more 1's, we will assume that the transmitter 478 | // sent us a one, otherwise we assume a zero 479 | uint8_t bits = afsk->sampledBits & 0x07; 480 | if (bits == 0x07 || // 111 481 | bits == 0x06 || // 110 482 | bits == 0x05 || // 101 483 | bits == 0x03 // 011 484 | ) { 485 | afsk->actualBits |= 1; 486 | } 487 | 488 | //// Alternative using five bits //////////////// 489 | // uint8_t bits = afsk->sampledBits & 0x0f; 490 | // uint8_t c = 0; 491 | // c += bits & BV(1); 492 | // c += bits & BV(2); 493 | // c += bits & BV(3); 494 | // c += bits & BV(4); 495 | // c += bits & BV(5); 496 | // if (c >= 3) afsk->actualBits |= 1; 497 | ///////////////////////////////////////////////// 498 | 499 | // Now we can pass the actual bit to the HDLC parser. 500 | // We are using NRZ-S coding, so if 2 consecutive bits 501 | // have the same value, we have a 1, otherwise a 0. 502 | // We use the TRANSITION_FOUND function to determine this. 503 | // 504 | // This is smart in combination with bit stuffing, 505 | // since it ensures a transmitter will never send more 506 | // than five consecutive 1's. When sending consecutive 507 | // ones, the signal stays at the same level, and if 508 | // this happens for longer periods of time, we would 509 | // not be able to synchronize our phase to the transmitter 510 | // and would start experiencing "bit slip". 511 | // 512 | // By combining bit-stuffing with NRZ-S coding, we ensure 513 | // that the signal will regularly make transitions 514 | // that we can use to synchronize our phase. 515 | // 516 | // We also check the return of the Link Control parser 517 | // to check if an error occured. 518 | 519 | if (!hdlcParse(&afsk->hdlc, !TRANSITION_FOUND(afsk->actualBits), &afsk->rxFifo)) { 520 | afsk->status |= 1; 521 | if (fifo_isfull(&afsk->rxFifo)) { 522 | fifo_flush(&afsk->rxFifo); 523 | afsk->status = 0; 524 | } 525 | } 526 | } 527 | 528 | if (afsk->silentSamples > DCD_TIMEOUT_SAMPLES) { 529 | afsk->silentSamples = 0; 530 | afsk->hdlc.dcd = false; 531 | LED_RX_OFF(); 532 | } 533 | 534 | } 535 | 536 | 537 | ISR(ADC_vect) { 538 | TIFR1 = _BV(ICF1); 539 | AFSK_adc_isr(AFSK_modem, ((int16_t)((ADC) >> 2) - 128)); 540 | if (hw_afsk_dac_isr) { 541 | DAC_PORT = (AFSK_dac_isr(AFSK_modem) & 0xF0) | _BV(3); 542 | } else { 543 | DAC_PORT = 128; 544 | } 545 | ++_clock; 546 | } -------------------------------------------------------------------------------- /hardware/AFSK.h: -------------------------------------------------------------------------------- 1 | #ifndef AFSK_H 2 | #define AFSK_H 3 | 4 | #include "device.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "util/FIFO.h" 10 | #include "util/time.h" 11 | #include "protocol/HDLC.h" 12 | 13 | #define SIN_LEN 512 14 | static const uint8_t sin_table[] PROGMEM = 15 | { 16 | 128, 129, 131, 132, 134, 135, 137, 138, 140, 142, 143, 145, 146, 148, 149, 151, 17 | 152, 154, 155, 157, 158, 160, 162, 163, 165, 166, 167, 169, 170, 172, 173, 175, 18 | 176, 178, 179, 181, 182, 183, 185, 186, 188, 189, 190, 192, 193, 194, 196, 197, 19 | 198, 200, 201, 202, 203, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 20 | 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 21 | 234, 234, 235, 236, 237, 238, 238, 239, 240, 241, 241, 242, 243, 243, 244, 245, 22 | 245, 246, 246, 247, 248, 248, 249, 249, 250, 250, 250, 251, 251, 252, 252, 252, 23 | 253, 253, 253, 253, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 24 | }; 25 | 26 | inline static uint8_t sinSample(uint16_t i) { 27 | uint16_t newI = i % (SIN_LEN/2); 28 | newI = (newI >= (SIN_LEN/4)) ? (SIN_LEN/2 - newI -1) : newI; 29 | uint8_t sine = pgm_read_byte(&sin_table[newI]); 30 | return (i >= (SIN_LEN/2)) ? (255 - sine) : sine; 31 | } 32 | 33 | 34 | #define SWITCH_TONE(inc) (((inc) == MARK_INC) ? SPACE_INC : MARK_INC) 35 | #define BITS_DIFFER(bits1, bits2) (((bits1)^(bits2)) & 0x01) 36 | #define DUAL_XOR(bits1, bits2) ((((bits1)^(bits2)) & 0x03) == 0x03) 37 | #define SIGNAL_TRANSITIONED(bits) DUAL_XOR((bits), (bits) >> 2) 38 | #define TRANSITION_FOUND(bits) BITS_DIFFER((bits), (bits) >> 1) 39 | 40 | #define CPU_FREQ F_CPU 41 | 42 | #define CONFIG_AFSK_RX_BUFLEN 64 43 | #define CONFIG_AFSK_TX_BUFLEN 64 44 | #define CONFIG_AFSK_RXTIMEOUT 0 45 | #define CONFIG_AFSK_PREAMBLE_LEN 350UL 46 | #define CONFIG_AFSK_TRAILER_LEN 50UL 47 | #define BIT_STUFF_LEN 5 48 | 49 | #define SAMPLERATE 9600 50 | #define BITRATE 1200 51 | 52 | #define SAMPLESPERBIT (SAMPLERATE / BITRATE) 53 | #define PHASE_INC 1 // Nudge by an eigth of a sample each adjustment 54 | 55 | #define DCD_MIN_COUNT 6 56 | #define DCD_TIMEOUT_SAMPLES 96 57 | 58 | #if BITRATE == 960 59 | #define FILTER_CUTOFF 600 60 | #define MARK_FREQ 960 61 | #define SPACE_FREQ 1600 62 | #define PHASE_BITS 10 // How much to increment phase counter each sample 63 | #elif BITRATE == 1200 64 | #define FILTER_CUTOFF 600 65 | #define MARK_FREQ 1200 66 | #define SPACE_FREQ 2200 67 | #define PHASE_BITS 8 68 | #elif BITRATE == 1600 69 | #define FILTER_CUTOFF 800 70 | #define MARK_FREQ 1600 71 | #define SPACE_FREQ 2600 72 | #define PHASE_BITS 8 73 | #else 74 | #error Unsupported bitrate! 75 | #endif 76 | 77 | #define PHASE_MAX (SAMPLESPERBIT * PHASE_BITS) // Resolution of our phase counter = 64 78 | #define PHASE_THRESHOLD (PHASE_MAX / 2) // Target transition point of our phase window 79 | 80 | typedef struct Hdlc 81 | { 82 | uint8_t demodulatedBits; 83 | uint8_t bitIndex; 84 | uint8_t currentByte; 85 | bool receiving; 86 | bool dcd; 87 | uint8_t dcd_count; 88 | } Hdlc; 89 | 90 | typedef struct Afsk 91 | { 92 | // Stream access to modem 93 | FILE fd; 94 | 95 | // General values 96 | Hdlc hdlc; // We need a link control structure 97 | uint16_t preambleLength; // Length of sync preamble 98 | uint16_t tailLength; // Length of transmission tail 99 | 100 | // Modulation values 101 | uint8_t sampleIndex; // Current sample index for outgoing bit 102 | uint8_t currentOutputByte; // Current byte to be modulated 103 | uint8_t txBit; // Mask of current modulated bit 104 | bool bitStuff; // Whether bitstuffing is allowed 105 | 106 | uint8_t bitstuffCount; // Counter for bit-stuffing 107 | 108 | uint16_t phaseAcc; // Phase accumulator 109 | uint16_t phaseInc; // Phase increment per sample 110 | 111 | uint8_t silentSamples; // How many samples were completely silent 112 | 113 | FIFOBuffer txFifo; // FIFO for transmit data 114 | uint8_t txBuf[CONFIG_AFSK_TX_BUFLEN]; // Actual data storage for said FIFO 115 | 116 | volatile bool sending; // Set when modem is sending 117 | volatile bool sending_data; // Set when modem is sending data 118 | 119 | // Demodulation values 120 | FIFOBuffer delayFifo; // Delayed FIFO for frequency discrimination 121 | int8_t delayBuf[SAMPLESPERBIT / 2 + 1]; // Actual data storage for said FIFO 122 | 123 | FIFOBuffer rxFifo; // FIFO for received data 124 | uint8_t rxBuf[CONFIG_AFSK_RX_BUFLEN]; // Actual data storage for said FIFO 125 | 126 | int16_t iirX[2]; // IIR Filter X cells 127 | int16_t iirY[2]; // IIR Filter Y cells 128 | 129 | uint8_t sampledBits; // Bits sampled by the demodulator (at ADC speed) 130 | int8_t currentPhase; // Current phase of the demodulator 131 | uint8_t actualBits; // Actual found bits at correct bitrate 132 | 133 | volatile int status; // Status of the modem, 0 means OK 134 | 135 | } Afsk; 136 | 137 | #define DIV_ROUND(dividend, divisor) (((dividend) + (divisor) / 2) / (divisor)) 138 | #define MARK_INC (uint16_t)(DIV_ROUND(SIN_LEN * (uint32_t)MARK_FREQ, CONFIG_AFSK_DAC_SAMPLERATE)) 139 | #define SPACE_INC (uint16_t)(DIV_ROUND(SIN_LEN * (uint32_t)SPACE_FREQ, CONFIG_AFSK_DAC_SAMPLERATE)) 140 | 141 | #define AFSK_DAC_IRQ_START() do { extern bool hw_afsk_dac_isr; hw_afsk_dac_isr = true; } while (0) 142 | #define AFSK_DAC_IRQ_STOP() do { extern bool hw_afsk_dac_isr; hw_afsk_dac_isr = false; } while (0) 143 | #define AFSK_DAC_INIT() do { DAC_DDR |= 0xF8; } while (0) 144 | 145 | // Here's some macros for controlling the RX/TX LEDs 146 | // THE _INIT() functions writes to the DDRB register 147 | // to configure the pins as output pins, and the _ON() 148 | // and _OFF() functions writes to the PORT registers 149 | // to turn the pins on or off. 150 | #define LED_TX_INIT() do { LED_DDR |= _BV(1); } while (0) 151 | #define LED_TX_ON() do { LED_PORT |= _BV(1); } while (0) 152 | #define LED_TX_OFF() do { LED_PORT &= ~_BV(1); } while (0) 153 | 154 | #define LED_RX_INIT() do { LED_DDR |= _BV(2); } while (0) 155 | #define LED_RX_ON() do { LED_PORT |= _BV(2); } while (0) 156 | #define LED_RX_OFF() do { LED_PORT &= ~_BV(2); } while (0) 157 | 158 | void AFSK_init(Afsk *afsk); 159 | void AFSK_transmit(char *buffer, size_t size); 160 | void AFSK_poll(Afsk *afsk); 161 | 162 | #endif -------------------------------------------------------------------------------- /hardware/Serial.c: -------------------------------------------------------------------------------- 1 | #include "Serial.h" 2 | #include 3 | #include 4 | #include 5 | 6 | void serial_init(Serial *serial) { 7 | memset(serial, 0, sizeof(*serial)); 8 | UBRR0H = UBRRH_VALUE; 9 | UBRR0L = UBRRL_VALUE; 10 | 11 | #if USE_2X 12 | UCSR0A |= _BV(U2X0); 13 | #else 14 | UCSR0A &= ~(_BV(U2X0)); 15 | #endif 16 | 17 | // Set to 8-bit data, enable RX and TX 18 | UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); 19 | UCSR0B = _BV(RXEN0) | _BV(TXEN0); 20 | 21 | FILE uart0_fd = FDEV_SETUP_STREAM(uart0_putchar, uart0_getchar, _FDEV_SETUP_RW); 22 | //FILE uart0_fd = FDEV_SETUP_STREAM(uart0_putchar, NULL, _FDEV_SETUP_WRITE); 23 | 24 | serial->uart0 = uart0_fd; 25 | } 26 | 27 | bool serial_available(uint8_t index) { 28 | if (index == 0) { 29 | if (UCSR0A & _BV(RXC0)) return true; 30 | } 31 | return false; 32 | } 33 | 34 | 35 | int uart0_putchar(char c, FILE *stream) { 36 | loop_until_bit_is_set(UCSR0A, UDRE0); 37 | UDR0 = c; 38 | return 1; 39 | } 40 | 41 | int uart0_getchar(FILE *stream) { 42 | loop_until_bit_is_set(UCSR0A, RXC0); 43 | return UDR0; 44 | } 45 | 46 | char uart0_getchar_nowait(void) { 47 | if (!(UCSR0A & _BV(RXC0))) return EOF; 48 | return UDR0; 49 | } -------------------------------------------------------------------------------- /hardware/Serial.h: -------------------------------------------------------------------------------- 1 | #ifndef SERIAL_H 2 | #define SERIAL_H 3 | 4 | #include "device.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | typedef struct Serial { 11 | FILE uart0; 12 | } Serial; 13 | 14 | void serial_init(Serial *serial); 15 | bool serial_available(uint8_t index); 16 | int uart0_putchar(char c, FILE *stream); 17 | int uart0_getchar(FILE *stream); 18 | char uart0_getchar_nowait(void); 19 | 20 | #endif -------------------------------------------------------------------------------- /images/.keepdir: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModemGP/2d54dea9a54b289ca6e6d300e2f9410e02f80d8c/images/.keepdir -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "device.h" 6 | #include "config.h" 7 | #include "util/FIFO.h" 8 | #include "util/time.h" 9 | #include "hardware/AFSK.h" 10 | #include "hardware/Serial.h" 11 | #include "protocol/AX25.h" 12 | #include "protocol/LLP.h" 13 | #include "protocol/KISS.h" 14 | 15 | 16 | Serial serial; 17 | Afsk modem; 18 | LLPAddress localAdress; 19 | LLPCtx llp; 20 | 21 | static void llp_callback(struct LLPCtx *ctx) { 22 | kiss_messageCallback(ctx); 23 | } 24 | 25 | void init(void) { 26 | sei(); 27 | 28 | AFSK_init(&modem); 29 | 30 | memset(&localAdress, 0, sizeof(localAdress)); 31 | localAdress.network = LLP_ADDR_BROADCAST; 32 | localAdress.host = LLP_ADDR_BROADCAST; 33 | llp_init(&llp, &localAdress, &modem.fd, llp_callback); 34 | 35 | serial_init(&serial); 36 | stdout = &serial.uart0; 37 | stdin = &serial.uart0; 38 | 39 | kiss_init(&llp, &modem, &serial); 40 | } 41 | 42 | int main (void) { 43 | init(); 44 | 45 | while (true) { 46 | llp_poll(&llp); 47 | 48 | if (serial_available(0)) { 49 | char sbyte = uart0_getchar_nowait(); 50 | kiss_serialCallback(sbyte); 51 | } 52 | #if SERIAL_FRAMING == SERIAL_FRAMING_DIRECT 53 | kiss_checkTimeout(false); 54 | #endif 55 | } 56 | 57 | return(0); 58 | } -------------------------------------------------------------------------------- /precompiled/MicroModemGP-direct.hex: -------------------------------------------------------------------------------- 1 | :100000000C9474010C9491010C9491010C94910145 2 | :100010000C9491010C9491010C9491010C94910118 3 | :100020000C9491010C9491010C9491010C94910108 4 | :100030000C9491010C9491010C9491010C949101F8 5 | :100040000C9491010C9491010C9491010C949101E8 6 | :100050000C9491010C94FC060C9491010C94910168 7 | :100060000C9491010C949101808183848687898A04 8 | :100070008C8E8F9192949597989A9B9D9EA0A2A307 9 | :10008000A5A6A7A9AAACADAFB0B2B3B5B6B7B9BA79 10 | :10009000BCBDBEC0C1C2C4C5C6C8C9CACBCDCECF07 11 | :1000A000D0D2D3D4D5D6D7D9DADBDCDDDEDFE0E1C0 12 | :1000B000E2E3E4E5E6E7E8E9EAEAEBECEDEEEEEFB1 13 | :1000C000F0F1F1F2F3F3F4F5F5F6F6F7F8F8F9F9E3 14 | :1000D000FAFAFAFBFBFCFCFCFDFDFDFDFEFEFEFE5C 15 | :1000E000FEFFFFFFFFFFFFFF0000891112239B327D 16 | :1000F0002446AD573665BF74488CC19D5AAFD3BEF8 17 | :100100006CCAE5DB7EE9F7F88110080193331A2207 18 | :10011000A5562C47B7753E64C99C408DDBBF52AED7 19 | :10012000EDDA64CBFFF976E802218B3010029913E7 20 | :100130002667AF763444BD554AADC3BC588ED19FB7 21 | :100140006EEBE7FA7CC8F5D983310A2091121803C7 22 | :10015000A7772E66B5543C45CBBD42ACD99E508F97 23 | :10016000EFFB66EAFDD874C904428D5316619F7097 24 | :100170002004A9153227BB364CCEC5DF5EEDD7FC77 25 | :100180006888E1997AABF3BA85520C4397711E6087 26 | :10019000A1142805B3373A26CDDE44CFDFFD56EC57 27 | :1001A000E9986089FBBB72AA06638F7214409D5167 28 | :1001B0002225AB343006B9174EEFC7FE5CCCD5DD37 29 | :1001C0006AA9E3B8788AF19B87730E6295501C4147 30 | :1001D000A3352A24B1163807CFFF46EEDDDC54CD17 31 | :1001E000EBB962A8F99A708B088481951AA793B627 32 | :1001F0002CC2A5D33EE1B7F04008C919522BDB3A17 33 | :10020000644EED5F766DFF7C899400859BB712A6E6 34 | :10021000ADD224C3BFF136E0C1184809D33B5A2AF6 35 | :10022000E55E6C4FF77D7E6C0AA583B418869197C6 36 | :100230002EE3A7F23CC0B5D14229CB38500AD91BD6 37 | :10024000666FEF7E744CFD5D8BB502A499961087A6 38 | :10025000AFF326E2BDD034C1C3394A28D11A580BB6 39 | :10026000E77F6E6EF55C7C4D0CC685D71EE597F476 40 | :100270002880A1913AA3B3B2444ACD5B5669DF7896 41 | :10028000600CE91D722FFB3E8DD604C79FF516E466 42 | :10029000A9902081BBB332A2C55A4C4BD7795E6876 43 | :1002A000E11C680DF33F7A2E0EE787F61CC495D546 44 | :1002B0002AA1A3B03882B193466BCF7A5448DD5956 45 | :1002C000622DEB3C700EF91F8FF706E69DD414C526 46 | :1002D000ABB122A0B9923083C77B4E6AD5585C4936 47 | :1002E000E33D6A2CF11E780F11241FBECFEFD8E03A 48 | :1002F000DEBFCDBF11E0A0E0B1E0EAE9F9E202C063 49 | :1003000005900D92A231B107D9F716E0A2E1B1E054 50 | :1003100001C01D92A43BB107E1F70E945B130C944E 51 | :10032000CB140C9400000C944C12789488EB95E05C 52 | :100330000E941803E8E9F6E08FEF9FEF9183808336 53 | :100340009383828323E931E048EB55E0BF018AE4DF 54 | :1003500093E00E94EE078AE896E00E94CF01EEEA61 55 | :10036000F6E08AE896E09383828391838083AC01F0 56 | :1003700068EB75E08AE493E00C943F129091C00022 57 | :1003800095FFFCCF8093C60081E090E008958091B6 58 | :10039000C00087FFFCCF8091C60090E00895CF9306 59 | :1003A000DF93CDB7DEB72E970FB6F894DEBF0FBE42 60 | :1003B000CDBFDC018EE0FD01982F11929A95E9F7EF 61 | :1003C0001092C50097E69093C400E0ECF0E09081B5 62 | :1003D0009D7F908396E09093C20098E19093C10036 63 | :1003E0009E012F5F3F4FF90111928A95E9F783E053 64 | :1003F0008C838EEB91E09A87898787EC91E09C87CC 65 | :100400008B879EE0F90101900D929A95E1F72E9667 66 | :100410000FB6F894DEBF0FBECDBFDF91CF91089528 67 | :10042000811106C08091C000881F8827881F089509 68 | :1004300080E008958091C00087FF03C08091C600CE 69 | :1004400008958FEF08950F931F93CF93DF93182F85 70 | :10045000C0919C06D0919D06FE01E659FF4F808118 71 | :10046000811126C080E490E098A38F8F1E8E1D8E90 72 | :100470001C8E01E0008331960083299A20910901A6 73 | :1004800030910A0140910B0150910C01A0EBB4E0B6 74 | :100490000E946E136056704F8F4F9F4F20E43FE1D4 75 | :1004A00040E050E00E94A1133D8B2C8B0093130180 76 | :1004B0000FB7F89420910501309106014091070192 77 | :1004C00050910801A0EBB4E00E946E136056704F8B 78 | :1004D0008F4F9F4F20E43FE140E050E00E94A11386 79 | :1004E0003F8B2E8B0FBFE0919C06F0919D064FB77E 80 | :1004F000F89426A137A182A193A12817390739F4CE 81 | :1005000020A531A584A195A12817390779F060A508 82 | :1005100071A526A137A12150310991E080E0621731 83 | :10052000730709F090E0292F382F02C021E030E056 84 | :100530004FBF232BC1F6E0919C06F0919D062FB78B 85 | :10054000F894A0A5B1A51C9340A551A584A195A19F 86 | :100550004817590719F482A193A103C080A591A55A 87 | :10056000019691A780A72FBF81E090E0DF91CF9106 88 | :100570001F910F910895E0919C06F0919D064FB751 89 | :10058000F894E758FF4F24813581868197814FBFCA 90 | :1005900028173907E9F0E0919C06F0919D069FB776 91 | :1005A000F894E758FF4FA481B58122813381A217C7 92 | :1005B000B30719F42081318105C0A481B5819D0163 93 | :1005C0002F5F3F4F358324838C919FBF90E0089528 94 | :1005D0008FEF9FEF0895109212010895109212016B 95 | :1005E0001092800089E18093810081E896E09093E9 96 | :1005F00087008093860080911201882321F080E497 97 | :1006000080937C0002C010927C00389840988091C2 98 | :100610007E00816080937E0087E080937B008CEE7B 99 | :1006200080937A008AB1886F8AB9219A229A0895B4 100 | :100630000F931F93CF93DF93CDB7DEB72E970FB6EF 101 | :10064000F894DEBF0FBECDBF8C018EECD8011D9299 102 | :100650008A95E9F710939D0600939C0680E490E04C 103 | :10066000F80190A3878F11A2C8018C589F4FE459BD 104 | :10067000FF4F918380839783868395838483049639 105 | :10068000938382830996D801A758BF4F11969C93F4 106 | :100690008E9317969C938E93169715969C938E9394 107 | :1006A0001497CF9613969C938E931297865991091F 108 | :1006B000D80193969C938E93929799969C938E9340 109 | :1006C000989797969C938E939697CF9695969C9392 110 | :1006D0008E93949784E090E0A681B7811C92468126 111 | :1006E0005781228133814217530719F420813181C8 112 | :1006F00004C0268137812F5F3F4F378326830197C0 113 | :1007000059F70E94EE028EE0FE013196DF01982F2C 114 | :100710001D929A95E9F793E09C8323E232E03A87B1 115 | :1007200029872BEB32E03C872B87D80101900D9273 116 | :100730008A95E1F72E960FB6F894DEBF0FBECDBFB7 117 | :10074000DF91CF911F910F9108950F931F93CF9336 118 | :10075000DF93E0919C06F0919D0620A531A537A37B 119 | :1007600026A3EC018C01060F171FC017D10731F02B 120 | :1007700060E070E089910E942302F7CFDF91CF9172 121 | :100780001F910F910895DC0158968C915897811113 122 | :10079000F8C05A968C915A978111AEC096964D9199 123 | :1007A0005C91979798962D913C9199974217530792 124 | :1007B00079F456962D913C915797232B49F410923A 125 | :1007C0001301FD01E659FF4F1082A559BF4F68C0C4 126 | :1007D0005B969C915B97911103C05C961C925C9711 127 | :1007E00091E05B969C935B9754962D913C91559725 128 | :1007F00021153105B9F596964D915C91979798968C 129 | :100800002D913C9199974217530779F4FD01E559D1 130 | :10081000FF4F108256962D913C91579721503109E8 131 | :1008200057963C932E93569723C09696ED91FC9144 132 | :10083000979794962D913C919597E217F30729F499 133 | :1008400092962D913C91939707C09696ED91FC91CD 134 | :1008500097979F012F5F3F4F97963C932E939697C4 135 | :10086000908107C02150310955963C932E9354979F 136 | :100870009EE759969C93599759969C9159979B310D 137 | :1008800089F596964D915C91979798962D913C910C 138 | :1008900099974217530739F410921301A659BF4F85 139 | :1008A0001C92299808959696ED91FC9197979496AD 140 | :1008B0008D919C919597E817F90729F492968D915F 141 | :1008C0009C91939706C09696ED91FC919797CF01D6 142 | :1008D000019697969C938E939697808159968C93C8 143 | :1008E000599706C09E57923018F45B961C925B97FE 144 | :1008F00081E05A968C935A975B968C915B975F96A2 145 | :100900002D913C9190978823A9F05C968C915C97EF 146 | :10091000853080F05C961C925C972034310519F08C 147 | :1009200080E490E002C085E790E090969C938E93DF 148 | :100930005F9723C05A968C915A9759969C915997D4 149 | :10094000982341F05C969C915C979F5F5C969C938A 150 | :100950005C970FC05C961C925C972034310519F0AF 151 | :1009600020E430E002C025E730E090963C932E93DF 152 | :100970005F97880F5A968C935A9788E058968C9375 153 | :1009800058975F96ED91FC9190975D968D919C9113 154 | :100990005E97E80FF91F9F0131705E963C932E938E 155 | :1009A0005D9758968C915897815058968C93FF2755 156 | :1009B000E038F10530F08FEF90E0AC014E1B5F0B9B 157 | :1009C000FA01E859FF4F84912F3F310511F008F0EB 158 | :1009D00080950895EF92FF920F931F93CF93DF932B 159 | :1009E000FC018C010D531F4FD8014D915C91119763 160 | :1009F000129711965C934E93A555B10914968D915B 161 | :100A00009C91159712962D913C91139782179307FD 162 | :100A100021F42D913C91119707C014968D919C91D2 163 | :100A200015979C012F5F3F4F15963C932E9314977B 164 | :100A3000EC012881260290011124C9019595879522 165 | :100A400095958795E801998388837F01D7ECED0E12 166 | :100A5000F11CE701288139818F010B531F4FE801F9 167 | :100A600039832883840F951F35952795820F931F0F 168 | :100A7000E70199838883AF0147535F4F21E0181640 169 | :100A800019060CF420E0EA018881880F822B888304 170 | :100A900016968D919C911797EC01688316962D916F 171 | :100AA0003C91179712968D919C91139728173907AF 172 | :100AB00021F48D919C91119705C016968D919C9172 173 | :100AC0001797019617969C938E931697DA018C913F 174 | :100AD000982F9695969589278370DF01A653BF4F6F 175 | :100AE000833049F48C91803214F48F5F01C08150BF 176 | :100AF0008C9311A203C081A18F5F81A38C91885F29 177 | :100B0000803414F48C936BC18F738C93DF01A553E5 178 | :100B1000BF4F8C91880F8C93EA01988197702BEFCF 179 | :100B2000290F233010F0933011F481608C938C9155 180 | :100B3000982F96958927809581709685990F892B96 181 | :100B400086878E3709F052C0DF01A758BF4F149631 182 | :100B50002D913C9115978D919C91119728173907EC 183 | :100B600059F416962D913C91179712968D919C9160 184 | :100B7000139728173907B1F116962D913C911797C5 185 | :100B800014968D919C91159701972817390751F16B 186 | :100B90001696CD91DC9117978EE7888316962D9146 187 | :100BA0003C91179712968D919C91139728173907AE 188 | :100BB00021F48D919C91119705C016968D919C9171 189 | :100BC0001797019617969C938E93169791E0918BA9 190 | :100BD0008389863020F4128A8F5F838B01C0928BC9 191 | :100BE00081E0BFC0118A128A138ABAC08F778F370B 192 | :100BF00011F4118A09C08289882311F02A9A01C050 193 | :100C00002A988189811103C0128A138AE8C08685D7 194 | :100C1000982F9F739E3309F4E2C080FF03C0808940 195 | :100C20008068808B97859F5F97878089983008F4CC 196 | :100C30009DC0DF01A758BF4F92E8980F923018F07F 197 | :100C40008B3109F046C014962D913C9115978D91EA 198 | :100C50009C9111972817390759F416962D913C91BC 199 | :100C6000179712968D919C9113972817390759F170 200 | :100C700016962D913C91179714968D919C911597EE 201 | :100C8000019728173907F9F01696CD91DC9117973F 202 | :100C90008BE1888316962D913C91179712968D9132 203 | :100CA0009C9113972817390721F48D919C911197E6 204 | :100CB00005C016968D919C911797019617969C9357 205 | :100CC0008E93169706C0118A128A138A2A9880E09A 206 | :100CD00001C081E014964D915C9115972D913C9146 207 | :100CE00011974217530759F416964D915C91179737 208 | :100CF00012962D913C9113974217530769F116965E 209 | :100D00004D915C91179714962D913C911597215018 210 | :100D100031094217530701F190891696CD91DC9164 211 | :100D20001797988316964D915C91179712962D916F 212 | :100D30003C9113974217530721F42D913C91119741 213 | :100D400006C016962D913C9117972F5F3F4F17962F 214 | :100D50003C932E93169705C0118A128A138A2A98FB 215 | :100D600080E0108A1786882321F039C08695808B11 216 | :100D700036C0EF01C453DF4F888199818160998328 217 | :100D80008883DF01A758BF4F14962D913C9115978A 218 | :100D90008D919C9111972817390759F416962D912A 219 | :100DA0003C91179712968D919C91139728173907AC 220 | :100DB00061F016962D913C91179714968D919C9108 221 | :100DC000159701972817390751F416968D919C9124 222 | :100DD000179715969C938E9314971982188281A168 223 | :100DE000813618F011A2128A2A98DF91CF911F91B3 224 | :100DF0000F91FF90EF9008951F920F920FB60F92F0 225 | :100E000011242F933F934F935F936F937F938F930F 226 | :100E10009F93AF93BF93EF93FF9380E286BB609164 227 | :100E2000780070917900769567957695679560580A 228 | :100E300080919C0690919D060E94EA048091130186 229 | :100E4000882349F080919C0690919D060E94C303DF 230 | :100E5000807F886001C080E88BB980918606909180 231 | :100E60008706A0918806B09189060196A11DB11D43 232 | :100E70008093860690938706A0938806B093890690 233 | :100E8000FF91EF91BF91AF919F918F917F916F9162 234 | :100E90005F914F913F912F910F900FBE0F901F9038 235 | :100EA00018950F931F93CF938C01C62F82E8860F5E 236 | :100EB000823010F06B3139F4F801608171818BE17F 237 | :100EC00090E00E946C14F801608171818C2F90E099 238 | :100ED000CF911F910F910C946C140F931F93CF938C 239 | :100EE000DF938C010F5A1D4FD8012D913C91119722 240 | :100EF000232B39F1EC01498550E01D972D913C9150 241 | :100F000011972C503109241B350B11963C932E93CD 242 | :100F1000FC016D917C9111979F01281B390B2617BD 243 | :100F2000370738F49F01240F351FE9012A852193E3 244 | :100F3000F0CFD801ED91FC91DF91CF911F910F91EE 245 | :100F40000994DF91CF911F910F910895AF92BF92B5 246 | :100F5000CF92DF92EF92FF920F931F93CF93DF9385 247 | :100F60005B016A017C0126EBE21A2DEFF20A2FEFFA 248 | :100F70003FEFF70131832083EC01C05CDD4F6881D6 249 | :100F800079818EE790E00E946C148501CA0CDB1C0D 250 | :100F90000C151D0539F0F80161918F01CE010E94F9 251 | :100FA0005107F6CFF701608111816095CE010E9453 252 | :100FB0005107612F6095CE010E94510768817981A8 253 | :100FC0008EE790E0DF91CF911F910F91FF90EF900E 254 | :100FD000DF90CF90BF90AF900C946C14CF93DF93C1 255 | :100FE000EEE6F2E0DC01EF011D922197E9F7FC014A 256 | :100FF000E05CFD4F518340837196318320833F979E 257 | :101000007183608338962FEF3FEF318320833297CF 258 | :1010100031832083EEE9F6E031832083338322831A 259 | :10102000DF91CF9108952F923F924F925F926F92EE 260 | :101030007F928F929F92AF92BF92CF92DF92EF9268 261 | :10104000FF920F931F93CF93DF93CDB7DEB728970F 262 | :101050000FB6F894DEBF0FBECDBF982F917083FB03 263 | :10106000442440F8512C81FBAA24A0F8B12C920111 264 | :101070002A253B253A83298384FB332730F93B8398 265 | :101080001C8286FB662460F8712C82FB002700F925 266 | :1010900010E085FB882480F8912C8078A82FB0E0A0 267 | :1010A0001D01220C232C221C3308862F817063FB28 268 | :1010B000222720F930E061FB442740F950E0422725 269 | :1010C000532764FBEE27E0F9F0E066FBEE24E0F83E 270 | :1010D000F12C62FBCC24C0F8D12C65FB772770F98A 271 | :1010E0007D831E82607870E0660F672F661F770B26 272 | :1010F000DF01AE25BF25B887AF83ED81FE81AE2726 273 | :10110000BF27A627B7275A01AC24BD246A257B2513 274 | :101110006295660F660F607CA62EF0E8AF9FA01860 275 | :101120001124AB81BC81A625B7256A2F6170692780 276 | :1011300079817170562F57276A2D650FA980BA8063 277 | :10114000A026B126A22474E0A79E600D1124A82534 278 | :10115000B925A225B325E8E0AE9F600D1124EF81EB 279 | :10116000E170E82741704E27F0E14F9F600D112498 280 | :101170004D815E814C255D25417084272E253F25BC 281 | :101180002170282730E2239F600D1124082519259E 282 | :101190000170802F8927A30144255525942F917034 283 | :1011A0008927880F860F28960FB6F894DEBF0FBEEA 284 | :1011B000CDBFDF91CF911F910F91FF90EF90DF9006 285 | :1011C000CF90BF90AF909F908F907F906F905F90E7 286 | :1011D0004F903F902F9008952F923F924F925F92A1 287 | :1011E0006F927F928F929F92AF92BF92CF92DF9237 288 | :1011F000EF92FF920F931F93CF93DF9300D000D015 289 | :10120000CDB7DEB79C01DC01AB5ABD4F9C91F90113 290 | :10121000E90FF11DEA5AFD4F60839F5F9C939C305C 291 | :1012200009F088C34901C901805C9D4F9C838B8371 292 | :101230001196BA83A9839C91892F881F8827881FBC 293 | :101240008795882787955901B9EAAB1ABDEFBB0A84 294 | :10125000F5014081942F991F9927991F682FF0E479 295 | :101260009F9F600D1124690120EAC21A2DEFD20A56 296 | :10127000D6019C91892F881F8827881F860F7401AB 297 | :10128000B7EAEB1ABDEFFB0AF7014081942F991FD3 298 | :101290009927991FF0E29F9F800D11248401065A1F 299 | :1012A0001D4FD8014C91942F991F9927991FB0E198 300 | :1012B0009B9F800D11243401E4EA6E1AEDEF7E0A43 301 | :1012C000D3014C91942F991F9927991FB8E09B9FA8 302 | :1012D000800D11242401E3EA4E1AEDEF5E0AD201DB 303 | :1012E0009C91692F661F6627661F660F660F680F41 304 | :1012F0001401B1EA2B1ABDEF3B0AF1018081982F4E 305 | :10130000991F9927991F990F690F8B819C810E94C2 306 | :101310005107A981BA819C9181E096FF80E0879571 307 | :1013200088278795F501408191E046FF90E0682F7E 308 | :10133000F0E49F9F600D1124D6019C9181E096FFFF 309 | :1013400080E0860FF701408191E046FF90E0F0E2F7 310 | :101350009F9F800D1124D8014C9191E046FF90E0B1 311 | :10136000B0E19B9F800D1124F301408191E046FF85 312 | :1013700090E0F8E09F9F800D1124D2019C9161E0E4 313 | :1013800096FF60E0660F660F680FF101808191E0C3 314 | :1013900086FF90E0990F690F8B819C810E94510715 315 | :1013A000A981BA819C9181E095FF80E0879588278B 316 | :1013B0008795F501408191E045FF90E0682FF0E4CA 317 | :1013C0009F9F600D1124D6019C9181E095FF80E0E4 318 | :1013D000860FF701408191E045FF90E0F0E29F9F8A 319 | :1013E000800D1124D8014C9191E045FF90E0B0E1CF 320 | :1013F0009B9F800D1124F301408191E045FF90E017 321 | :10140000F8E09F9F800D1124D2019C9161E095FF2F 322 | :1014100060E0660F660F680FF101808191E085FF43 323 | :1014200090E0990F690F8B819C810E945107A981DF 324 | :10143000BA819C9181E094FF80E087958827879509 325 | :10144000F501408191E044FF90E0682FF0E49F9F18 326 | :10145000600D1124D6019C9181E094FF80E0860FFD 327 | :10146000F701408191E044FF90E0F0E29F9F800D02 328 | :101470001124D8014C9191E044FF90E0B0E19B9F92 329 | :10148000800D1124F301408191E044FF90E0F8E0E9 330 | :101490009F9F800D1124D2019C9161E094FF60E038 331 | :1014A000660F660F680FF101808191E084FF90E084 332 | :1014B000990F690F8B819C810E945107C4018A5A40 333 | :1014C0009D4F9A838983DC019C9181E093FF80E0AA 334 | :1014D0008795882787955401B9EAAB1ABDEFBB0AF7 335 | :1014E000F501408191E043FF90E0682FF0E49F9F79 336 | :1014F000600D1124640120EAC21A2DEFD20AD60130 337 | :101500009C9181E093FF80E0860F7401B7EAEB1AAB 338 | :10151000BDEFFB0AF701408191E043FF90E0F0E26C 339 | :101520009F9F800D11248401065A1D4FD8014C91B4 340 | :1015300091E043FF90E0B0E19B9F800D11243401C6 341 | :10154000E4EA6E1AEDEF7E0AD3014C9191E043FF7D 342 | :1015500090E0B8E09B9F800D11242401E3EA4E1A2D 343 | :10156000EDEF5E0AD2019C9161E093FF60E0660FAF 344 | :10157000660F680F1401B1EA2B1ABDEF3B0AF101A7 345 | :10158000808191E083FF90E0990F690F8B819C81AE 346 | :101590000E945107A981BA819C9181E092FF80E06D 347 | :1015A000879588278795F501408191E042FF90E07B 348 | :1015B000682FF0E49F9F600D1124D6019C9181E07B 349 | :1015C00092FF80E0860FF701408191E042FF90E0BA 350 | :1015D000F0E29F9F800D1124D8014C9191E042FFD1 351 | :1015E00090E0B0E19B9F800D1124F301408191E0D8 352 | :1015F00042FF90E0F8E09F9F800D1124D2019C9162 353 | :1016000061E092FF60E0660F660F680FF101808174 354 | :1016100091E082FF90E0990F690F8B819C810E947D 355 | :101620005107A981BA819C9181E091FF80E0879563 356 | :1016300088278795F501408191E041FF90E0682F70 357 | :10164000F0E49F9F600D1124D6019C9181E091FFF1 358 | :1016500080E0860FF701408191E041FF90E0F0E2E9 359 | :101660009F9F800D1124D8014C9191E041FF90E0A3 360 | :10167000B0E19B9F800D1124F301408191E041FF77 361 | :1016800090E0F8E09F9F800D1124D2019C9161E0D1 362 | :1016900091FF60E0660F660F680FF101808191E0B5 363 | :1016A00081FF90E0990F690F8B819C810E94510707 364 | :1016B000A981BA819C91F501808181708295880F02 365 | :1016C000880F807CF0E89F9F80191124D6019C919F 366 | :1016D0009170890FF70190819170F0E29F9F800DCA 367 | :1016E0001124D8019C919170B0E19B9F800D112431 368 | :1016F000F30190819170F8E09F9F800D1124D20139 369 | :101700006C916170660F660F680FF10190819170A6 370 | :10171000990F690F8B819C810E9451075401F8EA4F 371 | :10172000AF1AFDEFBF0AD5016C916401B5EACB1A7F 372 | :10173000BDEFDB0AF60170817401F2EAEF1AFDEFEA 373 | :10174000FF0AD7019C9184010F591D4FF801408178 374 | :10175000862F881F8827881F87958827879551E0BF 375 | :1017600063FF50E0682FF0E45F9F600D112481E07B 376 | :1017700043FF80E0860F572F551F5527551F20E246 377 | :10178000529F800D112451E073FF50E0A0E15A9F59 378 | :10179000800D1124592F551F5527551FB8E05B9F09 379 | :1017A000800D112461E093FF60E0660F660F680F03 380 | :1017B000942F991F9927991F990F690F8B819C81ED 381 | :1017C0000E945107F5016081D6017C91F70190815B 382 | :1017D000D8014C9181E066FF80E087958827879546 383 | :1017E00051E062FF50E0682FB0E45B9F600D112470 384 | :1017F00081E042FF80E0860F51E076FF50E0E0E2BA 385 | :101800005E9F800D112451E072FF50E0F0E15F9F78 386 | :10181000800D112451E096FF50E028E0529F800D8A 387 | :10182000112461E092FF60E0660F660F680F91E09F 388 | :1018300046FF90E0990F690F8B819C810E945107B0 389 | :10184000D5016C91F6017081D7019C91F80140811E 390 | :1018500081E065FF80E087958827879551E061FFEB 391 | :1018600050E0682FF0E45F9F600D112481E041FF9C 392 | :1018700080E0860F51E075FF50E020E2529F800D1E 393 | :10188000112451E071FF50E0A0E15A9F800D112416 394 | :1018900051E095FF50E0B8E05B9F800D112461E0BE 395 | :1018A00091FF60E0660F660F680F91E045FF90E0E2 396 | :1018B000990F690F8B819C810E945107D501EC9192 397 | :1018C000D6017C91D7015C91D8014C919E2F9170EB 398 | :1018D000872F81708295807FB0E49B9F800D1124BB 399 | :1018E000642F6170860F952F9170990F990F890F52 400 | :1018F00091E0E4FF90E0E0E89E9F8019112491E0E0 401 | :1019000074FF90E0F0E29F9F800D112491E054FF5E 402 | :1019100090E028E0929F800D112461E044FF60E098 403 | :10192000660F680F8B819C810E945107F401EB5A6E 404 | :10193000FD4F10820F900F900F900F90DF91CF917D 405 | :101940001F910F91FF90EF90DF90CF90BF90AF90DD 406 | :101950009F908F907F906F905F904F903F902F90CF 407 | :1019600008951F93CF93DF93EC01162F0E94EC088C 408 | :10197000DE01A65BBD4F2D913C911197F901E12746 409 | :10198000FF27EE0FFF1FE851FF4F85919491232F02 410 | :101990003327282739272D933C93809115018823DD 411 | :1019A00049F0612F809114010E941308682FCE0125 412 | :1019B0000E94EC08109314019091150181E0892791 413 | :1019C00080931501DF91CF911F9108950F931F937D 414 | :1019D000CF93DF93EC018B01FB0161810E94B10C7D 415 | :1019E000F8016081CE010E94B10CF8016381CE0143 416 | :1019F0000E94B10CF8016281CE01DF91CF911F915D 417 | :101A00000F910C94B10C6F927F928F929F92AF9234 418 | :101A1000BF92CF92DF92EF92FF920F931F93CF93DB 419 | :101A2000DF93CDB7DEB72A970FB6F894DEBF0FBEAF 420 | :101A3000CDBF8C013A016901FC01EB5AFD4F1082C8 421 | :101A40005C0186EBA81A8DEFB80A8FEF9FEFF501C6 422 | :101A500091838083CE0101967C018AE0F701119287 423 | :101A60008A95E9F7F801EE5BFD4F0190F081E02DDA 424 | :101A7000808191819A838983828193819C838B83E6 425 | :101A8000FB01808191819E838D83828193819887E0 426 | :101A90008F838CE0820F877011F41A8603C098E060 427 | :101AA000981B9A874801F0EC8F1AFDEF9F0AF4010A 428 | :101AB000608171818EE790E00E946C14B701C801CB 429 | :101AC0000E94E60CBE016B5F7F4FC8010E94E60CCE 430 | :101AD0006985C8010E94B10C6A85C8010E94B10CD9 431 | :101AE0008A859FEF980F9A87882311F060E0F5CFE1 432 | :101AF0007301C60CD71CEC14FD0439F0F701619199 433 | :101B00007F01C8010E94B10CF6CFF5016081F18020 434 | :101B10006095C8010E94B10C6F2D6095C8010E94AC 435 | :101B2000B10CF401608171818EE790E00E946C1429 436 | :101B30002A960FB6F894DEBF0FBECDBFDF91CF91CE 437 | :101B40001F910F91FF90EF90DF90CF90BF90AF90DB 438 | :101B50009F908F907F906F9008959A01AB016EE9EE 439 | :101B600076E00C94030D6F927F928F929F92AF92CA 440 | :101B7000BF92CF92DF92EF92FF920F931F93CF937A 441 | :101B8000DF938C010E591D4FF801B080EC01CD5947 442 | :101B9000DD4F5881DC01AC59BD4FDC903C01FBE9C5 443 | :101BA0006F1AFDEF7F0AF30170819C012A593D4FA6 444 | :101BB000F90160812F5F3F4FF90140812F5F3F4F57 445 | :101BC000F90130817C01F7E9EF1AFDEFFF0AF70117 446 | :101BD00020817C01F6E9EF1AFDEFFF0AF701C080D2 447 | :101BE0007C01F5E9EF1AFDEFFF0AF701A0807C0107 448 | :101BF000F4E9EF1AFDEFFF0AF70190807C01F3E9A9 449 | :101C0000EF1AFDEFFF0AF701F080EB2CEE1CEE243B 450 | :101C1000EE1CE794EE24E794852E881C8824881C0B 451 | :101C2000F0E48F9EE00C11248E2CE22EEE1CEE24AC 452 | :101C3000EE1CE80C8D2C881C8824881CE0E28E9E0B 453 | :101C4000E00C1124872E881C8824881CF0E18F9ECC 454 | :101C5000E00C1124862E881C8824881CE8E08E9EC7 455 | :101C6000E00C1124842E881C8824881C880C880C85 456 | :101C7000E80C832E881C8824881C880CE80CF8014A 457 | :101C8000E08211E0B6FE10E017951127179501E0EC 458 | :101C900056FF00E0F0E40F9F100D1124012F11E01A 459 | :101CA00026FF10E0100F01E0D6FE00E0E0E20E9FFC 460 | :101CB000100D112401E076FF00E0F0E10F9F100D00 461 | :101CC000112401E066FF00E0E8E00E9F100D1124F2 462 | :101CD00001E046FF00E0000F000F100F01E036FFAB 463 | :101CE00000E0000F100F1883CC2DCC1FCC27CC1F89 464 | :101CF000C795CC27C795DA2DDD1FDD27DD1FF0E462 465 | :101D0000DF9FC00D1124DC2FC1E0F6FEC0E0CD0F37 466 | :101D1000D92DDD1FDD27DD1FE0E2DE9FC00D112480 467 | :101D2000DF2DDD1FDD27DD1FF0E1DF9FC00D11245A 468 | :101D3000D1E0C6FED0E0E8E0DE9FC00D1124D1E086 469 | :101D4000A6FED0E0DD0FDD0FCD0FD1E096FED0E096 470 | :101D5000DD0FCD0FCC93A1E0B5FEA0E0A795AA279B 471 | :101D6000A795B1E055FFB0E0F0E4BF9FA00D1124AE 472 | :101D7000BA2FA1E025FFA0E0AB0FB1E0D5FEB0E0A7 473 | :101D8000C0E2BC9FA00D1124B1E075FFB0E0E0E11E 474 | :101D9000BE9FA00D1124B1E065FFB0E0F8E0BF9F49 475 | :101DA000A00D1124B1E045FFB0E0BB0FBB0FAB0F9E 476 | :101DB000B1E035FFB0E0BB0FAB0FF301A083FC0136 477 | :101DC000EA59FD4FA1E0B4FEA0E0A795AA27A79588 478 | :101DD000B1E054FFB0E0C0E4BC9FA00D1124BA2FC5 479 | :101DE000A1E024FFA0E0AB0FB1E0D4FEB0E0C0E280 480 | :101DF000BC9FA00D1124B1E074FFB0E0C0E1BC9F16 481 | :101E0000A00D1124B1E064FFB0E0C8E0BC9FA00DBC 482 | :101E10001124B1E044FFB0E0BB0FBB0FAB0FB1E04A 483 | :101E200034FFB0E0BB0FAB0FA083FC01E959FD4FBD 484 | :101E3000A1E0C5FEA0E0A795AA27A795B1E0A5FE61 485 | :101E4000B0E0C0E4BC9FA00D1124BA2FA1E0F4FEC5 486 | :101E5000A0E0AB0FB1E095FEB0E0C0E2BC9FA00DEA 487 | :101E60001124B1E0F5FEB0E0C0E1BC9FA00D11244B 488 | :101E7000B1E0C4FEB0E0C8E0BC9FA00D1124B1E009 489 | :101E8000A4FEB0E0BB0FBB0FAB0FB1E094FEB0E01F 490 | :101E9000BB0FAB0FA083FC01E859FD4FA1E0B3FEDF 491 | :101EA000A0E0A795AA27A795B1E053FFB0E0C0E452 492 | :101EB000BC9FA00D1124BA2FA1E023FFA0E0AB0F1F 493 | :101EC000B1E0D3FEB0E0C0E2BC9FA00D1124B1E0B0 494 | :101ED00073FFB0E0C0E1BC9FA00D1124B1E063FF2F 495 | :101EE000B0E0C8E0BC9FA00D1124B1E043FFB0E01A 496 | :101EF000BB0FBB0FAB0FB1E033FFB0E0BB0FAB0FBD 497 | :101F0000A083FC01E759FD4FA1E0B2FEA0E0A79538 498 | :101F1000AA27A795B1E052FFB0E0C0E4BC9FA00D96 499 | :101F20001124BA2FA1E022FFA0E0AB0FB1E0D2FE56 500 | :101F3000B0E0C0E2BC9FA00D1124B1E072FFB0E0A0 501 | :101F4000C0E1BC9FA00D1124B1E062FFB0E0C8E089 502 | :101F5000BC9FA00D1124B1E042FFB0E0BB0FBB0F4E 503 | :101F6000AB0FB1E032FFB0E0BB0FAB0FA083FC01C1 504 | :101F7000E659FD4FA1E0C3FEA0E0A795AA27A795CB 505 | :101F8000B1E0A3FEB0E0C0E4BC9FA00D1124BA2FC5 506 | :101F9000A1E0F2FEA0E0AB0FB1E093FEB0E0C0E242 507 | :101FA000BC9FA00D1124B1E0F3FEB0E0C0E1BC9FE6 508 | :101FB000A00D1124B1E0C2FEB0E0C8E0BC9FA00DAE 509 | :101FC0001124B1E0A2FEB0E0BB0FBB0FAB0FB1E03C 510 | :101FD00092FEB0E0BB0FAB0FA083FC01E559FD4FB3 511 | :101FE000A1E0B1FEA0E0A795AA27A795B1E051FF17 512 | :101FF000B0E0C0E4BC9FA00D1124BA2FA1E021FFE6 513 | :10200000A0E0AB0FB1E0D1FEB0E0C0E2BC9FA00DFC 514 | :102010001124B1E071FFB0E0C0E1BC9FA00D11241C 515 | :10202000B1E061FFB0E0C8E0BC9FA00D1124B1E0B9 516 | :1020300041FFB0E0BB0FBB0FAB0FB1E031FFB0E031 517 | :10204000BB0FAB0FA083FC01E459FD4F51705295BB 518 | :10205000550F550F507CA0E8BA9E501911242170DD 519 | :10206000250F5D2D5170C0E25C9F200D1124717011 520 | :1020700050E1759F200D11246170A8E06A9F200D2A 521 | :1020800011244170440F440F240F3170330F230F7C 522 | :10209000208331968C2D81709A2D9170990F990F14 523 | :1020A000C8E08C9F900D11248F2D8170980F292DE1 524 | :1020B0002170220F920F81E0C1FE80E020E8829F14 525 | :1020C0009019112481E0A1FE80E050E4859F900DDD 526 | :1020D000112481E091FE80E0A0E28A9F900D1124FE 527 | :1020E00081E0F1FE80E0C0E18C9F900D112490838F 528 | :1020F000DF91CF911F910F91FF90EF90DF90CF90E4 529 | :10210000BF90AF909F908F907F906F9008952F9287 530 | :102110003F924F925F926F927F928F929F92AF9277 531 | :10212000BF92CF92DF92EF92FF920F931F93CF93C4 532 | :10213000DF93CDB7DEB72B970FB6F894DEBF0FBE97 533 | :10214000CDBF8C014C012DEA821A2DEF920A5C0161 534 | :102150003CEAA31A3DEFB30A7C014CEBE41A4DEFC5 535 | :10216000F40A9C01235B3D4F3C832B831C0133E924 536 | :10217000231A3DEF330A9C01245B3D4F38872F83A0 537 | :10218000F801E05CFD4F808191810E942E149C013A 538 | :10219000019609F45BC1D4014C91442309F4F2C0C7 539 | :1021A0002B31310529F4F5018081882309F4EAC037 540 | :1021B000F801EA5BFD4F80819181019691838083D4 541 | :1021C0006CE070E00E947913892B09F0DBC02B31A1 542 | :1021D000310529F0C9018E579109029710F4D501F4 543 | :1021E0001C92F70180819181F801EE59FD4F8D56C7 544 | :1021F0009240DF01A80FB91F4C914193E215F305FE 545 | :10220000C1F7D1012C93C8010E94B30DF7014080A2 546 | :102210005180F3E04F1A5108D7014D925C9268014A 547 | :10222000BCE9CB1ABDEFDB0A612C712C9801285B4D 548 | :102230003D4F3E832D83F6013297208131963081C8 549 | :10224000D6019C91632F822F29873A879B870E9412 550 | :102250001308EF81F88580839B85892729853A8536 551 | :10226000882309F451C0982F9F70998382958F70AD 552 | :102270008A83FE01319680E090E041915FEF540F38 553 | :102280005230E8F14430D9F14830C9F1433009F413 554 | :10229000DBC0453041F0463059F0473071F050E036 555 | :1022A000493089F002C052E013C04A3071F002C0D8 556 | :1022B00054E00EC04B3059F002C058E009C04C3019 557 | :1022C00009F4BDC005C050E103C050E201C050E4B4 558 | :1022D0008130910509F0AFC025274423A9F0AB81D7 559 | :1022E000BC814D915D916D917C9113974F5F5F4FD4 560 | :1022F0006F4F7F4F4D935D936D937C931397019731 561 | :1023000019F081E090E0B9CFED81FE8140815181EB 562 | :10231000FA01E227FF27EE0FFF1FE851FF4F6591FB 563 | :102320007491852F992786279727FC01E327FF279C 564 | :10233000EE0FFF1FE851FF4F45915491892F9927C8 565 | :1023400084279527AD81BE818D939C93C30163E063 566 | :1023500070E00E948D13660F771F640D751D600F6E 567 | :10236000711FFB013897208331963083B3E06B0EE9 568 | :10237000711CE3E0CE0ED11CFCE06F16710409F075 569 | :102380005ACFFECED5018C9181113BC02E3731053D 570 | :1023900059F5F701808191819801285B3D4F6901D2 571 | :1023A0000C9750F0D9018D919C91883B904F21F46E 572 | :1023B0002A9AC8010E946D0781E0F40180838FEFA3 573 | :1023C0009FEFD6018D939C93F70111821082F80143 574 | :1023D000EA5BFD4F11821082AB81BC811D921D9280 575 | :1023E0001D921C921397CCCE2F37310519F4F401AE 576 | :1023F0001082C6CE2B31310521F481E0D5018C93BA 577 | :10240000BFCE4423A1F0F701808191818034F2E0B6 578 | :102410009F0758F4AC014F5F5F4FD7014D935C931A 579 | :10242000F801E80FF91F208302C0F4011082D501E2 580 | :102430001C92A6CE50E83527411151CF60CF813094 581 | :102440009105C1F720584BCF51E042CF2B960FB6E4 582 | :10245000F894DEBF0FBECDBFDF91CF911F910F91DA 583 | :10246000FF90EF90DF90CF90BF90AF909F908F90B4 584 | :102470007F906F905F904F903F902F900895909332 585 | :10248000A3068093A20650938B0640938A0670930E 586 | :10249000A6066093A5060895EF92FF920F931F93EF 587 | :1024A000CF93DF93EC018C017C018CEBE81A8DEF6C 588 | :1024B000F80AF7018081918198012C1B3D0B2817A8 589 | :1024C000390758F4F80181918F0160918A06709163 590 | :1024D0008B0690E00E946C14ECCFDF91CF911F919E 591 | :1024E0000F91FF90EF9008954F925F926F927F92BD 592 | :1024F0008F929F92AF92BF92EF92FF920F931F9392 593 | :10250000CF93DF93EC018B017A01E091A506F09166 594 | :10251000A6068189811145C00E941E149091000178 595 | :10252000891798F4A701B801CE01DF91CF911F91CF 596 | :102530000F91FF90EF90BF90AF909F908F907F9002 597 | :102540006F905F904F900C94AD0D8FB7F894809082 598 | :10255000860690908706A0908806B09089068FBF67 599 | :102560002091010130910201409103015091040139 600 | :10257000AAE0B0E00E946E132FB7F8944090860650 601 | :102580005090870660908806709089062FBF481883 602 | :1025900059086A087B08461657066806790664F3E8 603 | :1025A000B4CFE091A506F091A6068189882309F4AD 604 | :1025B000ACCF8091A2069091A3060E948710E09173 605 | :1025C000A506F091A606E453FF4F80819181892BE7 606 | :1025D00041F311821082DF91CF911F910F91FF90F3 607 | :1025E000EF90BF90AF909F908F907F906F905F9093 608 | :1025F0004F9008954091AC065091AD0666E171E0B0 609 | :102600008091A2069091A3060E9474121092A706D0 610 | :102610001092AD061092AC06089581110C94FA1236 611 | :102620008091A7068823D9F02FB7F8948091860669 612 | :1026300090918706A0918806B09189062FBF40919E 613 | :10264000A8065091A9066091AA067091AB06841B5A 614 | :10265000950BA60BB70BC397A105B105FCF6089522 615 | :102660009FB7F8944091860650918706609188063E 616 | :10267000709189069FBF4093A8065093A906609366 617 | :10268000AA067093AB0691E09093A7062091AC0642 618 | :102690003091AD06A9014F5F5F4F5093AD06409357 619 | :1026A000AC06F901EA5EFE4F80834433524010F0DD 620 | :1026B0000C94FA1208950E9495018AE493E00E9416 621 | :1026C000871080E00E941002882321F00E941A02E5 622 | :1026D0000E94301380E00E940D13EFCF0E94C313BD 623 | :1026E000A59F900DB49F900DA49F800D911D112466 624 | :1026F0000895AA1BBB1B51E107C0AA1FBB1FA61749 625 | :10270000B70710F0A61BB70B881F991F5A95A9F79A 626 | :1027100080959095BC01CD01089597FB072E16F486 627 | :10272000009407D077FD09D00E94791307FC05D0EB 628 | :102730003EF4909581959F4F0895709561957F4FD8 629 | :102740000895A1E21A2EAA1BBB1BFD010DC0AA1FF2 630 | :10275000BB1FEE1FFF1FA217B307E407F50720F00A 631 | :10276000A21BB30BE40BF50B661F771F881F991F85 632 | :102770001A9469F760957095809590959B01AC01CE 633 | :10278000BD01CF010895A29FB001B39FC001A39FD7 634 | :10279000700D811D1124911DB29F700D811D11249A 635 | :1027A000911D08958F929F92AF92BF92CF92DF9228 636 | :1027B000EF92FF92CF93DF93EC01688179818A8158 637 | :1027C0009B81611571058105910521F464E279ED24 638 | :1027D0008BE597E02DE133EF41E050E00E94AC142F 639 | :1027E00049015A019B01AC01A7EAB1E40E946E13B2 640 | :1027F0006B017C01ACEEB4EFA50194010E94A7141B 641 | :10280000DC01CB018C0D9D1DAE1DBF1DB7FF03C0AC 642 | :102810000197A109B04888839983AA83BB839F77D6 643 | :10282000DF91CF91FF90EF90DF90CF90BF90AF906E 644 | :102830009F908F9008950E94D21308958EE091E0AA 645 | :102840000E94D2130895A0E0B0E080930E0190930F 646 | :102850000F01A0931001B09311010895CF93DF935E 647 | :10286000EC012B8120FF33C026FF0AC02F7B2B8376 648 | :102870008E819F8101969F838E838A8190E029C0FB 649 | :1028800022FF0FC0E881F9818081992787FD90950B 650 | :10289000009719F420622B831AC03196F983E883DC 651 | :1028A0000EC0EA85FB85099597FF09C02B8101962B 652 | :1028B00011F080E201C080E1822B8B8308C02E8161 653 | :1028C0003F812F5F3F4F3F832E83992702C08FEFB9 654 | :1028D0009FEFDF91CF9108950F931F93CF93DF93D5 655 | :1028E000FB01238121FD03C08FEF9FEF28C022FF52 656 | :1028F00016C046815781248135814217530744F41D 657 | :10290000A081B1819D012F5F3F4F318320838C9344 658 | :10291000268137812F5F3F4F3783268310C0EB011D 659 | :10292000092F182F0084F185E02D0995892BE1F6F8 660 | :102930008E819F8101969F838E83812F902FDF91BF 661 | :10294000CF911F910F910895B7FF0C946E130E94C1 662 | :102950006E13821B930B0895052E97FB1EF40094B3 663 | :102960000E94C31457FD07D00E94A11307FC03D097 664 | :102970004EF40C94C31450954095309521953F4FDB 665 | :102980004F4F5F4F089590958095709561957F4F5B 666 | :0A2990008F4F9F4F0895F894FFCF7A 667 | :10299A00FFC8000000320000005E010000FE0100D6 668 | :0229AA0000002B 669 | :00000001FF 670 | -------------------------------------------------------------------------------- /precompiled/MicroModemGP-kiss.hex: -------------------------------------------------------------------------------- 1 | :100000000C9474010C9491010C9491010C94910145 2 | :100010000C9491010C9491010C9491010C94910118 3 | :100020000C9491010C9491010C9491010C94910108 4 | :100030000C9491010C9491010C9491010C949101F8 5 | :100040000C9491010C9491010C9491010C949101E8 6 | :100050000C9491010C94FC060C9491010C94910168 7 | :100060000C9491010C949101808183848687898A04 8 | :100070008C8E8F9192949597989A9B9D9EA0A2A307 9 | :10008000A5A6A7A9AAACADAFB0B2B3B5B6B7B9BA79 10 | :10009000BCBDBEC0C1C2C4C5C6C8C9CACBCDCECF07 11 | :1000A000D0D2D3D4D5D6D7D9DADBDCDDDEDFE0E1C0 12 | :1000B000E2E3E4E5E6E7E8E9EAEAEBECEDEEEEEFB1 13 | :1000C000F0F1F1F2F3F3F4F5F5F6F6F7F8F8F9F9E3 14 | :1000D000FAFAFAFBFBFCFCFCFDFDFDFDFEFEFEFE5C 15 | :1000E000FEFFFFFFFFFFFFFF0000891112239B327D 16 | :1000F0002446AD573665BF74488CC19D5AAFD3BEF8 17 | :100100006CCAE5DB7EE9F7F88110080193331A2207 18 | :10011000A5562C47B7753E64C99C408DDBBF52AED7 19 | :10012000EDDA64CBFFF976E802218B3010029913E7 20 | :100130002667AF763444BD554AADC3BC588ED19FB7 21 | :100140006EEBE7FA7CC8F5D983310A2091121803C7 22 | :10015000A7772E66B5543C45CBBD42ACD99E508F97 23 | :10016000EFFB66EAFDD874C904428D5316619F7097 24 | :100170002004A9153227BB364CCEC5DF5EEDD7FC77 25 | :100180006888E1997AABF3BA85520C4397711E6087 26 | :10019000A1142805B3373A26CDDE44CFDFFD56EC57 27 | :1001A000E9986089FBBB72AA06638F7214409D5167 28 | :1001B0002225AB343006B9174EEFC7FE5CCCD5DD37 29 | :1001C0006AA9E3B8788AF19B87730E6295501C4147 30 | :1001D000A3352A24B1163807CFFF46EEDDDC54CD17 31 | :1001E000EBB962A8F99A708B088481951AA793B627 32 | :1001F0002CC2A5D33EE1B7F04008C919522BDB3A17 33 | :10020000644EED5F766DFF7C899400859BB712A6E6 34 | :10021000ADD224C3BFF136E0C1184809D33B5A2AF6 35 | :10022000E55E6C4FF77D7E6C0AA583B418869197C6 36 | :100230002EE3A7F23CC0B5D14229CB38500AD91BD6 37 | :10024000666FEF7E744CFD5D8BB502A499961087A6 38 | :10025000AFF326E2BDD034C1C3394A28D11A580BB6 39 | :10026000E77F6E6EF55C7C4D0CC685D71EE597F476 40 | :100270002880A1913AA3B3B2444ACD5B5669DF7896 41 | :10028000600CE91D722FFB3E8DD604C79FF516E466 42 | :10029000A9902081BBB332A2C55A4C4BD7795E6876 43 | :1002A000E11C680DF33F7A2E0EE787F61CC495D546 44 | :1002B0002AA1A3B03882B193466BCF7A5448DD5956 45 | :1002C000622DEB3C700EF91F8FF706E69DD414C526 46 | :1002D000ABB122A0B9923083C77B4E6AD5585C4936 47 | :1002E000E33D6A2CF11E780F11241FBECFEFD8E03A 48 | :1002F000DEBFCDBF11E0A0E0B1E0E4ECFAE202C065 49 | :1003000005900D92A231B107D9F716E0A2E1B1E054 50 | :1003100001C01D92A43BB107E1F70E94F3130C94B6 51 | :1003200060150C9400000C944C12789488EB95E0C6 52 | :100330000E941803E8E9F6E08FEF9FEF9183808336 53 | :100340009383828323E931E048EB55E0BF018AE4DF 54 | :1003500093E00E94EE078AE896E00E94CF01EEEA61 55 | :10036000F6E08AE896E09383828391838083AC01F0 56 | :1003700068EB75E08AE493E00C943F129091C00022 57 | :1003800095FFFCCF8093C60081E090E008958091B6 58 | :10039000C00087FFFCCF8091C60090E00895CF9306 59 | :1003A000DF93CDB7DEB72E970FB6F894DEBF0FBE42 60 | :1003B000CDBFDC018EE0FD01982F11929A95E9F7EF 61 | :1003C0001092C50097E69093C400E0ECF0E09081B5 62 | :1003D0009D7F908396E09093C20098E19093C10036 63 | :1003E0009E012F5F3F4FF90111928A95E9F783E053 64 | :1003F0008C838EEB91E09A87898787EC91E09C87CC 65 | :100400008B879EE0F90101900D929A95E1F72E9667 66 | :100410000FB6F894DEBF0FBECDBFDF91CF91089528 67 | :10042000811106C08091C000881F8827881F089509 68 | :1004300080E008958091C00087FF03C08091C600CE 69 | :1004400008958FEF08950F931F93CF93DF93182F85 70 | :10045000C0919C06D0919D06FE01E659FF4F808118 71 | :10046000811126C080E490E098A38F8F1E8E1D8E90 72 | :100470001C8E01E0008331960083299A20910901A6 73 | :1004800030910A0140910B0150910C01A0EBB4E0B6 74 | :100490000E9412146056704F8F4F9F4F20E43FE12F 75 | :1004A00040E050E00E9445143D8B2C8B00931301DB 76 | :1004B0000FB7F89420910501309106014091070192 77 | :1004C00050910801A0EBB4E00E9412146056704FE6 78 | :1004D0008F4F9F4F20E43FE140E050E00E944514E1 79 | :1004E0003F8B2E8B0FBFE0919C06F0919D064FB77E 80 | :1004F000F89426A137A182A193A12817390739F4CE 81 | :1005000020A531A584A195A12817390779F060A508 82 | :1005100071A526A137A12150310991E080E0621731 83 | :10052000730709F090E0292F382F02C021E030E056 84 | :100530004FBF232BC1F6E0919C06F0919D062FB78B 85 | :10054000F894A0A5B1A51C9340A551A584A195A19F 86 | :100550004817590719F482A193A103C080A591A55A 87 | :10056000019691A780A72FBF81E090E0DF91CF9106 88 | :100570001F910F910895E0919C06F0919D064FB751 89 | :10058000F894E758FF4F24813581868197814FBFCA 90 | :1005900028173907E9F0E0919C06F0919D069FB776 91 | :1005A000F894E758FF4FA481B58122813381A217C7 92 | :1005B000B30719F42081318105C0A481B5819D0163 93 | :1005C0002F5F3F4F358324838C919FBF90E0089528 94 | :1005D0008FEF9FEF0895109212010895109212016B 95 | :1005E0001092800089E18093810081E896E09093E9 96 | :1005F00087008093860080911201882321F080E497 97 | :1006000080937C0002C010927C00389840988091C2 98 | :100610007E00816080937E0087E080937B008CEE7B 99 | :1006200080937A008AB1886F8AB9219A229A0895B4 100 | :100630000F931F93CF93DF93CDB7DEB72E970FB6EF 101 | :10064000F894DEBF0FBECDBF8C018EECD8011D9299 102 | :100650008A95E9F710939D0600939C0680E490E04C 103 | :10066000F80190A3878F11A2C8018C589F4FE459BD 104 | :10067000FF4F918380839783868395838483049639 105 | :10068000938382830996D801A758BF4F11969C93F4 106 | :100690008E9317969C938E93169715969C938E9394 107 | :1006A0001497CF9613969C938E931297865991091F 108 | :1006B000D80193969C938E93929799969C938E9340 109 | :1006C000989797969C938E939697CF9695969C9392 110 | :1006D0008E93949784E090E0A681B7811C92468126 111 | :1006E0005781228133814217530719F420813181C8 112 | :1006F00004C0268137812F5F3F4F378326830197C0 113 | :1007000059F70E94EE028EE0FE013196DF01982F2C 114 | :100710001D929A95E9F793E09C8323E232E03A87B1 115 | :1007200029872BEB32E03C872B87D80101900D9273 116 | :100730008A95E1F72E960FB6F894DEBF0FBECDBFB7 117 | :10074000DF91CF911F910F9108950F931F93CF9336 118 | :10075000DF93E0919C06F0919D0620A531A537A37B 119 | :1007600026A3EC018C01060F171FC017D10731F02B 120 | :1007700060E070E089910E942302F7CFDF91CF9172 121 | :100780001F910F910895DC0158968C915897811113 122 | :10079000F8C05A968C915A978111AEC096964D9199 123 | :1007A0005C91979798962D913C9199974217530792 124 | :1007B00079F456962D913C915797232B49F410923A 125 | :1007C0001301FD01E659FF4F1082A559BF4F68C0C4 126 | :1007D0005B969C915B97911103C05C961C925C9711 127 | :1007E00091E05B969C935B9754962D913C91559725 128 | :1007F00021153105B9F596964D915C91979798968C 129 | :100800002D913C9199974217530779F4FD01E559D1 130 | :10081000FF4F108256962D913C91579721503109E8 131 | :1008200057963C932E93569723C09696ED91FC9144 132 | :10083000979794962D913C919597E217F30729F499 133 | :1008400092962D913C91939707C09696ED91FC91CD 134 | :1008500097979F012F5F3F4F97963C932E939697C4 135 | :10086000908107C02150310955963C932E9354979F 136 | :100870009EE759969C93599759969C9159979B310D 137 | :1008800089F596964D915C91979798962D913C910C 138 | :1008900099974217530739F410921301A659BF4F85 139 | :1008A0001C92299808959696ED91FC9197979496AD 140 | :1008B0008D919C919597E817F90729F492968D915F 141 | :1008C0009C91939706C09696ED91FC919797CF01D6 142 | :1008D000019697969C938E939697808159968C93C8 143 | :1008E000599706C09E57923018F45B961C925B97FE 144 | :1008F00081E05A968C935A975B968C915B975F96A2 145 | :100900002D913C9190978823A9F05C968C915C97EF 146 | :10091000853080F05C961C925C972034310519F08C 147 | :1009200080E490E002C085E790E090969C938E93DF 148 | :100930005F9723C05A968C915A9759969C915997D4 149 | :10094000982341F05C969C915C979F5F5C969C938A 150 | :100950005C970FC05C961C925C972034310519F0AF 151 | :1009600020E430E002C025E730E090963C932E93DF 152 | :100970005F97880F5A968C935A9788E058968C9375 153 | :1009800058975F96ED91FC9190975D968D919C9113 154 | :100990005E97E80FF91F9F0131705E963C932E938E 155 | :1009A0005D9758968C915897815058968C93FF2755 156 | :1009B000E038F10530F08FEF90E0AC014E1B5F0B9B 157 | :1009C000FA01E859FF4F84912F3F310511F008F0EB 158 | :1009D00080950895EF92FF920F931F93CF93DF932B 159 | :1009E000FC018C010D531F4FD8014D915C91119763 160 | :1009F000129711965C934E93A555B10914968D915B 161 | :100A00009C91159712962D913C91139782179307FD 162 | :100A100021F42D913C91119707C014968D919C91D2 163 | :100A200015979C012F5F3F4F15963C932E9314977B 164 | :100A3000EC012881260290011124C9019595879522 165 | :100A400095958795E801998388837F01D7ECED0E12 166 | :100A5000F11CE701288139818F010B531F4FE801F9 167 | :100A600039832883840F951F35952795820F931F0F 168 | :100A7000E70199838883AF0147535F4F21E0181640 169 | :100A800019060CF420E0EA018881880F822B888304 170 | :100A900016968D919C911797EC01688316962D916F 171 | :100AA0003C91179712968D919C91139728173907AF 172 | :100AB00021F48D919C91119705C016968D919C9172 173 | :100AC0001797019617969C938E931697DA018C913F 174 | :100AD000982F9695969589278370DF01A653BF4F6F 175 | :100AE000833049F48C91803214F48F5F01C08150BF 176 | :100AF0008C9311A203C081A18F5F81A38C91885F29 177 | :100B0000803414F48C936BC18F738C93DF01A553E5 178 | :100B1000BF4F8C91880F8C93EA01988197702BEFCF 179 | :100B2000290F233010F0933011F481608C938C9155 180 | :100B3000982F96958927809581709685990F892B96 181 | :100B400086878E3709F052C0DF01A758BF4F149631 182 | :100B50002D913C9115978D919C91119728173907EC 183 | :100B600059F416962D913C91179712968D919C9160 184 | :100B7000139728173907B1F116962D913C911797C5 185 | :100B800014968D919C91159701972817390751F16B 186 | :100B90001696CD91DC9117978EE7888316962D9146 187 | :100BA0003C91179712968D919C91139728173907AE 188 | :100BB00021F48D919C91119705C016968D919C9171 189 | :100BC0001797019617969C938E93169791E0918BA9 190 | :100BD0008389863020F4128A8F5F838B01C0928BC9 191 | :100BE00081E0BFC0118A128A138ABAC08F778F370B 192 | :100BF00011F4118A09C08289882311F02A9A01C050 193 | :100C00002A988189811103C0128A138AE8C08685D7 194 | :100C1000982F9F739E3309F4E2C080FF03C0808940 195 | :100C20008068808B97859F5F97878089983008F4CC 196 | :100C30009DC0DF01A758BF4F92E8980F923018F07F 197 | :100C40008B3109F046C014962D913C9115978D91EA 198 | :100C50009C9111972817390759F416962D913C91BC 199 | :100C6000179712968D919C9113972817390759F170 200 | :100C700016962D913C91179714968D919C911597EE 201 | :100C8000019728173907F9F01696CD91DC9117973F 202 | :100C90008BE1888316962D913C91179712968D9132 203 | :100CA0009C9113972817390721F48D919C911197E6 204 | :100CB00005C016968D919C911797019617969C9357 205 | :100CC0008E93169706C0118A128A138A2A9880E09A 206 | :100CD00001C081E014964D915C9115972D913C9146 207 | :100CE00011974217530759F416964D915C91179737 208 | :100CF00012962D913C9113974217530769F116965E 209 | :100D00004D915C91179714962D913C911597215018 210 | :100D100031094217530701F190891696CD91DC9164 211 | :100D20001797988316964D915C91179712962D916F 212 | :100D30003C9113974217530721F42D913C91119741 213 | :100D400006C016962D913C9117972F5F3F4F17962F 214 | :100D50003C932E93169705C0118A128A138A2A98FB 215 | :100D600080E0108A1786882321F039C08695808B11 216 | :100D700036C0EF01C453DF4F888199818160998328 217 | :100D80008883DF01A758BF4F14962D913C9115978A 218 | :100D90008D919C9111972817390759F416962D912A 219 | :100DA0003C91179712968D919C91139728173907AC 220 | :100DB00061F016962D913C91179714968D919C9108 221 | :100DC000159701972817390751F416968D919C9124 222 | :100DD000179715969C938E9314971982188281A168 223 | :100DE000813618F011A2128A2A98DF91CF911F91B3 224 | :100DF0000F91FF90EF9008951F920F920FB60F92F0 225 | :100E000011242F933F934F935F936F937F938F930F 226 | :100E10009F93AF93BF93EF93FF9380E286BB609164 227 | :100E2000780070917900769567957695679560580A 228 | :100E300080919C0690919D060E94EA048091130186 229 | :100E4000882349F080919C0690919D060E94C303DF 230 | :100E5000807F886001C080E88BB980918606909180 231 | :100E60008706A0918806B09189060196A11DB11D43 232 | :100E70008093860690938706A0938806B093890690 233 | :100E8000FF91EF91BF91AF919F918F917F916F9162 234 | :100E90005F914F913F912F910F900FBE0F901F9038 235 | :100EA00018950F931F93CF938C01C62F82E8860F5E 236 | :100EB000823010F06B3139F4F801608171818BE17F 237 | :100EC00090E00E940115F801608171818C2F90E003 238 | :100ED000CF911F910F910C9401150F931F93CF93F6 239 | :100EE000DF938C010F5A1D4FD8012D913C91119722 240 | :100EF000232B39F1EC01498550E01D972D913C9150 241 | :100F000011972C503109241B350B11963C932E93CD 242 | :100F1000FC016D917C9111979F01281B390B2617BD 243 | :100F2000370738F49F01240F351FE9012A852193E3 244 | :100F3000F0CFD801ED91FC91DF91CF911F910F91EE 245 | :100F40000994DF91CF911F910F910895AF92BF92B5 246 | :100F5000CF92DF92EF92FF920F931F93CF93DF9385 247 | :100F60005B016A017C0126EBE21A2DEFF20A2FEFFA 248 | :100F70003FEFF70131832083EC01C05CDD4F6881D6 249 | :100F800079818EE790E00E9401158501CA0CDB1C77 250 | :100F90000C151D0539F0F80161918F01CE010E94F9 251 | :100FA0005107F6CFF701608111816095CE010E9453 252 | :100FB0005107612F6095CE010E94510768817981A8 253 | :100FC0008EE790E0DF91CF911F910F91FF90EF900E 254 | :100FD000DF90CF90BF90AF900C940115CF93DF932B 255 | :100FE000EEE6F2E0DC01EF011D922197E9F7FC014A 256 | :100FF000E05CFD4F518340837196318320833F979E 257 | :101000007183608338962FEF3FEF318320833297CF 258 | :1010100031832083EEE9F6E031832083338322831A 259 | :10102000DF91CF9108952F923F924F925F926F92EE 260 | :101030007F928F929F92AF92BF92CF92DF92EF9268 261 | :10104000FF920F931F93CF93DF93CDB7DEB728970F 262 | :101050000FB6F894DEBF0FBECDBF982F917083FB03 263 | :10106000442440F8512C81FBAA24A0F8B12C920111 264 | :101070002A253B253A83298384FB332730F93B8398 265 | :101080001C8286FB662460F8712C82FB002700F925 266 | :1010900010E085FB882480F8912C8078A82FB0E0A0 267 | :1010A0001D01220C232C221C3308862F817063FB28 268 | :1010B000222720F930E061FB442740F950E0422725 269 | :1010C000532764FBEE27E0F9F0E066FBEE24E0F83E 270 | :1010D000F12C62FBCC24C0F8D12C65FB772770F98A 271 | :1010E0007D831E82607870E0660F672F661F770B26 272 | :1010F000DF01AE25BF25B887AF83ED81FE81AE2726 273 | :10110000BF27A627B7275A01AC24BD246A257B2513 274 | :101110006295660F660F607CA62EF0E8AF9FA01860 275 | :101120001124AB81BC81A625B7256A2F6170692780 276 | :1011300079817170562F57276A2D650FA980BA8063 277 | :10114000A026B126A22474E0A79E600D1124A82534 278 | :10115000B925A225B325E8E0AE9F600D1124EF81EB 279 | :10116000E170E82741704E27F0E14F9F600D112498 280 | :101170004D815E814C255D25417084272E253F25BC 281 | :101180002170282730E2239F600D1124082519259E 282 | :101190000170802F8927A30144255525942F917034 283 | :1011A0008927880F860F28960FB6F894DEBF0FBEEA 284 | :1011B000CDBFDF91CF911F910F91FF90EF90DF9006 285 | :1011C000CF90BF90AF909F908F907F906F905F90E7 286 | :1011D0004F903F902F9008952F923F924F925F92A1 287 | :1011E0006F927F928F929F92AF92BF92CF92DF9237 288 | :1011F000EF92FF920F931F93CF93DF9300D000D015 289 | :10120000CDB7DEB79C01DC01AB5ABD4F9C91F90113 290 | :10121000E90FF11DEA5AFD4F60839F5F9C939C305C 291 | :1012200009F088C34901C901805C9D4F9C838B8371 292 | :101230001196BA83A9839C91892F881F8827881FBC 293 | :101240008795882787955901B9EAAB1ABDEFBB0A84 294 | :10125000F5014081942F991F9927991F682FF0E479 295 | :101260009F9F600D1124690120EAC21A2DEFD20A56 296 | :10127000D6019C91892F881F8827881F860F7401AB 297 | :10128000B7EAEB1ABDEFFB0AF7014081942F991FD3 298 | :101290009927991FF0E29F9F800D11248401065A1F 299 | :1012A0001D4FD8014C91942F991F9927991FB0E198 300 | :1012B0009B9F800D11243401E4EA6E1AEDEF7E0A43 301 | :1012C000D3014C91942F991F9927991FB8E09B9FA8 302 | :1012D000800D11242401E3EA4E1AEDEF5E0AD201DB 303 | :1012E0009C91692F661F6627661F660F660F680F41 304 | :1012F0001401B1EA2B1ABDEF3B0AF1018081982F4E 305 | :10130000991F9927991F990F690F8B819C810E94C2 306 | :101310005107A981BA819C9181E096FF80E0879571 307 | :1013200088278795F501408191E046FF90E0682F7E 308 | :10133000F0E49F9F600D1124D6019C9181E096FFFF 309 | :1013400080E0860FF701408191E046FF90E0F0E2F7 310 | :101350009F9F800D1124D8014C9191E046FF90E0B1 311 | :10136000B0E19B9F800D1124F301408191E046FF85 312 | :1013700090E0F8E09F9F800D1124D2019C9161E0E4 313 | :1013800096FF60E0660F660F680FF101808191E0C3 314 | :1013900086FF90E0990F690F8B819C810E94510715 315 | :1013A000A981BA819C9181E095FF80E0879588278B 316 | :1013B0008795F501408191E045FF90E0682FF0E4CA 317 | :1013C0009F9F600D1124D6019C9181E095FF80E0E4 318 | :1013D000860FF701408191E045FF90E0F0E29F9F8A 319 | :1013E000800D1124D8014C9191E045FF90E0B0E1CF 320 | :1013F0009B9F800D1124F301408191E045FF90E017 321 | :10140000F8E09F9F800D1124D2019C9161E095FF2F 322 | :1014100060E0660F660F680FF101808191E085FF43 323 | :1014200090E0990F690F8B819C810E945107A981DF 324 | :10143000BA819C9181E094FF80E087958827879509 325 | :10144000F501408191E044FF90E0682FF0E49F9F18 326 | :10145000600D1124D6019C9181E094FF80E0860FFD 327 | :10146000F701408191E044FF90E0F0E29F9F800D02 328 | :101470001124D8014C9191E044FF90E0B0E19B9F92 329 | :10148000800D1124F301408191E044FF90E0F8E0E9 330 | :101490009F9F800D1124D2019C9161E094FF60E038 331 | :1014A000660F660F680FF101808191E084FF90E084 332 | :1014B000990F690F8B819C810E945107C4018A5A40 333 | :1014C0009D4F9A838983DC019C9181E093FF80E0AA 334 | :1014D0008795882787955401B9EAAB1ABDEFBB0AF7 335 | :1014E000F501408191E043FF90E0682FF0E49F9F79 336 | :1014F000600D1124640120EAC21A2DEFD20AD60130 337 | :101500009C9181E093FF80E0860F7401B7EAEB1AAB 338 | :10151000BDEFFB0AF701408191E043FF90E0F0E26C 339 | :101520009F9F800D11248401065A1D4FD8014C91B4 340 | :1015300091E043FF90E0B0E19B9F800D11243401C6 341 | :10154000E4EA6E1AEDEF7E0AD3014C9191E043FF7D 342 | :1015500090E0B8E09B9F800D11242401E3EA4E1A2D 343 | :10156000EDEF5E0AD2019C9161E093FF60E0660FAF 344 | :10157000660F680F1401B1EA2B1ABDEF3B0AF101A7 345 | :10158000808191E083FF90E0990F690F8B819C81AE 346 | :101590000E945107A981BA819C9181E092FF80E06D 347 | :1015A000879588278795F501408191E042FF90E07B 348 | :1015B000682FF0E49F9F600D1124D6019C9181E07B 349 | :1015C00092FF80E0860FF701408191E042FF90E0BA 350 | :1015D000F0E29F9F800D1124D8014C9191E042FFD1 351 | :1015E00090E0B0E19B9F800D1124F301408191E0D8 352 | :1015F00042FF90E0F8E09F9F800D1124D2019C9162 353 | :1016000061E092FF60E0660F660F680FF101808174 354 | :1016100091E082FF90E0990F690F8B819C810E947D 355 | :101620005107A981BA819C9181E091FF80E0879563 356 | :1016300088278795F501408191E041FF90E0682F70 357 | :10164000F0E49F9F600D1124D6019C9181E091FFF1 358 | :1016500080E0860FF701408191E041FF90E0F0E2E9 359 | :101660009F9F800D1124D8014C9191E041FF90E0A3 360 | :10167000B0E19B9F800D1124F301408191E041FF77 361 | :1016800090E0F8E09F9F800D1124D2019C9161E0D1 362 | :1016900091FF60E0660F660F680FF101808191E0B5 363 | :1016A00081FF90E0990F690F8B819C810E94510707 364 | :1016B000A981BA819C91F501808181708295880F02 365 | :1016C000880F807CF0E89F9F80191124D6019C919F 366 | :1016D0009170890FF70190819170F0E29F9F800DCA 367 | :1016E0001124D8019C919170B0E19B9F800D112431 368 | :1016F000F30190819170F8E09F9F800D1124D20139 369 | :101700006C916170660F660F680FF10190819170A6 370 | :10171000990F690F8B819C810E9451075401F8EA4F 371 | :10172000AF1AFDEFBF0AD5016C916401B5EACB1A7F 372 | :10173000BDEFDB0AF60170817401F2EAEF1AFDEFEA 373 | :10174000FF0AD7019C9184010F591D4FF801408178 374 | :10175000862F881F8827881F87958827879551E0BF 375 | :1017600063FF50E0682FF0E45F9F600D112481E07B 376 | :1017700043FF80E0860F572F551F5527551F20E246 377 | :10178000529F800D112451E073FF50E0A0E15A9F59 378 | :10179000800D1124592F551F5527551FB8E05B9F09 379 | :1017A000800D112461E093FF60E0660F660F680F03 380 | :1017B000942F991F9927991F990F690F8B819C81ED 381 | :1017C0000E945107F5016081D6017C91F70190815B 382 | :1017D000D8014C9181E066FF80E087958827879546 383 | :1017E00051E062FF50E0682FB0E45B9F600D112470 384 | :1017F00081E042FF80E0860F51E076FF50E0E0E2BA 385 | :101800005E9F800D112451E072FF50E0F0E15F9F78 386 | :10181000800D112451E096FF50E028E0529F800D8A 387 | :10182000112461E092FF60E0660F660F680F91E09F 388 | :1018300046FF90E0990F690F8B819C810E945107B0 389 | :10184000D5016C91F6017081D7019C91F80140811E 390 | :1018500081E065FF80E087958827879551E061FFEB 391 | :1018600050E0682FF0E45F9F600D112481E041FF9C 392 | :1018700080E0860F51E075FF50E020E2529F800D1E 393 | :10188000112451E071FF50E0A0E15A9F800D112416 394 | :1018900051E095FF50E0B8E05B9F800D112461E0BE 395 | :1018A00091FF60E0660F660F680F91E045FF90E0E2 396 | :1018B000990F690F8B819C810E945107D501EC9192 397 | :1018C000D6017C91D7015C91D8014C919E2F9170EB 398 | :1018D000872F81708295807FB0E49B9F800D1124BB 399 | :1018E000642F6170860F952F9170990F990F890F52 400 | :1018F00091E0E4FF90E0E0E89E9F8019112491E0E0 401 | :1019000074FF90E0F0E29F9F800D112491E054FF5E 402 | :1019100090E028E0929F800D112461E044FF60E098 403 | :10192000660F680F8B819C810E945107F401EB5A6E 404 | :10193000FD4F10820F900F900F900F90DF91CF917D 405 | :101940001F910F91FF90EF90DF90CF90BF90AF90DD 406 | :101950009F908F907F906F905F904F903F902F90CF 407 | :1019600008951F93CF93DF93EC01162F0E94EC088C 408 | :10197000DE01A65BBD4F2D913C911197F901E12746 409 | :10198000FF27EE0FFF1FE851FF4F85919491232F02 410 | :101990003327282739272D933C93809115018823DD 411 | :1019A00049F0612F809114010E941308682FCE0125 412 | :1019B0000E94EC08109314019091150181E0892791 413 | :1019C00080931501DF91CF911F9108950F931F937D 414 | :1019D000CF93DF93EC018B01FB0161810E94B10C7D 415 | :1019E000F8016081CE010E94B10CF8016381CE0143 416 | :1019F0000E94B10CF8016281CE01DF91CF911F915D 417 | :101A00000F910C94B10C6F927F928F929F92AF9234 418 | :101A1000BF92CF92DF92EF92FF920F931F93CF93DB 419 | :101A2000DF93CDB7DEB72A970FB6F894DEBF0FBEAF 420 | :101A3000CDBF8C013A016901FC01EB5AFD4F1082C8 421 | :101A40005C0186EBA81A8DEFB80A8FEF9FEFF501C6 422 | :101A500091838083CE0101967C018AE0F701119287 423 | :101A60008A95E9F7F801EE5BFD4F0190F081E02DDA 424 | :101A7000808191819A838983828193819C838B83E6 425 | :101A8000FB01808191819E838D83828193819887E0 426 | :101A90008F838CE0820F877011F41A8603C098E060 427 | :101AA000981B9A874801F0EC8F1AFDEF9F0AF4010A 428 | :101AB000608171818EE790E00E940115B701C80135 429 | :101AC0000E94E60CBE016B5F7F4FC8010E94E60CCE 430 | :101AD0006985C8010E94B10C6A85C8010E94B10CD9 431 | :101AE0008A859FEF980F9A87882311F060E0F5CFE1 432 | :101AF0007301C60CD71CEC14FD0439F0F701619199 433 | :101B00007F01C8010E94B10CF6CFF5016081F18020 434 | :101B10006095C8010E94B10C6F2D6095C8010E94AC 435 | :101B2000B10CF401608171818EE790E00E94011593 436 | :101B30002A960FB6F894DEBF0FBECDBFDF91CF91CE 437 | :101B40001F910F91FF90EF90DF90CF90BF90AF90DB 438 | :101B50009F908F907F906F9008959A01AB016EE9EE 439 | :101B600076E00C94030D6F927F928F929F92AF92CA 440 | :101B7000BF92CF92DF92EF92FF920F931F93CF937A 441 | :101B8000DF938C010E591D4FF801B080EC01CD5947 442 | :101B9000DD4F5881DC01AC59BD4FDC903C01FBE9C5 443 | :101BA0006F1AFDEF7F0AF30170819C012A593D4FA6 444 | :101BB000F90160812F5F3F4FF90140812F5F3F4F57 445 | :101BC000F90130817C01F7E9EF1AFDEFFF0AF70117 446 | :101BD00020817C01F6E9EF1AFDEFFF0AF701C080D2 447 | :101BE0007C01F5E9EF1AFDEFFF0AF701A0807C0107 448 | :101BF000F4E9EF1AFDEFFF0AF70190807C01F3E9A9 449 | :101C0000EF1AFDEFFF0AF701F080EB2CEE1CEE243B 450 | :101C1000EE1CE794EE24E794852E881C8824881C0B 451 | :101C2000F0E48F9EE00C11248E2CE22EEE1CEE24AC 452 | :101C3000EE1CE80C8D2C881C8824881CE0E28E9E0B 453 | :101C4000E00C1124872E881C8824881CF0E18F9ECC 454 | :101C5000E00C1124862E881C8824881CE8E08E9EC7 455 | :101C6000E00C1124842E881C8824881C880C880C85 456 | :101C7000E80C832E881C8824881C880CE80CF8014A 457 | :101C8000E08211E0B6FE10E017951127179501E0EC 458 | :101C900056FF00E0F0E40F9F100D1124012F11E01A 459 | :101CA00026FF10E0100F01E0D6FE00E0E0E20E9FFC 460 | :101CB000100D112401E076FF00E0F0E10F9F100D00 461 | :101CC000112401E066FF00E0E8E00E9F100D1124F2 462 | :101CD00001E046FF00E0000F000F100F01E036FFAB 463 | :101CE00000E0000F100F1883CC2DCC1FCC27CC1F89 464 | :101CF000C795CC27C795DA2DDD1FDD27DD1FF0E462 465 | :101D0000DF9FC00D1124DC2FC1E0F6FEC0E0CD0F37 466 | :101D1000D92DDD1FDD27DD1FE0E2DE9FC00D112480 467 | :101D2000DF2DDD1FDD27DD1FF0E1DF9FC00D11245A 468 | :101D3000D1E0C6FED0E0E8E0DE9FC00D1124D1E086 469 | :101D4000A6FED0E0DD0FDD0FCD0FD1E096FED0E096 470 | :101D5000DD0FCD0FCC93A1E0B5FEA0E0A795AA279B 471 | :101D6000A795B1E055FFB0E0F0E4BF9FA00D1124AE 472 | :101D7000BA2FA1E025FFA0E0AB0FB1E0D5FEB0E0A7 473 | :101D8000C0E2BC9FA00D1124B1E075FFB0E0E0E11E 474 | :101D9000BE9FA00D1124B1E065FFB0E0F8E0BF9F49 475 | :101DA000A00D1124B1E045FFB0E0BB0FBB0FAB0F9E 476 | :101DB000B1E035FFB0E0BB0FAB0FF301A083FC0136 477 | :101DC000EA59FD4FA1E0B4FEA0E0A795AA27A79588 478 | :101DD000B1E054FFB0E0C0E4BC9FA00D1124BA2FC5 479 | :101DE000A1E024FFA0E0AB0FB1E0D4FEB0E0C0E280 480 | :101DF000BC9FA00D1124B1E074FFB0E0C0E1BC9F16 481 | :101E0000A00D1124B1E064FFB0E0C8E0BC9FA00DBC 482 | :101E10001124B1E044FFB0E0BB0FBB0FAB0FB1E04A 483 | :101E200034FFB0E0BB0FAB0FA083FC01E959FD4FBD 484 | :101E3000A1E0C5FEA0E0A795AA27A795B1E0A5FE61 485 | :101E4000B0E0C0E4BC9FA00D1124BA2FA1E0F4FEC5 486 | :101E5000A0E0AB0FB1E095FEB0E0C0E2BC9FA00DEA 487 | :101E60001124B1E0F5FEB0E0C0E1BC9FA00D11244B 488 | :101E7000B1E0C4FEB0E0C8E0BC9FA00D1124B1E009 489 | :101E8000A4FEB0E0BB0FBB0FAB0FB1E094FEB0E01F 490 | :101E9000BB0FAB0FA083FC01E859FD4FA1E0B3FEDF 491 | :101EA000A0E0A795AA27A795B1E053FFB0E0C0E452 492 | :101EB000BC9FA00D1124BA2FA1E023FFA0E0AB0F1F 493 | :101EC000B1E0D3FEB0E0C0E2BC9FA00D1124B1E0B0 494 | :101ED00073FFB0E0C0E1BC9FA00D1124B1E063FF2F 495 | :101EE000B0E0C8E0BC9FA00D1124B1E043FFB0E01A 496 | :101EF000BB0FBB0FAB0FB1E033FFB0E0BB0FAB0FBD 497 | :101F0000A083FC01E759FD4FA1E0B2FEA0E0A79538 498 | :101F1000AA27A795B1E052FFB0E0C0E4BC9FA00D96 499 | :101F20001124BA2FA1E022FFA0E0AB0FB1E0D2FE56 500 | :101F3000B0E0C0E2BC9FA00D1124B1E072FFB0E0A0 501 | :101F4000C0E1BC9FA00D1124B1E062FFB0E0C8E089 502 | :101F5000BC9FA00D1124B1E042FFB0E0BB0FBB0F4E 503 | :101F6000AB0FB1E032FFB0E0BB0FAB0FA083FC01C1 504 | :101F7000E659FD4FA1E0C3FEA0E0A795AA27A795CB 505 | :101F8000B1E0A3FEB0E0C0E4BC9FA00D1124BA2FC5 506 | :101F9000A1E0F2FEA0E0AB0FB1E093FEB0E0C0E242 507 | :101FA000BC9FA00D1124B1E0F3FEB0E0C0E1BC9FE6 508 | :101FB000A00D1124B1E0C2FEB0E0C8E0BC9FA00DAE 509 | :101FC0001124B1E0A2FEB0E0BB0FBB0FAB0FB1E03C 510 | :101FD00092FEB0E0BB0FAB0FA083FC01E559FD4FB3 511 | :101FE000A1E0B1FEA0E0A795AA27A795B1E051FF17 512 | :101FF000B0E0C0E4BC9FA00D1124BA2FA1E021FFE6 513 | :10200000A0E0AB0FB1E0D1FEB0E0C0E2BC9FA00DFC 514 | :102010001124B1E071FFB0E0C0E1BC9FA00D11241C 515 | :10202000B1E061FFB0E0C8E0BC9FA00D1124B1E0B9 516 | :1020300041FFB0E0BB0FBB0FAB0FB1E031FFB0E031 517 | :10204000BB0FAB0FA083FC01E459FD4F51705295BB 518 | :10205000550F550F507CA0E8BA9E501911242170DD 519 | :10206000250F5D2D5170C0E25C9F200D1124717011 520 | :1020700050E1759F200D11246170A8E06A9F200D2A 521 | :1020800011244170440F440F240F3170330F230F7C 522 | :10209000208331968C2D81709A2D9170990F990F14 523 | :1020A000C8E08C9F900D11248F2D8170980F292DE1 524 | :1020B0002170220F920F81E0C1FE80E020E8829F14 525 | :1020C0009019112481E0A1FE80E050E4859F900DDD 526 | :1020D000112481E091FE80E0A0E28A9F900D1124FE 527 | :1020E00081E0F1FE80E0C0E18C9F900D112490838F 528 | :1020F000DF91CF911F910F91FF90EF90DF90CF90E4 529 | :10210000BF90AF909F908F907F906F9008952F9287 530 | :102110003F924F925F926F927F928F929F92AF9277 531 | :10212000BF92CF92DF92EF92FF920F931F93CF93C4 532 | :10213000DF93CDB7DEB72B970FB6F894DEBF0FBE97 533 | :10214000CDBF8C014C012DEA821A2DEF920A5C0161 534 | :102150003CEAA31A3DEFB30A7C014CEBE41A4DEFC5 535 | :10216000F40A9C01235B3D4F3C832B831C0133E924 536 | :10217000231A3DEF330A9C01245B3D4F38872F83A0 537 | :10218000F801E05CFD4F808191810E94C3149C01A5 538 | :10219000019609F45BC1D4014C91442309F4F2C0C7 539 | :1021A0002B31310529F4F5018081882309F4EAC037 540 | :1021B000F801EA5BFD4F80819181019691838083D4 541 | :1021C0006CE070E00E941D14892B09F0DBC02B31FC 542 | :1021D000310529F0C9018E579109029710F4D501F4 543 | :1021E0001C92F70180819181F801EE59FD4F8D56C7 544 | :1021F0009240DF01A80FB91F4C914193E215F305FE 545 | :10220000C1F7D1012C93C8010E94B30DF7014080A2 546 | :102210005180F3E04F1A5108D7014D925C9268014A 547 | :10222000BCE9CB1ABDEFDB0A612C712C9801285B4D 548 | :102230003D4F3E832D83F6013297208131963081C8 549 | :10224000D6019C91632F822F29873A879B870E9412 550 | :102250001308EF81F88580839B85892729853A8536 551 | :10226000882309F451C0982F9F70998382958F70AD 552 | :102270008A83FE01319680E090E041915FEF540F38 553 | :102280005230E8F14430D9F14830C9F1433009F413 554 | :10229000DBC0453041F0463059F0473071F050E036 555 | :1022A000493089F002C052E013C04A3071F002C0D8 556 | :1022B00054E00EC04B3059F002C058E009C04C3019 557 | :1022C00009F4BDC005C050E103C050E201C050E4B4 558 | :1022D0008130910509F0AFC025274423A9F0AB81D7 559 | :1022E000BC814D915D916D917C9113974F5F5F4FD4 560 | :1022F0006F4F7F4F4D935D936D937C931397019731 561 | :1023000019F081E090E0B9CFED81FE8140815181EB 562 | :10231000FA01E227FF27EE0FFF1FE851FF4F6591FB 563 | :102320007491852F992786279727FC01E327FF279C 564 | :10233000EE0FFF1FE851FF4F45915491892F9927C8 565 | :1023400084279527AD81BE818D939C93C30163E063 566 | :1023500070E00E943114660F771F640D751D600FC9 567 | :10236000711FFB013897208331963083B3E06B0EE9 568 | :10237000711CE3E0CE0ED11CFCE06F16710409F075 569 | :102380005ACFFECED5018C9181113BC02E3731053D 570 | :1023900059F5F701808191819801285B3D4F6901D2 571 | :1023A0000C9750F0D9018D919C91883B904F21F46E 572 | :1023B0002A9AC8010E946D0781E0F40180838FEFA3 573 | :1023C0009FEFD6018D939C93F70111821082F80143 574 | :1023D000EA5BFD4F11821082AB81BC811D921D9280 575 | :1023E0001D921C921397CCCE2F37310519F4F401AE 576 | :1023F0001082C6CE2B31310521F481E0D5018C93BA 577 | :10240000BFCE4423A1F0F701808191818034F2E0B6 578 | :102410009F0758F4AC014F5F5F4FD7014D935C931A 579 | :10242000F801E80FF91F208302C0F4011082D501E2 580 | :102430001C92A6CE50E83527411151CF60CF813094 581 | :102440009105C1F720584BCF51E042CF2B960FB6E4 582 | :10245000F894DEBF0FBECDBFDF91CF911F910F91DA 583 | :10246000FF90EF90DF90CF90BF90AF909F908F90B4 584 | :102470007F906F905F904F903F902F900895909332 585 | :10248000A3068093A20650938B0640938A0670930E 586 | :10249000A6066093A5060895EF92FF920F931F93EF 587 | :1024A000CF93DF93EC0160918A0670918B0680ECEC 588 | :1024B00090E00E94011560918A0670918B0680E081 589 | :1024C00090E00E9401158E017E018CEBE81A8DEFE1 590 | :1024D000F80AF7018081918160918A0670918B06DC 591 | :1024E00098012C1B3D0B2817390708F5F80181913D 592 | :1024F0008F01803C59F48BED90E00E9401156091B2 593 | :102500008A0670918B068CED90E00EC08B3D59F4DD 594 | :102510008BED90E00E94011560918A0670918B0608 595 | :102520008DED90E001C090E00E940115D2CF80ECCB 596 | :1025300090E0DF91CF911F910F91FF90EF900C945D 597 | :1025400001154F925F926F927F928F929F92AF92FE 598 | :10255000BF92EF92FF920F931F93CF93DF93EC0103 599 | :102560008B017A01E091A506F091A606818981117F 600 | :1025700045C00E94B31490910001891798F4A701F7 601 | :10258000B801CE01DF91CF911F910F91FF90EF9095 602 | :10259000BF90AF909F908F907F906F905F904F9083 603 | :1025A0000C94AD0D8FB7F8948090860690908706B6 604 | :1025B000A0908806B09089068FBF209101013091CC 605 | :1025C00002014091030150910401AAE0B0E00E9491 606 | :1025D00012142FB7F89440908606509087066090AA 607 | :1025E0008806709089062FBF481859086A087B082A 608 | :1025F000461657066806790664F3B4CFE091A5063F 609 | :10260000F091A6068189882309F4ACCF8091A206B7 610 | :102610009091A3060E948710E091A506F091A6066E 611 | :10262000E453FF4F80819181892B41F31182108205 612 | :10263000DF91CF911F910F91FF90EF90BF90AF90DE 613 | :102640009F908F907F906F905F904F900895882318 614 | :1026500099F04091AC065091AD0666E171E0809131 615 | :10266000A2069091A3060E94A1121092A7061092B2 616 | :10267000AD061092AC0608958091A7068823D9F084 617 | :102680002FB7F8948091860690918706A0918806CE 618 | :10269000B09189062FBF4091A8065091A90660917C 619 | :1026A000AA067091AB06841B950BA60BB70BC397BC 620 | :1026B000A105B10574F608959091A7069923A1F09C 621 | :1026C000803C01F580910D01811111C01092A70687 622 | :1026D0004091AC065091AD0666E171E08091A20692 623 | :1026E0009091A3060C94A112803C09F07BC081E07C 624 | :1026F0008093A7068EEF80930D011092AD06109285 625 | :10270000AC0608952091AC063091AD06243392E0DA 626 | :10271000390708F067C090910D012115310531F49A 627 | :102720009E3F21F48F7080930D01089591111FC079 628 | :102730008B3D21F481E08093A40608959091A40636 629 | :10274000992349F08C3D21F08D3D19F48BED01C0AA 630 | :1027500080EC1092A406A9014F5F5F4F5093AD0625 631 | :102760004093AC06F901EA5EFE4F808308959130F4 632 | :1027700079F4282F30E0AAE0B0E00E9403146093BF 633 | :10278000090170930A0180930B0190930C01089545 634 | :10279000943089F42AE0829FC0011124AA2797FD72 635 | :1027A000A095BA2F8093050190930601A09307018D 636 | :1027B000B09308010895933089F42AE0829FC00104 637 | :1027C0001124AA2797FDA095BA2F80930101909319 638 | :1027D0000201A0930301B09304010895923011F413 639 | :1027E0008093000108950E9495018AE493E00E947D 640 | :1027F000871080E00E9410028823B9F30E941A0219 641 | :102800000E945C13F2CFA29FB001B39FC001A39FAF 642 | :10281000700D811D1124911DB29F700D811D112419 643 | :10282000911D08950E940314A59F900DB49F900DD3 644 | :10283000A49F800D911D11240895AA1BBB1B51E17B 645 | :1028400007C0AA1FBB1FA617B70710F0A61BB70B20 646 | :10285000881F991F5A95A9F780959095BC01CD01C5 647 | :10286000089597FB072E16F4009407D077FD09D042 648 | :102870000E941D1407FC05D03EF4909581959F4F52 649 | :102880000895709561957F4F0895A1E21A2EAA1BB5 650 | :10289000BB1BFD010DC0AA1FBB1FEE1FFF1FA21710 651 | :1028A000B307E407F50720F0A21BB30BE40BF50B0D 652 | :1028B000661F771F881F991F1A9469F76095709596 653 | :1028C000809590959B01AC01BD01CF0108958F9239 654 | :1028D0009F92AF92BF92CF92DF92EF92FF92CF93EF 655 | :1028E000DF93EC01688179818A819B816115710593 656 | :1028F0008105910521F464E279ED8BE597E02DE106 657 | :1029000033EF41E050E00E94411549015A019B011B 658 | :10291000AC01A7EAB1E40E9412146B017C01ACEE99 659 | :10292000B4EFA50194010E943C15DC01CB018C0D94 660 | :102930009D1DAE1DBF1DB7FF03C00197A109B04883 661 | :1029400088839983AA83BB839F77DF91CF91FF9080 662 | :10295000EF90DF90CF90BF90AF909F908F900895B1 663 | :102960000E94671408958EE091E00E946714089514 664 | :10297000A0E0B0E080930E0190930F01A0931001AE 665 | :10298000B09311010895CF93DF93EC012B8120FFC9 666 | :1029900033C026FF0AC02F7B2B838E819F81019637 667 | :1029A0009F838E838A8190E029C022FF0FC0E88137 668 | :1029B000F9818081992787FD9095009719F420620D 669 | :1029C0002B831AC03196F983E8830EC0EA85FB8514 670 | :1029D000099597FF09C02B81019611F080E201C093 671 | :1029E00080E1822B8B8308C02E813F812F5F3F4F78 672 | :1029F0003F832E83992702C08FEF9FEFDF91CF9106 673 | :102A000008950F931F93CF93DF93FB01238121FD43 674 | :102A100003C08FEF9FEF28C022FF16C04681578169 675 | :102A2000248135814217530744F4A081B1819D016F 676 | :102A30002F5F3F4F318320838C93268137812F5F17 677 | :102A40003F4F3783268310C0EB01092F182F0084D6 678 | :102A5000F185E02D0995892BE1F68E819F81019604 679 | :102A60009F838E83812F902FDF91CF911F910F91A4 680 | :102A70000895B7FF0C9412140E941214821B930B3A 681 | :102A80000895052E97FB1EF400940E94581557FDDB 682 | :102A900007D00E94451407FC03D04EF40C9458153F 683 | :102AA00050954095309521953F4F4F4F5F4F08957A 684 | :102AB00090958095709561957F4F8F4F9F4F0895AA 685 | :042AC000F894FFCFB8 686 | :102AC400FFC8000000320000005E010000FE0100AB 687 | :022AD400000000 688 | :00000001FF 689 | -------------------------------------------------------------------------------- /protocol/AX25.c: -------------------------------------------------------------------------------- 1 | // Based on work by Francesco Sacchi 2 | 3 | #include 4 | #include 5 | #include "AX25.h" 6 | #include "protocol/HDLC.h" 7 | #include "util/CRC-CCIT.h" 8 | #include "../hardware/AFSK.h" 9 | 10 | #define countof(a) sizeof(a)/sizeof(a[0]) 11 | #define MIN(a,b) ({ typeof(a) _a = (a); typeof(b) _b = (b); ((typeof(_a))((_a < _b) ? _a : _b)); }) 12 | #define DECODE_CALL(buf, addr) for (unsigned i = 0; i < sizeof((addr)); i++) { char c = (*(buf)++ >> 1); (addr)[i] = (c == ' ') ? '\x0' : c; } 13 | #define AX25_SET_REPEATED(msg, idx, val) do { if (val) { (msg)->rpt_flags |= _BV(idx); } else { (msg)->rpt_flags &= ~_BV(idx) ; } } while(0) 14 | 15 | void ax25_init(AX25Ctx *ctx, FILE *channel, ax25_callback_t hook) { 16 | memset(ctx, 0, sizeof(*ctx)); 17 | ctx->ch = channel; 18 | ctx->hook = hook; 19 | ctx->crc_in = ctx->crc_out = CRC_CCIT_INIT_VAL; 20 | } 21 | 22 | static void ax25_decode(AX25Ctx *ctx) { 23 | #if SERIAL_PROTOCOL == PROTOCOL_KISS 24 | if (ctx->hook) ctx->hook(ctx); 25 | #endif 26 | } 27 | 28 | void ax25_poll(AX25Ctx *ctx) { 29 | int c; 30 | 31 | while ((c = fgetc(ctx->ch)) != EOF) { 32 | if (!ctx->escape && c == HDLC_FLAG) { 33 | if (ctx->frame_len >= AX25_MIN_FRAME_LEN) { 34 | if (ctx->crc_in == AX25_CRC_CORRECT) { 35 | #if OPEN_SQUELCH == true 36 | LED_RX_ON(); 37 | #endif 38 | ax25_decode(ctx); 39 | } 40 | } 41 | ctx->sync = true; 42 | ctx->crc_in = CRC_CCIT_INIT_VAL; 43 | ctx->frame_len = 0; 44 | continue; 45 | } 46 | 47 | if (!ctx->escape && c == HDLC_RESET) { 48 | ctx->sync = false; 49 | continue; 50 | } 51 | 52 | if (!ctx->escape && c == AX25_ESC) { 53 | ctx->escape = true; 54 | continue; 55 | } 56 | 57 | if (ctx->sync) { 58 | if (ctx->frame_len < AX25_MAX_FRAME_LEN) { 59 | ctx->buf[ctx->frame_len++] = c; 60 | ctx->crc_in = update_crc_ccit(c, ctx->crc_in); 61 | } else { 62 | ctx->sync = false; 63 | } 64 | } 65 | ctx->escape = false; 66 | } 67 | } 68 | 69 | static void ax25_putchar(AX25Ctx *ctx, uint8_t c) 70 | { 71 | if (c == HDLC_FLAG || c == HDLC_RESET || c == AX25_ESC) fputc(AX25_ESC, ctx->ch); 72 | ctx->crc_out = update_crc_ccit(c, ctx->crc_out); 73 | fputc(c, ctx->ch); 74 | } 75 | 76 | void ax25_sendRaw(AX25Ctx *ctx, void *_buf, size_t len) { 77 | ctx->crc_out = CRC_CCIT_INIT_VAL; 78 | fputc(HDLC_FLAG, ctx->ch); 79 | const uint8_t *buf = (const uint8_t *)_buf; 80 | while (len--) ax25_putchar(ctx, *buf++); 81 | 82 | uint8_t crcl = (ctx->crc_out & 0xff) ^ 0xff; 83 | uint8_t crch = (ctx->crc_out >> 8) ^ 0xff; 84 | ax25_putchar(ctx, crcl); 85 | ax25_putchar(ctx, crch); 86 | 87 | fputc(HDLC_FLAG, ctx->ch); 88 | } 89 | -------------------------------------------------------------------------------- /protocol/AX25.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOCOL_AX25_H 2 | #define PROTOCOL_AX25_H 3 | 4 | #include 5 | #include 6 | #include "device.h" 7 | 8 | #define AX25_MIN_FRAME_LEN 18 9 | #ifndef CUSTOM_FRAME_SIZE 10 | #define AX25_MAX_FRAME_LEN 620 11 | #else 12 | #define AX25_MAX_FRAME_LEN CUSTOM_FRAME_SIZE 13 | #endif 14 | 15 | #define AX25_CRC_CORRECT 0xF0B8 16 | 17 | #define AX25_CTRL_UI 0x03 18 | #define AX25_PID_NOLAYER3 0xF0 19 | 20 | struct AX25Ctx; // Forward declarations 21 | struct AX25Msg; 22 | 23 | typedef void (*ax25_callback_t)(struct AX25Ctx *ctx); 24 | 25 | typedef struct AX25Ctx { 26 | uint8_t buf[AX25_MAX_FRAME_LEN]; 27 | FILE *ch; 28 | size_t frame_len; 29 | uint16_t crc_in; 30 | uint16_t crc_out; 31 | ax25_callback_t hook; 32 | bool sync; 33 | bool escape; 34 | } AX25Ctx; 35 | 36 | void ax25_poll(AX25Ctx *ctx); 37 | void ax25_sendRaw(AX25Ctx *ctx, void *_buf, size_t len); 38 | void ax25_init(AX25Ctx *ctx, FILE *channel, ax25_callback_t hook); 39 | 40 | #endif -------------------------------------------------------------------------------- /protocol/HDLC.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOCOL_HDLC_H 2 | #define PROTOCOL_HDLC_H 3 | 4 | #define HDLC_FLAG 0x7E 5 | #define HDLC_RESET 0x7F 6 | #define LLP_ESC 0x1B 7 | 8 | #endif -------------------------------------------------------------------------------- /protocol/KISS.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "device.h" 5 | #include "KISS.h" 6 | 7 | static uint8_t serialBuffer[LLP_MAX_DATA_SIZE]; // Buffer for holding incoming serial data 8 | LLPCtx *llpCtx; 9 | Afsk *channel; 10 | Serial *serial; 11 | size_t frame_len; 12 | bool IN_FRAME; 13 | bool ESCAPE; 14 | bool FLOWCONTROL; 15 | 16 | uint8_t command = CMD_UNKNOWN; 17 | unsigned long custom_preamble = CONFIG_AFSK_PREAMBLE_LEN; 18 | unsigned long custom_tail = CONFIG_AFSK_TRAILER_LEN; 19 | 20 | unsigned long slotTime = 200; 21 | uint8_t p = 255; 22 | ticks_t timeout_ticks; 23 | 24 | void kiss_init(LLPCtx *ctx, Afsk *afsk, Serial *ser) { 25 | llpCtx = ctx; 26 | serial = ser; 27 | channel = afsk; 28 | FLOWCONTROL = false; 29 | } 30 | 31 | void kiss_messageCallback(LLPCtx *ctx) { 32 | #if (SERIAL_FRAMING == SERIAL_FRAMING_DIRECT) 33 | for (unsigned i = 0; i < ctx->frame_len; i++) { 34 | uint8_t b = ctx->buf[i]; 35 | fputc(b, &serial->uart0); 36 | } 37 | #else 38 | fputc(FEND, &serial->uart0); 39 | fputc(0x00, &serial->uart0); 40 | for (unsigned i = 0; i < ctx->frame_len; i++) { 41 | uint8_t b = ctx->buf[i]; 42 | if (b == FEND) { 43 | fputc(FESC, &serial->uart0); 44 | fputc(TFEND, &serial->uart0); 45 | } else if (b == FESC) { 46 | fputc(FESC, &serial->uart0); 47 | fputc(TFESC, &serial->uart0); 48 | } else { 49 | fputc(b, &serial->uart0); 50 | } 51 | } 52 | fputc(FEND, &serial->uart0); 53 | #endif 54 | } 55 | 56 | void kiss_csma(LLPCtx *ctx, uint8_t *buf, size_t len) { 57 | bool sent = false; 58 | while (!sent) { 59 | //puts("Waiting in CSMA"); 60 | if(!channel->hdlc.receiving) { 61 | uint8_t tp = rand() & 0xFF; 62 | if (tp < p) { 63 | //llp_sendRaw(ctx, buf, len); 64 | llp_broadcast(ctx, buf, len); 65 | sent = true; 66 | } else { 67 | ticks_t start = timer_clock(); 68 | long slot_ticks = ms_to_ticks(slotTime); 69 | while (timer_clock() - start < slot_ticks) { 70 | cpu_relax(); 71 | } 72 | } 73 | } else { 74 | while (!sent && channel->hdlc.receiving) { 75 | // Continously poll the modem for data 76 | // while waiting, so we don't overrun 77 | // receive buffers 78 | llp_poll(llpCtx); 79 | 80 | if (channel->status != 0) { 81 | // If an overflow or other error 82 | // occurs, we'll back off and drop 83 | // this packet silently. 84 | channel->status = 0; 85 | sent = true; 86 | } 87 | } 88 | } 89 | } 90 | 91 | if (FLOWCONTROL) { 92 | while (!ctx->ready_for_data) { /* Wait */ } 93 | fputc(FEND, &serial->uart0); 94 | fputc(CMD_READY, &serial->uart0); 95 | fputc(0x01, &serial->uart0); 96 | fputc(FEND, &serial->uart0); 97 | } 98 | } 99 | 100 | void kiss_checkTimeout(bool force) { 101 | if (force || (IN_FRAME && timer_clock() - timeout_ticks > ms_to_ticks(TX_MAXWAIT))) { 102 | kiss_csma(llpCtx, serialBuffer, frame_len); 103 | IN_FRAME = false; 104 | frame_len = 0; 105 | } 106 | 107 | } 108 | 109 | void kiss_serialCallback(uint8_t sbyte) { 110 | #if SERIAL_FRAMING == SERIAL_FRAMING_DIRECT 111 | timeout_ticks = timer_clock(); 112 | IN_FRAME = true; 113 | serialBuffer[frame_len++] = sbyte; 114 | if (frame_len >= LLP_MAX_DATA_SIZE) kiss_checkTimeout(true); 115 | #else 116 | if (IN_FRAME && sbyte == FEND && command == CMD_DATA) { 117 | IN_FRAME = false; 118 | kiss_csma(llpCtx, serialBuffer, frame_len); 119 | } else if (sbyte == FEND) { 120 | IN_FRAME = true; 121 | command = CMD_UNKNOWN; 122 | frame_len = 0; 123 | } else if (IN_FRAME && frame_len < LLP_MAX_DATA_SIZE) { 124 | // Have a look at the command byte first 125 | if (frame_len == 0 && command == CMD_UNKNOWN) { 126 | // MicroModem supports only one HDLC port, so we 127 | // strip off the port nibble of the command byte 128 | sbyte = sbyte & 0x0F; 129 | command = sbyte; 130 | } else if (command == CMD_DATA) { 131 | if (sbyte == FESC) { 132 | ESCAPE = true; 133 | } else { 134 | if (ESCAPE) { 135 | if (sbyte == TFEND) sbyte = FEND; 136 | if (sbyte == TFESC) sbyte = FESC; 137 | ESCAPE = false; 138 | } 139 | serialBuffer[frame_len++] = sbyte; 140 | } 141 | } else if (command == CMD_TXDELAY) { 142 | custom_preamble = sbyte * 10UL; 143 | } else if (command == CMD_TXTAIL) { 144 | custom_tail = sbyte * 10; 145 | } else if (command == CMD_SLOTTIME) { 146 | slotTime = sbyte * 10; 147 | } else if (command == CMD_P) { 148 | p = sbyte; 149 | } else if (command == CMD_READY) { 150 | if (sbyte == 0x00) { 151 | FLOWCONTROL = false; 152 | } else { 153 | FLOWCONTROL = true; 154 | } 155 | } 156 | 157 | } 158 | #endif 159 | } -------------------------------------------------------------------------------- /protocol/KISS.h: -------------------------------------------------------------------------------- 1 | #ifndef _PROTOCOL_KISS 2 | #define _PROTOCOL_KISS 0x02 3 | 4 | #include "../hardware/AFSK.h" 5 | #include "../hardware/Serial.h" 6 | #include "../util/time.h" 7 | #include "LLP.h" 8 | #include "config.h" 9 | 10 | #define FEND 0xC0 11 | #define FESC 0xDB 12 | #define TFEND 0xDC 13 | #define TFESC 0xDD 14 | 15 | #define CMD_UNKNOWN 0xFE 16 | #define CMD_DATA 0x00 17 | #define CMD_TXDELAY 0x01 18 | #define CMD_P 0x02 19 | #define CMD_SLOTTIME 0x03 20 | #define CMD_TXTAIL 0x04 21 | #define CMD_FULLDUPLEX 0x05 22 | #define CMD_SETHARDWARE 0x06 23 | #define CMD_READY 0x0F 24 | #define CMD_RETURN 0xFF 25 | 26 | void kiss_init(LLPCtx *ctx, Afsk *afsk, Serial *ser); 27 | void kiss_csma(LLPCtx *ctx, uint8_t *buf, size_t len); 28 | void kiss_messageCallback(LLPCtx *ctx); 29 | void kiss_serialCallback(uint8_t sbyte); 30 | void kiss_checkTimeout(bool force); 31 | 32 | #endif -------------------------------------------------------------------------------- /protocol/LLP.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "LLP.h" 4 | #include "protocol/HDLC.h" 5 | #include "util/CRC-CCIT.h" 6 | #include "../hardware/AFSK.h" 7 | 8 | #define DISABLE_INTERLEAVE false 9 | #define PASSALL false 10 | #define STRIP_HEADERS true 11 | 12 | // The GET_BIT macro is used in the interleaver 13 | // and deinterleaver to access single bits of a 14 | // byte. 15 | inline bool GET_BIT(uint8_t byte, int n) { return (byte & (1 << (8-n))) == (1 << (8-n)); } 16 | 17 | // We need an indicator to tell us whether we 18 | // should send a parity byte. This happens 19 | // whenever two normal bytes of data has been 20 | // sent. We also keep the last sent byte in 21 | // memory because we need it to calculate the 22 | // parity byte. 23 | static bool sendParityBlock = false; 24 | static uint8_t lastByte = 0x00; 25 | 26 | LLPAddress broadcast_address; 27 | 28 | void llp_decode(LLPCtx *ctx) { 29 | if (ctx->hook) { 30 | size_t length = ctx->frame_len; 31 | uint8_t *buffer = (uint8_t*)&ctx->buf; 32 | size_t padding = buffer[LLP_HEADER_SIZE-1]; 33 | size_t address_size = 2*sizeof(LLPAddress); 34 | #if STRIP_HEADERS 35 | uint8_t strip_headers = 1; 36 | #else 37 | uint8_t strip_headers = 0; 38 | #endif 39 | size_t subtraction = (address_size + (LLP_HEADER_SIZE - address_size))*strip_headers + padding; 40 | ctx->frame_len = length - subtraction - LLP_CHECKSUM_SIZE; 41 | 42 | for (int i = 0; i < ctx->frame_len; i++) { 43 | #if STRIP_HEADERS 44 | buffer[i] = buffer[i+subtraction]; 45 | #else 46 | if ( i >= LLP_HEADER_SIZE ) { 47 | buffer[i] = buffer[i+padding]; 48 | } else { 49 | buffer[i] = buffer[i]; 50 | } 51 | #endif 52 | } 53 | 54 | ctx->hook(ctx); 55 | } 56 | } 57 | 58 | void llp_poll(LLPCtx *ctx) { 59 | int c; 60 | 61 | #if DISABLE_INTERLEAVE 62 | while ((c = fgetc(ctx->ch)) != EOF) { 63 | if (!ctx->escape && c == HDLC_FLAG) { 64 | if (ctx->frame_len >= LLP_MIN_FRAME_LENGTH) { 65 | if (PASSALL || ctx->crc_in == LLP_CRC_CORRECT) { 66 | #if OPEN_SQUELCH == true 67 | LED_RX_ON(); 68 | #endif 69 | llp_decode(ctx); 70 | } 71 | } 72 | ctx->sync = true; 73 | ctx->crc_in = CRC_CCIT_INIT_VAL; 74 | ctx->frame_len = 0; 75 | continue; 76 | } 77 | 78 | if (!ctx->escape && c == HDLC_RESET) { 79 | ctx->sync = false; 80 | continue; 81 | } 82 | 83 | if (!ctx->escape && c == LLP_ESC) { 84 | ctx->escape = true; 85 | continue; 86 | } 87 | 88 | if (ctx->sync) { 89 | if (ctx->frame_len < LLP_MAX_FRAME_LENGTH) { 90 | ctx->buf[ctx->frame_len++] = c; 91 | ctx->crc_in = update_crc_ccit(c, ctx->crc_in); 92 | } else { 93 | ctx->sync = false; 94 | } 95 | } 96 | ctx->escape = false; 97 | } 98 | #else 99 | while ((c = fgetc(ctx->ch)) != EOF) { 100 | 101 | ///////////////////////////////////////////// 102 | // Start of forward error correction block // 103 | ///////////////////////////////////////////// 104 | if ((ctx->sync && (c != LLP_ESC )) || (ctx->sync && (ctx->escape && (c == LLP_ESC || c == HDLC_FLAG || c == HDLC_RESET)))) { 105 | // We have a byte, increment our read counter 106 | ctx->readLength++; 107 | 108 | // Check if we have read 12 bytes. If we 109 | // have, we should now have a block of two 110 | // data bytes and a parity byte. This block 111 | if (ctx->readLength % LLP_INTERLEAVE_SIZE == 0) { 112 | // If the last character in the block 113 | // looks like a control character, we 114 | // need to set the escape indicator to 115 | // false, since the next byte will be 116 | // read immediately after the FEC 117 | // routine, and thus, the normal reading 118 | // code will not reset the indicator. 119 | if (c == LLP_ESC || c == HDLC_FLAG || c == HDLC_RESET) ctx->escape = false; 120 | 121 | // The block is interleaved, so we will 122 | // first put the received bytes in the 123 | // deinterleaving buffer 124 | for (int i = 1; i < LLP_INTERLEAVE_SIZE; i++) { 125 | ctx->interleaveIn[i-1] = ctx->buf[ctx->frame_len-(LLP_INTERLEAVE_SIZE-i)]; 126 | } 127 | ctx->interleaveIn[LLP_INTERLEAVE_SIZE-1] = c; 128 | 129 | // We then deinterleave the block 130 | llpDeinterleave(ctx); 131 | 132 | // Adjust the packet length, since we will get 133 | // parity bytes in the data buffer with block 134 | // sizes larger than 3 135 | ctx->frame_len -= LLP_INTERLEAVE_SIZE/3 - 1; 136 | 137 | // For each 3-byte block in the deinterleaved 138 | // bytes, we apply forward error correction 139 | for (int i = 0; i < LLP_INTERLEAVE_SIZE; i+=3) { 140 | // We now calculate a parity byte on the 141 | // received data. 142 | 143 | // Deinterleaved data bytes 144 | uint8_t a = ctx->interleaveIn[i]; 145 | uint8_t b = ctx->interleaveIn[i+1]; 146 | 147 | // Deinterleaved parity byte 148 | uint8_t p = ctx->interleaveIn[i+2]; 149 | 150 | ctx->calculatedParity = llpParityBlock(a, b); 151 | 152 | // By XORing the calculated parity byte 153 | // with the received parity byte, we get 154 | // what is called the "syndrome". This 155 | // number will tell us if we had any 156 | // errors during transmission, and if so 157 | // where they are. Using Hamming code, we 158 | // can only detect single bit errors in a 159 | // byte though, which is why we interleave 160 | // the data, since most errors will usually 161 | // occur in bursts of more than one bit. 162 | // With 2 data byte interleaving we can 163 | // correct 2 consecutive bit errors. 164 | uint8_t syndrome = ctx->calculatedParity ^ p; 165 | if (syndrome == 0x00) { 166 | // If the syndrome equals 0, we either 167 | // don't have any errors, or the error 168 | // is unrecoverable, so we don't do 169 | // anything 170 | } else { 171 | // If the syndrome is not equal to 0, 172 | // there is a problem, and we will try 173 | // to correct it. We first need to split 174 | // the syndrome byte up into the two 175 | // actual syndrome numbers, one for 176 | // each data byte. 177 | uint8_t syndromes[2]; 178 | syndromes[0] = syndrome & 0x0f; 179 | syndromes[1] = (syndrome & 0xf0) >> 4; 180 | 181 | // Then we look at each syndrome number 182 | // to determine what bit in the data 183 | // bytes to correct. 184 | for (int i = 0; i < 2; i++) { 185 | uint8_t s = syndromes[i]; 186 | uint8_t correction = 0x00; 187 | if (s == 1 || s == 2 || s == 4 || s == 8) { 188 | // This signifies an error in the 189 | // parity block, so we actually 190 | // don't need any correction 191 | continue; 192 | } 193 | 194 | // The following determines what 195 | // bit to correct according to 196 | // the syndrome value. 197 | if (s == 3) correction = 0x01; 198 | if (s == 5) correction = 0x02; 199 | if (s == 6) correction = 0x04; 200 | if (s == 7) correction = 0x08; 201 | if (s == 9) correction = 0x10; 202 | if (s == 10) correction = 0x20; 203 | if (s == 11) correction = 0x40; 204 | if (s == 12) correction = 0x80; 205 | 206 | // And finally we apply the correction 207 | if (i == 1) a ^= correction; 208 | if (i == 0) b ^= correction; 209 | 210 | // This is just for testing purposes. 211 | // Nice to know when corrections were 212 | // actually made. 213 | if (s != 0) ctx->correctionsMade += 1; 214 | } 215 | } 216 | 217 | // We now update the checksum of the packet 218 | // with the deinterleaved and possibly 219 | // corrected bytes. 220 | 221 | ctx->crc_in = update_crc_ccit(a, ctx->crc_in); 222 | ctx->crc_in = update_crc_ccit(b, ctx->crc_in); 223 | 224 | ctx->buf[ctx->frame_len-(LLP_DATA_BLOCK_SIZE)+((i/3)*2)] = a; 225 | ctx->buf[ctx->frame_len-(LLP_DATA_BLOCK_SIZE-1)+((i/3)*2)] = b; 226 | } 227 | 228 | continue; 229 | } 230 | } 231 | ///////////////////////////////////////////// 232 | // End of forward error correction block // 233 | ///////////////////////////////////////////// 234 | 235 | if (!ctx->escape && c == HDLC_FLAG) { 236 | if (ctx->frame_len >= LLP_MIN_FRAME_LENGTH) { 237 | if (PASSALL || ctx->crc_in == LLP_CRC_CORRECT) { 238 | #if OPEN_SQUELCH == true 239 | LED_RX_ON(); 240 | #endif 241 | llp_decode(ctx); 242 | } 243 | } 244 | ctx->sync = true; 245 | ctx->crc_in = CRC_CCIT_INIT_VAL; 246 | ctx->frame_len = 0; 247 | ctx->readLength = 0; 248 | ctx->correctionsMade = 0; 249 | continue; 250 | } 251 | 252 | if (!ctx->escape && c == HDLC_RESET) { 253 | ctx->sync = false; 254 | continue; 255 | } 256 | 257 | if (!ctx->escape && c == LLP_ESC) { 258 | ctx->escape = true; 259 | continue; 260 | } 261 | 262 | if (ctx->sync) { 263 | if (ctx->frame_len < LLP_MAX_FRAME_LENGTH) { 264 | ctx->buf[ctx->frame_len++] = c; 265 | } else { 266 | ctx->sync = false; 267 | } 268 | } 269 | ctx->escape = false; 270 | } 271 | #endif 272 | } 273 | 274 | static void llp_putchar(LLPCtx *ctx, uint8_t c) { 275 | if (c == HDLC_FLAG || c == HDLC_RESET || c == LLP_ESC) fputc(LLP_ESC, ctx->ch); 276 | fputc(c, ctx->ch); 277 | } 278 | 279 | static void llp_sendchar(LLPCtx *ctx, uint8_t c) { 280 | llpInterleave(ctx, c); 281 | ctx->crc_out = update_crc_ccit(c, ctx->crc_out); 282 | 283 | if (sendParityBlock) { 284 | uint8_t p = llpParityBlock(lastByte, c); 285 | llpInterleave(ctx, p); 286 | } 287 | 288 | lastByte = c; 289 | sendParityBlock ^= true; 290 | } 291 | 292 | void llp_sendaddress(LLPCtx *ctx, LLPAddress *address) { 293 | llp_sendchar(ctx, address->network >> 8); 294 | llp_sendchar(ctx, address->network & 0xff); 295 | llp_sendchar(ctx, address->host >> 8); 296 | llp_sendchar(ctx, address->host & 0xff); 297 | } 298 | 299 | void llp_broadcast(LLPCtx *ctx, const void *_buf, size_t len) { 300 | llp_send(ctx, &broadcast_address, _buf, len); 301 | } 302 | 303 | void llp_send(LLPCtx *ctx, LLPAddress *dst, const void *_buf, size_t len) { 304 | ctx->ready_for_data = false; 305 | ctx->interleaveCounter = 0; 306 | ctx->crc_out = CRC_CCIT_INIT_VAL; 307 | uint8_t *buffer = (uint8_t*)_buf; 308 | 309 | LLPHeader header; 310 | memset(&header, 0, sizeof(header)); 311 | 312 | LLPAddress *localAddress = ctx->address; 313 | header.src.network = localAddress->network; 314 | header.src.host = localAddress->host; 315 | header.dst.network = dst->network; 316 | header.dst.host = dst->host; 317 | header.flags = 0x00; 318 | header.padding = (len + LLP_HEADER_SIZE + LLP_CRC_SIZE) % LLP_DATA_BLOCK_SIZE; 319 | if (header.padding != 0) { 320 | header.padding = LLP_DATA_BLOCK_SIZE - header.padding; 321 | } 322 | 323 | // Transmit the HDLC_FLAG to signify start of TX 324 | fputc(HDLC_FLAG, ctx->ch); 325 | 326 | // Transmit source & destination addresses 327 | llp_sendaddress(ctx, &header.src); 328 | llp_sendaddress(ctx, &header.dst); 329 | 330 | // Transmit header flags & padding count 331 | llp_sendchar(ctx, header.flags); 332 | llp_sendchar(ctx, header.padding); 333 | 334 | // Transmit padding 335 | while (header.padding--) { 336 | llp_sendchar(ctx, 0x00); 337 | } 338 | 339 | // Transmit payload 340 | while (len--) { 341 | llp_sendchar(ctx, *buffer++); 342 | } 343 | 344 | // Send CRC checksum 345 | uint8_t crcl = (ctx->crc_out & 0xff) ^ 0xff; 346 | uint8_t crch = (ctx->crc_out >> 8) ^ 0xff; 347 | llp_sendchar(ctx, crcl); 348 | llp_sendchar(ctx, crch); 349 | 350 | // And transmit a HDLC_FLAG to signify 351 | // end of the transmission. 352 | fputc(HDLC_FLAG, ctx->ch); 353 | ctx->ready_for_data = true; 354 | } 355 | 356 | void llp_sendRaw(LLPCtx *ctx, const void *_buf, size_t len) { 357 | ctx->ready_for_data = false; 358 | ctx->crc_out = CRC_CCIT_INIT_VAL; 359 | fputc(HDLC_FLAG, ctx->ch); 360 | const uint8_t *buf = (const uint8_t *)_buf; 361 | while (len--) llp_putchar(ctx, *buf++); 362 | 363 | uint8_t crcl = (ctx->crc_out & 0xff) ^ 0xff; 364 | uint8_t crch = (ctx->crc_out >> 8) ^ 0xff; 365 | llp_putchar(ctx, crcl); 366 | llp_putchar(ctx, crch); 367 | 368 | fputc(HDLC_FLAG, ctx->ch); 369 | 370 | ctx->ready_for_data = true; 371 | } 372 | 373 | void llp_init(LLPCtx *ctx, LLPAddress *address, FILE *channel, llp_callback_t hook) { 374 | memset(ctx, 0, sizeof(*ctx)); 375 | ctx->ch = channel; 376 | ctx->hook = hook; 377 | ctx->address = address; 378 | ctx->crc_in = ctx->crc_out = CRC_CCIT_INIT_VAL; 379 | ctx->ready_for_data = true; 380 | 381 | memset(&broadcast_address, 0, sizeof(broadcast_address)); 382 | broadcast_address.network = LLP_ADDR_BROADCAST; 383 | broadcast_address.host = LLP_ADDR_BROADCAST; 384 | } 385 | 386 | // This function calculates and returns a parity 387 | // byte for two input bytes. The parity byte is 388 | // used for correcting errors in the transmission. 389 | // The error correction algorithm is a standard 390 | // (12,8) Hamming code. 391 | inline bool BIT(uint8_t byte, int n) { return ((byte & _BV(n-1))>>(n-1)); } 392 | uint8_t llpParityBlock(uint8_t first, uint8_t other) { 393 | uint8_t parity = 0x00; 394 | 395 | parity = ((BIT(first, 1) ^ BIT(first, 2) ^ BIT(first, 4) ^ BIT(first, 5) ^ BIT(first, 7))) + 396 | ((BIT(first, 1) ^ BIT(first, 3) ^ BIT(first, 4) ^ BIT(first, 6) ^ BIT(first, 7))<<1) + 397 | ((BIT(first, 2) ^ BIT(first, 3) ^ BIT(first, 4) ^ BIT(first, 8))<<2) + 398 | ((BIT(first, 5) ^ BIT(first, 6) ^ BIT(first, 7) ^ BIT(first, 8))<<3) + 399 | 400 | ((BIT(other, 1) ^ BIT(other, 2) ^ BIT(other, 4) ^ BIT(other, 5) ^ BIT(other, 7))<<4) + 401 | ((BIT(other, 1) ^ BIT(other, 3) ^ BIT(other, 4) ^ BIT(other, 6) ^ BIT(other, 7))<<5) + 402 | ((BIT(other, 2) ^ BIT(other, 3) ^ BIT(other, 4) ^ BIT(other, 8))<<6) + 403 | ((BIT(other, 5) ^ BIT(other, 6) ^ BIT(other, 7) ^ BIT(other, 8))<<7); 404 | 405 | return parity; 406 | } 407 | 408 | // Following is the functions responsible 409 | // for interleaving and deinterleaving 410 | // blocks of data. The interleaving table 411 | // for 3-byte interleaving is also included. 412 | // The table for 12-byte is much simpler, 413 | // and should be inferable from looking 414 | // at the function. 415 | 416 | /////////////////////////////// 417 | // Interleave-table (3-byte) // 418 | /////////////////////////////// 419 | // 420 | // Non-interleaved: 421 | // aaaaaaaa bbbbbbbb cccccccc 422 | // 12345678 12345678 12345678 423 | // M L 424 | // S S 425 | // B B 426 | // 427 | // Interleaved: 428 | // abcabcab cabcabca bcabcabc 429 | // 11144477 22255578 63336688 430 | // 431 | /////////////////////////////// 432 | 433 | void llpInterleave(LLPCtx *ctx, uint8_t byte) { 434 | ctx->interleaveOut[ctx->interleaveCounter] = byte; 435 | ctx->interleaveCounter++; 436 | if (!DISABLE_INTERLEAVE) { 437 | if (ctx->interleaveCounter == LLP_INTERLEAVE_SIZE) { 438 | // We have the bytes we need for interleaving 439 | // in the buffer and are ready to interleave them. 440 | 441 | uint8_t a = (GET_BIT(ctx->interleaveOut[0], 1) << 7) + 442 | (GET_BIT(ctx->interleaveOut[1], 1) << 6) + 443 | (GET_BIT(ctx->interleaveOut[3], 1) << 5) + 444 | (GET_BIT(ctx->interleaveOut[4], 1) << 4) + 445 | (GET_BIT(ctx->interleaveOut[6], 1) << 3) + 446 | (GET_BIT(ctx->interleaveOut[7], 1) << 2) + 447 | (GET_BIT(ctx->interleaveOut[9], 1) << 1) + 448 | (GET_BIT(ctx->interleaveOut[10],1)); 449 | llp_putchar(ctx, a); 450 | 451 | uint8_t b = (GET_BIT(ctx->interleaveOut[0], 2) << 7) + 452 | (GET_BIT(ctx->interleaveOut[1], 2) << 6) + 453 | (GET_BIT(ctx->interleaveOut[3], 2) << 5) + 454 | (GET_BIT(ctx->interleaveOut[4], 2) << 4) + 455 | (GET_BIT(ctx->interleaveOut[6], 2) << 3) + 456 | (GET_BIT(ctx->interleaveOut[7], 2) << 2) + 457 | (GET_BIT(ctx->interleaveOut[9], 2) << 1) + 458 | (GET_BIT(ctx->interleaveOut[10],2)); 459 | llp_putchar(ctx, b); 460 | 461 | uint8_t c = (GET_BIT(ctx->interleaveOut[0], 3) << 7) + 462 | (GET_BIT(ctx->interleaveOut[1], 3) << 6) + 463 | (GET_BIT(ctx->interleaveOut[3], 3) << 5) + 464 | (GET_BIT(ctx->interleaveOut[4], 3) << 4) + 465 | (GET_BIT(ctx->interleaveOut[6], 3) << 3) + 466 | (GET_BIT(ctx->interleaveOut[7], 3) << 2) + 467 | (GET_BIT(ctx->interleaveOut[9], 3) << 1) + 468 | (GET_BIT(ctx->interleaveOut[10],3)); 469 | llp_putchar(ctx, c); 470 | 471 | uint8_t d = (GET_BIT(ctx->interleaveOut[0], 4) << 7) + 472 | (GET_BIT(ctx->interleaveOut[1], 4) << 6) + 473 | (GET_BIT(ctx->interleaveOut[3], 4) << 5) + 474 | (GET_BIT(ctx->interleaveOut[4], 4) << 4) + 475 | (GET_BIT(ctx->interleaveOut[6], 4) << 3) + 476 | (GET_BIT(ctx->interleaveOut[7], 4) << 2) + 477 | (GET_BIT(ctx->interleaveOut[9], 4) << 1) + 478 | (GET_BIT(ctx->interleaveOut[10],4)); 479 | llp_putchar(ctx, d); 480 | 481 | uint8_t e = (GET_BIT(ctx->interleaveOut[0], 5) << 7) + 482 | (GET_BIT(ctx->interleaveOut[1], 5) << 6) + 483 | (GET_BIT(ctx->interleaveOut[3], 5) << 5) + 484 | (GET_BIT(ctx->interleaveOut[4], 5) << 4) + 485 | (GET_BIT(ctx->interleaveOut[6], 5) << 3) + 486 | (GET_BIT(ctx->interleaveOut[7], 5) << 2) + 487 | (GET_BIT(ctx->interleaveOut[9], 5) << 1) + 488 | (GET_BIT(ctx->interleaveOut[10],5)); 489 | llp_putchar(ctx, e); 490 | 491 | uint8_t f = (GET_BIT(ctx->interleaveOut[0], 6) << 7) + 492 | (GET_BIT(ctx->interleaveOut[1], 6) << 6) + 493 | (GET_BIT(ctx->interleaveOut[3], 6) << 5) + 494 | (GET_BIT(ctx->interleaveOut[4], 6) << 4) + 495 | (GET_BIT(ctx->interleaveOut[6], 6) << 3) + 496 | (GET_BIT(ctx->interleaveOut[7], 6) << 2) + 497 | (GET_BIT(ctx->interleaveOut[9], 6) << 1) + 498 | (GET_BIT(ctx->interleaveOut[10],6)); 499 | llp_putchar(ctx, f); 500 | 501 | uint8_t g = (GET_BIT(ctx->interleaveOut[0], 7) << 7) + 502 | (GET_BIT(ctx->interleaveOut[1], 7) << 6) + 503 | (GET_BIT(ctx->interleaveOut[3], 7) << 5) + 504 | (GET_BIT(ctx->interleaveOut[4], 7) << 4) + 505 | (GET_BIT(ctx->interleaveOut[6], 7) << 3) + 506 | (GET_BIT(ctx->interleaveOut[7], 7) << 2) + 507 | (GET_BIT(ctx->interleaveOut[9], 7) << 1) + 508 | (GET_BIT(ctx->interleaveOut[10],7)); 509 | llp_putchar(ctx, g); 510 | 511 | uint8_t h = (GET_BIT(ctx->interleaveOut[0], 8) << 7) + 512 | (GET_BIT(ctx->interleaveOut[1], 8) << 6) + 513 | (GET_BIT(ctx->interleaveOut[3], 8) << 5) + 514 | (GET_BIT(ctx->interleaveOut[4], 8) << 4) + 515 | (GET_BIT(ctx->interleaveOut[6], 8) << 3) + 516 | (GET_BIT(ctx->interleaveOut[7], 8) << 2) + 517 | (GET_BIT(ctx->interleaveOut[9], 8) << 1) + 518 | (GET_BIT(ctx->interleaveOut[10],8)); 519 | llp_putchar(ctx, h); 520 | 521 | uint8_t p = (GET_BIT(ctx->interleaveOut[2], 1) << 7) + 522 | (GET_BIT(ctx->interleaveOut[2], 5) << 6) + 523 | (GET_BIT(ctx->interleaveOut[5], 1) << 5) + 524 | (GET_BIT(ctx->interleaveOut[5], 5) << 4) + 525 | (GET_BIT(ctx->interleaveOut[8], 1) << 3) + 526 | (GET_BIT(ctx->interleaveOut[8], 5) << 2) + 527 | (GET_BIT(ctx->interleaveOut[11],1) << 1) + 528 | (GET_BIT(ctx->interleaveOut[11],5)); 529 | llp_putchar(ctx, p); 530 | 531 | uint8_t q = (GET_BIT(ctx->interleaveOut[2], 2) << 7) + 532 | (GET_BIT(ctx->interleaveOut[2], 6) << 6) + 533 | (GET_BIT(ctx->interleaveOut[5], 2) << 5) + 534 | (GET_BIT(ctx->interleaveOut[5], 6) << 4) + 535 | (GET_BIT(ctx->interleaveOut[8], 2) << 3) + 536 | (GET_BIT(ctx->interleaveOut[8], 6) << 2) + 537 | (GET_BIT(ctx->interleaveOut[11],2) << 1) + 538 | (GET_BIT(ctx->interleaveOut[11],6)); 539 | llp_putchar(ctx, q); 540 | 541 | uint8_t s = (GET_BIT(ctx->interleaveOut[2], 3) << 7) + 542 | (GET_BIT(ctx->interleaveOut[2], 7) << 6) + 543 | (GET_BIT(ctx->interleaveOut[5], 3) << 5) + 544 | (GET_BIT(ctx->interleaveOut[5], 7) << 4) + 545 | (GET_BIT(ctx->interleaveOut[8], 3) << 3) + 546 | (GET_BIT(ctx->interleaveOut[8], 7) << 2) + 547 | (GET_BIT(ctx->interleaveOut[11],3) << 1) + 548 | (GET_BIT(ctx->interleaveOut[11],7)); 549 | llp_putchar(ctx, s); 550 | 551 | uint8_t t = (GET_BIT(ctx->interleaveOut[2], 4) << 7) + 552 | (GET_BIT(ctx->interleaveOut[2], 8) << 6) + 553 | (GET_BIT(ctx->interleaveOut[5], 4) << 5) + 554 | (GET_BIT(ctx->interleaveOut[5], 8) << 4) + 555 | (GET_BIT(ctx->interleaveOut[8], 4) << 3) + 556 | (GET_BIT(ctx->interleaveOut[8], 8) << 2) + 557 | (GET_BIT(ctx->interleaveOut[11],4) << 1) + 558 | (GET_BIT(ctx->interleaveOut[11],8)); 559 | llp_putchar(ctx, t); 560 | 561 | ctx->interleaveCounter = 0; 562 | } 563 | } else { 564 | if (ctx->interleaveCounter == LLP_INTERLEAVE_SIZE) { 565 | for (int i = 0; i < LLP_INTERLEAVE_SIZE; i++) { 566 | llp_putchar(ctx, ctx->interleaveOut[i]); 567 | } 568 | ctx->interleaveCounter = 0; 569 | } 570 | 571 | } 572 | } 573 | 574 | 575 | void llpDeinterleave(LLPCtx *ctx) { 576 | uint8_t a = (GET_BIT(ctx->interleaveIn[0], 1) << 7) + 577 | (GET_BIT(ctx->interleaveIn[1], 1) << 6) + 578 | (GET_BIT(ctx->interleaveIn[2], 1) << 5) + 579 | (GET_BIT(ctx->interleaveIn[3], 1) << 4) + 580 | (GET_BIT(ctx->interleaveIn[4], 1) << 3) + 581 | (GET_BIT(ctx->interleaveIn[5], 1) << 2) + 582 | (GET_BIT(ctx->interleaveIn[6], 1) << 1) + 583 | (GET_BIT(ctx->interleaveIn[7], 1)); 584 | 585 | uint8_t b = (GET_BIT(ctx->interleaveIn[0], 2) << 7) + 586 | (GET_BIT(ctx->interleaveIn[1], 2) << 6) + 587 | (GET_BIT(ctx->interleaveIn[2], 2) << 5) + 588 | (GET_BIT(ctx->interleaveIn[3], 2) << 4) + 589 | (GET_BIT(ctx->interleaveIn[4], 2) << 3) + 590 | (GET_BIT(ctx->interleaveIn[5], 2) << 2) + 591 | (GET_BIT(ctx->interleaveIn[6], 2) << 1) + 592 | (GET_BIT(ctx->interleaveIn[7], 2)); 593 | 594 | uint8_t p = (GET_BIT(ctx->interleaveIn[8], 1) << 7) + 595 | (GET_BIT(ctx->interleaveIn[9], 1) << 6) + 596 | (GET_BIT(ctx->interleaveIn[10],1) << 5) + 597 | (GET_BIT(ctx->interleaveIn[11],1) << 4) + 598 | (GET_BIT(ctx->interleaveIn[8], 2) << 3) + 599 | (GET_BIT(ctx->interleaveIn[9], 2) << 2) + 600 | (GET_BIT(ctx->interleaveIn[10],2) << 1) + 601 | (GET_BIT(ctx->interleaveIn[11],2)); 602 | 603 | uint8_t c = (GET_BIT(ctx->interleaveIn[0], 3) << 7) + 604 | (GET_BIT(ctx->interleaveIn[1], 3) << 6) + 605 | (GET_BIT(ctx->interleaveIn[2], 3) << 5) + 606 | (GET_BIT(ctx->interleaveIn[3], 3) << 4) + 607 | (GET_BIT(ctx->interleaveIn[4], 3) << 3) + 608 | (GET_BIT(ctx->interleaveIn[5], 3) << 2) + 609 | (GET_BIT(ctx->interleaveIn[6], 3) << 1) + 610 | (GET_BIT(ctx->interleaveIn[7], 3)); 611 | 612 | uint8_t d = (GET_BIT(ctx->interleaveIn[0], 4) << 7) + 613 | (GET_BIT(ctx->interleaveIn[1], 4) << 6) + 614 | (GET_BIT(ctx->interleaveIn[2], 4) << 5) + 615 | (GET_BIT(ctx->interleaveIn[3], 4) << 4) + 616 | (GET_BIT(ctx->interleaveIn[4], 4) << 3) + 617 | (GET_BIT(ctx->interleaveIn[5], 4) << 2) + 618 | (GET_BIT(ctx->interleaveIn[6], 4) << 1) + 619 | (GET_BIT(ctx->interleaveIn[7], 4)); 620 | 621 | uint8_t q = (GET_BIT(ctx->interleaveIn[8], 3) << 7) + 622 | (GET_BIT(ctx->interleaveIn[9], 3) << 6) + 623 | (GET_BIT(ctx->interleaveIn[10],3) << 5) + 624 | (GET_BIT(ctx->interleaveIn[11],3) << 4) + 625 | (GET_BIT(ctx->interleaveIn[8], 4) << 3) + 626 | (GET_BIT(ctx->interleaveIn[9], 4) << 2) + 627 | (GET_BIT(ctx->interleaveIn[10],4) << 1) + 628 | (GET_BIT(ctx->interleaveIn[11],4)); 629 | 630 | uint8_t e = (GET_BIT(ctx->interleaveIn[0], 5) << 7) + 631 | (GET_BIT(ctx->interleaveIn[1], 5) << 6) + 632 | (GET_BIT(ctx->interleaveIn[2], 5) << 5) + 633 | (GET_BIT(ctx->interleaveIn[3], 5) << 4) + 634 | (GET_BIT(ctx->interleaveIn[4], 5) << 3) + 635 | (GET_BIT(ctx->interleaveIn[5], 5) << 2) + 636 | (GET_BIT(ctx->interleaveIn[6], 5) << 1) + 637 | (GET_BIT(ctx->interleaveIn[7], 5)); 638 | 639 | uint8_t f = (GET_BIT(ctx->interleaveIn[0], 6) << 7) + 640 | (GET_BIT(ctx->interleaveIn[1], 6) << 6) + 641 | (GET_BIT(ctx->interleaveIn[2], 6) << 5) + 642 | (GET_BIT(ctx->interleaveIn[3], 6) << 4) + 643 | (GET_BIT(ctx->interleaveIn[4], 6) << 3) + 644 | (GET_BIT(ctx->interleaveIn[5], 6) << 2) + 645 | (GET_BIT(ctx->interleaveIn[6], 6) << 1) + 646 | (GET_BIT(ctx->interleaveIn[7], 6)); 647 | 648 | uint8_t s = (GET_BIT(ctx->interleaveIn[8], 5) << 7) + 649 | (GET_BIT(ctx->interleaveIn[9], 5) << 6) + 650 | (GET_BIT(ctx->interleaveIn[10],5) << 5) + 651 | (GET_BIT(ctx->interleaveIn[11],5) << 4) + 652 | (GET_BIT(ctx->interleaveIn[8], 6) << 3) + 653 | (GET_BIT(ctx->interleaveIn[9], 6) << 2) + 654 | (GET_BIT(ctx->interleaveIn[10],6) << 1) + 655 | (GET_BIT(ctx->interleaveIn[11],6)); 656 | 657 | uint8_t g = (GET_BIT(ctx->interleaveIn[0], 7) << 7) + 658 | (GET_BIT(ctx->interleaveIn[1], 7) << 6) + 659 | (GET_BIT(ctx->interleaveIn[2], 7) << 5) + 660 | (GET_BIT(ctx->interleaveIn[3], 7) << 4) + 661 | (GET_BIT(ctx->interleaveIn[4], 7) << 3) + 662 | (GET_BIT(ctx->interleaveIn[5], 7) << 2) + 663 | (GET_BIT(ctx->interleaveIn[6], 7) << 1) + 664 | (GET_BIT(ctx->interleaveIn[7], 7)); 665 | 666 | uint8_t h = (GET_BIT(ctx->interleaveIn[0], 8) << 7) + 667 | (GET_BIT(ctx->interleaveIn[1], 8) << 6) + 668 | (GET_BIT(ctx->interleaveIn[2], 8) << 5) + 669 | (GET_BIT(ctx->interleaveIn[3], 8) << 4) + 670 | (GET_BIT(ctx->interleaveIn[4], 8) << 3) + 671 | (GET_BIT(ctx->interleaveIn[5], 8) << 2) + 672 | (GET_BIT(ctx->interleaveIn[6], 8) << 1) + 673 | (GET_BIT(ctx->interleaveIn[7], 8)); 674 | 675 | uint8_t t = (GET_BIT(ctx->interleaveIn[8], 7) << 7) + 676 | (GET_BIT(ctx->interleaveIn[9], 7) << 6) + 677 | (GET_BIT(ctx->interleaveIn[10],7) << 5) + 678 | (GET_BIT(ctx->interleaveIn[11],7) << 4) + 679 | (GET_BIT(ctx->interleaveIn[8], 8) << 3) + 680 | (GET_BIT(ctx->interleaveIn[9], 8) << 2) + 681 | (GET_BIT(ctx->interleaveIn[10],8) << 1) + 682 | (GET_BIT(ctx->interleaveIn[11],8)); 683 | 684 | ctx->interleaveIn[0] = a; 685 | ctx->interleaveIn[1] = b; 686 | ctx->interleaveIn[2] = p; 687 | ctx->interleaveIn[3] = c; 688 | ctx->interleaveIn[4] = d; 689 | ctx->interleaveIn[5] = q; 690 | ctx->interleaveIn[6] = e; 691 | ctx->interleaveIn[7] = f; 692 | ctx->interleaveIn[8] = s; 693 | ctx->interleaveIn[9] = g; 694 | ctx->interleaveIn[10] = h; 695 | ctx->interleaveIn[11] = t; 696 | } -------------------------------------------------------------------------------- /protocol/LLP.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOCOL_LLP_H 2 | #define PROTOCOL_LLP_H 3 | 4 | #include 5 | #include 6 | #include "device.h" 7 | 8 | #define LLP_ADDR_BROADCAST 0xFFFF 9 | 10 | #define LLP_INTERLEAVE_SIZE 12 11 | #define LLP_MIN_FRAME_LENGTH LLP_INTERLEAVE_SIZE 12 | #define LLP_MAX_FRAME_LENGTH 48 * LLP_INTERLEAVE_SIZE 13 | #define LLP_HEADER_SIZE 10 14 | #define LLP_CHECKSUM_SIZE 2 15 | #define LLP_MAX_DATA_SIZE LLP_MAX_FRAME_LENGTH - LLP_HEADER_SIZE - LLP_CHECKSUM_SIZE 16 | #define LLP_DATA_BLOCK_SIZE ((LLP_INTERLEAVE_SIZE/3)*2) 17 | 18 | #define LLP_CRC_SIZE 2 19 | #define LLP_CRC_CORRECT 0xF0B8 20 | 21 | struct LLPCtx; // Forward declarations 22 | 23 | typedef void (*llp_callback_t)(struct LLPCtx *ctx); 24 | 25 | typedef struct LLPAddress { 26 | uint16_t network; 27 | uint16_t host; 28 | } LLPAddress; 29 | 30 | typedef struct LLPHeader { 31 | LLPAddress src; 32 | LLPAddress dst; 33 | uint8_t flags; 34 | uint8_t padding; 35 | } LLPHeader; 36 | 37 | typedef struct LLPMsg { 38 | LLPHeader header; 39 | const uint8_t *data; 40 | size_t len; 41 | } LLPMsg; 42 | 43 | typedef struct LLPCtx { 44 | uint8_t buf[LLP_MAX_FRAME_LENGTH]; 45 | FILE *ch; 46 | LLPAddress *address; 47 | size_t frame_len; 48 | size_t readLength; 49 | uint16_t crc_in; 50 | uint16_t crc_out; 51 | uint8_t calculatedParity; 52 | long correctionsMade; 53 | llp_callback_t hook; 54 | bool sync; 55 | bool escape; 56 | bool ready_for_data; 57 | uint8_t interleaveCounter; // Keeps track of when we have received an entire interleaved block 58 | uint8_t interleaveOut[LLP_INTERLEAVE_SIZE]; // A buffer for interleaving bytes before they are sent 59 | uint8_t interleaveIn[LLP_INTERLEAVE_SIZE]; // A buffer for storing interleaved bytes before they are deinterleaved 60 | } LLPCtx; 61 | 62 | void llp_broadcast(LLPCtx *ctx, const void *_buf, size_t len); 63 | void llp_send(LLPCtx *ctx, LLPAddress *dst, const void *_buf, size_t len); 64 | void llp_sendRaw(LLPCtx *ctx, const void *_buf, size_t len); 65 | void llp_poll(LLPCtx *ctx); 66 | void llp_init(LLPCtx *ctx, LLPAddress *address, FILE *channel, llp_callback_t hook); 67 | 68 | void llpInterleave(LLPCtx *ctx, uint8_t byte); 69 | void llpDeinterleave(LLPCtx *ctx); 70 | uint8_t llpParityBlock(uint8_t first, uint8_t other); 71 | 72 | #endif -------------------------------------------------------------------------------- /util/CRC-CCIT.c: -------------------------------------------------------------------------------- 1 | #include "CRC-CCIT.h" 2 | 3 | const uint16_t crc_ccit_table[256] PROGMEM = { 4 | 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 5 | 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 6 | 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 7 | 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 8 | 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 9 | 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 10 | 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 11 | 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 12 | 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 13 | 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 14 | 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 15 | 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 16 | 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 17 | 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 18 | 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 19 | 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 20 | 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 21 | 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 22 | 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 23 | 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 24 | 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 25 | 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 26 | 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 27 | 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 28 | 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 29 | 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 30 | 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 31 | 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 32 | 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 33 | 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 34 | 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 35 | 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78, 36 | }; -------------------------------------------------------------------------------- /util/CRC-CCIT.h: -------------------------------------------------------------------------------- 1 | // CRC-CCIT Implementation based on work by Francesco Sacchi 2 | 3 | #ifndef CRC_CCIT_H 4 | #define CRC_CCIT_H 5 | 6 | #include 7 | #include 8 | 9 | #define CRC_CCIT_INIT_VAL ((uint16_t)0xFFFF) 10 | 11 | extern const uint16_t crc_ccit_table[256]; 12 | 13 | inline uint16_t update_crc_ccit(uint8_t c, uint16_t prev_crc) { 14 | return (prev_crc >> 8) ^ pgm_read_word(&crc_ccit_table[(prev_crc ^ c) & 0xff]); 15 | } 16 | 17 | 18 | #endif -------------------------------------------------------------------------------- /util/FIFO.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_FIFO_H 2 | #define UTIL_FIFO_H 3 | 4 | #include 5 | #include 6 | 7 | typedef struct FIFOBuffer 8 | { 9 | unsigned char *begin; 10 | unsigned char *end; 11 | unsigned char * volatile head; 12 | unsigned char * volatile tail; 13 | } FIFOBuffer; 14 | 15 | inline bool fifo_isempty(const FIFOBuffer *f) { 16 | return f->head == f->tail; 17 | } 18 | 19 | inline bool fifo_isfull(const FIFOBuffer *f) { 20 | return ((f->head == f->begin) && (f->tail == f->end)) || (f->tail == f->head - 1); 21 | } 22 | 23 | inline void fifo_push(FIFOBuffer *f, unsigned char c) { 24 | *(f->tail) = c; 25 | 26 | if (f->tail == f->end) { 27 | f->tail = f->begin; 28 | } else { 29 | f->tail++; 30 | } 31 | } 32 | 33 | inline unsigned char fifo_pop(FIFOBuffer *f) { 34 | if(f->head == f->end) { 35 | f->head = f->begin; 36 | return *(f->end); 37 | } else { 38 | return *(f->head++); 39 | } 40 | } 41 | 42 | inline void fifo_flush(FIFOBuffer *f) { 43 | f->head = f->tail; 44 | } 45 | 46 | inline bool fifo_isempty_locked(const FIFOBuffer *f) { 47 | bool result; 48 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { 49 | result = fifo_isempty(f); 50 | } 51 | return result; 52 | } 53 | 54 | inline bool fifo_isfull_locked(const FIFOBuffer *f) { 55 | bool result; 56 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { 57 | result = fifo_isfull(f); 58 | } 59 | return result; 60 | } 61 | 62 | inline void fifo_push_locked(FIFOBuffer *f, unsigned char c) { 63 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { 64 | fifo_push(f, c); 65 | } 66 | } 67 | 68 | inline unsigned char fifo_pop_locked(FIFOBuffer *f) { 69 | unsigned char c; 70 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { 71 | c = fifo_pop(f); 72 | } 73 | return c; 74 | } 75 | 76 | inline void fifo_init(FIFOBuffer *f, unsigned char *buffer, size_t size) { 77 | f->head = f->tail = f->begin = buffer; 78 | f->end = buffer + size -1; 79 | } 80 | 81 | inline size_t fifo_len(FIFOBuffer *f) { 82 | return f->end - f->begin; 83 | } 84 | 85 | #endif -------------------------------------------------------------------------------- /util/constants.h: -------------------------------------------------------------------------------- 1 | #define PROTOCOL_KISS 0x01 2 | #define PROTOCOL_SIMPLE_SERIAL 0x02 3 | 4 | #define m328p 0x01 5 | #define m1284p 0x02 6 | #define m644p 0x03 7 | 8 | #define REF_3V3 0x01 9 | #define REF_5V 0x02 10 | 11 | #define SERIAL_FRAMING_KISS 0x01 12 | #define SERIAL_FRAMING_DIRECT 0x02 -------------------------------------------------------------------------------- /util/time.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_TIME_H 2 | #define UTIL_TIME_H 3 | 4 | #include 5 | #include "device.h" 6 | 7 | #define DIV_ROUND(dividend, divisor) (((dividend) + (divisor) / 2) / (divisor)) 8 | #define CLOCK_TICKS_PER_SEC CONFIG_AFSK_DAC_SAMPLERATE 9 | 10 | typedef int32_t ticks_t; 11 | typedef int32_t mtime_t; 12 | 13 | volatile ticks_t _clock; 14 | 15 | inline ticks_t timer_clock(void) { 16 | ticks_t result; 17 | 18 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { 19 | result = _clock; 20 | } 21 | 22 | return result; 23 | } 24 | 25 | 26 | inline ticks_t ms_to_ticks(mtime_t ms) { 27 | return ms * DIV_ROUND(CLOCK_TICKS_PER_SEC, 1000); 28 | } 29 | 30 | inline void cpu_relax(void) { 31 | // Do nothing! 32 | } 33 | 34 | inline void delay_ms(unsigned long ms) { 35 | ticks_t start = timer_clock(); 36 | unsigned long n_ticks = ms_to_ticks(ms); 37 | while (timer_clock() - start < n_ticks) { 38 | cpu_relax(); 39 | } 40 | } 41 | 42 | 43 | #endif --------------------------------------------------------------------------------