This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: hal_idle_thread_action on ARM
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: Daniel Néri <daniel dot neri at sigicom dot com>
- Cc: ecos-patches at sources dot redhat dot com
- Date: Tue, 24 Jun 2003 09:41:31 +0100
- Subject: Re: hal_idle_thread_action on ARM
- References: <87r89nxbho.fsf@fnord.local.sigicom.com> <3E655589.1070401@eCosCentric.com> <87fznehjqo.fsf@fnord.local.sigicom.com> <m3n0hmol4m.fsf@miso.calivar.com> <87bry2r0x7.fsf@nowhere.mayonnaise.net> <3EED48CE.4090003@eCosCentric.com> <wku1aq763y.fsf@sigicom.com>
Daniel Néri wrote:
Jonathan Larmour <jifl@eCosCentric.com> writes:
Daniel, have you got something yet, or should I just go ahead and do
my own thing?
No, I haven't had time. I'm still using my good old over-complicated
solution ;-)
Ah yes, time. I remember that. Haven't seen much of it about recently.
I'd like to commit the var_io.h patch with it and your subsequent
patch too, but I don't want to interfere with it if you're still
looking at it!
That would be great! Don't let me stop you...
Heh :-). Attached and committed.
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
Index: arch/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/ChangeLog,v
retrieving revision 1.90
diff -u -5 -p -r1.90 ChangeLog
--- arch/current/ChangeLog 6 May 2003 21:00:18 -0000 1.90
+++ arch/current/ChangeLog 24 Jun 2003 08:39:28 -0000
@@ -1,5 +1,14 @@
+2003-06-24 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * include/hal_arch.h: Include plf_arch.h or var_arch.h if platform
+ or variant requires it to do overrides.
+ (HAL_IDLE_THREAD_ACTION): Default to empty statement but allow to be
+ overridden.
+
+ * src/hal_misc.c: Remove hal_idle_thread_action. It's no use.
+
2003-05-06 Pierre Habraken <Pierre.Habraken@imag.fr>
* src/arm_stub.c (target_ins, target_thumb_ins): Added code to
enable stepping into swi instructions.
Index: arch/current/include/hal_arch.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/include/hal_arch.h,v
retrieving revision 1.21
diff -u -5 -p -r1.21 hal_arch.h
--- arch/current/include/hal_arch.h 6 May 2003 21:00:19 -0000 1.21
+++ arch/current/include/hal_arch.h 24 Jun 2003 08:39:29 -0000
@@ -55,10 +55,18 @@
//==========================================================================
#include <pkgconf/hal.h> // To decide on stack usage
#include <cyg/infra/cyg_type.h>
+#ifdef CYGBLD_HAL_ARM_PLF_ARCH_H
+#include <cyg/hal/plf_arch.h>
+#endif
+
+#ifdef CYGBLD_HAL_ARM_VAR_ARCH_H
+#include <cyg/hal/var_arch.h>
+#endif
+
//
// CPSR Register defines
//
#define CPSR_IRQ_DISABLE 0x80 // IRQ disabled when =1
@@ -328,15 +336,16 @@ externC void hal_longjmp(hal_jmp_buf env
//--------------------------------------------------------------------------
// Idle thread code.
// This macro is called in the idle thread loop, and gives the HAL the
// chance to insert code. Typical idle thread behaviour might be to halt the
-// processor.
-
-externC void hal_idle_thread_action(cyg_uint32 loop_count);
+// processor. Here we only supply a default fallback if the variant/platform
+// doesn't define anything.
-#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_)
+#ifndef HAL_IDLE_THREAD_ACTION
+#define HAL_IDLE_THREAD_ACTION(_count_) CYG_EMPTY_STATEMENT
+#endif
//---------------------------------------------------------------------------
// Minimal and sensible stack sizes: the intention is that applications
// will use these to provide a stack size in the first instance prior to
Index: arch/current/src/hal_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/src/hal_misc.c,v
retrieving revision 1.18
diff -u -5 -p -r1.18 hal_misc.c
--- arch/current/src/hal_misc.c 23 May 2002 23:01:42 -0000 1.18
+++ arch/current/src/hal_misc.c 24 Jun 2003 08:39:29 -0000
@@ -212,18 +212,10 @@ hal_arch_default_isr(CYG_ADDRWORD vector
CYG_FAIL("Spurious Interrupt!!!");
return 0;
}
-/*------------------------------------------------------------------------*/
-/* Idle thread action */
-
-void
-hal_idle_thread_action( cyg_uint32 count )
-{
-}
-
/*-------------------------------------------------------------------------*/
/* Misc functions */
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
/* This function will generate a breakpoint exception. It is used at the
Index: at91/var/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/ChangeLog,v
retrieving revision 1.5
diff -u -5 -p -r1.5 ChangeLog
--- at91/var/current/ChangeLog 24 Jun 2003 06:32:39 -0000 1.5
+++ at91/var/current/ChangeLog 24 Jun 2003 08:39:29 -0000
@@ -1,5 +1,17 @@
+2003-06-24 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * include/var_io.h: Remove not seemingly useful AT91_PMC_SCER_CPU.
+
+ * cdl/hal_arm_at91.cdl: We have a var_arch.h so define
+ CYGBLD_HAL_ARM_VAR_ARCH_H.
+
+ * include/var_arch.h: New file containing
+ overrides for hal_arch.h.
+ (HAL_IDLE_THREAD_ACTION): override here by defining power saving modes
+ for idle actions.
+
2003-06-04 Daniel Néri <daniel.neri@sigicom.se>
* src/at91_misc.c (hal_hardware_init): Make sure the AIC internal
priority level stack is flushed.
(hal_IRQ_handler): Calculate active interrupt by dummy read from
Index: at91/var/current/cdl/hal_arm_at91.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/cdl/hal_arm_at91.cdl,v
retrieving revision 1.1
diff -u -5 -p -r1.1 hal_arm_at91.cdl
--- at91/var/current/cdl/hal_arm_at91.cdl 13 May 2003 18:27:59 -0000 1.1
+++ at91/var/current/cdl/hal_arm_at91.cdl 24 Jun 2003 08:39:29 -0000
@@ -68,10 +68,11 @@ cdl_package CYGPKG_HAL_ARM_AT91 {
implements CYGINT_HAL_ARM_THUMB_ARCH
# Let the architectural HAL see this variant's files
define_proc {
puts $::cdl_system_header "#define CYGBLD_HAL_ARM_VAR_IO_H"
+ puts $::cdl_system_header "#define CYGBLD_HAL_ARM_VAR_ARCH_H"
}
cdl_option CYGHWR_HAL_ARM_AT91 {
display "AT91 variant used"
flavor data
Index: at91/var/current/include/var_arch.h
===================================================================
RCS file: at91/var/current/include/var_arch.h
diff -N at91/var/current/include/var_arch.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ at91/var/current/include/var_arch.h 24 Jun 2003 08:39:29 -0000
@@ -0,0 +1,94 @@
+#ifndef CYGONCE_HAL_VAR_ARCH_H
+#define CYGONCE_HAL_VAR_ARCH_H
+//=============================================================================
+//
+// var_arch.h
+//
+// AT91 variant architecture overrides
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003 Jonathan Larmour <jifl@eCosCentric.com>
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting the copyright
+// holders.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jlarmour
+// Contributors: Daniel Neri
+// Date: 2003-06-24
+// Purpose: AT91 variant architecture overrides
+// Description:
+// Usage: #include <cyg/hal/hal_arch.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <cyg/hal/hal_io.h>
+
+//--------------------------------------------------------------------------
+// Idle thread code.
+// This macro is called in the idle thread loop, and gives the HAL the
+// chance to insert code. Typical idle thread behaviour might be to halt the
+// processor. These implementations halt the system core clock.
+
+#ifndef HAL_IDLE_THREAD_ACTION
+
+
+#if defined(CYGHWR_HAL_ARM_AT91_R40807) || \
+ defined(CYGHWR_HAL_ARM_AT91_R40008)
+
+#define HAL_IDLE_THREAD_ACTION(_count_) \
+CYG_MACRO_START \
+ HAL_WRITE_UINT32(AT91_PS+AT91_PS_CR, AT91_PS_CR_CPU); \
+CYG_MACRO_END
+
+#elif defined(CYGHWR_HAL_ARM_AT91_M42800A) || \
+ defined(CYGHWR_HAL_ARM_AT91_M55800A)
+
+#define HAL_IDLE_THREAD_ACTION(_count_) \
+CYG_MACRO_START \
+ HAL_WRITE_UINT32(AT91_PMC+AT91_PMC_SCDR, 1); \
+CYG_MACRO_END
+
+#else
+
+#error Unknown AT91 variant
+
+#endif
+
+#endif
+
+//-----------------------------------------------------------------------------
+// end of var_arch.h
+#endif // CYGONCE_HAL_VAR_ARCH_H
Index: at91/var/current/include/var_io.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/include/var_io.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 var_io.h
--- at91/var/current/include/var_io.h 24 Jun 2003 04:06:49 -0000 1.2
+++ at91/var/current/include/var_io.h 24 Jun 2003 08:39:29 -0000
@@ -393,11 +393,11 @@
#ifndef AT91_PS
#define AT91_PS 0xFFFF4000
#endif
#define AT91_PS_CR 0x000 // Control
-#define AT91_PS_CR_CPU (1<<0) // Disable CPU clock
+#define AT91_PS_CR_CPU (1<<0) // Disable CPU clock (idle mode)
#define AT91_PS_PCER 0x004 // Peripheral clock enable
#define AT91_PS_PCDR 0x008 // Peripheral clock disable
#define AT91_PS_PCSR 0x00c // Peripheral clock status
#elif defined(CYGHWR_HAL_ARM_AT91_M42800A) || \
@@ -410,11 +410,10 @@
#endif
#define AT91_PMC_SCER 0x00
#define AT91_PMC_SCDR 0x04
#define AT91_PMC_SCSR 0x08
-#define AT91_PMC_SCER_CPU 0x01
#define AT91_PMC_PCER 0x10
#define AT91_PMC_PCDR 0x14
#define AT91_PMC_PCSR 0x18