Ignore:
Timestamp:
Jan 3, 2000, 2:06:42 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
db941670
Parents:
d5c4681e
Message:

Combination of coverhd.h cleanup and MVME23xx/MCP750 patch from Eric Valette
<valette@…> and Jay Kulpinski <jskulpin@…>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/shared/cpu.h

    rd5c4681e r95273a6  
    192192extern ppc_cpu_revision_t get_ppc_cpu_revision();
    193193extern ppc_cpu_revision_t current_ppc_revision;
     194/*
     195 *  Routines to access the time base register
     196 */
     197
     198static inline unsigned long long PPC_Get_timebase_register( void )
     199{
     200  unsigned long tbr_low;
     201  unsigned long tbr_high;
     202  unsigned long tbr_high_old;
     203  unsigned long long tbr;
     204
     205  do {
     206    asm volatile( "mftbu %0" : "=r" (tbr_high_old));
     207    asm volatile( "mftb  %0" : "=r" (tbr_low));
     208    asm volatile( "mftbu %0" : "=r" (tbr_high));
     209  } while ( tbr_high_old != tbr_high );
     210
     211  tbr = tbr_high;
     212  tbr <<= 32;
     213  tbr |= tbr_low;
     214  return tbr;
     215}
     216
     217static inline  void PPC_Set_timebase_register (unsigned long long tbr)
     218{
     219  unsigned long tbr_low;
     220  unsigned long tbr_high;
     221
     222  tbr_low = (tbr & 0xffffffff) ;
     223  tbr_high = (tbr >> 32) & 0xffffffff;
     224  asm volatile( "mtspr 284, %0" : : "r" (tbr_low));
     225  asm volatile( "mtspr 285, %0" : : "r" (tbr_high));
     226 
     227}
    194228#endif
    195229
Note: See TracChangeset for help on using the changeset viewer.