Changeset 37f4c2d in rtems for c/src/lib/libbsp/unix/posix/clock
- Timestamp:
- 09/27/95 20:53:58 (28 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 07058e7
- Parents:
- c701f197
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/unix/posix/clock/clock.c
rc701f197 r37f4c2d 15 15 */ 16 16 17 #include < rtems.h>17 #include <bsp.h> 18 18 #include <rtems/libio.h> 19 #include <bsp.h>20 21 /*22 * In order to get the types and prototypes used in this file under23 * 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__ 030 #undef _POSIX_C_SOURCE31 #endif32 33 19 #include <stdlib.h> 34 #include <stdio.h>35 #include <signal.h>36 #include <time.h>37 38 extern rtems_configuration_table Configuration;39 20 40 21 void Clock_exit(void); 41 22 42 23 volatile rtems_unsigned32 Clock_driver_ticks; 24 25 rtems_unsigned32 Clock_driver_vector; 43 26 44 27 /* … … 52 35 Install_clock(rtems_isr_entry clock_isr) 53 36 { 54 struct itimerval new;55 56 37 Clock_driver_ticks = 0; 57 38 58 new.it_value.tv_sec = 0; 59 new.it_value.tv_usec = Configuration.microseconds_per_tick; 60 new.it_interval.tv_sec = 0; 61 new.it_interval.tv_usec = Configuration.microseconds_per_tick; 39 (void)set_vector(clock_isr, Clock_driver_vector, 1); 62 40 63 (void)set_vector(clock_isr, SIGALRM, 1); 64 65 setitimer(ITIMER_REAL, &new, 0); 41 _CPU_Start_clock( BSP_Configuration.microseconds_per_tick ); 66 42 67 43 atexit(Clock_exit); … … 74 50 75 51 rtems_interrupt_disable(isrlevel); 76 (void)set_vector(new_clock_isr, SIGALRM, 1);52 (void)set_vector(new_clock_isr, Clock_driver_vector, 1); 77 53 rtems_interrupt_enable(isrlevel); 78 54 } … … 93 69 Clock_exit(void) 94 70 { 95 struct itimerval new; 96 struct sigaction act; 71 _CPU_Stop_clock(); 97 72 98 /* 99 * Set the SIGALRM signal to ignore any last 100 * signals that might come in while we are 101 * disarming the timer and removing the interrupt 102 * vector. 103 */ 104 105 act.sa_handler = SIG_IGN; 106 107 sigaction(SIGALRM, &act, 0); 108 109 new.it_value.tv_sec = 0; 110 new.it_value.tv_usec = 0; 111 112 setitimer(ITIMER_REAL, &new, 0); 113 114 (void)set_vector(0, SIGALRM, 1); 73 (void)set_vector(0, Clock_driver_vector, 1); 115 74 } 116 75 … … 122 81 ) 123 82 { 83 Clock_driver_vector = _CPU_Get_clock_vector(); 84 124 85 Install_clock((rtems_isr_entry) Clock_isr); 125 86 … … 151 112 if (args->command == rtems_build_name('I', 'S', 'R', ' ')) 152 113 { 153 Clock_isr( SIGALRM);114 Clock_isr(Clock_driver_vector); 154 115 } 155 116 else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
Note: See TracChangeset
for help on using the changeset viewer.