From 048e98f10e9f922244b296258b93e13c1eedf044 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Sep 2010 06:23:55 +0000 Subject: [PATCH] Fixed bug 3075354. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_2.0.x@2195 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- docs/reports/AT91SAM7X-48-ARM.txt | 6 +++--- docs/reports/AT91SAM7X-48-THUMB.txt | 8 ++++---- os/hal/platforms/AT91SAM7/hal_lld.c | 11 ++++++++++- os/kernel/src/chthreads.c | 3 --- readme.txt | 1 + 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/reports/AT91SAM7X-48-ARM.txt b/docs/reports/AT91SAM7X-48-ARM.txt index c7d4c1e40..72f510133 100644 --- a/docs/reports/AT91SAM7X-48-ARM.txt +++ b/docs/reports/AT91SAM7X-48-ARM.txt @@ -5,7 +5,7 @@ Settings: MCK=48.054857, MC_FMR = AT91C_MC_FWS_1FWS (1 wait state) *** ChibiOS/RT test suite *** -*** Kernel: 2.0.4 +*** Kernel: 2.0.5 *** GCC Version: 4.5.1 *** Architecture: ARM *** Core Variant: ARM7TDMI @@ -111,11 +111,11 @@ Settings: MCK=48.054857, MC_FMR = AT91C_MC_FWS_1FWS (1 wait state) --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.5 (Benchmark, threads, full cycle) ---- Score : 65956 threads/S +--- Score : 65594 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.6 (Benchmark, threads, create only) ---- Score : 94130 threads/S +--- Score : 93394 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.7 (Benchmark, mass reschedule, 5 threads) diff --git a/docs/reports/AT91SAM7X-48-THUMB.txt b/docs/reports/AT91SAM7X-48-THUMB.txt index c9c847a85..5ab3f6484 100644 --- a/docs/reports/AT91SAM7X-48-THUMB.txt +++ b/docs/reports/AT91SAM7X-48-THUMB.txt @@ -5,7 +5,7 @@ Settings: MCK=48.054857, MC_FMR = AT91C_MC_FWS_1FWS (1 wait state) *** ChibiOS/RT test suite *** -*** Kernel: 2.0.4 +*** Kernel: 2.0.5 *** GCC Version: 4.5.1 *** Architecture: ARM *** Core Variant: ARM7TDMI @@ -111,11 +111,11 @@ Settings: MCK=48.054857, MC_FMR = AT91C_MC_FWS_1FWS (1 wait state) --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.5 (Benchmark, threads, full cycle) ---- Score : 68329 threads/S +--- Score : 65791 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.6 (Benchmark, threads, create only) ---- Score : 101120 threads/S +--- Score : 95660 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.7 (Benchmark, mass reschedule, 5 threads) @@ -123,7 +123,7 @@ Settings: MCK=48.054857, MC_FMR = AT91C_MC_FWS_1FWS (1 wait state) --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.8 (Benchmark, round robin context switching) ---- Score : 212116 ctxswc/S +--- Score : 212112 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.9 (Benchmark, I/O Queues throughput) diff --git a/os/hal/platforms/AT91SAM7/hal_lld.c b/os/hal/platforms/AT91SAM7/hal_lld.c index f4ccc5650..4412121d2 100644 --- a/os/hal/platforms/AT91SAM7/hal_lld.c +++ b/os/hal/platforms/AT91SAM7/hal_lld.c @@ -112,7 +112,12 @@ void at91sam7_clock_init(void) { AT91C_BASE_RSTC->RSTC_RMR = ((0xA5 << 24) | AT91C_RSTC_URSTEN); /* Flash Memory: 1 wait state, about 50 cycles in a microsecond.*/ +#if SAM7_PLATFORM == SAM7X512 + AT91C_BASE_MC->MC0_FMR = (AT91C_MC_FMCN & (50 << 16)) | AT91C_MC_FWS_1FWS; + AT91C_BASE_MC->MC1_FMR = (AT91C_MC_FMCN & (50 << 16)) | AT91C_MC_FWS_1FWS; +#else AT91C_BASE_MC->MC_FMR = (AT91C_MC_FMCN & (50 << 16)) | AT91C_MC_FWS_1FWS; +#endif /* Enables the main oscillator and waits 56 slow cycles as startup time.*/ AT91C_BASE_PMC->PMC_MOR = (AT91C_CKGR_OSCOUNT & (7 << 8)) | AT91C_CKGR_MOSCEN; @@ -129,7 +134,11 @@ void at91sam7_clock_init(void) { ; /* Master clock = PLLfreq / 2 = 48054858 Hz (rounded).*/ - AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_CSS_PLL_CLK | AT91C_PMC_PRES_CLK_2; + AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2; + while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY)) + ; + + AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK; while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY)) ; } diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c index 1db2d5c10..e7e78f03f 100644 --- a/os/kernel/src/chthreads.c +++ b/os/kernel/src/chthreads.c @@ -123,9 +123,6 @@ static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) { * the initial state is @p THD_STATE_SUSPENDED. * @note A thread can terminate by calling @p chThdExit() or by simply * returning from its main function. - * @note This function can be invoked from within an interrupt handler - * even if it is not an I-Class API because it does not touch - * any critical kernel data structure. * * @param[out] wsp pointer to a working area dedicated to the thread stack * @param[in] size size of the working area diff --git a/readme.txt b/readme.txt index f31b59a5a..cf057a15b 100644 --- a/readme.txt +++ b/readme.txt @@ -59,6 +59,7 @@ ***************************************************************************** *** 2.0.5 *** +- FIX: Incorrect AT91SAM7X initialization, thanks Leszek (bug 3075354). - FIX: Fixed race condition in function chSchGoSleepTimeoutS, thanks Balázs (bug 3074984). - FIX: Fixed race condition in threads creation (bug 3069854).