Пример #1
0
/* The following was added for debugging purposes */
void Clock_exit( void )
{
  uint8_t         data;

  /* disable timer
  	data = TCR;
  	TCR = (data & 0xFE); */
  MC68230_READ (MC68230_TCR, data);
  MC68230_WRITE (MC68230_TCR, (data & 0xFE));

  /* do not restore old vector */
}
Пример #2
0
int benchmark_timer_read(void)
{
  uint8_t         data;
  uint8_t          msb, osb, lsb;
  uint32_t         remaining, total;

  /* Disable timer so that timer can be read
        data = MC68230_TCR;
        MC68230_TCR = (data & 0xFE); */
  MC68230_READ (MC68230_TCR, data);
  MC68230_WRITE (MC68230_TCR, (data & 0xFE));

  /* Read the counter value
        msb = MC68230_CNTRH;
        osb = MC68230_CNTRM;
        lsb = MC68230_CNTRL; */
  MC68230_READ (MC68230_CNTRH, msb);
  MC68230_READ (MC68230_CNTRM, osb);
  MC68230_READ (MC68230_CNTRL, lsb);

  /* Calculate the time so far */
  remaining = 0x1000000 - ((msb << 16) + (osb << 8) + lsb);
  total = (Ttimer_val * 0x1000000) + remaining;

  /* Enable timer so that timer can continue
	 	MC68230_TCR = 0xA1; */
  MC68230_WRITE (MC68230_TCR, 0xA1);

  /* do not restore old vector */
  if ( benchmark_timer_find_average_overhead == true )
    return total;          /* in countdown units */

  if ( total < LEAST_VALID )
    return 0;            /* below timer resolution */

  /* Clocked at 6.5 Mhz */
  /* Avoid floating point problems, be lazy, and return the total minus
     the average overhead */
  return (total - AVG_OVERHEAD);
}