home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / vxworks / 725 < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.1 KB  |  48 lines

  1. Newsgroups: comp.os.vxworks
  2. Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!marcu
  3. From: marcu@leland.Stanford.EDU (Marc Albert Ullman)
  4. Subject: Re: MVME167 and RealTime Clock
  5. Message-ID: <1992Aug14.024626.21811@leland.Stanford.EDU>
  6. Sender: news@leland.Stanford.EDU (Mr News)
  7. Organization: DSG, Stanford University, CA 94305, USA
  8. References: <1992Aug14.013252.7600@chiton.ucsd.edu>
  9. Date: Fri, 14 Aug 92 02:46:26 GMT
  10. Lines: 36
  11.  
  12. In article <1992Aug14.013252.7600@chiton.ucsd.edu> cdl@chiton.ucsd.edu (Carl Lowenstein) writes:
  13. >I just spent the better part of a day wondering why elapsed time as
  14. >measured by counting clock ticks was not tracking well with time of day
  15. >as determined by reading the real-time clock chip.
  16. >
  17. >Deep down in the inside of the PCC2 hardware is a prescale divider
  18. >that divides the CPU clock rate (25 MHz) to make the timer clock.
  19. >The MVME167 Programmers Manual points out that the byte that controls
  20. >the prescaler should be set to (256 - BCLK), or 0xe7 for 25 MHz.
  21. >I found both by peeking at the hardware register and by examining
  22. >the code in vw/config/mv167/sysLib.c that the number in use was 0xe6.
  23. >The one's complement of 25, rather than the two's complement.
  24. >
  25. >    *PCC2_PRESCALE = ~BCLK;        /* one's complement, wrong */
  26. >
  27. >    *PCC2_PRESCALE = -BCLK;        /* two's complement, right */
  28. >
  29. >What a difference between the little straight line and the little wiggly one!
  30.  
  31. While I agree with your general problem assessment--indeed the library
  32. code is wrong--your fix is not quite correct.  It is the Prescaler Clock
  33. Adjust Register that is being incorrectly initialized.  It is not clear
  34. why the driver even bothers writing to the Prescaler Count Register since
  35. the documentation says it is a read-only register (although the register
  36. map says otherwise).  Thus I believe the correct fix is to change:
  37.  
  38.         *PCC2_PRESCALE        = ~BCLK;
  39.         *PCC2_PRESCALE_CLK_ADJ  = ~BCLK;
  40. to:
  41.         *PCC2_PRESCALE_CLK_ADJ  = 256 - BCLK;
  42.  
  43. Yes, I realize that for a char register the 256 is unnecessary but it
  44. makes it clearer that one read the documentation.
  45.  
  46. --Marc Ullman
  47.   Stanford University
  48.