/[dtapublic]/winprojs/scirfmmon/docs/man20081211a/man20081211a.tex
ViewVC logotype

Annotation of /winprojs/scirfmmon/docs/man20081211a/man20081211a.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22 - (hide annotations) (download) (as text)
Sat Oct 8 06:05:29 2016 UTC (8 years ago) by dashley
File MIME type: application/x-tex
File size: 87453 byte(s)
Initial commit.
1 dashley 22 %$Header: /home/dashley/cvsrep/e3ft_gpl01/e3ft_gpl01/winprojs/scirfmmon/docs/man20081211a/man20081211a.tex,v 1.20 2009/01/17 22:17:01 dashley Exp $
2     \documentclass[letterpaper,10pt,titlepage]{article}
3     //-------------------------------------------------------------------------------------------------
4     //This source code and any program in which it is compiled/used is provided under the GNU GENERAL
5     //PUBLIC LICENSE, Version 3, full license text below.
6     //-------------------------------------------------------------------------------------------------
7     // GNU GENERAL PUBLIC LICENSE
8     // Version 3, 29 June 2007
9     //
10     // Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
11     // Everyone is permitted to copy and distribute verbatim copies
12     // of this license document, but changing it is not allowed.
13     //
14     // Preamble
15     //
16     // The GNU General Public License is a free, copyleft license for
17     //software and other kinds of works.
18     //
19     // The licenses for most software and other practical works are designed
20     //to take away your freedom to share and change the works. By contrast,
21     //the GNU General Public License is intended to guarantee your freedom to
22     //share and change all versions of a program--to make sure it remains free
23     //software for all its users. We, the Free Software Foundation, use the
24     //GNU General Public License for most of our software; it applies also to
25     //any other work released this way by its authors. You can apply it to
26     //your programs, too.
27     //
28     // When we speak of free software, we are referring to freedom, not
29     //price. Our General Public Licenses are designed to make sure that you
30     //have the freedom to distribute copies of free software (and charge for
31     //them if you wish), that you receive source code or can get it if you
32     //want it, that you can change the software or use pieces of it in new
33     //free programs, and that you know you can do these things.
34     //
35     // To protect your rights, we need to prevent others from denying you
36     //these rights or asking you to surrender the rights. Therefore, you have
37     //certain responsibilities if you distribute copies of the software, or if
38     //you modify it: responsibilities to respect the freedom of others.
39     //
40     // For example, if you distribute copies of such a program, whether
41     //gratis or for a fee, you must pass on to the recipients the same
42     //freedoms that you received. You must make sure that they, too, receive
43     //or can get the source code. And you must show them these terms so they
44     //know their rights.
45     //
46     // Developers that use the GNU GPL protect your rights with two steps:
47     //(1) assert copyright on the software, and (2) offer you this License
48     //giving you legal permission to copy, distribute and/or modify it.
49     //
50     // For the developers' and authors' protection, the GPL clearly explains
51     //that there is no warranty for this free software. For both users' and
52     //authors' sake, the GPL requires that modified versions be marked as
53     //changed, so that their problems will not be attributed erroneously to
54     //authors of previous versions.
55     //
56     // Some devices are designed to deny users access to install or run
57     //modified versions of the software inside them, although the manufacturer
58     //can do so. This is fundamentally incompatible with the aim of
59     //protecting users' freedom to change the software. The systematic
60     //pattern of such abuse occurs in the area of products for individuals to
61     //use, which is precisely where it is most unacceptable. Therefore, we
62     //have designed this version of the GPL to prohibit the practice for those
63     //products. If such problems arise substantially in other domains, we
64     //stand ready to extend this provision to those domains in future versions
65     //of the GPL, as needed to protect the freedom of users.
66     //
67     // Finally, every program is threatened constantly by software patents.
68     //States should not allow patents to restrict development and use of
69     //software on general-purpose computers, but in those that do, we wish to
70     //avoid the special danger that patents applied to a free program could
71     //make it effectively proprietary. To prevent this, the GPL assures that
72     //patents cannot be used to render the program non-free.
73     //
74     // The precise terms and conditions for copying, distribution and
75     //modification follow.
76     //
77     // TERMS AND CONDITIONS
78     //
79     // 0. Definitions.
80     //
81     // "This License" refers to version 3 of the GNU General Public License.
82     //
83     // "Copyright" also means copyright-like laws that apply to other kinds of
84     //works, such as semiconductor masks.
85     //
86     // "The Program" refers to any copyrightable work licensed under this
87     //License. Each licensee is addressed as "you". "Licensees" and
88     //"recipients" may be individuals or organizations.
89     //
90     // To "modify" a work means to copy from or adapt all or part of the work
91     //in a fashion requiring copyright permission, other than the making of an
92     //exact copy. The resulting work is called a "modified version" of the
93     //earlier work or a work "based on" the earlier work.
94     //
95     // A "covered work" means either the unmodified Program or a work based
96     //on the Program.
97     //
98     // To "propagate" a work means to do anything with it that, without
99     //permission, would make you directly or secondarily liable for
100     //infringement under applicable copyright law, except executing it on a
101     //computer or modifying a private copy. Propagation includes copying,
102     //distribution (with or without modification), making available to the
103     //public, and in some countries other activities as well.
104     //
105     // To "convey" a work means any kind of propagation that enables other
106     //parties to make or receive copies. Mere interaction with a user through
107     //a computer network, with no transfer of a copy, is not conveying.
108     //
109     // An interactive user interface displays "Appropriate Legal Notices"
110     //to the extent that it includes a convenient and prominently visible
111     //feature that (1) displays an appropriate copyright notice, and (2)
112     //tells the user that there is no warranty for the work (except to the
113     //extent that warranties are provided), that licensees may convey the
114     //work under this License, and how to view a copy of this License. If
115     //the interface presents a list of user commands or options, such as a
116     //menu, a prominent item in the list meets this criterion.
117     //
118     // 1. Source Code.
119     //
120     // The "source code" for a work means the preferred form of the work
121     //for making modifications to it. "Object code" means any non-source
122     //form of a work.
123     //
124     // A "Standard Interface" means an interface that either is an official
125     //standard defined by a recognized standards body, or, in the case of
126     //interfaces specified for a particular programming language, one that
127     //is widely used among developers working in that language.
128     //
129     // The "System Libraries" of an executable work include anything, other
130     //than the work as a whole, that (a) is included in the normal form of
131     //packaging a Major Component, but which is not part of that Major
132     //Component, and (b) serves only to enable use of the work with that
133     //Major Component, or to implement a Standard Interface for which an
134     //implementation is available to the public in source code form. A
135     //"Major Component", in this context, means a major essential component
136     //(kernel, window system, and so on) of the specific operating system
137     //(if any) on which the executable work runs, or a compiler used to
138     //produce the work, or an object code interpreter used to run it.
139     //
140     // The "Corresponding Source" for a work in object code form means all
141     //the source code needed to generate, install, and (for an executable
142     //work) run the object code and to modify the work, including scripts to
143     //control those activities. However, it does not include the work's
144     //System Libraries, or general-purpose tools or generally available free
145     //programs which are used unmodified in performing those activities but
146     //which are not part of the work. For example, Corresponding Source
147     //includes interface definition files associated with source files for
148     //the work, and the source code for shared libraries and dynamically
149     //linked subprograms that the work is specifically designed to require,
150     //such as by intimate data communication or control flow between those
151     //subprograms and other parts of the work.
152     //
153     // The Corresponding Source need not include anything that users
154     //can regenerate automatically from other parts of the Corresponding
155     //Source.
156     //
157     // The Corresponding Source for a work in source code form is that
158     //same work.
159     //
160     // 2. Basic Permissions.
161     //
162     // All rights granted under this License are granted for the term of
163     //copyright on the Program, and are irrevocable provided the stated
164     //conditions are met. This License explicitly affirms your unlimited
165     //permission to run the unmodified Program. The output from running a
166     //covered work is covered by this License only if the output, given its
167     //content, constitutes a covered work. This License acknowledges your
168     //rights of fair use or other equivalent, as provided by copyright law.
169     //
170     // You may make, run and propagate covered works that you do not
171     //convey, without conditions so long as your license otherwise remains
172     //in force. You may convey covered works to others for the sole purpose
173     //of having them make modifications exclusively for you, or provide you
174     //with facilities for running those works, provided that you comply with
175     //the terms of this License in conveying all material for which you do
176     //not control copyright. Those thus making or running the covered works
177     //for you must do so exclusively on your behalf, under your direction
178     //and control, on terms that prohibit them from making any copies of
179     //your copyrighted material outside their relationship with you.
180     //
181     // Conveying under any other circumstances is permitted solely under
182     //the conditions stated below. Sublicensing is not allowed; section 10
183     //makes it unnecessary.
184     //
185     // 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
186     //
187     // No covered work shall be deemed part of an effective technological
188     //measure under any applicable law fulfilling obligations under article
189     //11 of the WIPO copyright treaty adopted on 20 December 1996, or
190     //similar laws prohibiting or restricting circumvention of such
191     //measures.
192     //
193     // When you convey a covered work, you waive any legal power to forbid
194     //circumvention of technological measures to the extent such circumvention
195     //is effected by exercising rights under this License with respect to
196     //the covered work, and you disclaim any intention to limit operation or
197     //modification of the work as a means of enforcing, against the work's
198     //users, your or third parties' legal rights to forbid circumvention of
199     //technological measures.
200     //
201     // 4. Conveying Verbatim Copies.
202     //
203     // You may convey verbatim copies of the Program's source code as you
204     //receive it, in any medium, provided that you conspicuously and
205     //appropriately publish on each copy an appropriate copyright notice;
206     //keep intact all notices stating that this License and any
207     //non-permissive terms added in accord with section 7 apply to the code;
208     //keep intact all notices of the absence of any warranty; and give all
209     //recipients a copy of this License along with the Program.
210     //
211     // You may charge any price or no price for each copy that you convey,
212     //and you may offer support or warranty protection for a fee.
213     //
214     // 5. Conveying Modified Source Versions.
215     //
216     // You may convey a work based on the Program, or the modifications to
217     //produce it from the Program, in the form of source code under the
218     //terms of section 4, provided that you also meet all of these conditions:
219     //
220     // a) The work must carry prominent notices stating that you modified
221     // it, and giving a relevant date.
222     //
223     // b) The work must carry prominent notices stating that it is
224     // released under this License and any conditions added under section
225     // 7. This requirement modifies the requirement in section 4 to
226     // "keep intact all notices".
227     //
228     // c) You must license the entire work, as a whole, under this
229     // License to anyone who comes into possession of a copy. This
230     // License will therefore apply, along with any applicable section 7
231     // additional terms, to the whole of the work, and all its parts,
232     // regardless of how they are packaged. This License gives no
233     // permission to license the work in any other way, but it does not
234     // invalidate such permission if you have separately received it.
235     //
236     // d) If the work has interactive user interfaces, each must display
237     // Appropriate Legal Notices; however, if the Program has interactive
238     // interfaces that do not display Appropriate Legal Notices, your
239     // work need not make them do so.
240     //
241     // A compilation of a covered work with other separate and independent
242     //works, which are not by their nature extensions of the covered work,
243     //and which are not combined with it such as to form a larger program,
244     //in or on a volume of a storage or distribution medium, is called an
245     //"aggregate" if the compilation and its resulting copyright are not
246     //used to limit the access or legal rights of the compilation's users
247     //beyond what the individual works permit. Inclusion of a covered work
248     //in an aggregate does not cause this License to apply to the other
249     //parts of the aggregate.
250     //
251     // 6. Conveying Non-Source Forms.
252     //
253     // You may convey a covered work in object code form under the terms
254     //of sections 4 and 5, provided that you also convey the
255     //machine-readable Corresponding Source under the terms of this License,
256     //in one of these ways:
257     //
258     // a) Convey the object code in, or embodied in, a physical product
259     // (including a physical distribution medium), accompanied by the
260     // Corresponding Source fixed on a durable physical medium
261     // customarily used for software interchange.
262     //
263     // b) Convey the object code in, or embodied in, a physical product
264     // (including a physical distribution medium), accompanied by a
265     // written offer, valid for at least three years and valid for as
266     // long as you offer spare parts or customer support for that product
267     // model, to give anyone who possesses the object code either (1) a
268     // copy of the Corresponding Source for all the software in the
269     // product that is covered by this License, on a durable physical
270     // medium customarily used for software interchange, for a price no
271     // more than your reasonable cost of physically performing this
272     // conveying of source, or (2) access to copy the
273     // Corresponding Source from a network server at no charge.
274     //
275     // c) Convey individual copies of the object code with a copy of the
276     // written offer to provide the Corresponding Source. This
277     // alternative is allowed only occasionally and noncommercially, and
278     // only if you received the object code with such an offer, in accord
279     // with subsection 6b.
280     //
281     // d) Convey the object code by offering access from a designated
282     // place (gratis or for a charge), and offer equivalent access to the
283     // Corresponding Source in the same way through the same place at no
284     // further charge. You need not require recipients to copy the
285     // Corresponding Source along with the object code. If the place to
286     // copy the object code is a network server, the Corresponding Source
287     // may be on a different server (operated by you or a third party)
288     // that supports equivalent copying facilities, provided you maintain
289     // clear directions next to the object code saying where to find the
290     // Corresponding Source. Regardless of what server hosts the
291     // Corresponding Source, you remain obligated to ensure that it is
292     // available for as long as needed to satisfy these requirements.
293     //
294     // e) Convey the object code using peer-to-peer transmission, provided
295     // you inform other peers where the object code and Corresponding
296     // Source of the work are being offered to the general public at no
297     // charge under subsection 6d.
298     //
299     // A separable portion of the object code, whose source code is excluded
300     //from the Corresponding Source as a System Library, need not be
301     //included in conveying the object code work.
302     //
303     // A "User Product" is either (1) a "consumer product", which means any
304     //tangible personal property which is normally used for personal, family,
305     //or household purposes, or (2) anything designed or sold for incorporation
306     //into a dwelling. In determining whether a product is a consumer product,
307     //doubtful cases shall be resolved in favor of coverage. For a particular
308     //product received by a particular user, "normally used" refers to a
309     //typical or common use of that class of product, regardless of the status
310     //of the particular user or of the way in which the particular user
311     //actually uses, or expects or is expected to use, the product. A product
312     //is a consumer product regardless of whether the product has substantial
313     //commercial, industrial or non-consumer uses, unless such uses represent
314     //the only significant mode of use of the product.
315     //
316     // "Installation Information" for a User Product means any methods,
317     //procedures, authorization keys, or other information required to install
318     //and execute modified versions of a covered work in that User Product from
319     //a modified version of its Corresponding Source. The information must
320     //suffice to ensure that the continued functioning of the modified object
321     //code is in no case prevented or interfered with solely because
322     //modification has been made.
323     //
324     // If you convey an object code work under this section in, or with, or
325     //specifically for use in, a User Product, and the conveying occurs as
326     //part of a transaction in which the right of possession and use of the
327     //User Product is transferred to the recipient in perpetuity or for a
328     //fixed term (regardless of how the transaction is characterized), the
329     //Corresponding Source conveyed under this section must be accompanied
330     //by the Installation Information. But this requirement does not apply
331     //if neither you nor any third party retains the ability to install
332     //modified object code on the User Product (for example, the work has
333     //been installed in ROM).
334     //
335     // The requirement to provide Installation Information does not include a
336     //requirement to continue to provide support service, warranty, or updates
337     //for a work that has been modified or installed by the recipient, or for
338     //the User Product in which it has been modified or installed. Access to a
339     //network may be denied when the modification itself materially and
340     //adversely affects the operation of the network or violates the rules and
341     //protocols for communication across the network.
342     //
343     // Corresponding Source conveyed, and Installation Information provided,
344     //in accord with this section must be in a format that is publicly
345     //documented (and with an implementation available to the public in
346     //source code form), and must require no special password or key for
347     //unpacking, reading or copying.
348     //
349     // 7. Additional Terms.
350     //
351     // "Additional permissions" are terms that supplement the terms of this
352     //License by making exceptions from one or more of its conditions.
353     //Additional permissions that are applicable to the entire Program shall
354     //be treated as though they were included in this License, to the extent
355     //that they are valid under applicable law. If additional permissions
356     //apply only to part of the Program, that part may be used separately
357     //under those permissions, but the entire Program remains governed by
358     //this License without regard to the additional permissions.
359     //
360     // When you convey a copy of a covered work, you may at your option
361     //remove any additional permissions from that copy, or from any part of
362     //it. (Additional permissions may be written to require their own
363     //removal in certain cases when you modify the work.) You may place
364     //additional permissions on material, added by you to a covered work,
365     //for which you have or can give appropriate copyright permission.
366     //
367     // Notwithstanding any other provision of this License, for material you
368     //add to a covered work, you may (if authorized by the copyright holders of
369     //that material) supplement the terms of this License with terms:
370     //
371     // a) Disclaiming warranty or limiting liability differently from the
372     // terms of sections 15 and 16 of this License; or
373     //
374     // b) Requiring preservation of specified reasonable legal notices or
375     // author attributions in that material or in the Appropriate Legal
376     // Notices displayed by works containing it; or
377     //
378     // c) Prohibiting misrepresentation of the origin of that material, or
379     // requiring that modified versions of such material be marked in
380     // reasonable ways as different from the original version; or
381     //
382     // d) Limiting the use for publicity purposes of names of licensors or
383     // authors of the material; or
384     //
385     // e) Declining to grant rights under trademark law for use of some
386     // trade names, trademarks, or service marks; or
387     //
388     // f) Requiring indemnification of licensors and authors of that
389     // material by anyone who conveys the material (or modified versions of
390     // it) with contractual assumptions of liability to the recipient, for
391     // any liability that these contractual assumptions directly impose on
392     // those licensors and authors.
393     //
394     // All other non-permissive additional terms are considered "further
395     //restrictions" within the meaning of section 10. If the Program as you
396     //received it, or any part of it, contains a notice stating that it is
397     //governed by this License along with a term that is a further
398     //restriction, you may remove that term. If a license document contains
399     //a further restriction but permits relicensing or conveying under this
400     //License, you may add to a covered work material governed by the terms
401     //of that license document, provided that the further restriction does
402     //not survive such relicensing or conveying.
403     //
404     // If you add terms to a covered work in accord with this section, you
405     //must place, in the relevant source files, a statement of the
406     //additional terms that apply to those files, or a notice indicating
407     //where to find the applicable terms.
408     //
409     // Additional terms, permissive or non-permissive, may be stated in the
410     //form of a separately written license, or stated as exceptions;
411     //the above requirements apply either way.
412     //
413     // 8. Termination.
414     //
415     // You may not propagate or modify a covered work except as expressly
416     //provided under this License. Any attempt otherwise to propagate or
417     //modify it is void, and will automatically terminate your rights under
418     //this License (including any patent licenses granted under the third
419     //paragraph of section 11).
420     //
421     // However, if you cease all violation of this License, then your
422     //license from a particular copyright holder is reinstated (a)
423     //provisionally, unless and until the copyright holder explicitly and
424     //finally terminates your license, and (b) permanently, if the copyright
425     //holder fails to notify you of the violation by some reasonable means
426     //prior to 60 days after the cessation.
427     //
428     // Moreover, your license from a particular copyright holder is
429     //reinstated permanently if the copyright holder notifies you of the
430     //violation by some reasonable means, this is the first time you have
431     //received notice of violation of this License (for any work) from that
432     //copyright holder, and you cure the violation prior to 30 days after
433     //your receipt of the notice.
434     //
435     // Termination of your rights under this section does not terminate the
436     //licenses of parties who have received copies or rights from you under
437     //this License. If your rights have been terminated and not permanently
438     //reinstated, you do not qualify to receive new licenses for the same
439     //material under section 10.
440     //
441     // 9. Acceptance Not Required for Having Copies.
442     //
443     // You are not required to accept this License in order to receive or
444     //run a copy of the Program. Ancillary propagation of a covered work
445     //occurring solely as a consequence of using peer-to-peer transmission
446     //to receive a copy likewise does not require acceptance. However,
447     //nothing other than this License grants you permission to propagate or
448     //modify any covered work. These actions infringe copyright if you do
449     //not accept this License. Therefore, by modifying or propagating a
450     //covered work, you indicate your acceptance of this License to do so.
451     //
452     // 10. Automatic Licensing of Downstream Recipients.
453     //
454     // Each time you convey a covered work, the recipient automatically
455     //receives a license from the original licensors, to run, modify and
456     //propagate that work, subject to this License. You are not responsible
457     //for enforcing compliance by third parties with this License.
458     //
459     // An "entity transaction" is a transaction transferring control of an
460     //organization, or substantially all assets of one, or subdividing an
461     //organization, or merging organizations. If propagation of a covered
462     //work results from an entity transaction, each party to that
463     //transaction who receives a copy of the work also receives whatever
464     //licenses to the work the party's predecessor in interest had or could
465     //give under the previous paragraph, plus a right to possession of the
466     //Corresponding Source of the work from the predecessor in interest, if
467     //the predecessor has it or can get it with reasonable efforts.
468     //
469     // You may not impose any further restrictions on the exercise of the
470     //rights granted or affirmed under this License. For example, you may
471     //not impose a license fee, royalty, or other charge for exercise of
472     //rights granted under this License, and you may not initiate litigation
473     //(including a cross-claim or counterclaim in a lawsuit) alleging that
474     //any patent claim is infringed by making, using, selling, offering for
475     //sale, or importing the Program or any portion of it.
476     //
477     // 11. Patents.
478     //
479     // A "contributor" is a copyright holder who authorizes use under this
480     //License of the Program or a work on which the Program is based. The
481     //work thus licensed is called the contributor's "contributor version".
482     //
483     // A contributor's "essential patent claims" are all patent claims
484     //owned or controlled by the contributor, whether already acquired or
485     //hereafter acquired, that would be infringed by some manner, permitted
486     //by this License, of making, using, or selling its contributor version,
487     //but do not include claims that would be infringed only as a
488     //consequence of further modification of the contributor version. For
489     //purposes of this definition, "control" includes the right to grant
490     //patent sublicenses in a manner consistent with the requirements of
491     //this License.
492     //
493     // Each contributor grants you a non-exclusive, worldwide, royalty-free
494     //patent license under the contributor's essential patent claims, to
495     //make, use, sell, offer for sale, import and otherwise run, modify and
496     //propagate the contents of its contributor version.
497     //
498     // In the following three paragraphs, a "patent license" is any express
499     //agreement or commitment, however denominated, not to enforce a patent
500     //(such as an express permission to practice a patent or covenant not to
501     //sue for patent infringement). To "grant" such a patent license to a
502     //party means to make such an agreement or commitment not to enforce a
503     //patent against the party.
504     //
505     // If you convey a covered work, knowingly relying on a patent license,
506     //and the Corresponding Source of the work is not available for anyone
507     //to copy, free of charge and under the terms of this License, through a
508     //publicly available network server or other readily accessible means,
509     //then you must either (1) cause the Corresponding Source to be so
510     //available, or (2) arrange to deprive yourself of the benefit of the
511     //patent license for this particular work, or (3) arrange, in a manner
512     //consistent with the requirements of this License, to extend the patent
513     //license to downstream recipients. "Knowingly relying" means you have
514     //actual knowledge that, but for the patent license, your conveying the
515     //covered work in a country, or your recipient's use of the covered work
516     //in a country, would infringe one or more identifiable patents in that
517     //country that you have reason to believe are valid.
518     //
519     // If, pursuant to or in connection with a single transaction or
520     //arrangement, you convey, or propagate by procuring conveyance of, a
521     //covered work, and grant a patent license to some of the parties
522     //receiving the covered work authorizing them to use, propagate, modify
523     //or convey a specific copy of the covered work, then the patent license
524     //you grant is automatically extended to all recipients of the covered
525     //work and works based on it.
526     //
527     // A patent license is "discriminatory" if it does not include within
528     //the scope of its coverage, prohibits the exercise of, or is
529     //conditioned on the non-exercise of one or more of the rights that are
530     //specifically granted under this License. You may not convey a covered
531     //work if you are a party to an arrangement with a third party that is
532     //in the business of distributing software, under which you make payment
533     //to the third party based on the extent of your activity of conveying
534     //the work, and under which the third party grants, to any of the
535     //parties who would receive the covered work from you, a discriminatory
536     //patent license (a) in connection with copies of the covered work
537     //conveyed by you (or copies made from those copies), or (b) primarily
538     //for and in connection with specific products or compilations that
539     //contain the covered work, unless you entered into that arrangement,
540     //or that patent license was granted, prior to 28 March 2007.
541     //
542     // Nothing in this License shall be construed as excluding or limiting
543     //any implied license or other defenses to infringement that may
544     //otherwise be available to you under applicable patent law.
545     //
546     // 12. No Surrender of Others' Freedom.
547     //
548     // If conditions are imposed on you (whether by court order, agreement or
549     //otherwise) that contradict the conditions of this License, they do not
550     //excuse you from the conditions of this License. If you cannot convey a
551     //covered work so as to satisfy simultaneously your obligations under this
552     //License and any other pertinent obligations, then as a consequence you may
553     //not convey it at all. For example, if you agree to terms that obligate you
554     //to collect a royalty for further conveying from those to whom you convey
555     //the Program, the only way you could satisfy both those terms and this
556     //License would be to refrain entirely from conveying the Program.
557     //
558     // 13. Use with the GNU Affero General Public License.
559     //
560     // Notwithstanding any other provision of this License, you have
561     //permission to link or combine any covered work with a work licensed
562     //under version 3 of the GNU Affero General Public License into a single
563     //combined work, and to convey the resulting work. The terms of this
564     //License will continue to apply to the part which is the covered work,
565     //but the special requirements of the GNU Affero General Public License,
566     //section 13, concerning interaction through a network will apply to the
567     //combination as such.
568     //
569     // 14. Revised Versions of this License.
570     //
571     // The Free Software Foundation may publish revised and/or new versions of
572     //the GNU General Public License from time to time. Such new versions will
573     //be similar in spirit to the present version, but may differ in detail to
574     //address new problems or concerns.
575     //
576     // Each version is given a distinguishing version number. If the
577     //Program specifies that a certain numbered version of the GNU General
578     //Public License "or any later version" applies to it, you have the
579     //option of following the terms and conditions either of that numbered
580     //version or of any later version published by the Free Software
581     //Foundation. If the Program does not specify a version number of the
582     //GNU General Public License, you may choose any version ever published
583     //by the Free Software Foundation.
584     //
585     // If the Program specifies that a proxy can decide which future
586     //versions of the GNU General Public License can be used, that proxy's
587     //public statement of acceptance of a version permanently authorizes you
588     //to choose that version for the Program.
589     //
590     // Later license versions may give you additional or different
591     //permissions. However, no additional obligations are imposed on any
592     //author or copyright holder as a result of your choosing to follow a
593     //later version.
594     //
595     // 15. Disclaimer of Warranty.
596     //
597     // THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
598     //APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
599     //HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
600     //OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
601     //THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
602     //PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
603     //IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
604     //ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
605     //
606     // 16. Limitation of Liability.
607     //
608     // IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
609     //WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
610     //THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
611     //GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
612     //USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
613     //DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
614     //PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
615     //EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
616     //SUCH DAMAGES.
617     //
618     // 17. Interpretation of Sections 15 and 16.
619     //
620     // If the disclaimer of warranty and limitation of liability provided
621     //above cannot be given local legal effect according to their terms,
622     //reviewing courts shall apply local law that most closely approximates
623     //an absolute waiver of all civil liability in connection with the
624     //Program, unless a warranty or assumption of liability accompanies a
625     //copy of the Program in return for a fee.
626     //
627     // END OF TERMS AND CONDITIONS
628     //
629     // How to Apply These Terms to Your New Programs
630     //
631     // If you develop a new program, and you want it to be of the greatest
632     //possible use to the public, the best way to achieve this is to make it
633     //free software which everyone can redistribute and change under these terms.
634     //
635     // To do so, attach the following notices to the program. It is safest
636     //to attach them to the start of each source file to most effectively
637     //state the exclusion of warranty; and each file should have at least
638     //the "copyright" line and a pointer to where the full notice is found.
639     //
640     // <one line to give the program's name and a brief idea of what it does.>
641     // Copyright (C) <year> <name of author>
642     //
643     // This program is free software: you can redistribute it and/or modify
644     // it under the terms of the GNU General Public License as published by
645     // the Free Software Foundation, either version 3 of the License, or
646     // (at your option) any later version.
647     //
648     // This program is distributed in the hope that it will be useful,
649     // but WITHOUT ANY WARRANTY; without even the implied warranty of
650     // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
651     // GNU General Public License for more details.
652     //
653     // You should have received a copy of the GNU General Public License
654     // along with this program. If not, see <http://www.gnu.org/licenses/>.
655     //
656     //Also add information on how to contact you by electronic and paper mail.
657     //
658     // If the program does terminal interaction, make it output a short
659     //notice like this when it starts in an interactive mode:
660     //
661     // <program> Copyright (C) <year> <name of author>
662     // This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
663     // This is free software, and you are welcome to redistribute it
664     // under certain conditions; type `show c' for details.
665     //
666     //The hypothetical commands `show w' and `show c' should show the appropriate
667     //parts of the General Public License. Of course, your program's commands
668     //might be different; for a GUI interface, you would use an "about box".
669     //
670     // You should also get your employer (if you work as a programmer) or school,
671     //if any, to sign a "copyright disclaimer" for the program, if necessary.
672     //For more information on this, and how to apply and follow the GNU GPL, see
673     //<http://www.gnu.org/licenses/>.
674     //
675     // The GNU General Public License does not permit incorporating your program
676     //into proprietary programs. If your program is a subroutine library, you
677     //may consider it more useful to permit linking proprietary applications with
678     //the library. If this is what you want to do, use the GNU Lesser General
679     //Public License instead of this License. But first, please read
680     //<http://www.gnu.org/philosophy/why-not-lgpl.html>.
681     //-------------------------------------------------------------------------------------------------%
682     %\pagestyle{headings}
683     %
684     \usepackage{amsmath}
685     \usepackage{amsfonts}
686     \usepackage{amssymb}
687     \usepackage[ansinew]{inputenc}
688     \usepackage[OT1]{fontenc}
689     \usepackage{graphicx}
690     \usepackage{makeidx}
691     %
692     %-----------------------------------------------------------------------------------
693     %Constants
694     \newcommand{\productversion}{0.1a}
695     \newcommand{\productname}{scirfmmon}
696     \newcommand{\productnameemph}{\emph{\productname}}
697     \newcommand{\productcompiledate}{Jan 17 2009}
698     \newcommand{\productassertletter}{a}
699     \newcommand{\productversionhash}{63570560d4fd6dc71431d7bca67c8ff35c9fd1fe}
700     %-----------------------------------------------------------------------------------
701     %New environments
702     %The following environment is for the glossary of terms at the end, if
703     %included.
704     \newenvironment{docglossaryenum}{\begin{list}
705     {}{\setlength{\labelwidth}{0mm}
706     \setlength{\leftmargin}{4mm}
707     \setlength{\itemindent}{-4mm}
708     \setlength{\parsep}{0.85mm}}}
709     {\end{list}}
710     %%
711     %The following environment is for the database table and field
712     %documentation at the end, if included.
713     \newenvironment{docdbtblfielddef}{\begin{list}
714     {}{\setlength{\labelwidth}{0mm}
715     \setlength{\leftmargin}{10mm}
716     \setlength{\itemindent}{-5mm}
717     \setlength{\parsep}{0.85mm}}}
718     {\end{list}}
719     %%
720     %-----------------------------------------------------------------------------------
721     %Embarrassingly, I've forgotten why "makeindex" is necessary ...
722     \makeindex
723     %
724     \begin{document}
725     %-----------------------------------------------------------------------------------
726     %"See" References
727     %-----------------------------------------------------------------------------------
728     \title{\textbf{\huge{The \productnameemph{} Program, Version \productversion{}}\\\vspace*{0.7cm}
729     \normalsize{(\productcompiledate{}, \productassertletter{}, \productversionhash{})}}}
730     \author{\vspace*{3.0cm}\\%
731     \small{David T. Ashley (\texttt{dashley@gmail.com})}}
732     \date{\vspace*{3.5cm}\small{Document Version Control $ $Revision: 1.20 $ $ \\
733     Document Version Control $ $Date: 2009/01/17 22:17:01 $ $ (UTC) \\
734     Document $ $RCSfile: man20081211a.tex,v $ $ \\
735     Document \LaTeX{} Compilation Date: \today{}}}
736     \maketitle
737     \begin{abstract}
738     This document describes the \productnameemph{} program,
739     version \productversion{} (mnemonic: \emph{SCI} \emph{RF} \emph{m}odule
740     \emph{mon}itor). The \productnameemph{} program is a console-mode \emph{Win32} program
741     that monitors SCI communication between
742     a host microcontroller and the LS Research \emph{FreeStar Module}, analyzes character and
743     packet transmissions and exchanges, logs communication activity,
744     and outputs diagnostic information.
745     \\\\
746     This document also provides some information about a hardware configuration that will
747     work to interface the SCI lines of a host microcontroller to the
748     \productnameemph{} program running on a PC.
749     \\\\
750     The \productnameemph{} program and all related documentation
751     is provided under the GPL (GNU General
752     Public License).
753     \end{abstract}
754    
755     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
756     \clearpage{}
757     \pagenumbering{roman} %No page number on table of contents.
758     \tableofcontents{}
759     \clearpage{}
760     \listoffigures
761     \clearpage{}
762    
763     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
764     %Force the page number to 1. We don't want to count the TOC page(s) as a
765     %used-up number.
766     %
767     \setcounter{page}{1}
768     \pagenumbering{arabic}
769    
770     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
771     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
772     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
773     \section{Introduction and Overview}
774     \label{siov0}
775    
776    
777     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
778     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
780     \subsection{Overview of \productnameemph{}}
781     \label{siov0:sovw0}
782    
783     \index{\productname@\productnameemph{}}\productnameemph{} is a \emph{Win32} console-mode
784     application that:
785    
786     \begin{itemize}
787     \item Monitors the SCI traffic between one host system and one LS Research Freestar
788     Module.
789     (Because the traffic is bidirectional and full duplex, two serial adapters are
790     required.)
791     \item Logs and displays the characters transmitted between the host system and FreeStar Module.
792     \item Logs, displays, and analyzes the packets transmitted between each host system and FreeStar
793     Module, flagging any errors or anomalies.
794     \end{itemize}
795    
796     \productnameemph{} is designed so that:
797    
798     \begin{itemize}
799     \item It can use any serial ports that \emph{Windows} recognizes; including ports built into
800     the motherboard of a laptop
801     or desktop PC, bus expansion cards, and USB-to-serial adapters.
802     \end{itemize}
803    
804     \productnameemph{} is designed to run under
805     \index{Windows XP@\emph{Windows XP}}\emph{Windows XP}
806     and \index{Windows Vista@\emph{Windows Vista}}\emph{Windows Vista} only (although
807     it is possible that it will run under other versions of
808     \emph{Windows}).
809    
810    
811     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
812     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
813     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
814     \subsection{License}
815     \label{siov0:slic0}
816    
817     \index{license}The \productnameemph{} program and all related documentation
818     is provided under the \index{GPL}GPL (\index{GNU General Public License}%
819     GNU General Public
820     License) \cite{bibref:swlic:gpl}.
821    
822     The reason for the selection of the GPL is so that LSR and CEL can pass this solution
823     (including source code) on to customers without restrictions.
824    
825     The GPL does require that modifications to the program be made public. There
826     are several ways to meet this requirement, including:
827    
828     \begin{itemize}
829     \item The modified source code may be posted on a website (\emph{any} website).
830     \item The modified source code may be supplied to
831     Dave Ashley \cite{{bibref:i:daveashley}}, and Dave
832     may integrate the changes into the version control archives and re-release the
833     program.
834     \item The entity making the modifications may create a project at
835     \index{SourceForge@\emph{SourceForge}}\emph{SourceForge} \cite{bibref:osws:sourceforge}
836     or add the source code to an existing \emph{SourceForge} project.
837     \end{itemize}
838    
839     Dave Ashley \cite{bibref:i:daveashley} is the logical first contact for discussion
840     about how to make modified source code public.
841    
842    
843     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
844     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
845     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846     \subsection{Versioning of Executable Program}
847     \label{siov0:svin0}
848    
849     In the console output and at the start of log files, the
850     \productnameemph{} program writes a line similar to the following. This
851     line is a version identification line.
852     \\\\
853     \begin{footnotesize}
854     \noindent{}\texttt{scirfmmon, v0.1a (Jan 15 2009, A, 0132f11a686cd6efcb395cef23b2231106d5fd25)}\\
855     \end{footnotesize}
856    
857     The components of the version identification line are:
858    
859     \begin{itemize}
860     \item The program name (``\texttt{scirfmmon}'').
861     \item The version number (``\texttt{v0.1a}'').
862     \item The compile date (``\texttt{Jan 15, 2009}'').
863     \item Whether or not debugging assertions are enabled (``\texttt{A}''). (``\texttt{A}''
864     indicates that debugging assertions are enabled, whereas ``\texttt{a}''
865     would indicate that debugging assertions are disabled.)
866     \item A hash (``\texttt{0132f11a686cd6efcb395cef23b2231106d5fd25}'')
867     calculated as a function
868     of the version control information and compile date/time
869     information as known to the compiler and embedded in the software source files.
870     (The purpose of the hash is to decisively identify different compilations of the
871     program that unwisely have the same version number. Compilation at a different date or time
872     or using a different version control revision
873     of a source file will
874     result in a different hash.)
875     \end{itemize}
876    
877    
878     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
879     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
880     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
881     \subsection{Revision History}
882     \label{siov0:srhs0}
883    
884     \begin{itemize}
885     \item \textbf{0.1a, January 17, 2009, a,\\
886     63570560d4fd6dc71431d7bca67c8ff35c9fd1fe}\\
887     Initial release. No known defects other than documented in
888     \S{}\ref{skli0}.
889     \end{itemize}
890    
891     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
892     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
893     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
894     \section{Software Design and Theory of Operation}
895     \label{sswd0}
896    
897    
898     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
899     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
900     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
901     \subsection{General Theory of Operation}
902     \label{sswd0:sgto0}
903    
904     The general theory of operation of the \productnameemph{}
905     program is that:
906    
907     \begin{itemize}
908     \item Each serial interface to the target system is
909     2-wire only (ground and received data)\@. Data is not
910     transmitted by \productnameemph{}
911     (it is only received). Neither hardware nor software
912     handshaking
913     is used.
914     \item The program uses exactly three threads:
915     \begin{itemize}
916     \item Two identical communication worker threads (one for each serial
917     port)\@. These threads each:
918     \begin{itemize}
919     \item Poll a single serial port using the
920     \emph{Windows} serial API.
921     \item Place received characters and events (serial
922     break, several types of errors) into a queue. There is
923     a separate queue for each serial port.
924     \item Separately timestamp received characters and events\@. (Because
925     of thread scheduling latencies and for other reasons,
926     this means that it is difficult to determine
927     exact timing relationships between characters arriving on
928     \emph{different} serial ports.)
929     \end{itemize}
930     \item The primary thread which:
931     \begin{itemize}
932     \item Accepts input from the two communication worker threads
933     via two queues of events.\footnote{Not related to the
934     \emph{Windows} notion of events.} (Received characters
935     as well as detected
936     serial communcation errors are events.)
937     \item Duplicates (or ``fans out'') queued events into other queues.
938     (There is a
939     separate queue for event logging, and a separate queue for
940     packet analysis,
941     for example).
942     \item Processes and parses events, characters, and packets.
943     \item Writes information to several log files, created automatically in
944     the working directory whenever the program is invoked.
945     \item Writes information to the standard output (usually the console).
946     \item Accepts CTRL-C as a termination signal and gracefully stops the
947     communication worker threads as part of the termination sequence.
948     \end{itemize}
949     \end{itemize}
950     \item Because of IPC issues between threads, there is some care taken
951     in the way that the communication worker threads and the
952     primary thread share queues (\S{}\ref{sswd0:sqip0}).
953     \end{itemize}
954    
955    
956     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
957     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
958     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
959     \subsection{Serial Communication Theory of Operation}
960     \label{sswd0:ssct0}
961    
962     The most helpful online information about the \emph{Win32} serial
963     communication API is \cite{bibref:twp:ms810467}. \cite{bibref:twp:ms810467}
964     describes
965     both nonoverlapped and overlapped I/O.
966    
967     For simplicity, the \productnameemph{} uses exclusively nonoverlapped
968     I/O\@. Within each communcation worker thread (\texttt{cw\_threads.c}), the
969     \emph{ClearCommError()} function is called repeatedly
970     to obtain the number of characters available. If characters are available,
971     the precise number of available characters is requested via the
972     \emph{ReadFile()} call. If no characters are available,
973     one character is requested via the \emph{ReadFile()} call, forcing
974     the \emph{ReadFile()} call to either time out or return immediately
975     when at least one character becomes available.
976    
977    
978     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
979     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
980     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
981     \subsection{Queueing and IPC Theory of Operation}
982     \label{sswd0:sqip0}
983    
984     The bulk of \productnameemph{} is ordinary C programming with no IPC
985     considerations. Queues of timestamped events are carried through the program, where
986     an event is either a received character, a serial communication error (such
987     as a parity error), or a serial communication event (such as a received
988     \emph{break}).
989    
990     In the shared data structures between the communication worker threads
991     and the primary thread, however, IPC issues do exist. The way these
992     IPC issues are handled is described in this section.
993    
994     The \emph{Win32} API is incompletely documented, so the
995     \emph{EnterCriticalSection()} and \emph{LeaveCriticalSection()}
996     functions were evaluated to determine their underlying behavior
997     (\texttt{thread\_test.c}).
998     It was determined that these functions won't necessarily allow threads
999     to enter critical sections in the same order that entry is attempted.
1000     Under the right conditions where there is accidental synchronization between thread
1001     scheduling, this could lead to deadlock (although it is improbable)\@.
1002     For this reason, \emph{EnterCriticalSection()} and \emph{LeaveCriticalSection()}
1003     were not used to handle the IPC issues in sharing a queue between the
1004     communication worker threads and the primary thread.
1005    
1006     The \emph{Win32} documentation indicates that reads and writes to
1007     a 32-bit integer are always atomic, so the following simple mechanism
1008     was used to share data between the communication worker threads and the
1009     primary thread. The details of the mechanism (per queue) are:
1010    
1011     \begin{itemize}
1012     \item Each communication worker thread has a 32-bit variable reserved to
1013     indicate whether the communication worker thread or the primary thread
1014     is allowed to access the shared queue.
1015     \begin{itemize}
1016     \item The value of zero indicates that the communication worker thread
1017     is allowed to place characters into the queue. (After placing
1018     characters into the queue, the communication worker thread should
1019     change the value of the variable to a non-zero value.)
1020     \item A non-zero value indicates that the primary thread is allowed
1021     to consume characters from the queue. (After removing characters
1022     from the queue, the primary thread should change the value of the
1023     variable to zero.)
1024     \end{itemize}
1025     \item The mechanism is safe because in all threads a test is done
1026     before the assignment. The communication worker thread
1027     will change the value of the variable only if it is zero, and
1028     the primary thread will change the value of the variable only
1029     if it is non-zero.
1030     \end{itemize}
1031    
1032     \begin{figure}
1033     \centering
1034     \begin{small}
1035     \begin{verbatim}
1036     //Try to move the characters from the
1037     //intermediate queue to the thread synchronization
1038     //queue. The thread synchronization queue is a
1039     //shared resource, so there is a protocol.
1040     //
1041     if (inceq.n != 0)
1042     {
1043     if (C_MAIN_TsQueueSyncSemaphore0 == 0) //Belongs to worker thread.
1044     {
1045     QCHAR_inceq_tsceq_transfer(&inceq, &C_MAIN_tsceq0);
1046     C_MAIN_TsQueueSyncSemaphore0 = 1; //Belongs to primary thread.
1047     }
1048     }
1049     \end{verbatim}
1050     \end{small}
1051     \caption{Communication Worker Thread Source Code to Safely Share Event Queue With Primary
1052     Thread}
1053     \label{fig:sswd0:sqip0:01}
1054     \end{figure}
1055    
1056     \begin{figure}
1057     \centering
1058     \begin{small}
1059     \begin{verbatim}
1060     //The transfer out of the TSCEQs has to be coordinated with the worker,
1061     //threads, hence the use of the semaphore variables. Without
1062     //coordination, bizarre effects could result with interleaving of
1063     //access.
1064     //
1065     if (C_MAIN_TsQueueSyncSemaphore0 != 0) //Belongs to primary thread.
1066     {
1067     QCHAR_tsceq_ptceq_transfer(&C_MAIN_tsceq0, &C_MAIN_ptceq0);
1068     C_MAIN_TsQueueSyncSemaphore0 = 0; //Belongs to worker thread.
1069     }
1070     if (C_MAIN_TsQueueSyncSemaphore1 != 0) //Belongs to primary thread.
1071     {
1072     QCHAR_tsceq_ptceq_transfer(&C_MAIN_tsceq1, &C_MAIN_ptceq1);
1073     C_MAIN_TsQueueSyncSemaphore1 = 0; //Belongs to worker thread.
1074     }
1075     \end{verbatim}
1076     \end{small}
1077     \caption{Primary Thread Source Code to Safely Share Event Queue With
1078     Communication Worker Threads}
1079     \label{fig:sswd0:sqip0:02}
1080     \end{figure}
1081    
1082     Figure \ref{fig:sswd0:sqip0:01} (p. \pageref{fig:sswd0:sqip0:01}) shows
1083     the code in a communication worker thread to protect access to the
1084     shared queue; and Figure \ref{fig:sswd0:sqip0:02}
1085     (p. \pageref{fig:sswd0:sqip0:02}) shows the analogous code in the
1086     primary thread.
1087    
1088     The protocol used for the shared queues (\texttt{C\_MAIN\_tsceq0}
1089     and \texttt{C\_MAIN\_tsceq1} in Figures \ref{fig:sswd0:sqip0:01}
1090     and \ref{fig:sswd0:sqip0:02}) implies (due to thread scheduling
1091     uncertainties) that the shared queues may be unavailable to the
1092     communication worker threads for an unknown period of time once
1093     the coordination variable is assigned to a non-zero value.
1094     For this reason, each communication worker thread keeps an internal
1095     queue to hold received characters until they can be transferred to the
1096     shared queue. The primary thread also keeps queues
1097     (\texttt{C\_MAIN\_ptceq0} and \texttt{C\_MAIN\_ptceq1} in
1098     Figure \ref{fig:sswd0:sqip0:02}) so that the shared queues can be
1099     evacuated quickly and fully. The only queues in the
1100     \productnameemph{} program
1101     shared between threads and subject to special
1102     access protocols are \texttt{C\_MAIN\_tsceq0}
1103     and \texttt{C\_MAIN\_tsceq1}.
1104    
1105    
1106     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1107     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1108     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1109     \section{Hardware Setup}
1110     \label{shsu0}
1111    
1112    
1113     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1114     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1116     \subsection{Hardware Requirements}
1117     \label{shsu0:shrq0}
1118    
1119     The \productnameemph{} program uses the serial commication API of \emph{Windows}, so any
1120     serial port recognized by \emph{Windows} should be satisfactory. Two serial interfaces
1121     are required. \productnameemph{}
1122     should work with any mixture of the following types of serial interfaces:
1123    
1124     \begin{itemize}
1125     \item A serial port built into the motherboard of a computer.
1126     \item A serial port installed as a bus expansion card.
1127     \item A serial port interfaced via a USB-to-serial adapter.
1128     \end{itemize}
1129    
1130     The interface required to the personal computer is 2-wire only: ground and
1131     received data. The \productnameemph{} program does not transmit data or
1132     use hardware or software flow control (it only monitors serial traffic).
1133    
1134     Generally, some electronics are required to interface the serial lines of the
1135     host microcontroller system to a PC, as the RS-232
1136     interface nominally requires 12-volt signals. It is likely that serial adapters
1137     exist that will work at TTL logic levels (negating the need for
1138     interface electronics), but this possibility was not
1139     investigated.
1140    
1141    
1142     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1143     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1144     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1145     \subsection{Description of a Possible Interface Hardware Configuration}
1146     \label{shsu0:sdph0}
1147    
1148     This section describes in detail a hardware configuration that is known to work
1149     for interfacing from a host microcontroller to a personal computer.
1150     The hardware configuration described is certainly not unique.
1151    
1152     Note that the interface hardware as described has some limitations.
1153     Please see \S{}\ref{skli0:sdap0}, \S{}\ref{skli0:sgoi0}, and
1154     \S{}\ref{skli0:ssud0}.
1155    
1156     The serial adapters used were the \index{Dynex}Dynex \cite{bibref:vendor:dynex}
1157     ``\emph{16-Inch USB PDA/Serial Adapter Cable}'', model \index{DX-UBDB9}DX-UBDB9.
1158     There was no particular reason for choosing this model except availability:
1159     it was on the shelves at \emph{Best Buy} for about \$35.\footnote{\$35 each---two
1160     will cost approximately \$70.} These adapters are shown most clearly in
1161     Figure \ref{fig:shsu0:sdph0:06}. As of January, 2009 these adapters have been
1162     discontinued, but there are other similar adapters available from several
1163     manufacturers.
1164    
1165     \begin{figure}
1166     \centering
1167     \includegraphics[width=4.6in]{etminia.eps}
1168     \caption{ET-MINI RS-232 Level Translator, With U.S. Quarter for Size Scale}
1169     \label{fig:shsu0:sdph0:01}
1170     \end{figure}
1171    
1172     In order to shift the SCI levels for input into a PC serial adapter,
1173     the ``\emph{RS232 to TTL-3V Converter Mini Board}'' (Figure \ref{fig:shsu0:sdph0:01})
1174     was purchased from \index{Futurelec}Futurelec \cite{bibref:vendor:futurelec}.
1175     (\emph{Note:} \index{Futurelec}Futurelec took a few weeks to deliver the interface boards,
1176     despite the fact that I specified overnight shipping.
1177     If time is critical, I recommend ordering a similar product from another
1178     vendor or building a board from scratch using the ADM3232 or similar.)
1179    
1180     \begin{figure}
1181     \centering
1182     \includegraphics[width=4.6in]{rs232transinnera.eps}
1183     \caption{RS-232 Level Translator Box Inside View}
1184     \label{fig:shsu0:sdph0:02}
1185     \end{figure}
1186    
1187     The RS-232 converter board was packaged inside a project box
1188     (purchased from \index{Radio Shack}Radio Shack). The
1189     converter board was affixed with standoffs to the back of the top
1190     panel (Figure \ref{fig:shsu0:sdph0:02}).
1191    
1192     \begin{figure}
1193     \centering
1194     \includegraphics[width=4.6in]{rs232transtopa.eps}
1195     \caption{RS-232 Level Translator Box Top View}
1196     \label{fig:shsu0:sdph0:03}
1197     \end{figure}
1198    
1199     The RS-232 level translator was equipped with batteries, a power switch,
1200     a battery test feature,
1201     and the necessary connections (Figure \ref{fig:shsu0:sdph0:03}).
1202    
1203     \begin{figure}
1204     \centering
1205     \includegraphics[width=4.6in]{rs232transdesktopa.eps}
1206     \caption{RS-232 Level Translator Box In Use On Desktop}
1207     \label{fig:shsu0:sdph0:04}
1208     \end{figure}
1209    
1210     \begin{figure}
1211     \centering
1212     \includegraphics[width=4.6in]{rs232transmicroconnecta.eps}
1213     \caption{RS-232 Level Translator Box Microcontroller Product Connection}
1214     \label{fig:shsu0:sdph0:05}
1215     \end{figure}
1216    
1217     \begin{figure}
1218     \centering
1219     \includegraphics[width=4.6in]{rs232transpcconnecta.eps}
1220     \caption{RS-232 Level Translator Box PC Connection}
1221     \label{fig:shsu0:sdph0:06}
1222     \end{figure}
1223    
1224     Figure \ref{fig:shsu0:sdph0:04} shows the level translator in use with a laptop computer.
1225     Figure \ref{fig:shsu0:sdph0:05} shows the connection of the level translator to a
1226     microcontroller product (phono jacks were used).
1227     Figure \ref{fig:shsu0:sdph0:06} shows the connection of the level translator
1228     to a laptop computer.
1229    
1230    
1231     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1232     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1233     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1234     \section{Program Usage}
1235     \label{susg0}
1236    
1237    
1238     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1239     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1240     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1241     \subsection{Finding Device Names of PC Serial Ports}
1242     \label{susg0:sfdn0}
1243    
1244     Before invoking the \productnameemph{} program, the device names of
1245     the two personal computer serial ports that will be used
1246     to monitor SCI communication must be known.
1247    
1248     \begin{figure}
1249     \centering
1250     \includegraphics[width=4.6in]{devmancomassignmentsa.eps}
1251     \caption{Screen Snapshot From \emph{Windows} Device Manager
1252     (\emph{Windows Vista})}
1253     \label{fig:susg0:sfdn0:01}
1254     \end{figure}
1255    
1256     Guessing the serial device names is not always possible, especially with USB adapters,
1257     where the port numbers assigned may be $>10$ and may change when the USB adapter
1258     is disconnected and reconnected to the computer.
1259    
1260     The device names can typically be found by opening the \emph{Device Manager} (typically
1261     under \emph{System} in the \emph{Windows} control panel). (Naturally, the
1262     devices must be plugged in if they are removable and the correct drivers
1263     must be installed.)
1264    
1265     Figure \ref{fig:susg0:sfdn0:01} is a screen snapshot from the \emph{Device Manager}
1266     under \emph{Windows Vista}. Under \emph{Ports (COM \& LPT)} it can be seen
1267     in this figure that the device names are ``COM12'' and ``COM13''.
1268    
1269    
1270     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1271     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1272     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1273     \subsection{Testing and Troubleshooting Serial Ports}
1274     \label{susg0:stts0}
1275    
1276     For testing and troubleshooting, it was found that
1277     \index{Realterm@\emph{RealTerm}}\emph{RealTerm} \cite{bibref:swp:realterm}
1278     (free open-source software) works very well for displaying the
1279     characters received by a serial port.
1280     \index{Realterm@\emph{RealTerm}}\emph{RealTerm} is able to display all
1281     received characters in hexadecimal, which is very helpful.
1282    
1283     \begin{figure}
1284     \centering
1285     \includegraphics[width=4.6in]{rtermsnapshot01.eps}
1286     \caption{\emph{RealTerm} Screen Snapshot (Hexadecimal Display Selected)}
1287     \label{fig:susg0:stts0:01}
1288     \end{figure}
1289    
1290     Figure \ref{fig:susg0:stts0:01} is a screen snapshot of
1291     \index{Realterm@\emph{RealTerm}}\emph{RealTerm} being used
1292     to capture data.
1293    
1294     \index{HyperTerminal@\emph{HyperTerminal}}\emph{HyperTerminal} (the default
1295     serial communcation program in many versions of \emph{Windows})
1296     is not recommended because of bugs involving bit 7 of incoming characters
1297     (and perhaps other bugs as well).
1298    
1299    
1300     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1301     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1302     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1303     \subsection{Program Invocation and Command-Line Parameters}
1304     \label{susg0:spin0}
1305    
1306     \productnameemph{} is typically invoked by opening a DOS shell and
1307     typing ``\texttt{\productname{}} \emph{ch0commport}
1308     \emph{ch1commport} \emph{logcharstocon} \emph{logpacketstocon}'' (where
1309     the four required parameters are described in detail below),
1310     followed by \emph{ENTER}. Because the program creates the log files
1311     (\S{}\ref{susg0:slgf0}) in the current working directory, the desired
1312     working directory is normally selected before invoking the program.
1313    
1314     It is likely possible to invoke the program via the \emph{Windows} GUI,
1315     but this has not been explored.
1316    
1317     \productnameemph{} requires the following four command-line parameters:
1318    
1319     \begin{itemize}
1320     \item \emph{ch0commport}\\
1321     \emph{ch1commport}\\
1322     These two parameters are the serial port names
1323     of the communication ports to be used.
1324    
1325     By convention, Channel 0 (\emph{ch0commport} above) is the serial communication
1326     from the host microcontroller to the RF module, and Channel 1
1327     (\emph{ch1commport} above) is the
1328     serial communication from the RF module to the host microcontroller.
1329    
1330     For example, with the communication hardware implied by
1331     Figure \ref{fig:susg0:sfdn0:01}, invoking the program using the
1332     command line\\\\
1333     \texttt{\productname{} com12 com13 n n}\\\\
1334     would result in the program expecting to listen to the output from
1335     the host microcontroller on \emph{com12} and the output from the
1336     RF module on \emph{com13}.
1337     \item \emph{logcharstocon}\\
1338     \emph{logpacketstocon}\\
1339     Whether to log received characters and received packets, respectively,
1340     to the console (in addition to logging them to the
1341     character and packet log files).
1342    
1343     The normal guesses for \emph{yes} and \emph{no}
1344     (``y'', ``1'', ``n'', ``0'', etc.) are all accepted.
1345    
1346     Errors are \emph{always} displayed on the console (as well as written to
1347     the alert log
1348     file).
1349     \end{itemize}
1350    
1351    
1352     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1353     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1354     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1355     \subsection{Program Termination}
1356     \label{susg0:sptm0}
1357    
1358     The \productnameemph{} program can be terminated by using CTRL-C. Using
1359     CTRL-C once will signal the program to terminate the communication threads
1360     in an orderly way, write trailing information to log files, and terminate.
1361     Termination may take up to approximately 5 seconds.
1362    
1363     The program will also terminate upon a variety of abnormal conditions,
1364     such as unexpected errors from \emph{Win32} API functions.
1365    
1366    
1367     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1368     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1369     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1370     \subsection{Log Files}
1371     \label{susg0:slgf0}
1372    
1373     When started, the \productnameemph{} program creates several log files in
1374     the current working directory. All of the created log files are
1375     plain text and can be viewed, manipulated, and printed
1376     using a text editor. This section describes these files.
1377    
1378    
1379     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1380     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1381     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1382     \subsubsection{Log File Creation, Naming, and Syntax}
1383     \label{susg0:slgf0:sfcn0}
1384    
1385     Log files are named based on the local date and time in
1386     YYYYMMDD\_HHMMSS format. For example, a log file named
1387     ``\texttt{20090116\_131247\_alert.txt}'' was created at
1388     approximately 1:12 p.m. on January 16, 2009 (local time).
1389    
1390     When started, \productnameemph{} creates an alert log file (containing error
1391     messages), a character log file (containing a log of received characters,
1392     serial events, and serial errors), a packet log file (containing
1393     information about parsed packets), and a comprehensive log file
1394     (containing all log entries to any file).
1395    
1396     Additionally, messages are written to the console (\S{}\ref{susg0:spin0}).
1397    
1398     The naming convention for log files means that \productnameemph{}
1399     can be run repeatedly in the same directory and the log file names will
1400     not conflict.
1401    
1402     A typical set of log file names from a single invocation of
1403     \productnameemph{} is:
1404    
1405     \begin{verbatim}
1406     20090116_131247_alert.txt
1407     20090116_131247_character.txt
1408     20090116_131247_comprehensive.txt
1409     20090116_131247_packet.txt
1410     \end{verbatim}
1411    
1412     Within each log file, entries are timestamped in HHMMSS.FFF format,
1413     where ``FFF'' is the fractional portion of the second.
1414    
1415    
1416     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1417     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1419     \subsubsection{Alert Log File Contents}
1420     \label{susg0:slgf0:salf0}
1421    
1422     The alert log file contains entries that indicate some sort of
1423     unusual event or logical problem. The purpose of the alert log
1424     file is to segregate error messages so that the other log files
1425     do not have to be searched for error messages. Generally, an
1426     empty alert log file indicates no problems in SCI communication.
1427    
1428     Typical entries from the alert log file are:
1429    
1430     \begin{small}
1431     \begin{verbatim}
1432     131247.848:ALRT: CH01:Non-packet start event discarded: Character: 0x57.
1433     131247.848:ALRT: CH01:Non-packet start event discarded: Character: 0xFF.
1434     \end{verbatim}
1435     \end{small}
1436    
1437     Note that:
1438    
1439     \begin{itemize}
1440     \item All alert messages are also duplicated to the console.
1441     \item Alert messages are usually also duplicated to the log files(s)
1442     where the messages have relevance. For example, the packet parse errors
1443     reproduced above would also be placed in the packet log file.
1444     \end{itemize}
1445    
1446    
1447     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1448     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1449     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1450     \subsubsection{Character Log File Contents}
1451     \label{susg0:slgf0:sclf0}
1452    
1453     The character log file contains a complete log of received characters,
1454     serial events, and serial errors.
1455    
1456     Typical entries from the character log file are:
1457    
1458     \begin{footnotesize}
1459     \begin{verbatim}
1460     131247.848:NORM: CH00:<01><12><14><3A><11><00><04><B1><BB><D4><60><00><40><40>
1461     131247.848:NORM: CH00:<01><1D><B4><04>
1462     131247.879:NORM: CH00:<01><12><14><3B><11><00><04><B1><BB><D4><60>
1463     131247.848:NORM: CH01:<57><FF><01><08><94><3A><01><00><D8><04>
1464     131247.864:NORM: CH01:<01><15><95><41><11><D4><00><16><E6><04><B1><AA><EE><02>
1465     131247.864:NORM: CH01:<01>
1466     \end{verbatim}
1467     \end{footnotesize}
1468    
1469     Note in the text above
1470     that the log entries between channels are slightly out of chronological order.
1471     Please see \S{}\ref{skli0:sooc0}.
1472    
1473    
1474     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1475     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1476     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1477     \subsubsection{Packet Log File Contents}
1478     \label{susg0:slgf0:splf0}
1479    
1480     The packet log file contains the parsed packets from the two communication channels.
1481    
1482     Typical entries from the packet log file are:
1483    
1484     \begin{footnotesize}
1485     \begin{verbatim}
1486     131455.144:NORM: CH01:ACK_SEND_DATA (0x94).
1487     131455.144:NORM: cspan=16, mdelta=109.
1488     131455.144:NORM: <01><08><94>
1489     131455.144:NORM: <6D><01><00>
1490     131455.144:NORM: <0B><04>
1491     131455.144:NORM: PACKET_ID: 0x6D, ACK_NACK: 0x01, NUM_RETRIES: 0x00.
1492     131455.129:NORM: CH00:SEND_DATA (0x14).
1493     131455.129:NORM: cspan=15, mdelta=110.
1494     131455.129:NORM: <01><12><14>
1495     131455.129:NORM: <6D><11><00><04><B1><BB><D4><70><00><40><73><01><1D>
1496     131455.129:NORM: <2A><04>
1497     131455.129:NORM: PACKET_ID: 0x6D, TARGET_SENDER: 0x11, ADDRESS_MODE: 0x00.
1498     131455.129:NORM: DST_TRANS_AD: 0xB104.
1499     131455.129:NORM: DATA:
1500     131455.129:NORM: <BB><D4><70><00><40><73><01><1D>
1501     131455.238:NORM: CH01:RXED_DATA (0x95).
1502     131455.238:NORM: cspan=15, mdelta=125.
1503     131455.238:NORM: <01><15><95>
1504     131455.238:NORM: <74><11><E4><00><16><E6><04><B1><AA><E7><02><01><80><6D>
1505     131455.238:NORM: <7E><FF>
1506     131455.238:NORM: <C3><04>
1507     131455.238:NORM: PACKET_ID: 0x74, TARGET_SENDER: 0x11, LQI: 0xE4.
1508     131455.238:NORM: ADDRESS_MODE: 0x00.
1509     131455.238:NORM: DST_TRANS_AD: 0xE616, SRC_TRANS_AD: 0xB104.
1510     131455.238:NORM: DATA:
1511     131455.238:NORM: <AA><E7><02><01><80><6D><7E><FF>
1512     \end{verbatim}
1513     \end{footnotesize}
1514    
1515     Each parsed packet is documented as:
1516    
1517     \begin{itemize}
1518     \item The channel and packet type.
1519     \item The approximate time span between the first and last
1520     characters of the packet, in milliseconds (``\emph{cspan}'').
1521     A large value of \emph{cspan} would indicate some sort of
1522     a software error in transmitting the packet.
1523     \item The approximate time since the last packet of this type
1524     was received (``\emph{mdelta}'').
1525     \item The raw bytes of the packet, grouped by header, payload,
1526     and trailer.
1527     \item The extracted data (symbolically) from the packet.
1528     \end{itemize}
1529    
1530     Note in the text above that the packet entries are sometimes
1531     chronologically out of order between the two channels
1532     (see \S{}\ref{skli0:soop0}).
1533    
1534    
1535     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1536     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1537     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1538     \subsubsection{Comprehensive Log File Contents}
1539     \label{susg0:slgf0:shlf0}
1540    
1541     Each entry written to any other log file is also written to the
1542     comprehensive log. The comprehensive log is simply an interleaved concatenation
1543     of the alert, character, and packet log files.
1544    
1545    
1546     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1547     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1548     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1549     \subsubsection{Concurrent Access to Log Files Using a Text Editor}
1550     \label{susg0:slgf0:scat0}
1551    
1552     As the \productnameemph{} program may run for days or weeks at a time,
1553     it is useful to examine the log files (especially the alert log) before
1554     the program has terminated.
1555    
1556     \productnameemph{} opens the log files in a mode compatible with sharing,
1557     so they can be safely viewed read-only with a text editor while the program
1558     is running.
1559    
1560     Please see \S{}\ref{skli0:sndf0}.
1561    
1562    
1563     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1565     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1566     \section{Known Issues and Limitations}
1567     \label{skli0}
1568    
1569     This section describes known issues and limitations with the
1570     \productnameemph{} program or the hardware configuration
1571     described in \S{}\ref{shsu0:sdph0}.
1572    
1573    
1574     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1575     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1576     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1577     \subsection{Possible Destruction of the ADM3232 Part}
1578     \label{skli0:sdap0}
1579    
1580     The level conversion board used is designed to be powered from the same power supply
1581     as the microcontroller.
1582    
1583     It is suspected that as the batteries discharge, the TTL
1584     SCI inputs from a product may
1585     damage the \index{ADM3232}ADM3232 part (as the
1586     inputs may be more than a diode drop above the
1587     supply voltage provided by the batteries).
1588    
1589     In retrospect, rather than using 3 AA
1590     batteries in series (4.5 volts),
1591     it would have been more prudent to use
1592     4 AA batteries in series (6.0 volts)
1593     with a forward-biased diode to bring the supply
1594     voltage down to about 5.4 volts.
1595    
1596     A resistor in series with the SCI inputs
1597     (not included in the first version
1598     of the SCI interface box) may also be prudent.
1599    
1600    
1601     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1602     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1603     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1604     \subsection{Ground Offset Issues}
1605     \label{skli0:sgoi0}
1606    
1607     It was observed that the hardware interface box
1608     (\S{}\ref{shsu0:sdph0}, p. \pageref{shsu0:sdph0})
1609     works perfectly when using a laptop computer, but
1610     less reliably when using a desktop computer.
1611    
1612     When the interface box fails to operate, the problem can usually
1613     be cured by disconnecting and then reconnecting the serial cables
1614     to the PC and/or the SCI connections to the microcontroller product.
1615    
1616     A ground offset issue involving the power supply and the PC
1617     is suspected.
1618    
1619    
1620     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1621     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1622     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1623     \subsection{Startup Difficulties}
1624     \label{skli0:ssud0}
1625    
1626     The \productnameemph{} may not start reliably in the presence of serial
1627     errors or events (such as a break event on the serial line, typically
1628     caused by the target module being turned off but the interface box being turned
1629     on).
1630     A typical error message involves inability to
1631     obtain serial port state or configure the port.
1632    
1633     To get \productnameemph{} to start, remove the serial error, start the
1634     program, then reapply the source of the errors. The two easiest approaches
1635     are:
1636    
1637     \begin{itemize}
1638     \item Disconnect the serial cables from the serial adapters, start the program,
1639     then reconnect the cables.
1640     \item Turn off the interface box, start the program, then turn on the interface box.
1641     \item Power up everything (including the target product) before starting the
1642     program.
1643     \end{itemize}
1644    
1645     The root cause is that the serial errors cause (by design) certain
1646     \emph{Windows} API functions not to operate until the error is cleared using
1647     another \emph{Windows} API function. The present version of the program will
1648     correctly handle serial errors at any time except startup.
1649    
1650     This is a very minor issue and does not affect the logical correctness
1651     of the program once it is running.
1652    
1653    
1654     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1655     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1656     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1657     \subsection{Inability to Determine Timing Relationships Between Channels}
1658     \label{skli0:itr0}
1659    
1660     The three-thread software design may lead to more timestamp inconsistency
1661     between the two channels than necessary. If possible, the design should probably
1662     be changed to two threads and overlapped I/O.
1663    
1664     The timestamps have, however, proved to be very accurate.
1665    
1666    
1667     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1668     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1669     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1670     \subsection{Out-of-Order Character Logging}
1671     \label{skli0:sooc0}
1672    
1673     The primary thread dequeues and processes all characters from
1674     Channel 0, then dequeues and processes all characters from Channel 1;
1675     regardless of the chronological ordering of the characters between the
1676     channels.
1677     This can result in characters being logged out of chronological order if
1678     characters are arriving on both channels nearly simultaneously.
1679    
1680     This problem can be easily fixed by changing the character logging
1681     algorithm to dequeue the characters in chronological order with respect
1682     to
1683     both queues.
1684    
1685     This problem does not affect the correctness of the timestamps in the
1686     character log file. It only affects the ordering of the log
1687     entries. Please see the sample log file text in
1688     \S{}\ref{susg0:slgf0:sclf0}, p. \pageref{susg0:slgf0:sclf0}.
1689    
1690    
1691     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1692     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1693     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1694     \subsection{Out-of-Order Packet Logging}
1695     \label{skli0:soop0}
1696    
1697     The packet logging issue occurs for exactly the same reasons as the
1698     character logging issue discussed in
1699     \S{}\ref{skli0:sooc0}. The solution is analogous---to modify the
1700     packet logging algorithm to process both queues simultaneously and
1701     log packets in chronological order.
1702    
1703     The sample text in \S{}\ref{susg0:slgf0:splf0}, p. \pageref{susg0:slgf0:splf0}
1704     illustrates the issue. The SEND\_DATA packet is sent at 131455.129 and it is
1705     followed by the ACK\_SEND\_DATA packet at 131455.144; but the log entries are
1706     not in chronological order.
1707    
1708     This issue does not affect the correctness of the log entries---only their
1709     ordering.
1710    
1711    
1712     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1713     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1714     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1715     \subsection{Suspected Out of Sequence Communication Errors}
1716     \label{skli0:sose0}
1717    
1718     It is suspected that framing errors and other errors become events
1719     that are reported out of sequence by the communication worker threads.
1720     The root cause is that communication errors may occur with characters
1721     buffered behind the \emph{Windows} API.
1722    
1723     The \productnameemph{} program handles errors first, then dequeues any characters;
1724     although the characters probably came first, followed by the error.
1725    
1726     The problem can be fixed by experimenting to determine the behavior of
1727     \emph{Windows} and then changing the communication worker threads to match.
1728    
1729     This issue is inconsequential because any communication error
1730     (break, framing error, overrun, etc.) is very serious if it occurs
1731     once the target product is operating, and exactly when it occurred is
1732     less important than that it did occur.
1733    
1734     The errors will be detected,
1735     but they may
1736     be slightly out of sequence in the event queue.
1737    
1738    
1739     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1740     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1741     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1742     \subsection{Non-Detection of Log File Flushes}
1743     \label{skli0:sndf0}
1744    
1745     \productnameemph{} flushes the log file streams every 15 seconds using
1746     the \emph{fflush()} function. Still,
1747     \index{SlickEdit@\emph{SlickEdit}}\emph{SlickEdit}
1748     (the text editor I use) does not
1749     exhibit the desired behavior of detecting the updated file when focus
1750     is restored. In order to see additions to a log file, the file must be
1751     closed and then re-opened in \emph{SlickEdit}.
1752    
1753     The technical basis for this non-detection should be investigated.
1754    
1755     Note that this limitation does not affect the correctness or completeness
1756     of any log file---it only affects whether a typical text editor will
1757     automatically detect that the open file has changed.
1758    
1759    
1760     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1761    
1762     %\clearpage{}
1763     %\section{Glossary of Terms, Acronyms, and Nomenclature}
1764     %\label{sglo1}
1765    
1766     %\begin{docglossaryenum}
1767    
1768     %\item \index{fTq@$f_{T_q}$}$f_{T_q}$
1769    
1770     % \cite[p. 161]{bibref:freescale:gz60a} defines $f_{T_q}$ as the
1771     % frequency of $T_q$, the atomic unit of time handled by the HSCAN
1772     % peripheral built in to the microcontroller.
1773    
1774     %\end{docglossaryenum}
1775    
1776     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1777     \clearpage{}
1778     \addcontentsline{toc}{section}{References}
1779    
1780     \begin{thebibliography}{000}
1781     \bibitem{bibref:vendor:dynex}
1782     \emph{Dynex},\\
1783     \texttt{http://www.dynexproducts.com}
1784     \bibitem{bibref:vendor:futurelec}
1785     \emph{Futurelec},\\
1786     \texttt{http://www.futurelec.com}
1787     \bibitem{bibref:twp:ms810467}
1788     \emph{Serial Communications in Win32},\\
1789     \texttt{http://msdn.microsoft.com/en-us/library/ms810467.aspx}
1790     \bibitem{bibref:swlic:gpl}
1791     \emph{GNU General Public License},\\
1792     \texttt{http://www.gnu.org/licenses/licenses.html}
1793     \bibitem{bibref:osws:sourceforge}
1794     \emph{SourceForge},\\
1795     \texttt{http://www.sourceforge.net}
1796     \bibitem{bibref:i:daveashley}
1797     David T. Ashley,\\
1798     \texttt{dashley@gmail.com}
1799     \bibitem{bibref:swp:slickedit}
1800     \emph{SlickEdit},\\
1801     \texttt{http://www.slickedit.com}
1802     \bibitem{bibref:swp:realterm}
1803     \index{Realterm@\emph{RealTerm}}\emph{RealTerm},\\
1804     \texttt{http://realterm.sourceforge.net}
1805     \end{thebibliography}
1806    
1807     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1808     \clearpage{}
1809     \addcontentsline{toc}{section}{Index}
1810     \printindex
1811    
1812     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1813     \end{document}
1814     %
1815     %$Log: man20081211a.tex,v $
1816     %Revision 1.20 2009/01/17 22:17:01 dashley
1817     %Edits.
1818     %
1819     %Revision 1.19 2009/01/17 20:08:12 dashley
1820     %Edits.
1821     %
1822     %Revision 1.18 2009/01/17 05:25:40 dashley
1823     %Edits.
1824     %
1825     %Revision 1.17 2009/01/17 04:28:05 dashley
1826     %Edits.
1827     %
1828     %Revision 1.16 2009/01/17 01:09:00 dashley
1829     %Edits.
1830     %
1831     %Revision 1.15 2009/01/16 21:32:38 dashley
1832     %Edits.
1833     %
1834     %End of $RCSfile: man20081211a.tex,v $.
1835     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25