diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-11 15:46:33 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-11 15:46:33 +0000 |
commit | 5023c87431b2c2f7b18251fa54028cd0b797fcb1 (patch) | |
tree | 29db4c1733f71b6e5ddccb0f78bbb8d0cb4861cf /c/src | |
parent | 2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-5023c87431b2c2f7b18251fa54028cd0b797fcb1.tar.bz2 |
2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>
* bsp_specs, clock/clock.c, include/bsp.h, irq/irq.c,
startup/bspclean.c, startup/bspstart.c: Eliminate copies of the
Configuration Table. Use the RTEMS provided accessor macros to obtain
configuration fields.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/ChangeLog | 7 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/bsp_specs | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/clock/clock.c | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/include/bsp.h | 1 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/irq/irq.c | 52 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c | 6 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c | 49 |
7 files changed, 83 insertions, 40 deletions
diff --git a/c/src/lib/libbsp/powerpc/gen5200/ChangeLog b/c/src/lib/libbsp/powerpc/gen5200/ChangeLog index 403cda39b9..064b8cc79e 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/ChangeLog +++ b/c/src/lib/libbsp/powerpc/gen5200/ChangeLog @@ -1,3 +1,10 @@ +2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com> + + * bsp_specs, clock/clock.c, include/bsp.h, irq/irq.c, + startup/bspclean.c, startup/bspstart.c: Eliminate copies of the + Configuration Table. Use the RTEMS provided accessor macros to obtain + configuration fields. + 2007-12-06 Joel Sherrill <joel.sherrill@oarcorp.com> * include/mpc5200.h: Expand tabs. diff --git a/c/src/lib/libbsp/powerpc/gen5200/bsp_specs b/c/src/lib/libbsp/powerpc/gen5200/bsp_specs index d750e714d9..15998a67db 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/bsp_specs +++ b/c/src/lib/libbsp/powerpc/gen5200/bsp_specs @@ -3,12 +3,12 @@ %rename link old_link *startfile: -%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s crtbegin.o%s \ +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s \ %{!qrtems_debug: start.o%s} \ %{qrtems_debug: start_g.o%s}}} *endfile: -%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s ecrtn.o%s} +%{!qrtems: %(old_endfile)} %{qrtems: ecrtn.o%s} *link: %{!qrtems: %(old_link)} %{qrtems: -dc -dp -u __vectors -N -u start -e start} diff --git a/c/src/lib/libbsp/powerpc/gen5200/clock/clock.c b/c/src/lib/libbsp/powerpc/gen5200/clock/clock.c index 9200eb3d6a..298d0cee19 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/clock/clock.c +++ b/c/src/lib/libbsp/powerpc/gen5200/clock/clock.c @@ -130,7 +130,7 @@ void mpc5200_gpt_clock_isr(rtems_irq_hdl_param handle) status = gpt->status; if (ClockInitialized && (status & GPT_STATUS_TEXP)) { - gpt->status |= GPT_STATUS_TEXP; + gpt->status |= GPT_STATUS_RESET; Clock_last_TBR = PPC_Get_timebase_register(); Clock_driver_ticks++; @@ -328,7 +328,7 @@ int BSP_connect_clock_handler (uint32_t gpt_no) status = gpt->status; \ \ if (ClockInitialized && (status & GPT_STATUS_TEXP)) { \ - gpt->status |= GPT_STATUS_TEXP; \ + gpt->status |= GPT_STATUS_RESET; \ Clock_last_TBR = PPC_Get_timebase_register(); \ } \ } while(0) diff --git a/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h b/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h index 63d7744511..099a494e15 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h +++ b/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h @@ -151,7 +151,6 @@ extern int rtems_mpc5200_fec_driver_attach_detach (struct rtems_bsdnet_ifconfig /* miscellaneous stuff assumed to exist */ -extern rtems_configuration_table BSP_Configuration; /* * We need to decide how much memory will be non-cacheable. This * will mainly be memory that will be used in DMA (network and serial diff --git a/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c b/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c index 2914452f23..b792ca5fe7 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c +++ b/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c @@ -631,6 +631,50 @@ int BSP_rtems_irq_mngt_get(rtems_irq_global_settings** config) return 0; } +#include <stdio.h> +uint64_t BSP_Starting_TBR; +uint64_t BSP_Total_in_ISR; +uint32_t BSP_ISR_Count; +uint32_t BSP_Worst_ISR; +#define BSP_COUNTED_IRQ 16 +uint32_t BSP_ISR_Count_Per[BSP_COUNTED_IRQ + 1]; + +void BSP_initialize_IRQ_Timing(void) +{ + int i; + BSP_Starting_TBR = PPC_Get_timebase_register(); + BSP_Total_in_ISR = 0; + BSP_ISR_Count = 0; + BSP_Worst_ISR = 0; + for ( i=0 ; i<BSP_COUNTED_IRQ ; i++ ) + BSP_ISR_Count_Per[i] = 0; +} + +static const char * u64tostring( + char *buffer, + uint64_t v +) +{ + sprintf( buffer, "%lld %lld usecs", v, (v / 33) ); + return buffer; +} +void BSP_report_IRQ_Timing(void) +{ + uint64_t now; + char buffer[96]; + int i; + + now = PPC_Get_timebase_register(); + printk( "Started at: %s\n", u64tostring(buffer, BSP_Starting_TBR) ); + printk( "Current : %s\n", u64tostring(buffer, now) ); + printk( "System up : %s\n", u64tostring(buffer, now - BSP_Starting_TBR) ); + printk( "ISRs : %d\n", BSP_ISR_Count ); + printk( "ISRs ran : %s\n", u64tostring(buffer, BSP_Total_in_ISR) ); + printk( "Worst ISR : %s\n", u64tostring(buffer, BSP_Worst_ISR) ); + for ( i=0 ; i<BSP_COUNTED_IRQ ; i++ ) + printk( "IRQ %d: %d\n", i, BSP_ISR_Count_Per[i] ); + printk( "Ticks : %d\n", Clock_driver_ticks ); +} /* * High level IRQ handler called from shared_raw_irq_code_entry @@ -642,6 +686,14 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum) register unsigned int new_msr; register unsigned int pmce; register unsigned int crit_pri_main_mask, per_mask; + uint64_t start, stop, thisTime; + + start = PPC_Get_timebase_register(); + BSP_ISR_Count++; + if ( excNum < BSP_COUNTED_IRQ ) + BSP_ISR_Count_Per[excNum]++; + else + printk( "not counting %d\n", excNum); switch (excNum) { /* diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c b/c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c index ebad9fc3c0..8dcba8bbc7 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c +++ b/c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c @@ -20,6 +20,12 @@ extern int mpc5200_uart_pollRead(int minor); void bsp_cleanup( void ) { + + { + extern void BSP_report_IRQ_Timing(void); + BSP_report_IRQ_Timing(); + } + #if defined(BSP_PRESS_KEY_FOR_RESET) printk( "\nEXECUTIVE SHUTDOWN! Any key to reboot..." ); diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c index 7a0c81d026..f3ec7fe863 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c @@ -120,16 +120,7 @@ bd_t uboot_bdinfo_copy; /* will be overwritten with copy of bdinfo * SPR_RW(SPRG0) SPR_RW(SPRG1) -/* - * The original table from the application (in ROM) and our copy of it with - * some changes. Configuration is defined in <confdefs.h>. Make sure that - * our configuration tables are uninitialized so that they get allocated in - * the .bss section (RAM). - */ -extern rtems_configuration_table Configuration; extern unsigned long intrStackPtr; -rtems_configuration_table BSP_Configuration; -char *rtems_progname; /* * Driver configuration parameters @@ -305,30 +296,22 @@ void bsp_start(void) #endif /* - * Allocate the memory for the RTEMS Work Space. This can come from - * a variety of places: hard coded address, malloc'ed from outside - * RTEMS world (e.g. simulator or primitive memory manager), or (as - * typically done by stock BSPs) by subtracting the required amount - * of work space from the last physical address on the CPU board. - */ - - /* * Need to "allocate" the memory for the RTEMS Workspace and * tell the RTEMS configuration where it is. This memory is * not malloc'ed. It is just "pulled from the air". */ - BSP_Configuration.work_space_start = (void *)&_WorkspaceBase; - - - /* - BSP_Configuration.microseconds_per_tick = 1000; - */ + Configuration.work_space_start = (void *)&_WorkspaceBase; /* * Initalize RTEMS IRQ system */ BSP_rtems_irq_mng_init(0); + { + void BSP_initialize_IRQ_Timing(void); + BSP_initialize_IRQ_Timing(); + } + #ifdef SHOW_MORE_INIT_SETTINGS printk("Exit from bspstart\n"); #endif @@ -344,17 +327,13 @@ void bsp_start(void) * defined in HID0. HID0 is set during starup in start.S. * */ -Thread _Thread_Idle_body(uint32_t ignored ) - { - - for(;;) - { - - asm volatile("mfmsr 3; oris 3,3,4; sync; mtmsr 3; isync; ori 3,3,0; ori 3,3,0"); - - } - - return 0; - +Thread _Thread_Idle_body(uint32_t ignored) +{ + for(;;) { + asm volatile( + "mfmsr 3; oris 3,3,4; sync; mtmsr 3; isync; ori 3,3,0; ori 3,3,0" + ); } + return 0; +} |