Changeset 780eab4 in rtems
- Timestamp:
- 10/07/14 14:39:42 (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 0dae390
- Parents:
- 46e72c8
- git-author:
- Joel Sherrill <joel.sherrill@…> (10/07/14 14:39:42)
- git-committer:
- Joel Sherrill <joel.sherrill@…> (10/09/14 15:11:54)
- Location:
- c/src/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/powerpc/mbx8xx/clock/p_clock.c
r46e72c8 r780eab4 1 /** 2 * @file 3 * @brief mbx8xx Clock Tick connection code. 4 */ 5 1 6 /* 2 * Clock Tick interrupt conexion code.3 *4 7 * COPYRIGHT (c) 1989-1997. 5 8 * On-Line Applications Research Corporation (OAR). … … 22 25 extern void Clock_isr(void*); 23 26 24 static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER, 25 (rtems_irq_hdl)Clock_isr, 26 0, 27 (rtems_irq_enable)clockOn, 28 (rtems_irq_disable)clockOff, 29 (rtems_irq_is_enabled)clockIsOn}; 27 static rtems_irq_connect_data clockIrqData = { 28 BSP_PERIODIC_TIMER, 29 (rtems_irq_hdl)Clock_isr, 30 0, 31 (rtems_irq_enable)clockOn, 32 (rtems_irq_disable)clockOff, 33 (rtems_irq_is_enabled)clockIsOn 34 }; 35 36 /* 37 * Prototypes 38 */ 39 int BSP_get_clock_irq_level(void); 40 int BSP_connect_clock_handler(rtems_irq_hdl hdl); 41 int BSP_disconnect_clock_handler(void); 30 42 31 43 int BSP_get_clock_irq_level(void) 32 44 { 33 45 /* 34 * Caution 46 * Caution: if you change this, you must change the 35 47 * definition of BSP_PERIODIC_TIMER accordingly 36 48 */ … … 38 50 } 39 51 40 int BSP_disconnect_clock_handler 52 int BSP_disconnect_clock_handler(void) 41 53 { 42 54 if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) { … … 47 59 } 48 60 49 int BSP_connect_clock_handler 61 int BSP_connect_clock_handler(rtems_irq_hdl hdl) 50 62 { 51 63 if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) { 52 64 printk("Unable to get system clock handler\n"); 53 65 rtems_fatal_error_occurred(1); 54 66 } 55 if (!BSP_remove_rtems_irq_handler (&clockIrqData)) { 56 printk("Unable to remove current system clock handler\n"); 67 68 if (!BSP_remove_rtems_irq_handler(&clockIrqData)) { 69 printk("Unable to remove current system clock handler\n"); 57 70 rtems_fatal_error_occurred(1); 58 71 } 72 59 73 /* 60 74 * Reinit structure -
c/src/lib/libcpu/powerpc/mpc8xx/clock/clock.c
r46e72c8 r780eab4 3 3 * This routine initializes the PIT on the MPC8xx. 4 4 * The tick frequency is specified by the bsp. 5 * 5 */ 6 7 /* 6 8 * Author: Jay Monkman (jmonkman@frasca.com) 7 9 * Copyright (C) 1998 by Frasca International, Inc. … … 50 52 extern uint32_t bsp_clock_speed; 51 53 54 /* 55 * Prototypes 56 */ 57 rtems_isr Clock_isr(rtems_vector_number vector); 52 58 void Clock_exit( void ); 53 54 /* 55 * These are set by clock driver during its init 56 */ 57 58 rtems_device_major_number rtems_clock_major = ~0; 59 rtems_device_minor_number rtems_clock_minor; 59 void clockOn(void* unused); 60 void clockOff(void* unused); 61 int clockIsOn(void* unused); 62 void Install_clock(rtems_isr_entry clock_isr); 63 void ReInstall_clock(rtems_isr_entry new_clock_isr); 60 64 61 65 /* … … 104 108 pdf_value = (plprcr_val & (0x00000006)) >> (31-30); 105 109 extclk = (((uint64_t)bsp_clock_speed) 106 107 108 110 * ((pdf_value + 1) * (mfd_value + 1)) 111 / (mfi_value * (mfd_value + 1) + mfn_value) 112 * (1 << s_value)); 109 113 } 110 114 else { … … 117 121 } 118 122 pit_value = (extclk 119 120 121 122 123 / 1000 124 / 4 125 * rtems_configuration_get_microseconds_per_tick() 126 / 1000); 123 127 m8xx.sccr |= (1<<23); 124 128 force_prescaler = true; … … 126 130 else { 127 131 pit_value = (rtems_configuration_get_microseconds_per_tick() * 128 132 bsp_clicks_per_usec); 129 133 130 134 m8xx.sccr &= ~(1<<23); 131 135 } 132 if ((pit_value > 0xffff) || force_prescaler){ 136 137 if ((pit_value > 0xffff) || force_prescaler) { 133 138 /* 134 139 * try to activate prescaler … … 153 158 M8xx_PISCR_PTE | M8xx_PISCR_PS | M8xx_PISCR_PIE; 154 159 } 160 155 161 /* 156 162 * Called via atexit() 157 163 * Remove the clock interrupt handler by setting handler to NULL 158 164 */ 159 void 160 clockOff(void* unused) 165 void clockOff(void* unused) 161 166 { 162 167 /* disable PIT and PIT interrupts */ … … 166 171 int clockIsOn(void* unused) 167 172 { 168 if (m8xx.piscr & M8xx_PISCR_PIE) return 1; 173 if (m8xx.piscr & M8xx_PISCR_PIE) 174 return 1; 169 175 return 0; 170 176 } … … 174 180 * Remove the clock interrupt handler by setting handler to NULL 175 181 */ 176 void 177 Clock_exit(void) 182 void Clock_exit(void) 178 183 { 179 184 (void) BSP_disconnect_clock_handler (); … … 188 193 } 189 194 190 void 191 ReInstall_clock(rtems_isr_entry new_clock_isr) 195 void ReInstall_clock(rtems_isr_entry new_clock_isr) 192 196 { 193 197 BSP_connect_clock_handler (new_clock_isr); 194 198 } 195 196 199 197 200 rtems_device_driver Clock_initialize( … … 203 206 Install_clock( Clock_isr ); 204 207 205 /*206 * make major/minor avail to others such as shared memory driver207 */208 209 rtems_clock_major = major;210 rtems_clock_minor = minor;211 212 208 return RTEMS_SUCCESSFUL; 213 209 }
Note: See TracChangeset
for help on using the changeset viewer.