Ignore:
Timestamp:
08/17/95 19:51:51 (28 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
95fbca1
Parents:
3b438fa
Message:

Numerous miscellaneous features incorporated from Tony Bennett
(tbennett@…) including the following major additions:

+ variable length messages
+ named devices
+ debug monitor
+ association tables/variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/unix/posix/clock/clock.c

    r3b438fa rb06e68ef  
    11/*  Clock
    22 *
    3  *  This routine initializes the interval timer on the
    4  *  PA-RISC CPU.  The tick frequency is specified by the bsp.
     3 *  This routine generates clock ticks using standard POSIX services.
     4 *  The tick frequency is specified by the bsp.
    55 *
    66 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
     
    1616
    1717#include <rtems.h>
     18#include <rtems/libio.h>
     19#include <bsp.h>
    1820
     21/*
     22 *  In order to get the types and prototypes used in this file under
     23 *  Solaris 2.3, it is necessary to pull the following magic.
     24 */
     25 
     26#if defined(solaris)
     27#warning "Ignore the undefining __STDC__ warning"
     28#undef __STDC__
     29#define __STDC__ 0
     30#undef  _POSIX_C_SOURCE
     31#endif
     32 
    1933#include <stdlib.h>
    2034#include <stdio.h>
    2135#include <signal.h>
    2236#include <time.h>
    23 #include <sys/time.h>
    2437
    2538extern rtems_configuration_table Configuration;
    26 extern sigset_t                  UNIX_SIGNAL_MASK;
    2739
    28 /*
    29  * Function prototypes
    30  */
    31 
    32 void Install_clock();
    33 void Clock_isr();
    34 void Clock_exit();
    35 
    36 /*
    37  * CPU_HPPA_CLICKS_PER_TICK is either a #define or an rtems_unsigned32
    38  *   allocated and set by bsp_start()
    39  */
    40 
    41 #ifndef CPU_HPPA_CLICKS_PER_TICK
    42 extern rtems_unsigned32 CPU_HPPA_CLICKS_PER_TICK;
    43 #endif
     40void Clock_exit(void);
    4441
    4542volatile rtems_unsigned32 Clock_driver_ticks;
    4643
    47 struct itimerval  new;
     44/*
     45 * These are set by clock driver during its init
     46 */
    4847
    49 rtems_device_driver
    50 Clock_initialize(
    51   rtems_device_major_number major,
    52   rtems_device_minor_number minor,
    53   void *pargp,
    54   rtems_id tid,
    55   rtems_unsigned32 *rval
    56 )
    57 {
    58     Install_clock(Clock_isr);
    59 }
    60 
    61 void
    62 ReInstall_clock(rtems_isr_entry new_clock_isr)
    63 {
    64     rtems_unsigned32  isrlevel = 0;
    65 
    66     rtems_interrupt_disable(isrlevel);
    67     (void)set_vector(new_clock_isr, SIGALRM, 1);
    68     rtems_interrupt_enable(isrlevel);
    69 }
     48rtems_device_major_number rtems_clock_major = ~0;
     49rtems_device_minor_number rtems_clock_minor;
    7050
    7151void
    7252Install_clock(rtems_isr_entry clock_isr)
    7353{
     54    struct itimerval  new;
     55
    7456    Clock_driver_ticks = 0;
    7557
     
    8769
    8870void
     71ReInstall_clock(rtems_isr_entry new_clock_isr)
     72{
     73    rtems_unsigned32  isrlevel = 0;
     74
     75    rtems_interrupt_disable(isrlevel);
     76    (void)set_vector(new_clock_isr, SIGALRM, 1);
     77    rtems_interrupt_enable(isrlevel);
     78}
     79
     80void
    8981Clock_isr(int vector)
    9082{
    9183    Clock_driver_ticks++;
    92 
    9384    rtems_clock_tick();
    9485}
     
    10293Clock_exit(void)
    10394{
     95    struct itimerval  new;
    10496     struct sigaction  act;
    10597
     
    122114    (void)set_vector(0, SIGALRM, 1);
    123115}
     116
     117rtems_device_driver
     118Clock_initialize(
     119  rtems_device_major_number major,
     120  rtems_device_minor_number minor,
     121  void *pargp
     122)
     123{
     124    Install_clock((rtems_isr_entry) Clock_isr);
     125
     126    /*
     127     * make major/minor avail to others such as shared memory driver
     128     */
     129    rtems_clock_major = major;
     130    rtems_clock_minor = minor;
     131
     132    return RTEMS_SUCCESSFUL;
     133}
     134
     135rtems_device_driver Clock_control(
     136  rtems_device_major_number major,
     137  rtems_device_minor_number minor,
     138  void *pargp
     139)
     140{
     141    rtems_libio_ioctl_args_t *args = pargp;
     142
     143    if (args == 0)
     144        goto done;
     145
     146    /*
     147     * This is hokey, but until we get a defined interface
     148     * to do this, it will just be this simple...
     149     */
     150
     151    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
     152    {
     153        Clock_isr(SIGALRM);
     154    }
     155    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
     156    {
     157        ReInstall_clock(args->buffer);
     158    }
     159   
     160done:
     161    return RTEMS_SUCCESSFUL;
     162}
Note: See TracChangeset for help on using the changeset viewer.