00001 /* 00002 GNU GENERAL PUBLIC LICENSE 00003 Version 2, June 1991 00004 00005 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 00006 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00007 Everyone is permitted to copy and distribute verbatim copies 00008 of this license document, but changing it is not allowed. 00009 00010 Preamble 00011 00012 The licenses for most software are designed to take away your 00013 freedom to share and change it. By contrast, the GNU General Public 00014 License is intended to guarantee your freedom to share and change free 00015 software--to make sure the software is free for all its users. This 00016 General Public License applies to most of the Free Software 00017 Foundation's software and to any other program whose authors commit to 00018 using it. (Some other Free Software Foundation software is covered by 00019 the GNU Library General Public License instead.) You can apply it to 00020 your programs, too. 00021 00022 When we speak of free software, we are referring to freedom, not 00023 price. Our General Public Licenses are designed to make sure that you 00024 have the freedom to distribute copies of free software (and charge for 00025 this service if you wish), that you receive source code or can get it 00026 if you want it, that you can change the software or use pieces of it 00027 in new free programs; and that you know you can do these things. 00028 00029 To protect your rights, we need to make restrictions that forbid 00030 anyone to deny you these rights or to ask you to surrender the rights. 00031 These restrictions translate to certain responsibilities for you if you 00032 distribute copies of the software, or if you modify it. 00033 00034 For example, if you distribute copies of such a program, whether 00035 gratis or for a fee, you must give the recipients all the rights that 00036 you have. You must make sure that they, too, receive or can get the 00037 source code. And you must show them these terms so they know their 00038 rights. 00039 00040 We protect your rights with two steps: (1) copyright the software, and 00041 (2) offer you this license which gives you legal permission to copy, 00042 distribute and/or modify the software. 00043 00044 Also, for each author's protection and ours, we want to make certain 00045 that everyone understands that there is no warranty for this free 00046 software. If the software is modified by someone else and passed on, we 00047 want its recipients to know that what they have is not the original, so 00048 that any problems introduced by others will not reflect on the original 00049 authors' reputations. 00050 00051 Finally, any free program is threatened constantly by software 00052 patents. We wish to avoid the danger that redistributors of a free 00053 program will individually obtain patent licenses, in effect making the 00054 program proprietary. To prevent this, we have made it clear that any 00055 patent must be licensed for everyone's free use or not licensed at all. 00056 00057 The precise terms and conditions for copying, distribution and 00058 modification follow. 00059 00060 GNU GENERAL PUBLIC LICENSE 00061 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 00062 00063 0. This License applies to any program or other work which contains 00064 a notice placed by the copyright holder saying it may be distributed 00065 under the terms of this General Public License. The "Program", below, 00066 refers to any such program or work, and a "work based on the Program" 00067 means either the Program or any derivative work under copyright law: 00068 that is to say, a work containing the Program or a portion of it, 00069 either verbatim or with modifications and/or translated into another 00070 language. (Hereinafter, translation is included without limitation in 00071 the term "modification".) Each licensee is addressed as "you". 00072 00073 Activities other than copying, distribution and modification are not 00074 covered by this License; they are outside its scope. The act of 00075 running the Program is not restricted, and the output from the Program 00076 is covered only if its contents constitute a work based on the 00077 Program (independent of having been made by running the Program). 00078 Whether that is true depends on what the Program does. 00079 00080 1. You may copy and distribute verbatim copies of the Program's 00081 source code as you receive it, in any medium, provided that you 00082 conspicuously and appropriately publish on each copy an appropriate 00083 copyright notice and disclaimer of warranty; keep intact all the 00084 notices that refer to this License and to the absence of any warranty; 00085 and give any other recipients of the Program a copy of this License 00086 along with the Program. 00087 00088 You may charge a fee for the physical act of transferring a copy, and 00089 you may at your option offer warranty protection in exchange for a fee. 00090 00091 2. You may modify your copy or copies of the Program or any portion 00092 of it, thus forming a work based on the Program, and copy and 00093 distribute such modifications or work under the terms of Section 1 00094 above, provided that you also meet all of these conditions: 00095 00096 a) You must cause the modified files to carry prominent notices 00097 stating that you changed the files and the date of any change. 00098 00099 b) You must cause any work that you distribute or publish, that in 00100 whole or in part contains or is derived from the Program or any 00101 part thereof, to be licensed as a whole at no charge to all third 00102 parties under the terms of this License. 00103 00104 c) If the modified program normally reads commands interactively 00105 when run, you must cause it, when started running for such 00106 interactive use in the most ordinary way, to print or display an 00107 announcement including an appropriate copyright notice and a 00108 notice that there is no warranty (or else, saying that you provide 00109 a warranty) and that users may redistribute the program under 00110 these conditions, and telling the user how to view a copy of this 00111 License. (Exception: if the Program itself is interactive but 00112 does not normally print such an announcement, your work based on 00113 the Program is not required to print an announcement.) 00114 00115 These requirements apply to the modified work as a whole. If 00116 identifiable sections of that work are not derived from the Program, 00117 and can be reasonably considered independent and separate works in 00118 themselves, then this License, and its terms, do not apply to those 00119 sections when you distribute them as separate works. But when you 00120 distribute the same sections as part of a whole which is a work based 00121 on the Program, the distribution of the whole must be on the terms of 00122 this License, whose permissions for other licensees extend to the 00123 entire whole, and thus to each and every part regardless of who wrote it. 00124 00125 Thus, it is not the intent of this section to claim rights or contest 00126 your rights to work written entirely by you; rather, the intent is to 00127 exercise the right to control the distribution of derivative or 00128 collective works based on the Program. 00129 00130 In addition, mere aggregation of another work not based on the Program 00131 with the Program (or with a work based on the Program) on a volume of 00132 a storage or distribution medium does not bring the other work under 00133 the scope of this License. 00134 00135 3. You may copy and distribute the Program (or a work based on it, 00136 under Section 2) in object code or executable form under the terms of 00137 Sections 1 and 2 above provided that you also do one of the following: 00138 00139 a) Accompany it with the complete corresponding machine-readable 00140 source code, which must be distributed under the terms of Sections 00141 1 and 2 above on a medium customarily used for software interchange; or, 00142 00143 b) Accompany it with a written offer, valid for at least three 00144 years, to give any third party, for a charge no more than your 00145 cost of physically performing source distribution, a complete 00146 machine-readable copy of the corresponding source code, to be 00147 distributed under the terms of Sections 1 and 2 above on a medium 00148 customarily used for software interchange; or, 00149 00150 c) Accompany it with the information you received as to the offer 00151 to distribute corresponding source code. (This alternative is 00152 allowed only for noncommercial distribution and only if you 00153 received the program in object code or executable form with such 00154 an offer, in accord with Subsection b above.) 00155 00156 The source code for a work means the preferred form of the work for 00157 making modifications to it. For an executable work, complete source 00158 code means all the source code for all modules it contains, plus any 00159 associated interface definition files, plus the scripts used to 00160 control compilation and installation of the executable. However, as a 00161 special exception, the source code distributed need not include 00162 anything that is normally distributed (in either source or binary 00163 form) with the major components (compiler, kernel, and so on) of the 00164 operating system on which the executable runs, unless that component 00165 itself accompanies the executable. 00166 00167 If distribution of executable or object code is made by offering 00168 access to copy from a designated place, then offering equivalent 00169 access to copy the source code from the same place counts as 00170 distribution of the source code, even though third parties are not 00171 compelled to copy the source along with the object code. 00172 00173 4. You may not copy, modify, sublicense, or distribute the Program 00174 except as expressly provided under this License. Any attempt 00175 otherwise to copy, modify, sublicense or distribute the Program is 00176 void, and will automatically terminate your rights under this License. 00177 However, parties who have received copies, or rights, from you under 00178 this License will not have their licenses terminated so long as such 00179 parties remain in full compliance. 00180 00181 5. You are not required to accept this License, since you have not 00182 signed it. However, nothing else grants you permission to modify or 00183 distribute the Program or its derivative works. These actions are 00184 prohibited by law if you do not accept this License. Therefore, by 00185 modifying or distributing the Program (or any work based on the 00186 Program), you indicate your acceptance of this License to do so, and 00187 all its terms and conditions for copying, distributing or modifying 00188 the Program or works based on it. 00189 00190 6. Each time you redistribute the Program (or any work based on the 00191 Program), the recipient automatically receives a license from the 00192 original licensor to copy, distribute or modify the Program subject to 00193 these terms and conditions. You may not impose any further 00194 restrictions on the recipients' exercise of the rights granted herein. 00195 You are not responsible for enforcing compliance by third parties to 00196 this License. 00197 00198 7. If, as a consequence of a court judgment or allegation of patent 00199 infringement or for any other reason (not limited to patent issues), 00200 conditions are imposed on you (whether by court order, agreement or 00201 otherwise) that contradict the conditions of this License, they do not 00202 excuse you from the conditions of this License. If you cannot 00203 distribute so as to satisfy simultaneously your obligations under this 00204 License and any other pertinent obligations, then as a consequence you 00205 may not distribute the Program at all. For example, if a patent 00206 license would not permit royalty-free redistribution of the Program by 00207 all those who receive copies directly or indirectly through you, then 00208 the only way you could satisfy both it and this License would be to 00209 refrain entirely from distribution of the Program. 00210 00211 If any portion of this section is held invalid or unenforceable under 00212 any particular circumstance, the balance of the section is intended to 00213 apply and the section as a whole is intended to apply in other 00214 circumstances. 00215 00216 It is not the purpose of this section to induce you to infringe any 00217 patents or other property right claims or to contest validity of any 00218 such claims; this section has the sole purpose of protecting the 00219 integrity of the free software distribution system, which is 00220 implemented by public license practices. Many people have made 00221 generous contributions to the wide range of software distributed 00222 through that system in reliance on consistent application of that 00223 system; it is up to the author/donor to decide if he or she is willing 00224 to distribute software through any other system and a licensee cannot 00225 impose that choice. 00226 00227 This section is intended to make thoroughly clear what is believed to 00228 be a consequence of the rest of this License. 00229 00230 8. If the distribution and/or use of the Program is restricted in 00231 certain countries either by patents or by copyrighted interfaces, the 00232 original copyright holder who places the Program under this License 00233 may add an explicit geographical distribution limitation excluding 00234 those countries, so that distribution is permitted only in or among 00235 countries not thus excluded. In such case, this License incorporates 00236 the limitation as if written in the body of this License. 00237 00238 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 00239 00240 Each version is given a distinguishing version number. If the Program 00241 specifies a version number of this License which applies to it and "any 00242 later version", you have the option of following the terms and conditions 00243 either of that version or of any later version published by the Free Software 00244 Foundation. If the Program does not specify a version number of this License, 00245 you may choose any version ever published by the Free Software Foundation. 00246 00247 10. If you wish to incorporate parts of the Program into other free 00248 programs whose distribution conditions are different, write to the author to 00249 ask for permission. For software which is copyrighted by the Free Software 00250 Foundation, write to the Free Software Foundation; we sometimes make 00251 exceptions for this. Our decision will be guided by the two goals of 00252 preserving the free status of all derivatives of our free software and of 00253 promoting the sharing and reuse of software generally. 00254 00255 NO WARRANTY 00256 00257 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR 00258 THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 00259 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE 00260 THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 00261 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00262 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 00263 PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, 00264 YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 00265 00266 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 00267 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 00268 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 00269 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 00270 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO 00271 LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR 00272 THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 00273 EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 00274 DAMAGES. 00275 00276 END OF TERMS AND CONDITIONS ' 00277 */ 00278 00279 00280 #include <config.h> 00281 00282 #include "CSIS3600.h" 00283 00284 00285 00286 #ifndef __VMEMODULE_H 00287 #include <VmeModule.h> 00288 #endif 00289 00290 #ifdef HAVE_STD_NAMESPACE 00291 using namespace std; 00292 #endif 00293 00294 // Structure of the module registers (offsets). 00295 00296 #define CSR 0x000 // Control status register offset. 00297 #define IDIRQ 0x004 // Identification and IRQ register. 00298 #define FCLEARWIN 0x008 // Fast clear window. 00299 #define OPFREQ 0x00c // Ouput pulse frequency generator. 00300 #define WRITEFIFO 0x010 // Write to fifo in test mode. 00301 #define CLEARFIFO 0x020 // KEY: Clear the FIFO. 00302 #define NEXTCLOCK 0x024 // KEY: VME Next clock. 00303 #define ENABLENEXTCLOCK 0x028 // KEY: Enable next clock logic. 00304 #define DISABLENEXTCLOCK 0x02c // KEY: Disable next clock logic. 00305 #define ENABLEFCLEAR 0x050 // KEY: Enable fast clear. 00306 #define DISABLEFCLEAR 0x054 // KEY: Disable fast clear. 00307 #define RESET 0x060 // KEY: Reset the module. 00308 #define PULSEOUT 0x068 // KEY: Generate an output pulse. 00309 #define CBLTSETUP 0x080 // CBLT setup register. 00310 #define FIFO 0x100 // FIFO (data). 00311 00312 // The CSR is both a status and a control register. The 00313 // bit structures below (assuming that bits are defined low to high' 00314 //e the structure of these registers.. 00315 00319 struct StatusRegister { 00320 unsigned LedOn:1; 00321 unsigned TestingFIFO:1; 00322 unsigned OutputMode:2; 00323 00324 00325 unsigned OutputPulseEnabled:1; 00326 unsigned isPipelined:1; 00327 unsigned isBroadcastOn:1; 00328 unsigned isBCastController:1; 00329 00330 unsigned FIFOEmpty:1; 00331 unsigned FIFOAlmostEmpty:1; 00332 unsigned FIFOHalfFull:1; 00333 unsigned FIFOAlmostFull:1; 00334 00335 unsigned FIFOFull:1; 00336 unsigned Unused1:1; 00337 unsigned FastClearEnabled:1; 00338 unsigned isEnableNext:1; 00339 00340 unsigned isExternalNext:1; 00341 unsigned isExternalClear:1; 00342 unsigned isLatchGate:1; 00343 unsigned isCoincidenceMode:1; 00344 00345 unsigned isEnableVMEIrq0:1; 00346 unsigned isEnableVMEIrq1:1; 00347 unsigned isEnableVMEIrq2:1; 00348 unsigned isEnableVMEIrq3:1; 00349 00350 unsigned Unused2:1; 00351 unsigned Unused3:1; 00352 unsigned InternalVMEIRQ:1; 00353 unsigned VMEIRQ:1; 00354 00355 unsigned VMEIRQ0:1; 00356 unsigned VMEIRQ1:1; 00357 unsigned VMEIRQ2:1; 00358 unsigned VMEIRQ3:1; 00359 }; 00360 00364 struct ControlRegister { 00365 unsigned SetLEDOn:1; 00366 unsigned SetFIFOTest:1; 00367 unsigned SetModeBit0:1; 00368 unsigned SetModeBit1:1; 00369 00370 unsigned EnableOutputPulses:1; 00371 unsigned EnablePipeline:1; 00372 unsigned EnableBroadcast:1; 00373 unsigned EnableBcastController:1; 00374 00375 unsigned ClearLEDOn:1; 00376 unsigned ClearFIFOTest:1; 00377 unsigned ClearModeBit0:1; 00378 unsigned ClearModeBit1:1; 00379 00380 unsigned DisableOutputPulses:1; 00381 unsigned DisablePipeline:1; 00382 unsigned DisableBroadcast:1; 00383 unsigned DisableBcastController:1; 00384 00385 unsigned EnableExternalNext:1; 00386 unsigned EnableExternalClear:1; 00387 unsigned SetLatchGate:1; 00388 unsigned SetCoincidenceMode:1; 00389 00390 unsigned EnableIRQ0:1; 00391 unsigned EnableIRQ1:1; 00392 unsigned EnableIRQ2:1; 00393 unsigned EnableIRQ3:1; 00394 00395 unsigned DisableExternalNext:1; 00396 unsigned DisableExternalClear:1; 00397 unsigned ClearLatchGate:1; 00398 unsigned ClearCoincidenceMode:1; 00399 00400 unsigned DisableIRQ0:1; 00401 unsigned DisableIRQ1:1; 00402 unsigned DisableIRQ2:1; 00403 unsigned DisableIRQ3:1; 00404 00405 }; 00406 00411 struct IdIrq { 00412 unsigned IRQVector:8; 00413 00414 unsigned IPL:3; 00415 unsigned IRQEnable:1; 00416 00417 unsigned Version:4; 00418 00419 unsigned ModuleId:16; 00420 00421 }; 00422 00423 00424 // 00425 // The following union definitions make it easier to deal with 00426 // the bit-wise/long wise duality of registers: 00427 // 00428 union IdRegister { // ID IRQ register... 00429 IdIrq bits; 00430 unsigned long l; 00431 }; 00432 00433 00434 union StatReg { 00435 StatusRegister bits; 00436 unsigned long l; 00437 }; 00438 00439 union CtlReg { 00440 ControlRegister bits; 00441 unsigned long l; 00442 }; 00443 00444 // The register unions above have a structure that is identical 00445 // in order to allow us to do the following little macro games: 00446 00447 #define SetBit(reg, field, value) reg.bits.field = value 00448 #define GetBit(reg, field) reg.bits.field 00449 #define Zero(reg) reg.l = 0 00450 #define Long(reg) reg.l 00451 00452 00453 static const unsigned int ModuleLength(0x200); 00454 00464 CSIS3600::CSIS3600(unsigned long base, int crate) throw (string) : 00465 CModule32(base, ModuleLength, crate) 00466 { 00467 IdRegister id; 00468 00469 00470 unsigned long csr = peek(CSR); // Sometimes needed for good->bad 00471 // module construction to shake up 00472 // the bus bits a bit. 00473 00474 Long(id) = peek(IDIRQ); 00475 00476 if(GetBit(id,ModuleId) != 0x3600) { 00477 ThrowString("CSIS3600::CSIS3600", 00478 "No 3600 at this base address"); 00479 } 00480 Reset(); // Reset the module. 00481 } 00485 CSIS3600::~CSIS3600() 00486 { 00487 } 00493 void 00494 CSIS3600::LightLed() const 00495 { 00496 00497 CtlReg csr; 00498 00499 Zero(csr); 00500 SetBit(csr, SetLEDOn, 1); 00501 00502 poke(Long(csr), CSR); 00503 00504 00505 } 00510 void 00511 CSIS3600::ClearLed() const 00512 { 00513 00514 CtlReg csr; 00515 00516 Zero(csr); 00517 SetBit(csr, ClearLEDOn, 1); 00518 00519 00520 poke(Long(csr), CSR); 00521 00522 00523 } 00531 bool 00532 CSIS3600::isLedLit() const 00533 { 00534 StatReg sr; 00535 00536 Long(sr) = peek(CSR); 00537 return (GetBit(sr,LedOn) == 1); 00538 } 00545 void 00546 CSIS3600::SetLatchMode() const 00547 { 00548 00549 CtlReg cr; 00550 00551 Zero(cr); 00552 SetBit(cr,ClearCoincidenceMode, 1); 00553 00554 poke(Long(cr), CSR); 00555 } 00560 void 00561 CSIS3600::SetCoincidenceMode() const 00562 { 00563 00564 CtlReg cr; 00565 00566 Zero(cr); 00567 SetBit(cr,SetCoincidenceMode,1); 00568 00569 poke(Long(cr), CSR); 00570 } 00576 bool 00577 CSIS3600::isLatchMode() const 00578 { 00579 StatReg sr; 00580 00581 Long(sr) = peek(CSR); 00582 00583 return (GetBit(sr,isCoincidenceMode) == 0); 00584 } 00588 void 00589 CSIS3600::Reset() 00590 { 00591 Key(RESET); 00592 m_nFastClearWindow = 220; // Default initial fast clear window. 00593 } 00598 void 00599 CSIS3600::EnableExternalNext() const 00600 { 00601 CtlReg cr; 00602 Zero(cr); 00603 SetBit(cr, EnableExternalNext, 1); 00604 poke(Long(cr), CSR); 00605 } 00610 void 00611 CSIS3600::DisableExternalNext() const 00612 { 00613 CtlReg cr; 00614 Zero(cr); 00615 SetBit(cr, DisableExternalNext, 1); 00616 poke(Long(cr), CSR); 00617 } 00623 bool 00624 CSIS3600::ExternalNextEnabled() const 00625 { 00626 StatReg sr; 00627 Long(sr) = peek(CSR); 00628 return (GetBit(sr, isExternalNext) == 1); 00629 } 00638 void 00639 CSIS3600::EnableExternalClear() const 00640 { 00641 CtlReg cr; 00642 Zero(cr); 00643 SetBit(cr,EnableExternalClear ,1); 00644 poke(Long(cr), CSR); 00645 00646 } 00650 void 00651 CSIS3600:: DisableExternalClear() const 00652 { 00653 CtlReg cr; 00654 Zero(cr); 00655 SetBit(cr, DisableExternalClear, 1); 00656 poke(Long(cr), CSR); 00657 } 00661 bool 00662 CSIS3600::ExternalClearEnabled() const 00663 { 00664 StatReg sr; 00665 Long(sr) = peek(CSR); 00666 return (GetBit(sr, isExternalClear) == 1); 00667 } 00684 void 00685 CSIS3600::SetFastClearWindow(int ns) 00686 { 00687 m_nFastClearWindow = ns; 00688 ns += 50; // This ensures rounding. 00689 unsigned int reg =ns; 00690 reg = (reg - 120)/100 -1; 00691 if(reg > 0xff) { 00692 ThrowString("CSIS3600::SetFastClearWidow", 00693 "Fast clear window range is [220, 25720]ns"); 00694 } 00695 00696 poke(reg, FCLEARWIN); 00697 } 00712 int 00713 CSIS3600::GetFastClearWindow() const 00714 { 00715 return m_nFastClearWindow; 00716 } 00726 void 00727 CSIS3600::StartLatch() const 00728 { 00729 CtlReg cr; 00730 Zero(cr); 00731 SetBit(cr, SetLatchGate,1); 00732 00733 poke(Long(cr), CSR); 00734 } 00739 void 00740 CSIS3600::EndLatch() const 00741 { 00742 CtlReg cr; 00743 Zero(cr); 00744 SetBit(cr, ClearLatchGate,1); 00745 00746 poke(Long(cr), CSR); 00747 } 00753 bool 00754 CSIS3600::DataReady() const 00755 { 00756 StatReg sr; 00757 00758 Long(sr) = peek(CSR); 00759 00760 return ((GetBit(sr, FIFOEmpty)) == 0); 00761 } 00765 void 00766 CSIS3600::Enable() const 00767 { 00768 Key(ENABLENEXTCLOCK); 00769 } 00773 void 00774 CSIS3600::Disable() const 00775 { 00776 Key(DISABLENEXTCLOCK); 00777 } 00781 void 00782 CSIS3600::Clock() const 00783 { 00784 Key(NEXTCLOCK); 00785 } 00789 void 00790 CSIS3600::ClearData() const 00791 { 00792 Key(CLEARFIFO); 00793 } 00807 unsigned long 00808 CSIS3600::Read() const throw (string) 00809 { 00810 if(DataReady()) { 00811 return peek(FIFO); 00812 } 00813 else { 00814 ThrowString("CSIS3600::Read", 00815 "No data present"); 00816 } 00817 } 00845 unsigned int 00846 CSIS3600::Read(void* pBuffer, 00847 int nLongs) const 00848 { 00849 unsigned long* p = (unsigned long*)pBuffer; 00850 unsigned int n = 0; 00851 00852 // This code assumes that a throw/catch is relatively expensive. 00853 00854 while(DataReady() && nLongs) { 00855 *p++ = Read(); 00856 n++; 00857 nLongs--; 00858 } 00859 return n; 00860 }