From c63f6e2efc963a3630953130eb83b2e8cc727846 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 26 Nov 2007 22:36:18 +0000 Subject: [PATCH] 2007-11-26 Joel Sherrill * clock/ckinit.c, startup/bspstart.c: Eliminate the clicks_per_microsecond field in the MIPS CPU Table and define another mechanism for drivers to obtain this information. --- c/src/lib/libbsp/mips/hurricane/ChangeLog | 6 ++ .../lib/libbsp/mips/hurricane/clock/ckinit.c | 75 +++++++++---------- .../libbsp/mips/hurricane/startup/bspstart.c | 9 +-- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/c/src/lib/libbsp/mips/hurricane/ChangeLog b/c/src/lib/libbsp/mips/hurricane/ChangeLog index e5f5a191aa..ad48ddf02b 100644 --- a/c/src/lib/libbsp/mips/hurricane/ChangeLog +++ b/c/src/lib/libbsp/mips/hurricane/ChangeLog @@ -1,3 +1,9 @@ +2007-11-26 Joel Sherrill + + * clock/ckinit.c, startup/bspstart.c: Eliminate the + clicks_per_microsecond field in the MIPS CPU Table and define another + mechanism for drivers to obtain this information. + 2007-04-12 Ralf Corsépius * bsp_specs: Remove qrtems_debug. diff --git a/c/src/lib/libbsp/mips/hurricane/clock/ckinit.c b/c/src/lib/libbsp/mips/hurricane/clock/ckinit.c index 55fbeaa615..f1096bd3b6 100644 --- a/c/src/lib/libbsp/mips/hurricane/clock/ckinit.c +++ b/c/src/lib/libbsp/mips/hurricane/clock/ckinit.c @@ -43,17 +43,12 @@ #include #include +extern uint32_t bsp_clicks_per_microsecond; + #define EXT_INT1 0x800 /* external interrupt 5 */ #include "clock.h" -/* formerly in the BSP */ -#if 0 -#define CLOCKS_PER_MICROSECOND ( CPU_CLOCK_RATE_MHZ ) /* equivalent to CPU clock speed in MHz */ -#endif - -#define CLOCKS_PER_MICROSECOND \ - rtems_cpu_configuration_get_clicks_per_microsecond() /* to avoid including the bsp */ mips_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int ); @@ -127,7 +122,7 @@ rtems_isr Clock_isr( * perform any timer dependent tasks */ - reset_wdt(); /* Reset hardware watchdog timer */ + reset_wdt(); /* Reset hardware watchdog timer */ Clock_driver_ticks += 1; @@ -156,42 +151,42 @@ void Install_clock( rtems_isr_entry clock_isr ) { - /* - * Initialize the clock tick device driver variables - */ + /* + * Initialize the clock tick device driver variables + */ - Clock_driver_ticks = 0; - Clock_isrs = rtems_configuration_get_milliseconds_per_tick(); + Clock_driver_ticks = 0; + Clock_isrs = rtems_configuration_get_milliseconds_per_tick(); - mips_timer_rate = - rtems_configuration_get_microseconds_per_tick() * CLOCKS_PER_MICROSECOND; + mips_timer_rate = rtems_configuration_get_microseconds_per_tick() * + bsp_clicks_per_microsecond; - /* - * Hardware specific initialize goes here - */ - - /* Set up USC heartbeat timer to generate interrupts */ - disable_hbi(); /* Disable heartbeat interrupt in USC */ - - /* Install interrupt handler */ - Old_ticker = (rtems_isr_entry) set_vector( USC_isr, CLOCK_VECTOR, 1 ); - - init_hbt(); /* Initialize heartbeat timer */ - - reset_wdt(); /* Reset watchdog timer */ - - enable_wdi(); /* Enable watchdog interrupt in USC */ - - enable_hbi(); /* Enable heartbeat interrupt in USC */ - - /* Enable USC interrupt in MIPS processor */ - mips_enable_in_interrupt_mask(CLOCK_VECTOR_MASK); - - /* - * Schedule the clock cleanup routine to execute if the application exits. - */ + /* + * Hardware specific initialize goes here + */ + + /* Set up USC heartbeat timer to generate interrupts */ + disable_hbi(); /* Disable heartbeat interrupt in USC */ + + /* Install interrupt handler */ + Old_ticker = (rtems_isr_entry) set_vector( USC_isr, CLOCK_VECTOR, 1 ); + + init_hbt(); /* Initialize heartbeat timer */ + + reset_wdt(); /* Reset watchdog timer */ + + enable_wdi(); /* Enable watchdog interrupt in USC */ + + enable_hbi(); /* Enable heartbeat interrupt in USC */ + + /* Enable USC interrupt in MIPS processor */ + mips_enable_in_interrupt_mask(CLOCK_VECTOR_MASK); + + /* + * Schedule the clock cleanup routine to execute if the application exits. + */ - atexit( Clock_exit ); + atexit( Clock_exit ); } /* diff --git a/c/src/lib/libbsp/mips/hurricane/startup/bspstart.c b/c/src/lib/libbsp/mips/hurricane/startup/bspstart.c index b75c1340b1..a9cc27e59b 100644 --- a/c/src/lib/libbsp/mips/hurricane/startup/bspstart.c +++ b/c/src/lib/libbsp/mips/hurricane/startup/bspstart.c @@ -19,6 +19,8 @@ #include #include #include + +uint32_t bsp_clicks_per_microsecond; /* * The original table from the application and our copy of it with @@ -108,10 +110,7 @@ void bsp_start( void ) Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY; - Cpu_table.clicks_per_microsecond = CPU_CLOCK_RATE_MHZ; - - mips_install_isr_entries(); /* Install generic MIPS exception handler */ - -/* init_exc_vecs(); */ /* Install BSP specific exception handler */ + bsp_clicks_per_microsecond = CPU_CLOCK_RATE_MHZ; + mips_install_isr_entries(); /* Install generic MIPS exception handler */ }