From 17508d02bba1d47f4cf884b190566e72f69adb4e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 26 Jul 2000 19:26:28 +0000 Subject: Port of RTEMS to the Texas Instruments C3x/C4x DSP families including a BSP (c4xsim) supporting the simulator included with gdb. This port was done by Joel Sherrill and Jennifer Averett of OAR Corporation. Also included with this port is a space/time optimization to eliminate FP context switch management on CPUs without hardware or software FP. An issue with this port was that sizeof(unsigned32) = sizeof(unsigned8) on this CPU. This required addressing alignment checks and assumptions as well as fixing code that assumed sizeof(unsigned32) == 4. --- cpukit/score/cpu/a29k/rtems/score/cpu.h | 1 + cpukit/score/cpu/c4x/.cvsignore | 13 +++++++++++++ cpukit/score/cpu/c4x/rtems/.cvsignore | 2 ++ cpukit/score/cpu/c4x/rtems/score/.cvsignore | 2 ++ cpukit/score/cpu/hppa1.1/rtems/score/cpu.h | 1 + cpukit/score/cpu/i386/rtems/score/cpu.h | 1 + cpukit/score/cpu/i960/rtems/score/cpu.h | 2 ++ cpukit/score/cpu/mips/rtems/score/cpu.h | 1 + cpukit/score/cpu/mips64orion/rtems/score/cpu.h | 1 + cpukit/score/cpu/sh/rtems/score/cpu.h | 1 + cpukit/score/cpu/sparc/rtems/score/cpu.h | 1 + cpukit/score/cpu/unix/rtems/score/cpu.h | 1 + cpukit/score/include/rtems/score/thread.h | 6 ++++++ cpukit/score/inline/rtems/score/address.inl | 4 +++- cpukit/score/inline/rtems/score/thread.inl | 6 ++++++ cpukit/score/macros/rtems/score/address.inl | 6 ++++++ cpukit/score/macros/rtems/score/thread.inl | 11 +++++++++++ 17 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 cpukit/score/cpu/c4x/.cvsignore create mode 100644 cpukit/score/cpu/c4x/rtems/.cvsignore create mode 100644 cpukit/score/cpu/c4x/rtems/score/.cvsignore (limited to 'cpukit/score') diff --git a/cpukit/score/cpu/a29k/rtems/score/cpu.h b/cpukit/score/cpu/a29k/rtems/score/cpu.h index 93528e5d7c..a4330123f2 100644 --- a/cpukit/score/cpu/a29k/rtems/score/cpu.h +++ b/cpukit/score/cpu/a29k/rtems/score/cpu.h @@ -187,6 +187,7 @@ extern void a29k_sigdfl_sup(void); #else #define CPU_HARDWARE_FP FALSE #endif +#define CPU_SOFTWARE_FP FALSE /* * Are all tasks RTEMS_FLOATING_POINT tasks implicitly? diff --git a/cpukit/score/cpu/c4x/.cvsignore b/cpukit/score/cpu/c4x/.cvsignore new file mode 100644 index 0000000000..525275c115 --- /dev/null +++ b/cpukit/score/cpu/c4x/.cvsignore @@ -0,0 +1,13 @@ +Makefile +Makefile.in +aclocal.m4 +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +missing +mkinstalldirs diff --git a/cpukit/score/cpu/c4x/rtems/.cvsignore b/cpukit/score/cpu/c4x/rtems/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/cpukit/score/cpu/c4x/rtems/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/cpukit/score/cpu/c4x/rtems/score/.cvsignore b/cpukit/score/cpu/c4x/rtems/score/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/cpukit/score/cpu/c4x/rtems/score/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/cpukit/score/cpu/hppa1.1/rtems/score/cpu.h b/cpukit/score/cpu/hppa1.1/rtems/score/cpu.h index e5db793923..037226fa21 100644 --- a/cpukit/score/cpu/hppa1.1/rtems/score/cpu.h +++ b/cpukit/score/cpu/hppa1.1/rtems/score/cpu.h @@ -56,6 +56,7 @@ extern "C" { */ #define CPU_HARDWARE_FP TRUE +#define CPU_SOFTWARE_FP FALSE #define CPU_ALL_TASKS_ARE_FP TRUE #define CPU_IDLE_TASK_IS_FP FALSE #define CPU_USE_DEFERRED_FP_SWITCH FALSE diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h index ab256cfa57..a0b7c2c4e2 100644 --- a/cpukit/score/cpu/i386/rtems/score/cpu.h +++ b/cpukit/score/cpu/i386/rtems/score/cpu.h @@ -58,6 +58,7 @@ extern "C" { #else #define CPU_HARDWARE_FP FALSE #endif +#define CPU_SOFTWARE_FP FALSE #define CPU_ALL_TASKS_ARE_FP FALSE #define CPU_IDLE_TASK_IS_FP FALSE diff --git a/cpukit/score/cpu/i960/rtems/score/cpu.h b/cpukit/score/cpu/i960/rtems/score/cpu.h index 71834e6dd2..958e27e87b 100644 --- a/cpukit/score/cpu/i960/rtems/score/cpu.h +++ b/cpukit/score/cpu/i960/rtems/score/cpu.h @@ -58,6 +58,8 @@ extern "C" { #define CPU_HARDWARE_FP FALSE #endif +#define CPU_SOFTWARE_FP FALSE + #define CPU_ALL_TASKS_ARE_FP FALSE #define CPU_IDLE_TASK_IS_FP FALSE #define CPU_USE_DEFERRED_FP_SWITCH TRUE diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h b/cpukit/score/cpu/mips/rtems/score/cpu.h index d7d1b42e0b..35d936ec7e 100644 --- a/cpukit/score/cpu/mips/rtems/score/cpu.h +++ b/cpukit/score/cpu/mips/rtems/score/cpu.h @@ -174,6 +174,7 @@ extern void mips_fatal_error ( int error ); #else #define CPU_HARDWARE_FP FALSE #endif +#define CPU_SOFTWARE_FP FALSE /* * Are all tasks RTEMS_FLOATING_POINT tasks implicitly? diff --git a/cpukit/score/cpu/mips64orion/rtems/score/cpu.h b/cpukit/score/cpu/mips64orion/rtems/score/cpu.h index d7d1b42e0b..35d936ec7e 100644 --- a/cpukit/score/cpu/mips64orion/rtems/score/cpu.h +++ b/cpukit/score/cpu/mips64orion/rtems/score/cpu.h @@ -174,6 +174,7 @@ extern void mips_fatal_error ( int error ); #else #define CPU_HARDWARE_FP FALSE #endif +#define CPU_SOFTWARE_FP FALSE /* * Are all tasks RTEMS_FLOATING_POINT tasks implicitly? diff --git a/cpukit/score/cpu/sh/rtems/score/cpu.h b/cpukit/score/cpu/sh/rtems/score/cpu.h index 43ccf35a73..f6c9252912 100644 --- a/cpukit/score/cpu/sh/rtems/score/cpu.h +++ b/cpukit/score/cpu/sh/rtems/score/cpu.h @@ -132,6 +132,7 @@ extern "C" { */ #define CPU_HARDWARE_FP FALSE +#define CPU_SOFTWARE_FP FALSE /* * Are all tasks RTEMS_FLOATING_POINT tasks implicitly? diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h index 5baf9aac5f..f7fbf121f9 100644 --- a/cpukit/score/cpu/sparc/rtems/score/cpu.h +++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h @@ -105,6 +105,7 @@ extern "C" { #else #define CPU_HARDWARE_FP FALSE #endif +#define CPU_SOFTWARE_FP FALSE /* * Are all tasks FLOATING_POINT tasks implicitly? diff --git a/cpukit/score/cpu/unix/rtems/score/cpu.h b/cpukit/score/cpu/unix/rtems/score/cpu.h index d7019c3eec..7e0cbf7777 100644 --- a/cpukit/score/cpu/unix/rtems/score/cpu.h +++ b/cpukit/score/cpu/unix/rtems/score/cpu.h @@ -158,6 +158,7 @@ extern "C" { */ #define CPU_HARDWARE_FP TRUE +#define CPU_SOFTWARE_FP FALSE /* * Are all tasks RTEMS_FLOATING_POINT tasks implicitly? diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 4c8032f558..99b38e2034 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -119,7 +119,9 @@ typedef struct { Priority_Control initial_priority; /* initial priority */ boolean core_allocated_stack; Stack_Control Initial_stack; /* stack information */ +#if ( CPU_HARDWARE_FP == TRUE ) void *fp_context; /* initial FP context area address */ +#endif void *stack; /* initial stack area address */ } Thread_Start_information; @@ -215,7 +217,9 @@ struct Thread_Control_struct { Priority_Information Priority_map; Thread_Start_information Start; Context_Control Registers; +#if ( CPU_HARDWARE_FP == TRUE ) void *fp_context; +#endif void *API_Extensions[ THREAD_API_LAST + 1 ]; void **extensions; rtems_task_variable_t *task_variables; @@ -308,7 +312,9 @@ SCORE_EXTERN Thread_Control *_Thread_Heir; * context is currently loaded. */ +#if ( CPU_HARDWARE_FP == TRUE ) SCORE_EXTERN Thread_Control *_Thread_Allocated_fp; +#endif /* * _Thread_Handler_initialization diff --git a/cpukit/score/inline/rtems/score/address.inl b/cpukit/score/inline/rtems/score/address.inl index b9a0373aff..54f11c3ca4 100644 --- a/cpukit/score/inline/rtems/score/address.inl +++ b/cpukit/score/inline/rtems/score/address.inl @@ -90,7 +90,9 @@ RTEMS_INLINE_ROUTINE boolean _Addresses_Is_aligned ( void *address ) { -#if defined(RTEMS_CPU_HAS_16_BIT_ADDRESSES) +#if (CPU_ALIGNMENT == 0) + return TRUE; +#elif defined(RTEMS_CPU_HAS_16_BIT_ADDRESSES) return ( ( (unsigned short)address % CPU_ALIGNMENT ) == 0 ); #else return ( ( (unsigned32)address % CPU_ALIGNMENT ) == 0 ); diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl index f1a2410c95..0c98830f76 100644 --- a/cpukit/score/inline/rtems/score/thread.inl +++ b/cpukit/score/inline/rtems/score/thread.inl @@ -111,8 +111,10 @@ RTEMS_INLINE_ROUTINE void _Thread_Unblock ( RTEMS_INLINE_ROUTINE void _Thread_Restart_self( void ) { +#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) if ( _Thread_Executing->fp_context != NULL ) _Context_Restore_fp( &_Thread_Executing->fp_context ); +#endif _CPU_Context_Restart_self( &_Thread_Executing->Registers ); } @@ -144,12 +146,14 @@ RTEMS_INLINE_ROUTINE void _Thread_Calculate_heir( void ) * FALSE otherwise. */ +#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) RTEMS_INLINE_ROUTINE boolean _Thread_Is_allocated_fp ( Thread_Control *the_thread ) { return ( the_thread == _Thread_Allocated_fp ); } +#endif /*PAGE * @@ -161,10 +165,12 @@ RTEMS_INLINE_ROUTINE boolean _Thread_Is_allocated_fp ( * point context is now longer associated with an active thread. */ +#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void ) { _Thread_Allocated_fp = NULL; } +#endif /*PAGE * diff --git a/cpukit/score/macros/rtems/score/address.inl b/cpukit/score/macros/rtems/score/address.inl index 2f14aa633a..10623b1f76 100644 --- a/cpukit/score/macros/rtems/score/address.inl +++ b/cpukit/score/macros/rtems/score/address.inl @@ -51,8 +51,14 @@ * */ +#if (CPU_ALIGNMENT == 0) + (TRUE) +#elif defined(RTEMS_CPU_HAS_16_BIT_ADDRESSES) + ( ( (unsigned short)(_address) % CPU_ALIGNMENT ) == 0 ) #define _Addresses_Is_aligned( _address ) \ ( ( (unsigned32)(_address) % CPU_ALIGNMENT ) == 0 ) +#else +#endif /*PAGE * diff --git a/cpukit/score/macros/rtems/score/thread.inl b/cpukit/score/macros/rtems/score/thread.inl index 26671093b6..749b1c5205 100644 --- a/cpukit/score/macros/rtems/score/thread.inl +++ b/cpukit/score/macros/rtems/score/thread.inl @@ -67,6 +67,7 @@ * */ +#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) #define _Thread_Restart_self() \ { \ if ( _Thread_Executing->fp_context != NULL ) \ @@ -74,6 +75,12 @@ \ _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ } +#else +#define _Thread_Restart_self() \ + { \ + _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ + } +#endif /*PAGE * @@ -96,8 +103,10 @@ * */ +#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) #define _Thread_Is_allocated_fp( _the_thread ) \ ( (_the_thread) == _Thread_Allocated_fp ) +#endif /*PAGE * @@ -105,8 +114,10 @@ * */ +#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) #define _Thread_Deallocate_fp() \ _Thread_Allocated_fp = NULL +#endif /*PAGE * -- cgit v1.2.3