Changeset 2e9b49f in multiio


Ignore:
Timestamp:
Dec 11, 2009, 8:41:36 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
5471507
Parents:
5ebe1e8
Message:

2009-12-11 Joel Sherrill <joel.sherrill@…>

  • main_pcmmio_din.c, main_pcmmio_irq.c, pcmmio_shell.c: Report time between discrete in interrupts in microseconds.
Location:
pcmmio/original
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pcmmio/original/ChangeLog

    r5ebe1e8 r2e9b49f  
     12009-12-11      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * main_pcmmio_din.c, main_pcmmio_irq.c, pcmmio_shell.c: Report time
     4        between discrete in interrupts in microseconds.
     5
    162009-12-11      Joel Sherrill <joel.sherrill@oarcorp.com>
    27
  • pcmmio/original/main_pcmmio_din.c

    r5ebe1e8 r2e9b49f  
    2020
    2121#if defined(TESTING)
    22   #define dio_read_bit(_x) (_x & 1)
     22  #define dio_read_bit(_x) ((_x) & 1)
    2323#endif
    2424
  • pcmmio/original/main_pcmmio_irq.c

    r5ebe1e8 r2e9b49f  
    1515#include "mio_io.h"
    1616#include <rtems/stringto.h>
     17#include <stdint.h>
    1718
    1819#define __need_getopt_newlib
     
    2627#define PRINT_USAGE() \
    2728   printf( pcmmio_irq_usage, argv[0] )
     29
     30/*
     31 *  pc386 BSP provided variables.
     32 */
     33extern uint64_t pc586_tsc_per_tick;
     34extern uint64_t pc586_nanoseconds_per_tick;
     35
     36/*
     37 *  Compute the number of TSC clicks per microsecond.
     38 */
     39uint64_t tsc_per_microsecond()
     40{
     41  static uint64_t pcmmio_tsc_per_microsecond = 0;
     42
     43  if ( pcmmio_tsc_per_microsecond == 0 ) {
     44    pcmmio_tsc_per_microsecond =
     45      (pc586_tsc_per_tick * 1000) / pc586_nanoseconds_per_tick;
     46  }
     47
     48  return pcmmio_tsc_per_microsecond;
     49}
     50
     51/*
     52 *  Subtract two timestamps from the PCMMIO driver and convert that to
     53 *  microseconds.
     54 */
     55int din_timestamp_subtract(
     56  uint64_t previousTimestamp,
     57  uint64_t timestamp
     58)
     59{
     60  uint64_t cycles;
     61
     62  if ( previousTimestamp == 0 )
     63    return 0;
     64
     65  cycles = timestamp - previousTimestamp;
     66  return (int) (cycles  / tsc_per_microsecond());
     67}
    2868
    2969int main_pcmmio_irq(int argc, char **argv)
     
    4686  int                 elapsed;
    4787  int                 interrupts;
    48   unsigned long long  timestamp;
     88  uint64_t            previousTimestamp = 0;
     89  uint64_t            timestamp;
    4990
    5091  /*
     
    177218    if ( sc != -1 ) {
    178219      interrupts++;
    179       if ( do_din == true )
    180         printf( "%d %s irq pin %d @ %llx\n", elapsed, irq, sc - 1, timestamp );
    181       else
     220      if ( do_din == true ) {
     221        printf(
     222          "%d %s irq pin %d @ %llx (%d usecs since last)\n",
     223          elapsed,
     224          irq,
     225          sc - 1,
     226          timestamp,
     227          din_timestamp_subtract( previousTimestamp, timestamp )
     228        );
     229        previousTimestamp = timestamp;
     230      } else {
    182231        printf( "%d %s irq\n", elapsed, irq );
     232      }
    183233    }
    184234
  • pcmmio/original/pcmmio_shell.c

    r5ebe1e8 r2e9b49f  
    7575#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    7676#define CONFIGURE_EXTRA_TASK_STACKS         (6 * RTEMS_MINIMUM_STACK_SIZE)
     77#define CONFIGURE_INIT_TASK_ATTRIBUTES      RTEMS_FLOATING_POINT
    7778
    7879#define CONFIGURE_STACK_CHECKER_ENABLED
Note: See TracChangeset for help on using the changeset viewer.