diff options
Diffstat (limited to 'cpukit/score')
116 files changed, 0 insertions, 23250 deletions
diff --git a/cpukit/score/cpu/hppa1.1/cpu.c b/cpukit/score/cpu/hppa1.1/cpu.c deleted file mode 100644 index 48e09b908a..0000000000 --- a/cpukit/score/cpu/hppa1.1/cpu.c +++ /dev/null @@ -1,365 +0,0 @@ -/* - * HP PA-RISC Dependent Source - * - * COPYRIGHT (c) 1994 by Division Incorporated - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Division Incorporated not be - * used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * Division Incorporated makes no representations about the - * suitability of this software for any purpose. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> - -void hppa_external_interrupt_initialize(void); -void hppa_external_interrupt_enable(unsigned32); -void hppa_external_interrupt_disable(unsigned32); -void hppa_external_interrupt(unsigned32, CPU_Interrupt_frame *); -void hppa_cpu_halt(unsigned32); - -/* - * The first level interrupt handler for first 32 interrupts/traps. - * Indexed by vector; generally each entry is _Generic_ISR_Handler. - * Some TLB traps may have their own first level handler. - */ - -extern void _Generic_ISR_Handler(void); -unsigned32 HPPA_first_level_interrupt_handler[HPPA_INTERNAL_INTERRUPTS]; - -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: - * cpu_table - CPU table to initialize - * thread_dispatch - address of disptaching routine - * - */ - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ -) -{ - register unsigned8 *fp_context; - unsigned32 iva; - unsigned32 iva_table; - int i; - - extern void IVA_Table(void); - - /* - * XXX; need to setup fpsr smarter perhaps - */ - - fp_context = (unsigned8*) &_CPU_Null_fp_context; - for (i=0 ; i<sizeof(Context_Control_fp); i++) - *fp_context++ = 0; - - /* - * Set _CPU_Default_gr27 here so it will hopefully be the correct - * global data pointer for the entire system. - */ - - asm volatile( "stw %%r27,%0" : "=m" (_CPU_Default_gr27): ); - - /* - * Init the first level interrupt handlers - */ - - for (i=0; i <= HPPA_INTERNAL_INTERRUPTS; i++) - HPPA_first_level_interrupt_handler[i] = (unsigned32) _Generic_ISR_Handler; - - /* - * Init the 2nd level interrupt handlers - */ - - for (i=0; i <= CPU_INTERRUPT_NUMBER_OF_VECTORS; i++) - _ISR_Vector_table[i] = (ISR_Handler_entry) hppa_cpu_halt; - - /* - * Stabilize the interrupt stuff - */ - - (void) hppa_external_interrupt_initialize(); - - /* - * Set the IVA to point to physical address of the IVA_Table - */ - - iva_table = (unsigned32) IVA_Table; -#if defined(hppa1_1) - /* - * HACK: (from PA72000 TRM, page 4-19) - * "The hardware TLB miss handler will never attempt to service - * a non-access TLB miss or a TLB protection violation. It - * will only attempt to service TLB accesses that would cause - * Trap Numbers 6 (Instruction TLB miss) and 15 (Data TLB miss)." - * - * The LPA instruction is used to translate a virtual address to - * a physical address, however, if the requested virtual address - * is not currently resident in the TLB, the hardware TLB miss - * handler will NOT insert it. In this situation Trap Number - * #17 is invoked (Non-access Data TLB miss fault). - * - * To work around this, a dummy data access is first performed - * to the virtual address prior to the LPA. The dummy access - * causes the TLB entry to be inserted (if not already present) - * and then the following LPA instruction will not generate - * a non-access data TLB miss fault. - * - * It is unclear whether or not this behaves the same way for - * the PA8000. - * - */ - iva = *(volatile unsigned32 *)iva_table; /* dummy access */ -#endif - - HPPA_ASM_LPA(0, iva_table, iva); - set_iva(iva); - - _CPU_Table = *cpu_table; -} - -/*PAGE - * - * _CPU_ISR_Get_level - */ - -unsigned32 _CPU_ISR_Get_level(void) -{ - int level; - HPPA_ASM_SSM(0, level); /* change no bits; just get copy */ - if (level & HPPA_PSW_I) - return 0; - return 1; -} - -/*PAGE - * - * _CPU_ISR_install_raw_handler - */ - -void _CPU_ISR_install_raw_handler( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - /* - * This is unsupported. - */ - - _CPU_Fatal_halt( 0xdeaddead ); -} - -/*PAGE - * - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * old_handler - former ISR for this vector number - * new_handler - replacement ISR for this vector number - * - * Output parameters: NONE - * - */ - -/* - * HPPA has 8w for each vector instead of an address to jump to. - * We put the actual ISR address in '_ISR_vector_table'. This will - * be pulled by the code in the vector. - */ - -void _CPU_ISR_install_vector( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - *old_handler = _ISR_Vector_table[vector]; - - _ISR_Vector_table[vector] = new_handler; - - if (vector >= HPPA_INTERRUPT_EXTERNAL_BASE) - { - unsigned32 external_vector; - - external_vector = vector - HPPA_INTERRUPT_EXTERNAL_BASE; - if (new_handler) - hppa_external_interrupt_enable(external_vector); - else - /* XXX this can never happen due to _ISR_Is_valid_user_handler */ - hppa_external_interrupt_disable(external_vector); - } -} - - -/* - * Support for external and spurious interrupts on HPPA - * - * TODO: - * Count interrupts - * make sure interrupts disabled properly - */ - -#define DISMISS(mask) set_eirr(mask) -#define DISABLE(mask) set_eiem(get_eiem() & ~(mask)) -#define ENABLE(mask) set_eiem(get_eiem() | (mask)) -#define VECTOR_TO_MASK(v) (1 << (31 - (v))) - -/* - * Init the external interrupt scheme - * called by bsp_start() - */ - -void -hppa_external_interrupt_initialize(void) -{ - proc_ptr ignore; - - /* mark them all unused */ - DISABLE(~0); - DISMISS(~0); - - /* install the external interrupt handler */ - _CPU_ISR_install_vector( - HPPA_INTERRUPT_EXTERNAL_INTERRUPT, - (proc_ptr)hppa_external_interrupt, &ignore -); -} - -/* - * Enable a specific external interrupt - */ - -void -hppa_external_interrupt_enable(unsigned32 v) -{ - unsigned32 isrlevel; - - _CPU_ISR_Disable(isrlevel); - ENABLE(VECTOR_TO_MASK(v)); - _CPU_ISR_Enable(isrlevel); -} - -/* - * Does not clear or otherwise affect any pending requests - */ - -void -hppa_external_interrupt_disable(unsigned32 v) -{ - unsigned32 isrlevel; - - _CPU_ISR_Disable(isrlevel); - DISABLE(VECTOR_TO_MASK(v)); - _CPU_ISR_Enable(isrlevel); -} - -void -hppa_external_interrupt_spurious_handler(unsigned32 vector, - CPU_Interrupt_frame *iframe) -{ -/* XXX should not be printing :) - printf("spurious external interrupt: %d at pc 0x%x; disabling\n", - vector, iframe->Interrupt.pcoqfront); -*/ -} - -void -hppa_external_interrupt_report_spurious(unsigned32 spurious_mask, - CPU_Interrupt_frame *iframe) -{ - int v; - for (v=0; v < HPPA_EXTERNAL_INTERRUPTS; v++) - if (VECTOR_TO_MASK(v) & spurious_mask) - { - DISMISS(VECTOR_TO_MASK(v)); - DISABLE(VECTOR_TO_MASK(v)); - hppa_external_interrupt_spurious_handler(v, iframe); - } - DISMISS(spurious_mask); -} - - -/* - * External interrupt handler. - * This is installed as cpu interrupt handler for - * HPPA_INTERRUPT_EXTERNAL_INTERRUPT. It vectors out to - * specific external interrupt handlers. - */ - -void -hppa_external_interrupt(unsigned32 vector, - CPU_Interrupt_frame *iframe) -{ - unsigned32 mask; - unsigned32 *vp, *max_vp; - unsigned32 external_vector; - unsigned32 global_vector; - hppa_rtems_isr_entry handler; - - max_vp = &_CPU_Table.external_interrupt[_CPU_Table.external_interrupts]; - while ( (mask = (get_eirr() & get_eiem())) ) - { - for (vp = _CPU_Table.external_interrupt; (vp < max_vp) && mask; vp++) - { - unsigned32 m; - - external_vector = *vp; - global_vector = external_vector + HPPA_INTERRUPT_EXTERNAL_BASE; - m = VECTOR_TO_MASK(external_vector); - handler = (hppa_rtems_isr_entry) _ISR_Vector_table[global_vector]; - if ((m & mask) && handler) - { - DISMISS(m); - mask &= ~m; - handler(global_vector, iframe); - } - } - - if (mask != 0) { - if ( _CPU_Table.spurious_handler ) - { - handler = (hppa_rtems_isr_entry) _CPU_Table.spurious_handler; - handler(mask, iframe); - } - else - hppa_external_interrupt_report_spurious(mask, iframe); - } - } -} - -/* - * Halt the system. - * Called by the _CPU_Fatal_halt macro - * - * XXX - * Later on, this will allow us to return to the prom. - * For now, we just ignore 'type_of_halt' - */ - -void -hppa_cpu_halt(unsigned32 the_error) -{ - unsigned32 isrlevel; - - _CPU_ISR_Disable(isrlevel); - - HPPA_ASM_LABEL("_hppa_cpu_halt"); - HPPA_ASM_BREAK(1, 0); -} diff --git a/cpukit/score/cpu/i386/asm.h b/cpukit/score/cpu/i386/asm.h deleted file mode 100644 index e317161043..0000000000 --- a/cpukit/score/cpu/i386/asm.h +++ /dev/null @@ -1,140 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. This file is: - * - * COPYRIGHT (c) 1994. - * On-Line Applications Research Corporation (OAR). - * - * $Id$ - */ - -#ifndef __i386_ASM_h -#define __i386_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM -#include <rtems/score/i386.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -/* - * Go32 suffers the same bug as __REGISTER_PREFIX__ - */ - -#if __GO32__ -#undef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -/* - * Looks like there is a bug in gcc 2.6.2 where this is not - * defined correctly when configured as i386-coff and - * i386-aout. - */ - -#undef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ % - -/* -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif -*/ - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -#define eax REG (eax) -#define ebx REG (ebx) -#define ecx REG (ecx) -#define edx REG (edx) -#define esi REG (esi) -#define edi REG (edi) -#define esp REG (esp) -#define ebp REG (ebp) - -#define ax REG (ax) -#define bx REG (bx) -#define cx REG (cx) -#define dx REG (dx) -#define si REG (si) -#define di REG (di) -#define sp REG (sp) -#define bp REG (bp) - -#define ah REG (ah) -#define al REG (al) - -#define cs REG (cs) -#define ds REG (ds) -#define es REG (es) -#define fs REG (fs) -#define gs REG (gs) -#define ss REG (ss) - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c deleted file mode 100644 index ad9c56e20a..0000000000 --- a/cpukit/score/cpu/i386/cpu.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Intel i386 Dependent Source - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> - -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: - * cpu_table - CPU table to initialize - * thread_dispatch - address of disptaching routine - */ - - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ -) -{ - register unsigned16 fp_status asm ("ax"); - register void *fp_context; - - _CPU_Table = *cpu_table; - - /* - * The following code saves a NULL i387 context which is given - * to each task at start and restart time. The following code - * is based upon that provided in the i386 Programmer's - * Manual and should work on any coprocessor greater than - * the i80287. - * - * NOTE: The NO RTEMS_WAIT form of the coprocessor instructions - * MUST be used in case there is not a coprocessor - * to wait for. - */ - - fp_status = 0xa5a5; - asm volatile( "fninit" ); - asm volatile( "fnstsw %0" : "=a" (fp_status) : "0" (fp_status) ); - - if ( fp_status == 0 ) { - - fp_context = &_CPU_Null_fp_context; - - asm volatile( "fsave (%0)" : "=r" (fp_context) - : "0" (fp_context) - ); - } -} - -/*PAGE - * - * _CPU_ISR_Get_level - */ - -unsigned32 _CPU_ISR_Get_level( void ) -{ - unsigned32 level; - - i386_get_interrupt_level( level ); - - return level; -} - -/*PAGE - * - * _CPU_ISR_install_raw_handler - */ - -#if __GO32__ -#include <go32.h> -#include <dpmi.h> -#endif /* __GO32__ */ - -void _CPU_ISR_install_raw_handler( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ -#if __GO32__ - _go32_dpmi_seginfo handler_info; - - /* get the address of the old handler */ - _go32_dpmi_get_protected_mode_interrupt_vector( vector, &handler_info); - - /* Notice how we're failing to save the pm_segment portion of the */ - /* structure here? That means we might crash the system if we */ - /* try to restore the ISR. Can't fix this until i386_isr is */ - /* redefined. XXX [BHC]. */ - *old_handler = (proc_ptr *) handler_info.pm_offset; - - handler_info.pm_offset = (u_long) new_handler; - handler_info.pm_selector = _go32_my_cs(); - - /* install the IDT entry */ - _go32_dpmi_set_protected_mode_interrupt_vector( vector, &handler_info ); -#else - i386_IDT_slot idt; - unsigned32 handler; - - *old_handler = 0; /* XXX not supported */ - - handler = (unsigned32) new_handler; - - /* build the IDT entry */ - idt.offset_0_15 = handler & 0xffff; - idt.segment_selector = i386_get_cs(); - idt.reserved = 0x00; - idt.p_dpl = 0x8e; /* present, ISR */ - idt.offset_16_31 = handler >> 16; - - /* install the IDT entry */ - i386_Install_idt( - (unsigned32) &idt, - _CPU_Table.interrupt_table_segment, - (unsigned32) _CPU_Table.interrupt_table_offset + (8 * vector) - ); -#endif -} - -/*PAGE - * - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * old_handler - former ISR for this vector number - * new_handler - replacement ISR for this vector number - * - * Output parameters: NONE - * - */ - -void _ISR_Handler_0(), _ISR_Handler_1(); - -#define PER_ISR_ENTRY \ - (((unsigned32) _ISR_Handler_1 - (unsigned32) _ISR_Handler_0)) - -#define _Interrupt_Handler_entry( _vector ) \ - (((unsigned32)_ISR_Handler_0) + ((_vector) * PER_ISR_ENTRY)) - -void _CPU_ISR_install_vector( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - proc_ptr ignored; - unsigned32 unique_handler; - - *old_handler = _ISR_Vector_table[ vector ]; - - /* calculate the unique entry point for this vector */ - unique_handler = _Interrupt_Handler_entry( vector ); - - _CPU_ISR_install_raw_handler( vector, (void *)unique_handler, &ignored ); - - _ISR_Vector_table[ vector ] = new_handler; -} diff --git a/cpukit/score/cpu/i386/rtems/asm.h b/cpukit/score/cpu/i386/rtems/asm.h deleted file mode 100644 index e317161043..0000000000 --- a/cpukit/score/cpu/i386/rtems/asm.h +++ /dev/null @@ -1,140 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. This file is: - * - * COPYRIGHT (c) 1994. - * On-Line Applications Research Corporation (OAR). - * - * $Id$ - */ - -#ifndef __i386_ASM_h -#define __i386_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM -#include <rtems/score/i386.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -/* - * Go32 suffers the same bug as __REGISTER_PREFIX__ - */ - -#if __GO32__ -#undef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -/* - * Looks like there is a bug in gcc 2.6.2 where this is not - * defined correctly when configured as i386-coff and - * i386-aout. - */ - -#undef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ % - -/* -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif -*/ - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -#define eax REG (eax) -#define ebx REG (ebx) -#define ecx REG (ecx) -#define edx REG (edx) -#define esi REG (esi) -#define edi REG (edi) -#define esp REG (esp) -#define ebp REG (ebp) - -#define ax REG (ax) -#define bx REG (bx) -#define cx REG (cx) -#define dx REG (dx) -#define si REG (si) -#define di REG (di) -#define sp REG (sp) -#define bp REG (bp) - -#define ah REG (ah) -#define al REG (al) - -#define cs REG (cs) -#define ds REG (ds) -#define es REG (es) -#define fs REG (fs) -#define gs REG (gs) -#define ss REG (ss) - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/i960/asm.h b/cpukit/score/cpu/i960/asm.h deleted file mode 100644 index 803f42f649..0000000000 --- a/cpukit/score/cpu/i960/asm.h +++ /dev/null @@ -1,107 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. This file is: - * - * COPYRIGHT (c) 1994. - * On-Line Applications Research Corporation (OAR). - * - * $Id$ - */ - -#ifndef __i960_ASM_h -#define __i960_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM -#include <rtems/score/i960.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -#define g0 REG (g0) -#define g1 REG (g1) -#define g2 REG (g2) -#define g3 REG (g3) -#define g4 REG (g4) -#define g5 REG (g5) -#define g6 REG (g6) -#define g7 REG (g7) -#define g8 REG (g8) -#define g9 REG (g9) -#define g10 REG (g10) -#define g11 REG (g11) -#define g12 REG (g12) -#define g13 REG (g13) -#define g14 REG (g14) -#define g15 REG (g15) - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -#endif -/* end of include file */ diff --git a/cpukit/score/cpu/i960/cpu.c b/cpukit/score/cpu/i960/cpu.c deleted file mode 100644 index e55a400c40..0000000000 --- a/cpukit/score/cpu/i960/cpu.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Intel i960CA Dependent Source - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA) -#else -#warning "*** ENTIRE FILE IMPLEMENTED & TESTED FOR CA ONLY ***" -#warning "*** THIS FILE WILL NOT COMPILE ON ANOTHER FAMILY MEMBER ***" -#endif - -#include <rtems/system.h> -#include <rtems/score/isr.h> - -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: - * cpu_table - CPU table to initialize - * thread_dispatch - address of disptaching routine - * - * OUTPUT PARAMETERS: NONE - */ - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ -) -{ - - _CPU_Table = *cpu_table; - -} - -/*PAGE - * - * _CPU_ISR_Get_level - */ - -unsigned32 _CPU_ISR_Get_level( void ) -{ - unsigned32 level; - - i960_get_interrupt_level( level ); - - return level; -} - -/*PAGE - * - * _CPU_ISR_install_raw_handler - */ - -#define _Is_vector_caching_enabled( _prcb ) \ - ((_prcb)->control_tbl->icon & 0x2000) - -void _CPU_ISR_install_raw_handler( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - i960ca_PRCB *prcb = _CPU_Table.Prcb; - proc_ptr *cached_intr_tbl = NULL; - - /* The i80960CA does not support vectors 0-7. The first 9 entries - * in the Interrupt Table are used to manage pending interrupts. - * Thus vector 8, the first valid vector number, is actually in - * slot 9 in the table. - */ - - *old_handler = prcb->intr_tbl[ vector + 1 ]; - - prcb->intr_tbl[ vector + 1 ] = new_handler; - - if ( _Is_vector_caching_enabled( prcb ) ) - if ( (vector & 0xf) == 0x2 ) /* cacheable? */ - cached_intr_tbl[ vector >> 4 ] = new_handler; -} - -/*PAGE - * - * _CPU__ISR_install_vector - * - * Install the RTEMS vector wrapper in the CPU's interrupt table. - * - * Input parameters: - * vector - interrupt vector number - * old_handler - former ISR for this vector number - * new_handler - replacement ISR for this vector number - * - * Output parameters: NONE - * - */ - -void _CPU_ISR_install_vector( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - proc_ptr ignored; - - *old_handler = _ISR_Vector_table[ vector ]; - - _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored ); - - _ISR_Vector_table[ vector ] = new_handler; -} - -/*PAGE - * - * _CPU_Install_interrupt_stack - */ - -#define soft_reset( prcb ) \ - { register i960ca_PRCB *_prcb = (prcb); \ - register unsigned32 *_next=0; \ - register unsigned32 _cmd = 0x30000; \ - asm volatile( "lda next,%1; \ - sysctl %0,%1,%2; \ - next: mov g0,g0" \ - : "=d" (_cmd), "=d" (_next), "=d" (_prcb) \ - : "0" (_cmd), "1" (_next), "2" (_prcb) ); \ - } - -void _CPU_Install_interrupt_stack( void ) -{ - i960ca_PRCB *prcb = _CPU_Table.Prcb; - unsigned32 level; - - /* - * Set the Interrupt Stack in the PRCB and force a reload of it. - * Interrupts are disabled for safety. - */ - - _CPU_ISR_Disable( level ); - - prcb->intr_stack = _CPU_Interrupt_stack_low; - - soft_reset( prcb ); - - _CPU_ISR_Enable( level ); -} diff --git a/cpukit/score/cpu/m68k/asm.h b/cpukit/score/cpu/m68k/asm.h deleted file mode 100644 index 4c53980d51..0000000000 --- a/cpukit/score/cpu/m68k/asm.h +++ /dev/null @@ -1,129 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. This file is: - * - * COPYRIGHT (c) 1994. - * On-Line Applications Research Corporation (OAR). - * - * $Id$ - */ - -#ifndef __M68k_ASM_h -#define __M68k_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM -#include <rtems/score/m68k.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -#define d0 REG (d0) -#define d1 REG (d1) -#define d2 REG (d2) -#define d3 REG (d3) -#define d4 REG (d4) -#define d5 REG (d5) -#define d6 REG (d6) -#define d7 REG (d7) -#define a0 REG (a0) -#define a1 REG (a1) -#define a2 REG (a2) -#define a3 REG (a3) -#define a4 REG (a4) -#define a5 REG (a5) -#define a6 REG (a6) -#define a7 REG (a7) - -#define msp REG (msp) -#define usp REG (usp) -#define isp REG (isp) -#define sr REG (sr) -#define vbr REG (vbr) -#define dfc REG (dfc) - -#define fp0 REG (fp0) -#define fp1 REG (fp1) -#define fp2 REG (fp2) -#define fp3 REG (fp3) -#define fp4 REG (fp4) -#define fp5 REG (fp5) -#define fp6 REG (fp6) -#define fp7 REG (fp7) - -#define fpc REG (fpc) -#define fpi REG (fpi) -#define fps REG (fps) - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/m68k/cpu.c b/cpukit/score/cpu/m68k/cpu.c deleted file mode 100644 index f57fae6685..0000000000 --- a/cpukit/score/cpu/m68k/cpu.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Motorola MC68xxx Dependent Source - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> - -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: - * cpu_table - CPU table to initialize - * thread_dispatch - entry pointer to thread dispatcher - * - * OUTPUT PARAMETERS: NONE - */ - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ -) -{ - _CPU_Table = *cpu_table; -} - -/*PAGE - * - * _CPU_ISR_Get_level - */ - -unsigned32 _CPU_ISR_Get_level( void ) -{ - unsigned32 level; - - m68k_get_interrupt_level( level ); - - return level; -} - -/*PAGE - * - * _CPU_ISR_install_raw_handler - */ - -void _CPU_ISR_install_raw_handler( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - proc_ptr *interrupt_table = NULL; - - m68k_get_vbr( interrupt_table ); - -#if ( M68K_HAS_VBR == 1) - *old_handler = interrupt_table[ vector ]; - interrupt_table[ vector ] = new_handler; -#else - *old_handler = *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10); - *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10) = new_handler; -#endif /* M68K_HAS_VBR */ -} - -/*PAGE - * - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * new_handler - replacement ISR for this vector number - * old_handler - former ISR for this vector number - * - * Output parameters: NONE - */ - -void _CPU_ISR_install_vector( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - proc_ptr ignored; - - *old_handler = _ISR_Vector_table[ vector ]; - - _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored ); - - _ISR_Vector_table[ vector ] = new_handler; -} - - -/*PAGE - * - * _CPU_Install_interrupt_stack - */ - -void _CPU_Install_interrupt_stack( void ) -{ -#if ( M68K_HAS_SEPARATE_STACKS == 1 ) - void *isp = _CPU_Interrupt_stack_high; - - asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) ); -#else -#warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!" -#endif -} - -#if ( M68K_HAS_BFFFO != 1 ) -/* - * Returns table for duplication of the BFFFO instruction (16 bits only) - */ -const unsigned char __BFFFOtable[256] = { - 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; -#endif diff --git a/cpukit/score/cpu/m68k/m68302.h b/cpukit/score/cpu/m68k/m68302.h deleted file mode 100644 index da96478cf3..0000000000 --- a/cpukit/score/cpu/m68k/m68302.h +++ /dev/null @@ -1,608 +0,0 @@ -/* - *------------------------------------------------------------------ - * - * m68302.h - Definitions for Motorola MC68302 processor. - * - * Section references in this file refer to revision 2 of Motorola's - * "MC68302 Integrated Multiprotocol Processor User's Manual". - * (Motorola document MC68302UM/AD REV 2.) - * - * Based on Don Meyer's cpu68302.h that was posted in comp.sys.m68k - * on 17 February, 1993. - * - * Copyright 1995 David W. Glessner. - * - * Redistribution and use in source and binary forms are permitted - * provided that the following conditions are met: - * 1. Redistribution of source code and documentation must retain - * the above copyright notice, this list of conditions and the - * following disclaimer. - * 2. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * This software is provided "AS IS" without warranty of any kind, - * either expressed or implied, including, but not limited to, the - * implied warranties of merchantability, title and fitness for a - * particular purpose. - * - * - * $Id$ - * - *------------------------------------------------------------------ - */ - -#ifndef __MOTOROLA_MC68302_DEFINITIONS_h -#define __MOTOROLA_MC68302_DEFINITIONS_h - -/* - * BAR - Base Address Register - * Section 2.7 - */ -#define M302_BAR (*((volatile rtems_unsigned16 *) 0xf2)) - -/* - * SCR - System Control Register - * Section 3.8.1 - */ -#define M302_SCR (*((volatile rtems_unsigned32 *) 0xf4)) -/* - * SCR bits - */ -#define RBIT_SCR_IPA 0x08000000 -#define RBIT_SCR_HWT 0x04000000 -#define RBIT_SCR_WPV 0x02000000 -#define RBIT_SCR_ADC 0x01000000 - -#define RBIT_SCR_ERRE 0x00400000 -#define RBIT_SCR_VGE 0x00200000 -#define RBIT_SCR_WPVE 0x00100000 -#define RBIT_SCR_RMCST 0x00080000 -#define RBIT_SCR_EMWS 0x00040000 -#define RBIT_SCR_ADCE 0x00020000 -#define RBIT_SCR_BCLM 0x00010000 - -#define RBIT_SCR_FRZW 0x00008000 -#define RBIT_SCR_FRZ2 0x00004000 -#define RBIT_SCR_FRZ1 0x00002000 -#define RBIT_SCR_SAM 0x00001000 -#define RBIT_SCR_HWDEN 0x00000800 -#define RBIT_SCR_HWDCN2 0x00000400 -#define RBIT_SCR_HWDCN1 0x00000200 -#define RBIT_SCR_HWDCN0 0x00000100 - -#define RBIT_SCR_LPREC 0x00000080 -#define RBIT_SCR_LPP16 0x00000040 -#define RBIT_SCR_LPEN 0x00000020 -#define RBIT_SCR_LPCLKDIV 0x0000001f - - -/* - * 68000 interrupt and trap vector numbers - */ -#define M68K_IVEC_BUS_ERROR 2 -#define M68K_IVEC_ADDRESS_ERROR 3 -#define M68K_IVEC_ILLEGAL_OPCODE 4 -#define M68K_IVEC_ZERO_DIVIDE 5 -#define M68K_IVEC_CHK 6 -#define M68K_IVEC_TRAPV 7 -#define M68K_IVEC_PRIVILEGE 8 -#define M68K_IVEC_TRACE 9 -#define M68K_IVEC_LINE_A 10 -#define M68K_IVEC_LINE_F 11 -/* Unassigned, Reserved 12-14 */ -#define M68K_IVEC_UNINITIALIZED_INT 15 -/* Unassigned, Reserved 16-23 */ -#define M68K_IVEC_SPURIOUS_INT 24 - -#define M68K_IVEC_LEVEL1_AUTOVECTOR 25 -#define M68K_IVEC_LEVEL2_AUTOVECTOR 26 -#define M68K_IVEC_LEVEL3_AUTOVECTOR 27 -#define M68K_IVEC_LEVEL4_AUTOVECTOR 28 -#define M68K_IVEC_LEVEL5_AUTOVECTOR 29 -#define M68K_IVEC_LEVEL6_AUTOVECTOR 30 -#define M68K_IVEC_LEVEL7_AUTOVECTOR 31 - -#define M68K_IVEC_TRAP0 32 -#define M68K_IVEC_TRAP1 33 -#define M68K_IVEC_TRAP2 34 -#define M68K_IVEC_TRAP3 35 -#define M68K_IVEC_TRAP4 36 -#define M68K_IVEC_TRAP5 37 -#define M68K_IVEC_TRAP6 38 -#define M68K_IVEC_TRAP7 39 -#define M68K_IVEC_TRAP8 40 -#define M68K_IVEC_TRAP9 41 -#define M68K_IVEC_TRAP10 42 -#define M68K_IVEC_TRAP11 43 -#define M68K_IVEC_TRAP12 44 -#define M68K_IVEC_TRAP13 45 -#define M68K_IVEC_TRAP14 46 -#define M68K_IVEC_TRAP15 47 -/* - * Unassigned, Reserved 48-59 - * - * Note: Vectors 60-63 are used by the MC68302 (e.g. BAR, SCR). - */ - -/* - * MC68302 Interrupt Vectors - * Section 3.2 - */ -enum m68302_ivec_e { - M302_IVEC_ERR =0, - M302_IVEC_PB8 =1, /* General-Purpose Interrupt 0 */ - M302_IVEC_SMC2 =2, - M302_IVEC_SMC1 =3, - M302_IVEC_TIMER3 =4, - M302_IVEC_SCP =5, - M302_IVEC_TIMER2 =6, - M302_IVEC_PB9 =7, /* General-Purpose Interrupt 1 */ - M302_IVEC_SCC3 =8, - M302_IVEC_TIMER1 =9, - M302_IVEC_SCC2 =10, - M302_IVEC_IDMA =11, - M302_IVEC_SDMA =12, /* SDMA Channels Bus Error */ - M302_IVEC_SCC1 =13, - M302_IVEC_PB10 =14, /* General-Purpose Interrupt 2 */ - M302_IVEC_PB11 =15, /* General-Purpose Interrupt 3 */ - M302_IVEC_IRQ1 =17, /* External Device */ - M302_IVEC_IRQ6 =22, /* External Device */ - M302_IVEC_IRQ7 =23 /* External Device */ -}; - - -/* - * GIMR - Global Interrupt Mode Register - * Section 3.2.5.1 - */ -#define RBIT_GIMR_MOD (1<<15) -#define RBIT_GIMR_IV7 (1<<14) -#define RBIT_GIMR_IV6 (1<<13) -#define RBIT_GIMR_IV1 (1<<12) -#define RBIT_GIMR_ET7 (1<<10) -#define RBIT_GIMR_ET6 (1<<9) -#define RBIT_GIMR_ET1 (1<<8) -#define RBIT_GIMR_VECTOR (7<<5) - -/* - * IPR - Interrupt Pending Register (Section 3.2.5.2) - * IMR - Interrupt Mask Register (Section 3.2.5.3) - * ISR - Interrupt In-Service Register (Section 3.2.5.4) - */ -#define RBIT_IPR_PB11 (1<<15) -#define RBIT_IPR_PB10 (1<<14) -#define RBIT_IPR_SCC1 (1<<13) -#define RBIT_IPR_SDMA (1<<12) -#define RBIT_IPR_IDMA (1<<11) -#define RBIT_IPR_SCC2 (1<<10) -#define RBIT_IPR_TIMER1 (1<<9) -#define RBIT_IPR_SCC3 (1<<8) -#define RBIT_IPR_PB9 (1<<7) -#define RBIT_IPR_TIMER2 (1<<6) -#define RBIT_IPR_SCP (1<<5) -#define RBIT_IPR_TIMER3 (1<<4) -#define RBIT_IPR_SMC1 (1<<3) -#define RBIT_IPR_SMC2 (1<<2) -#define RBIT_IPR_PB8 (1<<1) -#define RBIT_IPR_ERR (1<<0) - -#define RBIT_ISR_PB11 (1<<15) -#define RBIT_ISR_PB10 (1<<14) -#define RBIT_ISR_SCC1 (1<<13) -#define RBIT_ISR_SDMA (1<<12) -#define RBIT_ISR_IDMA (1<<11) -#define RBIT_ISR_SCC2 (1<<10) -#define RBIT_ISR_TIMER1 (1<<9) -#define RBIT_ISR_SCC3 (1<<8) -#define RBIT_ISR_PB9 (1<<7) -#define RBIT_ISR_TIMER2 (1<<6) -#define RBIT_ISR_SCP (1<<5) -#define RBIT_ISR_TIMER3 (1<<4) -#define RBIT_ISR_SMC1 (1<<3) -#define RBIT_ISR_SMC2 (1<<2) -#define RBIT_ISR_PB8 (1<<1) - -#define RBIT_IMR_PB11 (1<<15) /* PB11 Interrupt Mask */ -#define RBIT_IMR_PB10 (1<<14) /* PB10 Interrupt Mask */ -#define RBIT_IMR_SCC1 (1<<13) /* SCC1 Interrupt Mask */ -#define RBIT_IMR_SDMA (1<<12) /* SDMA Interrupt Mask */ -#define RBIT_IMR_IDMA (1<<11) /* IDMA Interrupt Mask */ -#define RBIT_IMR_SCC2 (1<<10) /* SCC2 Interrupt Mask */ -#define RBIT_IMR_TIMER1 (1<<9) /* TIMER1 Interrupt Mask */ -#define RBIT_IMR_SCC3 (1<<8) /* SCC3 Interrupt Mask */ -#define RBIT_IMR_PB9 (1<<7) /* PB9 Interrupt Mask */ -#define RBIT_IMR_TIMER2 (1<<6) /* TIMER2 Interrupt Mask */ -#define RBIT_IMR_SCP (1<<5) /* SCP Interrupt Mask */ -#define RBIT_IMR_TIMER3 (1<<4) /* TIMER3 Interrupt Mask */ -#define RBIT_IMR_SMC1 (1<<3) /* SMC1 Interrupt Mask */ -#define RBIT_IMR_SMC2 (1<<2) /* SMC2 Interrupt Mask */ -#define RBIT_IMR_PB8 (1<<1) /* PB8 Interrupt Mask */ - - -/* - * DRAM Refresh - * Section 3.9 - * - * The DRAM refresh memory map replaces the SCC2 Tx BD 6 and Tx BD 7 - * structures in the parameter RAM. - * - * Access to the DRAM registers can be accomplished by - * the following approach: - * - * volatile m302_DRAM_refresh_t *dram; - * dram = (volatile m302_DRAM_refresh_t *) &m302.scc2.bd.tx[6]; - * - * Then simply use pointer references (e.g. dram->count = 3). - */ -typedef struct { - rtems_unsigned16 dram_high; /* DRAM high address and FC */ - rtems_unsigned16 dram_low; /* DRAM low address */ - rtems_unsigned16 increment; /* increment step (bytes/row) */ - rtems_unsigned16 count; /* RAM refresh cycle count (#rows) */ - rtems_unsigned16 t_ptr_h; /* temporary refresh high addr & FC */ - rtems_unsigned16 t_ptr_l; /* temporary refresh low address */ - rtems_unsigned16 t_count; /* temporary refresh cycles count */ - rtems_unsigned16 res; /* reserved */ -} m302_DRAM_refresh_t; - - -/* - * TMR - Timer Mode Register (for timers 1 and 2) - * Section 3.5.2.1 - */ -#define RBIT_TMR_ICLK_STOP (0<<1) -#define RBIT_TMR_ICLK_MASTER (1<<1) -#define RBIT_TMR_ICLK_MASTER16 (2<<1) -#define RBIT_TMR_ICLK_TIN (3<<1) - -#define RBIT_TMR_OM (1<<5) -#define RBIT_TMR_ORI (1<<4) -#define RBIT_TMR_FRR (1<<3) -#define RBIT_TMR_RST (1<<0) - - -/* - * TER - Timer Event Register (for timers 1 and 2) - * Section 3.5.2.5 - */ -#define RBIT_TER_REF (1<<1) /* Output Reference Event */ -#define RBIT_TER_CAP (1<<0) /* Capture Event */ - - -/* - * SCC Buffer Descriptors and Buffer Descriptors Table - * Section 4.5.5 - */ -typedef struct m302_SCC_bd { - rtems_unsigned16 status; /* status and control */ - rtems_unsigned16 length; /* data length */ - rtems_unsigned8 *buffer; /* data buffer pointer */ -} m302_SCC_bd_t; - -typedef struct { - m302_SCC_bd_t rx[8]; /* receive buffer descriptors */ - m302_SCC_bd_t tx[8]; /* transmit buffer descriptors */ -} m302_SCC_bd_table_t; - - -/* - * SCC Parameter RAM (offset 0x080 from an SCC Base) - * Section 4.5.6 - * - * Each SCC parameter RAM area begins at offset 0x80 from each SCC base - * area (0x400, 0x500, or 0x600 from the dual-port RAM base). - * - * Offsets 0x9c-0xbf from each SCC base area compose the protocol-specific - * portion of the SCC parameter RAM. - */ -typedef struct { - rtems_unsigned8 rfcr; /* Rx Function Code */ - rtems_unsigned8 tfcr; /* Tx Function Code */ - rtems_unsigned16 mrblr; /* Maximum Rx Buffer Length */ - rtems_unsigned16 _rstate; /* Rx Internal State */ - rtems_unsigned8 res2; - rtems_unsigned8 rbd; /* Rx Internal Buffer Number */ - rtems_unsigned32 _rdptr; /* Rx Internal Data Pointer */ - rtems_unsigned16 _rcount; /* Rx Internal Byte Count */ - rtems_unsigned16 _rtmp; /* Rx Temp */ - rtems_unsigned16 _tstate; /* Tx Internal State */ - rtems_unsigned8 res7; - rtems_unsigned8 tbd; /* Tx Internal Buffer Number */ - rtems_unsigned32 _tdptr; /* Tx Internal Data Pointer */ - rtems_unsigned16 _tcount; /* Tx Internal Byte Count */ - rtems_unsigned16 _ttmp; /* Tx Temp */ -} m302_SCC_parameters_t; - -/* - * UART-Specific SCC Parameter RAM - * Section 4.5.11.3 - */ -typedef struct { - rtems_unsigned16 max_idl; /* Maximum IDLE Characters (rx) */ - rtems_unsigned16 idlc; /* Temporary rx IDLE counter */ - rtems_unsigned16 brkcr; /* Break Count Register (tx) */ - rtems_unsigned16 parec; /* Receive Parity Error Counter */ - rtems_unsigned16 frmec; /* Receive Framing Error Counter */ - rtems_unsigned16 nosec; /* Receive Noise Counter */ - rtems_unsigned16 brkec; /* Receive Break Condition Counter */ - rtems_unsigned16 uaddr1; /* UART ADDRESS Character 1 */ - rtems_unsigned16 uaddr2; /* UART ADDRESS Character 2 */ - rtems_unsigned16 rccr; /* Receive Control Character Register */ - rtems_unsigned16 character[8]; /* Control Characters 1 through 8*/ -} m302_SCC_UartSpecific_t; -/* - * This definition allows for the checking of receive buffers - * for errors. - */ - -#define RCV_ERR 0x003F - -/* - * UART receive buffer descriptor bit definitions. - * Section 4.5.11.14 - */ -#define RBIT_UART_CTRL (1<<11) /* buffer contains a control char */ -#define RBIT_UART_ADDR (1<<10) /* first byte contains an address */ -#define RBIT_UART_MATCH (1<<9) /* indicates which addr char matched */ -#define RBIT_UART_IDLE (1<<8) /* buffer closed due to IDLE sequence */ -#define RBIT_UART_BR (1<<5) /* break sequence was received */ -#define RBIT_UART_FR (1<<4) /* framing error was received */ -#define RBIT_UART_PR (1<<3) /* parity error was received */ -#define RBIT_UART_OV (1<<1) /* receiver overrun occurred */ -#define RBIT_UART_CD (1<<0) /* carrier detect lost */ -#define RBIT_UART_STATUS 0x003B /* all status bits */ - -/* - * UART transmit buffer descriptor bit definitions. - * Section 4.5.11.15 - */ -#define RBIT_UART_CR (1<<11) /* clear-to-send report - * this results in two idle bits - * between back-to-back frames - */ -#define RBIT_UART_A (1<<10) /* buffer contains address characters - * only valid in multidrop mode (UM0=1) - */ -#define RBIT_UART_PREAMBLE (1<<9) /* send preamble before data */ -#define RBIT_UART_CTS_LOST (1<<0) /* CTS lost */ - -/* - * UART event register - * Section 4.5.11.16 - */ -#define M302_UART_EV_CTS (1<<7) /* CTS status changed */ -#define M302_UART_EV_CD (1<<6) /* carrier detect status changed */ -#define M302_UART_EV_IDL (1<<5) /* IDLE sequence status changed */ -#define M302_UART_EV_BRK (1<<4) /* break character was received */ -#define M302_UART_EV_CCR (1<<3) /* control character received */ -#define M302_UART_EV_TX (1<<1) /* buffer has been transmitted */ -#define M302_UART_EV_RX (1<<0) /* buffer has been received */ - - -/* - * HDLC-Specific SCC Parameter RAM - * Section 4.5.12.3 - * - * c_mask_l should be 0xF0B8 for 16-bit CRC, 0xdebb for 32-bit CRC - * c_mask_h is a don't care for 16-bit CRC, 0x20E2 for 32-bit CRC - */ -typedef struct { - rtems_unsigned16 rcrc_l; /* Temp Receive CRC Low */ - rtems_unsigned16 rcrc_h; /* Temp Receive CRC High */ - rtems_unsigned16 c_mask_l; /* CRC Mask Low */ - rtems_unsigned16 c_mask_h; /* CRC Mask High */ - rtems_unsigned16 tcrc_l; /* Temp Transmit CRC Low */ - rtems_unsigned16 tcrc_h; /* Temp Transmit CRC High */ - - rtems_unsigned16 disfc; /* Discard Frame Counter */ - rtems_unsigned16 crcec; /* CRC Error Counter */ - rtems_unsigned16 abtsc; /* Abort Sequence Counter */ - rtems_unsigned16 nmarc; /* Nonmatching Address Received Cntr */ - rtems_unsigned16 retrc; /* Frame Retransmission Counter */ - - rtems_unsigned16 mflr; /* Maximum Frame Length Register */ - rtems_unsigned16 max_cnt; /* Maximum_Length Counter */ - - rtems_unsigned16 hmask; /* User Defined Frame Address Mask */ - rtems_unsigned16 haddr1; /* User Defined Frame Address */ - rtems_unsigned16 haddr2; /* " */ - rtems_unsigned16 haddr3; /* " */ - rtems_unsigned16 haddr4; /* " */ -} m302_SCC_HdlcSpecific_t; -/* - * HDLC receiver buffer descriptor bit definitions - * Section 4.5.12.10 - */ -#define RBIT_HDLC_EMPTY_BIT 0x8000 /* buffer associated with BD is empty */ -#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in a frame */ -#define RBIT_HDLC_FIRST_BIT 0x0400 /* buffer is first in a frame */ -#define RBIT_HDLC_FRAME_LEN 0x0020 /* receiver frame length violation */ -#define RBIT_HDLC_NONOCT_Rx 0x0010 /* received non-octet aligned frame */ -#define RBIT_HDLC_ABORT_SEQ 0x0008 /* received abort sequence */ -#define RBIT_HDLC_CRC_ERROR 0x0004 /* frame contains a CRC error */ -#define RBIT_HDLC_OVERRUN 0x0002 /* receiver overrun occurred */ -#define RBIT_HDLC_CD_LOST 0x0001 /* carrier detect lost */ - -/* - * HDLC transmit buffer descriptor bit definitions - * Section 4.5.12.11 - */ -#define RBIT_HDLC_READY_BIT 0x8000 /* buffer is ready to transmit */ -#define RBIT_HDLC_EXT_BUFFER 0x4000 /* buffer is in external memory */ -#define RBIT_HDLC_WRAP_BIT 0x2000 /* last buffer in bd table, so wrap */ -#define RBIT_HDLC_WAKE_UP 0x1000 /* interrupt when buffer serviced */ -#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in the frame */ -#define RBIT_HDLC_TxCRC_BIT 0x0400 /* transmit a CRC sequence */ -#define RBIT_HDLC_UNDERRUN 0x0002 /* transmitter underrun */ -#define RBIT_HDLC_CTS_LOST 0x0001 /* CTS lost */ - -/* - * HDLC event register bit definitions - * Section 4.5.12.12 - */ -#define RBIT_HDLC_CTS 0x80 /* CTS status changed */ -#define RBIT_HDLC_CD 0x40 /* carrier detect status changed */ -#define RBIT_HDLC_IDL 0x20 /* IDLE sequence status changed */ -#define RBIT_HDLC_TXE 0x10 /* transmit error */ -#define RBIT_HDLC_RXF 0x08 /* received frame */ -#define RBIT_HDLC_BSY 0x04 /* frame rcvd and discarded due to - * lack of buffers - */ -#define RBIT_HDLC_TXB 0x02 /* buffer has been transmitted */ -#define RBIT_HDLC_RXB 0x01 /* received buffer */ - - - -typedef struct { - m302_SCC_bd_table_t bd; /* +000 Buffer Descriptor Table */ - m302_SCC_parameters_t parm; /* +080 Common Parameter RAM */ - union { /* +09C Protocol-Specific Parm RAM */ - m302_SCC_UartSpecific_t uart; - m302_SCC_HdlcSpecific_t hdlc; - } prot; - rtems_unsigned8 res[0x040]; /* +0C0 reserved, (not implemented) */ -} m302_SCC_t; - - -/* - * Common SCC Registers - */ -typedef struct { - rtems_unsigned16 res1; - rtems_unsigned16 scon; /* SCC Configuration Register 4.5.2 */ - rtems_unsigned16 scm; /* SCC Mode Register 4.5.3 */ - rtems_unsigned16 dsr; /* SCC Data Synchronization Register 4.5.4 */ - rtems_unsigned8 scce; /* SCC Event Register 4.5.8.1 */ - rtems_unsigned8 res2; - rtems_unsigned8 sccm; /* SCC Mask Register 4.5.8.2 */ - rtems_unsigned8 res3; - rtems_unsigned8 sccs; /* SCC Status Register 4.5.8.3 */ - rtems_unsigned8 res4; - rtems_unsigned16 res5; -} m302_SCC_Registers_t; - -/* - * SCON - SCC Configuration Register - * Section 4.5.2 - */ -#define RBIT_SCON_WOMS (1<<15) /* Wired-OR Mode Select (NMSI mode only) - * When set, the TXD driver is an - * open-drain output */ -#define RBIT_SCON_EXTC (1<<14) /* External Clock Source */ -#define RBIT_SCON_TCS (1<<13) /* Transmit Clock Source */ -#define RBIT_SCON_RCS (1<<12) /* Receive Clock Source */ - -/* - * SCM - SCC Mode Register bit definitions - * Section 4.5.3 - * The parameter-specific mode bits occupy bits 15 through 6. - */ -#define RBIT_SCM_ENR (1<<3) /* Enable receiver */ -#define RBIT_SCM_ENT (1<<2) /* Enable transmitter */ - - -/* - * Internal MC68302 Registers - * starts at offset 0x800 from dual-port RAM base - * Section 2.8 - */ -typedef struct { - /* offset +800 */ - rtems_unsigned16 res0; - rtems_unsigned16 cmr; /* IDMA Channel Mode Register */ - rtems_unsigned32 sapr; /* IDMA Source Address Pointer */ - rtems_unsigned32 dapr; /* IDMA Destination Address Pointer */ - rtems_unsigned16 bcr; /* IDMA Byte Count Register */ - rtems_unsigned8 csr; /* IDMA Channel Status Register */ - rtems_unsigned8 res1; - rtems_unsigned8 fcr; /* IDMA Function Code Register */ - rtems_unsigned8 res2; - - /* offset +812 */ - rtems_unsigned16 gimr; /* Global Interrupt Mode Register */ - rtems_unsigned16 ipr; /* Interrupt Pending Register */ - rtems_unsigned16 imr; /* Interrupt Mask Register */ - rtems_unsigned16 isr; /* Interrupt In-Service Register */ - rtems_unsigned16 res3; - rtems_unsigned16 res4; - - /* offset +81e */ - rtems_unsigned16 pacnt; /* Port A Control Register */ - rtems_unsigned16 paddr; /* Port A Data Direction Register */ - rtems_unsigned16 padat; /* Port A Data Register */ - rtems_unsigned16 pbcnt; /* Port B Control Register */ - rtems_unsigned16 pbddr; /* Port B Data Direction Register */ - rtems_unsigned16 pbdat; /* Port B Data Register */ - rtems_unsigned16 res5; - - /* offset +82c */ - rtems_unsigned16 res6; - rtems_unsigned16 res7; - rtems_unsigned16 br0; /* Base Register (CS0) */ - rtems_unsigned16 or0; /* Option Register (CS0) */ - rtems_unsigned16 br1; /* Base Register (CS1) */ - rtems_unsigned16 or1; /* Option Register (CS1) */ - rtems_unsigned16 br2; /* Base Register (CS2) */ - rtems_unsigned16 or2; /* Option Register (CS2) */ - rtems_unsigned16 br3; /* Base Register (CS3) */ - rtems_unsigned16 or3; /* Option Register (CS3) */ - - /* offset +840 */ - rtems_unsigned16 tmr1; /* Timer Unit 1 Mode Register */ - rtems_unsigned16 trr1; /* Timer Unit 1 Reference Register */ - rtems_unsigned16 tcr1; /* Timer Unit 1 Capture Register */ - rtems_unsigned16 tcn1; /* Timer Unit 1 Counter */ - rtems_unsigned8 res8; - rtems_unsigned8 ter1; /* Timer Unit 1 Event Register */ - rtems_unsigned16 wrr; /* Watchdog Reference Register */ - rtems_unsigned16 wcn; /* Watchdog Counter */ - rtems_unsigned16 res9; - rtems_unsigned16 tmr2; /* Timer Unit 2 Mode Register */ - rtems_unsigned16 trr2; /* Timer Unit 2 Reference Register */ - rtems_unsigned16 tcr2; /* Timer Unit 2 Capture Register */ - rtems_unsigned16 tcn2; /* Timer Unit 2 Counter */ - rtems_unsigned8 resa; - rtems_unsigned8 ter2; /* Timer Unit 2 Event Register */ - rtems_unsigned16 resb; - rtems_unsigned16 resc; - rtems_unsigned16 resd; - - /* offset +860 */ - rtems_unsigned8 cr; /* Command Register */ - rtems_unsigned8 rese[0x1f]; - - /* offset +880, +890, +8a0 */ - m302_SCC_Registers_t scc[3]; /* SCC1, SCC2, SCC3 Registers */ - - /* offset +8b0 */ - rtems_unsigned16 spmode; /* SCP,SMC Mode and Clock Cntrl Reg */ - rtems_unsigned16 simask; /* Serial Interface Mask Register */ - rtems_unsigned16 simode; /* Serial Interface Mode Register */ -} m302_internalReg_t ; - - -/* - * MC68302 dual-port RAM structure. - * (Includes System RAM, Parameter RAM, and Internal Registers). - * Section 2.8 - */ -typedef struct { - rtems_unsigned8 mem[0x240]; /* +000 User Data Memory */ - rtems_unsigned8 res1[0x1c0]; /* +240 reserved, (not implemented) */ - m302_SCC_t scc1; /* +400 SCC1 */ - m302_SCC_t scc2; /* +500 SCC2 */ - m302_SCC_t scc3; /* +600 SCC3 */ - rtems_unsigned8 res2[0x100]; /* +700 reserved, (not implemented) */ - m302_internalReg_t reg; /* +800 68302 Internal Registers */ -} m302_dualPortRAM_t; - - -/* - * Declare the variable that's used to reference the variables in - * the dual-port RAM. - */ -extern volatile m302_dualPortRAM_t m302; - -#endif -/* end of include file */ diff --git a/cpukit/score/cpu/m68k/qsm.h b/cpukit/score/cpu/m68k/qsm.h deleted file mode 100644 index e1bf33bc12..0000000000 --- a/cpukit/score/cpu/m68k/qsm.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - *------------------------------------------------------------------- - * - * QSM -- Queued Serial Module - * - * The QSM contains two serial interfaces: (a) the queued serial - * peripheral interface (QSPI) and the serial communication interface - * (SCI). The QSPI provides peripheral expansion and/or interprocessor - * communication through a full-duplex, synchronous, three-wire bus. A - * self contained RAM queue permits serial data transfers without CPU - * intervention and automatic continuous sampling. The SCI provides a - * standard non-return to zero mark/space format with wakeup functions - * to allow the CPU to run uninterrupted until woken - * - * For more information, refer to Motorola's "Modular Microcontroller - * Family Queued Serial Module Reference Manual" (Motorola document - * QSMRM/AD). - * - * This file has been created by John S. Gwynne for support of - * Motorola's 68332 MCU in the efi332 project. - * - * Redistribution and use in source and binary forms are permitted - * provided that the following conditions are met: - * 1. Redistribution of source code and documentation must retain - * the above authorship, this list of conditions and the - * following disclaimer. - * 2. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * This software is provided "AS IS" without warranty of any kind, - * either expressed or implied, including, but not limited to, the - * implied warranties of merchantability, title and fitness for a - * particular purpose. - * - *------------------------------------------------------------------ - * - * $Id$ - */ - -#ifndef _QSM_H_ -#define _QSM_H_ - - -#include <efi332.h> - - -/* SAM-- shift and mask */ -#undef SAM -#define SAM(a,b,c) ((a << b) & c) - - -/* QSM_CRB (QSM Control Register Block) base address of the QSM - control registers */ -#if SIM_MM == 0 -#define QSM_CRB 0x7ffc00 -#else -#undef SIM_MM -#define SIM_MM 1 -#define QSM_CRB 0xfffc00 -#endif - - -#define QSMCR (volatile unsigned short int * const)(0x00 + QSM_CRB) - /* QSM Configuration Register */ -#define STOP 0x8000 /* Stop Enable */ -#define FRZ 0x6000 /* Freeze Control */ -#define SUPV 0x0080 /* Supervisor/Unrestricted */ -#define IARB 0x000f /* Inerrupt Arbitration */ - - -#define QTEST (volatile unsigned short int * const)(0x02 + QSM_CRB) - /* QSM Test Register */ -/* Used only for factor testing */ - - -#define QILR (volatile unsigned char * const)(0x04 + QSM_CRB) - /* QSM Interrupt Level Register */ -#define ILQSPI 0x38 /* Interrupt Level for QSPI */ -#define ILSCI 0x07 /* Interrupt Level for SCI */ - - -#define QIVR (volatile unsigned char * const)(0x05 + QSM_CRB) - /* QSM Interrupt Vector Register */ -#define INTV 0xff /* Interrupt Vector Number */ - - -#define SCCR0 (volatile unsigned short int * const)(0x08 + QSM_CRB) - /* SCI Control Register 0 */ -#define SCBR 0x1fff /* SCI Baud Rate */ - - -#define SCCR1 (volatile unsigned short int * const)(0x0a + QSM_CRB) - /* SCI Control Register 1 */ -#define LOOPS 0x4000 /* Loop Mode */ -#define WOMS 0x2000 /* Wired-OR Mode for SCI Pins */ -#define ILT 0x1000 /* Idle-Line Detect Type */ -#define PT 0x0800 /* Parity Type */ -#define PE 0x0400 /* Parity Enable */ -#define M 0x0200 /* Mode Select */ -#define WAKE 0x0100 /* Wakeup by Address Mark */ -#define TIE 0x0080 /* Transmit Complete Interrupt Enable */ -#define TCIE 0x0040 /* Transmit Complete Interrupt Enable */ -#define RIE 0x0020 /* Receiver Interrupt Enable */ -#define ILIE 0x0010 /* Idle-Line Interrupt Enable */ -#define TE 0x0008 /* Transmitter Enable */ -#define RE 0x0004 /* Receiver Enable */ -#define RWU 0x0002 /* Receiver Wakeup */ -#define SBK 0x0001 /* Send Break */ - - -#define SCSR (volatile unsigned short int * const)(0x0c + QSM_CRB) - /* SCI Status Register */ -#define TDRE 0x0100 /* Transmit Data Register Empty */ -#define TC 0x0080 /* Transmit Complete */ -#define RDRF 0x0040 /* Receive Data Register Full */ -#define RAF 0x0020 /* Receiver Active */ -#define IDLE 0x0010 /* Idle-Line Detected */ -#define OR 0x0008 /* Overrun Error */ -#define NF 0x0004 /* Noise Error Flag */ -#define FE 0x0002 /* Framing Error */ -#define PF 0x0001 /* Parity Error */ - - -#define SCDR (volatile unsigned short int * const)(0x0e + QSM_CRB) - /* SCI Data Register */ - - -#define PORTQS (volatile unsigned char * const)(0x15 + QSM_CRB) - /* Port QS Data Register */ - -#define PQSPAR (volatile unsigned char * const)(0x16 + QSM_CRB) - /* PORT QS Pin Assignment Rgister */ -/* Any bit cleared (zero) defines the corresponding pin to be an I/O - pin. Any bit set defines the corresponding pin to be a QSPI - signal. */ -/* note: PQS2 is a digital I/O pin unless the SPI is enabled in which - case it becomes the SPI serial clock SCK. */ -/* note: PQS7 is a digital I/O pin unless the SCI transmitter is - enabled in which case it becomes the SCI serial output TxD. */ -#define QSMFun 0x0 -#define QSMDis 0x1 -/* - * PQSPAR Field | QSM Function | Discrete I/O pin - *------------------+--------------+------------------ */ -#define PQSPA0 0 /* MISO | PQS0 */ -#define PQSPA1 1 /* MOSI | PQS1 */ -#define PQSPA2 2 /* SCK | PQS2 (see note)*/ -#define PQSPA3 3 /* PCSO/!SS | PQS3 */ -#define PQSPA4 4 /* PCS1 | PQS4 */ -#define PQSPA5 5 /* PCS2 | PQS5 */ -#define PQSPA6 6 /* PCS3 | PQS6 */ -#define PQSPA7 7 /* TxD | PQS7 (see note)*/ - - -#define DDRQS (volatile unsigned char * const)(0x17 + QSM_CRB) - /* PORT QS Data Direction Register */ -/* Clearing a bit makes the corresponding pin an input; setting a bit - makes the pin an output. */ - - -#define SPCR0 (volatile unsigned short int * const)(0x18 + QSM_CRB) - /* QSPI Control Register 0 */ -#define MSTR 0x8000 /* Master/Slave Mode Select */ -#define WOMQ 0x4000 /* Wired-OR Mode for QSPI Pins */ -#define BITS 0x3c00 /* Bits Per Transfer */ -#define CPOL 0x0200 /* Clock Polarity */ -#define CPHA 0x0100 /* Clock Phase */ -#define SPBR 0x00ff /* Serial Clock Baud Rate */ - - -#define SPCR1 (volatile unsigned short int * const)(0x1a + QSM_CRB) - /* QSPI Control Register 1 */ -#define SPE 0x8000 /* QSPI Enable */ -#define DSCKL 0x7f00 /* Delay before SCK */ -#define DTL 0x00ff /* Length of Delay after Transfer */ - - -#define SPCR2 (volatile unsigned short int * const)(0x1c + QSM_CRB) - /* QSPI Control Register 2 */ -#define SPIFIE 0x8000 /* SPI Finished Interrupt Enable */ -#define WREN 0x4000 /* Wrap Enable */ -#define WRTO 0x2000 /* Wrap To */ -#define ENDQP 0x0f00 /* Ending Queue Pointer */ -#define NEWQP 0x000f /* New Queue Pointer Value */ - - -#define SPCR3 (volatile unsigned char * const)(0x1e + QSM_CRB) - /* QSPI Control Register 3 */ -#define LOOPQ 0x0400 /* QSPI Loop Mode */ -#define HMIE 0x0200 /* HALTA and MODF Interrupt Enable */ -#define HALT 0x0100 /* Halt */ - - -#define SPSR (volatile unsigned char * const)(0x1f + QSM_CRB) - /* QSPI Status Register */ -#define SPIF 0x0080 /* QSPI Finished Flag */ -#define MODF 0x0040 /* Mode Fault Flag */ -#define HALTA 0x0020 /* Halt Acknowlwdge Flag */ -#define CPTQP x0000f /* Completed Queue Pointer */ - -#define QSPIRR (volatile unsigned char * const)(0x100 + QSM_CRB) - /* QSPI Receive Data RAM */ -#define QSPITR (volatile unsigned char * const)(0x120 + QSM_CRB) - /* QSPI Transmit Data RAM */ -#define QSPIcR (volatile unsigned char * const)(0x140 + QSM_CRB) - /* QSPI Command RAM */ - -#endif /* _QSM_H_ */ diff --git a/cpukit/score/cpu/m68k/rtems/asm.h b/cpukit/score/cpu/m68k/rtems/asm.h deleted file mode 100644 index 4c53980d51..0000000000 --- a/cpukit/score/cpu/m68k/rtems/asm.h +++ /dev/null @@ -1,129 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. This file is: - * - * COPYRIGHT (c) 1994. - * On-Line Applications Research Corporation (OAR). - * - * $Id$ - */ - -#ifndef __M68k_ASM_h -#define __M68k_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM -#include <rtems/score/m68k.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -#define d0 REG (d0) -#define d1 REG (d1) -#define d2 REG (d2) -#define d3 REG (d3) -#define d4 REG (d4) -#define d5 REG (d5) -#define d6 REG (d6) -#define d7 REG (d7) -#define a0 REG (a0) -#define a1 REG (a1) -#define a2 REG (a2) -#define a3 REG (a3) -#define a4 REG (a4) -#define a5 REG (a5) -#define a6 REG (a6) -#define a7 REG (a7) - -#define msp REG (msp) -#define usp REG (usp) -#define isp REG (isp) -#define sr REG (sr) -#define vbr REG (vbr) -#define dfc REG (dfc) - -#define fp0 REG (fp0) -#define fp1 REG (fp1) -#define fp2 REG (fp2) -#define fp3 REG (fp3) -#define fp4 REG (fp4) -#define fp5 REG (fp5) -#define fp6 REG (fp6) -#define fp7 REG (fp7) - -#define fpc REG (fpc) -#define fpi REG (fpi) -#define fps REG (fps) - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/m68k/rtems/m68k/m68302.h b/cpukit/score/cpu/m68k/rtems/m68k/m68302.h deleted file mode 100644 index da96478cf3..0000000000 --- a/cpukit/score/cpu/m68k/rtems/m68k/m68302.h +++ /dev/null @@ -1,608 +0,0 @@ -/* - *------------------------------------------------------------------ - * - * m68302.h - Definitions for Motorola MC68302 processor. - * - * Section references in this file refer to revision 2 of Motorola's - * "MC68302 Integrated Multiprotocol Processor User's Manual". - * (Motorola document MC68302UM/AD REV 2.) - * - * Based on Don Meyer's cpu68302.h that was posted in comp.sys.m68k - * on 17 February, 1993. - * - * Copyright 1995 David W. Glessner. - * - * Redistribution and use in source and binary forms are permitted - * provided that the following conditions are met: - * 1. Redistribution of source code and documentation must retain - * the above copyright notice, this list of conditions and the - * following disclaimer. - * 2. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * This software is provided "AS IS" without warranty of any kind, - * either expressed or implied, including, but not limited to, the - * implied warranties of merchantability, title and fitness for a - * particular purpose. - * - * - * $Id$ - * - *------------------------------------------------------------------ - */ - -#ifndef __MOTOROLA_MC68302_DEFINITIONS_h -#define __MOTOROLA_MC68302_DEFINITIONS_h - -/* - * BAR - Base Address Register - * Section 2.7 - */ -#define M302_BAR (*((volatile rtems_unsigned16 *) 0xf2)) - -/* - * SCR - System Control Register - * Section 3.8.1 - */ -#define M302_SCR (*((volatile rtems_unsigned32 *) 0xf4)) -/* - * SCR bits - */ -#define RBIT_SCR_IPA 0x08000000 -#define RBIT_SCR_HWT 0x04000000 -#define RBIT_SCR_WPV 0x02000000 -#define RBIT_SCR_ADC 0x01000000 - -#define RBIT_SCR_ERRE 0x00400000 -#define RBIT_SCR_VGE 0x00200000 -#define RBIT_SCR_WPVE 0x00100000 -#define RBIT_SCR_RMCST 0x00080000 -#define RBIT_SCR_EMWS 0x00040000 -#define RBIT_SCR_ADCE 0x00020000 -#define RBIT_SCR_BCLM 0x00010000 - -#define RBIT_SCR_FRZW 0x00008000 -#define RBIT_SCR_FRZ2 0x00004000 -#define RBIT_SCR_FRZ1 0x00002000 -#define RBIT_SCR_SAM 0x00001000 -#define RBIT_SCR_HWDEN 0x00000800 -#define RBIT_SCR_HWDCN2 0x00000400 -#define RBIT_SCR_HWDCN1 0x00000200 -#define RBIT_SCR_HWDCN0 0x00000100 - -#define RBIT_SCR_LPREC 0x00000080 -#define RBIT_SCR_LPP16 0x00000040 -#define RBIT_SCR_LPEN 0x00000020 -#define RBIT_SCR_LPCLKDIV 0x0000001f - - -/* - * 68000 interrupt and trap vector numbers - */ -#define M68K_IVEC_BUS_ERROR 2 -#define M68K_IVEC_ADDRESS_ERROR 3 -#define M68K_IVEC_ILLEGAL_OPCODE 4 -#define M68K_IVEC_ZERO_DIVIDE 5 -#define M68K_IVEC_CHK 6 -#define M68K_IVEC_TRAPV 7 -#define M68K_IVEC_PRIVILEGE 8 -#define M68K_IVEC_TRACE 9 -#define M68K_IVEC_LINE_A 10 -#define M68K_IVEC_LINE_F 11 -/* Unassigned, Reserved 12-14 */ -#define M68K_IVEC_UNINITIALIZED_INT 15 -/* Unassigned, Reserved 16-23 */ -#define M68K_IVEC_SPURIOUS_INT 24 - -#define M68K_IVEC_LEVEL1_AUTOVECTOR 25 -#define M68K_IVEC_LEVEL2_AUTOVECTOR 26 -#define M68K_IVEC_LEVEL3_AUTOVECTOR 27 -#define M68K_IVEC_LEVEL4_AUTOVECTOR 28 -#define M68K_IVEC_LEVEL5_AUTOVECTOR 29 -#define M68K_IVEC_LEVEL6_AUTOVECTOR 30 -#define M68K_IVEC_LEVEL7_AUTOVECTOR 31 - -#define M68K_IVEC_TRAP0 32 -#define M68K_IVEC_TRAP1 33 -#define M68K_IVEC_TRAP2 34 -#define M68K_IVEC_TRAP3 35 -#define M68K_IVEC_TRAP4 36 -#define M68K_IVEC_TRAP5 37 -#define M68K_IVEC_TRAP6 38 -#define M68K_IVEC_TRAP7 39 -#define M68K_IVEC_TRAP8 40 -#define M68K_IVEC_TRAP9 41 -#define M68K_IVEC_TRAP10 42 -#define M68K_IVEC_TRAP11 43 -#define M68K_IVEC_TRAP12 44 -#define M68K_IVEC_TRAP13 45 -#define M68K_IVEC_TRAP14 46 -#define M68K_IVEC_TRAP15 47 -/* - * Unassigned, Reserved 48-59 - * - * Note: Vectors 60-63 are used by the MC68302 (e.g. BAR, SCR). - */ - -/* - * MC68302 Interrupt Vectors - * Section 3.2 - */ -enum m68302_ivec_e { - M302_IVEC_ERR =0, - M302_IVEC_PB8 =1, /* General-Purpose Interrupt 0 */ - M302_IVEC_SMC2 =2, - M302_IVEC_SMC1 =3, - M302_IVEC_TIMER3 =4, - M302_IVEC_SCP =5, - M302_IVEC_TIMER2 =6, - M302_IVEC_PB9 =7, /* General-Purpose Interrupt 1 */ - M302_IVEC_SCC3 =8, - M302_IVEC_TIMER1 =9, - M302_IVEC_SCC2 =10, - M302_IVEC_IDMA =11, - M302_IVEC_SDMA =12, /* SDMA Channels Bus Error */ - M302_IVEC_SCC1 =13, - M302_IVEC_PB10 =14, /* General-Purpose Interrupt 2 */ - M302_IVEC_PB11 =15, /* General-Purpose Interrupt 3 */ - M302_IVEC_IRQ1 =17, /* External Device */ - M302_IVEC_IRQ6 =22, /* External Device */ - M302_IVEC_IRQ7 =23 /* External Device */ -}; - - -/* - * GIMR - Global Interrupt Mode Register - * Section 3.2.5.1 - */ -#define RBIT_GIMR_MOD (1<<15) -#define RBIT_GIMR_IV7 (1<<14) -#define RBIT_GIMR_IV6 (1<<13) -#define RBIT_GIMR_IV1 (1<<12) -#define RBIT_GIMR_ET7 (1<<10) -#define RBIT_GIMR_ET6 (1<<9) -#define RBIT_GIMR_ET1 (1<<8) -#define RBIT_GIMR_VECTOR (7<<5) - -/* - * IPR - Interrupt Pending Register (Section 3.2.5.2) - * IMR - Interrupt Mask Register (Section 3.2.5.3) - * ISR - Interrupt In-Service Register (Section 3.2.5.4) - */ -#define RBIT_IPR_PB11 (1<<15) -#define RBIT_IPR_PB10 (1<<14) -#define RBIT_IPR_SCC1 (1<<13) -#define RBIT_IPR_SDMA (1<<12) -#define RBIT_IPR_IDMA (1<<11) -#define RBIT_IPR_SCC2 (1<<10) -#define RBIT_IPR_TIMER1 (1<<9) -#define RBIT_IPR_SCC3 (1<<8) -#define RBIT_IPR_PB9 (1<<7) -#define RBIT_IPR_TIMER2 (1<<6) -#define RBIT_IPR_SCP (1<<5) -#define RBIT_IPR_TIMER3 (1<<4) -#define RBIT_IPR_SMC1 (1<<3) -#define RBIT_IPR_SMC2 (1<<2) -#define RBIT_IPR_PB8 (1<<1) -#define RBIT_IPR_ERR (1<<0) - -#define RBIT_ISR_PB11 (1<<15) -#define RBIT_ISR_PB10 (1<<14) -#define RBIT_ISR_SCC1 (1<<13) -#define RBIT_ISR_SDMA (1<<12) -#define RBIT_ISR_IDMA (1<<11) -#define RBIT_ISR_SCC2 (1<<10) -#define RBIT_ISR_TIMER1 (1<<9) -#define RBIT_ISR_SCC3 (1<<8) -#define RBIT_ISR_PB9 (1<<7) -#define RBIT_ISR_TIMER2 (1<<6) -#define RBIT_ISR_SCP (1<<5) -#define RBIT_ISR_TIMER3 (1<<4) -#define RBIT_ISR_SMC1 (1<<3) -#define RBIT_ISR_SMC2 (1<<2) -#define RBIT_ISR_PB8 (1<<1) - -#define RBIT_IMR_PB11 (1<<15) /* PB11 Interrupt Mask */ -#define RBIT_IMR_PB10 (1<<14) /* PB10 Interrupt Mask */ -#define RBIT_IMR_SCC1 (1<<13) /* SCC1 Interrupt Mask */ -#define RBIT_IMR_SDMA (1<<12) /* SDMA Interrupt Mask */ -#define RBIT_IMR_IDMA (1<<11) /* IDMA Interrupt Mask */ -#define RBIT_IMR_SCC2 (1<<10) /* SCC2 Interrupt Mask */ -#define RBIT_IMR_TIMER1 (1<<9) /* TIMER1 Interrupt Mask */ -#define RBIT_IMR_SCC3 (1<<8) /* SCC3 Interrupt Mask */ -#define RBIT_IMR_PB9 (1<<7) /* PB9 Interrupt Mask */ -#define RBIT_IMR_TIMER2 (1<<6) /* TIMER2 Interrupt Mask */ -#define RBIT_IMR_SCP (1<<5) /* SCP Interrupt Mask */ -#define RBIT_IMR_TIMER3 (1<<4) /* TIMER3 Interrupt Mask */ -#define RBIT_IMR_SMC1 (1<<3) /* SMC1 Interrupt Mask */ -#define RBIT_IMR_SMC2 (1<<2) /* SMC2 Interrupt Mask */ -#define RBIT_IMR_PB8 (1<<1) /* PB8 Interrupt Mask */ - - -/* - * DRAM Refresh - * Section 3.9 - * - * The DRAM refresh memory map replaces the SCC2 Tx BD 6 and Tx BD 7 - * structures in the parameter RAM. - * - * Access to the DRAM registers can be accomplished by - * the following approach: - * - * volatile m302_DRAM_refresh_t *dram; - * dram = (volatile m302_DRAM_refresh_t *) &m302.scc2.bd.tx[6]; - * - * Then simply use pointer references (e.g. dram->count = 3). - */ -typedef struct { - rtems_unsigned16 dram_high; /* DRAM high address and FC */ - rtems_unsigned16 dram_low; /* DRAM low address */ - rtems_unsigned16 increment; /* increment step (bytes/row) */ - rtems_unsigned16 count; /* RAM refresh cycle count (#rows) */ - rtems_unsigned16 t_ptr_h; /* temporary refresh high addr & FC */ - rtems_unsigned16 t_ptr_l; /* temporary refresh low address */ - rtems_unsigned16 t_count; /* temporary refresh cycles count */ - rtems_unsigned16 res; /* reserved */ -} m302_DRAM_refresh_t; - - -/* - * TMR - Timer Mode Register (for timers 1 and 2) - * Section 3.5.2.1 - */ -#define RBIT_TMR_ICLK_STOP (0<<1) -#define RBIT_TMR_ICLK_MASTER (1<<1) -#define RBIT_TMR_ICLK_MASTER16 (2<<1) -#define RBIT_TMR_ICLK_TIN (3<<1) - -#define RBIT_TMR_OM (1<<5) -#define RBIT_TMR_ORI (1<<4) -#define RBIT_TMR_FRR (1<<3) -#define RBIT_TMR_RST (1<<0) - - -/* - * TER - Timer Event Register (for timers 1 and 2) - * Section 3.5.2.5 - */ -#define RBIT_TER_REF (1<<1) /* Output Reference Event */ -#define RBIT_TER_CAP (1<<0) /* Capture Event */ - - -/* - * SCC Buffer Descriptors and Buffer Descriptors Table - * Section 4.5.5 - */ -typedef struct m302_SCC_bd { - rtems_unsigned16 status; /* status and control */ - rtems_unsigned16 length; /* data length */ - rtems_unsigned8 *buffer; /* data buffer pointer */ -} m302_SCC_bd_t; - -typedef struct { - m302_SCC_bd_t rx[8]; /* receive buffer descriptors */ - m302_SCC_bd_t tx[8]; /* transmit buffer descriptors */ -} m302_SCC_bd_table_t; - - -/* - * SCC Parameter RAM (offset 0x080 from an SCC Base) - * Section 4.5.6 - * - * Each SCC parameter RAM area begins at offset 0x80 from each SCC base - * area (0x400, 0x500, or 0x600 from the dual-port RAM base). - * - * Offsets 0x9c-0xbf from each SCC base area compose the protocol-specific - * portion of the SCC parameter RAM. - */ -typedef struct { - rtems_unsigned8 rfcr; /* Rx Function Code */ - rtems_unsigned8 tfcr; /* Tx Function Code */ - rtems_unsigned16 mrblr; /* Maximum Rx Buffer Length */ - rtems_unsigned16 _rstate; /* Rx Internal State */ - rtems_unsigned8 res2; - rtems_unsigned8 rbd; /* Rx Internal Buffer Number */ - rtems_unsigned32 _rdptr; /* Rx Internal Data Pointer */ - rtems_unsigned16 _rcount; /* Rx Internal Byte Count */ - rtems_unsigned16 _rtmp; /* Rx Temp */ - rtems_unsigned16 _tstate; /* Tx Internal State */ - rtems_unsigned8 res7; - rtems_unsigned8 tbd; /* Tx Internal Buffer Number */ - rtems_unsigned32 _tdptr; /* Tx Internal Data Pointer */ - rtems_unsigned16 _tcount; /* Tx Internal Byte Count */ - rtems_unsigned16 _ttmp; /* Tx Temp */ -} m302_SCC_parameters_t; - -/* - * UART-Specific SCC Parameter RAM - * Section 4.5.11.3 - */ -typedef struct { - rtems_unsigned16 max_idl; /* Maximum IDLE Characters (rx) */ - rtems_unsigned16 idlc; /* Temporary rx IDLE counter */ - rtems_unsigned16 brkcr; /* Break Count Register (tx) */ - rtems_unsigned16 parec; /* Receive Parity Error Counter */ - rtems_unsigned16 frmec; /* Receive Framing Error Counter */ - rtems_unsigned16 nosec; /* Receive Noise Counter */ - rtems_unsigned16 brkec; /* Receive Break Condition Counter */ - rtems_unsigned16 uaddr1; /* UART ADDRESS Character 1 */ - rtems_unsigned16 uaddr2; /* UART ADDRESS Character 2 */ - rtems_unsigned16 rccr; /* Receive Control Character Register */ - rtems_unsigned16 character[8]; /* Control Characters 1 through 8*/ -} m302_SCC_UartSpecific_t; -/* - * This definition allows for the checking of receive buffers - * for errors. - */ - -#define RCV_ERR 0x003F - -/* - * UART receive buffer descriptor bit definitions. - * Section 4.5.11.14 - */ -#define RBIT_UART_CTRL (1<<11) /* buffer contains a control char */ -#define RBIT_UART_ADDR (1<<10) /* first byte contains an address */ -#define RBIT_UART_MATCH (1<<9) /* indicates which addr char matched */ -#define RBIT_UART_IDLE (1<<8) /* buffer closed due to IDLE sequence */ -#define RBIT_UART_BR (1<<5) /* break sequence was received */ -#define RBIT_UART_FR (1<<4) /* framing error was received */ -#define RBIT_UART_PR (1<<3) /* parity error was received */ -#define RBIT_UART_OV (1<<1) /* receiver overrun occurred */ -#define RBIT_UART_CD (1<<0) /* carrier detect lost */ -#define RBIT_UART_STATUS 0x003B /* all status bits */ - -/* - * UART transmit buffer descriptor bit definitions. - * Section 4.5.11.15 - */ -#define RBIT_UART_CR (1<<11) /* clear-to-send report - * this results in two idle bits - * between back-to-back frames - */ -#define RBIT_UART_A (1<<10) /* buffer contains address characters - * only valid in multidrop mode (UM0=1) - */ -#define RBIT_UART_PREAMBLE (1<<9) /* send preamble before data */ -#define RBIT_UART_CTS_LOST (1<<0) /* CTS lost */ - -/* - * UART event register - * Section 4.5.11.16 - */ -#define M302_UART_EV_CTS (1<<7) /* CTS status changed */ -#define M302_UART_EV_CD (1<<6) /* carrier detect status changed */ -#define M302_UART_EV_IDL (1<<5) /* IDLE sequence status changed */ -#define M302_UART_EV_BRK (1<<4) /* break character was received */ -#define M302_UART_EV_CCR (1<<3) /* control character received */ -#define M302_UART_EV_TX (1<<1) /* buffer has been transmitted */ -#define M302_UART_EV_RX (1<<0) /* buffer has been received */ - - -/* - * HDLC-Specific SCC Parameter RAM - * Section 4.5.12.3 - * - * c_mask_l should be 0xF0B8 for 16-bit CRC, 0xdebb for 32-bit CRC - * c_mask_h is a don't care for 16-bit CRC, 0x20E2 for 32-bit CRC - */ -typedef struct { - rtems_unsigned16 rcrc_l; /* Temp Receive CRC Low */ - rtems_unsigned16 rcrc_h; /* Temp Receive CRC High */ - rtems_unsigned16 c_mask_l; /* CRC Mask Low */ - rtems_unsigned16 c_mask_h; /* CRC Mask High */ - rtems_unsigned16 tcrc_l; /* Temp Transmit CRC Low */ - rtems_unsigned16 tcrc_h; /* Temp Transmit CRC High */ - - rtems_unsigned16 disfc; /* Discard Frame Counter */ - rtems_unsigned16 crcec; /* CRC Error Counter */ - rtems_unsigned16 abtsc; /* Abort Sequence Counter */ - rtems_unsigned16 nmarc; /* Nonmatching Address Received Cntr */ - rtems_unsigned16 retrc; /* Frame Retransmission Counter */ - - rtems_unsigned16 mflr; /* Maximum Frame Length Register */ - rtems_unsigned16 max_cnt; /* Maximum_Length Counter */ - - rtems_unsigned16 hmask; /* User Defined Frame Address Mask */ - rtems_unsigned16 haddr1; /* User Defined Frame Address */ - rtems_unsigned16 haddr2; /* " */ - rtems_unsigned16 haddr3; /* " */ - rtems_unsigned16 haddr4; /* " */ -} m302_SCC_HdlcSpecific_t; -/* - * HDLC receiver buffer descriptor bit definitions - * Section 4.5.12.10 - */ -#define RBIT_HDLC_EMPTY_BIT 0x8000 /* buffer associated with BD is empty */ -#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in a frame */ -#define RBIT_HDLC_FIRST_BIT 0x0400 /* buffer is first in a frame */ -#define RBIT_HDLC_FRAME_LEN 0x0020 /* receiver frame length violation */ -#define RBIT_HDLC_NONOCT_Rx 0x0010 /* received non-octet aligned frame */ -#define RBIT_HDLC_ABORT_SEQ 0x0008 /* received abort sequence */ -#define RBIT_HDLC_CRC_ERROR 0x0004 /* frame contains a CRC error */ -#define RBIT_HDLC_OVERRUN 0x0002 /* receiver overrun occurred */ -#define RBIT_HDLC_CD_LOST 0x0001 /* carrier detect lost */ - -/* - * HDLC transmit buffer descriptor bit definitions - * Section 4.5.12.11 - */ -#define RBIT_HDLC_READY_BIT 0x8000 /* buffer is ready to transmit */ -#define RBIT_HDLC_EXT_BUFFER 0x4000 /* buffer is in external memory */ -#define RBIT_HDLC_WRAP_BIT 0x2000 /* last buffer in bd table, so wrap */ -#define RBIT_HDLC_WAKE_UP 0x1000 /* interrupt when buffer serviced */ -#define RBIT_HDLC_LAST_BIT 0x0800 /* buffer is last in the frame */ -#define RBIT_HDLC_TxCRC_BIT 0x0400 /* transmit a CRC sequence */ -#define RBIT_HDLC_UNDERRUN 0x0002 /* transmitter underrun */ -#define RBIT_HDLC_CTS_LOST 0x0001 /* CTS lost */ - -/* - * HDLC event register bit definitions - * Section 4.5.12.12 - */ -#define RBIT_HDLC_CTS 0x80 /* CTS status changed */ -#define RBIT_HDLC_CD 0x40 /* carrier detect status changed */ -#define RBIT_HDLC_IDL 0x20 /* IDLE sequence status changed */ -#define RBIT_HDLC_TXE 0x10 /* transmit error */ -#define RBIT_HDLC_RXF 0x08 /* received frame */ -#define RBIT_HDLC_BSY 0x04 /* frame rcvd and discarded due to - * lack of buffers - */ -#define RBIT_HDLC_TXB 0x02 /* buffer has been transmitted */ -#define RBIT_HDLC_RXB 0x01 /* received buffer */ - - - -typedef struct { - m302_SCC_bd_table_t bd; /* +000 Buffer Descriptor Table */ - m302_SCC_parameters_t parm; /* +080 Common Parameter RAM */ - union { /* +09C Protocol-Specific Parm RAM */ - m302_SCC_UartSpecific_t uart; - m302_SCC_HdlcSpecific_t hdlc; - } prot; - rtems_unsigned8 res[0x040]; /* +0C0 reserved, (not implemented) */ -} m302_SCC_t; - - -/* - * Common SCC Registers - */ -typedef struct { - rtems_unsigned16 res1; - rtems_unsigned16 scon; /* SCC Configuration Register 4.5.2 */ - rtems_unsigned16 scm; /* SCC Mode Register 4.5.3 */ - rtems_unsigned16 dsr; /* SCC Data Synchronization Register 4.5.4 */ - rtems_unsigned8 scce; /* SCC Event Register 4.5.8.1 */ - rtems_unsigned8 res2; - rtems_unsigned8 sccm; /* SCC Mask Register 4.5.8.2 */ - rtems_unsigned8 res3; - rtems_unsigned8 sccs; /* SCC Status Register 4.5.8.3 */ - rtems_unsigned8 res4; - rtems_unsigned16 res5; -} m302_SCC_Registers_t; - -/* - * SCON - SCC Configuration Register - * Section 4.5.2 - */ -#define RBIT_SCON_WOMS (1<<15) /* Wired-OR Mode Select (NMSI mode only) - * When set, the TXD driver is an - * open-drain output */ -#define RBIT_SCON_EXTC (1<<14) /* External Clock Source */ -#define RBIT_SCON_TCS (1<<13) /* Transmit Clock Source */ -#define RBIT_SCON_RCS (1<<12) /* Receive Clock Source */ - -/* - * SCM - SCC Mode Register bit definitions - * Section 4.5.3 - * The parameter-specific mode bits occupy bits 15 through 6. - */ -#define RBIT_SCM_ENR (1<<3) /* Enable receiver */ -#define RBIT_SCM_ENT (1<<2) /* Enable transmitter */ - - -/* - * Internal MC68302 Registers - * starts at offset 0x800 from dual-port RAM base - * Section 2.8 - */ -typedef struct { - /* offset +800 */ - rtems_unsigned16 res0; - rtems_unsigned16 cmr; /* IDMA Channel Mode Register */ - rtems_unsigned32 sapr; /* IDMA Source Address Pointer */ - rtems_unsigned32 dapr; /* IDMA Destination Address Pointer */ - rtems_unsigned16 bcr; /* IDMA Byte Count Register */ - rtems_unsigned8 csr; /* IDMA Channel Status Register */ - rtems_unsigned8 res1; - rtems_unsigned8 fcr; /* IDMA Function Code Register */ - rtems_unsigned8 res2; - - /* offset +812 */ - rtems_unsigned16 gimr; /* Global Interrupt Mode Register */ - rtems_unsigned16 ipr; /* Interrupt Pending Register */ - rtems_unsigned16 imr; /* Interrupt Mask Register */ - rtems_unsigned16 isr; /* Interrupt In-Service Register */ - rtems_unsigned16 res3; - rtems_unsigned16 res4; - - /* offset +81e */ - rtems_unsigned16 pacnt; /* Port A Control Register */ - rtems_unsigned16 paddr; /* Port A Data Direction Register */ - rtems_unsigned16 padat; /* Port A Data Register */ - rtems_unsigned16 pbcnt; /* Port B Control Register */ - rtems_unsigned16 pbddr; /* Port B Data Direction Register */ - rtems_unsigned16 pbdat; /* Port B Data Register */ - rtems_unsigned16 res5; - - /* offset +82c */ - rtems_unsigned16 res6; - rtems_unsigned16 res7; - rtems_unsigned16 br0; /* Base Register (CS0) */ - rtems_unsigned16 or0; /* Option Register (CS0) */ - rtems_unsigned16 br1; /* Base Register (CS1) */ - rtems_unsigned16 or1; /* Option Register (CS1) */ - rtems_unsigned16 br2; /* Base Register (CS2) */ - rtems_unsigned16 or2; /* Option Register (CS2) */ - rtems_unsigned16 br3; /* Base Register (CS3) */ - rtems_unsigned16 or3; /* Option Register (CS3) */ - - /* offset +840 */ - rtems_unsigned16 tmr1; /* Timer Unit 1 Mode Register */ - rtems_unsigned16 trr1; /* Timer Unit 1 Reference Register */ - rtems_unsigned16 tcr1; /* Timer Unit 1 Capture Register */ - rtems_unsigned16 tcn1; /* Timer Unit 1 Counter */ - rtems_unsigned8 res8; - rtems_unsigned8 ter1; /* Timer Unit 1 Event Register */ - rtems_unsigned16 wrr; /* Watchdog Reference Register */ - rtems_unsigned16 wcn; /* Watchdog Counter */ - rtems_unsigned16 res9; - rtems_unsigned16 tmr2; /* Timer Unit 2 Mode Register */ - rtems_unsigned16 trr2; /* Timer Unit 2 Reference Register */ - rtems_unsigned16 tcr2; /* Timer Unit 2 Capture Register */ - rtems_unsigned16 tcn2; /* Timer Unit 2 Counter */ - rtems_unsigned8 resa; - rtems_unsigned8 ter2; /* Timer Unit 2 Event Register */ - rtems_unsigned16 resb; - rtems_unsigned16 resc; - rtems_unsigned16 resd; - - /* offset +860 */ - rtems_unsigned8 cr; /* Command Register */ - rtems_unsigned8 rese[0x1f]; - - /* offset +880, +890, +8a0 */ - m302_SCC_Registers_t scc[3]; /* SCC1, SCC2, SCC3 Registers */ - - /* offset +8b0 */ - rtems_unsigned16 spmode; /* SCP,SMC Mode and Clock Cntrl Reg */ - rtems_unsigned16 simask; /* Serial Interface Mask Register */ - rtems_unsigned16 simode; /* Serial Interface Mode Register */ -} m302_internalReg_t ; - - -/* - * MC68302 dual-port RAM structure. - * (Includes System RAM, Parameter RAM, and Internal Registers). - * Section 2.8 - */ -typedef struct { - rtems_unsigned8 mem[0x240]; /* +000 User Data Memory */ - rtems_unsigned8 res1[0x1c0]; /* +240 reserved, (not implemented) */ - m302_SCC_t scc1; /* +400 SCC1 */ - m302_SCC_t scc2; /* +500 SCC2 */ - m302_SCC_t scc3; /* +600 SCC3 */ - rtems_unsigned8 res2[0x100]; /* +700 reserved, (not implemented) */ - m302_internalReg_t reg; /* +800 68302 Internal Registers */ -} m302_dualPortRAM_t; - - -/* - * Declare the variable that's used to reference the variables in - * the dual-port RAM. - */ -extern volatile m302_dualPortRAM_t m302; - -#endif -/* end of include file */ diff --git a/cpukit/score/cpu/m68k/rtems/m68k/qsm.h b/cpukit/score/cpu/m68k/rtems/m68k/qsm.h deleted file mode 100644 index e1bf33bc12..0000000000 --- a/cpukit/score/cpu/m68k/rtems/m68k/qsm.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - *------------------------------------------------------------------- - * - * QSM -- Queued Serial Module - * - * The QSM contains two serial interfaces: (a) the queued serial - * peripheral interface (QSPI) and the serial communication interface - * (SCI). The QSPI provides peripheral expansion and/or interprocessor - * communication through a full-duplex, synchronous, three-wire bus. A - * self contained RAM queue permits serial data transfers without CPU - * intervention and automatic continuous sampling. The SCI provides a - * standard non-return to zero mark/space format with wakeup functions - * to allow the CPU to run uninterrupted until woken - * - * For more information, refer to Motorola's "Modular Microcontroller - * Family Queued Serial Module Reference Manual" (Motorola document - * QSMRM/AD). - * - * This file has been created by John S. Gwynne for support of - * Motorola's 68332 MCU in the efi332 project. - * - * Redistribution and use in source and binary forms are permitted - * provided that the following conditions are met: - * 1. Redistribution of source code and documentation must retain - * the above authorship, this list of conditions and the - * following disclaimer. - * 2. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * This software is provided "AS IS" without warranty of any kind, - * either expressed or implied, including, but not limited to, the - * implied warranties of merchantability, title and fitness for a - * particular purpose. - * - *------------------------------------------------------------------ - * - * $Id$ - */ - -#ifndef _QSM_H_ -#define _QSM_H_ - - -#include <efi332.h> - - -/* SAM-- shift and mask */ -#undef SAM -#define SAM(a,b,c) ((a << b) & c) - - -/* QSM_CRB (QSM Control Register Block) base address of the QSM - control registers */ -#if SIM_MM == 0 -#define QSM_CRB 0x7ffc00 -#else -#undef SIM_MM -#define SIM_MM 1 -#define QSM_CRB 0xfffc00 -#endif - - -#define QSMCR (volatile unsigned short int * const)(0x00 + QSM_CRB) - /* QSM Configuration Register */ -#define STOP 0x8000 /* Stop Enable */ -#define FRZ 0x6000 /* Freeze Control */ -#define SUPV 0x0080 /* Supervisor/Unrestricted */ -#define IARB 0x000f /* Inerrupt Arbitration */ - - -#define QTEST (volatile unsigned short int * const)(0x02 + QSM_CRB) - /* QSM Test Register */ -/* Used only for factor testing */ - - -#define QILR (volatile unsigned char * const)(0x04 + QSM_CRB) - /* QSM Interrupt Level Register */ -#define ILQSPI 0x38 /* Interrupt Level for QSPI */ -#define ILSCI 0x07 /* Interrupt Level for SCI */ - - -#define QIVR (volatile unsigned char * const)(0x05 + QSM_CRB) - /* QSM Interrupt Vector Register */ -#define INTV 0xff /* Interrupt Vector Number */ - - -#define SCCR0 (volatile unsigned short int * const)(0x08 + QSM_CRB) - /* SCI Control Register 0 */ -#define SCBR 0x1fff /* SCI Baud Rate */ - - -#define SCCR1 (volatile unsigned short int * const)(0x0a + QSM_CRB) - /* SCI Control Register 1 */ -#define LOOPS 0x4000 /* Loop Mode */ -#define WOMS 0x2000 /* Wired-OR Mode for SCI Pins */ -#define ILT 0x1000 /* Idle-Line Detect Type */ -#define PT 0x0800 /* Parity Type */ -#define PE 0x0400 /* Parity Enable */ -#define M 0x0200 /* Mode Select */ -#define WAKE 0x0100 /* Wakeup by Address Mark */ -#define TIE 0x0080 /* Transmit Complete Interrupt Enable */ -#define TCIE 0x0040 /* Transmit Complete Interrupt Enable */ -#define RIE 0x0020 /* Receiver Interrupt Enable */ -#define ILIE 0x0010 /* Idle-Line Interrupt Enable */ -#define TE 0x0008 /* Transmitter Enable */ -#define RE 0x0004 /* Receiver Enable */ -#define RWU 0x0002 /* Receiver Wakeup */ -#define SBK 0x0001 /* Send Break */ - - -#define SCSR (volatile unsigned short int * const)(0x0c + QSM_CRB) - /* SCI Status Register */ -#define TDRE 0x0100 /* Transmit Data Register Empty */ -#define TC 0x0080 /* Transmit Complete */ -#define RDRF 0x0040 /* Receive Data Register Full */ -#define RAF 0x0020 /* Receiver Active */ -#define IDLE 0x0010 /* Idle-Line Detected */ -#define OR 0x0008 /* Overrun Error */ -#define NF 0x0004 /* Noise Error Flag */ -#define FE 0x0002 /* Framing Error */ -#define PF 0x0001 /* Parity Error */ - - -#define SCDR (volatile unsigned short int * const)(0x0e + QSM_CRB) - /* SCI Data Register */ - - -#define PORTQS (volatile unsigned char * const)(0x15 + QSM_CRB) - /* Port QS Data Register */ - -#define PQSPAR (volatile unsigned char * const)(0x16 + QSM_CRB) - /* PORT QS Pin Assignment Rgister */ -/* Any bit cleared (zero) defines the corresponding pin to be an I/O - pin. Any bit set defines the corresponding pin to be a QSPI - signal. */ -/* note: PQS2 is a digital I/O pin unless the SPI is enabled in which - case it becomes the SPI serial clock SCK. */ -/* note: PQS7 is a digital I/O pin unless the SCI transmitter is - enabled in which case it becomes the SCI serial output TxD. */ -#define QSMFun 0x0 -#define QSMDis 0x1 -/* - * PQSPAR Field | QSM Function | Discrete I/O pin - *------------------+--------------+------------------ */ -#define PQSPA0 0 /* MISO | PQS0 */ -#define PQSPA1 1 /* MOSI | PQS1 */ -#define PQSPA2 2 /* SCK | PQS2 (see note)*/ -#define PQSPA3 3 /* PCSO/!SS | PQS3 */ -#define PQSPA4 4 /* PCS1 | PQS4 */ -#define PQSPA5 5 /* PCS2 | PQS5 */ -#define PQSPA6 6 /* PCS3 | PQS6 */ -#define PQSPA7 7 /* TxD | PQS7 (see note)*/ - - -#define DDRQS (volatile unsigned char * const)(0x17 + QSM_CRB) - /* PORT QS Data Direction Register */ -/* Clearing a bit makes the corresponding pin an input; setting a bit - makes the pin an output. */ - - -#define SPCR0 (volatile unsigned short int * const)(0x18 + QSM_CRB) - /* QSPI Control Register 0 */ -#define MSTR 0x8000 /* Master/Slave Mode Select */ -#define WOMQ 0x4000 /* Wired-OR Mode for QSPI Pins */ -#define BITS 0x3c00 /* Bits Per Transfer */ -#define CPOL 0x0200 /* Clock Polarity */ -#define CPHA 0x0100 /* Clock Phase */ -#define SPBR 0x00ff /* Serial Clock Baud Rate */ - - -#define SPCR1 (volatile unsigned short int * const)(0x1a + QSM_CRB) - /* QSPI Control Register 1 */ -#define SPE 0x8000 /* QSPI Enable */ -#define DSCKL 0x7f00 /* Delay before SCK */ -#define DTL 0x00ff /* Length of Delay after Transfer */ - - -#define SPCR2 (volatile unsigned short int * const)(0x1c + QSM_CRB) - /* QSPI Control Register 2 */ -#define SPIFIE 0x8000 /* SPI Finished Interrupt Enable */ -#define WREN 0x4000 /* Wrap Enable */ -#define WRTO 0x2000 /* Wrap To */ -#define ENDQP 0x0f00 /* Ending Queue Pointer */ -#define NEWQP 0x000f /* New Queue Pointer Value */ - - -#define SPCR3 (volatile unsigned char * const)(0x1e + QSM_CRB) - /* QSPI Control Register 3 */ -#define LOOPQ 0x0400 /* QSPI Loop Mode */ -#define HMIE 0x0200 /* HALTA and MODF Interrupt Enable */ -#define HALT 0x0100 /* Halt */ - - -#define SPSR (volatile unsigned char * const)(0x1f + QSM_CRB) - /* QSPI Status Register */ -#define SPIF 0x0080 /* QSPI Finished Flag */ -#define MODF 0x0040 /* Mode Fault Flag */ -#define HALTA 0x0020 /* Halt Acknowlwdge Flag */ -#define CPTQP x0000f /* Completed Queue Pointer */ - -#define QSPIRR (volatile unsigned char * const)(0x100 + QSM_CRB) - /* QSPI Receive Data RAM */ -#define QSPITR (volatile unsigned char * const)(0x120 + QSM_CRB) - /* QSPI Transmit Data RAM */ -#define QSPIcR (volatile unsigned char * const)(0x140 + QSM_CRB) - /* QSPI Command RAM */ - -#endif /* _QSM_H_ */ diff --git a/cpukit/score/cpu/m68k/rtems/m68k/sim.h b/cpukit/score/cpu/m68k/rtems/m68k/sim.h deleted file mode 100644 index fae7fe8783..0000000000 --- a/cpukit/score/cpu/m68k/rtems/m68k/sim.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - *------------------------------------------------------------------- - * - * SIM -- System Integration Module - * - * The system integration module (SIM) is used on many Motorola 16- - * and 32-bit MCUs for the following functions: - * - * () System configuration and protection. Bus and software watchdog - * monitors are provided in addition to periodic interrupt generators. - * - * () Clock signal generation for other intermodule bus (IMB) members - * and external devices. - * - * () The generation of chip-select signals that simplify external - * circuitry interface. - * - * () Data ports that are available for general purpose input and - * output. - * - * () A system test block that is intended only for factory tests. - * - * For more information, refer to Motorola's "Modular Microcontroller - * Family System Integration Module Reference Manual" (Motorola document - * SIMRM/AD). - * - * This file has been created by John S. Gwynne for support of - * Motorola's 68332 MCU in the efi332 project. - * - * Redistribution and use in source and binary forms are permitted - * provided that the following conditions are met: - * 1. Redistribution of source code and documentation must retain - * the above authorship, this list of conditions and the - * following disclaimer. - * 2. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * This software is provided "AS IS" without warranty of any kind, - * either expressed or implied, including, but not limited to, the - * implied warranties of merchantability, title and fitness for a - * particular purpose. - * - *------------------------------------------------------------------ - * - * $Id$ - */ - -#ifndef _SIM_H_ -#define _SIM_H_ - - -#include <efi332.h> - - -/* SAM-- shift and mask */ -#undef SAM -#define SAM(a,b,c) ((a << b) & c) - - - -/* SIM_CRB (SIM Control Register Block) base address of the SIM - control registers */ -/* not included in ram_init.h */ -#if SIM_MM == 0 -#define SIM_CRB 0x7ffa00 -#else -#undef SIM_MM -#define SIM_MM 1 -#define SIM_CRB 0xfffa00 -#endif -/* end not included in ram_init.h */ - - - -#define SIMCR (volatile unsigned short int * const)(0x00 + SIM_CRB) - /* Module Configuration Register */ -#define EXOFF 0x8000 /* External Clock Off */ -#define FRZSW 0x4000 /* Freeze Software Enable */ -#define FRZBM 0x2000 /* Freeze Bus Monitor Enable */ -#define SLVEN 0x0800 /* Factory Test Model Enabled (ro)*/ -#define SHEN 0x0300 /* Show Cycle Enable */ -#define SUPV 0x0080 /* Supervisor/Unrestricted Data Space */ -#define MM 0x0040 /* Module Mapping */ -#define IARB 0x000f /* Interrupt Arbitration Field */ - - - -#define SIMTR (volatile unsigned short int * const)(0x02 + SIM_CRB) - /* SIM Test Register */ -/* Used only for factor testing */ - - - -#define SYNCR (volatile unsigned short int * const)(0x04 + SIM_CRB) - /* Clock Synthesizer Control Register */ -#define W 0x8000 /* Frequency Control (VCO) */ -#define X 0x4000 /* Frequency Control Bit (Prescale) */ -#define Y 0x3f00 /* Frequency Control Counter */ -#define EDIV 0x0080 /* ECLK Divide Rate */ -#define SLIMP 0x0010 /* Limp Mode Status */ -#define SLOCK 0x0008 /* Synthesizer Lock */ -#define RSTEN 0x0004 /* Reset Enable */ -#define STSIM 0x0002 /* Stop Mode SIM Clock */ -#define STEXT 0x0001 /* Stop Mode External Clock */ - - - -#define RSR (volatile unsigned char * const)(0x07 + SIM_CRB) - /* Reset Status Register */ -#define EXT 0x0080 /* External Reset */ -#define POW 0x0040 /* Power-On Reset */ -#define SW 0x0020 /* Software Watchdog Reset */ -#define DBF 0x0010 /* Double Bus Fault Reset */ -#define LOC 0x0004 /* Loss of Clock Reset */ -#define SYS 0x0002 /* System Reset */ -#define TST 0x0001 /* Test Submodule Reset */ - - - -#define SIMTRE (volatile unsigned short int * const)(0x08 + SIM_CRB) - /* System Integration Test Register */ -/* Used only for factor testing */ - - - -#define PORTE0 (volatile unsigned char * const)(0x11 + SIM_CRB) -#define PORTE1 (volatile unsigned char * const)(0x13 + SIM_CRB) - /* Port E Data Register */ -#define DDRE (volatile unsigned char * const)(0x15 + SIM_CRB) - /* Port E Data Direction Register */ -#define PEPAR (volatile unsigned char * const)(0x17 + SIM_CRB) - /* Port E Pin Assignment Register */ -/* Any bit cleared (zero) defines the corresponding pin to be an I/O - pin. Any bit set defines the corresponding pin to be a bus control - signal. */ - - - -#define PORTF0 (volatile unsigned char * const)(0x19 + SIM_CRB) -#define PORTF1 (volatile unsigned char * const)(0x1b + SIM_CRB) - /* Port F Data Register */ -#define DDRF (volatile unsigned char * const)(0x1d + SIM_CRB) - /* Port E Data Direction Register */ -#define PFPAR (volatile unsigned char * const)(0x1f + SIM_CRB) -/* Any bit cleared (zero) defines the corresponding pin to be an I/O - pin. Any bit set defines the corresponding pin to be a bus control - signal. */ - - - -#define SYPCR (volatile unsigned char * const)(0x21 + SIM_CRB) -/* !!! can write to only once after reset !!! */ - /* System Protection Control Register */ -#define SWE 0x80 /* Software Watch Enable */ -#define SWP 0x40 /* Software Watchdog Prescale */ -#define SWT 0x30 /* Software Watchdog Timing */ -#define HME 0x08 /* Halt Monitor Enable */ -#define BME 0x04 /* Bus Monitor External Enable */ -#define BMT 0x03 /* Bus Monitor Timing */ - - - -#define PICR (volatile unsigned short int * const)(0x22 + SIM_CRB) - /* Periodic Interrupt Control Reg. */ -#define PIRQL 0x0700 /* Periodic Interrupt Request Level */ -#define PIV 0x00ff /* Periodic Interrupt Level */ - - - -#define PITR (volatile unsigned short int * const)(0x24 + SIM_CRB) - /* Periodic Interrupt Timer Register */ -#define PTP 0x0100 /* Periodic Timer Prescaler Control */ -#define PITM 0x00ff /* Periodic Interrupt Timing Modulus */ - - - -#define SWSR (volatile unsigned char * const)(0x27 + SIM_CRB) - /* Software Service Register */ -/* write 0x55 then 0xaa to service the software watchdog */ - - - -#define TSTMSRA (volatile unsigned short int * const)(0x30 + SIM_CRB) - /* Test Module Master Shift A */ -#define TSTMSRB (volatile unsigned short int * const)(0x32 + SIM_CRB) - /* Test Module Master Shift A */ -#define TSTSC (volatile unsigned short int * const)(0x34 + SIM_CRB) - /* Test Module Shift Count */ -#define TSTRC (volatile unsigned short int * const)(0x36 + SIM_CRB) - /* Test Module Repetition Counter */ -#define CREG (volatile unsigned short int * const)(0x38 + SIM_CRB) - /* Test Module Control */ -#define DREG (volatile unsigned short int * const)(0x3a + SIM_CRB) - /* Test Module Distributed */ -/* Used only for factor testing */ - - - -#define PORTC (volatile unsigned char * const)(0x41 + SIM_CRB) - /* Port C Data */ - - - -#define CSPAR0 (volatile unsigned short int * const)(0x44 + SIM_CRB) - /* Chip Select Pin Assignment - Resgister 0 */ -/* CSPAR0 contains seven two-bit fields that determine the functions - of corresponding chip-select pins. CSPAR0[15:14] are not - used. These bits always read zero; write have no effect. CSPAR0 bit - 1 always reads one; writes to CSPAR0 bit 1 have no effect. */ -#define CSPAR1 (volatile unsigned short int * const)(0x46 + SIM_CRB) - /* Chip Select Pin Assignment - Register 1 */ -/* CSPAR1 contains five two-bit fields that determine the finctions of - corresponding chip-select pins. CSPAR1[15:10] are not used. These - bits always read zero; writes have no effect. */ -/* - * - * Bit Field | Description - * ------------+--------------- - * 00 | Discrete Output - * 01 | Alternate Function - * 10 | Chip Select (8-bit port) - * 11 | Chip Select (16-bit port) - */ -#define DisOut 0x0 -#define AltFun 0x1 -#define CS8bit 0x2 -#define CS16bit 0x3 -/* - * - * CSPARx Field |Chip Select Signal | Alternate Signal | Discrete Output - *-----------------+--------------------+--------------------+---------------*/ -#define CS_5 12 /* !CS5 | FC2 | PC2 */ -#define CS_4 10 /* !CS4 | FC1 | PC1 */ -#define CS_3 8 /* !CS3 | FC0 | PC0 */ -#define CS_2 6 /* !CS2 | !BGACK | */ -#define CS_1 4 /* !CS1 | !BG | */ -#define CS_0 2 /* !CS0 | !BR | */ -#define CSBOOT 0 /* !CSBOOT | | */ -/* | | | */ -#define CS_10 8 /* !CS10 | ADDR23 | ECLK */ -#define CS_9 6 /* !CS9 | ADDR22 | PC6 */ -#define CS_8 4 /* !CS8 | ADDR21 | PC5 */ -#define CS_7 2 /* !CS7 | ADDR20 | PC4 */ -#define CS_6 0 /* !CS6 | ADDR19 | PC3 */ - -#define BS_2K 0x0 -#define BS_8K 0x1 -#define BS_16K 0x2 -#define BS_64K 0x3 -#define BS_128K 0x4 -#define BS_256K 0x5 -#define BS_512K 0x6 -#define BS_1M 0x7 - -#define CSBARBT (volatile unsigned short int * const)(0x48 + SIM_CRB) -#define CSBAR0 (volatile unsigned short int * const)(0x4c + SIM_CRB) -#define CSBAR1 (volatile unsigned short int * const)(0x50 + SIM_CRB) -#define CSBAR2 (volatile unsigned short int * const)(0x54 + SIM_CRB) -#define CSBAR3 (volatile unsigned short int * const)(0x58 + SIM_CRB) -#define CSBAR4 (volatile unsigned short int * const)(0x5c + SIM_CRB) -#define CSBAR5 (volatile unsigned short int * const)(0x60 + SIM_CRB) -#define CSBAR6 (volatile unsigned short int * const)(0x64 + SIM_CRB) -#define CSBAR7 (volatile unsigned short int * const)(0x68 + SIM_CRB) -#define CSBAR8 (volatile unsigned short int * const)(0x6c + SIM_CRB) -#define CSBAR9 (volatile unsigned short int * const)(0x70 + SIM_CRB) -#define CSBAR10 (volatile unsigned short int * const)(0x74 + SIM_CRB) - -#define MODE 0x8000 -#define Disable 0 -#define LowerByte 0x2000 -#define UpperByte 0x4000 -#define BothBytes 0x6000 -#define ReadOnly 0x0800 -#define WriteOnly 0x1000 -#define ReadWrite 0x1800 -#define SyncAS 0x0 -#define SyncDS 0x0400 - -#define WaitStates_0 (0x0 << 6) -#define WaitStates_1 (0x1 << 6) -#define WaitStates_2 (0x2 << 6) -#define WaitStates_3 (0x3 << 6) -#define WaitStates_4 (0x4 << 6) -#define WaitStates_5 (0x5 << 6) -#define WaitStates_6 (0x6 << 6) -#define WaitStates_7 (0x7 << 6) -#define WaitStates_8 (0x8 << 6) -#define WaitStates_9 (0x9 << 6) -#define WaitStates_10 (0xa << 6) -#define WaitStates_11 (0xb << 6) -#define WaitStates_12 (0xc << 6) -#define WaitStates_13 (0xd << 6) -#define FastTerm (0xe << 6) -#define External (0xf << 6) - -#define CPUSpace (0x0 << 4) -#define UserSpace (0x1 << 4) -#define SupSpace (0x2 << 4) -#define UserSupSpace (0x3 << 4) - -#define IPLevel_any 0x0 -#define IPLevel_1 0x2 -#define IPLevel_2 0x4 -#define IPLevel_3 0x6 -#define IPLevel_4 0x8 -#define IPLevel_5 0xa -#define IPLevel_6 0xc -#define IPLevel_7 0xe - -#define AVEC 1 - -#define CSORBT (volatile unsigned short int * const)(0x4a + SIM_CRB) -#define CSOR0 (volatile unsigned short int * const)(0x4e + SIM_CRB) -#define CSOR1 (volatile unsigned short int * const)(0x52 + SIM_CRB) -#define CSOR2 (volatile unsigned short int * const)(0x56 + SIM_CRB) -#define CSOR3 (volatile unsigned short int * const)(0x5a + SIM_CRB) -#define CSOR4 (volatile unsigned short int * const)(0x5e + SIM_CRB) -#define CSOR5 (volatile unsigned short int * const)(0x62 + SIM_CRB) -#define CSOR6 (volatile unsigned short int * const)(0x66 + SIM_CRB) -#define CSOR7 (volatile unsigned short int * const)(0x6a + SIM_CRB) -#define CSOR8 (volatile unsigned short int * const)(0x6e + SIM_CRB) -#define CSOR9 (volatile unsigned short int * const)(0x72 + SIM_CRB) -#define CSOR10 (volatile unsigned short int * const)(0x76 + SIM_CRB) - -#endif /* _SIM_h_ */ diff --git a/cpukit/score/cpu/m68k/sim.h b/cpukit/score/cpu/m68k/sim.h deleted file mode 100644 index fae7fe8783..0000000000 --- a/cpukit/score/cpu/m68k/sim.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - *------------------------------------------------------------------- - * - * SIM -- System Integration Module - * - * The system integration module (SIM) is used on many Motorola 16- - * and 32-bit MCUs for the following functions: - * - * () System configuration and protection. Bus and software watchdog - * monitors are provided in addition to periodic interrupt generators. - * - * () Clock signal generation for other intermodule bus (IMB) members - * and external devices. - * - * () The generation of chip-select signals that simplify external - * circuitry interface. - * - * () Data ports that are available for general purpose input and - * output. - * - * () A system test block that is intended only for factory tests. - * - * For more information, refer to Motorola's "Modular Microcontroller - * Family System Integration Module Reference Manual" (Motorola document - * SIMRM/AD). - * - * This file has been created by John S. Gwynne for support of - * Motorola's 68332 MCU in the efi332 project. - * - * Redistribution and use in source and binary forms are permitted - * provided that the following conditions are met: - * 1. Redistribution of source code and documentation must retain - * the above authorship, this list of conditions and the - * following disclaimer. - * 2. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * This software is provided "AS IS" without warranty of any kind, - * either expressed or implied, including, but not limited to, the - * implied warranties of merchantability, title and fitness for a - * particular purpose. - * - *------------------------------------------------------------------ - * - * $Id$ - */ - -#ifndef _SIM_H_ -#define _SIM_H_ - - -#include <efi332.h> - - -/* SAM-- shift and mask */ -#undef SAM -#define SAM(a,b,c) ((a << b) & c) - - - -/* SIM_CRB (SIM Control Register Block) base address of the SIM - control registers */ -/* not included in ram_init.h */ -#if SIM_MM == 0 -#define SIM_CRB 0x7ffa00 -#else -#undef SIM_MM -#define SIM_MM 1 -#define SIM_CRB 0xfffa00 -#endif -/* end not included in ram_init.h */ - - - -#define SIMCR (volatile unsigned short int * const)(0x00 + SIM_CRB) - /* Module Configuration Register */ -#define EXOFF 0x8000 /* External Clock Off */ -#define FRZSW 0x4000 /* Freeze Software Enable */ -#define FRZBM 0x2000 /* Freeze Bus Monitor Enable */ -#define SLVEN 0x0800 /* Factory Test Model Enabled (ro)*/ -#define SHEN 0x0300 /* Show Cycle Enable */ -#define SUPV 0x0080 /* Supervisor/Unrestricted Data Space */ -#define MM 0x0040 /* Module Mapping */ -#define IARB 0x000f /* Interrupt Arbitration Field */ - - - -#define SIMTR (volatile unsigned short int * const)(0x02 + SIM_CRB) - /* SIM Test Register */ -/* Used only for factor testing */ - - - -#define SYNCR (volatile unsigned short int * const)(0x04 + SIM_CRB) - /* Clock Synthesizer Control Register */ -#define W 0x8000 /* Frequency Control (VCO) */ -#define X 0x4000 /* Frequency Control Bit (Prescale) */ -#define Y 0x3f00 /* Frequency Control Counter */ -#define EDIV 0x0080 /* ECLK Divide Rate */ -#define SLIMP 0x0010 /* Limp Mode Status */ -#define SLOCK 0x0008 /* Synthesizer Lock */ -#define RSTEN 0x0004 /* Reset Enable */ -#define STSIM 0x0002 /* Stop Mode SIM Clock */ -#define STEXT 0x0001 /* Stop Mode External Clock */ - - - -#define RSR (volatile unsigned char * const)(0x07 + SIM_CRB) - /* Reset Status Register */ -#define EXT 0x0080 /* External Reset */ -#define POW 0x0040 /* Power-On Reset */ -#define SW 0x0020 /* Software Watchdog Reset */ -#define DBF 0x0010 /* Double Bus Fault Reset */ -#define LOC 0x0004 /* Loss of Clock Reset */ -#define SYS 0x0002 /* System Reset */ -#define TST 0x0001 /* Test Submodule Reset */ - - - -#define SIMTRE (volatile unsigned short int * const)(0x08 + SIM_CRB) - /* System Integration Test Register */ -/* Used only for factor testing */ - - - -#define PORTE0 (volatile unsigned char * const)(0x11 + SIM_CRB) -#define PORTE1 (volatile unsigned char * const)(0x13 + SIM_CRB) - /* Port E Data Register */ -#define DDRE (volatile unsigned char * const)(0x15 + SIM_CRB) - /* Port E Data Direction Register */ -#define PEPAR (volatile unsigned char * const)(0x17 + SIM_CRB) - /* Port E Pin Assignment Register */ -/* Any bit cleared (zero) defines the corresponding pin to be an I/O - pin. Any bit set defines the corresponding pin to be a bus control - signal. */ - - - -#define PORTF0 (volatile unsigned char * const)(0x19 + SIM_CRB) -#define PORTF1 (volatile unsigned char * const)(0x1b + SIM_CRB) - /* Port F Data Register */ -#define DDRF (volatile unsigned char * const)(0x1d + SIM_CRB) - /* Port E Data Direction Register */ -#define PFPAR (volatile unsigned char * const)(0x1f + SIM_CRB) -/* Any bit cleared (zero) defines the corresponding pin to be an I/O - pin. Any bit set defines the corresponding pin to be a bus control - signal. */ - - - -#define SYPCR (volatile unsigned char * const)(0x21 + SIM_CRB) -/* !!! can write to only once after reset !!! */ - /* System Protection Control Register */ -#define SWE 0x80 /* Software Watch Enable */ -#define SWP 0x40 /* Software Watchdog Prescale */ -#define SWT 0x30 /* Software Watchdog Timing */ -#define HME 0x08 /* Halt Monitor Enable */ -#define BME 0x04 /* Bus Monitor External Enable */ -#define BMT 0x03 /* Bus Monitor Timing */ - - - -#define PICR (volatile unsigned short int * const)(0x22 + SIM_CRB) - /* Periodic Interrupt Control Reg. */ -#define PIRQL 0x0700 /* Periodic Interrupt Request Level */ -#define PIV 0x00ff /* Periodic Interrupt Level */ - - - -#define PITR (volatile unsigned short int * const)(0x24 + SIM_CRB) - /* Periodic Interrupt Timer Register */ -#define PTP 0x0100 /* Periodic Timer Prescaler Control */ -#define PITM 0x00ff /* Periodic Interrupt Timing Modulus */ - - - -#define SWSR (volatile unsigned char * const)(0x27 + SIM_CRB) - /* Software Service Register */ -/* write 0x55 then 0xaa to service the software watchdog */ - - - -#define TSTMSRA (volatile unsigned short int * const)(0x30 + SIM_CRB) - /* Test Module Master Shift A */ -#define TSTMSRB (volatile unsigned short int * const)(0x32 + SIM_CRB) - /* Test Module Master Shift A */ -#define TSTSC (volatile unsigned short int * const)(0x34 + SIM_CRB) - /* Test Module Shift Count */ -#define TSTRC (volatile unsigned short int * const)(0x36 + SIM_CRB) - /* Test Module Repetition Counter */ -#define CREG (volatile unsigned short int * const)(0x38 + SIM_CRB) - /* Test Module Control */ -#define DREG (volatile unsigned short int * const)(0x3a + SIM_CRB) - /* Test Module Distributed */ -/* Used only for factor testing */ - - - -#define PORTC (volatile unsigned char * const)(0x41 + SIM_CRB) - /* Port C Data */ - - - -#define CSPAR0 (volatile unsigned short int * const)(0x44 + SIM_CRB) - /* Chip Select Pin Assignment - Resgister 0 */ -/* CSPAR0 contains seven two-bit fields that determine the functions - of corresponding chip-select pins. CSPAR0[15:14] are not - used. These bits always read zero; write have no effect. CSPAR0 bit - 1 always reads one; writes to CSPAR0 bit 1 have no effect. */ -#define CSPAR1 (volatile unsigned short int * const)(0x46 + SIM_CRB) - /* Chip Select Pin Assignment - Register 1 */ -/* CSPAR1 contains five two-bit fields that determine the finctions of - corresponding chip-select pins. CSPAR1[15:10] are not used. These - bits always read zero; writes have no effect. */ -/* - * - * Bit Field | Description - * ------------+--------------- - * 00 | Discrete Output - * 01 | Alternate Function - * 10 | Chip Select (8-bit port) - * 11 | Chip Select (16-bit port) - */ -#define DisOut 0x0 -#define AltFun 0x1 -#define CS8bit 0x2 -#define CS16bit 0x3 -/* - * - * CSPARx Field |Chip Select Signal | Alternate Signal | Discrete Output - *-----------------+--------------------+--------------------+---------------*/ -#define CS_5 12 /* !CS5 | FC2 | PC2 */ -#define CS_4 10 /* !CS4 | FC1 | PC1 */ -#define CS_3 8 /* !CS3 | FC0 | PC0 */ -#define CS_2 6 /* !CS2 | !BGACK | */ -#define CS_1 4 /* !CS1 | !BG | */ -#define CS_0 2 /* !CS0 | !BR | */ -#define CSBOOT 0 /* !CSBOOT | | */ -/* | | | */ -#define CS_10 8 /* !CS10 | ADDR23 | ECLK */ -#define CS_9 6 /* !CS9 | ADDR22 | PC6 */ -#define CS_8 4 /* !CS8 | ADDR21 | PC5 */ -#define CS_7 2 /* !CS7 | ADDR20 | PC4 */ -#define CS_6 0 /* !CS6 | ADDR19 | PC3 */ - -#define BS_2K 0x0 -#define BS_8K 0x1 -#define BS_16K 0x2 -#define BS_64K 0x3 -#define BS_128K 0x4 -#define BS_256K 0x5 -#define BS_512K 0x6 -#define BS_1M 0x7 - -#define CSBARBT (volatile unsigned short int * const)(0x48 + SIM_CRB) -#define CSBAR0 (volatile unsigned short int * const)(0x4c + SIM_CRB) -#define CSBAR1 (volatile unsigned short int * const)(0x50 + SIM_CRB) -#define CSBAR2 (volatile unsigned short int * const)(0x54 + SIM_CRB) -#define CSBAR3 (volatile unsigned short int * const)(0x58 + SIM_CRB) -#define CSBAR4 (volatile unsigned short int * const)(0x5c + SIM_CRB) -#define CSBAR5 (volatile unsigned short int * const)(0x60 + SIM_CRB) -#define CSBAR6 (volatile unsigned short int * const)(0x64 + SIM_CRB) -#define CSBAR7 (volatile unsigned short int * const)(0x68 + SIM_CRB) -#define CSBAR8 (volatile unsigned short int * const)(0x6c + SIM_CRB) -#define CSBAR9 (volatile unsigned short int * const)(0x70 + SIM_CRB) -#define CSBAR10 (volatile unsigned short int * const)(0x74 + SIM_CRB) - -#define MODE 0x8000 -#define Disable 0 -#define LowerByte 0x2000 -#define UpperByte 0x4000 -#define BothBytes 0x6000 -#define ReadOnly 0x0800 -#define WriteOnly 0x1000 -#define ReadWrite 0x1800 -#define SyncAS 0x0 -#define SyncDS 0x0400 - -#define WaitStates_0 (0x0 << 6) -#define WaitStates_1 (0x1 << 6) -#define WaitStates_2 (0x2 << 6) -#define WaitStates_3 (0x3 << 6) -#define WaitStates_4 (0x4 << 6) -#define WaitStates_5 (0x5 << 6) -#define WaitStates_6 (0x6 << 6) -#define WaitStates_7 (0x7 << 6) -#define WaitStates_8 (0x8 << 6) -#define WaitStates_9 (0x9 << 6) -#define WaitStates_10 (0xa << 6) -#define WaitStates_11 (0xb << 6) -#define WaitStates_12 (0xc << 6) -#define WaitStates_13 (0xd << 6) -#define FastTerm (0xe << 6) -#define External (0xf << 6) - -#define CPUSpace (0x0 << 4) -#define UserSpace (0x1 << 4) -#define SupSpace (0x2 << 4) -#define UserSupSpace (0x3 << 4) - -#define IPLevel_any 0x0 -#define IPLevel_1 0x2 -#define IPLevel_2 0x4 -#define IPLevel_3 0x6 -#define IPLevel_4 0x8 -#define IPLevel_5 0xa -#define IPLevel_6 0xc -#define IPLevel_7 0xe - -#define AVEC 1 - -#define CSORBT (volatile unsigned short int * const)(0x4a + SIM_CRB) -#define CSOR0 (volatile unsigned short int * const)(0x4e + SIM_CRB) -#define CSOR1 (volatile unsigned short int * const)(0x52 + SIM_CRB) -#define CSOR2 (volatile unsigned short int * const)(0x56 + SIM_CRB) -#define CSOR3 (volatile unsigned short int * const)(0x5a + SIM_CRB) -#define CSOR4 (volatile unsigned short int * const)(0x5e + SIM_CRB) -#define CSOR5 (volatile unsigned short int * const)(0x62 + SIM_CRB) -#define CSOR6 (volatile unsigned short int * const)(0x66 + SIM_CRB) -#define CSOR7 (volatile unsigned short int * const)(0x6a + SIM_CRB) -#define CSOR8 (volatile unsigned short int * const)(0x6e + SIM_CRB) -#define CSOR9 (volatile unsigned short int * const)(0x72 + SIM_CRB) -#define CSOR10 (volatile unsigned short int * const)(0x76 + SIM_CRB) - -#endif /* _SIM_h_ */ diff --git a/cpukit/score/cpu/no_cpu/asm.h b/cpukit/score/cpu/no_cpu/asm.h deleted file mode 100644 index 66d98be652..0000000000 --- a/cpukit/score/cpu/no_cpu/asm.h +++ /dev/null @@ -1,98 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. This file is: - * - * COPYRIGHT (c) 1994. - * On-Line Applications Research Corporation (OAR). - * - * $Id$ - */ - -#ifndef __NO_CPU_ASM_h -#define __NO_CPU_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM -#include <rtems/score/no_cpu.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -/* - * define macros for all of the registers on this CPU - * - * EXAMPLE: #define d0 REG (d0) - */ - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/no_cpu/cpu.c b/cpukit/score/cpu/no_cpu/cpu.c deleted file mode 100644 index ba533324ac..0000000000 --- a/cpukit/score/cpu/no_cpu/cpu.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * XXX CPU Dependent Source - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/wkspace.h> - -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: - * cpu_table - CPU table to initialize - * thread_dispatch - address of disptaching routine - */ - - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ -) -{ - /* - * The thread_dispatch argument is the address of the entry point - * for the routine called at the end of an ISR once it has been - * decided a context switch is necessary. On some compilation - * systems it is difficult to call a high-level language routine - * from assembly. This allows us to trick these systems. - * - * If you encounter this problem save the entry point in a CPU - * dependent variable. - */ - - _CPU_Thread_dispatch_pointer = thread_dispatch; - - /* - * If there is not an easy way to initialize the FP context - * during Context_Initialize, then it is usually easier to - * save an "uninitialized" FP context here and copy it to - * the task's during Context_Initialize. - */ - - /* FP context initialization support goes here */ - - _CPU_Table = *cpu_table; -} - -/*PAGE - * - * _CPU_ISR_Get_level - */ - -unsigned32 _CPU_ISR_Get_level( void ) -{ - /* - * This routine returns the current interrupt level. - */ -} - -/*PAGE - * - * _CPU_ISR_install_raw_handler - */ - -void _CPU_ISR_install_raw_handler( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - /* - * This is where we install the interrupt handler into the "raw" interrupt - * table used by the CPU to dispatch interrupt handlers. - */ -} - -/*PAGE - * - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * old_handler - former ISR for this vector number - * new_handler - replacement ISR for this vector number - * - * Output parameters: NONE - * - */ - -void _CPU_ISR_install_vector( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - *old_handler = _ISR_Vector_table[ vector ]; - - /* - * If the interrupt vector table is a table of pointer to isr entry - * points, then we need to install the appropriate RTEMS interrupt - * handler for this vector number. - */ - - _CPU_ISR_install_raw_handler( vector, new_handler, old_handler ); - - /* - * We put the actual user ISR address in '_ISR_vector_table'. This will - * be used by the _ISR_Handler so the user gets control. - */ - - _ISR_Vector_table[ vector ] = new_handler; -} - -/*PAGE - * - * _CPU_Install_interrupt_stack - */ - -void _CPU_Install_interrupt_stack( void ) -{ -} - -/*PAGE - * - * _CPU_Thread_Idle_body - * - * NOTES: - * - * 1. This is the same as the regular CPU independent algorithm. - * - * 2. If you implement this using a "halt", "idle", or "shutdown" - * instruction, then don't forget to put it in an infinite loop. - * - * 3. Be warned. Some processors with onboard DMA have been known - * to stop the DMA if the CPU were put in IDLE mode. This might - * also be a problem with other on-chip peripherals. So use this - * hook with caution. - */ - -void _CPU_Thread_Idle_body( void ) -{ - - for( ; ; ) - /* insert your "halt" instruction here */ ; -} diff --git a/cpukit/score/cpu/no_cpu/cpu_asm.c b/cpukit/score/cpu/no_cpu/cpu_asm.c deleted file mode 100644 index 5a36ece987..0000000000 --- a/cpukit/score/cpu/no_cpu/cpu_asm.c +++ /dev/null @@ -1,165 +0,0 @@ -/* cpu_asm.c ===> cpu_asm.S or cpu_asm.s - * - * This file contains the basic algorithms for all assembly code used - * in an specific CPU port of RTEMS. These algorithms must be implemented - * in assembly language - * - * NOTE: This is supposed to be a .S or .s file NOT a C file. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -/* - * This is supposed to be an assembly file. This means that system.h - * and cpu.h should not be included in a "real" cpu_asm file. An - * implementation in assembly should include "cpu_asm.h> - */ - -#include <rtems/system.h> -#include <rtems/score/cpu.h> -/* #include "cpu_asm.h> */ - -/* - * _CPU_Context_save_fp_context - * - * This routine is responsible for saving the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_save_fp( - void **fp_context_ptr -) -{ -} - -/* - * _CPU_Context_restore_fp_context - * - * This routine is responsible for restoring the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_restore_fp( - void **fp_context_ptr -) -{ -} - -/* _CPU_Context_switch - * - * This routine performs a normal non-FP context switch. - */ - -void _CPU_Context_switch( - Context_Control *run, - Context_Control *heir -) -{ -} - -/* - * _CPU_Context_restore - * - * This routine is generallu used only to restart self in an - * efficient manner. It may simply be a label in _CPU_Context_switch. - * - * NOTE: May be unnecessary to reload some registers. - */ - -void _CPU_Context_restore( - Context_Control *new_context -) -{ -} - -/* void __ISR_Handler() - * - * This routine provides the RTEMS interrupt management. - * - */ - -void _ISR_Handler() -{ - /* - * This discussion ignores a lot of the ugly details in a real - * implementation such as saving enough registers/state to be - * able to do something real. Keep in mind that the goal is - * to invoke a user's ISR handler which is written in C and - * uses a certain set of registers. - * - * Also note that the exact order is to a large extent flexible. - * Hardware will dictate a sequence for a certain subset of - * _ISR_Handler while requirements for setting - */ - - /* - * At entry to "common" _ISR_Handler, the vector number must be - * available. On some CPUs the hardware puts either the vector - * number or the offset into the vector table for this ISR in a - * known place. If the hardware does not give us this information, - * then the assembly portion of RTEMS for this port will contain - * a set of distinct interrupt entry points which somehow place - * the vector number in a known place (which is safe if another - * interrupt nests this one) and branches to _ISR_Handler. - * - * save some or all context on stack - * may need to save some special interrupt information for exit - * - * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE ) - * if ( _ISR_Nest_level == 0 ) - * switch to software interrupt stack - * #endif - * - * _ISR_Nest_level++; - * - * _Thread_Dispatch_disable_level++; - * - * (*_ISR_Vector_table[ vector ])( vector ); - * - * --_ISR_Nest_level; - * - * if ( _ISR_Nest_level ) - * goto the label "exit interrupt (simple case)" - * - * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE ) - * restore stack - * #endif - * - * if ( !_Context_Switch_necessary ) - * goto the label "exit interrupt (simple case)" - * - * if ( !_ISR_Signals_to_thread_executing ) - * _ISR_Signals_to_thread_executing = FALSE; - * goto the label "exit interrupt (simple case)" - * - * call _Thread_Dispatch() or prepare to return to _ISR_Dispatch - * - * prepare to get out of interrupt - * return from interrupt (maybe to _ISR_Dispatch) - * - * LABEL "exit interrupt (simple case): - * prepare to get out of interrupt - * return from interrupt - */ -} - diff --git a/cpukit/score/cpu/no_cpu/rtems/asm.h b/cpukit/score/cpu/no_cpu/rtems/asm.h deleted file mode 100644 index 66d98be652..0000000000 --- a/cpukit/score/cpu/no_cpu/rtems/asm.h +++ /dev/null @@ -1,98 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. This file is: - * - * COPYRIGHT (c) 1994. - * On-Line Applications Research Corporation (OAR). - * - * $Id$ - */ - -#ifndef __NO_CPU_ASM_h -#define __NO_CPU_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM -#include <rtems/score/no_cpu.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -/* - * define macros for all of the registers on this CPU - * - * EXAMPLE: #define d0 REG (d0) - */ - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/sparc/README b/cpukit/score/cpu/sparc/README deleted file mode 100644 index c4c2200075..0000000000 --- a/cpukit/score/cpu/sparc/README +++ /dev/null @@ -1,110 +0,0 @@ -# -# $Id$ -# - -This file discusses SPARC specific issues which are important to -this port. The primary topics in this file are: - - + Global Register Usage - + Stack Frame - + EF bit in the PSR - - -Global Register Usage -===================== - -This information on register usage is based heavily on a comment in the -file gcc-2.7.0/config/sparc/sparc.h in the the gcc 2.7.0 source. - - + g0 is hardwired to 0 - + On non-v9 systems: - - g1 is free to use as temporary. - - g2-g4 are reserved for applications. Gcc normally uses them as - temporaries, but this can be disabled via the -mno-app-regs option. - - g5 through g7 are reserved for the operating system. - + On v9 systems: - - g1 and g5 are free to use as temporaries. - - g2-g4 are reserved for applications (the compiler will not normally use - them, but they can be used as temporaries with -mapp-regs). - - g6-g7 are reserved for the operating system. - - NOTE: As of gcc 2.7.0 register g1 was used in the following scenarios: - - + as a temporary by the 64 bit sethi pattern - + when restoring call-preserved registers in large stack frames - -RTEMS places no constraints on the usage of the global registers. Although -gcc assumes that either g5-g7 (non-V9) or g6-g7 (V9) are reserved for the -operating system, RTEMS does not assume any special use for them. - - - -Stack Frame -=========== - -The stack grows downward (i.e. to lower addresses) on the SPARC architecture. - -The following is the organization of the stack frame: - - - - | ............... | - fp | | - +-------------------------------+ - | | - | Local registers, temporaries, | - | and saved floats | x bytes - | | - sp + x +-------------------------------+ - | | - | outgoing parameters past | - | the sixth one | x bytes - | | - sp + 92 +-------------------------------+ * - | | * - | area for callee to save | * - | register arguments | * 24 bytes - | | * - sp + 68 +-------------------------------+ * - | | * - | structure return pointer | * 4 bytes - | | * - sp + 64 +-------------------------------+ * - | | * - | local register set | * 32 bytes - | | * - sp + 32 +-------------------------------+ * - | | * - | input register set | * 32 bytes - | | * - sp +-------------------------------+ * - - -* = minimal stack frame - -x = optional components - -EF bit in the PSR -================= - -The EF (enable floating point unit) in the PSR is utilized in this port to -prevent non-floating point tasks from performing floating point -operations. This bit is maintained as part of the integer context. -However, the floating point context is switched BEFORE the integer -context. Thus the EF bit in place at the time of the FP switch may -indicate that FP operations are disabled. This occurs on certain task -switches, when the EF bit will be 0 for the outgoing task and thus a fault -will be generated on the first FP operation of the FP context save. - -The remedy for this is to enable FP access as the first step in both the -save and restore of the FP context area. This bit will be subsequently -reloaded by the integer context switch. - -Two of the scenarios which demonstrate this problem are outlined below: - -1. When the first FP task is switched to. The system tasks are not FP and -thus would be unable to restore the FP context of the incoming task. - -2. On a deferred FP context switch. In this case, the system might switch -from FP Task A to non-FP Task B and then to FP Task C. In this scenario, -the floating point state must technically be saved by a non-FP task. diff --git a/cpukit/score/cpu/sparc/asm.h b/cpukit/score/cpu/sparc/asm.h deleted file mode 100644 index a3d62416b8..0000000000 --- a/cpukit/score/cpu/sparc/asm.h +++ /dev/null @@ -1,111 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. - * - * $Id$ - */ - -#ifndef __SPARC_ASM_h -#define __SPARC_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM - -#include <rtems/score/sparc.h> -#include <rtems/score/cpu.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */ -/* XXX The following ifdef magic fixes the problem but results in a warning */ -/* XXX when compiling assembly code. */ -#undef __USER_LABEL_PREFIX__ -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -/* - * define macros for all of the registers on this CPU - * - * EXAMPLE: #define d0 REG (d0) - */ - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -/* - * Entry for traps which jump to a programmer-specified trap handler. - */ - -#define TRAP(_vector, _handler) \ - mov %psr, %l0 ; \ - sethi %hi(_handler), %l4 ; \ - jmp %l4+%lo(_handler); \ - mov _vector, %l3 - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/sparc/cpu.c b/cpukit/score/cpu/sparc/cpu.c deleted file mode 100644 index 23a93f176e..0000000000 --- a/cpukit/score/cpu/sparc/cpu.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * SPARC Dependent Source - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * Ported to ERC32 implementation of the SPARC by On-Line Applications - * Research Corporation (OAR) under contract to the European Space - * Agency (ESA). - * - * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. - * European Space Agency. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> - -#if defined(erc32) -#include <erc32.h> -#endif - -/* - * This initializes the set of opcodes placed in each trap - * table entry. The routine which installs a handler is responsible - * for filling in the fields for the _handler address and the _vector - * trap type. - * - * The constants following this structure are masks for the fields which - * must be filled in when the handler is installed. - */ - -const CPU_Trap_table_entry _CPU_Trap_slot_template = { - 0xa1480000, /* mov %psr, %l0 */ - 0x29000000, /* sethi %hi(_handler), %l4 */ - 0x81c52000, /* jmp %l4 + %lo(_handler) */ - 0xa6102000 /* mov _vector, %l3 */ -}; - -/*PAGE - * - * _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * Input Parameters: - * cpu_table - CPU table to initialize - * thread_dispatch - address of disptaching routine - * - * Output Parameters: NONE - * - * NOTE: There is no need to save the pointer to the thread dispatch routine. - * The SPARC's assembly code can reference it directly with no problems. - */ - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ -) -{ - void *pointer; - unsigned32 trap_table_start; - unsigned32 tbr_value; - CPU_Trap_table_entry *old_tbr; - CPU_Trap_table_entry *trap_table; - - /* - * Install the executive's trap table. All entries from the original - * trap table are copied into the executive's trap table. This is essential - * since this preserves critical trap handlers such as the window underflow - * and overflow handlers. It is the responsibility of the BSP to provide - * install these in the initial trap table. - */ - - trap_table_start = (unsigned32) &_CPU_Trap_Table_area; - if (trap_table_start & (SPARC_TRAP_TABLE_ALIGNMENT-1)) - trap_table_start = (trap_table_start + SPARC_TRAP_TABLE_ALIGNMENT) & - ~(SPARC_TRAP_TABLE_ALIGNMENT-1); - - trap_table = (CPU_Trap_table_entry *) trap_table_start; - - sparc_get_tbr( tbr_value ); - - old_tbr = (CPU_Trap_table_entry *) (tbr_value & 0xfffff000); - - memcpy( trap_table, (void *) old_tbr, 256 * sizeof( CPU_Trap_table_entry ) ); - - sparc_set_tbr( trap_table_start ); - - /* - * This seems to be the most appropriate way to obtain an initial - * FP context on the SPARC. The NULL fp context is copied it to - * the task's FP context during Context_Initialize. - */ - - pointer = &_CPU_Null_fp_context; - _CPU_Context_save_fp( &pointer ); - - /* - * Grab our own copy of the user's CPU table. - */ - - _CPU_Table = *cpu_table; - -#if defined(erc32) - - /* - * ERC32 specific initialization - */ - - _ERC32_MEC_Timer_Control_Mirror = 0; - ERC32_MEC.Timer_Control = 0; - - ERC32_MEC.Control |= ERC32_CONFIGURATION_POWER_DOWN_ALLOWED; - -#endif - -} - -/*PAGE - * - * _CPU_ISR_Get_level - * - * Input Parameters: NONE - * - * Output Parameters: - * returns the current interrupt level (PIL field of the PSR) - */ - -unsigned32 _CPU_ISR_Get_level( void ) -{ - unsigned32 level; - - sparc_get_interrupt_level( level ); - - return level; -} - -/*PAGE - * - * _CPU_ISR_install_raw_handler - * - * This routine installs the specified handler as a "raw" non-executive - * supported trap handler (a.k.a. interrupt service routine). - * - * Input Parameters: - * vector - trap table entry number plus synchronous - * vs. asynchronous information - * new_handler - address of the handler to be installed - * old_handler - pointer to an address of the handler previously installed - * - * Output Parameters: NONE - * *new_handler - address of the handler previously installed - * - * NOTE: - * - * On the SPARC, there are really only 256 vectors. However, the executive - * has no easy, fast, reliable way to determine which traps are synchronous - * and which are asynchronous. By default, synchronous traps return to the - * instruction which caused the interrupt. So if you install a software - * trap handler as an executive interrupt handler (which is desirable since - * RTEMS takes care of window and register issues), then the executive needs - * to know that the return address is to the trap rather than the instruction - * following the trap. - * - * So vectors 0 through 255 are treated as regular asynchronous traps which - * provide the "correct" return address. Vectors 256 through 512 are assumed - * by the executive to be synchronous and to require that the return address - * be fudged. - * - * If you use this mechanism to install a trap handler which must reexecute - * the instruction which caused the trap, then it should be installed as - * an asynchronous trap. This will avoid the executive changing the return - * address. - */ - -void _CPU_ISR_install_raw_handler( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - unsigned32 real_vector; - CPU_Trap_table_entry *tbr; - CPU_Trap_table_entry *slot; - unsigned32 u32_tbr; - unsigned32 u32_handler; - - /* - * Get the "real" trap number for this vector ignoring the synchronous - * versus asynchronous indicator included with our vector numbers. - */ - - real_vector = SPARC_REAL_TRAP_NUMBER( vector ); - - /* - * Get the current base address of the trap table and calculate a pointer - * to the slot we are interested in. - */ - - sparc_get_tbr( u32_tbr ); - - u32_tbr &= 0xfffff000; - - tbr = (CPU_Trap_table_entry *) u32_tbr; - - slot = &tbr[ real_vector ]; - - /* - * Get the address of the old_handler from the trap table. - * - * NOTE: The old_handler returned will be bogus if it does not follow - * the RTEMS model. - */ - -#define HIGH_BITS_MASK 0xFFFFFC00 -#define HIGH_BITS_SHIFT 10 -#define LOW_BITS_MASK 0x000003FF - - if ( slot->mov_psr_l0 == _CPU_Trap_slot_template.mov_psr_l0 ) { - u32_handler = - ((slot->sethi_of_handler_to_l4 & HIGH_BITS_MASK) << HIGH_BITS_SHIFT) | - (slot->jmp_to_low_of_handler_plus_l4 & LOW_BITS_MASK); - *old_handler = (proc_ptr) u32_handler; - } else - *old_handler = 0; - - /* - * Copy the template to the slot and then fix it. - */ - - *slot = _CPU_Trap_slot_template; - - u32_handler = (unsigned32) new_handler; - - slot->mov_vector_l3 |= vector; - slot->sethi_of_handler_to_l4 |= - (u32_handler & HIGH_BITS_MASK) >> HIGH_BITS_SHIFT; - slot->jmp_to_low_of_handler_plus_l4 |= (u32_handler & LOW_BITS_MASK); -} - -/*PAGE - * - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * new_handler - replacement ISR for this vector number - * old_handler - pointer to former ISR for this vector number - * - * Output parameters: - * *old_handler - former ISR for this vector number - * - */ - -void _CPU_ISR_install_vector( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - unsigned32 real_vector; - proc_ptr ignored; - - /* - * Get the "real" trap number for this vector ignoring the synchronous - * versus asynchronous indicator included with our vector numbers. - */ - - real_vector = SPARC_REAL_TRAP_NUMBER( vector ); - - /* - * Return the previous ISR handler. - */ - - *old_handler = _ISR_Vector_table[ real_vector ]; - - /* - * Install the wrapper so this ISR can be invoked properly. - */ - - _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored ); - - /* - * We put the actual user ISR address in '_ISR_vector_table'. This will - * be used by the _ISR_Handler so the user gets control. - */ - - _ISR_Vector_table[ real_vector ] = new_handler; -} - -/*PAGE - * - * _CPU_Context_Initialize - * - * This kernel routine initializes the basic non-FP context area associated - * with each thread. - * - * Input parameters: - * the_context - pointer to the context area - * stack_base - address of memory for the SPARC - * size - size in bytes of the stack area - * new_level - interrupt level for this context area - * entry_point - the starting execution point for this this context - * is_fp - TRUE if this context is associated with an FP thread - * - * Output parameters: NONE - */ - -void _CPU_Context_Initialize( - Context_Control *the_context, - unsigned32 *stack_base, - unsigned32 size, - unsigned32 new_level, - void *entry_point, - boolean is_fp -) -{ - unsigned32 stack_high; /* highest "stack aligned" address */ - unsigned32 the_size; - unsigned32 tmp_psr; - - /* - * On CPUs with stacks which grow down (i.e. SPARC), we build the stack - * based on the stack_high address. - */ - - stack_high = ((unsigned32)(stack_base) + size); - stack_high &= ~(CPU_STACK_ALIGNMENT - 1); - - the_size = size & ~(CPU_STACK_ALIGNMENT - 1); - - /* - * See the README in this directory for a diagram of the stack. - */ - - the_context->o7 = ((unsigned32) entry_point) - 8; - the_context->o6_sp = stack_high - CPU_MINIMUM_STACK_FRAME_SIZE; - the_context->i6_fp = stack_high; - - /* - * Build the PSR for the task. Most everything can be 0 and the - * CWP is corrected during the context switch. - * - * The EF bit determines if the floating point unit is available. - * The FPU is ONLY enabled if the context is associated with an FP task - * and this SPARC model has an FPU. - */ - - sparc_get_psr( tmp_psr ); - tmp_psr &= ~SPARC_PSR_PIL_MASK; - tmp_psr |= (new_level << 8) & SPARC_PSR_PIL_MASK; - tmp_psr &= ~SPARC_PSR_EF_MASK; /* disabled by default */ - -#if (SPARC_HAS_FPU == 1) - /* - * If this bit is not set, then a task gets a fault when it accesses - * a floating point register. This is a nice way to detect floating - * point tasks which are not currently declared as such. - */ - - if ( is_fp ) - tmp_psr |= SPARC_PSR_EF_MASK; -#endif - the_context->psr = tmp_psr; -} - -/*PAGE - * - * _CPU_Thread_Idle_body - * - * Some SPARC implementations have low power, sleep, or idle modes. This - * tries to take advantage of those models. - */ - -#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE) - -/* - * This is the implementation for the erc32. - * - * NOTE: Low power mode was enabled at initialization time. - */ - -#if defined(erc32) - -void _CPU_Thread_Idle_body( void ) -{ - while (1) { - ERC32_MEC.Power_Down = 0; /* value is irrelevant */ - } -} - -#endif - -#endif /* CPU_PROVIDES_IDLE_THREAD_BODY */ diff --git a/cpukit/score/cpu/sparc/rtems/asm.h b/cpukit/score/cpu/sparc/rtems/asm.h deleted file mode 100644 index a3d62416b8..0000000000 --- a/cpukit/score/cpu/sparc/rtems/asm.h +++ /dev/null @@ -1,111 +0,0 @@ -/* asm.h - * - * This include file attempts to address the problems - * caused by incompatible flavors of assemblers and - * toolsets. It primarily addresses variations in the - * use of leading underscores on symbols and the requirement - * that register names be preceded by a %. - * - * - * NOTE: The spacing in the use of these macros - * is critical to them working as advertised. - * - * COPYRIGHT: - * - * This file is based on similar code found in newlib available - * from ftp.cygnus.com. The file which was used had no copyright - * notice. This file is freely distributable as long as the source - * of the file is noted. - * - * $Id$ - */ - -#ifndef __SPARC_ASM_h -#define __SPARC_ASM_h - -/* - * Indicate we are in an assembly file and get the basic CPU definitions. - */ - -#define ASM - -#include <rtems/score/sparc.h> -#include <rtems/score/cpu.h> - -/* - * Recent versions of GNU cpp define variables which indicate the - * need for underscores and percents. If not using GNU cpp or - * the version does not support this, then you will obviously - * have to define these as appropriate. - */ - -/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */ -/* XXX The following ifdef magic fixes the problem but results in a warning */ -/* XXX when compiling assembly code. */ -#undef __USER_LABEL_PREFIX__ -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -/* - * define macros for all of the registers on this CPU - * - * EXAMPLE: #define d0 REG (d0) - */ - -/* - * Define macros to handle section beginning and ends. - */ - - -#define BEGIN_CODE_DCL .text -#define END_CODE_DCL -#define BEGIN_DATA_DCL .data -#define END_DATA_DCL -#define BEGIN_CODE .text -#define END_CODE -#define BEGIN_DATA -#define END_DATA -#define BEGIN_BSS -#define END_BSS -#define END - -/* - * Following must be tailor for a particular flavor of the C compiler. - * They may need to put underscores in front of the symbols. - */ - -#define PUBLIC(sym) .globl SYM (sym) -#define EXTERN(sym) .globl SYM (sym) - -/* - * Entry for traps which jump to a programmer-specified trap handler. - */ - -#define TRAP(_vector, _handler) \ - mov %psr, %l0 ; \ - sethi %hi(_handler), %l4 ; \ - jmp %l4+%lo(_handler); \ - mov _vector, %l3 - -#endif -/* end of include file */ - - diff --git a/cpukit/score/cpu/unix/cpu.c b/cpukit/score/cpu/unix/cpu.c deleted file mode 100644 index 5578911b16..0000000000 --- a/cpukit/score/cpu/unix/cpu.c +++ /dev/null @@ -1,938 +0,0 @@ -/* - * UNIX Simulator Dependent Source - * - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Division Incorporated not be - * used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * Division Incorporated makes no representations about the - * suitability of this software for any purpose. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/interr.h> - -#if defined(solaris2) -/* -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 3 -#undef __STRICT_ANSI__ -#define __STRICT_ANSI__ -*/ -#define __EXTENSIONS__ -#endif - -#if defined(linux) -#define MALLOC_0_RETURNS_NULL -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <setjmp.h> -#include <signal.h> -#include <time.h> -#include <sys/time.h> -#include <sys/types.h> -#include <errno.h> -#include <unistd.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <sys/sem.h> - -#ifndef SA_RESTART -#define SA_RESTART 0 -#endif - -typedef struct { - jmp_buf regs; - sigset_t isr_level; -} Context_Control_overlay; - -void _CPU_Signal_initialize(void); -void _CPU_Stray_signal(int); -void _CPU_ISR_Handler(int); - -sigset_t _CPU_Signal_mask; -Context_Control _CPU_Context_Default_with_ISRs_enabled; -Context_Control _CPU_Context_Default_with_ISRs_disabled; - -/* - * Which cpu are we? Used by libcpu and libbsp. - */ - -int cpu_number; - -/*PAGE - * - * _CPU_ISR_From_CPU_Init - */ - -sigset_t posix_empty_mask; - -void _CPU_ISR_From_CPU_Init() -{ - unsigned32 i; - proc_ptr old_handler; - - /* - * Generate an empty mask to be used by disable_support - */ - - sigemptyset(&posix_empty_mask); - - /* - * Block all the signals except SIGTRAP for the debugger - * and SIGABRT for fatal errors. - */ - - (void) sigfillset(&_CPU_Signal_mask); - (void) sigdelset(&_CPU_Signal_mask, SIGTRAP); - (void) sigdelset(&_CPU_Signal_mask, SIGABRT); - (void) sigdelset(&_CPU_Signal_mask, SIGIOT); - (void) sigdelset(&_CPU_Signal_mask, SIGCONT); - - _CPU_ISR_Enable(1); - - /* - * Set the handler for all signals to be signal_handler - * which will then vector out to the correct handler - * for whichever signal actually happened. Initially - * set the vectors to the stray signal handler. - */ - - for (i = 0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++) - (void)_CPU_ISR_install_vector(i, _CPU_Stray_signal, &old_handler); - - _CPU_Signal_initialize(); -} - -void _CPU_Signal_initialize( void ) -{ - struct sigaction act; - sigset_t mask; - - /* mark them all active except for TraceTrap and Abort */ - - sigfillset(&mask); - sigdelset(&mask, SIGTRAP); - sigdelset(&mask, SIGABRT); - sigdelset(&mask, SIGIOT); - sigdelset(&mask, SIGCONT); - sigprocmask(SIG_UNBLOCK, &mask, 0); - - act.sa_handler = _CPU_ISR_Handler; - act.sa_mask = mask; - act.sa_flags = SA_RESTART; - - sigaction(SIGHUP, &act, 0); - sigaction(SIGINT, &act, 0); - sigaction(SIGQUIT, &act, 0); - sigaction(SIGILL, &act, 0); -#ifdef SIGEMT - sigaction(SIGEMT, &act, 0); -#endif - sigaction(SIGFPE, &act, 0); - sigaction(SIGKILL, &act, 0); - sigaction(SIGBUS, &act, 0); - sigaction(SIGSEGV, &act, 0); -#ifdef SIGSYS - sigaction(SIGSYS, &act, 0); -#endif - sigaction(SIGPIPE, &act, 0); - sigaction(SIGALRM, &act, 0); - sigaction(SIGTERM, &act, 0); - sigaction(SIGUSR1, &act, 0); - sigaction(SIGUSR2, &act, 0); - sigaction(SIGCHLD, &act, 0); - sigaction(SIGCLD, &act, 0); - sigaction(SIGPWR, &act, 0); - sigaction(SIGVTALRM, &act, 0); - sigaction(SIGPROF, &act, 0); - sigaction(SIGIO, &act, 0); - sigaction(SIGWINCH, &act, 0); - sigaction(SIGSTOP, &act, 0); - sigaction(SIGTTIN, &act, 0); - sigaction(SIGTTOU, &act, 0); - sigaction(SIGURG, &act, 0); -#ifdef SIGLOST - sigaction(SIGLOST, &act, 0); -#endif - -} - -/*PAGE - * - * _CPU_Context_From_CPU_Init - */ - -void _CPU_Context_From_CPU_Init() -{ - -#if defined(hppa1_1) && defined(RTEMS_UNIXLIB_SETJMP) - /* - * HACK - set the _SYSTEM_ID to 0x20c so that setjmp/longjmp - * will handle the full 32 floating point registers. - * - * NOTE: Is this a bug in HPUX9? - */ - - { - extern unsigned32 _SYSTEM_ID; - - _SYSTEM_ID = 0x20c; - } -#endif - - /* - * get default values to use in _CPU_Context_Initialize() - */ - - _CPU_ISR_Set_level( 0 ); - _CPU_Context_switch( - &_CPU_Context_Default_with_ISRs_enabled, - &_CPU_Context_Default_with_ISRs_enabled - ); - - _CPU_ISR_Set_level( 1 ); - _CPU_Context_switch( - &_CPU_Context_Default_with_ISRs_disabled, - &_CPU_Context_Default_with_ISRs_disabled - ); -} - -/*PAGE - * - * _CPU_ISR_Get_level - */ - -sigset_t GET_old_mask; - -unsigned32 _CPU_ISR_Get_level( void ) -{ -/* sigset_t old_mask; */ - unsigned32 old_level; - - sigprocmask(0, 0, &GET_old_mask); - - if (memcmp((void *)&posix_empty_mask, (void *)&GET_old_mask, sizeof(sigset_t))) - old_level = 1; - else - old_level = 0; - - return old_level; -} - -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: - * cpu_table - CPU table to initialize - * thread_dispatch - address of disptaching routine - */ - - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ -) -{ - /* - * The thread_dispatch argument is the address of the entry point - * for the routine called at the end of an ISR once it has been - * decided a context switch is necessary. On some compilation - * systems it is difficult to call a high-level language routine - * from assembly. This allows us to trick these systems. - * - * If you encounter this problem save the entry point in a CPU - * dependent variable. - */ - - _CPU_Thread_dispatch_pointer = thread_dispatch; - - /* - * XXX; If there is not an easy way to initialize the FP context - * during Context_Initialize, then it is usually easier to - * save an "uninitialized" FP context here and copy it to - * the task's during Context_Initialize. - */ - - /* XXX: FP context initialization support */ - - _CPU_Table = *cpu_table; - - _CPU_ISR_From_CPU_Init(); - - _CPU_Context_From_CPU_Init(); - -} - -/*PAGE - * - * _CPU_ISR_install_raw_handler - */ - -void _CPU_ISR_install_raw_handler( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - _CPU_Fatal_halt( 0xdeaddead ); -} - -/*PAGE - * - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * old_handler - former ISR for this vector number - * new_handler - replacement ISR for this vector number - * - * Output parameters: NONE - * - */ - - -void _CPU_ISR_install_vector( - unsigned32 vector, - proc_ptr new_handler, - proc_ptr *old_handler -) -{ - *old_handler = _ISR_Vector_table[ vector ]; - - /* - * If the interrupt vector table is a table of pointer to isr entry - * points, then we need to install the appropriate RTEMS interrupt - * handler for this vector number. - */ - - /* - * We put the actual user ISR address in '_ISR_vector_table'. This will - * be used by the _CPU_ISR_Handler so the user gets control. - */ - - _ISR_Vector_table[ vector ] = new_handler; -} - -/*PAGE - * - * _CPU_Install_interrupt_stack - */ - -void _CPU_Install_interrupt_stack( void ) -{ -} - -/*PAGE - * - * _CPU_Thread_Idle_body - * - * Stop until we get a signal which is the logically the same thing - * entering low-power or sleep mode on a real processor and waiting for - * an interrupt. This significantly reduces the consumption of host - * CPU cycles which is again similar to low power mode. - */ - -void _CPU_Thread_Idle_body( void ) -{ - while (1) - pause(); -} - -/*PAGE - * - * _CPU_Context_Initialize - */ - -void _CPU_Context_Initialize( - Context_Control *_the_context, - unsigned32 *_stack_base, - unsigned32 _size, - unsigned32 _new_level, - void *_entry_point, - boolean _is_fp -) -{ - void *source; - unsigned32 *addr; - unsigned32 jmp_addr; - unsigned32 _stack_low; /* lowest "stack aligned" address */ - unsigned32 _stack_high; /* highest "stack aligned" address */ - unsigned32 _the_size; - - jmp_addr = (unsigned32) _entry_point; - - /* - * On CPUs with stacks which grow down, we build the stack - * based on the _stack_high address. On CPUs with stacks which - * grow up, we build the stack based on the _stack_low address. - */ - - _stack_low = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT); - _stack_low &= ~(CPU_STACK_ALIGNMENT - 1); - - _stack_high = ((unsigned32)(_stack_base) + _size); - _stack_high &= ~(CPU_STACK_ALIGNMENT - 1); - - _the_size = _size & ~(CPU_STACK_ALIGNMENT - 1); - - /* - * Slam our jmp_buf template into the context we are creating - */ - - if ( _new_level == 0 ) - source = &_CPU_Context_Default_with_ISRs_enabled; - else - source = &_CPU_Context_Default_with_ISRs_disabled; - - memcpy(_the_context, source, sizeof(Context_Control) ); /* sizeof(jmp_buf)); */ - - addr = (unsigned32 *)_the_context; - -#if defined(hppa1_1) - *(addr + RP_OFF) = jmp_addr; - *(addr + SP_OFF) = (unsigned32)(_stack_low + CPU_FRAME_SIZE); - - /* - * See if we are using shared libraries by checking - * bit 30 in 24 off of newp. If bit 30 is set then - * we are using shared libraries and the jump address - * is at what 24 off of newp points to so shove that - * into 24 off of newp instead. - */ - - if (jmp_addr & 0x40000000) { - jmp_addr &= 0xfffffffc; - *(addr + RP_OFF) = (unsigned32)*(unsigned32 *)jmp_addr; - } -#elif defined(sparc) - - /* - * See /usr/include/sys/stack.h in Solaris 2.3 for a nice - * diagram of the stack. - */ - - asm ("ta 0x03"); /* flush registers */ - - *(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET; - *(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE); - *(addr + FP_OFF) = (unsigned32)(_stack_high); - -#elif defined(i386) - - /* - * This information was gathered by disassembling setjmp(). - */ - - { - unsigned32 stack_ptr; - - stack_ptr = _stack_high - CPU_FRAME_SIZE; - - *(addr + EBX_OFF) = 0xFEEDFEED; - *(addr + ESI_OFF) = 0xDEADDEAD; - *(addr + EDI_OFF) = 0xDEAFDEAF; - *(addr + EBP_OFF) = stack_ptr; - *(addr + ESP_OFF) = stack_ptr; - *(addr + RET_OFF) = jmp_addr; - - addr = (unsigned32 *) stack_ptr; - - addr[ 0 ] = jmp_addr; - addr[ 1 ] = (unsigned32) stack_ptr; - addr[ 2 ] = (unsigned32) stack_ptr; - } - -#else -#error "UNKNOWN CPU!!!" -#endif - -} - -/*PAGE - * - * _CPU_Context_restore - */ - -void _CPU_Context_restore( - Context_Control *next -) -{ - Context_Control_overlay *nextp = (Context_Control_overlay *)next; - - sigprocmask( SIG_SETMASK, &nextp->isr_level, 0 ); - longjmp( nextp->regs, 0 ); -} - -/*PAGE - * - * _CPU_Context_switch - */ - -void _CPU_Context_switch( - Context_Control *current, - Context_Control *next -) -{ - Context_Control_overlay *currentp = (Context_Control_overlay *)current; - Context_Control_overlay *nextp = (Context_Control_overlay *)next; - - int status; - - /* - * Switch levels in one operation - */ - - status = sigprocmask( SIG_SETMASK, &nextp->isr_level, ¤tp->isr_level ); - if ( status ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - status - ); - - if (setjmp(currentp->regs) == 0) { /* Save the current context */ - longjmp(nextp->regs, 0); /* Switch to the new context */ - if ( status ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - status - ); - } - -} - -/*PAGE - * - * _CPU_Save_float_context - */ - -void _CPU_Save_float_context( - Context_Control_fp *fp_context -) -{ -} - -/*PAGE - * - * _CPU_Restore_float_context - */ - -void _CPU_Restore_float_context( - Context_Control_fp *fp_context -) -{ -} - -/*PAGE - * - * _CPU_ISR_Disable_support - */ - -unsigned32 _CPU_ISR_Disable_support(void) -{ - int status; - sigset_t old_mask; - - status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, &old_mask); - if ( status ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - status - ); - - if (memcmp((void *)&posix_empty_mask, (void *)&old_mask, sizeof(sigset_t))) - return 1; - - return 0; -} - -/*PAGE - * - * _CPU_ISR_Enable - */ - -void _CPU_ISR_Enable( - unsigned32 level -) -{ - int status; - - if (level == 0) - status = sigprocmask(SIG_UNBLOCK, &_CPU_Signal_mask, 0); - else - status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, 0); - - if ( status ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - status - ); -} - -/*PAGE - * - * _CPU_ISR_Handler - * - * External interrupt handler. - * This is installed as a UNIX signal handler. - * It vectors out to specific user interrupt handlers. - */ - -void _CPU_ISR_Handler(int vector) -{ - extern void _Thread_Dispatch(void); - extern unsigned32 _Thread_Dispatch_disable_level; - extern boolean _Context_Switch_necessary; - - if (_ISR_Nest_level++ == 0) { - /* switch to interrupt stack */ - } - - _Thread_Dispatch_disable_level++; - - if (_ISR_Vector_table[vector]) { - _ISR_Vector_table[vector](vector); - } else { - _CPU_Stray_signal(vector); - } - - if (_ISR_Nest_level-- == 0) { - /* switch back to original stack */ - } - - _Thread_Dispatch_disable_level--; - - if (_Thread_Dispatch_disable_level == 0 && - (_Context_Switch_necessary || _ISR_Signals_to_thread_executing)) { - _ISR_Signals_to_thread_executing = FALSE; - _CPU_ISR_Enable(0); - _Thread_Dispatch(); - } -} - -/*PAGE - * - * _CPU_Stray_signal - */ - -void _CPU_Stray_signal(int sig_num) -{ - char buffer[ 4 ]; - - /* - * print "stray" msg about ones which that might mean something - * Avoid using the stdio section of the library. - * The following is generally safe. - */ - - switch (sig_num) - { - case SIGCLD: - break; - - default: - { - /* - * We avoid using the stdio section of the library. - * The following is generally safe. - */ - - buffer[ 0 ] = (sig_num >> 4) + 0x30; - buffer[ 1 ] = (sig_num & 0xf) + 0x30; - buffer[ 2 ] = '\n'; - - write( 2, "Stray signal 0x", 12 ); - write( 2, buffer, 3 ); - } - } - - /* - * If it was a "fatal" signal, then exit here - * If app code has installed a hander for one of these, then - * we won't call _CPU_Stray_signal, so this is ok. - */ - - switch (sig_num) { - case SIGINT: - case SIGHUP: - case SIGQUIT: - case SIGILL: -#ifdef SIGEMT - case SIGEMT: -#endif - case SIGKILL: - case SIGBUS: - case SIGSEGV: - case SIGTERM: - _CPU_Fatal_error(0x100 + sig_num); - } -} - -/*PAGE - * - * _CPU_Fatal_error - */ - -void _CPU_Fatal_error(unsigned32 error) -{ - setitimer(ITIMER_REAL, 0, 0); - - if ( error ) { -#ifdef RTEMS_DEBUG - abort(); -#endif - if (getenv("RTEMS_DEBUG")) - abort(); - } - - _exit(error); -} - -/* - * Special Purpose Routines to hide the use of UNIX system calls. - */ - -int _CPU_Get_clock_vector( void ) -{ - return SIGALRM; -} - -void _CPU_Start_clock( - int microseconds -) -{ - struct itimerval new; - - new.it_value.tv_sec = 0; - new.it_value.tv_usec = microseconds; - new.it_interval.tv_sec = 0; - new.it_interval.tv_usec = microseconds; - - setitimer(ITIMER_REAL, &new, 0); -} - -void _CPU_Stop_clock( void ) -{ - struct itimerval new; - struct sigaction act; - - /* - * Set the SIGALRM signal to ignore any last - * signals that might come in while we are - * disarming the timer and removing the interrupt - * vector. - */ - - act.sa_handler = SIG_IGN; - - sigaction(SIGALRM, &act, 0); - - new.it_value.tv_sec = 0; - new.it_value.tv_usec = 0; - - setitimer(ITIMER_REAL, &new, 0); -} - -int _CPU_SHM_Semid; -extern void fix_syscall_errno( void ); - -void _CPU_SHM_Init( - unsigned32 maximum_nodes, - boolean is_master_node, - void **shm_address, - unsigned32 *shm_length -) -{ - int i; - int shmid; - char *shm_addr; - key_t shm_key; - key_t sem_key; - int status; - int shm_size; - - if (getenv("RTEMS_SHM_KEY")) - shm_key = strtol(getenv("RTEMS_SHM_KEY"), 0, 0); - else -#ifdef RTEMS_SHM_KEY - shm_key = RTEMS_SHM_KEY; -#else - shm_key = 0xa000; -#endif - - if (getenv("RTEMS_SHM_SIZE")) - shm_size = strtol(getenv("RTEMS_SHM_SIZE"), 0, 0); - else -#ifdef RTEMS_SHM_SIZE - shm_size = RTEMS_SHM_SIZE; -#else - shm_size = 64 * 1024; -#endif - - if (getenv("RTEMS_SHM_SEMAPHORE_KEY")) - sem_key = strtol(getenv("RTEMS_SHM_SEMAPHORE_KEY"), 0, 0); - else -#ifdef RTEMS_SHM_SEMAPHORE_KEY - sem_key = RTEMS_SHM_SEMAPHORE_KEY; -#else - sem_key = 0xa001; -#endif - - shmid = shmget(shm_key, shm_size, IPC_CREAT | 0660); - if ( shmid == -1 ) { - fix_syscall_errno(); /* in case of newlib */ - perror( "shmget" ); - _CPU_Fatal_halt( 0xdead0001 ); - } - - shm_addr = shmat(shmid, (char *)0, SHM_RND); - if ( shm_addr == (void *)-1 ) { - fix_syscall_errno(); /* in case of newlib */ - perror( "shmat" ); - _CPU_Fatal_halt( 0xdead0002 ); - } - - _CPU_SHM_Semid = semget(sem_key, maximum_nodes + 1, IPC_CREAT | 0660); - if ( _CPU_SHM_Semid == -1 ) { - fix_syscall_errno(); /* in case of newlib */ - perror( "semget" ); - _CPU_Fatal_halt( 0xdead0003 ); - } - - if ( is_master_node ) { - for ( i=0 ; i <= maximum_nodes ; i++ ) { -#if defined(solaris2) - union semun { - int val; - struct semid_ds *buf; - ushort *array; - } help; - - help.val = 1; - status = semctl( _CPU_SHM_Semid, i, SETVAL, help ); -#endif -#if defined(hpux) - status = semctl( _CPU_SHM_Semid, i, SETVAL, 1 ); -#endif - - fix_syscall_errno(); /* in case of newlib */ - if ( status == -1 ) { - _CPU_Fatal_halt( 0xdead0004 ); - } - } - } - - *shm_address = shm_addr; - *shm_length = shm_size; - -} - -int _CPU_Get_pid( void ) -{ - return getpid(); -} - -/* - * Define this to use signals for MPCI shared memory driver. - * If undefined, the shared memory driver will poll from the - * clock interrupt. - * Ref: ../shmsupp/getcfg.c - * - * BEWARE:: many UN*X kernels and debuggers become severely confused when - * debugging programs which use signals. The problem is *much* - * worse when using multiple signals, since ptrace(2) tends to - * drop all signals except 1 in the case of multiples. - * On hpux9, this problem was so bad, we couldn't use interrupts - * with the shared memory driver if we ever hoped to debug - * RTEMS programs. - * Maybe systems that use /proc don't have this problem... - */ - - -int _CPU_SHM_Get_vector( void ) -{ -#ifdef CPU_USE_SHM_INTERRUPTS - return SIGUSR1; -#else - return 0; -#endif -} - -void _CPU_SHM_Send_interrupt( - int pid, - int vector -) -{ - kill((pid_t) pid, vector); -} - -void _CPU_SHM_Lock( - int semaphore -) -{ - struct sembuf sb; - int status; - - sb.sem_num = semaphore; - sb.sem_op = -1; - sb.sem_flg = 0; - - while (1) { - status = semop(_CPU_SHM_Semid, &sb, 1); - if ( status >= 0 ) - break; - if ( status == -1 ) { - fix_syscall_errno(); /* in case of newlib */ - if (errno == EINTR) - continue; - perror("shm lock"); - _CPU_Fatal_halt( 0xdead0005 ); - } - } - -} - -void _CPU_SHM_Unlock( - int semaphore -) -{ - struct sembuf sb; - int status; - - sb.sem_num = semaphore; - sb.sem_op = 1; - sb.sem_flg = 0; - - while (1) { - status = semop(_CPU_SHM_Semid, &sb, 1); - if ( status >= 0 ) - break; - - if ( status == -1 ) { - fix_syscall_errno(); /* in case of newlib */ - if (errno == EINTR) - continue; - perror("shm unlock"); - _CPU_Fatal_halt( 0xdead0006 ); - } - } - -} diff --git a/cpukit/score/include/rtems/debug.h b/cpukit/score/include/rtems/debug.h deleted file mode 100644 index afe6251bbe..0000000000 --- a/cpukit/score/include/rtems/debug.h +++ /dev/null @@ -1,98 +0,0 @@ -/* debug.h - * - * This include file contains the information pertaining to the debug - * support within RTEMS. It is currently cast in the form of a - * Manager since it is externally accessible. - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_DEBUG_h -#define __RTEMS_DEBUG_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The following type is used to manage the debug mask. - */ - -typedef unsigned32 rtems_debug_control; - -/* - * These constants represent various classes of debugging. - */ - -#define RTEMS_DEBUG_ALL_MASK 0xffffffff -#define RTEMS_DEBUG_REGION 0x00000001 - -/* - * This variable contains the current debug level. - */ - -EXTERN rtems_debug_control _Debug_Level; - -/* - * _Debug_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _Debug_Manager_initialization( void ); - -/* - * rtems_debug_enable - * - * DESCRIPTION: - * - * This routine enables the specified types of debug checks. - */ - -void rtems_debug_enable ( - rtems_debug_control to_be_enabled -); - -/* - * rtems_debug_disable - * - * DESCRIPTION: - * - * This routine disables the specified types of debug checks. - */ - -void rtems_debug_disable ( - rtems_debug_control to_be_disabled -); - -/* - * - * _Debug_Is_enabled - * - * DESCRIPTION: - * - * This routine returns TRUE if the requested debug level is - * enabled, and FALSE otherwise. - */ - -boolean _Debug_Is_enabled( - rtems_debug_control level -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/address.h b/cpukit/score/include/rtems/score/address.h deleted file mode 100644 index d9be75ee4b..0000000000 --- a/cpukit/score/include/rtems/score/address.h +++ /dev/null @@ -1,31 +0,0 @@ -/* address.h - * - * This include file contains the information required to manipulate - * physical addresses. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_ADDRESSES_h -#define __RTEMS_ADDRESSES_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/address.inl> - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/apiext.h b/cpukit/score/include/rtems/score/apiext.h deleted file mode 100644 index 44e7bc8dd3..0000000000 --- a/cpukit/score/include/rtems/score/apiext.h +++ /dev/null @@ -1,102 +0,0 @@ -/* apiext.h - * - * XXX - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - - -#ifndef __API_EXTENSIONS_h -#define __API_EXTENSIONS_h - -#include <rtems/score/chain.h> -#include <rtems/score/thread.h> - -/* - * The control structure which defines the points at which an API - * can add an extension to the system initialization thread. - */ - -typedef void (*API_extensions_Predriver_hook)(void); -typedef void (*API_extensions_Postdriver_hook)(void); -typedef void (*API_extensions_Postswitch_hook)( - Thread_Control * - ); - - -typedef struct { - Chain_Node Node; - API_extensions_Predriver_hook predriver_hook; - API_extensions_Postdriver_hook postdriver_hook; - API_extensions_Postswitch_hook postswitch_hook; -} API_extensions_Control; - -/* - * This is the list of API extensions to the system initialization. - */ - -EXTERN Chain_Control _API_extensions_List; - -/* - * _API_extensions_Initialization - * - * DESCRIPTION: - * - * This routine initializes the API extension handler. - * - */ - -void _API_extensions_Initialization( void ); - -/* - * _API_extensions_Add - * - * DESCRIPTION: - * - * XXX - */ - -void _API_extensions_Add( - API_extensions_Control *the_extension -); - -/* - * _API_extensions_Run_predriver - * - * DESCRIPTION: - * - * XXX - */ - -void _API_extensions_Run_predriver( void ); - -/* - * _API_extensions_Run_postdriver - * - * DESCRIPTION: - * - * XXX - */ - -void _API_extensions_Run_postdriver( void ); - -/* - * _API_extensions_Run_postswitch - * - * DESCRIPTION: - * - * XXX - */ - -void _API_extensions_Run_postswitch( void ); - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/bitfield.h b/cpukit/score/include/rtems/score/bitfield.h deleted file mode 100644 index 6dbf1e0ba0..0000000000 --- a/cpukit/score/include/rtems/score/bitfield.h +++ /dev/null @@ -1,98 +0,0 @@ -/* bitfield.h - * - * This include file contains all bit field manipulation routines. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_BITFIELD_h -#define __RTEMS_BITFIELD_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _Bitfield_Find_first_bit - * - * DESCRIPTION: - * - * This routine returns the bit_number of the first bit set - * in the specified value. The correspondence between bit_number - * and actual bit position is processor dependent. The search for - * the first bit set may run from most to least significant bit - * or vice-versa. - * - * NOTE: - * - * This routine is used when the executing thread is removed - * from the ready state and, as a result, its performance has a - * significant impact on the performance of the executive as a whole. - */ - -#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE ) - -#ifndef INIT - extern const unsigned char __log2table[256]; -#else -const unsigned char __log2table[256] = { - 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; -#endif - -#endif - -#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE ) - -#define _Bitfield_Find_first_bit( _value, _bit_number ) \ - _CPU_Bitfield_Find_first_bit( _value, _bit_number ) - -#else - -/* - * The following must be a macro because if a CPU specific version - * is used it will most likely use inline assembly. - */ - -#define _Bitfield_Find_first_bit( _value, _bit_number ) \ - { \ - register __value = (_value); \ - register const unsigned char *__p = __log2table; \ - \ - if ( __value < 0x100 ) \ - (_bit_number) = __p[ __value ] + 8; \ - else \ - (_bit_number) = __p[ __value >> 8 ]; \ - } - -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/chain.h b/cpukit/score/include/rtems/score/chain.h deleted file mode 100644 index 6eed361e88..0000000000 --- a/cpukit/score/include/rtems/score/chain.h +++ /dev/null @@ -1,158 +0,0 @@ -/* chain.h - * - * This include file contains all the constants and structures associated - * with the Doubly Linked Chain Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_CHAIN_h -#define __RTEMS_CHAIN_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/address.h> - -/* - * This is used to manage each element (node) which is placed - * on a chain. - * - * NOTE: Typically, a more complicated structure will use the - * chain package. The more complicated structure will - * include a chain node as the first element in its - * control structure. It will then call the chain package - * with a pointer to that node element. The node pointer - * and the higher level structure start at the same address - * so the user can cast the pointers back and forth. - * - */ - -typedef struct Chain_Node_struct Chain_Node; - -struct Chain_Node_struct { - Chain_Node *next; - Chain_Node *previous; -}; - -/* - * This is used to manage a chain. A chain consists of a doubly - * linked list of zero or more nodes. - * - * NOTE: This implementation does not require special checks for - * manipulating the first and last elements on the chain. - * To accomplish this the chain control structure is - * treated as two overlapping chain nodes. The permanent - * head of the chain overlays a node structure on the - * first and permanent_null fields. The permanent tail - * of the chain overlays a node structure on the - * permanent_null and last elements of the structure. - * - */ - -typedef struct { - Chain_Node *first; - Chain_Node *permanent_null; - Chain_Node *last; -} Chain_Control; - -/* - * _Chain_Initialize - * - * DESCRIPTION: - * - * This routine initializes the_chain structure to manage the - * contiguous array of number_nodes nodes which starts at - * starting_address. Each node is of node_size bytes. - * - */ - -void _Chain_Initialize( - Chain_Control *the_chain, - void *starting_address, - unsigned32 number_nodes, - unsigned32 node_size -); - -/* - * _Chain_Extract - * - * DESCRIPTION: - * - * This routine extracts the_node from the chain on which it resides. - * It disables interrupts to insure the atomicity of the - * extract operation. - * - */ - -void _Chain_Extract( - Chain_Node *the_node -); - -/* - * _Chain_Get - * - * DESCRIPTION: - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It disables interrupts to insure the atomicity of the - * get operation. - * - */ - -Chain_Node *_Chain_Get( - Chain_Control *the_chain -); - -/* - * _Chain_Insert - * - * DESCRIPTION: - * - * This routine inserts the_node on a chain immediately following - * after_node. It disables interrupts to insure the atomicity - * of the extract operation. - * - */ - -void _Chain_Insert( - Chain_Node *after_node, - Chain_Node *the_node -); - -/* - * _Chain_Append - * - * DESCRIPTION: - * - * This routine appends the_node onto the end of the_chain. - * It disables interrupts to insure the atomicity of the - * append operation. - * - */ - -void _Chain_Append( - Chain_Control *the_chain, - Chain_Node *the_node -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/chain.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/context.h b/cpukit/score/include/rtems/score/context.h deleted file mode 100644 index 4cd1f1e4c5..0000000000 --- a/cpukit/score/include/rtems/score/context.h +++ /dev/null @@ -1,134 +0,0 @@ -/* context.h - * - * This include file contains all information about a context. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_CONTEXT_h -#define __RTEMS_CONTEXT_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/cpu.h> - -/* - * The following constant defines the number of bytes required - * to store a full floating point context. - */ - -#define CONTEXT_FP_SIZE CPU_CONTEXT_FP_SIZE - -/* - * The following variable is set to TRUE when a reschedule operation - * has determined that the processor should be taken away from the - * currently executing thread and given to the heir thread. - */ - -EXTERN boolean _Context_Switch_necessary; - -/* - * _Context_Initialize - * - * DESCRIPTION: - * - * This routine initializes THE_CONTEXT such that the stack - * pointer, interrupt level, and entry point are correct for the - * thread's initial state. - */ - -#define \ - _Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp ) \ - _CPU_Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp ) - -/* - * _Context_Switch - * - * DESCRIPTION: - * - * This routine saves the current context into the EXECUTING - * context record and restores the context specified by HEIR. - */ - -#define _Context_Switch( _executing, _heir ) \ - _CPU_Context_switch( _executing, _heir ) - -/* - * _Context_Restart_self - * - * DESCRIPTION: - * - * This routine restarts the calling thread by restoring its initial - * stack pointer and returning to the thread's entry point. - */ - -#define _Context_Restart_self( _the_context ) \ - _CPU_Context_Restart_self( _the_context ) - -/* - * _Context_Fp_start - * - * DESCRIPTION: - * - * This function returns the starting address of the floating - * point context save area. It is assumed that the are reserved - * for the floating point save area is large enough. - */ - -#define _Context_Fp_start( _base, _offset ) \ - _CPU_Context_Fp_start( (_base), (_offset) ) - -/* - * _Context_Initialize_fp - * - * DESCRIPTION: - * - * This routine initializes the floating point context save - * area to contain an initial known state. - */ - -#define _Context_Initialize_fp( _fp_area ) \ - _CPU_Context_Initialize_fp( _fp_area ) - -/* - * _Context_Restore_fp - * - * DESCRIPTION: - * - * This routine restores the floating point context contained - * in the FP_CONTEXT area. It is assumed that the current - * floating point context has been saved by a previous invocation - * of SAVE_FP. - */ - -#define _Context_Restore_fp( _fp ) \ - _CPU_Context_restore_fp( _fp ) - -/* - * _Context_Save_fp - * - * DESCRIPTION: - * - * This routine saves the current floating point context - * in the FP_CONTEXT area. - */ - -#define _Context_Save_fp( _fp ) \ - _CPU_Context_save_fp( _fp ) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/copyrt.h b/cpukit/score/include/rtems/score/copyrt.h deleted file mode 100644 index c711ba09b3..0000000000 --- a/cpukit/score/include/rtems/score/copyrt.h +++ /dev/null @@ -1,42 +0,0 @@ -/* copyrt.h - * - * This include file contains the copyright notice for RTEMS - * which is included in every binary copy of the executive. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_COPYRIGHT_h -#define __RTEMS_COPYRIGHT_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef INIT - -const char _Copyright_Notice[] = -"COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n\ -On-Line Applications Research Corporation (OAR).\n\ -All rights assigned to U.S. Government, 1994.\n"; - -#else - -extern const char _Copyright_Notice[]; - -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/coremsg.h b/cpukit/score/include/rtems/score/coremsg.h deleted file mode 100644 index b51e07ef61..0000000000 --- a/cpukit/score/include/rtems/score/coremsg.h +++ /dev/null @@ -1,274 +0,0 @@ -/* coremsg.h - * - * This include file contains all the constants and structures associated - * with the Message queue Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h -#define __RTEMS_CORE_MESSAGE_QUEUE_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/priority.h> -#include <rtems/score/watchdog.h> - -/* - * The following type defines the callout which the API provides - * to support global/multiprocessor operations on message_queues. - */ - -typedef void ( *CORE_message_queue_API_mp_support_callout )( - Thread_Control *, - Objects_Id - ); - -/* - * The following defines the data types needed to manipulate - * the contents of message buffers. - * Since msgs are variable length we just make a ptr to 1. - */ - -typedef struct { - unsigned32 size; - -#ifndef __cplusplus - /* NOTE: [0] is gcc specific, - * but specifically disallowed by ANSI STD C++ - * g++ warns about it, so we #ifdef it out to - * get rid of warnings when compiled by g++. - */ - unsigned32 buffer[0]; -#endif - -} CORE_message_queue_Buffer; - -/* - * The following records define the organization of a message - * buffer. - */ - -typedef struct { - Chain_Node Node; - CORE_message_queue_Buffer Contents; -} CORE_message_queue_Buffer_control; - -/* - * Blocking disciplines for a message_queue. - */ - -typedef enum { - CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO, - CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY -} CORE_message_queue_Disciplines; - -/* - * The following enumerated type details the modes in which a message - * may be submitted to a message queue. The message may be posted - * in a send or urgent fashion. - */ - -typedef enum { - CORE_MESSAGE_QUEUE_SEND_REQUEST = 0, - CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1 -} CORE_message_queue_Submit_types; - -/* - * Core Message queue handler return statuses. - */ - -typedef enum { - CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL, - CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE, - CORE_MESSAGE_QUEUE_STATUS_TOO_MANY, - CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED, - CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT, - CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED, - CORE_MESSAGE_QUEUE_STATUS_TIMEOUT -} CORE_message_queue_Status; - -/* - * The following defines the control block used to manage the - * attributes of each message queue. - */ - -typedef struct { - CORE_message_queue_Disciplines discipline; -} CORE_message_queue_Attributes; - -/* - * The following defines the type for a Notification handler. A notification - * handler is invoked when the message queue makes a 0->1 transition on - * pending messages. - */ - -typedef void (*CORE_message_queue_Notify_Handler)( void * ); - -/* - * The following defines the control block used to manage each - * counting message_queue. - */ - -typedef struct { - Thread_queue_Control Wait_queue; - CORE_message_queue_Attributes Attributes; - unsigned32 maximum_pending_messages; - unsigned32 number_of_pending_messages; - unsigned32 maximum_message_size; - Chain_Control Pending_messages; - CORE_message_queue_Buffer *message_buffers; - CORE_message_queue_Notify_Handler notify_handler; - void *notify_argument; - Chain_Control Inactive_messages; -} CORE_message_queue_Control; - -/* - * _CORE_message_queue_Initialize - * - * DESCRIPTION: - * - * This routine initializes the message_queue based on the parameters passed. - */ - -boolean _CORE_message_queue_Initialize( - CORE_message_queue_Control *the_message_queue, - Objects_Classes the_class, - CORE_message_queue_Attributes *the_message_queue_attributes, - unsigned32 maximum_pending_messages, - unsigned32 maximum_message_size, - Thread_queue_Extract_callout proxy_extract_callout -); - -/* - * _CORE_message_queue_Close - * - * DESCRIPTION: - * - * This function closes a message by returning all allocated space and - * flushing the message_queue's task wait queue. - */ - -void _CORE_message_queue_Close( - CORE_message_queue_Control *the_message_queue, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -); - -/* - * - * _CORE_message_queue_Flush - * - * DESCRIPTION: - * - * This function flushes the message_queue's task wait queue. The number - * messages flushed from the queue is returned. - * - */ - -unsigned32 _CORE_message_queue_Flush( - CORE_message_queue_Control *the_message_queue -); - -/* - * _CORE_message_queue_Flush_support - * - * DESCRIPTION: - * - * This routine flushes all outstanding messages and returns - * them to the inactive message chain. - */ - -unsigned32 _CORE_message_queue_Flush_support( - CORE_message_queue_Control *the_message_queue -); - -/* - * - * _CORE_message_queue_Broadcast - * - * DESCRIPTION: - * - * This function sends a message for every thread waiting on the queue and - * returns the number of threads made ready by the message. - * - */ - -CORE_message_queue_Status _CORE_message_queue_Broadcast( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support, - unsigned32 *count -); - -/* - * - * _CORE_message_queue_Submit - * - * DESCRIPTION: - * - * This routine implements the send and urgent message functions. It - * processes a message that is to be submitted to the designated - * message queue. The message will either be processed as a - * send message which it will be inserted at the rear of the queue - * or it will be processed as an urgent message which will be inserted - * at the front of the queue. - * - */ - -CORE_message_queue_Status _CORE_message_queue_Submit( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support, - CORE_message_queue_Submit_types submit_type -); - -/* - * - * _CORE_message_queue_Seize - * - * DESCRIPTION: - * - * This kernel routine dequeues a message, copies the message buffer to - * a given destination buffer, and frees the message buffer to the - * inactive message pool. The thread will be blocked if wait is TRUE, - * otherwise an error will be given to the thread if no messages are available. - * - */ - -void _CORE_message_queue_Seize( - CORE_message_queue_Control *the_message_queue, - Objects_Id id, - void *buffer, - unsigned32 *size, - boolean wait, - Watchdog_Interval timeout -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/coremsg.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h deleted file mode 100644 index 73b7e34417..0000000000 --- a/cpukit/score/include/rtems/score/coremutex.h +++ /dev/null @@ -1,171 +0,0 @@ -/* mutex.h - * - * This include file contains all the constants and structures associated - * with the Mutex Handler. A mutex is an enhanced version of the standard - * Dijkstra binary semaphore used to provide synchronization and mutual - * exclusion capabilities. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_CORE_MUTEX_h -#define __RTEMS_CORE_MUTEX_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/priority.h> -#include <rtems/score/watchdog.h> - -/* - * The following type defines the callout which the API provides - * to support global/multiprocessor operations on mutexes. - */ - -typedef void ( *CORE_mutex_API_mp_support_callout )( - Thread_Control *, - Objects_Id - ); - -/* - * Blocking disciplines for a mutex. - */ - -typedef enum { - CORE_MUTEX_DISCIPLINES_FIFO, - CORE_MUTEX_DISCIPLINES_PRIORITY, - CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT, - CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING -} CORE_mutex_Disciplines; - -/* - * Mutex handler return statuses. - */ - -typedef enum { - CORE_MUTEX_STATUS_SUCCESSFUL, - CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT, - CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED, - CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE, - CORE_MUTEX_WAS_DELETED, - CORE_MUTEX_TIMEOUT -} CORE_mutex_Status; - -/* - * Locked and unlocked values - */ - -#define CORE_MUTEX_UNLOCKED 1 -#define CORE_MUTEX_LOCKED 0 - -/* - * The following defines the control block used to manage the - * attributes of each mutex. - */ - -typedef struct { - boolean allow_nesting; - CORE_mutex_Disciplines discipline; - Priority_Control priority_ceiling; -} CORE_mutex_Attributes; - -/* - * The following defines the control block used to manage each mutex. - */ - -typedef struct { - Thread_queue_Control Wait_queue; - CORE_mutex_Attributes Attributes; - unsigned32 lock; - unsigned32 nest_count; - Thread_Control *holder; - Objects_Id holder_id; -} CORE_mutex_Control; - -/* - * _CORE_mutex_Initialize - * - * DESCRIPTION: - * - * This routine initializes the mutex based on the parameters passed. - */ - -void _CORE_mutex_Initialize( - CORE_mutex_Control *the_mutex, - Objects_Classes the_class, - CORE_mutex_Attributes *the_mutex_attributes, - unsigned32 initial_lock, - Thread_queue_Extract_callout proxy_extract_callout -); - -/* - * _CORE_mutex_Seize - * - * DESCRIPTION: - * - * This routine attempts to receive a unit from the_mutex. - * If a unit is available or if the wait flag is FALSE, then the routine - * returns. Otherwise, the calling task is blocked until a unit becomes - * available. - */ - -void _CORE_mutex_Seize( - CORE_mutex_Control *the_mutex, - Objects_Id id, - boolean wait, - Watchdog_Interval timeout -); - -/* - * _CORE_mutex_Surrender - * - * DESCRIPTION: - * - * This routine frees a unit to the mutex. If a task was blocked waiting for - * a unit from this mutex, then that task will be readied and the unit - * given to that task. Otherwise, the unit will be returned to the mutex. - */ - -CORE_mutex_Status _CORE_mutex_Surrender( - CORE_mutex_Control *the_mutex, - Objects_Id id, - CORE_mutex_API_mp_support_callout api_mutex_mp_support -); - -/* - * _CORE_mutex_Flush - * - * DESCRIPTION: - * - * This routine assists in the deletion of a mutex by flushing the associated - * wait queue. - */ - -void _CORE_mutex_Flush( - CORE_mutex_Control *the_mutex, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/coremutex.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/cpukit/score/include/rtems/score/coresem.h b/cpukit/score/include/rtems/score/coresem.h deleted file mode 100644 index 88f712be5d..0000000000 --- a/cpukit/score/include/rtems/score/coresem.h +++ /dev/null @@ -1,156 +0,0 @@ -/* core_sem.h - * - * This include file contains all the constants and structures associated - * with the Counting Semaphore Handler. A counting semaphore is the - * standard Dijkstra binary semaphore used to provide synchronization - * and mutual exclusion capabilities. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h -#define __RTEMS_CORE_COUNTING_SEMAPHORE_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/priority.h> -#include <rtems/score/watchdog.h> - -/* - * The following type defines the callout which the API provides - * to support global/multiprocessor operations on semaphores. - */ - -typedef void ( *CORE_semaphore_API_mp_support_callout )( - Thread_Control *, - Objects_Id - ); - -/* - * Blocking disciplines for a semaphore. - */ - -typedef enum { - CORE_SEMAPHORE_DISCIPLINES_FIFO, - CORE_SEMAPHORE_DISCIPLINES_PRIORITY -} CORE_semaphore_Disciplines; - -/* - * Core Semaphore handler return statuses. - */ - -typedef enum { - CORE_SEMAPHORE_STATUS_SUCCESSFUL, - CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT, - CORE_SEMAPHORE_WAS_DELETED, - CORE_SEMAPHORE_TIMEOUT -} CORE_semaphore_Status; - -/* - * The following defines the control block used to manage the - * attributes of each semaphore. - */ - -typedef struct { - CORE_semaphore_Disciplines discipline; -} CORE_semaphore_Attributes; - -/* - * The following defines the control block used to manage each - * counting semaphore. - */ - -typedef struct { - Thread_queue_Control Wait_queue; - CORE_semaphore_Attributes Attributes; - unsigned32 count; -} CORE_semaphore_Control; - -/* - * _CORE_semaphore_Initialize - * - * DESCRIPTION: - * - * This routine initializes the semaphore based on the parameters passed. - */ - -void _CORE_semaphore_Initialize( - CORE_semaphore_Control *the_semaphore, - Objects_Classes the_class, - CORE_semaphore_Attributes *the_semaphore_attributes, - unsigned32 initial_value, - Thread_queue_Extract_callout proxy_extract_callout -); - -/* - * _CORE_semaphore_Seize - * - * DESCRIPTION: - * - * This routine attempts to receive a unit from the_semaphore. - * If a unit is available or if the wait flag is FALSE, then the routine - * returns. Otherwise, the calling task is blocked until a unit becomes - * available. - */ - -void _CORE_semaphore_Seize( - CORE_semaphore_Control *the_semaphore, - Objects_Id id, - boolean wait, - Watchdog_Interval timeout -); - -/* - * _CORE_semaphore_Surrender - * - * DESCRIPTION: - * - * This routine frees a unit to the semaphore. If a task was blocked waiting - * for a unit from this semaphore, then that task will be readied and the unit - * given to that task. Otherwise, the unit will be returned to the semaphore. - */ - -CORE_semaphore_Status _CORE_semaphore_Surrender( - CORE_semaphore_Control *the_semaphore, - Objects_Id id, - CORE_semaphore_API_mp_support_callout api_semaphore_mp_support -); - -/* - * _CORE_semaphore_Flush - * - * DESCRIPTION: - * - * This routine assists in the deletion of a semaphore by flushing the - * associated wait queue. - */ - -void _CORE_semaphore_Flush( - CORE_semaphore_Control *the_semaphore, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/coresem.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h deleted file mode 100644 index c1a0650d0a..0000000000 --- a/cpukit/score/include/rtems/score/heap.h +++ /dev/null @@ -1,226 +0,0 @@ -/* heap.h - * - * This include file contains the information pertaining to the Heap - * Handler. A heap is a doubly linked list of variable size - * blocks which are allocated using the first fit method. Garbage - * collection is performed each time a block is returned to the heap by - * coalescing neighbor blocks. Control information for both allocated - * and unallocated blocks is contained in the heap space. A heap header - * contains control information for the heap. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_HEAP_h -#define __RTEMS_HEAP_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Status codes for heap_extend - */ - -typedef enum { - HEAP_EXTEND_SUCCESSFUL, - HEAP_EXTEND_ERROR, - HEAP_EXTEND_NOT_IMPLEMENTED -} Heap_Extend_status; - -/* - * Constants used in the size/used field of each heap block to - * indicate when a block is free or in use. - */ - -#define HEAP_BLOCK_USED 1 /* indicates block is in use */ -#define HEAP_BLOCK_FREE 0 /* indicates block is free */ - -/* - * The size/used field value for the dummy front and back flags. - */ - -#define HEAP_DUMMY_FLAG (0 + HEAP_BLOCK_USED) - -/* - * The following constants reflect various requirements of the - * heap data structures which impact the management of a heap. - * - * NOTE: Because free block overhead is greater than used block - * overhead AND a portion of the allocated space is from - * the extra free block overhead, the absolute lower bound - * of the minimum fragment size is equal to the size of - * the free block overhead. - */ - -#define HEAP_OVERHEAD \ - (sizeof( unsigned32 ) * 2) /* size dummy first and last blocks */ -#define HEAP_BLOCK_USED_OVERHEAD \ - (sizeof( void * ) * 2) /* num bytes overhead in used block */ -#define HEAP_MINIMUM_SIZE \ - (HEAP_OVERHEAD + sizeof (Heap_Block)) - /* min number of bytes the user may */ - /* specify for the heap size */ - -/* - * The following defines the data structure used to manage - * individual blocks in a heap. When the block is allocated, the - * next and previous fields are not used by the Heap Handler - * and thus the address returned for the block starts at - * the address of the next field. - * - * NOTE: The next and previous pointers are only valid when the - * block is free. Caution must be exercised to insure that - * allocated blocks are large enough to contain them and - * that they are not accidentally overwritten when the - * block is actually allocated. - */ - -typedef struct Heap_Block_struct Heap_Block; - -struct Heap_Block_struct { - unsigned32 back_flag; /* size and status of prev block */ - unsigned32 front_flag; /* size and status of block */ - Heap_Block *next; /* pointer to next block */ - Heap_Block *previous; /* pointer to previous block */ -}; - -/* - * The following defines the control block used to manage each heap. - * - * NOTE: - * - * This structure is layed out such that it can be used a a dummy - * first and last block on the free block chain. The extra padding - * insures the dummy last block is the correct size. - * - * The first Heap_Block starts at first while the second starts at - * final. This is effectively the same trick as is used in the Chain - * Handler. - */ - -typedef struct { - Heap_Block *start; /* first valid block address in heap */ - Heap_Block *final; /* last valid block address in heap */ - - Heap_Block *first; /* pointer to first block in heap */ - Heap_Block *permanent_null; /* always NULL pointer */ - Heap_Block *last; /* pointer to last block in heap */ - unsigned32 page_size; /* allocation unit */ - unsigned32 reserved; -} Heap_Control; - -/* - * _Heap_Initialize - * - * DESCRIPTION: - * - * This routine initializes the_heap record to manage the - * contiguous heap of size bytes which starts at starting_address. - * Blocks of memory are allocated from the heap in multiples of - * page_size byte units. - */ - -unsigned32 _Heap_Initialize( - Heap_Control *the_heap, - void *starting_address, - unsigned32 size, - unsigned32 page_size -); - -/* - * _Heap_Extend - * - * DESCRIPTION: - * - * This routine grows the_heap memory area using the size bytes which - * begin at starting_address. - */ - -Heap_Extend_status _Heap_Extend( - Heap_Control *the_heap, - void *starting_address, - unsigned32 size, - unsigned32 *amount_extended -); - -/* - * _Heap_Allocate - * - * DESCRIPTION: - * - * DESCRIPTION: - * - * This function attempts to allocate a block of size bytes from - * the_heap. If insufficient memory is free in the_heap to allocate - * a block of the requested size, then NULL is returned. - */ - -void *_Heap_Allocate( - Heap_Control *the_heap, - unsigned32 size -); - -/* - * _Heap_Size_of_user_area - * - * DESCRIPTION: - * - * This kernel routine sets size to the size of the given heap block. - * It returns TRUE if the starting_address is in the heap, and FALSE - * otherwise. - */ - -boolean _Heap_Size_of_user_area( - Heap_Control *the_heap, - void *starting_address, - unsigned32 *size -); - -/* - * _Heap_Free - * - * DESCRIPTION: - * - * This routine returns the block of memory which begins - * at starting_address to the_heap. Any coalescing which is - * possible with the freeing of this routine is performed. - */ - -boolean _Heap_Free( - Heap_Control *the_heap, - void *start_address -); - -/* - * _Heap_Walk - * - * DESCRIPTION: - * - * This routine walks the heap to verify its integrity. - */ - -void _Heap_Walk( - Heap_Control *the_heap, - int source, - boolean do_dump -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/heap.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h deleted file mode 100644 index 655656acc7..0000000000 --- a/cpukit/score/include/rtems/score/interr.h +++ /dev/null @@ -1,93 +0,0 @@ -/* interr.h - * - * This include file contains constants and prototypes related - * to the Internal Error Handler. - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_INTERNAL_ERROR_h -#define __RTEMS_INTERNAL_ERROR_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This type lists the possible sources from which an error - * can be reported. - */ - -typedef enum { - INTERNAL_ERROR_CORE, - INTERNAL_ERROR_RTEMS_API -} Internal_errors_Source; - -/* - * A list of errors which are generated internally by the executive core. - */ - -typedef enum { - INTERNAL_ERROR_NO_CONFIGURATION_TABLE, - INTERNAL_ERROR_NO_CPU_TABLE, - INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS, - INTERNAL_ERROR_TOO_LITTLE_WORKSPACE, - INTERNAL_ERROR_WORKSPACE_ALLOCATION, - INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL, - INTERNAL_ERROR_THREAD_EXITTED, - INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION, - INTERNAL_ERROR_INVALID_NODE, - INTERNAL_ERROR_NO_MPCI, - INTERNAL_ERROR_BAD_PACKET, - INTERNAL_ERROR_OUT_OF_PACKETS, - INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS, - INTERNAL_ERROR_OUT_OF_PROXIES, - INTERNAL_ERROR_INVALID_GLOBAL_ID -} Internal_errors_Core_list; - -/* - * This type holds the fatal error information. - */ - -typedef struct { - Internal_errors_Source the_source; - boolean is_internal; - unsigned32 the_error; -} Internal_errors_Information; - -/* - * When a fatal error occurs, the error information is stored here. - */ - -EXTERN Internal_errors_Information Internal_errors_What_happened; - -/* - * _Internal_error_Occurred - * - * DESCRIPTION: - * - * This routine is invoked when the application or the executive itself - * determines that a fatal error has occurred. - */ - -void volatile _Internal_error_Occurred( - Internal_errors_Source the_source, - boolean is_internal, - unsigned32 the_error -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/isr.h b/cpukit/score/include/rtems/score/isr.h deleted file mode 100644 index e42d7b888e..0000000000 --- a/cpukit/score/include/rtems/score/isr.h +++ /dev/null @@ -1,226 +0,0 @@ -/* isr.h - * - * This include file contains all the constants and structures associated - * with the management of processor interrupt levels. This handler - * supports interrupt critical sections, vectoring of user interrupt - * handlers, nesting of interrupts, and manipulating interrupt levels. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __ISR_h -#define __ISR_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The following type defines the control block used to manage - * the interrupt level portion of the status register. - */ - -typedef unsigned32 ISR_Level; - -/* - * The following type defines the type used to manage the vectors. - */ - -typedef unsigned32 ISR_Vector_number; - -/* - * Return type for ISR Handler - */ - -typedef void ISR_Handler; - -/* - * Pointer to an ISR Handler - */ - -typedef ISR_Handler ( *ISR_Handler_entry )( - ISR_Vector_number - ); -/* - * This constant promotes out the number of vectors truly supported by - * the current CPU being used. This is usually the number of distinct vectors - * the cpu can vector. - */ - -#define ISR_NUMBER_OF_VECTORS CPU_INTERRUPT_NUMBER_OF_VECTORS - -/* - * This constant promotes out the highest valid interrupt vector number. - */ - -#define ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER - -/* - * The following is TRUE if signals have been sent to the currently - * executing thread by an ISR handler. - */ - -EXTERN boolean _ISR_Signals_to_thread_executing; - -/* - * The following contains the interrupt service routine nest level. - * When this variable is zero, a thread is executing. - */ - -EXTERN unsigned32 _ISR_Nest_level; - -/* - * The following declares the Vector Table. Application - * interrupt service routines are vectored by the ISR Handler via this table. - */ - -EXTERN ISR_Handler_entry _ISR_Vector_table[ ISR_NUMBER_OF_VECTORS ]; - -/* - * _ISR_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -void _ISR_Handler_initialization ( void ); - -/* - * _ISR_Disable - * - * DESCRIPTION: - * - * This routine disables all interrupts so that a critical section - * of code can be executing without being interrupted. Upon return, - * the argument _level will contain the previous interrupt mask level. - */ - -#define _ISR_Disable( _level ) \ - _CPU_ISR_Disable( _level ) - -/* - * _ISR_Enable - * - * DESCRIPTION: - * - * This routine enables interrupts to the previous interrupt mask - * LEVEL. It is used at the end of a critical section of code to - * enable interrupts so they can be processed again. - */ - -#define _ISR_Enable( _level ) \ - _CPU_ISR_Enable( _level ) - -/* - * _ISR_Flash - * - * DESCRIPTION: - * - * This routine temporarily enables interrupts to the previous - * interrupt mask level and then disables all interrupts so that - * the caller can continue into the second part of a critical - * section. This routine is used to temporarily enable interrupts - * during a long critical section. It is used in long sections of - * critical code when a point is reached at which interrupts can - * be temporarily enabled. Deciding where to flash interrupts - * in a long critical section is often difficult and the point - * must be selected with care to insure that the critical section - * properly protects itself. - */ - -#define _ISR_Flash( _level ) \ - _CPU_ISR_Flash( _level ) - -/* - * _ISR_Install_vector - * - * DESCRIPTION: - * - * This routine installs new_handler as the interrupt service routine - * for the specified vector. The previous interrupt service routine is - * returned as old_handler. - */ - -#define _ISR_Install_vector( _vector, _new_handler, _old_handler ) \ - _CPU_ISR_install_vector( _vector, _new_handler, _old_handler ) - -/* - * _ISR_Get_level - * - * DESCRIPTION: - * - * This routine returns the current interrupt level. - */ - -#define _ISR_Get_level() \ - _CPU_ISR_Get_level() - -/* - * _ISR_Set_level - * - * DESCRIPTION: - * - * This routine sets the current interrupt level to that specified - * by new_level. The new interrupt level is effective when the - * routine exits. - */ - -#define _ISR_Set_level( _new_level ) \ - _CPU_ISR_Set_level( _new_level ) - -/* - * _ISR_Handler - * - * DESCRIPTION: - * - * This routine is the interrupt dispatcher. ALL interrupts - * are vectored to this routine so that minimal context can be saved - * and setup performed before the application's high-level language - * interrupt service routine is invoked. After the application's - * interrupt service routine returns control to this routine, it - * will determine if a thread dispatch is necessary. If so, it will - * insure that the necessary thread scheduling operations are - * performed when the outermost interrupt service routine exits. - * - * NOTE: Implemented in assembly language. - */ - -void _ISR_Handler( void ); - -/* - * _ISR_Dispatch - * - * DESCRIPTION: - * - * This routine provides a wrapper so that the routine - * _Thread_Dispatch can be invoked when a reschedule is necessary - * at the end of the outermost interrupt service routine. This - * wrapper is necessary to establish the processor context needed - * by _Thread_Dispatch and to save the processor context which is - * corrupted by _Thread_Dispatch. This context typically consists - * of registers which are not preserved across routine invocations. - * - * NOTE: Implemented in assembly language. - */ - -void _ISR_Dispatch( void ); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/isr.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/mpci.h b/cpukit/score/include/rtems/score/mpci.h deleted file mode 100644 index 25d7ac4094..0000000000 --- a/cpukit/score/include/rtems/score/mpci.h +++ /dev/null @@ -1,411 +0,0 @@ -/* mpci.h - * - * This include file contains all the constants and structures associated - * with the MPCI layer. It provides mechanisms to utilize packets. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MPCI_h -#define __MPCI_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/mppkt.h> -#include <rtems/score/states.h> -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/tqdata.h> -#include <rtems/score/watchdog.h> -#include <rtems/score/coresem.h> - -/* - * The following constants define the stack size requirements for - * the system threads. - */ - -#define MPCI_RECEIVE_SERVER_STACK_SIZE \ - ( STACK_MINIMUM_SIZE + \ - CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \ - _CPU_Table.extra_mpci_receive_server_stack \ - ) - -/* - * The following defines the node number used when a broadcast is desired. - */ - -#define MPCI_ALL_NODES 0 - -/* - * For packets associated with requests that don't already have a timeout, - * use the one specified by this MPCI driver. The value specified by - * the MPCI driver sets an upper limit on how long a remote request - * should take to complete. - */ - -#define MPCI_DEFAULT_TIMEOUT 0xFFFFFFFF - -/* - * The following records define the Multiprocessor Communications - * Interface (MPCI) Table. This table defines the user-provided - * MPCI which is a required part of a multiprocessor system. - * - * For non-blocking local operations that become remote operations, - * we need a timeout. This is a per-driver timeout: default_timeout - */ - -typedef void MPCI_Entry; - -typedef MPCI_Entry ( *MPCI_initialization_entry )( void ); - -typedef MPCI_Entry ( *MPCI_get_packet_entry )( - MP_packet_Prefix ** - ); - -typedef MPCI_Entry ( *MPCI_return_packet_entry )( - MP_packet_Prefix * - ); - -typedef MPCI_Entry ( *MPCI_send_entry )( - unsigned32, - MP_packet_Prefix * - ); - -typedef MPCI_Entry ( *MPCI_receive_entry )( - MP_packet_Prefix ** - ); - -typedef struct { - unsigned32 default_timeout; /* in ticks */ - unsigned32 maximum_packet_size; - MPCI_initialization_entry initialization; - MPCI_get_packet_entry get_packet; - MPCI_return_packet_entry return_packet; - MPCI_send_entry send_packet; - MPCI_receive_entry receive_packet; -} MPCI_Control; - -/* - * The following defines the type for packet processing routines - * invoked by the MPCI Receive server. - */ - -typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * ); - -/* - * The following enumerated type defines the list of - * internal MP operations. - */ - -typedef enum { - MPCI_PACKETS_SYSTEM_VERIFY = 0 -} MPCI_Internal_Remote_operations; - -/* - * The following data structure defines the packet used to perform - * remote event operations. - */ - -typedef struct { - MP_packet_Prefix Prefix; - MPCI_Internal_Remote_operations operation; - unsigned32 maximum_nodes; - unsigned32 maximum_global_objects; -} MPCI_Internal_packet; - -/* - * This is the core semaphore which the MPCI Receive Server blocks on. - */ - -EXTERN CORE_semaphore_Control _MPCI_Semaphore; -/* - * The following thread queue is used to maintain a list of tasks - * which currently have outstanding remote requests. - */ - -EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads; - -/* - * The following define the internal pointers to the user's - * configuration information. - */ - -EXTERN MPCI_Control *_MPCI_table; - -/* - * The following points to the MPCI Receive Server. - */ - -EXTERN Thread_Control *_MPCI_Receive_server_tcb; - -/* - * The following table contains the process packet routines provided - * by each object that supports MP operations. - */ - -EXTERN MPCI_Packet_processor _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1]; - -/* - * _MPCI_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -void _MPCI_Handler_initialization( - MPCI_Control *users_mpci_table, - unsigned32 timeout_status -); - -/* - * _MPCI_Create_server - * - * DESCRIPTION: - * - * This routine creates the packet receive server used in MP systems. - */ - -void _MPCI_Create_server( void ); - -/* - * _MPCI_Initialization - * - * DESCRIPTION: - * - * This routine initializes the MPCI driver by - * invoking the user provided MPCI initialization callout. - */ - -void _MPCI_Initialization ( void ); - -/* - * _MPCI_Register_packet_processor - * - * DESCRIPTION: - * - * This routine registers the MPCI packet processor for the - * designated object class. - */ - -void _MPCI_Register_packet_processor( - MP_packet_Classes the_object, - MPCI_Packet_processor the_packet_processor - -); - -/* - * _MPCI_Get_packet - * - * DESCRIPTION: - * - * This function obtains a packet by invoking the user provided - * MPCI get packet callout. - */ - -MP_packet_Prefix *_MPCI_Get_packet ( void ); - -/* - * _MPCI_Return_packet - * - * DESCRIPTION: - * - * This routine returns a packet by invoking the user provided - * MPCI return packet callout. - */ - -void _MPCI_Return_packet ( - MP_packet_Prefix *the_packet -); - -/* - * _MPCI_Send_process_packet - * - * DESCRIPTION: - * - * This routine sends a process packet by invoking the user provided - * MPCI send callout. - */ - -void _MPCI_Send_process_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet -); - -/* - * _MPCI_Send_request_packet - * - * DESCRIPTION: - * - * This routine sends a request packet by invoking the user provided - * MPCI send callout. - */ - -unsigned32 _MPCI_Send_request_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet, - States_Control extra_state -); - -/* - * _MPCI_Send_response_packet - * - * DESCRIPTION: - * - * This routine sends a response packet by invoking the user provided - * MPCI send callout. - */ - -void _MPCI_Send_response_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet -); - -/* - * _MPCI_Receive_packet - * - * DESCRIPTION: - * - * This routine receives a packet by invoking the user provided - * MPCI receive callout. - */ - -MP_packet_Prefix *_MPCI_Receive_packet ( void ); - -/* - * _MPCI_Process_response - * - * DESCRIPTION: - * - * This routine obtains a packet by invoking the user provided - * MPCI get packet callout. - */ - -Thread_Control *_MPCI_Process_response ( - MP_packet_Prefix *the_packet -); - -/*PAGE - * - * _MPCI_Receive_server - * - */ - -Thread _MPCI_Receive_server( - unsigned32 ignored -); - -/*PAGE - * - * _MPCI_Announce - * - * DESCRIPTION: - * - * XXX - */ - -void _MPCI_Announce ( void ); - -/* - * _MPCI_Internal_packets_Send_process_packet - * - * DESCRIPTION: - * - * This routine performs a remote procedure call so that a - * process operation can be performed on another node. - */ - -void _MPCI_Internal_packets_Send_process_packet ( - MPCI_Internal_Remote_operations operation -); - -/* - * _MPCI_Internal_packets_Send_request_packet - * - * DESCRIPTION: - * - * This routine performs a remote procedure call so that a - * directive operation can be initiated on another node. - * - * This routine is not needed since there are no request - * packets to be sent by this manager. - */ - -/* - * _MPCI_Internal_packets_Send_response_packet - * - * DESCRIPTION: - * - * This routine performs a remote procedure call so that a - * directive can be performed on another node. - * - * This routine is not needed since there are no response - * packets to be sent by this manager. - */ - -/* - * - * _MPCI_Internal_packets_Process_packet - * - * DESCRIPTION: - * - * This routine performs the actions specific to this package for - * the request from another node. - */ - -void _MPCI_Internal_packets_Process_packet ( - MP_packet_Prefix *the_packet_prefix -); - -/* - * _MPCI_Internal_packets_Send_object_was_deleted - * - * DESCRIPTION: - * - * This routine is invoked indirectly by the thread queue - * when a proxy has been removed from the thread queue and - * the remote node must be informed of this. - * - * This routine is not needed since there are no objects - * deleted by this manager. - */ - -/* - * _MPCI_Internal_packets_Send_extract_proxy - * - * DESCRIPTION: - * - * This routine is invoked when a task is deleted and it - * has a proxy which must be removed from a thread queue and - * the remote node must be informed of this. - * - * This routine is not needed since there are no objects - * deleted by this manager. - */ - -/* - * _MPCI_Internal_packets_Get_packet - * - * DESCRIPTION: - * - * This routine is used to obtain a internal threads mp packet. - */ - - MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void ); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/mppkt.h b/cpukit/score/include/rtems/score/mppkt.h deleted file mode 100644 index 0c651bc4e8..0000000000 --- a/cpukit/score/include/rtems/score/mppkt.h +++ /dev/null @@ -1,100 +0,0 @@ -/* mppkt.h - * - * This package is the specification for the Packet Handler. - * This handler defines the basic packet and provides - * mechanisms to utilize packets based on this prefix. - * Packets are the fundamental basis for messages passed between - * nodes in an MP system. - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MP_PACKET_h -#define __MP_PACKET_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/object.h> -#include <rtems/score/priority.h> -#include <rtems/score/watchdog.h> - -/* - * The following enumerated type defines the packet classes. - * - * NOTE: In general, each class corresponds to a manager - * which supports global operations. Each manager - * defines the set of supported operations. - */ - -typedef enum { - MP_PACKET_MPCI_INTERNAL = 0, - MP_PACKET_TASKS = 1, - MP_PACKET_MESSAGE_QUEUE = 2, - MP_PACKET_SEMAPHORE = 3, - MP_PACKET_PARTITION = 4, - MP_PACKET_REGION = 5, - MP_PACKET_EVENT = 6, - MP_PACKET_SIGNAL = 7 -} MP_packet_Classes; - -#define MP_PACKET_CLASSES_FIRST MP_PACKET_MPCI_INTERNAL -#define MP_PACKET_CLASSES_LAST MP_PACKET_SIGNAL - -/* - * The following record contains the prefix for every packet - * passed between nodes in an MP system. - * - * NOTE: This structure is padded to insure that anything - * following it is on a 16 byte boundary. This is - * the most stringent structure alignment rule - * encountered yet (i960CA). - */ - -typedef struct { - MP_packet_Classes the_class; - Objects_Id id; - Objects_Id source_tid; - Priority_Control source_priority; - unsigned32 return_code; - unsigned32 length; - unsigned32 to_convert; - Watchdog_Interval timeout; -} MP_packet_Prefix; - -/* - * An MPCI must support packets of at least this size. - */ - -#define MP_PACKET_MINIMUM_PACKET_SIZE 64 - -/* - * The following constant defines the number of unsigned32's - * in a packet which must be converted to native format in a - * heterogeneous system. In packets longer than - * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data - * may a user message buffer which is not automatically endian swapped. - */ - -#define MP_PACKET_MINIMUN_HETERO_CONVERSION ( sizeof( MP_packet_Prefix ) / 4 ) - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/mppkt.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h deleted file mode 100644 index d70009c3c9..0000000000 --- a/cpukit/score/include/rtems/score/object.h +++ /dev/null @@ -1,397 +0,0 @@ -/* object.h - * - * This include file contains all the constants and structures associated - * with the Object Handler. This Handler provides mechanisms which - * can be used to initialize and manipulate all objects which have - * ids. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __OBJECTS_h -#define __OBJECTS_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/chain.h> - -/* - * The following type defines the control block used to manage - * object names. - */ - -typedef void * Objects_Name; - -/* - * Space for object names is allocated in multiples of this. - * - * NOTE: Must be a power of 2. Matches the name manipulation routines. - */ - -#define OBJECTS_NAME_ALIGNMENT 4 - -/* - * Functions which compare names are prototyped like this. - */ - -typedef boolean (*Objects_Name_comparators)( - void * /* name_1 */, - void * /* name_2 */, - unsigned32 /* length */ -); - -/* - * The following type defines the control block used to manage - * object IDs. The format is as follows (0=LSB): - * - * Bits 0 .. 15 = index - * Bits 16 .. 25 = node - * Bits 26 .. 31 = class - */ - -typedef unsigned32 Objects_Id; - -#define OBJECTS_INDEX_START_BIT 0 -#define OBJECTS_NODE_START_BIT 16 -#define OBJECTS_CLASS_START_BIT 26 - -#define OBJECTS_INDEX_MASK 0x0000ffff -#define OBJECTS_NODE_MASK 0x03ff0000 -#define OBJECTS_CLASS_MASK 0xfc000000 - -#define OBJECTS_INDEX_VALID_BITS 0x0000ffff -#define OBJECTS_NODE_VALID_BITS 0x000003ff -#define OBJECTS_CLASS_VALID_BITS 0x000000cf - -/* - * This enumerated type is used in the class field of the object ID. - */ - -typedef enum { - OBJECTS_NO_CLASS = 0, - OBJECTS_INTERNAL_THREADS = 1, - OBJECTS_RTEMS_TASKS = 2, - OBJECTS_POSIX_THREADS = 3, - OBJECTS_RTEMS_TIMERS = 4, - OBJECTS_RTEMS_SEMAPHORES = 5, - OBJECTS_RTEMS_MESSAGE_QUEUES = 6, - OBJECTS_RTEMS_PARTITIONS = 7, - OBJECTS_RTEMS_REGIONS = 8, - OBJECTS_RTEMS_PORTS = 9, - OBJECTS_RTEMS_PERIODS = 10, - OBJECTS_RTEMS_EXTENSIONS = 11, - OBJECTS_POSIX_KEYS = 12, - OBJECTS_POSIX_INTERRUPTS = 13, - OBJECTS_POSIX_MESSAGE_QUEUES = 14, - OBJECTS_POSIX_MUTEXES = 15, - OBJECTS_POSIX_SEMAPHORES = 16, - OBJECTS_POSIX_CONDITION_VARIABLES = 17 -} Objects_Classes; - -#define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS -#define OBJECTS_CLASSES_LAST OBJECTS_POSIX_CONDITION_VARIABLES -#define OBJECTS_CLASSES_FIRST_THREAD_CLASS OBJECTS_MPCI_PACKETS -#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_POSIX_THREADS - -/* - * This enumerated type lists the locations which may be returned - * by _Objects_Get. These codes indicate the success of locating - * an object with the specified ID. - */ - -typedef enum { - OBJECTS_LOCAL = 0, /* object is local */ - OBJECTS_REMOTE = 1, /* object is remote */ - OBJECTS_ERROR = 2 /* id was invalid */ -} Objects_Locations; - -/* - * The following defines the Object Control Block used to manage - * each object local to this node. - */ - -typedef struct { - Chain_Node Node; - Objects_Id id; - Objects_Name name; -} Objects_Control; - -/* - * The following defines the structure for the information used to - * manage each class of objects. - */ - -typedef struct { - Objects_Classes the_class; /* Class of this object */ - Objects_Id minimum_id; /* minimum valid id of this type */ - Objects_Id maximum_id; /* maximum valid id of this type */ - unsigned32 maximum; /* maximum number of objects */ - Objects_Control **local_table; /* table of local object pointers */ - Objects_Name *name_table; /* table of local object names */ - Chain_Control *global_table; /* pointer to global table */ - Chain_Control Inactive; /* chain of inactive ctl blocks */ - boolean is_string; /* TRUE if names are strings */ - unsigned32 name_length; /* maximum length of names */ - boolean is_thread; /* TRUE if these are threads */ - /* irregardless of API */ -} Objects_Information; - -/* - * The following defines the data storage which contains the - * node number of the local node. - */ - -EXTERN unsigned32 _Objects_Local_node; -EXTERN unsigned32 _Objects_Maximum_nodes; - -/* - * The following is the list of information blocks for each object - * class. From the ID, we can go to one of these information blocks, - * and obtain a pointer to the appropriate object control block. - */ - -EXTERN Objects_Information - *_Objects_Information_table[OBJECTS_CLASSES_LAST + 1]; - -/* - * The following defines the constant which may be used - * with _Objects_Get to manipulate the calling task. - * - */ - -#define OBJECTS_ID_OF_SELF ((Objects_Id) 0) - -/* - * The following define the constants which may be used in name searches. - */ - -#define OBJECTS_SEARCH_ALL_NODES 0 -#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE -#define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF -#define OBJECTS_WHO_AM_I 0 - -/* - * Parameters and return id's for _Objects_Get_next - */ - -#define OBJECTS_ID_INITIAL_INDEX (0) -#define OBJECTS_ID_FINAL_INDEX (0xffff) - -#define OBJECTS_ID_INITIAL(_class, _node) \ - _Objects_Build_id( (_class), (_node), OBJECTS_ID_INITIAL_INDEX ) - -#define OBJECTS_ID_FINAL ((Objects_Id)~0) - -/* - * _Objects_Handler_initialization - * - * DESCRIPTION: - * - * This function performs the initialization necessary for this handler. - * - */ - -void _Objects_Handler_initialization( - unsigned32 node, - unsigned32 maximum_nodes, - unsigned32 maximum_global_objects -); - -/* - * _Objects_Initialize_information - * - * DESCRIPTION: - * - * This function initializes an object class information record. - * SUPPORTS_GLOBAL is TRUE if the object class supports global - * objects, and FALSE otherwise. Maximum indicates the number - * of objects required in this class and size indicates the size - * in bytes of each control block for this object class. The - * name length and string designator are also set. In addition, - * the class may be a task, therefore this information is also included. - */ - -void _Objects_Initialize_information ( - Objects_Information *information, - Objects_Classes the_class, - boolean supports_global, - unsigned32 maximum, - unsigned32 size, - boolean is_string, - unsigned32 maximum_name_length, - boolean is_task -); - -/* - * _Objects_Clear_name - * - * DESCRIPTION: - * - * XXX - */ - -void _Objects_Clear_name( - void *name, - unsigned32 length -); - -/* - * _Objects_Copy_name_string - * - * DESCRIPTION: - * - * XXX - */ - -void _Objects_Copy_name_string( - void *source, - void *destination -); - -/* - * _Objects_Copy_name_raw - * - * DESCRIPTION: - * - * XXX - */ - -void _Objects_Copy_name_raw( - void *source, - void *destination, - unsigned32 length -); - -/* - * _Objects_Compare_name_string - * - * DESCRIPTION: - * - * XXX - */ - -boolean _Objects_Compare_name_string( - void *name_1, - void *name_2, - unsigned32 length -); - -/* - * _Objects_Compare_name_raw - * - * DESCRIPTION: - * - * XXX - */ - -boolean _Objects_Compare_name_raw( - void *name_1, - void *name_2, - unsigned32 length -); -/* - * _Objects_Name_to_id - * - * DESCRIPTION: - * - * This function implements the common portion of the object - * identification directives. This directive returns the object - * id associated with name. If more than one object of this class - * is named name, then the object to which the id belongs is - * arbitrary. Node indicates the extent of the search for the - * id of the object named name. If the object class supports global - * objects, then the search can be limited to a particular node - * or allowed to encompass all nodes. - * - */ - -typedef enum { - OBJECTS_SUCCESSFUL, - OBJECTS_INVALID_NAME, - OBJECTS_INVALID_NODE -} Objects_Name_to_id_errors; - -#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_SUCCESSFUL -#define OBJECTS_NAME_ERRORS_LAST OBJECTS_INVALID_NODE - -Objects_Name_to_id_errors _Objects_Name_to_id( - Objects_Information *information, - Objects_Name name, - unsigned32 node, - Objects_Id *id -); - -/* - * _Objects_Get - * - * DESCRIPTION: - * - * This function maps object ids to object control blocks. - * If id corresponds to a local object, then it returns - * the_object control pointer which maps to id and location - * is set to OBJECTS_LOCAL. If the object class supports global - * objects and the object id is global and resides on a remote - * node, then location is set to OBJECTS_REMOTE, and the_object - * is undefined. Otherwise, location is set to OBJECTS_ERROR - * and the_object is undefined. - * - */ - -Objects_Control *_Objects_Get ( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location -); - -/* - * _Objects_Get_next - * - * DESCRIPTION: - * - * Like _Objects_Get, but is used to find "next" open object. - * - */ - -Objects_Control *_Objects_Get_next( - Objects_Information *information, - Objects_Id id, - unsigned32 *location_p, - Objects_Id *next_id_p -); - -/* - * _Objects_Get_information - * - * DESCRIPTION: - * - * Returns the information control block for the class of objects - * corresponding to this id. - */ - -Objects_Information *_Objects_Get_information( - Objects_Id id -); - -/* - * Pieces of object.inl are promoted out to the user - */ - -#include <rtems/score/object.inl> -#include <rtems/score/objectmp.h> - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/objectmp.h b/cpukit/score/include/rtems/score/objectmp.h deleted file mode 100644 index 96496656df..0000000000 --- a/cpukit/score/include/rtems/score/objectmp.h +++ /dev/null @@ -1,152 +0,0 @@ -/* objectmp.h - * - * This include file contains all the constants and structures associated - * with the manipulation of Global RTEMS Objects. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_OBJECTS_MP_h -#define __RTEMS_OBJECTS_MP_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This defines the Global Object Control Block used to manage - * objects resident on other nodes. - */ - -typedef struct { - Objects_Control Object; - unsigned32 name; /* XXX broken but works */ - /* XXX If any API is MP with variable length names .. BOOM!!!! */ -} Objects_MP_Control; - -/* - * _Objects_MP_Handler_initialization - * - * DESCRIPTION: - * - * This routine intializes the inactive global object chain - * based on the maximum number of global objects configured. - */ - -void _Objects_MP_Handler_initialization ( - unsigned32 node, - unsigned32 maximum_nodes, - unsigned32 maximum_global_objects -); - -/*PAGE - * - * _Objects_MP_Open - * - * DESCRIPTION: - * - * This routine place the specified global object in the - * specified information table. - */ - -void _Objects_MP_Open ( - Objects_Information *information, - Objects_MP_Control *the_global_object, - unsigned32 the_name, /* XXX -- wrong for variable */ - Objects_Id the_id -); - -/* - * _Objects_MP_Allocate_and_open - * - * DESCRIPTION: - * - * This routine allocates a global object control block - * and places it in the specified information table. If the - * allocation fails, then is_fatal_error determines the - * error processing actions taken. - */ - -boolean _Objects_MP_Allocate_and_open ( - Objects_Information *information, - unsigned32 the_name, /* XXX -- wrong for variable length */ - Objects_Id the_id, - boolean is_fatal_error -); - -/* - * _Objects_MP_Close - * - * DESCRIPTION: - * - * This routine removes a global object from the specified - * information table and deallocates the global object control block. - */ - -void _Objects_MP_Close ( - Objects_Information *information, - Objects_Id the_id -); - -/* - * _Objects_MP_Global_name_search - * - * DESCRIPTION: - * - * This routine looks for the object with the_name in the global - * object tables indicated by information. It returns the ID of the - * object with that name if one is found. - */ - -Objects_Name_to_id_errors _Objects_MP_Global_name_search ( - Objects_Information *information, - Objects_Name the_name, - unsigned32 nodes_to_search, - Objects_Id *the_id -); - -/* - * _Objects_MP_Is_remote - * - * DESCRIPTION: - * - * This function searches the Global Object Table managed - * by information for the object indicated by ID. If the object - * is found, then location is set to objects_remote, otherwise - * location is set to objects_error. In both cases, the_object - * is undefined. - */ - -void _Objects_MP_Is_remote ( - Objects_Information *information, - Objects_Id the_id, - Objects_Locations *location, - Objects_Control **the_object -); - -/* - * The following chain header is used to manage the set of - * inactive global object control blocks. - */ - -EXTERN unsigned32 _Objects_MP_Maximum_global_objects; -EXTERN Chain_Control _Objects_MP_Inactive_global_objects; - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/objectmp.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/priority.h b/cpukit/score/include/rtems/score/priority.h deleted file mode 100644 index b7de14f0f9..0000000000 --- a/cpukit/score/include/rtems/score/priority.h +++ /dev/null @@ -1,96 +0,0 @@ -/* priority.h - * - * This include file contains all thread priority manipulation routines. - * This Handler provides mechanisms which can be used to - * initialize and manipulate thread priorities. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __PRIORITY_h -#define __PRIORITY_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The following type defines the control block used to manage - * thread priorities. - * - * NOTE: Priority 0 is reserved for internal threads only. - */ - -typedef unsigned32 Priority_Control; - -#define PRIORITY_MINIMUM 0 /* highest thread priority */ -#define PRIORITY_MAXIMUM 255 /* lowest thread priority */ - -/* - * The following record defines the information associated with - * each thread to manage its interaction with the priority bit maps. - */ - -typedef struct { - Priority_Bit_map_control *minor; /* addr of minor bit map slot */ - Priority_Bit_map_control ready_major; /* priority bit map ready mask */ - Priority_Bit_map_control ready_minor; /* priority bit map ready mask */ - Priority_Bit_map_control block_major; /* priority bit map block mask */ - Priority_Bit_map_control block_minor; /* priority bit map block mask */ -} Priority_Information; - -/* - * The following data items are the priority bit map. - * Each of the sixteen bits used in the _Priority_Major_bit_map is - * associated with one of the sixteen entries in the _Priority_Bit_map. - * Each bit in the _Priority_Bit_map indicates whether or not there are - * threads ready at a particular priority. The mapping of - * individual priority levels to particular bits is processor - * dependent as is the value of each bit used to indicate that - * threads are ready at that priority. - */ - -EXTERN volatile Priority_Bit_map_control _Priority_Major_bit_map; -EXTERN Priority_Bit_map_control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT; - -/* - * The definition of the Priority_Bit_map_control type is CPU dependent. - * - */ - -/* - * Priority Bitfield Manipulation Routines - * - * NOTE: - * - * These may simply be pass throughs to CPU dependent routines. - */ - -#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE ) - -#define _Priority_Mask( _bit_number ) \ - _CPU_Priority_Mask( _bit_number ) - -#define _Priority_Bits_index( _priority ) \ - _CPU_Priority_bits_index( _priority ) - -#endif - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/priority.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/stack.h b/cpukit/score/include/rtems/score/stack.h deleted file mode 100644 index bf72782b42..0000000000 --- a/cpukit/score/include/rtems/score/stack.h +++ /dev/null @@ -1,50 +0,0 @@ -/* stack.h - * - * This include file contains all information about the thread - * Stack Handler. This Handler provides mechanisms which can be used to - * initialize and utilize stacks. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __STACK_h -#define __STACK_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The following constant defines the minimum stack size which every - * thread must exceed. - */ - -#define STACK_MINIMUM_SIZE CPU_STACK_MINIMUM_SIZE - -/* - * The following defines the control block used to manage each stack. - */ - -typedef struct { - unsigned32 size; /* stack size */ - void *area; /* low memory addr of stack */ -} Stack_Control; - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/stack.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/states.h b/cpukit/score/include/rtems/score/states.h deleted file mode 100644 index 1f8fd49fae..0000000000 --- a/cpukit/score/include/rtems/score/states.h +++ /dev/null @@ -1,78 +0,0 @@ -/* states.h - * - * This include file contains thread execution state information. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_STATES_h -#define __RTEMS_STATES_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The following type defines the control block used to manage a - * thread's state. - */ - -typedef unsigned32 States_Control; - -/* - * The following constants define the individual states which may be - * be used to compose and manipulate a thread's state. - */ - -#define STATES_ALL_SET 0xffff /* all states */ -#define STATES_READY 0x0000 /* ready to run */ -#define STATES_DORMANT 0x0001 /* created not started */ -#define STATES_SUSPENDED 0x0002 /* waiting for resume */ -#define STATES_TRANSIENT 0x0004 /* thread in transition */ -#define STATES_DELAYING 0x0008 /* wait for timeout */ -#define STATES_WAITING_FOR_TIME 0x0010 /* wait for TOD */ -#define STATES_WAITING_FOR_BUFFER 0x0020 -#define STATES_WAITING_FOR_SEGMENT 0x0040 -#define STATES_WAITING_FOR_MESSAGE 0x0080 -#define STATES_WAITING_FOR_EVENT 0x0100 -#define STATES_WAITING_FOR_SEMAPHORE 0x0200 -#define STATES_WAITING_FOR_MUTEX 0x0400 -#define STATES_WAITING_FOR_CONDITION_VARIABLE 0x0800 -#define STATES_WAITING_FOR_RPC_REPLY 0x1000 -#define STATES_WAITING_FOR_PERIOD 0x2000 - -#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \ - STATES_WAITING_FOR_SEGMENT | \ - STATES_WAITING_FOR_MESSAGE | \ - STATES_WAITING_FOR_MUTEX | \ - STATES_WAITING_FOR_CONDITION_VARIABLE | \ - STATES_WAITING_FOR_SEMAPHORE ) - -#define STATES_WAITING_ON_THREAD_QUEUE \ - ( STATES_LOCALLY_BLOCKED | \ - STATES_WAITING_FOR_RPC_REPLY ) - -#define STATES_BLOCKED ( STATES_DELAYING | \ - STATES_WAITING_FOR_TIME | \ - STATES_WAITING_FOR_PERIOD | \ - STATES_WAITING_FOR_EVENT | \ - STATES_WAITING_ON_THREAD_QUEUE ) - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/states.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/sysstate.h b/cpukit/score/include/rtems/score/sysstate.h deleted file mode 100644 index d7e43b2356..0000000000 --- a/cpukit/score/include/rtems/score/sysstate.h +++ /dev/null @@ -1,66 +0,0 @@ -/* sysstates.h - * - * This include file contains information regarding the system state. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_SYSTEM_STATE_h -#define __RTEMS_SYSTEM_STATE_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* types */ - -/* enumerated constants */ - -/* - * The following type defines the possible system states. - */ - -typedef enum { - SYSTEM_STATE_BEFORE_INITIALIZATION, /* start -> end of 1st init part */ - SYSTEM_STATE_BEFORE_MULTITASKING, /* end of 1st -> beginning of 2nd */ - SYSTEM_STATE_BEGIN_MULTITASKING, /* just before multitasking starts */ - SYSTEM_STATE_UP, /* normal operation */ - SYSTEM_STATE_FAILED /* fatal error occurred */ -} System_state_Codes; - -#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION -#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED - -/* - * The following variable indicates whether or not this is - * an multiprocessing system. - */ - -EXTERN boolean _System_state_Is_multiprocessing; - -/* - * The following variable contains the current system state. - */ - -EXTERN System_state_Codes _System_state_Current; - -/* - * Make it possible for the application to get the system state information. - */ - -#include <rtems/score/sysstate.inl> - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h deleted file mode 100644 index 8abf7c3584..0000000000 --- a/cpukit/score/include/rtems/score/thread.h +++ /dev/null @@ -1,571 +0,0 @@ -/* thread.h - * - * This include file contains all constants and structures associated - * with the thread control block. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __THREAD_h -#define __THREAD_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/context.h> -#include <rtems/score/cpu.h> -#include <rtems/score/mppkt.h> -#include <rtems/score/object.h> -#include <rtems/score/priority.h> -#include <rtems/score/stack.h> -#include <rtems/score/states.h> -#include <rtems/score/tod.h> -#include <rtems/score/tqdata.h> -#include <rtems/score/watchdog.h> - -/* - * The following defines the "return type" of a thread. - */ - -typedef void Thread; - -/* - * The following defines the ways in which the entry point for a - * thread can be invoked. Basically, it can be passed any - * combination/permutation of a pointer and an unsigned32 value. - * - * NOTE: For now, we are ignoring the return type. - */ - -typedef enum { - THREAD_START_NUMERIC, - THREAD_START_POINTER, - THREAD_START_BOTH_POINTER_FIRST, - THREAD_START_BOTH_NUMERIC_FIRST -} Thread_Start_types; - -typedef Thread ( *Thread_Entry )( ); - -/* - * The following structure contains the information which defines - * the starting state of a thread. - */ - -typedef struct { - Thread_Entry entry_point; /* starting thread address */ - Thread_Start_types prototype; /* how task is invoked */ - void *pointer_argument; /* pointer argument */ - unsigned32 numeric_argument; /* numeric argument */ - /* initial execution modes */ - boolean is_preemptible; - boolean is_timeslice; - unsigned32 isr_level; - Priority_Control initial_priority; /* initial priority */ - Stack_Control Initial_stack; /* stack information */ - void *fp_context; /* initial FP context area address */ - void *stack; /* initial FP context area address */ -} Thread_Start_information; - -/* - * The following structure contains the information necessary to manage - * a thread which it is waiting for a resource. - */ - -#define THREAD_STATUS_PROXY_BLOCKING 0x1111111 - -typedef struct { - Objects_Id id; /* waiting on this object */ - unsigned32 count; /* "generic" fields to be used */ - void *return_argument; /* when blocking */ - void *return_argument_1; - unsigned32 option; - - /* - * NOTE: The following assumes that all API return codes can be - * treated as an unsigned32. - */ - unsigned32 return_code; /* status for thread awakened */ - - Chain_Control Block2n; /* 2 - n priority blocked chain */ - Thread_queue_Control *queue; /* pointer to thread queue */ -} Thread_Wait_information; - -/* - * The following defines the control block used to manage - * each thread proxy. - * - * NOTE: It is critical that proxies and threads have identical - * memory images for the shared part. - */ - -typedef struct { - Objects_Control Object; - States_Control current_state; - Priority_Control current_priority; - Priority_Control real_priority; - unsigned32 resource_count; - Thread_Wait_information Wait; - Watchdog_Control Timer; - MP_packet_Prefix *receive_packet; - /****************** end of common block ********************/ - Chain_Node Active; -} Thread_Proxy_control; - - -/* - * The following record defines the control block used - * to manage each thread. - * - * NOTE: It is critical that proxies and threads have identical - * memory images for the shared part. - */ - -typedef enum { - THREAD_API_RTEMS, - THREAD_API_POSIX -} Thread_APIs; - -#define THREAD_API_FIRST THREAD_API_RTEMS -#define THREAD_API_LAST THREAD_API_POSIX - -typedef struct { - Objects_Control Object; - States_Control current_state; - Priority_Control current_priority; - Priority_Control real_priority; - unsigned32 resource_count; - Thread_Wait_information Wait; - Watchdog_Control Timer; - MP_packet_Prefix *receive_packet; - /****************** end of common block ********************/ - boolean is_global; - boolean do_post_task_switch_extension; - Chain_Control *ready; - Priority_Information Priority_map; - Thread_Start_information Start; - boolean is_preemptible; - boolean is_timeslice; - Context_Control Registers; - void *fp_context; - void *API_Extensions[ THREAD_API_LAST + 1 ]; - void **extensions; -} Thread_Control; - -/* - * The following constants define the stack size requirements for - * the idle thread. - */ - - -#define THREAD_IDLE_STACK_SIZE STACK_MINIMUM_SIZE - -/* - * The following defines the information control block used to - * manage this class of objects. - */ - -EXTERN Objects_Information _Thread_Internal_information; - -/* - * The following define the thread control pointers used to access - * and manipulate the idle thread. - */ - -EXTERN Thread_Control *_Thread_Idle; - -/* - * The following context area contains the context of the "thread" - * which invoked the start multitasking routine. This context is - * restored as the last action of the stop multitasking routine. Thus - * control of the processor can be returned to the environment - * which initiated the system. - */ - -EXTERN Context_Control _Thread_BSP_context; - -/* - * The following declares the dispatch critical section nesting - * counter which is used to prevent context switches at inopportune - * moments. - */ - -EXTERN unsigned32 _Thread_Dispatch_disable_level; - -/* - * The following holds how many user extensions are in the system. This - * is used to determine how many user extension data areas to allocate - * per thread. - */ - -EXTERN unsigned32 _Thread_Maximum_extensions; - -/* - * The following data items are used to manage timeslicing. - */ - -EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice; -EXTERN unsigned32 _Thread_Ticks_per_timeslice; - -/* - * The following points to the array of FIFOs used to manage the - * set of ready threads. - */ - -EXTERN Chain_Control *_Thread_Ready_chain; - -/* - * The following points to the thread which is currently executing. - * This thread is implicitly manipulated by numerous directives. - */ - -EXTERN Thread_Control *_Thread_Executing; - -/* - * The following points to the highest priority ready thread - * in the system. Unless the current thread is not preemptibl, - * then this thread will be context switched to when the next - * dispatch occurs. - */ - -EXTERN Thread_Control *_Thread_Heir; - -/* - * The following points to the thread whose floating point - * context is currently loaded. - */ - -EXTERN Thread_Control *_Thread_Allocated_fp; - -/* - * _Thread_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -void _Thread_Handler_initialization ( - unsigned32 ticks_per_timeslice, - unsigned32 maximum_extensions, - unsigned32 maximum_proxies -); - -/* - * _Thread_Create_idle - * - * DESCRIPTION: - * - * This routine creates the idle thread. - * - * WARNING!! No thread should be created before this one. - */ - -void _Thread_Create_idle( void ); - -/* - * _Thread_Start_multitasking - * - * DESCRIPTION: - * - * This routine initiates multitasking. It is invoked only as - * part of initialization and its invocation is the last act of - * the non-multitasking part of the system initialization. - */ - -void _Thread_Start_multitasking( void ); - -/* - * _Thread_Dispatch - * - * DESCRIPTION: - * - * This routine is responsible for transferring control of the - * processor from the executing thread to the heir thread. As part - * of this process, it is responsible for the following actions: - * - * + saving the context of the executing thread - * + restoring the context of the heir thread - * + dispatching any signals for the resulting executing thread - */ - -void _Thread_Dispatch( void ); - -/* - * _Thread_Initialize - * - * DESCRIPTION: - * - * XXX - */ - -boolean _Thread_Initialize( - Objects_Information *information, - Thread_Control *the_thread, - void *stack_area, /* NULL if to be allocated */ - unsigned32 stack_size, /* insure it is >= min */ - boolean is_fp, /* TRUE if thread uses FP */ - Priority_Control priority, - boolean is_preemptible, - boolean is_timeslice, - unsigned32 isr_level, - Objects_Name name - -); - -/* - * _Thread_Start - * - * DESCRIPTION: - * - * XXX - */ - -boolean _Thread_Start( - Thread_Control *the_thread, - Thread_Start_types the_prototype, - void *entry_point, - void *pointer_argument, - unsigned32 numeric_argument -); - -/* - * _Thread_Restart - * - * DESCRIPTION: - * - * XXX - */ - -/* XXX multiple task arg profiles */ - -boolean _Thread_Restart( - Thread_Control *the_thread, - void *pointer_argument, - unsigned32 numeric_argument -); - -/* - * _Thread_Close - * - * DESCRIPTION: - * - * XXX - */ - -void _Thread_Close( - Objects_Information *information, - Thread_Control *the_thread -); - -/* - * _Thread_Ready - * - * DESCRIPTION: - * - * This routine removes any set states for the_thread. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - */ - -void _Thread_Ready( - Thread_Control *the_thread -); - -/* - * _Thread_Clear_state - * - * DESCRIPTION: - * - * This routine clears the indicated STATES for the_thread. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - */ - -void _Thread_Clear_state( - Thread_Control *the_thread, - States_Control state -); - -/* - * _Thread_Set_state - * - * DESCRIPTION: - * - * This routine sets the indicated states for the_thread. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - * - */ - -void _Thread_Set_state( - Thread_Control *the_thread, - States_Control state -); - -/* - * _Thread_Set_transient - * - * DESCRIPTION: - * - * This routine sets the TRANSIENT state for the_thread. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - */ - -void _Thread_Set_transient( - Thread_Control *the_thread -); - -/* - * _Thread_Reset_timeslice - * - * DESCRIPTION: - * - * This routine is invoked upon expiration of the currently - * executing thread's timeslice. If no other thread's are ready - * at the priority of the currently executing thread, then the - * executing thread's timeslice is reset. Otherwise, the - * currently executing thread is placed at the rear of the - * FIFO for this priority and a new heir is selected. - */ - -void _Thread_Reset_timeslice( void ); - -/* - * _Thread_Tickle_timeslice - * - * DESCRIPTION: - * - * This routine is invoked as part of processing each clock tick. - * It is responsible for determining if the current thread allows - * timeslicing and, if so, when its timeslice expires. - */ - -void _Thread_Tickle_timeslice( void ); - -/* - * _Thread_Yield_processor - * - * DESCRIPTION: - * - * This routine is invoked when a thread wishes to voluntarily - * transfer control of the processor to another thread of equal - * or greater priority. - */ - -void _Thread_Yield_processor( void ); - -/* - * _Thread_Load_environment - * - * DESCRIPTION: - * - * This routine initializes the context of the_thread to its - * appropriate starting state. - */ - -void _Thread_Load_environment( - Thread_Control *the_thread -); - -/* - * _Thread_Handler - * - * DESCRIPTION: - * - * This routine is the wrapper function for all threads. It is - * the starting point for all threads. The user provided thread - * entry point is invoked by this routine. Operations - * which must be performed immediately before and after the user's - * thread executes are found here. - */ - -void _Thread_Handler( void ); - -/* - * _Thread_Delay_ended - * - * DESCRIPTION: - * - * This routine is invoked when a thread must be unblocked at the - * end of a time based delay (i.e. wake after or wake when). - */ - -void _Thread_Delay_ended( - Objects_Id id, - void *ignored -); - -/* - * _Thread_Change_priority - * - * DESCRIPTION: - * - * This routine changes the current priority of the_thread to - * new_priority. It performs any necessary scheduling operations - * including the selection of a new heir thread. - */ - -void _Thread_Change_priority ( - Thread_Control *the_thread, - Priority_Control new_priority -); - -/* - * _Thread_Set_priority - * - * DESCRIPTION: - * - * This routine updates the priority related fields in the_thread - * control block to indicate the current priority is now new_priority. - */ - -void _Thread_Set_priority( - Thread_Control *the_thread, - Priority_Control new_priority -); - -/* - * _Thread_Evaluate_mode - * - * DESCRIPTION: - * - * This routine XXX - */ - -boolean _Thread_Evaluate_mode( void ); - -/* - * _Thread_Idle_body - * - * DESCRIPTION: - * - * This routine is the body of the system idle thread. - */ - -#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE) -Thread _Thread_Idle_body( - unsigned32 ignored -); -#endif - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/thread.inl> -#endif -#include <rtems/score/threadmp.h> - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/threadmp.h b/cpukit/score/include/rtems/score/threadmp.h deleted file mode 100644 index 0466a04065..0000000000 --- a/cpukit/score/include/rtems/score/threadmp.h +++ /dev/null @@ -1,89 +0,0 @@ -/* threadmp.h - * - * This include file contains the specification for all routines - * and data specific to the multiprocessing portion of the thread package. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_THREAD_MP_h -#define __RTEMS_THREAD_MP_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _Thread_MP_Handler_initialization - * - * DESCRIPTION: - * - * This routine initializes the multiprocessing portion of the Thread Handler. - */ - -void _Thread_MP_Handler_initialization ( - unsigned32 maximum_proxies -); - -/* - * _Thread_MP_Allocate_proxy - * - * DESCRIPTION: - * - * This allocates a proxy control block from - * the inactive chain of free proxy control blocks. - * - * NOTE: This function returns a thread control pointer - * because proxies are substitutes for remote threads. - */ - -Thread_Control *_Thread_MP_Allocate_proxy ( - States_Control the_state -); - -/* - * _Thread_MP_Find_proxy - * - * DESCRIPTION: - * - * This function removes the proxy control block for the specified - * id from the active chain of proxy control blocks. - */ - -Thread_Control *_Thread_MP_Find_proxy ( - Objects_Id the_id -); - -/* - * The following is used to determine when the multiprocessing receive - * thread is executing so that a proxy can be allocated instead of - * blocking the multiprocessing receive thread. - */ - -EXTERN Thread_Control *_Thread_MP_Receive; - -/* - * The following chains are used to manage proxies. - */ - -EXTERN Chain_Control _Thread_MP_Active_proxies; -EXTERN Chain_Control _Thread_MP_Inactive_proxies; - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/threadmp.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h deleted file mode 100644 index 6a074daf16..0000000000 --- a/cpukit/score/include/rtems/score/threadq.h +++ /dev/null @@ -1,301 +0,0 @@ -/* threadq.h - * - * This include file contains all the constants and structures associated - * with the manipulation of objects. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __THREAD_QUEUE_h -#define __THREAD_QUEUE_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/tqdata.h> - -#include <rtems/score/object.h> -#include <rtems/score/thread.h> -#include <rtems/score/watchdog.h> - -/* - * Constant for indefinite wait. - */ - -#define THREAD_QUEUE_WAIT_FOREVER WATCHDOG_NO_TIMEOUT - -/* - * The following type defines the callout used when a remote task - * is extracted from a local thread queue. - */ - -typedef void ( *Thread_queue_Flush_callout )( - Thread_Control * - ); - -/* - * The following type defines the callout used when a local task - * is extracted from a remote thread queue (i.e. it's proxy must - * extracted from the remote queue). - */ - -typedef void ( *Thread_queue_Extract_callout )( - Thread_Control * - ); - -EXTERN Thread_queue_Extract_callout - _Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ]; - -/* - * _Thread_queue_Dequeue - * - * DESCRIPTION: - * - * This function returns a pointer to a thread waiting on - * the_thread_queue. The selection of this thread is based on - * the discipline of the_thread_queue. If no threads are waiting - * on the_thread_queue, then NULL is returned. - */ - -Thread_Control *_Thread_queue_Dequeue( - Thread_queue_Control *the_thread_queue -); - -/* - * _Thread_queue_Enqueue - * - * DESCRIPTION: - * - * This routine enqueues the currently executing thread on - * the_thread_queue with an optional timeout. - */ - -void _Thread_queue_Enqueue( - Thread_queue_Control *the_thread_queue, - Watchdog_Interval timeout -); - -/* - * _Thread_queue_Extract - * - * DESCRIPTION: - * - * This routine removes the_thread from the_thread_queue - * and cancels any timeouts associated with this blocking. - */ - -void _Thread_queue_Extract( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -); - -/* - * _Thread_queue_Extract_with_proxy - * - * DESCRIPTION: - * - * This routine extracts the_thread from the_thread_queue - * and insures that if there is a proxy for this task on - * another node, it is also dealt with. - */ - -boolean _Thread_queue_Extract_with_proxy( - Thread_Control *the_thread -); - -/* - * _Thread_queue_First - * - * DESCRIPTION: - * - * This function returns a pointer to the "first" thread - * on the_thread_queue. The "first" thread is selected - * based on the discipline of the_thread_queue. - */ - -Thread_Control *_Thread_queue_First( - Thread_queue_Control *the_thread_queue -); - -/* - * _Thread_queue_Flush - * - * DESCRIPTION: - * - * This routine unblocks all threads blocked on the_thread_queue - * and cancels any associated timeouts. - */ - -void _Thread_queue_Flush( - Thread_queue_Control *the_thread_queue, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -); - -/* - * _Thread_queue_Initialize - * - * DESCRIPTION: - * - * This routine initializes the_thread_queue based on the - * discipline indicated in attribute_set. The state set on - * threads which block on the_thread_queue is state. - */ - -void _Thread_queue_Initialize( - Thread_queue_Control *the_thread_queue, - Objects_Classes the_class, - Thread_queue_Disciplines the_discipline, - States_Control state, - Thread_queue_Extract_callout proxy_extract_callout, - unsigned32 timeout_status -); - -/* - * _Thread_queue_Dequeue_priority - * - * DESCRIPTION: - * - * This function returns a pointer to the highest priority - * thread waiting on the_thread_queue. If no threads are waiting - * on the_thread_queue, then NULL is returned. - */ - -Thread_Control *_Thread_queue_Dequeue_priority( - Thread_queue_Control *the_thread_queue -); - -/* - * _Thread_queue_Enqueue_priority - * - * DESCRIPTION: - * - * This routine enqueues the currently executing thread on - * the_thread_queue with an optional timeout using the - * priority discipline. - */ - -void _Thread_queue_Enqueue_priority( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - Watchdog_Interval timeout -); - -/* - * _Thread_queue_Extract_priority - * - * DESCRIPTION: - * - * This routine removes the_thread from the_thread_queue - * and cancels any timeouts associated with this blocking. - */ - -void _Thread_queue_Extract_priority( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -); - -/* - * _Thread_queue_First_priority - * - * DESCRIPTION: - * - * This function returns a pointer to the "first" thread - * on the_thread_queue. The "first" thread is the highest - * priority thread waiting on the_thread_queue. - */ - -Thread_Control *_Thread_queue_First_priority( - Thread_queue_Control *the_thread_queue -); - -/* - * _Thread_queue_Dequeue_FIFO - * - * DESCRIPTION: - * - * This function returns a pointer to the thread which has - * been waiting the longest on the_thread_queue. If no - * threads are waiting on the_thread_queue, then NULL is returned. - */ - -Thread_Control *_Thread_queue_Dequeue_fifo( - Thread_queue_Control *the_thread_queue -); - -/* - * _Thread_queue_Enqueue_FIFO - * - * DESCRIPTION: - * - * This routine enqueues the currently executing thread on - * the_thread_queue with an optional timeout using the - * FIFO discipline. - */ - -void _Thread_queue_Enqueue_fifo( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - Watchdog_Interval timeout -); - -/* - * _Thread_queue_Extract_FIFO - * - * DESCRIPTION: - * - * This routine removes the_thread from the_thread_queue - * and cancels any timeouts associated with this blocking. - */ - -void _Thread_queue_Extract_fifo( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -); - -/* - * _Thread_queue_First_FIFO - * - * DESCRIPTION: - * - * This function returns a pointer to the "first" thread - * on the_thread_queue. The first thread is the thread - * which has been waiting longest on the_thread_queue. - */ - -Thread_Control *_Thread_queue_First_fifo( - Thread_queue_Control *the_thread_queue -); - -/* - * _Thread_queue_timeout - * - * DESCRIPTION: - * - * This routine is invoked when a task's request has not - * been satisfied after the timeout interval specified to - * enqueue. The task represented by ID will be unblocked and - * its status code will be set in it's control block to indicate - * that a timeout has occurred. - */ - -void _Thread_queue_Timeout ( - Objects_Id id, - void *ignored -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h deleted file mode 100644 index b0fb686014..0000000000 --- a/cpukit/score/include/rtems/score/tod.h +++ /dev/null @@ -1,260 +0,0 @@ -/* tod.h - * - * This include file contains all the constants and structures associated - * with the Time of Day Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __TIME_OF_DAY_h -#define __TIME_OF_DAY_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/object.h> -#include <rtems/score/watchdog.h> - -/* - * The following constants are related to the time of day. - */ - -#define TOD_SECONDS_PER_MINUTE 60 -#define TOD_MINUTES_PER_HOUR 60 -#define TOD_MONTHS_PER_YEAR 12 -#define TOD_DAYS_PER_YEAR 365 -#define TOD_HOURS_PER_DAY 24 -#define TOD_SECONDS_PER_DAY (TOD_SECONDS_PER_MINUTE * \ - TOD_MINUTES_PER_HOUR * \ - TOD_HOURS_PER_DAY) - -#define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY) - -#define TOD_MICROSECONDS_PER_SECOND 1000000 -#define TOD_MILLISECONDS_PER_SECOND 1000 - -/* - * The following constant define the earliest year to which an - * time of day can be initialized. This is considered the - * epoch. - */ - -#define TOD_BASE_YEAR 1988 - -/* - * The following record defines the time of control block. This - * control block is used to maintain the current time of day. - */ - -typedef struct { /* RTEID style time/date */ - unsigned32 year; /* year, A.D. */ - unsigned32 month; /* month, 1 -> 12 */ - unsigned32 day; /* day, 1 -> 31 */ - unsigned32 hour; /* hour, 0 -> 23 */ - unsigned32 minute; /* minute, 0 -> 59 */ - unsigned32 second; /* second, 0 -> 59 */ - unsigned32 ticks; /* elapsed ticks between secs */ -} TOD_Control; - -/* - * The following contains the current time of day. - */ - -EXTERN TOD_Control _TOD_Current; - -/* - * The following contains the number of seconds from 00:00:00 - * January 1, TOD_BASE_YEAR until the current time of day. - */ - -EXTERN Watchdog_Interval _TOD_Seconds_since_epoch; - -/* - * The following contains the number of ticks since the - * system was booted. - */ - -EXTERN Watchdog_Interval _TOD_Ticks_since_boot; - -/* - * The following contains the number of microseconds per tick. - */ - -EXTERN unsigned32 _TOD_Microseconds_per_tick; - -/* - * The following contains the number of clock ticks per second. - * - * NOTE: - * - * If one second is NOT evenly divisible by the number of microseconds - * per clock tick, this value will contain only the integer portion - * of the division. This means that the interval between clock ticks - * can be a source of error in the current time of day. - */ - -EXTERN unsigned32 _TOD_Ticks_per_second; - -/* - * This is the control structure for the watchdog timer which - * fires to service the seconds chain. - */ - -EXTERN Watchdog_Control _TOD_Seconds_watchdog; - -#ifdef INIT - -/* - * The following array contains the number of days in all months. - * The first dimension should be 1 for leap years, and 0 otherwise. - * The second dimension should range from 1 to 12 for January to - * February, respectively. - */ - -const unsigned32 _TOD_Days_per_month[ 2 ][ 13 ] = { - { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } -}; - -/* - * The following array contains the number of days in all months - * up to the month indicated by the index of the second dimension. - * The first dimension should be 1 for leap years, and 0 otherwise. - */ - -const unsigned16 _TOD_Days_to_date[2][13] = { - { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }, - { 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 } -}; - -/* - * The following array contains the number of days in the years - * since the last leap year. The index should be 0 for leap - * years, and the number of years since the beginning of a leap - * year otherwise. - */ - -const unsigned16 _TOD_Days_since_last_leap_year[4] = { 0, 366, 761, 1126 }; - -#else - -extern const unsigned16 _TOD_Days_to_date[2][13]; /* Julian days */ -extern const unsigned16 _TOD_Days_since_last_leap_year[4]; -extern const unsigned32 _TOD_Days_per_month[2][13]; - -#endif - -/* - * _TOD_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -void _TOD_Handler_initialization( - unsigned32 microseconds_per_tick -); - -/* - * _TOD_Set - * - * DESCRIPTION: - * - * This routine sets the current time of day to THE_TOD and - * the equivalent SECONDS_SINCE_EPOCH. - */ - -void _TOD_Set( - TOD_Control *the_tod, - Watchdog_Interval seconds_since_epoch -); - -/* - * _TOD_Validate - * - * DESCRIPTION: - * - * This function returns TRUE if THE_TOD contains - * a valid time of day, and FALSE otherwise. - */ - -boolean _TOD_Validate( - TOD_Control *the_tod -); - -/* - * _TOD_To_seconds - * - * DESCRIPTION: - * - * This function returns the number seconds between the epoch and THE_TOD. - */ - -Watchdog_Interval _TOD_To_seconds( - TOD_Control *the_tod -); - -/* - * _TOD_Tickle - * - * DESCRIPTION: - * - * This routine is scheduled as a watchdog function and is invoked at - * each second boundary. It updates the current time of day to indicate - * that a second has passed and processes the seconds watchdog chain. - */ - -void _TOD_Tickle( - Objects_Id id, - void *ignored -); - -/* - * TOD_MILLISECONDS_TO_MICROSECONDS - * - * DESCRIPTION: - * - * This routine converts an interval expressed in milliseconds to microseconds. - * - * NOTE: - * - * This must be a macro so it can be used in "static" tables. - */ - -#define TOD_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000) - -/* - * TOD_MILLISECONDS_TO_TICKS - * - * DESCRIPTION: - * - * This routine converts an interval expressed in milliseconds to ticks. - * - * NOTE: - * - * This must be a macro so it can be used in "static" tables. - */ - -#define TOD_MILLISECONDS_TO_TICKS(_ms) \ - (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick) - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/tod.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/tqdata.h b/cpukit/score/include/rtems/score/tqdata.h deleted file mode 100644 index c9c9585f7f..0000000000 --- a/cpukit/score/include/rtems/score/tqdata.h +++ /dev/null @@ -1,91 +0,0 @@ -/* tqdata.h - * - * This include file contains all the constants and structures - * needed to declare a thread queue. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __THREAD_QUEUE_DATA_h -#define __THREAD_QUEUE_DATA_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/chain.h> -#include <rtems/score/priority.h> -#include <rtems/score/states.h> - -/* - * The following enumerated type details all of the disciplines - * supported by the Thread Queue Handler. - */ - -typedef enum { - THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */ - THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */ -} Thread_queue_Disciplines; - -/* - * The following enumerated types indicate what happened while the thread - * queue was in the synchronization window. - */ - -typedef enum { - THREAD_QUEUE_SYNCHRONIZED, - THREAD_QUEUE_NOTHING_HAPPENED, - THREAD_QUEUE_TIMEOUT, - THREAD_QUEUE_SATISFIED -} Thread_queue_States; - -/* - * The following constants are used to manage the priority queues. - * - * There are four chains used to maintain a priority -- each chain - * manages a distinct set of task priorities. The number of chains - * is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS. - * The following set must be consistent. - * - * The set below configures 4 headers -- each contains 64 priorities. - * Header x manages priority range (x*64) through ((x*64)+63). If - * the priority is more than half way through the priority range it - * is in, then the search is performed from the rear of the chain. - * This halves the search time to find the insertion point. - */ - -#define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4 -#define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER 64 -#define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK 0x20 - -typedef struct { - union { - Chain_Control Fifo; /* FIFO discipline list */ - Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS]; - /* priority discipline list */ - } Queues; - Thread_queue_States sync_state; /* alloc/dealloc critical section */ - Thread_queue_Disciplines discipline; /* queue discipline */ - States_Control state; /* state of threads on Thread_q */ - unsigned32 timeout_status; - unsigned32 count; -} Thread_queue_Control; - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/tqdata.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/userext.h b/cpukit/score/include/rtems/score/userext.h deleted file mode 100644 index 1a6ac3437e..0000000000 --- a/cpukit/score/include/rtems/score/userext.h +++ /dev/null @@ -1,213 +0,0 @@ -/* userext.h - * - * This include file contains all information about user extensions. This - * Handler provides mechanisms which can be used to initialize and manipulate - * all user extensions. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __USER_EXTENSIONS_h -#define __USER_EXTENSIONS_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/interr.h> -#include <rtems/score/chain.h> -#include <rtems/score/thread.h> - -/* - * The following records defines the User Extension Table. - * This table defines the application dependent routines which - * are invoked at critical points in the life of each thread and - * the system as a whole. - */ - -typedef void User_extensions_routine; - -typedef boolean ( *User_extensions_thread_create_extension )( - Thread_Control *, - Thread_Control * - ); - -typedef User_extensions_routine ( *User_extensions_thread_delete_extension )( - Thread_Control *, - Thread_Control * - ); - -typedef User_extensions_routine ( *User_extensions_thread_start_extension )( - Thread_Control *, - Thread_Control * - ); - -typedef User_extensions_routine ( *User_extensions_thread_restart_extension )( - Thread_Control *, - Thread_Control * - ); - -typedef User_extensions_routine ( *User_extensions_thread_switch_extension )( - Thread_Control *, - Thread_Control * - ); - -typedef User_extensions_routine ( *User_extensions_thread_begin_extension )( - Thread_Control * - ); - -typedef User_extensions_routine ( *User_extensions_thread_exitted_extension )( - Thread_Control * - ); - -typedef User_extensions_routine ( *User_extensions_fatal_extension )( - Internal_errors_Source /* the_source */, - boolean /* is_internal */, - unsigned32 /* the_error */ - ); - - -typedef struct { - User_extensions_thread_create_extension thread_create; - User_extensions_thread_start_extension thread_start; - User_extensions_thread_restart_extension thread_restart; - User_extensions_thread_delete_extension thread_delete; - User_extensions_thread_switch_extension thread_switch; - User_extensions_thread_begin_extension thread_begin; - User_extensions_thread_exitted_extension thread_exitted; - User_extensions_fatal_extension fatal; -} User_extensions_Table; - -/* - * The following is used to manage each user extension set. - */ - -typedef struct { - Chain_Node Node; - User_extensions_Table Callouts; -} User_extensions_Control; - -/* - * The following contains the static extension set which may be - * configured by the application. - */ - -EXTERN User_extensions_Control _User_extensions_Initial; - -/* - * The following is used to manage the list of active extensions. - */ - -EXTERN Chain_Control _User_extensions_List; - -/* - * _User_extensions_Thread_create - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension for - * the thread creation operate. - */ - -boolean _User_extensions_Thread_create ( - Thread_Control *the_thread -); - -/* - * _User_extensions_Thread_delete - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension for - * the thread deletion operation. - */ - -void _User_extensions_Thread_delete ( - Thread_Control *the_thread -); - -/* - * _User_extensions_Thread_start - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension for - * the thread start operation. - */ - -void _User_extensions_Thread_start ( - Thread_Control *the_thread -); - -/* - * _User_extensions_Thread_restart - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension for - * the thread restart operation. - */ - -void _User_extensions_Thread_restart ( - Thread_Control *the_thread -); - -/* - * _User_extensions_Thread_begin - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension which - * is invoked when a thread begins. - */ - -void _User_extensions_Thread_begin ( - Thread_Control *executing -); - -/* - * _User_extensions_Thread_exitted - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension which - * is invoked when a thread exits. - */ - -void _User_extensions_Thread_exitted ( - Thread_Control *executing -); - -/* - * _User_extensions_Fatal - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension invoked - * when a fatal error occurs. - */ - -void _User_extensions_Fatal ( - Internal_errors_Source the_source, - boolean is_internal, - unsigned32 the_error -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/userext.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/watchdog.h b/cpukit/score/include/rtems/score/watchdog.h deleted file mode 100644 index 9b13407c8e..0000000000 --- a/cpukit/score/include/rtems/score/watchdog.h +++ /dev/null @@ -1,185 +0,0 @@ -/* watchdog.h - * - * This include file contains all the constants and structures associated - * with watchdog timers. This Handler provides mechanisms which can be - * used to initialize and manipulate watchdog timers. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __WATCHDOG_h -#define __WATCHDOG_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/object.h> - -/* - * The following type defines the control block used to manage - * intervals. - */ - -typedef unsigned32 Watchdog_Interval; - -/* - * The following types define a pointer to a watchdog service routine. - */ - -typedef void Watchdog_Service_routine; - -typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )( - Objects_Id, - void * - ); - -/* - * Constant for indefinite wait. (actually an illegal interval) - */ - -#define WATCHDOG_NO_TIMEOUT 0 - -/* - * The following enumerated type lists the states in which a - * watchdog timer may be at any given time. - */ - -typedef enum { - WATCHDOG_INACTIVE, /* off all chains */ - WATCHDOG_BEING_INSERTED, /* off all chains, searching for insertion point */ - WATCHDOG_ACTIVE, /* on chain, allowed to fire */ - WATCHDOG_REMOVE_IT /* on chain, remove without firing if expires */ -} Watchdog_States; - -/* - * The following enumerated type details the manner in which - * a watchdog chain may be adjusted by the Watchdog_Adjust - * routine. The direction indicates a movement FORWARD - * or BACKWARD in time. - */ - -typedef enum { - WATCHDOG_FORWARD, /* adjust delta value forward */ - WATCHDOG_BACKWARD /* adjust delta value backward */ -} Watchdog_Adjust_directions; - -/* - * The following record defines the control block used - * to manage each watchdog timer. - */ - -typedef struct { - Chain_Node Node; - Watchdog_States state; - Watchdog_Interval initial; - Watchdog_Interval delta_interval; - Watchdog_Service_routine_entry routine; - Objects_Id id; - void *user_data; -} Watchdog_Control; - -/* - * The following are used for synchronization purposes - * during an insert on a watchdog delta chain. - */ - -EXTERN volatile unsigned32 _Watchdog_Sync_level; -EXTERN volatile unsigned32 _Watchdog_Sync_count; - -/* - * The following defines the watchdog chains which are managed - * on ticks and second boundaries. - */ - -EXTERN Chain_Control _Watchdog_Ticks_chain; -EXTERN Chain_Control _Watchdog_Seconds_chain; - -/* - * _Watchdog_Handler_initialization - * - * DESCRIPTION: - * - * This routine initializes the watchdog handler. The watchdog - * synchronization flag is initialized and the watchdog chains are - * initialized and emptied. - */ - -void _Watchdog_Handler_initialization( void ); - -/* - * _Watchdog_Remove - * - * DESCRIPTION: - * - * This routine removes THE_WATCHDOG from the watchdog chain on which - * it resides and returns the state THE_WATCHDOG timer was in. - */ - -Watchdog_States _Watchdog_Remove ( - Watchdog_Control *the_watchdog -); - -/* - * _Watchdog_Adjust - * - * DESCRIPTION: - * - * This routine adjusts the HEADER watchdog chain in the forward - * or backward DIRECTION for UNITS ticks. - */ - -void _Watchdog_Adjust ( - Chain_Control *header, - Watchdog_Adjust_directions direction, - Watchdog_Interval units -); - -/* - * _Watchdog_Insert - * - * DESCRIPTION: - * - * This routine inserts THE_WATCHDOG into the HEADER watchdog chain - * for a time of UNITS. The INSERT_MODE indicates whether - * THE_WATCHDOG is to be activated automatically or later, explicitly - * by the caller. - * - */ - -void _Watchdog_Insert ( - Chain_Control *header, - Watchdog_Control *the_watchdog -); - -/* - * _Watchdog_Tickle - * - * DESCRIPTION: - * - * This routine is invoked at appropriate intervals to update - * the HEADER watchdog chain. - */ - -void _Watchdog_Tickle ( - Chain_Control *header -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/watchdog.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/wkspace.h b/cpukit/score/include/rtems/score/wkspace.h deleted file mode 100644 index cb82852ca5..0000000000 --- a/cpukit/score/include/rtems/score/wkspace.h +++ /dev/null @@ -1,58 +0,0 @@ -/* wkspace.h - * - * This include file contains information related to the - * RAM Workspace. This Handler provides mechanisms which can be used to - * define, initialize and manipulate the workspace. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __WORKSPACE_h -#define __WORKSPACE_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/heap.h> -#include <rtems/score/interr.h> - -/* - * The following is used to manage the Workspace. - * - */ - -EXTERN Heap_Control _Workspace_Area; /* executive heap header */ - -/* - * _Workspace_Allocate_or_fatal_error - * - * DESCRIPTION: - * - * This routine returns the address of a block of memory of size - * bytes. If a block of the appropriate size cannot be allocated - * from the workspace, then the internal error handler is invoked. - */ - -void *_Workspace_Allocate_or_fatal_error( - unsigned32 size -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/wkspace.inl> -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/system.h b/cpukit/score/include/rtems/system.h deleted file mode 100644 index 9b50159c81..0000000000 --- a/cpukit/score/include/rtems/system.h +++ /dev/null @@ -1,134 +0,0 @@ -/* system.h - * - * This include file contains information that is included in every - * function in the executive. This must be the first include file - * included in all internal RTEMS files. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __RTEMS_SYSTEM_h -#define __RTEMS_SYSTEM_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The following define the CPU Family and Model within the family - * - * NOTE: The string "REPLACE_THIS_WITH_USE_INLINE_OR_MACROS" is replaced - * with either "USE_INLINES" or "USE_MACROS" based upon the - * whether this target configuration uses the inline or - * macro implementations of the inlined RTEMS routines. - */ - - -#define REPLACE_THIS_WITH_USE_INLINE_OR_MACROS - -/* - * The following insures that all data is declared in the space - * of the Initialization Manager. It is referenced as "external" - * in every other file. - */ - -#ifdef INIT -#undef EXTERN -#define EXTERN -#else -#undef EXTERN -#define EXTERN extern -#endif - -/* - * The following (in conjunction with compiler arguments) are used - * to choose between the use of static inline functions and macro - * functions. The static inline implementation allows better - * type checking with no cost in code size or execution speed. - */ - -#ifdef USE_INLINES -# define STATIC static -# ifdef __GNUC__ -# define INLINE __inline__ -# else -# define INLINE inline -# endif -#else -# define STATIC -# define INLINE -#endif - -/* - * Include a base set of files. - */ - -/* - * XXX: Eventually proc_ptr needs to disappear!!! - */ - -typedef void * proc_ptr; - -#include <rtems/score/cpu.h> /* processor specific information */ - -/* - * Define NULL - */ - -#ifndef NULL -#define NULL 0 /* NULL value */ -#endif - -/* - * Boolean constants - */ - -#if !defined( TRUE ) || (TRUE != 1) -#undef TRUE -#define TRUE (1) -#endif - -#if !defined( FALSE ) || (FALSE != 0) -#undef FALSE -#define FALSE (0) -#endif - -#define stringify( _x ) # _x - -#define RTEMS_offsetof(type, field) \ - ((unsigned32) &(((type *) 0)->field)) - -/* - * The following is the extern for the RTEMS version string. - * The contents of this string are CPU specific. - */ - -extern const char _RTEMS_version[]; /* RTEMS version string */ -extern const char _Copyright_Notice[]; /* RTEMS copyright string */ - -/* - * The following defines the CPU dependent information table. - */ - -EXTERN rtems_cpu_table _CPU_Table; /* CPU dependent info */ - -/* - * XXX weird RTEMS stuff - */ - -#define RTEMS_MAXIMUM_NAME_LENGTH 4 - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/address.inl b/cpukit/score/inline/rtems/score/address.inl deleted file mode 100644 index 343123c981..0000000000 --- a/cpukit/score/inline/rtems/score/address.inl +++ /dev/null @@ -1,120 +0,0 @@ -/* inline/address.inl - * - * This include file contains the bodies of the routines - * about addresses which are inlined. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __INLINE_ADDRESSES_inl -#define __INLINE_ADDRESSES_inl - -/*PAGE - * - * _Addresses_Add_offset - * - * DESCRIPTION: - * - * This function is used to add an offset to a base address. - * It returns the resulting address. This address is typically - * converted to an access type before being used further. - */ - -STATIC INLINE void *_Addresses_Add_offset ( - void *base, - unsigned32 offset -) -{ - return (void *)((char *)base + offset); -} - -/*PAGE - * - * _Addresses_Subtract_offset - * - * DESCRIPTION: - * - * This function is used to subtract an offset from a base - * address. It returns the resulting address. This address is - * typically converted to an access type before being used further. - */ - -STATIC INLINE void *_Addresses_Subtract_offset ( - void *base, - unsigned32 offset -) -{ - return (void *)((char *)base - offset); -} - -/*PAGE - * - * _Addresses_Subtract - * - * DESCRIPTION: - * - * This function is used to subtract two addresses. It returns the - * resulting offset. - * - * NOTE: The cast of an address to an unsigned32 makes this code - * dependent on an addresses being thirty two bits. - */ - -STATIC INLINE unsigned32 _Addresses_Subtract ( - void *left, - void *right -) -{ - return ((char *) left - (char *) right); -} - -/*PAGE - * - * _Addresses_Is_aligned - * - * DESCRIPTION: - * - * This function returns TRUE if the given address is correctly - * aligned for this processor and FALSE otherwise. Proper alignment - * is based on correctness and efficiency. - */ - -STATIC INLINE boolean _Addresses_Is_aligned ( - void *address -) -{ - return ( ( (unsigned32)address % CPU_ALIGNMENT ) == 0 ); -} - -/*PAGE - * - * _Addresses_Is_in_range - * - * DESCRIPTION: - * - * This function returns TRUE if the given address is within the - * memory range specified and FALSE otherwise. base is the address - * of the first byte in the memory range and limit is the address - * of the last byte in the memory range. The base address is - * assumed to be lower than the limit address. - */ - -STATIC INLINE boolean _Addresses_Is_in_range ( - void *address, - void *base, - void *limit -) -{ - return ( address >= base && address <= limit ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/chain.inl b/cpukit/score/inline/rtems/score/chain.inl deleted file mode 100644 index 7fd3fef934..0000000000 --- a/cpukit/score/inline/rtems/score/chain.inl +++ /dev/null @@ -1,390 +0,0 @@ -/* inline/chain.inl - * - * This include file contains the bodies of the routines which are - * associated with doubly linked chains and inlined. - * - * NOTE: The routines in this file are ordered from simple - * to complex. No other Chain Handler routine is referenced - * unless it has already been defined. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __INLINE_CHAIN_inl -#define __INLINE_CHAIN_inl - -/*PAGE - * - * _Chain_Are_nodes_equal - * - * DESCRIPTION: - * - * This function returns TRUE if LEFT and RIGHT are equal, - * and FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Are_nodes_equal( - Chain_Node *left, - Chain_Node *right -) -{ - return left == right; -} - -/*PAGE - * - * _Chain_Is_null - * - * DESCRIPTION: - * - * This function returns TRUE if the_chain is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_null( - Chain_Control *the_chain -) -{ - return ( the_chain == NULL ); -} - -/*PAGE - * - * _Chain_Is_null_node - * - * DESCRIPTION: - * - * This function returns TRUE if the_node is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_null_node( - Chain_Node *the_node -) -{ - return ( the_node == NULL ); -} - -/*PAGE - * - * _Chain_Head - * - * DESCRIPTION: - * - * This function returns a pointer to the first node on the chain. - */ - -STATIC INLINE Chain_Node *_Chain_Head( - Chain_Control *the_chain -) -{ - return (Chain_Node *) the_chain; -} - -/*PAGE - * - * _Chain_Tail - * - * DESCRIPTION: - * - * This function returns a pointer to the last node on the chain. - */ - -STATIC INLINE Chain_Node *_Chain_Tail( - Chain_Control *the_chain -) -{ - return (Chain_Node *) &the_chain->permanent_null; -} - -/*PAGE - * - * _Chain_Is_empty - * - * DESCRIPTION: - * - * This function returns TRUE if there a no nodes on the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_empty( - Chain_Control *the_chain -) -{ - return ( the_chain->first == _Chain_Tail( the_chain ) ); -} - -/*PAGE - * - * _Chain_Is_first - * - * DESCRIPTION: - * - * This function returns TRUE if the_node is the first node on a chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_first( - Chain_Node *the_node -) -{ - return ( the_node->previous == NULL ); -} - -/*PAGE - * - * _Chain_Is_last - * - * DESCRIPTION: - * - * This function returns TRUE if the_node is the last node on a chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_last( - Chain_Node *the_node -) -{ - return ( the_node->next == NULL ); -} - -/*PAGE - * - * _Chain_Has_only_one_node - * - * DESCRIPTION: - * - * This function returns TRUE if there is only one node on the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Has_only_one_node( - Chain_Control *the_chain -) -{ - return ( the_chain->first == the_chain->last ); -} - -/*PAGE - * - * _Chain_Is_head - * - * DESCRIPTION: - * - * This function returns TRUE if the_node is the head of the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_head( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - return ( the_node == _Chain_Head( the_chain ) ); -} - -/*PAGE - * - * _Chain_Is_tail - * - * DESCRIPTION: - * - * This function returns TRUE if the_node is the tail of the_chain and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Chain_Is_tail( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - return ( the_node == _Chain_Tail( the_chain ) ); -} - -/*PAGE - * - * Chain_Initialize_empty - * - * DESCRIPTION: - * - * This routine initializes the specified chain to contain zero nodes. - */ - -STATIC INLINE void _Chain_Initialize_empty( - Chain_Control *the_chain -) -{ - the_chain->first = _Chain_Tail( the_chain ); - the_chain->permanent_null = NULL; - the_chain->last = _Chain_Head( the_chain ); -} - -/*PAGE - * - * _Chain_Extract_unprotected - * - * DESCRIPTION: - * - * This routine extracts the_node from the chain on which it resides. - * It does NOT disable interrupts to insure the atomicity of the - * extract operation. - */ - -STATIC INLINE void _Chain_Extract_unprotected( - Chain_Node *the_node -) -{ - Chain_Node *next; - Chain_Node *previous; - - next = the_node->next; - previous = the_node->previous; - next->previous = previous; - previous->next = next; -} - -/*PAGE - * - * _Chain_Get_first_unprotected - * - * DESCRIPTION: - * - * This function removes the first node from the_chain and returns - * a pointer to that node. It does NOT disable interrupts to insure - * the atomicity of the get operation. - */ - -STATIC INLINE Chain_Node *_Chain_Get_first_unprotected( - Chain_Control *the_chain -) -{ - Chain_Node *return_node; - Chain_Node *new_first; - - return_node = the_chain->first; - new_first = return_node->next; - the_chain->first = new_first; - new_first->previous = _Chain_Head( the_chain ); - - return return_node; -} - -/*PAGE - * - * Chain_Get_unprotected - * - * DESCRIPTION: - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It does NOT disable interrupts to insure the atomicity of the - * get operation. - */ - -STATIC INLINE Chain_Node *_Chain_Get_unprotected( - Chain_Control *the_chain -) -{ - if ( !_Chain_Is_empty( the_chain ) ) - return _Chain_Get_first_unprotected( the_chain ); - else - return NULL; -} - -/*PAGE - * - * _Chain_Insert_unprotected - * - * DESCRIPTION: - * - * This routine inserts the_node on a chain immediately following - * after_node. It does NOT disable interrupts to insure the atomicity - * of the extract operation. - */ - -STATIC INLINE void _Chain_Insert_unprotected( - Chain_Node *after_node, - Chain_Node *the_node -) -{ - Chain_Node *before_node; - - the_node->previous = after_node; - before_node = after_node->next; - after_node->next = the_node; - the_node->next = before_node; - before_node->previous = the_node; -} - -/*PAGE - * - * _Chain_Append_unprotected - * - * DESCRIPTION: - * - * This routine appends the_node onto the end of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * append operation. - */ - -STATIC INLINE void _Chain_Append_unprotected( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - Chain_Node *old_last_node; - - the_node->next = _Chain_Tail( the_chain ); - old_last_node = the_chain->last; - the_chain->last = the_node; - old_last_node->next = the_node; - the_node->previous = old_last_node; -} - -/*PAGE - * - * _Chain_Prepend_unprotected - * - * DESCRIPTION: - * - * This routine prepends the_node onto the front of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * prepend operation. - */ - -STATIC INLINE void _Chain_Prepend_unprotected( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - _Chain_Insert_unprotected( _Chain_Head( the_chain ), the_node ); - -} - -/*PAGE - * - * _Chain_Prepend - * - * DESCRIPTION: - * - * This routine prepends the_node onto the front of the_chain. - * It disables interrupts to insure the atomicity of the - * prepend operation. - */ - -STATIC INLINE void _Chain_Prepend( - Chain_Control *the_chain, - Chain_Node *the_node -) -{ - _Chain_Insert( _Chain_Head( the_chain ), the_node ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/coremsg.inl b/cpukit/score/inline/rtems/score/coremsg.inl deleted file mode 100644 index 84e7250aa7..0000000000 --- a/cpukit/score/inline/rtems/score/coremsg.inl +++ /dev/null @@ -1,260 +0,0 @@ -/* coremsg.inl - * - * This include file contains the static inline implementation of all - * inlined routines in the Core Message Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __CORE_MESSAGE_QUEUE_inl -#define __CORE_MESSAGE_QUEUE_inl - -#include <string.h> /* needed for memcpy */ - -/*PAGE - * - * _CORE_message_queue_Send - * - * DESCRIPTION: - * - * This routine sends a message to the end of the specified message queue. - */ - -STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Send( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support -) -{ - return _CORE_message_queue_Submit( - the_message_queue, - buffer, - size, - id, - api_message_queue_mp_support, - CORE_MESSAGE_QUEUE_SEND_REQUEST - ); -} - -/*PAGE - * - * _CORE_message_queue_Urgent - * - * DESCRIPTION: - * - * This routine sends a message to the front of the specified message queue. - */ - -STATIC INLINE CORE_message_queue_Status _CORE_message_queue_Urgent( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support -) -{ - return _CORE_message_queue_Submit( - the_message_queue, - buffer, - size, - id, - api_message_queue_mp_support, - CORE_MESSAGE_QUEUE_URGENT_REQUEST - ); -} - -/*PAGE - * - * _CORE_message_queue_Copy_buffer - * - * DESCRIPTION: - * - * This routine copies the contents of the source message buffer - * to the destination message buffer. - */ - -STATIC INLINE void _CORE_message_queue_Copy_buffer ( - void *source, - void *destination, - unsigned32 size -) -{ - memcpy(destination, source, size); -} - -/*PAGE - * - * _CORE_message_queue_Allocate_message_buffer - * - * DESCRIPTION: - * - * This function allocates a message buffer from the inactive - * message buffer chain. - */ - -STATIC INLINE CORE_message_queue_Buffer_control * -_CORE_message_queue_Allocate_message_buffer ( - CORE_message_queue_Control *the_message_queue -) -{ - return (CORE_message_queue_Buffer_control *) - _Chain_Get( &the_message_queue->Inactive_messages ); -} - -/*PAGE - * - * _CORE_message_queue_Free_message_buffer - * - * DESCRIPTION: - * - * This routine frees a message buffer to the inactive - * message buffer chain. - */ - -STATIC INLINE void _CORE_message_queue_Free_message_buffer ( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Buffer_control *the_message -) -{ - _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node ); -} - -/*PAGE - * - * _CORE_message_queue_Get_pending_message - * - * DESCRIPTION: - * - * This function removes the first message from the_message_queue - * and returns a pointer to it. - */ - -STATIC INLINE - CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message ( - CORE_message_queue_Control *the_message_queue -) -{ - return (CORE_message_queue_Buffer_control *) - _Chain_Get_unprotected( &the_message_queue->Pending_messages ); -} - -/*PAGE - * - * _CORE_message_queue_Is_priority - * - * DESCRIPTION: - * - * This function returns TRUE if the priority attribute is - * enabled in the attribute_set and FALSE otherwise. - */ - -STATIC INLINE boolean _CORE_message_queue_Is_priority( - CORE_message_queue_Attributes *the_attribute -) -{ - return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY); -} - -/*PAGE - * - * _CORE_message_queue_Append - * - * DESCRIPTION: - * - * This routine places the_message at the rear of the outstanding - * messages on the_message_queue. - */ - -STATIC INLINE void _CORE_message_queue_Append ( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Buffer_control *the_message -) -{ - _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node ); -} - -/*PAGE - * - * _CORE_message_queue_Prepend - * - * DESCRIPTION: - * - * This routine places the_message at the front of the outstanding - * messages on the_message_queue. - */ - -STATIC INLINE void _CORE_message_queue_Prepend ( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Buffer_control *the_message -) -{ - _Chain_Prepend( - &the_message_queue->Pending_messages, - &the_message->Node - ); -} - -/*PAGE - * - * _CORE_message_queue_Is_null - * - * DESCRIPTION: - * - * This function returns TRUE if the_message_queue is TRUE and FALSE otherwise. - */ - -STATIC INLINE boolean _CORE_message_queue_Is_null ( - CORE_message_queue_Control *the_message_queue -) -{ - return ( the_message_queue == NULL ); -} - -/*PAGE - * - * _CORE_message_queue_Is_notify_enabled - * - * DESCRIPTION: - * - * This function returns TRUE if notification is enabled on this message - * queue and FALSE otherwise. - */ - -STATIC INLINE boolean _CORE_message_queue_Is_notify_enabled ( - CORE_message_queue_Control *the_message_queue -) -{ - return (the_message_queue->notify_handler != NULL); -} - -/*PAGE - * - * _CORE_message_queue_Set_notify - * - * DESCRIPTION: - * - * This routine initializes the notification information for the_message_queue. - */ - -STATIC INLINE void _CORE_message_queue_Set_notify ( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Notify_Handler the_handler, - void *the_argument -) -{ - the_message_queue->notify_handler = the_handler; - the_message_queue->notify_argument = the_argument; -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl deleted file mode 100644 index 537d6f7e5f..0000000000 --- a/cpukit/score/inline/rtems/score/coremutex.inl +++ /dev/null @@ -1,124 +0,0 @@ -/* inline/coremutex.inl - * - * This include file contains all of the inlined routines associated - * with the CORE mutexes. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __INLINE_CORE_MUTEX_inl -#define __INLINE_CORE_MUTEX_inl - -/*PAGE - * - * _CORE_mutex_Is_locked - * - * DESCRIPTION: - * - * This routine returns TRUE if the mutex specified is locked and FALSE - * otherwise. - */ - -STATIC INLINE boolean _CORE_mutex_Is_locked( - CORE_mutex_Control *the_mutex -) -{ - return the_mutex->lock == CORE_MUTEX_LOCKED; -} - -/*PAGE - * - * _CORE_mutex_Is_fifo - * - * DESCRIPTION: - * - * This routine returns TRUE if the mutex's wait discipline is FIFO and FALSE - * otherwise. - */ - -STATIC INLINE boolean _CORE_mutex_Is_fifo( - CORE_mutex_Attributes *the_attribute -) -{ - return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO; -} - -/*PAGE - * - * _CORE_mutex_Is_priority - * - * DESCRIPTION: - * - * This routine returns TRUE if the mutex's wait discipline is PRIORITY and - * FALSE otherwise. - */ - -STATIC INLINE boolean _CORE_mutex_Is_priority( - CORE_mutex_Attributes *the_attribute -) -{ - return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY; -} - -/*PAGE - * - * _CORE_mutex_Is_inherit_priority - * - * DESCRIPTION: - * - * This routine returns TRUE if the mutex's wait discipline is - * INHERIT_PRIORITY and FALSE otherwise. - */ - -STATIC INLINE boolean _CORE_mutex_Is_inherit_priority( - CORE_mutex_Attributes *the_attribute -) -{ - return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT; -} - -/*PAGE - * - * _CORE_mutex_Is_priority_ceiling - * - * DESCRIPTION: - * - * This routine returns TRUE if the mutex's wait discipline is - * PRIORITY_CEILING and FALSE otherwise. - */ - -STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling( - CORE_mutex_Attributes *the_attribute -) -{ - return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING; -} - -/*PAGE - * - * _CORE_mutex_Is_nesting_allowed - * - * DESCRIPTION: - * - * This routine returns TRUE if the mutex allows a task to obtain a - * semaphore more than once and nest. - */ - -STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed( - CORE_mutex_Attributes *the_attribute -) -{ - return the_attribute->allow_nesting == TRUE; - -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/coresem.inl b/cpukit/score/inline/rtems/score/coresem.inl deleted file mode 100644 index 6f82318d10..0000000000 --- a/cpukit/score/inline/rtems/score/coresem.inl +++ /dev/null @@ -1,54 +0,0 @@ -/* inline/coresem.inl - * - * This include file contains all of the inlined routines associated - * with the CORE semaphore. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __INLINE_CORE_SEMAPHORE_inl -#define __INLINE_CORE_SEMAPHORE_inl - -/*PAGE - * - * _CORE_semaphore_Is_priority - * - * DESCRIPTION: - * - * This function returns TRUE if the priority attribute is - * enabled in the attribute_set and FALSE otherwise. - */ - -STATIC INLINE boolean _CORE_semaphore_Is_priority( - CORE_semaphore_Attributes *the_attribute -) -{ - return ( the_attribute->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ); -} - -/*PAGE - * - * _CORE_semaphore_Get_count - * - * DESCRIPTION: - * - * This routine returns the current count associated with the semaphore. - */ - -STATIC INLINE unsigned32 _CORE_semaphore_Get_count( - CORE_semaphore_Control *the_semaphore -) -{ - return the_semaphore->count; -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/heap.inl b/cpukit/score/inline/rtems/score/heap.inl deleted file mode 100644 index 6b4b1af74e..0000000000 --- a/cpukit/score/inline/rtems/score/heap.inl +++ /dev/null @@ -1,274 +0,0 @@ -/* heap.inl - * - * This file contains the static inline implementation of the inlined - * routines from the heap handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __HEAP_inl -#define __HEAP_inl - -#include <rtems/score/address.h> - -/*PAGE - * - * _Heap_Head - * - * DESCRIPTION: - * - * This function returns the head of the specified heap. - */ - -STATIC INLINE Heap_Block *_Heap_Head ( - Heap_Control *the_heap -) -{ - return (Heap_Block *)&the_heap->start; -} - -/*PAGE - * - * _Heap_Tail - * - * DESCRIPTION: - * - * This function returns the tail of the specified heap. - */ - -STATIC INLINE Heap_Block *_Heap_Tail ( - Heap_Control *the_heap -) -{ - return (Heap_Block *)&the_heap->final; -} - -/*PAGE - * - * _Heap_Previous_block - * - * DESCRIPTION: - * - * This function returns the address of the block which physically - * precedes the_block in memory. - */ - -STATIC INLINE Heap_Block *_Heap_Previous_block ( - Heap_Block *the_block -) -{ - return (Heap_Block *) _Addresses_Subtract_offset( - (void *)the_block, - the_block->back_flag & ~ HEAP_BLOCK_USED - ); -} - -/*PAGE - * - * _Heap_Next_block - * - * DESCRIPTION: - * - * This function returns the address of the block which physically - * follows the_block in memory. - * - * NOTE: Next_block assumes that the block is free. - */ - -STATIC INLINE Heap_Block *_Heap_Next_block ( - Heap_Block *the_block -) -{ - return (Heap_Block *) _Addresses_Add_offset( - (void *)the_block, - the_block->front_flag & ~ HEAP_BLOCK_USED - ); -} - -/*PAGE - * - * _Heap_Block_at - * - * DESCRIPTION: - * - * This function calculates and returns a block's location (address) - * in the heap based upad a base address and an offset. - */ - -STATIC INLINE Heap_Block *_Heap_Block_at( - void *base, - unsigned32 offset -) -{ - return (Heap_Block *) _Addresses_Add_offset( (void *)base, offset ); -} - -/*PAGE - * - * _Heap_User_block_at - * - * DESCRIPTION: - * - * XXX - */ - -STATIC INLINE Heap_Block *_Heap_User_block_at( - void *base -) -{ - unsigned32 offset; - - offset = *(((unsigned32 *) base) - 1); - return _Heap_Block_at( base, -offset + -HEAP_BLOCK_USED_OVERHEAD); -} - -/*PAGE - * - * _Heap_Is_previous_block_free - * - * DESCRIPTION: - * - * This function returns TRUE if the previous block of the_block - * is free, and FALSE otherwise. - */ - -STATIC INLINE boolean _Heap_Is_previous_block_free ( - Heap_Block *the_block -) -{ - return !(the_block->back_flag & HEAP_BLOCK_USED); -} - -/*PAGE - * - * _Heap_Is_block_free - * - * DESCRIPTION: - * - * This function returns TRUE if the block is free, and FALSE otherwise. - */ - -STATIC INLINE boolean _Heap_Is_block_free ( - Heap_Block *the_block -) -{ - return !(the_block->front_flag & HEAP_BLOCK_USED); -} - -/*PAGE - * - * _Heap_Is_block_used - * - * DESCRIPTION: - * - * This function returns TRUE if the block is currently allocated, - * and FALSE otherwise. - */ - -STATIC INLINE boolean _Heap_Is_block_used ( - Heap_Block *the_block -) -{ - return (the_block->front_flag & HEAP_BLOCK_USED); -} - -/*PAGE - * - * _Heap_Block_size - * - * DESCRIPTION: - * - * This function returns the size of the_block in bytes. - */ - -STATIC INLINE unsigned32 _Heap_Block_size ( - Heap_Block *the_block -) -{ - return (the_block->front_flag & ~HEAP_BLOCK_USED); -} - -/*PAGE - * - * _Heap_Start_of_user_area - * - * DESCRIPTION: - * - * This function returns the starting address of the portion of the block - * which the user may access. - */ - -STATIC INLINE void *_Heap_Start_of_user_area ( - Heap_Block *the_block -) -{ - return (void *) &the_block->next; -} - -/*PAGE - * - * _Heap_Is_block_in - * - * DESCRIPTION: - * - * This function returns TRUE if the_block is within the memory area - * managed by the_heap, and FALSE otherwise. - */ - -STATIC INLINE boolean _Heap_Is_block_in ( - Heap_Control *the_heap, - Heap_Block *the_block -) -{ - return _Addresses_Is_in_range( the_block, the_heap->start, the_heap->final ); -} - -/*PAGE - * - * _Heap_Is_page_size_valid - * - * DESCRIPTION: - * - * This function validates a specified heap page size. If the page size - * is 0 or if lies outside a page size alignment boundary it is invalid - * and FALSE is returned. Otherwise, the page size is valid and TRUE is - * returned. - */ - -STATIC INLINE boolean _Heap_Is_page_size_valid( - unsigned32 page_size -) -{ - return ((page_size != 0) && - ((page_size % CPU_HEAP_ALIGNMENT) == 0)); -} - -/*PAGE - * - * _Heap_Build_flag - * - * DESCRIPTION: - * - * This function returns the block flag composed of size and in_use_flag. - * The flag returned is suitable for use as a back or front flag in a - * heap block. - */ - -STATIC INLINE unsigned32 _Heap_Build_flag ( - unsigned32 size, - unsigned32 in_use_flag -) -{ - return size | in_use_flag; -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/isr.inl b/cpukit/score/inline/rtems/score/isr.inl deleted file mode 100644 index 2dd41315bc..0000000000 --- a/cpukit/score/inline/rtems/score/isr.inl +++ /dev/null @@ -1,73 +0,0 @@ -/* isr.inl - * - * This include file contains the static implementation of all - * inlined routines in the Interrupt Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __ISR_inl -#define __ISR_inl - -/*PAGE - * - * _ISR_Is_in_progress - * - * DESCRIPTION: - * - * This function returns TRUE if the processor is currently servicing - * and interrupt and FALSE otherwise. A return value of TRUE indicates - * that the caller is an interrupt service routine, NOT a thread. The - * directives available to an interrupt service routine are restricted. - */ - -STATIC INLINE boolean _ISR_Is_in_progress( void ) -{ - return (_ISR_Nest_level != 0); -} - -/*PAGE - * - * _ISR_Is_vector_number_valid - * - * DESCRIPTION: - * - * This function returns TRUE if the vector is a valid vector number - * for this processor and FALSE otherwise. - */ - -STATIC INLINE boolean _ISR_Is_vector_number_valid ( - unsigned32 vector -) -{ - return ( vector <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER ); -} - -/*PAGE - * - * _ISR_Is_valid_user_handler - * - * - * DESCRIPTION: - * - * This function returns TRUE if handler is the entry point of a valid - * use interrupt service routine and FALSE otherwise. - */ - -STATIC INLINE boolean _ISR_Is_valid_user_handler ( - void *handler -) -{ - return ( handler != NULL); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/mppkt.inl b/cpukit/score/inline/rtems/score/mppkt.inl deleted file mode 100644 index c8b6ecd117..0000000000 --- a/cpukit/score/inline/rtems/score/mppkt.inl +++ /dev/null @@ -1,58 +0,0 @@ -/* inline/mppkt.inl - * - * This package is the implementation of the Packet Handler - * routines which are inlined. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __INLINE_MP_PACKET_inl -#define __INLINE_MP_PACKET_inl - -/*PAGE - * - * _Mp_packet_Is_valid_packet_class - * - * DESCRIPTION: - * - * This function returns TRUE if the the_packet_class is valid, - * and FALSE otherwise. - * - * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary - * because this enum starts at lower bound of zero. - */ - -STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( - MP_packet_Classes the_packet_class -) -{ - return ( the_packet_class <= MP_PACKET_CLASSES_LAST ); -} - -/*PAGE - * - * _Mp_packet_Is_null - * - * DESCRIPTION: - * - * This function returns TRUE if the the_packet_class is null, - * and FALSE otherwise. - */ - -STATIC INLINE boolean _Mp_packet_Is_null ( - MP_packet_Prefix *the_packet -) -{ - return the_packet == NULL; -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl deleted file mode 100644 index 249814bacf..0000000000 --- a/cpukit/score/inline/rtems/score/object.inl +++ /dev/null @@ -1,244 +0,0 @@ -/* object.inl - * - * This include file contains the static inline implementation of all - * of the inlined routines in the Object Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __OBJECTS_inl -#define __OBJECTS_inl - -/*PAGE - * - * _Objects_Build_id - * - * DESCRIPTION: - * - * This function builds an object's id from the processor node and index - * values specified. - */ - -STATIC INLINE Objects_Id _Objects_Build_id( - Objects_Classes the_class, - unsigned32 node, - unsigned32 index -) -{ - return ( (the_class << OBJECTS_CLASS_START_BIT) | - (node << OBJECTS_NODE_START_BIT) | - (index << OBJECTS_INDEX_START_BIT) ); -} - -/*PAGE - * - * _Objects_Get_class - * - * DESCRIPTION: - * - * This function returns the class portion of the ID. - */ - -STATIC INLINE Objects_Classes _Objects_Get_class( - Objects_Id id -) -{ - return (Objects_Classes) - ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS); -} - - -/*PAGE - * - * _Objects_Get_node - * - * DESCRIPTION: - * - * This function returns the node portion of the ID. - */ - -STATIC INLINE unsigned32 _Objects_Get_node( - Objects_Id id -) -{ - return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS; -} - -/*PAGE - * - * _Objects_Get_index - * - * DESCRIPTION: - * - * This function returns the index portion of the ID. - */ - -STATIC INLINE unsigned32 _Objects_Get_index( - Objects_Id id -) -{ - return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS; -} - -/*PAGE - * - * _Objects_Is_class_valid - * - * DESCRIPTION: - * - * This function returns TRUE if the class is valid. - */ - -STATIC INLINE boolean _Objects_Is_class_valid( - Objects_Classes the_class -) -{ - return the_class <= OBJECTS_CLASSES_LAST; -} - -/*PAGE - * - * _Objects_Is_local_node - * - * DESCRIPTION: - * - * This function returns TRUE if the node is of the local object, and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Objects_Is_local_node( - unsigned32 node -) -{ - return ( node == _Objects_Local_node ); -} - -/*PAGE - * - * _Objects_Is_local_id - * - * DESCRIPTION: - * - * This function returns TRUE if the id is of a local object, and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Objects_Is_local_id( - Objects_Id id -) -{ - return _Objects_Is_local_node( _Objects_Get_node(id) ); -} - -/*PAGE - * - * _Objects_Are_ids_equal - * - * DESCRIPTION: - * - * This function returns TRUE if left and right are equal, - * and FALSE otherwise. - */ - -STATIC INLINE boolean _Objects_Are_ids_equal( - Objects_Id left, - Objects_Id right -) -{ - return ( left == right ); -} - -/*PAGE - * - * _Objects_Allocate - * - * DESCRIPTION: - * - * This function allocates a object control block from - * the inactive chain of free object control blocks. - */ - -STATIC INLINE Objects_Control *_Objects_Allocate( - Objects_Information *information -) -{ - return (Objects_Control *) _Chain_Get( &information->Inactive ); -} - -/*PAGE - * - * _Objects_Free - * - * DESCRIPTION: - * - * This function frees a object control block to the - * inactive chain of free object control blocks. - */ - -STATIC INLINE void _Objects_Free( - Objects_Information *information, - Objects_Control *the_object -) -{ - _Chain_Append( &information->Inactive, &the_object->Node ); -} - -/*PAGE - * - * _Objects_Open - * - * DESCRIPTION: - * - * This function places the_object control pointer and object name - * in the Local Pointer and Local Name Tables, respectively. - */ - -STATIC INLINE void _Objects_Open( - Objects_Information *information, - Objects_Control *the_object, - Objects_Name name -) -{ - unsigned32 index; - - index = _Objects_Get_index( the_object->id ); - information->local_table[ index ] = the_object; - - if ( information->is_string ) - _Objects_Copy_name_string( name, the_object->name ); - else - _Objects_Copy_name_raw( name, the_object->name, information->name_length ); -} - -/*PAGE - * - * _Objects_Close - * - * DESCRIPTION: - * - * This function removes the_object control pointer and object name - * in the Local Pointer and Local Name Tables. - */ - -STATIC INLINE void _Objects_Close( - Objects_Information *information, - Objects_Control *the_object -) -{ - unsigned32 index; - - index = _Objects_Get_index( the_object->id ); - information->local_table[ index ] = NULL; - _Objects_Clear_name( the_object->name, information->name_length ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/objectmp.inl b/cpukit/score/inline/rtems/score/objectmp.inl deleted file mode 100644 index dda2799643..0000000000 --- a/cpukit/score/inline/rtems/score/objectmp.inl +++ /dev/null @@ -1,73 +0,0 @@ -/* inline/objectmp.inl - * - * This include file contains the bodies of all inlined routines - * which deal with global objects. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __INLINE_MP_OBJECTS_inl -#define __INLINE_MP_OBJECTS_inl - -/*PAGE - * - * _Objects_MP_Allocate_global_object - * - * DESCRIPTION: - * - * This function allocates a Global Object control block. - */ - -STATIC INLINE Objects_MP_Control *_Objects_MP_Allocate_global_object ( - void -) -{ - return (Objects_MP_Control *) - _Chain_Get( &_Objects_MP_Inactive_global_objects ); -} - -/*PAGE - * - * _Objects_MP_Free_global_object - * - * DESCRIPTION: - * - * This routine deallocates a Global Object control block. - */ - -STATIC INLINE void _Objects_MP_Free_global_object ( - Objects_MP_Control *the_object -) -{ - _Chain_Append( - &_Objects_MP_Inactive_global_objects, - &the_object->Object.Node - ); -} - -/*PAGE - * - * _Objects_MP_Is_null_global_object - * - * DESCRIPTION: - * - * This function returns whether the global object is NULL or not. - */ - -STATIC INLINE boolean _Objects_MP_Is_null_global_object ( - Objects_MP_Control *the_object -) -{ - return( the_object == NULL ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/priority.inl b/cpukit/score/inline/rtems/score/priority.inl deleted file mode 100644 index d65056057b..0000000000 --- a/cpukit/score/inline/rtems/score/priority.inl +++ /dev/null @@ -1,247 +0,0 @@ -/* priority.inl - * - * This file contains the static inline implementation of all inlined - * routines in the Priority Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __PRIORITY_inl -#define __PRIORITY_inl - -#include <rtems/score/bitfield.h> - -/*PAGE - * - * _Priority_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -STATIC INLINE void _Priority_Handler_initialization( void ) -{ - unsigned32 index; - - _Priority_Major_bit_map = 0; - for ( index=0 ; index <16 ; index++ ) - _Priority_Bit_map[ index ] = 0; -} - -/*PAGE - * - * _Priority_Is_valid - * - * DESCRIPTION: - * - * This function returns TRUE if the_priority if valid for a - * user task, and FALSE otherwise. - */ - -STATIC INLINE boolean _Priority_Is_valid ( - Priority_Control the_priority -) -{ - /* - * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned, - * then checking for less than 0 is unnecessary. - */ - - return ( the_priority <= PRIORITY_MAXIMUM ); -} - -/*PAGE - * - * _Priority_Major - * - * DESCRIPTION: - * - * This function returns the major portion of the_priority. - */ - -STATIC INLINE unsigned32 _Priority_Major ( - Priority_Control the_priority -) -{ - return ( the_priority / 16 ); -} - -/*PAGE - * - * _Priority_Minor - * - * DESCRIPTION: - * - * This function returns the minor portion of the_priority. - */ - -STATIC INLINE unsigned32 _Priority_Minor ( - Priority_Control the_priority -) -{ - return ( the_priority % 16 ); -} - -#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE ) - -/*PAGE - * - * _Priority_Mask - * - * DESCRIPTION: - * - * This function returns the mask associated with the major or minor - * number passed to it. - */ - -STATIC INLINE unsigned32 _Priority_Mask ( - unsigned32 bit_number -) -{ - return (0x8000 >> bit_number); -} - - -/*PAGE - * - * _Priority_Bits_index - * - * DESCRIPTION: - * - * This function translates the bit numbers returned by the bit scan - * of a priority bit field into something suitable for use as - * a major or minor component of a priority. - */ - -STATIC INLINE unsigned32 _Priority_Bits_index ( - unsigned32 bit_number -) -{ - return bit_number; -} - -#endif - -/*PAGE - * - * _Priority_Add_to_bit_map - * - * DESCRIPTION: - * - * This routine uses the_priority_map to update the priority - * bit maps to indicate that a thread has been readied. - */ - -STATIC INLINE void _Priority_Add_to_bit_map ( - Priority_Information *the_priority_map -) -{ - *the_priority_map->minor |= the_priority_map->ready_minor; - _Priority_Major_bit_map |= the_priority_map->ready_major; -} - -/*PAGE - * - * _Priority_Remove_from_bit_map - * - * DESCRIPTION: - * - * This routine uses the_priority_map to update the priority - * bit maps to indicate that a thread has been removed from the - * ready state. - */ - -STATIC INLINE void _Priority_Remove_from_bit_map ( - Priority_Information *the_priority_map -) -{ - *the_priority_map->minor &= the_priority_map->block_minor; - if ( *the_priority_map->minor == 0 ) - _Priority_Major_bit_map &= the_priority_map->block_major; -} - -/*PAGE - * - * _Priority_Get_highest - * - * DESCRIPTION: - * - * This function returns the priority of the highest priority - * ready thread. - */ - -STATIC INLINE Priority_Control _Priority_Get_highest( void ) -{ - Priority_Bit_map_control minor; - Priority_Bit_map_control major; - - _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); - _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); - - return (_Priority_Bits_index( major ) << 4) + - _Priority_Bits_index( minor ); -} - -/*PAGE - * - * _Priority_Initialize_information - * - * DESCRIPTION: - * - * This routine initializes the_priority_map so that it - * contains the information necessary to manage a thread - * at new_priority. - */ - -STATIC INLINE void _Priority_Initialize_information( - Priority_Information *the_priority_map, - Priority_Control new_priority -) -{ - Priority_Bit_map_control major; - Priority_Bit_map_control minor; - Priority_Bit_map_control mask; - - major = _Priority_Major( new_priority ); - minor = _Priority_Minor( new_priority ); - - the_priority_map->minor = - &_Priority_Bit_map[ _Priority_Bits_index(major) ]; - - mask = _Priority_Mask( major ); - the_priority_map->ready_major = mask; - the_priority_map->block_major = ~mask; - - mask = _Priority_Mask( minor ); - the_priority_map->ready_minor = mask; - the_priority_map->block_minor = ~mask; -} - -/*PAGE - * - * _Priority_Is_group_empty - * - * DESCRIPTION: - * - * This function returns TRUE if the priority GROUP is empty, and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Priority_Is_group_empty ( - Priority_Control the_priority -) -{ - return the_priority == 0; -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/stack.inl b/cpukit/score/inline/rtems/score/stack.inl deleted file mode 100644 index d29874a7dd..0000000000 --- a/cpukit/score/inline/rtems/score/stack.inl +++ /dev/null @@ -1,81 +0,0 @@ -/* stack.inl - * - * This file contains the static inline implementation of the inlined - * routines from the Stack Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __STACK_inl -#define __STACK_inl - -/*PAGE - * - * _Stack_Initialize - * - * DESCRIPTION: - * - * This routine initializes the_stack record to indicate that - * size bytes of memory starting at starting_address have been - * reserved for a stack. - */ - -STATIC INLINE void _Stack_Initialize ( - Stack_Control *the_stack, - void *starting_address, - unsigned32 size -) -{ - the_stack->area = starting_address; - the_stack->size = size; -} - -/*PAGE - * - * _Stack_Is_enough - * - * DESCRIPTION: - * - * This function returns TRUE if size bytes is enough memory for - * a valid stack area on this processor, and FALSE otherwise. - */ - -STATIC INLINE boolean _Stack_Is_enough ( - unsigned32 size -) -{ - return ( size >= STACK_MINIMUM_SIZE ); -} - -/*PAGE - * - * _Stack_Adjust_size - * - * DESCRIPTION: - * - * This function increases the stack size to insure that the thread - * has the desired amount of stack space after the initial stack - * pointer is determined based on alignment restrictions. - * - * NOTE: - * - * The amount of adjustment for alignment is CPU dependent. - */ - -STATIC INLINE unsigned32 _Stack_Adjust_size ( - unsigned32 size -) -{ - return size + CPU_STACK_ALIGNMENT; -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/states.inl b/cpukit/score/inline/rtems/score/states.inl deleted file mode 100644 index fad8ce727c..0000000000 --- a/cpukit/score/inline/rtems/score/states.inl +++ /dev/null @@ -1,384 +0,0 @@ -/* states.inl - * - * This file contains the macro implementation of the inlined - * routines associated with thread state information. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __STATES_inl -#define __STATES_inl - -/*PAGE - * - * _States_Set - * - * DESCRIPTION: - * - * This function sets the given states_to_set into the current_state - * passed in. The result is returned to the user in current_state. - */ - -STATIC INLINE States_Control _States_Set ( - States_Control states_to_set, - States_Control current_state -) -{ - return (current_state | states_to_set); -} - -/*PAGE - * - * _States_Clear - * - * DESCRIPTION: - * - * This function clears the given states_to_clear into the current_state - * passed in. The result is returned to the user in current_state. - */ - -STATIC INLINE States_Control _States_Clear ( - States_Control states_to_clear, - States_Control current_state -) -{ - return (current_state & ~states_to_clear); -} - -/*PAGE - * - * _States_Is_ready - * - * DESCRIPTION: - * - * This function returns TRUE if the_states indicates that the - * state is READY, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_ready ( - States_Control the_states -) -{ - return (the_states == STATES_READY); -} - -/*PAGE - * - * _States_Is_only_dormant - * - * DESCRIPTION: - * - * This function returns TRUE if the DORMANT state is the ONLY state - * set in the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_only_dormant ( - States_Control the_states -) -{ - return (the_states == STATES_DORMANT); -} - -/*PAGE - * - * _States_Is_dormant - * - * DESCRIPTION: - * - * This function returns TRUE if the DORMANT state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_dormant ( - States_Control the_states -) -{ - return (the_states & STATES_DORMANT); -} - -/*PAGE - * - * _States_Is_suspended - * - * DESCRIPTION: - * - * This function returns TRUE if the SUSPENDED state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_suspended ( - States_Control the_states -) -{ - return (the_states & STATES_SUSPENDED); -} - -/*PAGE - * - * _States_Is_Transient - * - * DESCRIPTION: - * - * This function returns TRUE if the TRANSIENT state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_transient ( - States_Control the_states -) -{ - return (the_states & STATES_TRANSIENT); -} - -/*PAGE - * - * _States_Is_delaying - * - * DESCRIPTION: - * - * This function returns TRUE if the DELAYING state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_delaying ( - States_Control the_states -) -{ - return (the_states & STATES_DELAYING); -} - -/*PAGE - * - * _States_Is_waiting_for_buffer - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_BUFFER state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_buffer ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_BUFFER); -} - -/*PAGE - * - * _States_Is_waiting_for_segment - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_SEGMENT state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_segment ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_SEGMENT); -} - -/*PAGE - * - * _States_Is_waiting_for_message - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_MESSAGE state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_message ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_MESSAGE); -} - -/*PAGE - * - * _States_Is_waiting_for_event - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_EVENT state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_event ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_EVENT); -} - -/*PAGE - * - * _States_Is_waiting_for_mutex - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_MUTEX state - * is set in the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_mutex ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_MUTEX); -} - -/*PAGE - * - * _States_Is_waiting_for_semaphore - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_SEMAPHORE state - * is set in the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_semaphore ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_SEMAPHORE); -} - -/*PAGE - * - * _States_Is_waiting_for_time - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_TIME state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_time ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_TIME); -} - -/*PAGE - * - * _States_Is_waiting_for_rpc_reply - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_TIME state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_rpc_reply ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_RPC_REPLY); -} - -/*PAGE - * - * _States_Is_waiting_for_period - * - * DESCRIPTION: - * - * This function returns TRUE if the WAITING_FOR_PERIOD state is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_for_period ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_FOR_PERIOD); -} - -/*PAGE - * - * _States_Is_locally_blocked - * - * DESCRIPTION: - * - * This function returns TRUE if one of the states which indicates - * that a task is blocked waiting for a local resource is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_locally_blocked ( - States_Control the_states -) -{ - return (the_states & STATES_LOCALLY_BLOCKED); -} - -/*PAGE - * - * _States_Is_waiting_on_thread_queue - * - * DESCRIPTION: - * - * This function returns TRUE if one of the states which indicates - * that a task is blocked waiting for a local resource is set in - * the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_waiting_on_thread_queue ( - States_Control the_states -) -{ - return (the_states & STATES_WAITING_ON_THREAD_QUEUE); -} - -/*PAGE - * - * _States_Is_blocked - * - * DESCRIPTION: - * - * This function returns TRUE if one of the states which indicates - * that a task is blocked is set in the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Is_blocked ( - States_Control the_states -) -{ - return (the_states & STATES_BLOCKED); -} - -/*PAGE - * - * - * _States_Are_set - * - * DESCRIPTION: - * - * This function returns TRUE if any of the states in the mask - * are set in the_states, and FALSE otherwise. - */ - -STATIC INLINE boolean _States_Are_set ( - States_Control the_states, - States_Control mask -) -{ - return ( (the_states & mask) != STATES_READY); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/sysstate.inl b/cpukit/score/inline/rtems/score/sysstate.inl deleted file mode 100644 index 08f8b9c513..0000000000 --- a/cpukit/score/inline/rtems/score/sysstate.inl +++ /dev/null @@ -1,154 +0,0 @@ -/* sysstates.inl - * - * This file contains the inline implementation of routines regarding the - * system state. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __SYSTEM_STATE_inl -#define __SYSTEM_STATE_inl - -/*PAGE - * - * _System_state_Handler_initialization - * - * DESCRIPTION: - * - * This routine initializes the system state handler. - */ - -STATIC INLINE void _System_state_Handler_initialization ( - boolean is_multiprocessing -) -{ - _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; - _System_state_Is_multiprocessing = is_multiprocessing; -} - -/*PAGE - * - * _System_state_Set - * - * DESCRIPTION: - * - * This routine sets the current system state to that specified by - * the called. - */ - -STATIC INLINE void _System_state_Set ( - System_state_Codes state -) -{ - _System_state_Current = state; -} - -/*PAGE - * - * _System_state_Get - * - * DESCRIPTION: - * - * This function returns the current system state. - */ - -STATIC INLINE System_state_Codes _System_state_Get ( void ) -{ - return _System_state_Current; -} - -/*PAGE - * - * _System_state_Is_before_initialization - * - * DESCRIPTION: - * - * This function returns TRUE if the state is equal to the - * "before initialization" state, and FALSE otherwise. - */ - -STATIC INLINE boolean _System_state_Is_before_initialization ( - System_state_Codes state -) -{ - return (state == SYSTEM_STATE_BEFORE_INITIALIZATION); -} - -/*PAGE - * - * _System_state_Is_before_multitasking - * - * DESCRIPTION: - * - * This function returns TRUE if the state is equal to the - * "before multitasking" state, and FALSE otherwise. - */ - -STATIC INLINE boolean _System_state_Is_before_multitasking ( - System_state_Codes state -) -{ - return (state == SYSTEM_STATE_BEFORE_MULTITASKING); -} - -/*PAGE - * - * _System_state_Is_begin_multitasking - * - * DESCRIPTION: - * - * This function returns TRUE if the state is equal to the - * "begin multitasking" state, and FALSE otherwise. - */ - -STATIC INLINE boolean _System_state_Is_begin_multitasking ( - System_state_Codes state -) -{ - return (state == SYSTEM_STATE_BEGIN_MULTITASKING); -} - -/*PAGE - * - * _System_state_Is_up - * - * DESCRIPTION: - * - * This function returns TRUE if the state is equal to the - * "up" state, and FALSE otherwise. - */ - -STATIC INLINE boolean _System_state_Is_up ( - System_state_Codes state -) -{ - return (state == SYSTEM_STATE_UP); -} - -/*PAGE - * - * _System_state_Is_failed - * - * DESCRIPTION: - * - * This function returns TRUE if the state is equal to the - * "failed" state, and FALSE otherwise. - */ - -STATIC INLINE boolean _System_state_Is_failed ( - System_state_Codes state -) -{ - return (state == SYSTEM_STATE_FAILED); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl deleted file mode 100644 index 53d5d41751..0000000000 --- a/cpukit/score/inline/rtems/score/thread.inl +++ /dev/null @@ -1,404 +0,0 @@ -/* thread.inl - * - * This file contains the macro implementation of the inlined - * routines from the Thread handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __THREAD_inl -#define __THREAD_inl - -/*PAGE - * - * _Thread_Stop_multitasking - * - * DESCRIPTION: - * - * This routine halts multitasking and returns control to - * the "thread" (i.e. the BSP) which initially invoked the - * routine which initialized the system. - */ - -STATIC INLINE void _Thread_Stop_multitasking( void ) -{ - _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context ); -} - -/*PAGE - * - * _Thread_Is_executing - * - * DESCRIPTION: - * - * This function returns TRUE if the_thread is the currently executing - * thread, and FALSE otherwise. - */ - -STATIC INLINE boolean _Thread_Is_executing ( - Thread_Control *the_thread -) -{ - return ( the_thread == _Thread_Executing ); -} - -/*PAGE - * - * _Thread_Is_heir - * - * DESCRIPTION: - * - * This function returns TRUE if the_thread is the heir - * thread, and FALSE otherwise. - */ - -STATIC INLINE boolean _Thread_Is_heir ( - Thread_Control *the_thread -) -{ - return ( the_thread == _Thread_Heir ); -} - -/*PAGE - * - * _Thread_Is_executing_also_the_heir - * - * DESCRIPTION: - * - * This function returns TRUE if the currently executing thread - * is also the heir thread, and FALSE otherwise. - */ - -STATIC INLINE boolean _Thread_Is_executing_also_the_heir( void ) -{ - return ( _Thread_Executing == _Thread_Heir ); -} - -/*PAGE - * - * _Thread_Resume - * - * DESCRIPTION: - * - * This routine clears the SUSPENDED state for the_thread. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - */ - -STATIC INLINE void _Thread_Resume ( - Thread_Control *the_thread -) -{ - _Thread_Clear_state( the_thread, STATES_SUSPENDED ); -} - -/*PAGE - * - * _Thread_Unblock - * - * DESCRIPTION: - * - * This routine clears any blocking state for the_thread. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - */ - -STATIC INLINE void _Thread_Unblock ( - Thread_Control *the_thread -) -{ - _Thread_Clear_state( the_thread, STATES_BLOCKED ); -} - -/*PAGE - * - * _Thread_Restart_self - * - * DESCRIPTION: - * - * This routine resets the current context of the calling thread - * to that of its initial state. - */ - -STATIC INLINE void _Thread_Restart_self( void ) -{ - if ( _Thread_Executing->fp_context != NULL ) - _Context_Restore_fp( &_Thread_Executing->fp_context ); - - _CPU_Context_Restart_self( &_Thread_Executing->Registers ); -} - -/*PAGE - * - * _Thread_Calculate_heir - * - * DESCRIPTION: - * - * This function returns a pointer to the highest priority - * ready thread. - */ - -STATIC INLINE void _Thread_Calculate_heir( void ) -{ - _Thread_Heir = (Thread_Control *) - _Thread_Ready_chain[ _Priority_Get_highest() ].first; -} - -/*PAGE - * - * _Thread_Is_allocated_fp - * - * DESCRIPTION: - * - * This function returns TRUE if the floating point context of - * the_thread is currently loaded in the floating point unit, and - * FALSE otherwise. - */ - -STATIC INLINE boolean _Thread_Is_allocated_fp ( - Thread_Control *the_thread -) -{ - return ( the_thread == _Thread_Allocated_fp ); -} - -/*PAGE - * - * _Thread_Deallocate_fp - * - * DESCRIPTION: - * - * This routine is invoked when the currently loaded floating - * point context is now longer associated with an active thread. - */ - -STATIC INLINE void _Thread_Deallocate_fp( void ) -{ - _Thread_Allocated_fp = NULL; -} - -/*PAGE - * - * _Thread_Disable_dispatch - * - * DESCRIPTION: - * - * This routine prevents dispatching. - */ - -STATIC INLINE void _Thread_Disable_dispatch( void ) -{ - _Thread_Dispatch_disable_level += 1; -} - -/*PAGE - * - * _Thread_Enable_dispatch - * - * DESCRIPTION: - * - * This routine allows dispatching to occur again. If this is - * the outer most dispatching critical section, then a dispatching - * operation will be performed and, if necessary, control of the - * processor will be transferred to the heir thread. - */ - -#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) -STATIC INLINE void _Thread_Enable_dispatch() -{ - if ( (--_Thread_Dispatch_disable_level) == 0 ) - _Thread_Dispatch(); -} -#endif - -#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) -void _Thread_Enable_dispatch( void ); -#endif - -/*PAGE - * - * _Thread_Unnest_dispatch - * - * DESCRIPTION: - * - * This routine allows dispatching to occur again. However, - * no dispatching operation is performed even if this is the outer - * most dispatching critical section. - */ - -STATIC INLINE void _Thread_Unnest_dispatch( void ) -{ - _Thread_Dispatch_disable_level -= 1; -} - -/*PAGE - * - * _Thread_Is_dispatching_enabled - * - * DESCRIPTION: - * - * This function returns TRUE if dispatching is disabled, and FALSE - * otherwise. - */ - -STATIC INLINE boolean _Thread_Is_dispatching_enabled( void ) -{ - return ( _Thread_Dispatch_disable_level == 0 ); -} - -/*PAGE - * - * _Thread_Is_context_switch_necessary - * - * DESCRIPTION: - * - * This function returns TRUE if dispatching is disabled, and FALSE - * otherwise. - */ - -STATIC INLINE boolean _Thread_Is_context_switch_necessary( void ) -{ - return ( _Context_Switch_necessary ); -} - -/*PAGE - * - * _Thread_Dispatch_initialization - * - * DESCRIPTION: - * - * This routine initializes the thread dispatching subsystem. - */ - -STATIC INLINE void _Thread_Dispatch_initialization( void ) -{ - _Thread_Dispatch_disable_level = 1; -} - -/*PAGE - * - * _Thread_Is_null - * - * DESCRIPTION: - * - * This function returns TRUE if the_thread is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Thread_Is_null ( - Thread_Control *the_thread -) -{ - return ( the_thread == NULL ); -} - -/*PAGE - * - * _Thread_Get - * - * DESCRIPTION: - * - * This function maps thread IDs to thread control - * blocks. If ID corresponds to a local thread, then it - * returns the_thread control pointer which maps to ID - * and location is set to OBJECTS_LOCAL. If the thread ID is - * global and resides on a remote node, then location is set - * to OBJECTS_REMOTE, and the_thread is undefined. - * Otherwise, location is set to OBJECTS_ERROR and - * the_thread is undefined. - * - * NOTE: XXX... This routine may be able to be optimized. - */ - -STATIC INLINE Thread_Control *_Thread_Get ( - Objects_Id id, - Objects_Locations *location -) -{ - Objects_Classes the_class; - Objects_Information *information; - Thread_Control *tp = (Thread_Control *) 0; - - if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { - _Thread_Disable_dispatch(); - *location = OBJECTS_LOCAL; - tp = _Thread_Executing; - goto done; - } - - the_class = _Objects_Get_class( id ); - - if ( the_class > OBJECTS_CLASSES_LAST ) { - *location = OBJECTS_ERROR; - goto done; - } - - information = _Objects_Information_table[ the_class ]; - - if ( !information || !information->is_thread ) { - *location = OBJECTS_ERROR; - goto done; - } - - tp = (Thread_Control *) _Objects_Get( information, id, location ); - -done: - return tp; -} - - -/* - * _Thread_Is_proxy_blocking - * - * DESCRIPTION: - * - * This function returns TRUE if the status code is equal to the - * status which indicates that a proxy is blocking, and FALSE otherwise. - */ - -STATIC INLINE boolean _Thread_Is_proxy_blocking ( - unsigned32 code -) -{ - return (code == THREAD_STATUS_PROXY_BLOCKING); -} - -/*PAGE - * - * _Thread_Internal_allocate - * - * DESCRIPTION: - * - * This routine allocates an internal thread. - */ - -STATIC INLINE Thread_Control *_Thread_Internal_allocate( void ) -{ - return (Thread_Control *) _Objects_Allocate( &_Thread_Internal_information ); -} - -/*PAGE - * - * _Thread_Internal_free - * - * DESCRIPTION: - * - * This routine frees an internal thread. - */ - -STATIC INLINE void _Thread_Internal_free ( - Thread_Control *the_task -) -{ - _Objects_Free( &_Thread_Internal_information, &the_task->Object ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/threadmp.inl b/cpukit/score/inline/rtems/score/threadmp.inl deleted file mode 100644 index f16f64e48a..0000000000 --- a/cpukit/score/inline/rtems/score/threadmp.inl +++ /dev/null @@ -1,61 +0,0 @@ -/* inline/threadmp.inl - * - * This include file contains the bodies of all inlined routines - * for the multiprocessing part of thread package. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __INLINE_MP_THREAD_inl -#define __INLINE_MP_THREAD_inl - -/*PAGE - * - * _Thread_MP_Is_receive - * - * DESCRIPTION: - * - * This function returns true if the thread in question is the - * multiprocessing receive thread. - */ - -STATIC INLINE boolean _Thread_MP_Is_receive ( - Thread_Control *the_thread -) -{ - return the_thread == _Thread_MP_Receive; -} - -/*PAGE - * - * _Thread_MP_Free_proxy - * - * DESCRIPTION: - * - * This routine frees a proxy control block to the - * inactive chain of free proxy control blocks. - */ - -STATIC INLINE void _Thread_MP_Free_proxy ( - Thread_Control *the_thread -) -{ - Thread_Proxy_control *the_proxy; - - the_proxy = (Thread_Proxy_control *) the_thread; - - _Chain_Extract( &the_proxy->Active ); - - _Chain_Append( &_Thread_MP_Inactive_proxies, &the_thread->Object.Node ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/tod.inl b/cpukit/score/inline/rtems/score/tod.inl deleted file mode 100644 index 5ed1e76d8f..0000000000 --- a/cpukit/score/inline/rtems/score/tod.inl +++ /dev/null @@ -1,82 +0,0 @@ -/* tod.inl - * - * This file contains the static inline implementation of the inlined routines - * from the Time of Day Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __TIME_OF_DAY_inl -#define __TIME_OF_DAY_inl - -/*PAGE - * - * _TOD_Is_set - * - * DESCRIPTION: - * - * This function returns TRUE if the application has set the current - * time of day, and FALSE otherwise. - */ - -STATIC INLINE boolean _TOD_Is_set( void ) -{ - return _Watchdog_Is_active( &_TOD_Seconds_watchdog ); -} - -/*PAGE - * - * _TOD_Tickle_ticks - * - * DESCRIPTION: - * - * This routine increments the ticks field of the current time of - * day at each clock tick. - */ - -STATIC INLINE void _TOD_Tickle_ticks( void ) -{ - _TOD_Current.ticks += 1; - _TOD_Ticks_since_boot += 1; -} - -/*PAGE - * - * _TOD_Deactivate - * - * DESCRIPTION: - * - * This routine deactivates updating of the current time of day. - */ - -STATIC INLINE void _TOD_Deactivate( void ) -{ - _Watchdog_Remove( &_TOD_Seconds_watchdog ); -} - -/*PAGE - * - * _TOD_Activate - * - * DESCRIPTION: - * - * This routine activates updating of the current time of day. - */ - -STATIC INLINE void _TOD_Activate( - Watchdog_Interval ticks -) -{ - _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, ticks ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/tqdata.inl b/cpukit/score/inline/rtems/score/tqdata.inl deleted file mode 100644 index c7d8630062..0000000000 --- a/cpukit/score/inline/rtems/score/tqdata.inl +++ /dev/null @@ -1,89 +0,0 @@ -/* tqdata.inl - * - * This file contains the static inline implementation of the inlined - * routines needed to support the Thread Queue Data. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __THREAD_QUEUE_DATA_inl -#define __THREAD_QUEUE_DATA_inl - -/*PAGE - * - * _Thread_queue_Header_number - * - * DESCRIPTION: - * - * This function returns the index of the priority chain on which - * a thread of the_priority should be placed. - */ - -STATIC INLINE unsigned32 _Thread_queue_Header_number ( - Priority_Control the_priority -) -{ - return (the_priority / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER); -} - -/*PAGE - * - * _Thread_queue_Is_reverse_search - * - * DESCRIPTION: - * - * This function returns TRUE if the_priority indicates that the - * enqueue search should start at the front of this priority - * group chain, and FALSE if the search should start at the rear. - */ - -STATIC INLINE boolean _Thread_queue_Is_reverse_search ( - Priority_Control the_priority -) -{ - return ( the_priority & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK ); -} - -/*PAGE - * - * _Thread_queue_Get_number_waiting - * - * DESCRIPTION: - * - * This function returns the number of threads waiting on this thread queue. - */ - -STATIC INLINE unsigned32 _Thread_queue_Get_number_waiting ( - Thread_queue_Control *the_thread_queue -) -{ - return ( the_thread_queue->count ); -} - -/*PAGE - * - * _Thread_queue_Enter_critical_section - * - * DESCRIPTION: - * - * This routine is invoked to indicate that the specified thread queue is - * entering a critical section. - */ - -STATIC INLINE void _Thread_queue_Enter_critical_section ( - Thread_queue_Control *the_thread_queue -) -{ - the_thread_queue->sync_state = THREAD_QUEUE_NOTHING_HAPPENED; -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/userext.inl b/cpukit/score/inline/rtems/score/userext.inl deleted file mode 100644 index a9a858b2e2..0000000000 --- a/cpukit/score/inline/rtems/score/userext.inl +++ /dev/null @@ -1,121 +0,0 @@ -/* userext.inl - * - * This file contains the macro implementation of the inlined routines - * from the User Extension Handler - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __USER_EXTENSIONS_inl -#define __USER_EXTENSIONS_inl - -/*PAGE - * - * _User_extensions_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -STATIC INLINE void _User_extensions_Handler_initialization ( - User_extensions_Table *initial_extensions -) -{ - _Chain_Initialize_empty( &_User_extensions_List ); - - if ( initial_extensions ) { - _User_extensions_Initial.Callouts = *initial_extensions; - _Chain_Append( &_User_extensions_List, &_User_extensions_Initial.Node ); - } -} - -/*PAGE - * - * _User_extensions_Add_set - * - * DESCRIPTION: - * - * This routine is used to add a user extension set to the active list. - */ - -STATIC INLINE void _User_extensions_Add_set ( - User_extensions_Control *the_extension, - User_extensions_Table *extension_table -) -{ - the_extension->Callouts = *extension_table; - - _Chain_Append( &_User_extensions_List, &the_extension->Node ); -} - -/*PAGE - * - * _User_extensions_Add_API_set - * DESCRIPTION: - * - * This routine is used to add an API extension set to the active list. - */ - -STATIC INLINE void _User_extensions_Add_API_set ( - User_extensions_Control *the_extension -) -{ - _Chain_Prepend( &_User_extensions_List, &the_extension->Node ); -} - -/*PAGE - * - * _User_extensions_Remove_set - * - * DESCRIPTION: - * - * This routine is used to remove a user extension set from the active list. - */ - -STATIC INLINE void _User_extensions_Remove_set ( - User_extensions_Control *the_extension -) -{ - _Chain_Extract( &the_extension->Node ); -} - -/*PAGE - * - * _User_extensions_Thread_switch - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension which - * is invoked when a context switch occurs. - */ - -STATIC INLINE void _User_extensions_Thread_switch ( - Thread_Control *executing, - Thread_Control *heir -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_switch != NULL ) - (*the_extension->Callouts.thread_switch)( executing, heir ); - } -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/watchdog.inl b/cpukit/score/inline/rtems/score/watchdog.inl deleted file mode 100644 index 75fb662dfc..0000000000 --- a/cpukit/score/inline/rtems/score/watchdog.inl +++ /dev/null @@ -1,324 +0,0 @@ -/* watchdog.inl - * - * This file contains the static inline implementation of all inlined - * routines in the Watchdog Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __WATCHDOG_inl -#define __WATCHDOG_inl - -/*PAGE - * - * _Watchdog_Initialize - * - * DESCRIPTION: - * - * This routine initializes the specified watchdog. The watchdog is - * made inactive, the watchdog id and handler routine are set to the - * specified values. - */ - -STATIC INLINE void _Watchdog_Initialize( - Watchdog_Control *the_watchdog, - Watchdog_Service_routine_entry routine, - Objects_Id id, - void *user_data -) -{ - the_watchdog->state = WATCHDOG_INACTIVE; - the_watchdog->routine = routine; - the_watchdog->id = id; - the_watchdog->user_data = user_data; -} - -/*PAGE - * - * _Watchdog_Is_active - * - * DESCRIPTION: - * - * This routine returns TRUE if the watchdog timer is in the ACTIVE - * state, and FALSE otherwise. - */ - -STATIC INLINE boolean _Watchdog_Is_active( - Watchdog_Control *the_watchdog -) -{ - - return ( the_watchdog->state == WATCHDOG_ACTIVE ); - -} - -/*PAGE - * - * _Watchdog_Activate - * - * DESCRIPTION: - * - * This routine activates THE_WATCHDOG timer which is already - * on a watchdog chain. - */ - -STATIC INLINE void _Watchdog_Activate( - Watchdog_Control *the_watchdog -) -{ - - the_watchdog->state = WATCHDOG_ACTIVE; - -} - -/*PAGE - * - * _Watchdog_Deactivate - * - * DESCRIPTION: - * - * This routine deactivates THE_WATCHDOG timer which will remain - * on a watchdog chain. - */ - -STATIC INLINE void _Watchdog_Deactivate( - Watchdog_Control *the_watchdog -) -{ - - the_watchdog->state = WATCHDOG_REMOVE_IT; - -} - -/*PAGE - * - * _Watchdog_Tickle_ticks - * - * DESCRIPTION: - * - * This routine is invoked at each clock tick to update the ticks - * watchdog chain. - */ - -STATIC INLINE void _Watchdog_Tickle_ticks( void ) -{ - - _Watchdog_Tickle( &_Watchdog_Ticks_chain ); - -} - -/*PAGE - * - * _Watchdog_Tickle_seconds - * - * DESCRIPTION: - * - * This routine is invoked at each clock tick to update the seconds - * watchdog chain. - */ - -STATIC INLINE void _Watchdog_Tickle_seconds( void ) -{ - - _Watchdog_Tickle( &_Watchdog_Seconds_chain ); - -} - -/*PAGE - * - * _Watchdog_Insert_ticks - * - * DESCRIPTION: - * - * This routine inserts THE_WATCHDOG into the ticks watchdog chain - * for a time of UNITS ticks. The INSERT_MODE indicates whether - * THE_WATCHDOG is to be activated automatically or later, explicitly - * by the caller. - */ - -STATIC INLINE void _Watchdog_Insert_ticks( - Watchdog_Control *the_watchdog, - Watchdog_Interval units -) -{ - - the_watchdog->initial = units; - - _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog ); - -} - -/*PAGE - * - * _Watchdog_Insert_seconds - * - * DESCRIPTION: - * - * This routine inserts THE_WATCHDOG into the seconds watchdog chain - * for a time of UNITS seconds. The INSERT_MODE indicates whether - * THE_WATCHDOG is to be activated automatically or later, explicitly - * by the caller. - */ - -STATIC INLINE void _Watchdog_Insert_seconds( - Watchdog_Control *the_watchdog, - Watchdog_Interval units -) -{ - - the_watchdog->initial = units; - - _Watchdog_Insert( &_Watchdog_Seconds_chain, the_watchdog ); - -} - -/*PAGE - * - * _Watchdog_Adjust_seconds - * - * DESCRIPTION: - * - * This routine adjusts the seconds watchdog chain in the forward - * or backward DIRECTION for UNITS seconds. This is invoked when the - * current time of day is changed. - */ - -STATIC INLINE void _Watchdog_Adjust_seconds( - Watchdog_Adjust_directions direction, - Watchdog_Interval units -) -{ - - _Watchdog_Adjust( &_Watchdog_Seconds_chain, direction, units ); - -} - -/*PAGE - * - * _Watchdog_Adjust_ticks - * - * DESCRIPTION: - * - * This routine adjusts the ticks watchdog chain in the forward - * or backward DIRECTION for UNITS ticks. - */ - -STATIC INLINE void _Watchdog_Adjust_ticks( - Watchdog_Adjust_directions direction, - Watchdog_Interval units -) -{ - - _Watchdog_Adjust( &_Watchdog_Ticks_chain, direction, units ); - -} - -/*PAGE - * - * _Watchdog_Reset - * - * DESCRIPTION: - * - * This routine resets THE_WATCHDOG timer to its state at INSERT - * time. This routine is valid only on interval watchdog timers - * and is used to make an interval watchdog timer fire "every" so - * many ticks. - */ - -STATIC INLINE void _Watchdog_Reset( - Watchdog_Control *the_watchdog -) -{ - - (void) _Watchdog_Remove( the_watchdog ); - - _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog ); - -} - -/*PAGE - * - * _Watchdog_Next - * - * DESCRIPTION: - * - * This routine returns a pointer to the watchdog timer following - * THE_WATCHDOG on the watchdog chain. - */ - -STATIC INLINE Watchdog_Control *_Watchdog_Next( - Watchdog_Control *the_watchdog -) -{ - - return ( (Watchdog_Control *) the_watchdog->Node.next ); - -} - -/*PAGE - * - * _Watchdog_Previous - * - * DESCRIPTION: - * - * This routine returns a pointer to the watchdog timer preceding - * THE_WATCHDOG on the watchdog chain. - */ - -STATIC INLINE Watchdog_Control *_Watchdog_Previous( - Watchdog_Control *the_watchdog -) -{ - - return ( (Watchdog_Control *) the_watchdog->Node.previous ); - -} - -/*PAGE - * - * _Watchdog_First - * - * DESCRIPTION: - * - * This routine returns a pointer to the first watchdog timer - * on the watchdog chain HEADER. - */ - -STATIC INLINE Watchdog_Control *_Watchdog_First( - Chain_Control *header -) -{ - - return ( (Watchdog_Control *) header->first ); - -} - -/*PAGE - * - * _Watchdog_Last - * - * DESCRIPTION: - * - * This routine returns a pointer to the last watchdog timer - * on the watchdog chain HEADER. - */ - -STATIC INLINE Watchdog_Control *_Watchdog_Last( - Chain_Control *header -) -{ - - return ( (Watchdog_Control *) header->last ); - -} - -#endif -/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/wkspace.inl b/cpukit/score/inline/rtems/score/wkspace.inl deleted file mode 100644 index a2dabfe962..0000000000 --- a/cpukit/score/inline/rtems/score/wkspace.inl +++ /dev/null @@ -1,104 +0,0 @@ -/* wkspace.inl - * - * This include file contains the bodies of the routines which contains - * information related to the RAM Workspace. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __WORKSPACE_inl -#define __WORKSPACE_inl - -/*PAGE - * - * _Workspace_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -STATIC INLINE void _Workspace_Handler_initialization( - void *starting_address, - unsigned32 size -) -{ - unsigned32 *zero_out_array; - unsigned32 index; - unsigned32 memory_available; - - if ( !starting_address || !_Addresses_Is_aligned( starting_address ) ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS - ); - - if ( _CPU_Table.do_zero_of_workspace ) { - for( zero_out_array = (unsigned32 *) starting_address, index = 0 ; - index < size / 4 ; - index++ ) - zero_out_array[ index ] = 0; - } - - memory_available = _Heap_Initialize( - &_Workspace_Area, - starting_address, - size, - CPU_HEAP_ALIGNMENT - ); - - if ( memory_available == 0 ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_TOO_LITTLE_WORKSPACE - ); -} - -/*PAGE - * - * _Workspace_Allocate - * - * DESCRIPTION: - * - * This routine returns the address of a block of memory of size - * bytes. If a block of the appropriate size cannot be allocated - * from the workspace, then NULL is returned. - */ - -STATIC INLINE void *_Workspace_Allocate( - unsigned32 size -) -{ - return _Heap_Allocate( &_Workspace_Area, size ); -} - -/*PAGE - * - * _Workspace_Free - * - * DESCRIPTION: - * - * This function frees the specified block of memory. If the block - * belongs to the Workspace and can be successfully freed, then - * TRUE is returned. Otherwise FALSE is returned. - */ - -STATIC INLINE boolean _Workspace_Free( - void *block -) -{ - return _Heap_Free( &_Workspace_Area, block ); -} - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/README b/cpukit/score/macros/README deleted file mode 100644 index b2f0c4d481..0000000000 --- a/cpukit/score/macros/README +++ /dev/null @@ -1,18 +0,0 @@ -# -# $Id$ -# - -The files in this directory are not considered the "primary" source -of inlined routines for RTEMS. The "inline" directory contains -the implementations of the inlined basis which are regularly -tested. In general, an effort is made to keep the contents of -this directory up to date but testing is only performed irregularly -and even then it is usually with a single target processor and BSP. - -The primary purpose of the code in this directory is to insure -that RTEMS can be compiled using a C compiler which does not support -static inline routines. - -These were last successfully tested on 2/1/95 on a prerelease version -of 3.2.0. The testing was done only on the Force CPU386 i386 target board. -No testing was done on version of the code in the final release. diff --git a/cpukit/score/macros/rtems/score/README b/cpukit/score/macros/rtems/score/README deleted file mode 100644 index b2f0c4d481..0000000000 --- a/cpukit/score/macros/rtems/score/README +++ /dev/null @@ -1,18 +0,0 @@ -# -# $Id$ -# - -The files in this directory are not considered the "primary" source -of inlined routines for RTEMS. The "inline" directory contains -the implementations of the inlined basis which are regularly -tested. In general, an effort is made to keep the contents of -this directory up to date but testing is only performed irregularly -and even then it is usually with a single target processor and BSP. - -The primary purpose of the code in this directory is to insure -that RTEMS can be compiled using a C compiler which does not support -static inline routines. - -These were last successfully tested on 2/1/95 on a prerelease version -of 3.2.0. The testing was done only on the Force CPU386 i386 target board. -No testing was done on version of the code in the final release. diff --git a/cpukit/score/macros/rtems/score/address.inl b/cpukit/score/macros/rtems/score/address.inl deleted file mode 100644 index c0d45c3c6b..0000000000 --- a/cpukit/score/macros/rtems/score/address.inl +++ /dev/null @@ -1,68 +0,0 @@ -/* macros/address.h - * - * This include file contains the bodies of the routines - * about addresses which are inlined. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MACROS_ADDRESSES_h -#define __MACROS_ADDRESSES_h - -/*PAGE - * - * _Addresses_Add_offset - * - */ - -#define _Addresses_Add_offset( _base, _offset ) \ - ((void *)((char *)(_base) + (_offset))) - -/*PAGE - * - * _Addresses_Subtract_offset - * - */ - -#define _Addresses_Subtract_offset( _base, _offset ) \ - ((void *)((char *)(_base) - (_offset))) - -/*PAGE - * - * _Addresses_Subtract - * - * NOTE: The cast of an address to an unsigned32 makes this code - * dependent on an addresses being thirty two bits. - */ - -#define _Addresses_Subtract( _left, _right ) \ - ((void *)(_left) - (void *)(_right)) - -/*PAGE - * - * _Addresses_Is_aligned - * - */ - -#define _Addresses_Is_aligned( _address ) \ - ( ( (unsigned32)(_address) % 4 ) == 0 ) - -/*PAGE - * - * _Addresses_Is_in_range - * - */ - -#define _Addresses_Is_in_range( _address, _base, _limit ) \ - ( (_address) >= (_base) && (_address) <= (_limit) ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/chain.inl b/cpukit/score/macros/rtems/score/chain.inl deleted file mode 100644 index 0f09499f1d..0000000000 --- a/cpukit/score/macros/rtems/score/chain.inl +++ /dev/null @@ -1,200 +0,0 @@ -/* macros/chain.h - * - * This include file contains the bodies of the routines which are - * associated with doubly linked chains and inlined. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MACROS_CHAIN_h -#define __MACROS_CHAIN_h - -/*PAGE - * - * _Chain_Are_nodes_equal - */ - -#define _Chain_Are_nodes_equal( _left, _right ) \ - ( (_left) == (_right) ) - -/*PAGE - * - * _Chain_Is_null - */ - -#define _Chain_Is_null( _the_chain ) \ - ( (_the_chain) == NULL ) - -/*PAGE - * - * _Chain_Is_null_node - */ - -#define _Chain_Is_null_node( _the_node ) \ - ( (_the_node) == NULL ) - -/*PAGE - * - * _Chain_Head - */ - -#define _Chain_Head( _the_chain ) \ - ((Chain_Node *) (_the_chain)) - -/*PAGE - * - * _Chain_Tail - */ - -#define _Chain_Tail( _the_chain ) \ - ((Chain_Node *) &(_the_chain)->permanent_null) - -/*PAGE - * - * _Chain_Is_empty - */ - -#define _Chain_Is_empty( _the_chain ) \ - ( (_the_chain)->first == _Chain_Tail( (_the_chain) ) ) - -/*PAGE - * - * _Chain_Is_first - */ - -#define _Chain_Is_first( _the_node ) \ - ( (the_node)->previous == NULL ) - -/*PAGE - * - * _Chain_Is_last - */ - -#define _Chain_Is_last( _the_node ) \ - ( (_the_node)->next == NULL ) - -/*PAGE - * - * _Chain_Has_only_one_node - */ - -#define _Chain_Has_only_one_node( _the_chain ) \ - ( (_the_chain)->first == (_the_chain)->last ) - -/*PAGE - * - * _Chain_Is_head - */ - -#define _Chain_Is_head( _the_chain, _the_node ) \ - ( (_the_node) == _Chain_Head( (_the_chain) ) ) - -/*PAGE - * - * _Chain_Is_tail - */ - -#define _Chain_Is_tail( _the_chain, _the_node ) \ - ( (_the_node) == _Chain_Tail( (_the_chain) ) ) - -/*PAGE - * - * Chain_Initialize_empty - */ - -#define _Chain_Initialize_empty( _the_chain ) \ -{ \ - (_the_chain)->first = _Chain_Tail( (_the_chain) ); \ - (_the_chain)->permanent_null = NULL; \ - (_the_chain)->last = _Chain_Head( (_the_chain) ); \ -} - -/*PAGE - * - * _Chain_Extract_unprotected - */ - -#define _Chain_Extract_unprotected( _the_node ) \ -{ \ - Chain_Node *_next; \ - Chain_Node *_previous; \ - \ - _next = (_the_node)->next; \ - _previous = (_the_node)->previous; \ - _next->previous = _previous; \ - _previous->next = _next; \ -} - -/*PAGE - * - * _Chain_Get_unprotected - */ - -/*PAGE - * - * Chain_Get_unprotected - */ - -#define _Chain_Get_unprotected( _the_chain ) \ - (( !_Chain_Is_empty( (_the_chain) ) ) \ - ? _Chain_Get_first_unprotected( (_the_chain) ) \ - : NULL) - -/*PAGE - * - * _Chain_Insert_unprotected - */ - -#define _Chain_Insert_unprotected( _after_node, _the_node ) \ -{ \ - Chain_Node *_before_node; \ - \ - (_the_node)->previous = (_after_node); \ - _before_node = (_after_node)->next; \ - (_after_node)->next = (_the_node); \ - (_the_node)->next = _before_node; \ - _before_node->previous = (_the_node); \ -} - -/*PAGE - * - * _Chain_Append_unprotected - */ - -#define _Chain_Append_unprotected( _the_chain, _the_node ) \ -{ \ - Chain_Node *_old_last_node; \ - \ - (_the_node)->next = _Chain_Tail( (_the_chain) ); \ - _old_last_node = (_the_chain)->last; \ - (_the_chain)->last = (_the_node); \ - _old_last_node->next = (_the_node); \ - (_the_node)->previous = _old_last_node; \ -} - -/*PAGE - * - * _Chain_Prepend_unprotected - */ - -#define _Chain_Prepend_unprotected( _the_chain, _the_node ) \ - _Chain_Insert_unprotected( _Chain_Head( (_the_chain) ), (_the_node) ) - -/*PAGE - * - * _Chain_Prepend - */ - -#define _Chain_Prepend( _the_chain, _the_node ) \ - _Chain_Insert( _Chain_Head( (_the_chain) ), (_the_node) ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/coremsg.inl b/cpukit/score/macros/rtems/score/coremsg.inl deleted file mode 100644 index 90bef885ed..0000000000 --- a/cpukit/score/macros/rtems/score/coremsg.inl +++ /dev/null @@ -1,143 +0,0 @@ -/* coremsg.inl - * - * This include file contains the macro implementation of all - * inlined routines in the Core Message Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __CORE_MESSAGE_QUEUE_inl -#define __CORE_MESSAGE_QUEUE_inl - -/*PAGE - * - * _CORE_message_queue_Send - * - */ - -#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \ -_id, _api_message_queue_mp_support ) \ - _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ - (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_SEND_REQUEST ) - -/*PAGE - * - * _CORE_message_queue_Urgent - * - */ - -#define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \ -_id, _api_message_queue_mp_support ) \ - _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ - (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_URGENT_REQUEST ) - -/*PAGE - * - * _CORE_message_queue_Copy_buffer - */ - -#define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \ - memcpy( _destination, _source, _size) - -/*PAGE - * - * _CORE_message_queue_Allocate_message_buffer - * - */ - -#define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \ - (CORE_message_queue_Buffer_control *) \ - _Chain_Get( &(_the_message_queue)->Inactive_messages ) - -/*PAGE - * - * _CORE_message_queue_Free_message_buffer - * - */ - -#define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \ - _Chain_Append( \ - &(_the_message_queue)->Inactive_messages, \ - &(_the_message)->Node \ - ) - -/*PAGE - * - * _CORE_message_queue_Is_priority - * - */ - -#define _CORE_message_queue_Is_priority( _the_attribute ) \ - ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY) - -/*PAGE - * - * _CORE_message_queue_Get_pending_message - * - */ - -#define _CORE_message_queue_Get_pending_message( _the_message_queue ) \ - (CORE_message_queue_Buffer_control *) \ - _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages ) - -/*PAGE - * - * _CORE_message_queue_Append - * - */ - -#define _CORE_message_queue_Append( _the_message_queue, _the_message ) \ - _Chain_Append( &(_the_message_queue)->Pending_messages, \ - &(_the_message)->Node ) - -/*PAGE - * - * _CORE_message_queue_Prepend - * - */ - -#define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \ - _Chain_Prepend( &(_the_message_queue)->Pending_messages, \ - &(_the_message)->Node ) - -/*PAGE - * - * _CORE_message_queue_Is_null - * - */ - -#define _CORE_message_queue_Is_null( _the_message_queue ) \ - ( (_the_message_queue) == NULL ) - -/*PAGE - * - * _CORE_message_queue_Is_notify_enabled - * - */ - -#define _CORE_message_queue_Is_notify_enabled( _the_message_queue ) \ - ( (_the_message_queue)->notify_handler != NULL ) - -/*PAGE - * - * _CORE_message_queue_Set_notify - * - */ - -#define _CORE_message_queue_Set_notify( \ - _the_message_queue, _the_handler, _the_argument ) \ - do { \ - (_the_message_queue)->notify_handler = (_the_handler); \ - (_the_message_queue)->notify_argument = (_the_argument); \ - } while ( 0 ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/coremutex.inl b/cpukit/score/macros/rtems/score/coremutex.inl deleted file mode 100644 index e8dbc9322c..0000000000 --- a/cpukit/score/macros/rtems/score/coremutex.inl +++ /dev/null @@ -1,77 +0,0 @@ -/* macros/coremutex.h - * - * This include file contains all of the inlined routines associated - * with core mutexes. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MACROS_CORE_MUTEX_h -#define __MACROS_CORE_MUTEX_h - - -/*PAGE - * - * _CORE_mutex_Is_locked - * - */ - -#define _CORE_mutex_Is_locked( _the_mutex ) \ - ( (_the_mutex)->lock == CORE_MUTEX_LOCKED ) - -/*PAGE - * - * _CORE_mutex_Is_fifo - * - */ - -#define _CORE_mutex_Is_fifo( _the_attribute ) \ - ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_FIFO ) - -/*PAGE - * - * _CORE_mutex_Is_priority - * - */ - -#define _CORE_mutex_Is_priority( _the_attribute ) \ - ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY ) - -/*PAGE - * - * _CORE_mutex_Is_inherit_priority - * - */ - -#define _CORE_mutex_Is_inherit_priority( _the_attribute ) \ - ( (_the_attribute)->discipline == \ - CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT ) - -/*PAGE - * - * _CORE_mutex_Is_priority_ceiling - * - */ - -#define _CORE_mutex_Is_priority_ceiling( _the_attribute )\ - ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) - -/*PAGE - * - * _CORE_mutex_Is_nesting_allowed - * - */ - -#define _CORE_mutex_Is_nesting_allowed( _the_attribute ) \ - ( (_the_attribute)->allow_nesting == TRUE ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/coresem.inl b/cpukit/score/macros/rtems/score/coresem.inl deleted file mode 100644 index 499b4a1433..0000000000 --- a/cpukit/score/macros/rtems/score/coresem.inl +++ /dev/null @@ -1,40 +0,0 @@ -/* macros/coresem.h - * - * This include file contains all of the inlined routines associated - * with core semaphores. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MACROS_CORE_SEMAPHORE_h -#define __MACROS_CORE_SEMAPHORE_h - -/*PAGE - * - * _CORE_semaphore_Is_priority - * - */ - -#define _CORE_semaphore_Is_priority( _the_attribute ) \ - ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ) - -/*PAGE - * - * _Core_semaphore_Get_count - * - */ - -#define _Core_semaphore_Get_count( _the_semaphore ) \ - ( (_the_semaphore)->count ) - - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/heap.inl b/cpukit/score/macros/rtems/score/heap.inl deleted file mode 100644 index 94f4ff9194..0000000000 --- a/cpukit/score/macros/rtems/score/heap.inl +++ /dev/null @@ -1,150 +0,0 @@ -/* heap.inl - * - * This file contains the macro implementation of the inlined - * routines from the heap handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __HEAP_inl -#define __HEAP_inl - -#include <rtems/score/address.h> - -/*PAGE - * - * _Heap_Head - */ - -#define _Heap_Head( _the_heap ) \ - ((Heap_Block *)&(_the_heap)->start) - -/*PAGE - * - * _Heap_Tail - */ - -#define _Heap_Tail( _the_heap ) \ - ((Heap_Block *)&(_the_heap)->final) - -/*PAGE - * - * _Heap_Previous_block - */ - -#define _Heap_Previous_block( _the_block ) \ - ( (Heap_Block *) _Addresses_Subtract_offset( \ - (void *)(_the_block), \ - (_the_block)->back_flag & ~ HEAP_BLOCK_USED \ - ) \ - ) - -/*PAGE - * - * _Heap_Next_block - */ - -#define _Heap_Next_block( _the_block ) \ - ( (Heap_Block *) _Addresses_Add_offset( \ - (void *)(_the_block), \ - (_the_block)->front_flag & ~ HEAP_BLOCK_USED \ - ) \ - ) - -/*PAGE - * - * _Heap_Block_at - */ - -#define _Heap_Block_at( _base, _offset ) \ - ( (Heap_Block *) \ - _Addresses_Add_offset( (void *)(_base), (_offset) ) ) - -/*PAGE - * - * _Heap_User_block_at - * - */ - -#define _Heap_User_block_at( _base ) \ - _Heap_Block_at( \ - (_base), \ - -*(((unsigned32 *) (_base)) - 1) + -HEAP_BLOCK_USED_OVERHEAD \ - ) - -/*PAGE - * - * _Heap_Is_previous_block_free - */ - -#define _Heap_Is_previous_block_free( _the_block ) \ - ( !((_the_block)->back_flag & HEAP_BLOCK_USED) ) - -/*PAGE - * - * _Heap_Is_block_free - */ - -#define _Heap_Is_block_free( _the_block ) \ - ( !((_the_block)->front_flag & HEAP_BLOCK_USED) ) - -/*PAGE - * - * _Heap_Is_block_used - */ - -#define _Heap_Is_block_used( _the_block ) \ - ((_the_block)->front_flag & HEAP_BLOCK_USED) - -/*PAGE - * - * _Heap_Block_size - */ - -#define _Heap_Block_size( _the_block ) \ - ((_the_block)->front_flag & ~HEAP_BLOCK_USED) - -/*PAGE - * - * _Heap_Start_of_user_area - */ - -#define _Heap_Start_of_user_area( _the_block ) \ - ((void *) &(_the_block)->next) - -/*PAGE - * - * _Heap_Is_block_in - */ - -#define _Heap_Is_block_in( _the_heap, _the_block ) \ - ( ((_the_block) >= (_the_heap)->start) && \ - ((_the_block) <= (_the_heap)->final) ) - -/*PAGE - * - * _Heap_Is_page_size_valid - */ - -#define _Heap_Is_page_size_valid( _page_size ) \ - ( ((_page_size) != 0) && \ - (((_page_size) % CPU_HEAP_ALIGNMENT) == 0) ) - -/*PAGE - * - * _Heap_Build_flag - */ - -#define _Heap_Build_flag( _size, _in_use_flag ) \ - ( (_size) | (_in_use_flag)) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/isr.inl b/cpukit/score/macros/rtems/score/isr.inl deleted file mode 100644 index 95f0319396..0000000000 --- a/cpukit/score/macros/rtems/score/isr.inl +++ /dev/null @@ -1,48 +0,0 @@ -/* isr.inl - * - * This include file contains the macro implementation of all - * inlined routines in the Interrupt Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __ISR_inl -#define __ISR_inl - -/*PAGE - * - * _ISR_Is_in_progress - * - */ - -#define _ISR_Is_in_progress() \ - (_ISR_Nest_level != 0) - -/*PAGE - * - * _ISR_Is_vector_number_valid - * - */ - -#define _ISR_Is_vector_number_valid( _vector ) \ - ( (_vector) <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER ) - -/*PAGE - * - * _ISR_Is_valid_user_handler - * - */ - -#define _ISR_Is_valid_user_handler( _handler ) \ - ((_handler) != NULL) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/mppkt.inl b/cpukit/score/macros/rtems/score/mppkt.inl deleted file mode 100644 index ff1d51034b..0000000000 --- a/cpukit/score/macros/rtems/score/mppkt.inl +++ /dev/null @@ -1,41 +0,0 @@ -/* macros/mppkt.h - * - * This package is the implementation of the Packet Handler - * routines which are inlined. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MACROS_MP_PACKET_h -#define __MACROS_MP_PACKET_h - -/*PAGE - * - * _Mp_packet_Is_valid_packet_class - * - * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary - * because this enum starts at lower bound of zero. - */ - -#define _Mp_packet_Is_valid_packet_class( _the_packet_class ) \ - ( (_the_packet_class) <= MP_PACKET_CLASSES_LAST ) - -/*PAGE - * - * _Mp_packet_Is_null - * - */ - -#define _Mp_packet_Is_null ( _the_packet ) \ - ( (_the_packet) == NULL ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/object.inl b/cpukit/score/macros/rtems/score/object.inl deleted file mode 100644 index 8a5a0a3411..0000000000 --- a/cpukit/score/macros/rtems/score/object.inl +++ /dev/null @@ -1,148 +0,0 @@ -/* object.inl - * - * This include file contains the macro implementation of all - * of the inlined routines in the Object Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __OBJECTS_inl -#define __OBJECTS_inl - -/*PAGE - * - * _Objects_Build_id - * - */ - -#define _Objects_Build_id( _the_class, _node, _index ) \ - ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \ - ((_node) << OBJECTS_NODE_START_BIT) | \ - ((_index) << OBJECTS_INDEX_START_BIT) ) - -/*PAGE - * - * _Objects_Get_class - */ - -#define _Objects_Get_class( _id ) \ - (Objects_Classes) \ - (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS) - -/*PAGE - * - * _Objects_Get_node - * - */ - -#define _Objects_Get_node( _id ) \ - (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS) - -/*PAGE - * - * _Objects_Get_index - * - */ - -#define _Objects_Get_index( _id ) \ - (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS) - -/*PAGE - * - * _Objects_Is_class_valid - * - */ - -#define _Objects_Is_class_valid( _the_class ) \ - ( (_the_class) <= OBJECTS_CLASSES_LAST ) - -/*PAGE - * - * _Objects_Is_local_node - * - */ - -#define _Objects_Is_local_node( _node ) \ - ( (_node) == _Objects_Local_node ) - -/*PAGE - * - * _Objects_Is_local_id - * - */ - -#define _Objects_Is_local_id( _id ) \ - _Objects_Is_local_node( _Objects_Get_node(_id) ) - -/*PAGE - * - * _Objects_Are_ids_equal - * - */ - -#define _Objects_Are_ids_equal( _left, _right ) \ - ( (_left) == (_right) ) - -/*PAGE - * - * _Objects_Allocate - * - */ - -#define _Objects_Allocate( _information ) \ - (Objects_Control *) _Chain_Get( &(_information)->Inactive ) - -/*PAGE - * - * _Objects_Free - * - */ - -#define _Objects_Free( _information, _the_object ) \ - _Chain_Append( &(_information)->Inactive, &(_the_object)->Node ) - -/*PAGE - * - * _Objects_Open - * - */ - -#define _Objects_Open( _information, _the_object, _name ) \ - { \ - unsigned32 _index; \ - \ - _index = _Objects_Get_index( (_the_object)->id ); \ - (_information)->local_table[ _index ] = (_the_object); \ - \ - if ( (_information)->is_string ) \ - _Objects_Copy_name_string( (_name), (_the_object)->name ); \ - else \ - _Objects_Copy_name_raw( \ - (_name), (_the_object)->name, (_information)->name_length ); \ - } - -/*PAGE - * - * _Objects_Close - * - */ - -#define _Objects_Close( _information, _the_object ) \ - { \ - unsigned32 _index; \ - \ - _index = _Objects_Get_index( (_the_object)->id ); \ - (_information)->local_table[ _index ] = NULL; \ - _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \ - } - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/objectmp.inl b/cpukit/score/macros/rtems/score/objectmp.inl deleted file mode 100644 index 2f1c5ac7fa..0000000000 --- a/cpukit/score/macros/rtems/score/objectmp.inl +++ /dev/null @@ -1,50 +0,0 @@ -/* macros/objectmp.inl - * - * This include file contains the bodies of all inlined routines - * which deal with global objects. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MACROS_MP_OBJECTS_inl -#define __MACROS_MP_OBJECTS_inl - -/*PAGE - * - * _Objects_MP_Allocate_global_object - * - */ - -#define _Objects_MP_Allocate_global_object() \ - (Objects_MP_Control *) \ - _Chain_Get( &_Objects_MP_Inactive_global_objects ) - -/*PAGE - * _Objects_MP_Free_global_object - * - */ - -#define _Objects_MP_Free_global_object( _the_object ) \ - _Chain_Append( \ - &_Objects_MP_Inactive_global_objects, \ - &(_the_object)->Object.Node \ - ) - -/*PAGE - * _Objects_MP_Is_null_global_object - * - */ - -#define _Objects_MP_Is_null_global_object( _the_object ) \ - ( (_the_object) == NULL ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/priority.inl b/cpukit/score/macros/rtems/score/priority.inl deleted file mode 100644 index 4c5d32b3b3..0000000000 --- a/cpukit/score/macros/rtems/score/priority.inl +++ /dev/null @@ -1,170 +0,0 @@ -/* priority.inl - * - * This file contains the macro implementation of all inlined routines - * in the Priority Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __PRIORITY_inl -#define __PRIORITY_inl - -#include <rtems/score/bitfield.h> - -/*PAGE - * - * _Priority_Handler_initialization - * - */ - -#define _Priority_Handler_initialization() \ - { \ - unsigned32 index; \ - \ - _Priority_Major_bit_map = 0; \ - for ( index=0 ; index <16 ; index++ ) \ - _Priority_Bit_map[ index ] = 0; \ - } - -/*PAGE - * - * _Priority_Is_valid - * - */ - - /* - * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned, - * then checking for less than 0 is unnecessary. - */ - -#define _Priority_Is_valid( _the_priority ) \ - ( (_the_priority) <= PRIORITY_MAXIMUM ) - -/*PAGE - * - * _Priority_Major - * - */ - -#define _Priority_Major( _the_priority ) ( (_the_priority) / 16 ) - -/*PAGE - * - * _Priority_Minor - * - */ - -#define _Priority_Minor( _the_priority ) ( (_the_priority) % 16 ) - -#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE ) - -/*PAGE - * - * _Priority_Mask - * - */ - -#define _Priority_Mask( _bit_number ) \ - (0x8000 >> _bit_number) - -/*PAGE - * - * _Priority_Bits_index - * - */ - -#define _Priority_Bits_index( _bit_number ) \ - (_bit_number) - -#endif - -/*PAGE - * - * _Priority_Add_to_bit_map - * - */ - -#define _Priority_Add_to_bit_map( _the_priority_map ) \ - { \ - *(_the_priority_map)->minor |= (_the_priority_map)->ready_minor; \ - _Priority_Major_bit_map |= (_the_priority_map)->ready_major; \ - } - -/*PAGE - * - * _Priority_Remove_from_bit_map - * - */ - -#define _Priority_Remove_from_bit_map( _the_priority_map ) \ - { \ - *(_the_priority_map)->minor &= (_the_priority_map)->block_minor; \ - if ( *(_the_priority_map)->minor == 0 ) \ - _Priority_Major_bit_map &= (_the_priority_map)->block_major; \ - } - -/*PAGE - * - * _Priority_Get_highest - * - */ - -#define _Priority_Get_highest( _high_priority ) \ - { \ - Priority_Bit_map_control minor; \ - Priority_Bit_map_control major; \ - \ - _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); \ - _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); \ - \ - (_high_priority) = (_Priority_Bits_index( major ) * 16) + \ - _Priority_Bits_index( minor ); \ - } - -/*PAGE - * - * _Priority_Initialize_information - * - */ - -#define _Priority_Initialize_information( \ - _the_priority_map, _new_priority ) \ - { \ - Priority_Bit_map_control _major; \ - Priority_Bit_map_control _minor; \ - Priority_Bit_map_control _mask; \ - \ - _major = _Priority_Major( (_new_priority) ); \ - _minor = _Priority_Minor( (_new_priority) ); \ - \ - (_the_priority_map)->minor = \ - &_Priority_Bit_map[ _Priority_Bits_index(_major) ]; \ - \ - _mask = _Priority_Mask( _major ); \ - (_the_priority_map)->ready_major = _mask; \ - (_the_priority_map)->block_major = ~_mask; \ - \ - _mask = _Priority_Mask( _minor ); \ - (_the_priority_map)->ready_minor = _mask; \ - (_the_priority_map)->block_minor = ~_mask; \ - } - -/*PAGE - * - * _Priority_Is_group_empty - * - */ - -#define _Priority_Is_group_empty ( _the_priority ) \ - ( (_the_priority) == 0 ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/stack.inl b/cpukit/score/macros/rtems/score/stack.inl deleted file mode 100644 index d20eebd0b9..0000000000 --- a/cpukit/score/macros/rtems/score/stack.inl +++ /dev/null @@ -1,50 +0,0 @@ -/* stack.inl - * - * This file contains the macro implementation of the inlined - * routines from the Stack Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __STACK_inl -#define __STACK_inl - -/*PAGE - * - * _Stack_Initialize - * - */ - -#define _Stack_Initialize( _the_stack, _starting_address, _size ) \ - { \ - (_the_stack)->area = (_starting_address); \ - (_the_stack)->size = (_size); \ - } - -/*PAGE - * - * _Stack_Is_enough - * - */ - -#define _Stack_Is_enough( _size ) \ - ( (_size) >= STACK_MINIMUM_SIZE ) - -/*PAGE - * - * _Stack_Adjust_size - */ - -#define _Stack_Adjust_size( _size ) \ - ((_size) + CPU_STACK_ALIGNMENT) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/states.inl b/cpukit/score/macros/rtems/score/states.inl deleted file mode 100644 index 4fa138d107..0000000000 --- a/cpukit/score/macros/rtems/score/states.inl +++ /dev/null @@ -1,210 +0,0 @@ -/* states.inl - * - * This file contains the macro implementation of the inlined - * routines associated with thread state information. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __STATES_inl -#define __STATES_inl - -/*PAGE - * - * _States_Set - * - */ - -#define _States_Set( _states_to_set, _current_state ) \ - ((_current_state) | (_states_to_set)) - -/*PAGE - * - * _States_Clear - * - */ - -#define _States_Clear( _states_to_clear, _current_state ) \ - ((_current_state) & ~(_states_to_clear)) - -/*PAGE - * - * _States_Is_ready - * - */ - -#define _States_Is_ready( _the_states ) \ - ( (_the_states) == STATES_READY ) - -/*PAGE - * - * _States_Is_only_dormant - * - */ - -#define _States_Is_only_dormant( _the_states ) \ - ( (_the_states) == STATES_DORMANT ) - -/*PAGE - * - * _States_Is_dormant - * - */ - -#define _States_Is_dormant( _the_states ) \ - ( (_the_states) & STATES_DORMANT ) - -/*PAGE - * - * _States_Is_suspended - * - */ - -#define _States_Is_suspended( _the_states ) \ - ( (_the_states) & STATES_SUSPENDED ) - -/*PAGE - * - * _States_Is_Transient - * - */ - -#define _States_Is_transient( _the_states ) \ - ( (_the_states) & STATES_TRANSIENT ) - -/*PAGE - * - * _States_Is_delaying - * - */ - -#define _States_Is_delaying( _the_states ) \ - ( (_the_states) & STATES_DELAYING ) - -/*PAGE - * - * _States_Is_waiting_for_buffer - * - */ - -#define _States_Is_waiting_for_buffer( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_BUFFER ) - -/*PAGE - * - * _States_Is_waiting_for_segment - * - */ - -#define _States_Is_waiting_for_segment( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_SEGMENT ) - -/*PAGE - * - * _States_Is_waiting_for_message - * - */ - -#define _States_Is_waiting_for_message( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_MESSAGE ) - -/*PAGE - * - * _States_Is_waiting_for_event - * - */ - -#define _States_Is_waiting_for_event( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_EVENT ) - -/*PAGE - * - * _States_Is_waiting_for_mutex - * - */ - -#define _States_Is_waiting_for_mutex( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_MUTEX ) - -/*PAGE - * - * _States_Is_waiting_for_semaphore - * - */ - -#define _States_Is_waiting_for_semaphore( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_SEMAPHORE ) - -/*PAGE - * - * _States_Is_waiting_for_time - * - */ - -#define _States_Is_waiting_for_time( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_TIME ) - -/*PAGE - * - * _States_Is_waiting_for_rpc_reply - * - */ - -#define _States_Is_waiting_for_rpc_reply( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_RPC_REPLY ) - -/*PAGE - * - * _States_Is_waiting_for_period - * - */ - -#define _States_Is_waiting_for_period( _the_states ) \ - ( (_the_states) & STATES_WAITING_FOR_PERIOD ) - -/*PAGE - * - * _States_Is_locally_blocked - * - */ - -#define _States_Is_locally_blocked( _the_states ) \ - ( (_the_states) & STATES_LOCALLY_BLOCKED ) - -/*PAGE - * - * _States_Is_waiting_on_thread_queue - * - */ - -#define _States_Is_waiting_on_thread_queue( _the_states ) \ - ( (_the_states) & STATES_WAITING_ON_THREAD_QUEUE ) - -/*PAGE - * - * _States_Is_blocked - * - */ - -#define _States_Is_blocked( _the_states ) \ - ( (_the_states) & STATES_BLOCKED ) - -/*PAGE - * - * _States_Are_set - * - */ - -#define _States_Are_set( _the_states, _mask ) \ - ( ((_the_states) & (_mask)) != STATES_READY ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/sysstate.inl b/cpukit/score/macros/rtems/score/sysstate.inl deleted file mode 100644 index d0cb932924..0000000000 --- a/cpukit/score/macros/rtems/score/sysstate.inl +++ /dev/null @@ -1,90 +0,0 @@ -/* sysstates.inl - * - * This file contains the macro implementation of routines regarding the - * system state. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __SYSTEM_STATE_inl -#define __SYSTEM_STATE_inl - -/*PAGE - * - * _System_state_Handler_initialization - */ - -#define _System_state_Handler_initialization( _is_multiprocessing ) \ - do { \ - _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; \ - _System_state_Is_multiprocessing = (_is_multiprocessing); \ - } while ( 0 ) - -/*PAGE - * - * _System_state_Set - */ - -#define _System_state_Set( _state ) \ - do { \ - _System_state_Current = (_state); \ - } while ( 0 ) - -/*PAGE - * - * _System_state_Get - */ - -#define _System_state_Get() \ - (_System_state_Current) - -/*PAGE - * - * _System_state_Is_before_initialization - */ - -#define _System_state_Is_before_initialization( _state ) \ - ((_state) == SYSTEM_STATE_BEFORE_INITIALIZATION) - -/*PAGE - * - * _System_state_Is_before_multitasking - */ - -#define _System_state_Is_before_multitasking( _state ) \ - ((_state) == SYSTEM_STATE_BEFORE_MULTITASKING) - -/*PAGE - * - * _System_state_Is_begin_multitasking - */ - -#define _System_state_Is_begin_multitasking( _state ) \ - ((_state) == SYSTEM_STATE_BEGIN_MULTITASKING) - -/*PAGE - * - * _System_state_Is_up - */ - -#define _System_state_Is_up( _state ) \ - ((_state) == SYSTEM_STATE_UP) - -/*PAGE - * - * _System_state_Is_failed - */ - -#define _System_state_Is_failed( _state ) \ - ((_state) == SYSTEM_STATE_FAILED) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/thread.inl b/cpukit/score/macros/rtems/score/thread.inl deleted file mode 100644 index 735686aa20..0000000000 --- a/cpukit/score/macros/rtems/score/thread.inl +++ /dev/null @@ -1,217 +0,0 @@ -/* thread.inl - * - * This file contains the macro implementation of the inlined - * routines from the Thread handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __THREAD_inl -#define __THREAD_inl - -/*PAGE - * - * _Thread_Stop_multitasking - * - */ - -#define _Thread_Stop_multitasking() \ - _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context ); - -/*PAGE - * - * _Thread_Is_executing - * - */ - -#define _Thread_Is_executing( _the_thread ) \ - ( (_the_thread) == _Thread_Executing ) - -/*PAGE - * - * _Thread_Is_heir - * - */ - -#define _Thread_Is_heir( _the_thread ) \ - ( (_the_thread) == _Thread_Heir ) - -/*PAGE - * - * _Thread_Is_executing_also_the_heir - * - */ - -#define _Thread_Is_executing_also_the_heir() \ - ( _Thread_Executing == _Thread_Heir ) - -/*PAGE - * - * _Thread_Resume - * - */ - -#define _Thread_Resume( _the_thread ) \ - _Thread_Clear_state( (_the_thread), STATES_SUSPENDED ) - -/*PAGE - * - * _Thread_Unblock - * - */ - -#define _Thread_Unblock( _the_thread ) \ - _Thread_Clear_state( (_the_thread), STATES_BLOCKED ); - -/*PAGE - * - * _Thread_Restart_self - * - */ - -#define _Thread_Restart_self() \ - { \ - if ( _Thread_Executing->fp_context != NULL ) \ - _Context_Restore_fp( &_Thread_Executing->fp_context ); \ - \ - _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ - } - -/*PAGE - * - * _Thread_Calculate_heir - * - */ - -#define _Thread_Calculate_heir() \ - { \ - Priority_Control highest; \ - \ - _Priority_Get_highest( highest ); \ - \ - _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \ - } - -/*PAGE - * - * _Thread_Is_allocated_fp - * - */ - -#define _Thread_Is_allocated_fp( _the_thread ) \ - ( (_the_thread) == _Thread_Allocated_fp ) - -/*PAGE - * - * _Thread_Deallocate_fp - * - */ - -#define _Thread_Deallocate_fp() \ - _Thread_Allocated_fp = NULL - -/*PAGE - * - * _Thread_Disable_dispatch - * - */ - -#define _Thread_Disable_dispatch() \ - _Thread_Dispatch_disable_level += 1 - -/*PAGE - * - * _Thread_Enable_dispatch - * - */ - -#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) -#define _Thread_Enable_dispatch() \ - { if ( (--_Thread_Dispatch_disable_level) == 0 ) \ - _Thread_Dispatch(); \ - } -#endif - -#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) -void _Thread_Enable_dispatch( void ); -#endif - -/*PAGE - * - * _Thread_Unnest_dispatch - * - */ - -#define _Thread_Unnest_dispatch() \ - _Thread_Dispatch_disable_level -= 1 - -/*PAGE - * - * _Thread_Is_dispatching_enabled - * - */ - -#define _Thread_Is_dispatching_enabled() \ - ( _Thread_Dispatch_disable_level == 0 ) - -/*PAGE - * - * _Thread_Is_context_switch_necessary - * - */ - -#define _Thread_Is_context_switch_necessary() \ - ( _Context_Switch_necessary == TRUE ) - -/*PAGE - * - * _Thread_Dispatch_initialization - * - */ - -#define _Thread_Dispatch_initialization() \ - _Thread_Dispatch_disable_level = 1 - -/*PAGE - * - * _Thread_Is_null - * - */ - -#define _Thread_Is_null( _the_thread ) \ - ( (_the_thread) == NULL ) - -/* - * _Thread_Is_proxy_blocking - * - */ - -#define _Thread_Is_proxy_blocking( _code ) \ - ( (_code) == THREAD_STATUS_PROXY_BLOCKING ) - -/* - * _Thread_Internal_allocate - * - */ - -#define _Thread_Internal_allocate() \ - ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information )) - -/* - * _Thread_Internal_free - * - */ - -#define _Thread_Internal_free( _the_task ) \ - _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/threadmp.inl b/cpukit/score/macros/rtems/score/threadmp.inl deleted file mode 100644 index c601862f96..0000000000 --- a/cpukit/score/macros/rtems/score/threadmp.inl +++ /dev/null @@ -1,50 +0,0 @@ -/* macros/threadmp.h - * - * This include file contains the bodies of all inlined routines - * for the multiprocessing part of thread package. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __MACROS_MP_THREAD_h -#define __MACROS_MP_THREAD_h - -/*PAGE - * - * _Thread_MP_Is_receive - * - */ - -#define _Thread_MP_Is_receive( _the_thread ) \ - ( (_the_thread) == _Thread_MP_Receive) - -/*PAGE - * - * _Thread_MP_Free_proxy - * - */ - -#define _Thread_MP_Free_proxy( _the_thread ) \ -{ \ - Thread_Proxy_control *_the_proxy; \ - \ - _the_proxy = (Thread_Proxy_control *) (_the_thread); \ - \ - _Chain_Extract( &_the_proxy->Active ); \ - \ - _Chain_Append( \ - &_Thread_MP_Inactive_proxies, \ - &(_the_thread)->Object.Node \ - ); \ -} - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/tod.inl b/cpukit/score/macros/rtems/score/tod.inl deleted file mode 100644 index ecab4e6eae..0000000000 --- a/cpukit/score/macros/rtems/score/tod.inl +++ /dev/null @@ -1,58 +0,0 @@ -/* tod.inl - * - * This file contains the macro implementation of the inlined routines - * from the Time of Day Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __TIME_OF_DAY_inl -#define __TIME_OF_DAY_inl - -/*PAGE - * - * _TOD_Is_set - * - */ - -#define _TOD_Is_set() \ - _Watchdog_Is_active( &_TOD_Seconds_watchdog ) - -/*PAGE - * - * _TOD_Tickle_ticks - * - */ - -#define _TOD_Tickle_ticks() \ - _TOD_Current.ticks++; \ - _TOD_Ticks_since_boot++ - -/*PAGE - * - * _TOD_Deactivate - * - */ - -#define _TOD_Deactivate() \ - _Watchdog_Remove( &_TOD_Seconds_watchdog ) - -/*PAGE - * - * _TOD_Activate - * - */ - -#define _TOD_Activate( _ticks ) \ - _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, (_ticks) ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/tqdata.inl b/cpukit/score/macros/rtems/score/tqdata.inl deleted file mode 100644 index 5ffb79bcb1..0000000000 --- a/cpukit/score/macros/rtems/score/tqdata.inl +++ /dev/null @@ -1,59 +0,0 @@ -/* tqdata.inl - * - * This file contains the macro implementation of the inlined - * routines needed to support the Thread Queue Data. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __THREAD_QUEUE_DATA_inl -#define __THREAD_QUEUE_DATA_inl - -/*PAGE - * - * _Thread_queue_Header_number - * - */ - -#define _Thread_queue_Header_number( _the_priority ) \ - ((_the_priority) / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER) - -/*PAGE - * - * _Thread_queue_Is_reverse_search - * - */ - -#define _Thread_queue_Is_reverse_search( _the_priority ) \ - ( (_the_priority) & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK ) - -/*PAGE - * - * _Thread_queue_Get_number_waiting - * - */ - -#define _Thread_queue_Get_number_waiting( _the_thread_queue ) \ - ( (_the_thread_queue)->count ) - -/*PAGE - * - * _Thread_queue_Enter_critical_section - * - */ - -#define _Thread_queue_Enter_critical_section( _the_thread_queue ) \ - do { \ - (_the_thread_queue)->sync_state = THREAD_QUEUE_NOTHING_HAPPENED; \ - } while ( 0 ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/userext.inl b/cpukit/score/macros/rtems/score/userext.inl deleted file mode 100644 index 4b5b8083bf..0000000000 --- a/cpukit/score/macros/rtems/score/userext.inl +++ /dev/null @@ -1,126 +0,0 @@ -/* userext.inl - * - * This file contains the macro implementation of the inlined routines - * from the User Extension Handler - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __USER_EXTENSIONS_inl -#define __USER_EXTENSIONS_inl - -/*PAGE - * - * _User_extensions_Handler_initialization - * - */ - -#define _User_extensions_Handler_initialization( _initial_extensions ) \ - { \ - _Chain_Initialize_empty( &_User_extensions_List ); \ - \ - if ( (_initial_extensions) ) { \ - _User_extensions_Initial.Callouts = *(_initial_extensions); \ - _Chain_Append( \ - &_User_extensions_List, &_User_extensions_Initial.Node ); \ - } \ - } - -/*PAGE - * - * _User_extensions_Add_set - */ - -#define _User_extensions_Add_set( _the_extension, _extension_table ) \ - do { \ - (_the_extension)->Callouts = *(_extension_table); \ - \ - _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \ - } while ( 0 ) - -/*PAGE - * - * _User_extensions_Add_API_set - */ - -#define _User_extensions_Add_API_set( _the_extension ) \ - _Chain_Prepend( &_User_extensions_List, &(_the_extension)->Node ) - - -/*PAGE - * - * _User_extensions_Remove_set - */ - -#define _User_extensions_Remove_set( _the_extension ) \ - _Chain_Extract( &(_the_extension)->Node ) - -/*PAGE - * - * _User_extensions_Run_list_forward - * - * NOTE: No parentheses around macro names here to avoid - * messing up the name and function call expansion. - */ - -#define _User_extensions_Run_list_forward( _name, _arguments ) \ - do { \ - Chain_Node *the_node; \ - User_extensions_Control *the_extension; \ - \ - for ( the_node = _User_extensions_List.first ; \ - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; \ - the_node = the_node->next ) { \ - the_extension = (User_extensions_Control *) the_node; \ - \ - if ( the_extension->Callouts.## _name != NULL ) \ - (*the_extension->Callouts.## _name) _arguments; \ - \ - } \ - \ - } while ( 0 ) - -/*PAGE - * - * _User_extensions_Run_list_backward - * - * NOTE: No parentheses around macro names here to avoid - * messing up the name and function call expansion. - */ - -#define _User_extensions_Run_list_backward( _name, _arguments ) \ - do { \ - Chain_Node *the_node; \ - User_extensions_Control *the_extension; \ - \ - for ( the_node = _User_extensions_List.last ; \ - !_Chain_Is_head( &_User_extensions_List, the_node ) ; \ - the_node = the_node->previous ) { \ - the_extension = (User_extensions_Control *) the_node; \ - \ - if ( the_extension->Callouts.## _name != NULL ) \ - (*the_extension->Callouts.## _name) _arguments; \ - \ - } \ - \ - } while ( 0 ) - -/*PAGE - * - * _User_extensions_Thread_switch - * - */ - -#define _User_extensions_Thread_switch( _executing, _heir ) \ - _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) ) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/watchdog.inl b/cpukit/score/macros/rtems/score/watchdog.inl deleted file mode 100644 index d24224f93d..0000000000 --- a/cpukit/score/macros/rtems/score/watchdog.inl +++ /dev/null @@ -1,172 +0,0 @@ -/* watchdog.inl - * - * This file contains the macro implementation of all inlined routines - * in the Watchdog Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __WATCHDOG_inl -#define __WATCHDOG_inl - -#include <rtems/score/object.h> - -/*PAGE - * - * _Watchdog_Initialize - * - */ - -#define _Watchdog_Initialize( _the_watchdog, _routine, _id, _user_data ) \ - { \ - (_the_watchdog)->state = WATCHDOG_INACTIVE; \ - (_the_watchdog)->routine = (_routine); \ - (_the_watchdog)->id = (_id); \ - (_the_watchdog)->user_data = (_user_data); \ - } - -/*PAGE - * - * _Watchdog_Is_active - * - */ - -#define _Watchdog_Is_active( _the_watchdog ) \ - ( (_the_watchdog)->state == WATCHDOG_ACTIVE ) - -/*PAGE - * - * _Watchdog_Activate - * - */ - -#define _Watchdog_Activate( _the_watchdog ) \ - (_the_watchdog)->state = WATCHDOG_ACTIVE - -/*PAGE - * - * _Watchdog_Deactivate - * - */ - -#define _Watchdog_Deactivate( _the_watchdog ) \ - (_the_watchdog)->state = WATCHDOG_REMOVE_IT - -/*PAGE - * - * _Watchdog_Tickle_ticks - * - */ - -#define _Watchdog_Tickle_ticks() \ - _Watchdog_Tickle( &_Watchdog_Ticks_chain ) - -/*PAGE - * - * _Watchdog_Tickle_seconds - * - */ - -#define _Watchdog_Tickle_seconds() \ - _Watchdog_Tickle( &_Watchdog_Seconds_chain ) - -/*PAGE - * - * _Watchdog_Insert_ticks - * - */ - -#define _Watchdog_Insert_ticks( _the_watchdog, _units ) \ - do { \ - (_the_watchdog)->initial = (_units); \ - _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \ - } while ( 0 ) - -/*PAGE - * - * _Watchdog_Insert_seconds - * - */ - -#define _Watchdog_Insert_seconds( _the_watchdog, _units ) \ - do { \ - (_the_watchdog)->initial = (_units); \ - _Watchdog_Insert( &_Watchdog_Seconds_chain, (_the_watchdog) ); \ - } while ( 0 ) - -/*PAGE - * - * _Watchdog_Adjust_seconds - * - */ - -#define _Watchdog_Adjust_seconds( _direction, _units ) \ - _Watchdog_Adjust( &_Watchdog_Seconds_chain, (_direction), (_units) ) - -/*PAGE - * - * _Watchdog_Adjust_ticks - * - */ - -#define _Watchdog_Adjust_ticks( _direction, _units ) \ - _Watchdog_Adjust( &_Watchdog_Ticks_chain, (_direction), (_units) ) - -/*PAGE - * - * _Watchdog_Reset - * - */ - -#define _Watchdog_Reset( _the_watchdog ) \ - { \ - (void) _Watchdog_Remove( (_the_watchdog) ); \ - _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \ - } - -/*PAGE - * - * _Watchdog_Next - * - */ - -#define _Watchdog_Next( _watchdog ) \ - ((Watchdog_Control *) (_watchdog)->Node.next) - -/*PAGE - * - * _Watchdog_Previous - * - */ - -#define _Watchdog_Previous( _watchdog ) \ - ((Watchdog_Control *) (_watchdog)->Node.previous) - -/*PAGE - * - * _Watchdog_First - * - */ - -#define _Watchdog_First( _header ) \ - ((Watchdog_Control *) (_header)->first) - -/*PAGE - * - * _Watchdog_Last - * - */ - -#define _Watchdog_Last( _header ) \ - ((Watchdog_Control *) (_header)->last) - -#endif -/* end of include file */ diff --git a/cpukit/score/macros/rtems/score/wkspace.inl b/cpukit/score/macros/rtems/score/wkspace.inl deleted file mode 100644 index c6483656d8..0000000000 --- a/cpukit/score/macros/rtems/score/wkspace.inl +++ /dev/null @@ -1,80 +0,0 @@ -/* wkspace.inl - * - * This file contains the macro implementation of the inlined routines - * from the RAM Workspace Handler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __WORKSPACE_inl -#define __WORKSPACE_inl - -/*PAGE - * - * _Workspace_Handler_initialization - * - */ - -#define _Workspace_Handler_initialization( _starting_address, _size ) \ -{ \ - unsigned32 *zero_out_array; \ - unsigned32 index; \ - unsigned32 memory_available; \ - \ - if ( !(_starting_address) || !_Addresses_Is_aligned( (_starting_address) ) ) \ - _Internal_error_Occurred( \ - INTERNAL_ERROR_CORE, \ - TRUE, \ - INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS \ - ); \ - \ - if ( _CPU_Table.do_zero_of_workspace ) { \ - for( zero_out_array = (unsigned32 *) (_starting_address), index = 0 ; \ - index < (_size) / 4 ; \ - index++ ) \ - zero_out_array[ index ] = 0; \ - } \ - \ - memory_available = _Heap_Initialize( \ - &_Workspace_Area, \ - (_starting_address), \ - (_size), \ - CPU_HEAP_ALIGNMENT \ - ); \ - \ - if ( memory_available == 0 ) \ - _Internal_error_Occurred( \ - INTERNAL_ERROR_CORE, \ - TRUE, \ - INTERNAL_ERROR_TOO_LITTLE_WORKSPACE \ - ); \ -} - -/*PAGE - * - * _Workspace_Allocate - * - */ - -#define _Workspace_Allocate( _size ) \ - _Heap_Allocate( &_Workspace_Area, (_size) ) - -/*PAGE - * - * _Workspace_Free - * - */ - -#define _Workspace_Free( _block ) \ - _Heap_Free( &_Workspace_Area, (_block) ) - -#endif -/* end of include file */ diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c deleted file mode 100644 index 6e82b49a53..0000000000 --- a/cpukit/score/src/apiext.c +++ /dev/null @@ -1,105 +0,0 @@ -/* apiext.c - * - * XXX - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - - -#include <rtems/system.h> -#include <rtems/score/apiext.h> - -/*PAGE - * - * _API_extensions_Initialization - */ - -void _API_extensions_Initialization( void ) -{ - _Chain_Initialize_empty( &_API_extensions_List ); -} - -/*PAGE - * - * _API_extensions_Add - */ - -void _API_extensions_Add( - API_extensions_Control *the_extension -) -{ - _Chain_Append( &_API_extensions_List, &the_extension->Node ); -} - -/*PAGE - * - * _API_extensions_Run_predriver - */ - -void _API_extensions_Run_predriver( void ) -{ - Chain_Node *the_node; - API_extensions_Control *the_extension; - - for ( the_node = _API_extensions_List.first ; - !_Chain_Is_tail( &_API_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (API_extensions_Control *) the_node; - - if ( the_extension->predriver_hook ) - (*the_extension->predriver_hook)(); - } -} - -/*PAGE - * - * _API_extensions_Run_postdriver - */ - -void _API_extensions_Run_postdriver( void ) -{ - Chain_Node *the_node; - API_extensions_Control *the_extension; - - for ( the_node = _API_extensions_List.first ; - !_Chain_Is_tail( &_API_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (API_extensions_Control *) the_node; - - if ( the_extension->postdriver_hook ) - (*the_extension->postdriver_hook)(); - } -} - -/*PAGE - * - * _API_extensions_Run_postswitch - */ - -void _API_extensions_Run_postswitch( void ) -{ - Chain_Node *the_node; - API_extensions_Control *the_extension; - - for ( the_node = _API_extensions_List.first ; - !_Chain_Is_tail( &_API_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (API_extensions_Control *) the_node; - - if ( the_extension->postswitch_hook ) - (*the_extension->postswitch_hook)( _Thread_Executing ); - } -} - -/* end of file */ diff --git a/cpukit/score/src/chain.c b/cpukit/score/src/chain.c deleted file mode 100644 index 5ef56ed5ad..0000000000 --- a/cpukit/score/src/chain.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Chain Handler - * - * NOTE: - * - * The order of this file is to allow proper compilation due to the - * order of inlining required by the compiler. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Chain_Initialize - * - * This kernel routine initializes a doubly linked chain. - * - * Input parameters: - * the_chain - pointer to chain header - * starting_address - starting address of first node - * number_nodes - number of nodes in chain - * node_size - size of node in bytes - * - * Output parameters: NONE - */ - -void _Chain_Initialize( - Chain_Control *the_chain, - void *starting_address, - unsigned32 number_nodes, - unsigned32 node_size -) -{ - unsigned32 count; - Chain_Node *current; - Chain_Node *next; - - count = number_nodes; - current = _Chain_Head( the_chain ); - the_chain->permanent_null = NULL; - next = (Chain_Node *)starting_address; - while ( count-- ) { - current->next = next; - next->previous = current; - current = next; - next = (Chain_Node *) - _Addresses_Add_offset( (void *) next, node_size ); - } - current->next = _Chain_Tail( the_chain ); - the_chain->last = current; -} - -/*PAGE - * - * _Chain_Get_first_unprotected - */ - -#ifndef USE_INLINES -Chain_Node *_Chain_Get_first_unprotected( - Chain_Control *the_chain -) -{ - Chain_Node *return_node; - Chain_Node *new_first; - - return_node = the_chain->first; - new_first = return_node->next; - the_chain->first = new_first; - new_first->previous = _Chain_Head( the_chain ); - - return return_node; -} -#endif /* USE_INLINES */ - -/*PAGE - * - * _Chain_Get - * - * This kernel routine returns a pointer to a node taken from the - * given chain. - * - * Input parameters: - * the_chain - pointer to chain header - * - * Output parameters: - * return_node - pointer to node in chain allocated - * CHAIN_END - if no nodes available - * - * INTERRUPT LATENCY: - * only case - */ - -Chain_Node *_Chain_Get( - Chain_Control *the_chain -) -{ - ISR_Level level; - Chain_Node *return_node; - - return_node = NULL; - _ISR_Disable( level ); - if ( !_Chain_Is_empty( the_chain ) ) - return_node = _Chain_Get_first_unprotected( the_chain ); - _ISR_Enable( level ); - return return_node; -} - -/*PAGE - * - * _Chain_Append - * - * This kernel routine puts a node on the end of the specified chain. - * - * Input parameters: - * the_chain - pointer to chain header - * node - address of node to put at rear of chain - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Append( - Chain_Control *the_chain, - Chain_Node *node -) -{ - ISR_Level level; - - _ISR_Disable( level ); - _Chain_Append_unprotected( the_chain, node ); - _ISR_Enable( level ); -} - -/*PAGE - * - * _Chain_Extract - * - * This kernel routine deletes the given node from a chain. - * - * Input parameters: - * node - pointer to node in chain to be deleted - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Extract( - Chain_Node *node -) -{ - ISR_Level level; - - _ISR_Disable( level ); - _Chain_Extract_unprotected( node ); - _ISR_Enable( level ); -} - -/*PAGE - * - * _Chain_Insert - * - * This kernel routine inserts a given node after a specified node - * a requested chain. - * - * Input parameters: - * after_node - pointer to node in chain to be inserted after - * node - pointer to node to be inserted - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Insert( - Chain_Node *after_node, - Chain_Node *node -) -{ - ISR_Level level; - - _ISR_Disable( level ); - _Chain_Insert_unprotected( after_node, node ); - _ISR_Enable( level ); -} diff --git a/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c deleted file mode 100644 index 05e4fb799d..0000000000 --- a/cpukit/score/src/coremsg.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/chain.h> -#include <rtems/score/isr.h> -#include <rtems/score/object.h> -#include <rtems/score/coremsg.h> -#include <rtems/score/states.h> -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/mpci.h> - -/*PAGE - * - * _CORE_message_queue_Initialize - * - * This routine initializes a newly created message queue based on the - * specified data. - * - * Input parameters: - * the_message_queue - the message queue to initialize - * the_class - the API specific object class - * the_message_queue_attributes - the message queue's attributes - * maximum_pending_messages - maximum message and reserved buffer count - * maximum_message_size - maximum size of each message - * proxy_extract_callout - remote extract support - * - * Output parameters: - * TRUE - if the message queue is initialized - * FALSE - if the message queue is NOT initialized - */ - -boolean _CORE_message_queue_Initialize( - CORE_message_queue_Control *the_message_queue, - Objects_Classes the_class, - CORE_message_queue_Attributes *the_message_queue_attributes, - unsigned32 maximum_pending_messages, - unsigned32 maximum_message_size, - Thread_queue_Extract_callout proxy_extract_callout -) -{ - unsigned32 message_buffering_required; - unsigned32 allocated_message_size; - - the_message_queue->maximum_pending_messages = maximum_pending_messages; - the_message_queue->number_of_pending_messages = 0; - the_message_queue->maximum_message_size = maximum_message_size; - _CORE_message_queue_Set_notify( the_message_queue, NULL, NULL ); - - /* - * round size up to multiple of a ptr for chain init - */ - - allocated_message_size = maximum_message_size; - if (allocated_message_size & (sizeof(unsigned32) - 1)) { - allocated_message_size += sizeof(unsigned32); - allocated_message_size &= ~(sizeof(unsigned32) - 1); - } - - message_buffering_required = maximum_pending_messages * - (allocated_message_size + sizeof(CORE_message_queue_Buffer_control)); - - the_message_queue->message_buffers = (CORE_message_queue_Buffer *) - _Workspace_Allocate( message_buffering_required ); - - if (the_message_queue->message_buffers == 0) - return FALSE; - - _Chain_Initialize ( - &the_message_queue->Inactive_messages, - the_message_queue->message_buffers, - maximum_pending_messages, - allocated_message_size + sizeof( CORE_message_queue_Buffer_control ) - ); - - _Chain_Initialize_empty( &the_message_queue->Pending_messages ); - - _Thread_queue_Initialize( - &the_message_queue->Wait_queue, - the_class, - _CORE_message_queue_Is_priority( the_message_queue_attributes ) ? - THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_MESSAGE, - proxy_extract_callout, - CORE_MESSAGE_QUEUE_STATUS_TIMEOUT - ); - - return TRUE; -} - -/*PAGE - * - * _CORE_message_queue_Close - * - * This function closes a message by returning all allocated space and - * flushing the message_queue's task wait queue. - * - * Input parameters: - * the_message_queue - the message_queue to be flushed - * remote_extract_callout - function to invoke remotely - * status - status to pass to thread - * - * Output parameters: NONE - */ - -void _CORE_message_queue_Close( - CORE_message_queue_Control *the_message_queue, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -) -{ - - if ( the_message_queue->number_of_pending_messages != 0 ) - (void) _CORE_message_queue_Flush_support( the_message_queue ); - else - _Thread_queue_Flush( - &the_message_queue->Wait_queue, - remote_extract_callout, - status - ); - - (void) _Workspace_Free( the_message_queue->message_buffers ); - -} - -/*PAGE - * - * _CORE_message_queue_Flush - * - * This function flushes the message_queue's task wait queue. The number - * of messages flushed from the queue is returned. - * - * Input parameters: - * the_message_queue - the message_queue to be flushed - * - * Output parameters: - * returns - the number of messages flushed from the queue - */ - -unsigned32 _CORE_message_queue_Flush( - CORE_message_queue_Control *the_message_queue -) -{ - if ( the_message_queue->number_of_pending_messages != 0 ) - return _CORE_message_queue_Flush_support( the_message_queue ); - else - return 0; -} - -/*PAGE - * - * _CORE_message_queue_Broadcast - * - * This function sends a message for every thread waiting on the queue and - * returns the number of threads made ready by the message. - * - * Input parameters: - * the_message_queue - message is submitted to this message queue - * buffer - pointer to message buffer - * size - size in bytes of message to send - * id - id of message queue - * api_message_queue_mp_support - api specific mp support callout - * count - area to store number of threads made ready - * - * Output parameters: - * count - number of threads made ready - * CORE_MESSAGE_QUEUE_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - -CORE_message_queue_Status _CORE_message_queue_Broadcast( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support, - unsigned32 *count -) -{ - Thread_Control *the_thread; - unsigned32 number_broadcasted; - Thread_Wait_information *waitp; - unsigned32 constrained_size; - - number_broadcasted = 0; - while ((the_thread = _Thread_queue_Dequeue(&the_message_queue->Wait_queue))) { - waitp = &the_thread->Wait; - number_broadcasted += 1; - - constrained_size = size; - if ( size > the_message_queue->maximum_message_size ) - constrained_size = the_message_queue->maximum_message_size; - - _CORE_message_queue_Copy_buffer( - buffer, - waitp->return_argument, - constrained_size - ); - - *(unsigned32 *)the_thread->Wait.return_argument_1 = size; - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - (*api_message_queue_mp_support) ( the_thread, id ); - - } - *count = number_broadcasted; - return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; -} - -/*PAGE - * - * _CORE_message_queue_Seize - * - * This kernel routine dequeues a message, copies the message buffer to - * a given destination buffer, and frees the message buffer to the - * inactive message pool. The thread will be blocked if wait is TRUE, - * otherwise an error will be given to the thread if no messages are available. - * - * Input parameters: - * the_message_queue - pointer to message queue - * id - id of object we are waitig on - * buffer - pointer to message buffer to be filled - * size - pointer to the size of buffer to be filled - * wait - TRUE if wait is allowed, FALSE otherwise - * timeout - time to wait for a message - * - * Output parameters: NONE - * - * NOTE: Dependent on BUFFER_LENGTH - * - * INTERRUPT LATENCY: - * available - * wait - */ - -void _CORE_message_queue_Seize( - CORE_message_queue_Control *the_message_queue, - Objects_Id id, - void *buffer, - unsigned32 *size, - boolean wait, - Watchdog_Interval timeout -) -{ - ISR_Level level; - CORE_message_queue_Buffer_control *the_message; - Thread_Control *executing; - - executing = _Thread_Executing; - executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; - _ISR_Disable( level ); - if ( the_message_queue->number_of_pending_messages != 0 ) { - the_message_queue->number_of_pending_messages -= 1; - - the_message = _CORE_message_queue_Get_pending_message( the_message_queue ); - _ISR_Enable( level ); - *size = the_message->Contents.size; - _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size ); - _CORE_message_queue_Free_message_buffer(the_message_queue, the_message ); - return; - } - - if ( !wait ) { - _ISR_Enable( level ); - executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT; - return; - } - - _Thread_queue_Enter_critical_section( &the_message_queue->Wait_queue ); - executing->Wait.queue = &the_message_queue->Wait_queue; - executing->Wait.id = id; - executing->Wait.return_argument = (void *)buffer; - executing->Wait.return_argument_1 = (void *)size; - _ISR_Enable( level ); - - _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout ); -} - -/*PAGE - * - * _CORE_message_queue_Flush_support - * - * This message handler routine removes all messages from a message queue - * and returns them to the inactive message pool. The number of messages - * flushed from the queue is returned - * - * Input parameters: - * the_message_queue - pointer to message queue - * - * Output parameters: - * returns - number of messages placed on inactive chain - * - * INTERRUPT LATENCY: - * only case - */ - -unsigned32 _CORE_message_queue_Flush_support( - CORE_message_queue_Control *the_message_queue -) -{ - ISR_Level level; - Chain_Node *inactive_first; - Chain_Node *message_queue_first; - Chain_Node *message_queue_last; - unsigned32 count; - - _ISR_Disable( level ); - inactive_first = the_message_queue->Inactive_messages.first; - message_queue_first = the_message_queue->Pending_messages.first; - message_queue_last = the_message_queue->Pending_messages.last; - - the_message_queue->Inactive_messages.first = message_queue_first; - message_queue_last->next = inactive_first; - inactive_first->previous = message_queue_last; - message_queue_first->previous = - _Chain_Head( &the_message_queue->Inactive_messages ); - - _Chain_Initialize_empty( &the_message_queue->Pending_messages ); - - count = the_message_queue->number_of_pending_messages; - the_message_queue->number_of_pending_messages = 0; - _ISR_Enable( level ); - return count; -} - -/*PAGE - * - * _CORE_message_queue_Submit - * - * This routine implements the send and urgent message functions. It - * processes a message that is to be submitted to the designated - * message queue. The message will either be processed as a - * send message which it will be inserted at the rear of the queue - * or it will be processed as an urgent message which will be inserted - * at the front of the queue. - * - * Input parameters: - * the_message_queue - message is submitted to this message queue - * buffer - pointer to message buffer - * size - size in bytes of message to send - * id - id of message queue - * api_message_queue_mp_support - api specific mp support callout - * submit_type - send or urgent message - * - * Output parameters: - * CORE_MESSAGE_QUEUE_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - -CORE_message_queue_Status _CORE_message_queue_Submit( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support, - CORE_message_queue_Submit_types submit_type -) -{ - CORE_message_queue_Buffer_control *the_message; - Thread_Control *the_thread; - - if ( size > the_message_queue->maximum_message_size ) - return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE; - - /* - * Is there a thread currently waiting on this message queue? - */ - - the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue ); - if ( the_thread ) - { - _CORE_message_queue_Copy_buffer( - buffer, - the_thread->Wait.return_argument, - size - ); - *(unsigned32 *)the_thread->Wait.return_argument_1 = size; - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - (*api_message_queue_mp_support) ( the_thread, id ); - - return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; - } - - /* - * No one waiting on this one currently. - * Allocate a message buffer and store it away - */ - - if ( the_message_queue->number_of_pending_messages == - the_message_queue->maximum_pending_messages ) { - return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY; - } - - the_message = _CORE_message_queue_Allocate_message_buffer(the_message_queue); - if ( the_message == 0) - return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED; - - _CORE_message_queue_Copy_buffer( buffer, the_message->Contents.buffer, size ); - the_message->Contents.size = size; - - the_message_queue->number_of_pending_messages += 1; - - switch ( submit_type ) { - case CORE_MESSAGE_QUEUE_SEND_REQUEST: - _CORE_message_queue_Append( the_message_queue, the_message ); - break; - case CORE_MESSAGE_QUEUE_URGENT_REQUEST: - _CORE_message_queue_Prepend( the_message_queue, the_message ); - break; - } - - return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; -} diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c deleted file mode 100644 index a0c3fd0264..0000000000 --- a/cpukit/score/src/coremutex.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Mutex Handler - * - * DESCRIPTION: - * - * This package is the implementation of the Mutex Handler. - * This handler provides synchronization and mutual exclusion capabilities. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/coremutex.h> -#include <rtems/score/states.h> -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> - -/*PAGE - * - * _CORE_mutex_Initialize - * - * This routine initializes a mutex at create time and set the control - * structure according to the values passed. - * - * Input parameters: - * the_mutex - the mutex control block to initialize - * the_class - the API class of the object - * the_mutex_attributes - the mutex attributes specified at create time - * initial_lock - mutex initial lock or unlocked status - * proxy_extract_callout - MP specific extract callout - * - * Output parameters: NONE - */ - -void _CORE_mutex_Initialize( - CORE_mutex_Control *the_mutex, - Objects_Classes the_class, - CORE_mutex_Attributes *the_mutex_attributes, - unsigned32 initial_lock, - Thread_queue_Extract_callout proxy_extract_callout -) -{ - -/* Add this to the RTEMS environment later ????????? - rtems_assert( initial_lock == CORE_MUTEX_LOCKED || - initial_lock == CORE_MUTEX_UNLOCKED ); - */ - - the_mutex->Attributes = *the_mutex_attributes; - the_mutex->lock = initial_lock; - - if ( initial_lock == CORE_MUTEX_LOCKED ) { - the_mutex->nest_count = 1; - the_mutex->holder = _Thread_Executing; - the_mutex->holder_id = _Thread_Executing->Object.id; - _Thread_Executing->resource_count++; - } else { - the_mutex->nest_count = 0; - the_mutex->holder = NULL; - the_mutex->holder_id = 0; - } - - _Thread_queue_Initialize( - &the_mutex->Wait_queue, - the_class, - _CORE_mutex_Is_priority( the_mutex_attributes ) ? - THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_MUTEX, - proxy_extract_callout, - CORE_MUTEX_TIMEOUT - ); -} - -/*PAGE - * - * _CORE_mutex_Seize - * - * This routine attempts to allocate a mutex to the calling thread. - * - * Input parameters: - * the_mutex - pointer to mutex control block - * id - id of object to wait on - * wait - TRUE if wait is allowed, FALSE otherwise - * timeout - number of ticks to wait (0 means forever) - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * available - * wait - */ - -void _CORE_mutex_Seize( - CORE_mutex_Control *the_mutex, - Objects_Id id, - boolean wait, - Watchdog_Interval timeout -) -{ - Thread_Control *executing; - ISR_Level level; - - executing = _Thread_Executing; - executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL; - _ISR_Disable( level ); - if ( ! _CORE_mutex_Is_locked( the_mutex ) ) { - the_mutex->lock = CORE_MUTEX_LOCKED; - the_mutex->holder = executing; - the_mutex->holder_id = executing->Object.id; - the_mutex->nest_count = 1; - executing->resource_count++; - _ISR_Enable( level ); - return; - } - - if ( _Objects_Are_ids_equal( - _Thread_Executing->Object.id, the_mutex->holder_id ) ) { - if ( _CORE_mutex_Is_nesting_allowed( &the_mutex->Attributes ) ) - the_mutex->nest_count++; - else - executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; - - _ISR_Enable( level ); - return; - } - - if ( !wait ) { - _ISR_Enable( level ); - executing->Wait.return_code = CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; - return; - } - - _Thread_queue_Enter_critical_section( &the_mutex->Wait_queue ); - executing->Wait.queue = &the_mutex->Wait_queue; - executing->Wait.id = id; - _ISR_Enable( level ); - - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) && - the_mutex->holder->current_priority > - _Thread_Executing->current_priority ) { - _Thread_Change_priority( - the_mutex->holder, _Thread_Executing->current_priority ); - } - - _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout ); -} - -/* - * _CORE_mutex_Surrender - * - * DESCRIPTION: - * - * This routine frees a unit to the mutex. If a task was blocked waiting for - * a unit from this mutex, then that task will be readied and the unit - * given to that task. Otherwise, the unit will be returned to the mutex. - * - * Input parameters: - * the_mutex - the mutex to be flushed - * id - id of parent mutex - * api_mutex_mp_support - api dependent MP support actions - * - * Output parameters: - * CORE_MUTEX_STATUS_SUCCESSFUL - if successful - * core error code - if unsuccessful - */ - -CORE_mutex_Status _CORE_mutex_Surrender( - CORE_mutex_Control *the_mutex, - Objects_Id id, - CORE_mutex_API_mp_support_callout api_mutex_mp_support -) -{ - Thread_Control *the_thread; - - if ( !_Objects_Are_ids_equal( - _Thread_Executing->Object.id, the_mutex->holder_id ) ) - return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE ); - - the_mutex->nest_count--; - - if ( the_mutex->nest_count != 0 ) - return( CORE_MUTEX_STATUS_SUCCESSFUL ); - - _Thread_Executing->resource_count--; - the_mutex->holder = NULL; - the_mutex->holder_id = 0; - - /* - * Whether or not someone is waiting for the mutex, an - * inherited priority must be lowered if this is the last - * mutex (i.e. resource) this task has. - */ - - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) && - _Thread_Executing->resource_count == 0 && - _Thread_Executing->real_priority != - _Thread_Executing->current_priority ) { - _Thread_Change_priority( - _Thread_Executing, - _Thread_Executing->real_priority - ); - } - - if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) { - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { - - the_mutex->holder = NULL; - the_mutex->holder_id = the_thread->Object.id; - the_mutex->nest_count = 1; - - ( *api_mutex_mp_support)( the_thread, id ); - - } else { - - the_mutex->holder = the_thread; - the_mutex->holder_id = the_thread->Object.id; - the_thread->resource_count++; - the_mutex->nest_count = 1; - - /* - * No special action for priority inheritance because the_thread - * is guaranteed to be the highest priority thread waiting for - * the mutex. - */ - } - } else - the_mutex->lock = CORE_MUTEX_UNLOCKED; - - return( CORE_MUTEX_STATUS_SUCCESSFUL ); -} - -/*PAGE - * - * _CORE_mutex_Flush - * - * This function a flushes the mutex's task wait queue. - * - * Input parameters: - * the_mutex - the mutex to be flushed - * remote_extract_callout - function to invoke remotely - * status - status to pass to thread - * - * Output parameters: NONE - */ - -void _CORE_mutex_Flush( - CORE_mutex_Control *the_mutex, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -) -{ - - _Thread_queue_Flush( - &the_mutex->Wait_queue, - remote_extract_callout, - status - ); - -} diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c deleted file mode 100644 index 0e55926304..0000000000 --- a/cpukit/score/src/coresem.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * CORE Semaphore Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Semaphore Handler. - * This core object utilizes standard Dijkstra counting semaphores to provide - * synchronization and mutual exclusion capabilities. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/coresem.h> -#include <rtems/score/states.h> -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/mpci.h> - -/*PAGE - * - * CORE_semaphore_Initialize - * - * This function initialize a semaphore and sets the initial value based - * on the given count. - * - * Input parameters: - * the_semaphore - the semaphore control block to initialize - * the_class - the API class of the object - * the_semaphore_attributes - the attributes specified at create time - * initial_value - semaphore's initial value - * proxy_extract_callout - MP specific extract callout - * - * Output parameters: NONE - */ - -void _CORE_semaphore_Initialize( - CORE_semaphore_Control *the_semaphore, - Objects_Classes the_class, - CORE_semaphore_Attributes *the_semaphore_attributes, - unsigned32 initial_value, - Thread_queue_Extract_callout proxy_extract_callout -) -{ - - the_semaphore->Attributes = *the_semaphore_attributes; - the_semaphore->count = initial_value; - - _Thread_queue_Initialize( - &the_semaphore->Wait_queue, - the_class, - _CORE_semaphore_Is_priority( the_semaphore_attributes ) ? - THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_SEMAPHORE, - proxy_extract_callout, - CORE_SEMAPHORE_TIMEOUT - ); -} - -/*PAGE - * - * _CORE_semaphore_Surrender - * - * Input parameters: - * the_semaphore - the semaphore to be flushed - * id - id of parent semaphore - * api_semaphore_mp_support - api dependent MP support actions - * - * Output parameters: - * CORE_SEMAPHORE_STATUS_SUCCESSFUL - if successful - * core error code - if unsuccessful - * - * Output parameters: - */ - -CORE_semaphore_Status _CORE_semaphore_Surrender( - CORE_semaphore_Control *the_semaphore, - Objects_Id id, - CORE_semaphore_API_mp_support_callout api_semaphore_mp_support -) -{ - Thread_Control *the_thread; - - if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) { - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - (*api_semaphore_mp_support) ( the_thread, id ); - - } else - the_semaphore->count += 1; - - return( CORE_SEMAPHORE_STATUS_SUCCESSFUL ); -} - -/*PAGE - * - * _CORE_semaphore_Seize - * - * This routine attempts to allocate a core semaphore to the calling thread. - * - * Input parameters: - * the_semaphore - pointer to semaphore control block - * id - id of object to wait on - * wait - TRUE if wait is allowed, FALSE otherwise - * timeout - number of ticks to wait (0 means forever) - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * available - * wait - */ - -void _CORE_semaphore_Seize( - CORE_semaphore_Control *the_semaphore, - Objects_Id id, - boolean wait, - Watchdog_Interval timeout -) -{ - Thread_Control *executing; - ISR_Level level; - - executing = _Thread_Executing; - executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; - _ISR_Disable( level ); - if ( the_semaphore->count != 0 ) { - the_semaphore->count -= 1; - _ISR_Enable( level ); - return; - } - - if ( !wait ) { - _ISR_Enable( level ); - executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; - return; - } - - _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue ); - executing->Wait.queue = &the_semaphore->Wait_queue; - executing->Wait.id = id; - _ISR_Enable( level ); - - _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); -} - - -/*PAGE - * - * _CORE_semaphore_Flush - * - * This function a flushes the semaphore's task wait queue. - * - * Input parameters: - * the_semaphore - the semaphore to be flushed - * remote_extract_callout - function to invoke remotely - * status - status to pass to thread - * - * Output parameters: NONE - */ - -void _CORE_semaphore_Flush( - CORE_semaphore_Control *the_semaphore, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -) -{ - - _Thread_queue_Flush( - &the_semaphore->Wait_queue, - remote_extract_callout, - status - ); - -} diff --git a/cpukit/score/src/coretod.c b/cpukit/score/src/coretod.c deleted file mode 100644 index 1a11034ceb..0000000000 --- a/cpukit/score/src/coretod.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Time of Day (TOD) Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/object.h> -#include <rtems/score/thread.h> -#include <rtems/score/tod.h> -#include <rtems/score/watchdog.h> - -/*PAGE - * - * _TOD_Handler_initialization - * - * This routine initializes the time of day handler. - * - * Input parameters: - * microseconds_per_tick - microseconds between clock ticks - * - * Output parameters: NONE - */ - -void _TOD_Handler_initialization( - unsigned32 microseconds_per_tick -) -{ - _TOD_Microseconds_per_tick = microseconds_per_tick; - - _TOD_Ticks_since_boot = 0; - _TOD_Seconds_since_epoch = 0; - - _TOD_Current.year = TOD_BASE_YEAR; - _TOD_Current.month = 1; - _TOD_Current.day = 1; - _TOD_Current.hour = 0; - _TOD_Current.minute = 0; - _TOD_Current.second = 0; - _TOD_Current.ticks = 0; - - if ( microseconds_per_tick == 0 ) - _TOD_Ticks_per_second = 0; - else - _TOD_Ticks_per_second = - TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick; - - _Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL ); -} - -/*PAGE - * - * _TOD_Set - * - * This rountine sets the current date and time with the specified - * new date and time structure. - * - * Input parameters: - * the_tod - pointer to the time and date structure - * seconds_since_epoch - seconds since system epoch - * - * Output parameters: NONE - */ - -void _TOD_Set( - TOD_Control *the_tod, - Watchdog_Interval seconds_since_epoch -) -{ - Watchdog_Interval ticks_until_next_second; - - _Thread_Disable_dispatch(); - _TOD_Deactivate(); - - if ( seconds_since_epoch < _TOD_Seconds_since_epoch ) - _Watchdog_Adjust_seconds( WATCHDOG_BACKWARD, - _TOD_Seconds_since_epoch - seconds_since_epoch ); - else - _Watchdog_Adjust_seconds( WATCHDOG_FORWARD, - seconds_since_epoch - _TOD_Seconds_since_epoch ); - - ticks_until_next_second = _TOD_Ticks_per_second; - if ( ticks_until_next_second > _TOD_Current.ticks ) - ticks_until_next_second -= _TOD_Current.ticks; - - _TOD_Current = *the_tod; - _TOD_Seconds_since_epoch = seconds_since_epoch; - _TOD_Activate( ticks_until_next_second ); - - _Thread_Enable_dispatch(); -} - -/*PAGE - * - * _TOD_Validate - * - * This kernel routine checks the validity of a date and time structure. - * - * Input parameters: - * the_tod - pointer to a time and date structure - * - * Output parameters: - * TRUE - if the date, time, and tick are valid - * FALSE - if the the_tod is invalid - * - * NOTE: This routine only works for leap-years through 2099. - */ - -boolean _TOD_Validate( - TOD_Control *the_tod -) -{ - unsigned32 days_in_month; - - if ((the_tod->ticks >= _TOD_Ticks_per_second) || - (the_tod->second >= TOD_SECONDS_PER_MINUTE) || - (the_tod->minute >= TOD_MINUTES_PER_HOUR) || - (the_tod->hour >= TOD_HOURS_PER_DAY) || - (the_tod->month == 0) || - (the_tod->month > TOD_MONTHS_PER_YEAR) || - (the_tod->year < TOD_BASE_YEAR) || - (the_tod->day == 0) ) - return FALSE; - - if ( (the_tod->year % 4) == 0 ) - days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ]; - else - days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ]; - - if ( the_tod->day > days_in_month ) - return FALSE; - - return TRUE; -} - -/*PAGE - * - * _TOD_To_seconds - * - * This routine returns the seconds from the epoch until the - * current date and time. - * - * Input parameters: - * the_tod - pointer to the time and date structure - * - * Output parameters: - * returns - seconds since epoch until the_tod - */ - -unsigned32 _TOD_To_seconds( - TOD_Control *the_tod -) -{ - unsigned32 time; - unsigned32 year_mod_4; - - time = the_tod->day - 1; - year_mod_4 = the_tod->year & 3; - - if ( year_mod_4 == 0 ) - time += _TOD_Days_to_date[ 1 ][ the_tod->month ]; - else - time += _TOD_Days_to_date[ 0 ][ the_tod->month ]; - - time += ( (the_tod->year - TOD_BASE_YEAR) / 4 ) * - ( (TOD_DAYS_PER_YEAR * 4) + 1); - - time += _TOD_Days_since_last_leap_year[ year_mod_4 ]; - - time *= TOD_SECONDS_PER_DAY; - - time += ((the_tod->hour * TOD_MINUTES_PER_HOUR) + the_tod->minute) - * TOD_SECONDS_PER_MINUTE; - - time += the_tod->second; - - return( time ); -} - -/*PAGE - * - * _TOD_Tickle - * - * This routine updates the calendar time and tickles the - * per second watchdog timer chain. - * - * Input parameters: - * ignored - this parameter is ignored - * - * Output parameters: NONE - * - * NOTE: This routine only works for leap-years through 2099. - */ - -void _TOD_Tickle( - Objects_Id id, - void *ignored -) -{ - unsigned32 leap; - - _TOD_Current.ticks = 0; - ++_TOD_Seconds_since_epoch; - if ( ++_TOD_Current.second >= TOD_SECONDS_PER_MINUTE ) { - _TOD_Current.second = 0; - if ( ++_TOD_Current.minute >= TOD_MINUTES_PER_HOUR ) { - _TOD_Current.minute = 0; - if ( ++_TOD_Current.hour >= TOD_HOURS_PER_DAY ) { - _TOD_Current.hour = 0; - if ( _TOD_Current.year & 0x3 ) leap = 0; - else leap = 1; - if ( ++_TOD_Current.day > - _TOD_Days_per_month[ leap ][ _TOD_Current.month ]) { - _TOD_Current.day = 1; - if ( ++_TOD_Current.month > TOD_MONTHS_PER_YEAR ) { - _TOD_Current.month = 1; - _TOD_Current.year++; - } - } - } - } - } - - _Watchdog_Tickle_seconds(); - _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, _TOD_Ticks_per_second ); -} diff --git a/cpukit/score/src/heap.c b/cpukit/score/src/heap.c deleted file mode 100644 index 11d8a31cee..0000000000 --- a/cpukit/score/src/heap.c +++ /dev/null @@ -1,537 +0,0 @@ -/* - * Heap Handler - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - - -#include <rtems/system.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/heap.h> - -/*PAGE - * - * _Heap_Initialize - * - * This kernel routine initializes a heap. - * - * Input parameters: - * the_heap - pointer to heap header - * starting_address - starting address of heap - * size - size of heap - * page_size - allocatable unit of memory - * - * Output parameters: - * returns - maximum memory available if RTEMS_SUCCESSFUL - * 0 - otherwise - * - * This is what a heap looks like in memory immediately - * after initialization: - * - * +--------------------------------+ - * 0 | size = 0 | status = used | a.k.a. dummy back flag - * +--------------------------------+ - * 4 | size = size-8 | status = free | a.k.a. front flag - * +--------------------------------+ - * 8 | next = PERM HEAP_TAIL | - * +--------------------------------+ - * 12 | previous = PERM HEAP_HEAD | - * +--------------------------------+ - * | | - * | memory available | - * | for allocation | - * | | - * +--------------------------------+ - * size - 8 | size = size-8 | status = free | a.k.a. back flag - * +--------------------------------+ - * size - 4 | size = 0 | status = used | a.k.a. dummy front flag - * +--------------------------------+ - */ - -unsigned32 _Heap_Initialize( - Heap_Control *the_heap, - void *starting_address, - unsigned32 size, - unsigned32 page_size -) -{ - Heap_Block *the_block; - unsigned32 the_size; - - if ( !_Heap_Is_page_size_valid( page_size ) || - (size < HEAP_MINIMUM_SIZE) ) - return 0; - - the_heap->page_size = page_size; - the_size = size - HEAP_OVERHEAD; - - the_block = (Heap_Block *) starting_address; - the_block->back_flag = HEAP_DUMMY_FLAG; - the_block->front_flag = the_size; - the_block->next = _Heap_Tail( the_heap ); - the_block->previous = _Heap_Head( the_heap ); - - the_heap->start = the_block; - the_heap->first = the_block; - the_heap->permanent_null = NULL; - the_heap->last = the_block; - - the_block = _Heap_Next_block( the_block ); - the_block->back_flag = the_size; - the_block->front_flag = HEAP_DUMMY_FLAG; - the_heap->final = the_block; - - return ( the_size - HEAP_BLOCK_USED_OVERHEAD ); -} - -/*PAGE - * - * _Heap_Extend - * - * This routine grows the_heap memory area using the size bytes which - * begin at starting_address. - * - * Input parameters: - * the_heap - pointer to heap header. - * starting_address - pointer to the memory area. - * size - size in bytes of the memory block to allocate. - * - * Output parameters: - * *amount_extended - amount of memory added to the_heap - */ - -Heap_Extend_status _Heap_Extend( - Heap_Control *the_heap, - void *starting_address, - unsigned32 size, - unsigned32 *amount_extended -) -{ - Heap_Block *the_block; - unsigned32 *p; - - /* - * The overhead was taken from the original heap memory. - */ - - Heap_Block *old_final; - Heap_Block *new_final; - - /* - * There are five possibilities for the location of starting - * address: - * - * 1. non-contiguous lower address (NOT SUPPORTED) - * 2. contiguous lower address (NOT SUPPORTED) - * 3. in the heap (ERROR) - * 4. contiguous higher address (SUPPORTED) - * 5. non-contiguous higher address (NOT SUPPORTED) - * - * As noted, this code only supports (4). - */ - - if ( starting_address >= (void *) the_heap->start && /* case 3 */ - starting_address <= (void *) the_heap->final - ) - return HEAP_EXTEND_ERROR; - - if ( starting_address < (void *) the_heap->start ) { /* cases 1 and 2 */ - - return HEAP_EXTEND_NOT_IMPLEMENTED; /* cases 1 and 2 */ - - } else { /* cases 4 and 5 */ - - the_block = (Heap_Block *) (starting_address - HEAP_OVERHEAD); - if ( the_block != the_heap->final ) - return HEAP_EXTEND_NOT_IMPLEMENTED; /* case 5 */ - } - - /* - * Currently only case 4 should make it to this point. - * The basic trick is to make the extend area look like a used - * block and free it. - */ - - *amount_extended = size; - - old_final = the_heap->final; - new_final = _Addresses_Add_offset( old_final, size ); - /* SAME AS: _Addresses_Add_offset( starting_address, size-HEAP_OVERHEAD ); */ - - the_heap->final = new_final; - - old_final->front_flag = - new_final->back_flag = _Heap_Build_flag( size, HEAP_BLOCK_USED ); - new_final->front_flag = HEAP_DUMMY_FLAG; - - /* - * Must pass in address of "user" area - * So add in the offset field. - */ - - p = (unsigned32 *) &old_final->next; - *p = sizeof(unsigned32); - p++; - _Heap_Free( the_heap, p ); - - return HEAP_EXTEND_SUCCESSFUL; -} - -/*PAGE - * - * _Heap_Allocate - * - * This kernel routine allocates the requested size of memory - * from the specified heap. - * - * Input parameters: - * the_heap - pointer to heap header. - * size - size in bytes of the memory block to allocate. - * - * Output parameters: - * returns - starting address of memory block allocated - */ - -void *_Heap_Allocate( - Heap_Control *the_heap, - unsigned32 size -) -{ - unsigned32 excess; - unsigned32 the_size; - Heap_Block *the_block; - Heap_Block *next_block; - Heap_Block *temporary_block; - void *ptr; - unsigned32 offset; - - excess = size % the_heap->page_size; - the_size = size + the_heap->page_size + HEAP_BLOCK_USED_OVERHEAD; - - if ( excess ) - the_size += the_heap->page_size - excess; - - if ( the_size < sizeof( Heap_Block ) ) - the_size = sizeof( Heap_Block ); - - for ( the_block = the_heap->first; - ; - the_block = the_block->next ) { - if ( the_block == _Heap_Tail( the_heap ) ) - return( NULL ); - if ( the_block->front_flag >= the_size ) - break; - } - - if ( (the_block->front_flag - the_size) > - (the_heap->page_size + HEAP_BLOCK_USED_OVERHEAD) ) { - the_block->front_flag -= the_size; - next_block = _Heap_Next_block( the_block ); - next_block->back_flag = the_block->front_flag; - - temporary_block = _Heap_Block_at( next_block, the_size ); - temporary_block->back_flag = - next_block->front_flag = _Heap_Build_flag( the_size, - HEAP_BLOCK_USED ); - ptr = _Heap_Start_of_user_area( next_block ); - } else { - next_block = _Heap_Next_block( the_block ); - next_block->back_flag = _Heap_Build_flag( the_block->front_flag, - HEAP_BLOCK_USED ); - the_block->front_flag = next_block->back_flag; - the_block->next->previous = the_block->previous; - the_block->previous->next = the_block->next; - ptr = _Heap_Start_of_user_area( the_block ); - } - - /* - * round ptr up to a multiple of page size - * Have to save the bump amount in the buffer so that free can figure it out - */ - - offset = the_heap->page_size - (((unsigned32) ptr) & (the_heap->page_size - 1)); - ptr += offset; - *(((unsigned32 *) ptr) - 1) = offset; - -#ifdef RTEMS_DEBUG - { - unsigned32 ptr_u32; - ptr_u32 = (unsigned32) ptr; - if (ptr_u32 & (the_heap->page_size - 1)) - abort(); - } -#endif - - return ptr; -} - -/*PAGE - * - * _Heap_Size_of_user_area - * - * This kernel routine returns the size of the memory area - * given heap block. - * - * Input parameters: - * the_heap - pointer to heap header - * starting_address - starting address of the memory block to free. - * size - pointer to size of area - * - * Output parameters: - * size - size of area filled in - * TRUE - if starting_address is valid heap address - * FALSE - if starting_address is invalid heap address - */ - -boolean _Heap_Size_of_user_area( - Heap_Control *the_heap, - void *starting_address, - unsigned32 *size -) -{ - Heap_Block *the_block; - Heap_Block *next_block; - unsigned32 the_size; - - the_block = _Heap_User_block_at( starting_address ); - - if ( !_Heap_Is_block_in( the_heap, the_block ) || - _Heap_Is_block_free( the_block ) ) - return( FALSE ); - - the_size = _Heap_Block_size( the_block ); - next_block = _Heap_Block_at( the_block, the_size ); - - if ( !_Heap_Is_block_in( the_heap, next_block ) || - (the_block->front_flag != next_block->back_flag) ) - return( FALSE ); - - *size = the_size; - return( TRUE ); -} - -/*PAGE - * - * _Heap_Free - * - * This kernel routine returns the memory designated by the - * given heap and given starting address to the memory pool. - * - * Input parameters: - * the_heap - pointer to heap header - * starting_address - starting address of the memory block to free. - * - * Output parameters: - * TRUE - if starting_address is valid heap address - * FALSE - if starting_address is invalid heap address - */ - -boolean _Heap_Free( - Heap_Control *the_heap, - void *starting_address -) -{ - Heap_Block *the_block; - Heap_Block *next_block; - Heap_Block *new_next_block; - Heap_Block *previous_block; - Heap_Block *temporary_block; - unsigned32 the_size; - - the_block = _Heap_User_block_at( starting_address ); - - if ( !_Heap_Is_block_in( the_heap, the_block ) || - _Heap_Is_block_free( the_block ) ) { - return( FALSE ); - } - - the_size = _Heap_Block_size( the_block ); - next_block = _Heap_Block_at( the_block, the_size ); - - if ( !_Heap_Is_block_in( the_heap, next_block ) || - (the_block->front_flag != next_block->back_flag) ) { - return( FALSE ); - } - - if ( _Heap_Is_previous_block_free( the_block ) ) { - previous_block = _Heap_Previous_block( the_block ); - - if ( !_Heap_Is_block_in( the_heap, previous_block ) ) { - return( FALSE ); - } - - if ( _Heap_Is_block_free( next_block ) ) { /* coalesce both */ - previous_block->front_flag += next_block->front_flag + the_size; - temporary_block = _Heap_Next_block( previous_block ); - temporary_block->back_flag = previous_block->front_flag; - next_block->next->previous = next_block->previous; - next_block->previous->next = next_block->next; - } - else { /* coalesce prev */ - previous_block->front_flag = - next_block->back_flag = previous_block->front_flag + the_size; - } - } - else if ( _Heap_Is_block_free( next_block ) ) { /* coalesce next */ - the_block->front_flag = the_size + next_block->front_flag; - new_next_block = _Heap_Next_block( the_block ); - new_next_block->back_flag = the_block->front_flag; - the_block->next = next_block->next; - the_block->previous = next_block->previous; - next_block->previous->next = the_block; - next_block->next->previous = the_block; - - if (the_heap->first == next_block) - the_heap->first = the_block; - } - else { /* no coalesce */ - next_block->back_flag = - the_block->front_flag = the_size; - the_block->previous = _Heap_Head( the_heap ); - the_block->next = the_heap->first; - the_heap->first = the_block; - the_block->next->previous = the_block; - } - - return( TRUE ); -} - -/*PAGE - * - * _Heap_Walk - * - * This kernel routine walks the heap and verifies its correctness. - * - * Input parameters: - * the_heap - pointer to heap header - * source - a numeric indicator of the invoker of this routine - * do_dump - when TRUE print the information - * - * Output parameters: NONE - */ - -#ifndef RTEMS_DEBUG - -void _Heap_Walk( - Heap_Control *the_heap, - int source, - boolean do_dump -) -{ -} - -#else - -#include <stdio.h> -#include <unistd.h> - -void _Heap_Walk( - Heap_Control *the_heap, - int source, - boolean do_dump -) -{ - Heap_Block *the_block = 0; /* avoid warnings */ - Heap_Block *next_block = 0; /* avoid warnings */ - int notdone = 1; - int error = 0; - int passes = 0; - - /* - * We don't want to allow walking the heap until we have - * transferred control to the user task so we watch the - * system state. - */ - - if ( !_System_state_Is_up( _System_state_Get() ) ) - return; - - the_block = the_heap->start; - - if (do_dump == TRUE) { - printf("\nPASS: %d start @ 0x%p final 0x%p, first 0x%p last 0x%p\n", - source, the_heap->start, the_heap->final, - the_heap->first, the_heap->last - ); - } - - /* - * Handle the 1st block - */ - - if (the_block->back_flag != HEAP_DUMMY_FLAG) { - printf("PASS: %d Back flag of 1st block isn't HEAP_DUMMY_FLAG\n", source); - error = 1; - } - - while (notdone) { - passes++; - if (error && (passes > 10)) - abort(); - - if (do_dump == TRUE) { - printf("PASS: %d Block @ 0x%p Back %d, Front %d", - source, the_block, - the_block->back_flag, the_block->front_flag); - if ( _Heap_Is_block_free(the_block) ) { - printf( " Prev 0x%p, Next 0x%p\n", - the_block->previous, the_block->next); - } else { - printf("\n"); - } - } - - /* - * Handle the last block - */ - - if ( the_block->front_flag != HEAP_DUMMY_FLAG ) { - next_block = _Heap_Next_block(the_block); - if ( the_block->front_flag != next_block->back_flag ) { - error = 1; - printf("PASS: %d Front and back flags don't match\n", source); - printf(" Current Block: Back - %d, Front - %d", - the_block->back_flag, the_block->front_flag); - if (do_dump == TRUE) { - if (_Heap_Is_block_free(the_block)) { - printf(" Prev 0x%p, Next 0x%p\n", - the_block->previous, the_block->next); - } else { - printf("\n"); - } - } else { - printf("\n"); - } - printf(" Next Block: Back - %d, Front - %d", - next_block->back_flag, next_block->front_flag); - if (do_dump == TRUE) { - if (_Heap_Is_block_free(next_block)) { - printf(" Prev 0x%p, Next 0x%p\n", - the_block->previous, the_block->next); - } else { - printf("\n"); - } - } else { - printf("\n"); - } - } - } - - if (the_block->front_flag == HEAP_DUMMY_FLAG) - notdone = 0; - else - the_block = next_block; - } - - if (error) - abort(); -} -#endif diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c deleted file mode 100644 index 04a77fbe37..0000000000 --- a/cpukit/score/src/interr.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Internal Error Handler - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/interr.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/userext.h> - -/*PAGE - * - * _Internal_error_Occurred - * - * This routine will invoke the fatal error handler supplied by the user - * followed by the the default one provided by the executive. The default - * error handler assumes no hardware is present to help inform the user - * of the problem. Halt stores the error code in a known register, - * disables interrupts, and halts the CPU. If the CPU does not have a - * halt instruction, it will loop to itself. - * - * Input parameters: - * the_source - what subsystem the error originated in - * is_internal - if the error was internally generated - * the_error - fatal error status code - * - * Output parameters: - * As much information as possible is stored in a CPU dependent fashion. - * See the CPU dependent code for more information. - * - * NOTE: The the_error is not necessarily a directive status code. - */ - -void volatile _Internal_error_Occurred( - Internal_errors_Source the_source, - boolean is_internal, - unsigned32 the_error -) -{ - - Internal_errors_What_happened.the_source = the_source; - Internal_errors_What_happened.is_internal = is_internal; - Internal_errors_What_happened.the_error = the_error; - - _User_extensions_Fatal( the_source, is_internal, the_error ); - - _System_state_Set( SYSTEM_STATE_FAILED ); - - _CPU_Fatal_halt( the_error ); - - /* will not return from this routine */ -} diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c deleted file mode 100644 index afc4cdcf38..0000000000 --- a/cpukit/score/src/isr.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ISR Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/stack.h> -#include <rtems/score/interr.h> -#include <rtems/score/wkspace.h> - -/* _ISR_Handler_initialization - * - * This routine initializes the ISR handler. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -void _ISR_Handler_initialization( void ) -{ - _ISR_Signals_to_thread_executing = FALSE; - - _ISR_Nest_level = 0; - -#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE ) - - if ( _CPU_Table.interrupt_stack_size < STACK_MINIMUM_SIZE ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL - ); - - _CPU_Interrupt_stack_low = - _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size ); - - _CPU_Interrupt_stack_high = _Addresses_Add_offset( - _CPU_Interrupt_stack_low, - _CPU_Table.interrupt_stack_size - ); - -#endif - -#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE ) - _CPU_Install_interrupt_stack(); -#endif - -} diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c deleted file mode 100644 index c3090aacc1..0000000000 --- a/cpukit/score/src/mpci.c +++ /dev/null @@ -1,524 +0,0 @@ -/* - * Multiprocessing Communications Interface (MPCI) Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/cpu.h> -#include <rtems/score/interr.h> -#include <rtems/score/mpci.h> -#include <rtems/score/mppkt.h> -#include <rtems/score/states.h> -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/tqdata.h> -#include <rtems/score/watchdog.h> -#include <rtems/score/sysstate.h> - -#include <rtems/score/coresem.h> - -/*PAGE - * - * _MPCI_Handler_initialization - * - * This subprogram performs the initialization necessary for this handler. - */ - -void _MPCI_Handler_initialization( - MPCI_Control *users_mpci_table, - unsigned32 timeout_status -) -{ - CORE_semaphore_Attributes attributes; - - if ( _System_state_Is_multiprocessing && !users_mpci_table ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_NO_MPCI - ); - - _MPCI_table = users_mpci_table; - - if ( !_System_state_Is_multiprocessing ) - return; - - /* - * Register the MP Process Packet routine. - */ - - _MPCI_Register_packet_processor( - MP_PACKET_MPCI_INTERNAL, - _MPCI_Internal_packets_Process_packet - ); - - /* - * Create the counting semaphore used by the MPCI Receive Server. - */ - - attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; - - _CORE_semaphore_Initialize( - &_MPCI_Semaphore, - OBJECTS_NO_CLASS, /* free floating semaphore */ - &attributes, /* the_semaphore_attributes */ - 0, /* initial_value */ - NULL /* proxy_extract_callout */ - ); - - _Thread_queue_Initialize( - &_MPCI_Remote_blocked_threads, - OBJECTS_NO_CLASS, - THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_RPC_REPLY, - NULL, - timeout_status - ); -} - -/*PAGE - * - * _MPCI_Create_server - * - * This subprogram creates the MPCI receive server. - */ - -char *_MPCI_Internal_name = "MPCI"; - -void _MPCI_Create_server( void ) -{ - - if ( !_System_state_Is_multiprocessing ) - return; - - /* - * Initialize the MPCI Receive Server - */ - - _MPCI_Receive_server_tcb = _Thread_Internal_allocate(); - - _Thread_Initialize( - &_Thread_Internal_information, - _MPCI_Receive_server_tcb, - NULL, /* allocate the stack */ - MPCI_RECEIVE_SERVER_STACK_SIZE, - CPU_ALL_TASKS_ARE_FP, - PRIORITY_MINIMUM, - FALSE, /* no preempt */ - FALSE, /* not timesliced */ - 0, /* all interrupts enabled */ - _MPCI_Internal_name - ); - - _Thread_Start( - _MPCI_Receive_server_tcb, - THREAD_START_NUMERIC, - _MPCI_Receive_server, - NULL, - 0 - ); -} - -/*PAGE - * - * _MPCI_Initialization - * - * This subprogram initializes the MPCI driver by - * invoking the user provided MPCI initialization callout. - */ - -void _MPCI_Initialization ( void ) -{ - (*_MPCI_table->initialization)(); -} - -/*PAGE - * - * _MPCI_Register_packet_processor - * - * This routine registers the MPCI packet processor for the - * designated object class. - */ - -void _MPCI_Register_packet_processor( - Objects_Classes the_class, - MPCI_Packet_processor the_packet_processor - -) -{ - _MPCI_Packet_processors[ the_class ] = the_packet_processor; -} - -/*PAGE - * - * _MPCI_Get_packet - * - * This subprogram obtains a packet by invoking the user provided - * MPCI get packet callout. - */ - -MP_packet_Prefix *_MPCI_Get_packet ( void ) -{ - MP_packet_Prefix *the_packet; - - (*_MPCI_table->get_packet)( &the_packet ); - - if ( the_packet == NULL ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_OUT_OF_PACKETS - ); - - /* - * Put in a default timeout that will be used for - * all packets that do not otherwise have a timeout. - */ - - the_packet->timeout = MPCI_DEFAULT_TIMEOUT; - - return the_packet; -} - -/*PAGE - * - * _MPCI_Return_packet - * - * This subprogram returns a packet by invoking the user provided - * MPCI return packet callout. - */ - -void _MPCI_Return_packet ( - MP_packet_Prefix *the_packet -) -{ - (*_MPCI_table->return_packet)( the_packet ); -} - -/*PAGE - * - * _MPCI_Send_process_packet - * - * This subprogram sends a process packet by invoking the user provided - * MPCI send callout. - */ - -void _MPCI_Send_process_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet -) -{ - the_packet->source_tid = _Thread_Executing->Object.id; - the_packet->to_convert = - ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / - sizeof(unsigned32); - - (*_MPCI_table->send_packet)( destination, the_packet ); -} - -/*PAGE - * - * _MPCI_Send_request_packet - * - * This subprogram sends a request packet by invoking the user provided - * MPCI send callout. - */ - -unsigned32 _MPCI_Send_request_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet, - States_Control extra_state -) -{ - the_packet->source_tid = _Thread_Executing->Object.id; - the_packet->source_priority = _Thread_Executing->current_priority; - the_packet->to_convert = - ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / - sizeof(unsigned32); - - _Thread_Executing->Wait.id = the_packet->id; - - _Thread_Executing->Wait.queue = &_MPCI_Remote_blocked_threads; - - _Thread_Disable_dispatch(); - - (*_MPCI_table->send_packet)( destination, the_packet ); - - _Thread_queue_Enter_critical_section( &_MPCI_Remote_blocked_threads ); - - /* - * See if we need a default timeout - */ - - if (the_packet->timeout == MPCI_DEFAULT_TIMEOUT) - the_packet->timeout = _MPCI_table->default_timeout; - - _Thread_queue_Enqueue( &_MPCI_Remote_blocked_threads, the_packet->timeout ); - - _Thread_Executing->current_state = - _States_Set( extra_state, _Thread_Executing->current_state ); - - _Thread_Enable_dispatch(); - - return _Thread_Executing->Wait.return_code; -} - -/*PAGE - * - * _MPCI_Send_response_packet - * - * This subprogram sends a response packet by invoking the user provided - * MPCI send callout. - */ - -void _MPCI_Send_response_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet -) -{ - the_packet->source_tid = _Thread_Executing->Object.id; - - (*_MPCI_table->send_packet)( destination, the_packet ); -} - -/*PAGE - * - * _MPCI_Receive_packet - * - * This subprogram receives a packet by invoking the user provided - * MPCI receive callout. - */ - -MP_packet_Prefix *_MPCI_Receive_packet ( void ) -{ - MP_packet_Prefix *the_packet; - - (*_MPCI_table->receive_packet)( &the_packet ); - - return the_packet; -} - -/*PAGE - * - * _MPCI_Process_response - * - * This subprogram obtains a packet by invoking the user provided - * MPCI get packet callout. - */ - -Thread_Control *_MPCI_Process_response ( - MP_packet_Prefix *the_packet -) -{ - Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _Thread_Get( the_packet->id, &location ); - switch ( location ) { - case OBJECTS_ERROR: - case OBJECTS_REMOTE: - the_thread = NULL; /* IMPOSSIBLE */ - break; - case OBJECTS_LOCAL: - _Thread_queue_Extract( &_MPCI_Remote_blocked_threads, the_thread ); - the_thread->Wait.return_code = the_packet->return_code; - _Thread_Unnest_dispatch(); - break; - } - - return the_thread; -} - -/*PAGE - * - * _MPCI_Receive_server - * - */ - -Thread _MPCI_Receive_server( - unsigned32 ignored -) -{ - - MP_packet_Prefix *the_packet; - MPCI_Packet_processor the_function; - Thread_Control *executing; - - executing = _Thread_Executing; - - for ( ; ; ) { - - executing->receive_packet = NULL; - - _Thread_Disable_dispatch(); - _CORE_semaphore_Seize( &_MPCI_Semaphore, 0, TRUE, WATCHDOG_NO_TIMEOUT ); - _Thread_Enable_dispatch(); - - for ( ; ; ) { - the_packet = _MPCI_Receive_packet(); - - if ( !the_packet ) - break; - - executing->receive_packet = the_packet; - - if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) ) - break; - - the_function = _MPCI_Packet_processors[ the_packet->the_class ]; - - if ( !the_function ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_BAD_PACKET - ); - - (*the_function)( the_packet ); - } - } -} - -/*PAGE - * - * _MPCI_Announce - * - */ - -void _MPCI_Announce ( void ) -{ - _Thread_Disable_dispatch(); - (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, 0, 0 ); - _Thread_Enable_dispatch(); -} - -/*PAGE - * - * _MPCI_Internal_packets_Send_process_packet - * - */ - -void _MPCI_Internal_packets_Send_process_packet ( - MPCI_Internal_Remote_operations operation -) -{ - MPCI_Internal_packet *the_packet; - - switch ( operation ) { - - case MPCI_PACKETS_SYSTEM_VERIFY: - - the_packet = _MPCI_Internal_packets_Get_packet(); - the_packet->Prefix.the_class = MP_PACKET_MPCI_INTERNAL; - the_packet->Prefix.length = sizeof ( MPCI_Internal_packet ); - the_packet->Prefix.to_convert = sizeof ( MPCI_Internal_packet ); - the_packet->operation = operation; - - the_packet->maximum_nodes = _Objects_Maximum_nodes; - - the_packet->maximum_global_objects = _Objects_MP_Maximum_global_objects; - - _MPCI_Send_process_packet( MPCI_ALL_NODES, &the_packet->Prefix ); - break; - } -} - -/*PAGE - * - * _MPCI_Internal_packets_Send_request_packet - * - * This subprogram is not needed since there are no request - * packets to be sent by this manager. - * - */ - -/*PAGE - * - * _MPCI_Internal_packets_Send_response_packet - * - * This subprogram is not needed since there are no response - * packets to be sent by this manager. - * - */ - -/*PAGE - * - * - * _MPCI_Internal_packets_Process_packet - * - */ - -void _MPCI_Internal_packets_Process_packet ( - MP_packet_Prefix *the_packet_prefix -) -{ - MPCI_Internal_packet *the_packet; - unsigned32 maximum_nodes; - unsigned32 maximum_global_objects; - - the_packet = (MPCI_Internal_packet *) the_packet_prefix; - - switch ( the_packet->operation ) { - - case MPCI_PACKETS_SYSTEM_VERIFY: - - maximum_nodes = the_packet->maximum_nodes; - maximum_global_objects = the_packet->maximum_global_objects; - if ( maximum_nodes != _Objects_Maximum_nodes || - maximum_global_objects != _Objects_MP_Maximum_global_objects ) { - - _MPCI_Return_packet( the_packet_prefix ); - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION - ); - } - - _MPCI_Return_packet( the_packet_prefix ); - - break; - } -} - -/*PAGE - * - * _MPCI_Internal_packets_Send_object_was_deleted - * - * This subprogram is not needed since there are no objects - * deleted by this manager. - * - */ - -/*PAGE - * - * _MPCI_Internal_packets_Send_extract_proxy - * - * This subprogram is not needed since there are no objects - * deleted by this manager. - * - */ - -/*PAGE - * - * _MPCI_Internal_packets_Get_packet - * - */ - -MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void ) -{ - return ( (MPCI_Internal_packet *) _MPCI_Get_packet() ); -} - -/* end of file */ diff --git a/cpukit/score/src/object.c b/cpukit/score/src/object.c deleted file mode 100644 index 4f672086fe..0000000000 --- a/cpukit/score/src/object.c +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#include <rtems/score/objectmp.h> -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> - -/*PAGE - * - * _Objects_Handler_initialization - * - * This routine initializes the object handler. - * - * Input parameters: - * node - local node - * maximum_nodes - number of nodes in the system - * maximum_global_objects - number of configured global objects - * - * Output parameters: NONE - */ - -void _Objects_Handler_initialization( - unsigned32 node, - unsigned32 maximum_nodes, - unsigned32 maximum_global_objects -) -{ - if ( node < 1 || node > maximum_nodes ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_INVALID_NODE - ); - - _Objects_Local_node = node; - _Objects_Maximum_nodes = maximum_nodes; - - _Objects_MP_Handler_initialization( - node, - maximum_nodes, - maximum_global_objects - ); -} - -/*PAGE - * - * _Objects_Initialize_information - * - * This routine initializes all object information related data structures. - * - * Input parameters: - * information - object information table - * the_class - object class - * supports_global - TRUE if this is a global object class - * maximum - maximum objects of this class - * is_string - TRUE if names for this object are strings - * size - size of this object's control block - * - * Output parameters: NONE - */ - -void _Objects_Initialize_information( - Objects_Information *information, - Objects_Classes the_class, - boolean supports_global, - unsigned32 maximum, - unsigned32 size, - boolean is_string, - unsigned32 maximum_name_length, - boolean is_thread -) -{ - unsigned32 minimum_index; - unsigned32 index; - Objects_Control *the_object; - unsigned32 name_length; - void *name_area; - - information->maximum = maximum; - information->the_class = the_class; - information->is_string = is_string; - information->is_thread = is_thread; - - /* - * Set the entry in the object information table. - */ - - _Objects_Information_table[ the_class ] = information; - - /* - * Calculate minimum and maximum Id's - */ - - if ( maximum == 0 ) minimum_index = 0; - else minimum_index = 1; - - information->minimum_id = - _Objects_Build_id( the_class, _Objects_Local_node, minimum_index ); - - information->maximum_id = - _Objects_Build_id( the_class, _Objects_Local_node, maximum ); - - /* - * Allocate local pointer table - */ - - information->local_table = _Workspace_Allocate_or_fatal_error( - (maximum + 1) * sizeof(Objects_Control *) - ); - - /* - * Allocate name table - */ - - name_length = maximum_name_length; - - if (name_length & (OBJECTS_NAME_ALIGNMENT-1)) - name_length = (name_length + OBJECTS_NAME_ALIGNMENT) & - ~(OBJECTS_NAME_ALIGNMENT-1); - - information->name_length = name_length; - - name_area = _Workspace_Allocate_or_fatal_error( (maximum + 1) * name_length ); - information->name_table = name_area; - - /* - * Initialize local pointer table - */ - - for ( index=0 ; index <= maximum ; index++ ) { - information->local_table[ index ] = NULL; - } - - /* - * Initialize objects .. if there are any - */ - - if ( maximum == 0 ) { - _Chain_Initialize_empty( &information->Inactive ); - } else { - - _Chain_Initialize( - &information->Inactive, - _Workspace_Allocate_or_fatal_error( maximum * size ), - maximum, - size - ); - - the_object = (Objects_Control *) information->Inactive.first; - for ( index=1; index <= maximum ; index++ ) { - the_object->id = - _Objects_Build_id( the_class, _Objects_Local_node, index ); - - the_object->name = (void *) name_area; - - name_area = _Addresses_Add_offset( name_area, name_length ); - - the_object = (Objects_Control *) the_object->Node.next; - } - - } - - /* - * Take care of multiprocessing - */ - - if ( supports_global == TRUE && _System_state_Is_multiprocessing ) { - - information->global_table = _Workspace_Allocate_or_fatal_error( - (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control) - ); - - for ( index=1; index <= _Objects_Maximum_nodes ; index++ ) - _Chain_Initialize_empty( &information->global_table[ index ] ); - } - else - information->global_table = NULL; -} - -/*PAGE - * - * _Objects_Clear_name - * - * XXX - */ - -void _Objects_Clear_name( - void *name, - unsigned32 length -) -{ - unsigned32 index; - unsigned32 maximum = length / OBJECTS_NAME_ALIGNMENT; - unsigned32 *name_ptr = name; - - for ( index=0 ; index < maximum ; index++ ) - *name_ptr++ = 0; -} - -/*PAGE - * - * _Objects_Copy_name_string - * - * XXX - */ - -void _Objects_Copy_name_string( - void *source, - void *destination -) -{ - unsigned8 *source_p = source; - unsigned8 *destination_p = destination; - - do { - *destination_p++ = *source_p; - } while ( *source_p++ ); -} - -/*PAGE - * - * _Objects_Copy_name_raw - * - * XXX - */ - -void _Objects_Copy_name_raw( - void *source, - void *destination, - unsigned32 length -) -{ - unsigned32 *source_p = source; - unsigned32 *destination_p = destination; - unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT; - - while ( tmp_length-- ) - *destination_p++ = *source_p++; -} - -/*PAGE - * - * _Objects_Compare_name_string - * - * XXX - */ - -boolean _Objects_Compare_name_string( - void *name_1, - void *name_2, - unsigned32 length -) -{ - unsigned8 *name_1_p = name_1; - unsigned8 *name_2_p = name_2; - unsigned32 tmp_length = length; - - do { - if ( *name_1_p++ != *name_2_p++ ) - return FALSE; - if ( !tmp_length-- ) - return FALSE; - } while ( *name_1_p ); - - return TRUE; -} - -/*PAGE - * - * _Objects_Compare_name_raw - * - * XXX - */ - -boolean _Objects_Compare_name_raw( - void *name_1, - void *name_2, - unsigned32 length -) -{ - unsigned32 *name_1_p = name_1; - unsigned32 *name_2_p = name_2; - unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT; - - while ( tmp_length-- ) - if ( *name_1_p++ != *name_2_p++ ) - return FALSE; - - return TRUE; -} - - -/*PAGE - * - * _Objects_Name_to_id - * - * These kernel routines search the object table(s) for the given - * object name and returns the associated object id. - * - * Input parameters: - * information - object information - * name - user defined object name - * node - node indentifier (0 indicates any node) - * id - address of return ID - * - * Output parameters: - * id - object id - * OBJECTS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - -Objects_Name_to_id_errors _Objects_Name_to_id( - Objects_Information *information, - Objects_Name name, - unsigned32 node, - Objects_Id *id -) -{ - boolean search_local_node; - Objects_Control **objects; - Objects_Control *the_object; - unsigned32 index; - unsigned32 name_length; - Objects_Name_comparators compare_them; - - if ( name == 0 ) - return OBJECTS_INVALID_NAME; - - search_local_node = FALSE; - - if ( information->maximum != 0 && - (node == OBJECTS_SEARCH_ALL_NODES || node == OBJECTS_SEARCH_LOCAL_NODE || - _Objects_Is_local_node( node ) ) ) - search_local_node = TRUE; - - if ( search_local_node ) { - objects = information->local_table; - - name_length = information->name_length; - - if ( information->is_string ) compare_them = _Objects_Compare_name_string; - else compare_them = _Objects_Compare_name_raw; - - for ( index = 1; index <= information->maximum; index++ ) { - - the_object = objects[ index ]; - - if ( !the_object || !the_object->name ) - continue; - - if ( (*compare_them)( name, the_object->name, name_length ) ) { - *id = the_object->id; - return OBJECTS_SUCCESSFUL; - } - } - } - - if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE ) - return OBJECTS_INVALID_NAME; - - return ( _Objects_MP_Global_name_search( information, name, node, id ) ); -} - -/*PAGE - * - * _Objects_Get - * - * This routine sets the object pointer for the given - * object id based on the given object information structure. - * - * Input parameters: - * information - pointer to entry in table for this class - * id - object id to search for - * location - address of where to store the location - * - * Output parameters: - * returns - address of object if local - * location - one of the following: - * OBJECTS_ERROR - invalid object ID - * OBJECTS_REMOTE - remote object - * OBJECTS_LOCAL - local object - */ - -Objects_Control *_Objects_Get( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location -) -{ - Objects_Control *the_object; - unsigned32 index; - - index = id - information->minimum_id; - - if ( information->maximum >= index ) { - _Thread_Disable_dispatch(); - if ( (the_object = information->local_table[index+1]) != NULL ) { - *location = OBJECTS_LOCAL; - return( the_object ); - } - _Thread_Enable_dispatch(); - *location = OBJECTS_ERROR; - return( NULL ); - } - *location = OBJECTS_ERROR; - _Objects_MP_Is_remote( information, id, location, &the_object ); - return the_object; -} - - -/*PAGE - * - * _Objects_Get_next - * - * Like _Objects_Get, but considers the 'id' as a "hint" and - * finds next valid one after that point. - * Mostly used for monitor and debug traversal of an object. - * - * Input parameters: - * information - pointer to entry in table for this class - * id - object id to search for - * location - address of where to store the location - * next_id - address to store next id to try - * - * Output parameters: - * returns - address of object if local - * location - one of the following: - * OBJECTS_ERROR - invalid object ID - * OBJECTS_REMOTE - remote object - * OBJECTS_LOCAL - local object - * next_id - will contain a reasonable "next" id to continue traversal - * - * NOTE: - * assumes can add '1' to an id to get to next index. - */ - -Objects_Control * -_Objects_Get_next( - Objects_Information *information, - Objects_Id id, - unsigned32 *location_p, - Objects_Id *next_id_p -) -{ - Objects_Control *object; - Objects_Id next_id; - - if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX) - next_id = information->minimum_id; - else - next_id = id; - - do { - /* walked off end of list? */ - if (_Objects_Get_index(next_id) > information->maximum) - { - *location_p = OBJECTS_ERROR; - goto final; - } - - /* try to grab one */ - object = _Objects_Get(information, next_id, location_p); - - next_id++; - - } while (*location_p != OBJECTS_LOCAL); - - *next_id_p = next_id; - return object; - -final: - *next_id_p = OBJECTS_ID_FINAL; - return 0; -} - -/*PAGE - * - * _Objects_Get_information - * - * XXX - */ - -Objects_Information *_Objects_Get_information( - Objects_Id id -) -{ - Objects_Classes the_class; - - the_class = _Objects_Get_class( id ); - - if ( !_Objects_Is_class_valid( the_class ) ) - return NULL; - - return _Objects_Information_table[ the_class ]; -} - diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c deleted file mode 100644 index 7546c33585..0000000000 --- a/cpukit/score/src/objectmp.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Multiprocessing Support for the Object Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/interr.h> -#include <rtems/score/object.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/thread.h> - -/*PAGE - * - * _Objects_MP_Handler_initialization - * - */ - -void _Objects_MP_Handler_initialization ( - unsigned32 node, - unsigned32 maximum_nodes, - unsigned32 maximum_global_objects -) -{ - _Objects_MP_Maximum_global_objects = maximum_global_objects; - - if ( maximum_global_objects == 0 ) { - _Chain_Initialize_empty( &_Objects_MP_Inactive_global_objects ); - return; - } - - _Chain_Initialize( - &_Objects_MP_Inactive_global_objects, - _Workspace_Allocate_or_fatal_error( - maximum_global_objects * sizeof( Objects_MP_Control ) - ), - maximum_global_objects, - sizeof( Objects_MP_Control ) - ); - -} - -/*PAGE - * - * _Objects_MP_Open - * - */ - -void _Objects_MP_Open ( - Objects_Information *information, - Objects_MP_Control *the_global_object, - unsigned32 the_name, /* XXX -- wrong for variable */ - Objects_Id the_id -) -{ - the_global_object->Object.id = the_id; - the_global_object->name = the_name; - - _Chain_Prepend( - &information->global_table[ _Objects_Get_node( the_id ) ], - &the_global_object->Object.Node - ); - -} - -/*PAGE - * - * _Objects_MP_Allocate_and_open - * - */ - -boolean _Objects_MP_Allocate_and_open ( - Objects_Information *information, - unsigned32 the_name, /* XXX -- wrong for variable */ - Objects_Id the_id, - boolean is_fatal_error -) -{ - Objects_MP_Control *the_global_object; - - the_global_object = _Objects_MP_Allocate_global_object(); - if ( _Objects_MP_Is_null_global_object( the_global_object ) ) { - - if ( is_fatal_error == FALSE ) - return FALSE; - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS - ); - - } - - _Objects_MP_Open( information, the_global_object, the_name, the_id ); - - return TRUE; -} - -/*PAGE - * - * _Objects_MP_Close - * - */ - -void _Objects_MP_Close ( - Objects_Information *information, - Objects_Id the_id -) -{ - Chain_Control *the_chain; - Chain_Node *the_node; - Objects_MP_Control *the_object; - - the_chain = &information->global_table[ _Objects_Get_node( the_id ) ]; - - for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; - the_node = the_node->next ) { - - the_object = (Objects_MP_Control *) the_node; - - if ( _Objects_Are_ids_equal( the_object->Object.id, the_id ) ) { - - _Chain_Extract( the_node ); - _Objects_MP_Free_global_object( the_object ); - return; - } - - } - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_INVALID_GLOBAL_ID - ); -} - -/*PAGE - * - * _Objects_MP_Global_name_search - * - */ - -Objects_Name_to_id_errors _Objects_MP_Global_name_search ( - Objects_Information *information, - Objects_Name the_name, - unsigned32 nodes_to_search, - Objects_Id *the_id -) -{ - unsigned32 low_node; - unsigned32 high_node; - unsigned32 node_index; - Chain_Control *the_chain; - Chain_Node *the_node; - Objects_MP_Control *the_object; - unsigned32 name_to_use = *(unsigned32 *)the_name; /* XXX variable */ - - if ( nodes_to_search > _Objects_Maximum_nodes ) - return OBJECTS_INVALID_NODE; - - if ( information->global_table == NULL ) - return OBJECTS_INVALID_NAME; - - if ( nodes_to_search == OBJECTS_SEARCH_ALL_NODES || - nodes_to_search == OBJECTS_SEARCH_OTHER_NODES ) { - low_node = 1; - high_node = _Objects_Maximum_nodes; - } else { - low_node = - high_node = nodes_to_search; - } - - _Thread_Disable_dispatch(); - - for ( node_index = low_node ; node_index <= high_node ; node_index++ ) { - - /* - * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. - */ - - if ( !_Objects_Is_local_node( node_index ) ) { - the_chain = &information->global_table[ node_index ]; - - for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; - the_node = the_node->next ) { - - the_object = (Objects_MP_Control *) the_node; - - if ( the_object->name == name_to_use ) { - *the_id = the_object->Object.id; - _Thread_Enable_dispatch(); - return OBJECTS_SUCCESSFUL; - } - } - } - } - - _Thread_Enable_dispatch(); - return OBJECTS_INVALID_NAME; -} - -/*PAGE - * - * _Objects_MP_Is_remote - * - */ - -void _Objects_MP_Is_remote ( - Objects_Information *information, - Objects_Id the_id, - Objects_Locations *location, - Objects_Control **the_object -) -{ - unsigned32 node; - Chain_Control *the_chain; - Chain_Node *the_node; - Objects_MP_Control *the_global_object; - - node = _Objects_Get_node( the_id ); - - /* - * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. - * - * The NODE field of an object id cannot be 0 - * because 0 is an invalid node number. - */ - - if ( node == 0 || - _Objects_Is_local_node( node ) || - node > _Objects_Maximum_nodes || - information->global_table == NULL ) { - - *location = OBJECTS_ERROR; - *the_object = NULL; - return; - } - - _Thread_Disable_dispatch(); - - the_chain = &information->global_table[ node ]; - - for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; - the_node = the_node->next ) { - - the_global_object = (Objects_MP_Control *) the_node; - - if ( _Objects_Are_ids_equal( the_global_object->Object.id, the_id ) ) { - _Thread_Unnest_dispatch(); - *location = OBJECTS_REMOTE; - *the_object = (Objects_Control *) the_global_object; - return; - } - } - - _Thread_Enable_dispatch(); - *location = OBJECTS_ERROR; - *the_object = NULL; - -} diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c deleted file mode 100644 index 79fa859cbe..0000000000 --- a/cpukit/score/src/thread.c +++ /dev/null @@ -1,1171 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/apiext.h> -#include <rtems/score/context.h> -#include <rtems/score/interr.h> -#include <rtems/score/isr.h> -#include <rtems/score/object.h> -#include <rtems/score/priority.h> -#include <rtems/score/states.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/userext.h> -#include <rtems/score/wkspace.h> - -/*PAGE - * - * _Thread_Handler_initialization - * - * This routine initializes all thread manager related data structures. - * - * Input parameters: - * ticks_per_timeslice - clock ticks per quantum - * maximum_proxies - number of proxies to initialize - * - * Output parameters: NONE - */ - -char *_Thread_Idle_name = "IDLE"; - -void _Thread_Handler_initialization( - unsigned32 ticks_per_timeslice, - unsigned32 maximum_extensions, - unsigned32 maximum_proxies -) -{ - unsigned32 index; - - _Context_Switch_necessary = FALSE; - _Thread_Executing = NULL; - _Thread_Heir = NULL; - _Thread_Allocated_fp = NULL; - - _Thread_Maximum_extensions = maximum_extensions; - - _Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice; - _Thread_Ticks_per_timeslice = ticks_per_timeslice; - - _Thread_Ready_chain = _Workspace_Allocate_or_fatal_error( - (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control) - ); - - for ( index=0; index <= PRIORITY_MAXIMUM ; index++ ) - _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] ); - - _Thread_MP_Handler_initialization( maximum_proxies ); - - /* - * Initialize this class of objects. - */ - - _Objects_Initialize_information( - &_Thread_Internal_information, - OBJECTS_INTERNAL_THREADS, - FALSE, - ( _System_state_Is_multiprocessing ) ? 2 : 1, - sizeof( Thread_Control ), - TRUE, - 8, - TRUE - ); - -} - -/*PAGE - * - * _Thread_Create_idle - */ - -void _Thread_Create_idle( void ) -{ - void *idle; - - /* - * The entire workspace is zeroed during its initialization. Thus, all - * fields not explicitly assigned were explicitly zeroed by - * _Workspace_Initialization. - */ - - _Thread_Idle = _Thread_Internal_allocate(); - - /* - * Initialize the IDLE task. - */ - -#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE) - idle = _CPU_Thread_Idle_body; -#else - idle = _Thread_Idle_body; -#endif - - if ( _CPU_Table.idle_task ) - idle = _CPU_Table.idle_task; - - _Thread_Initialize( - &_Thread_Internal_information, - _Thread_Idle, - NULL, /* allocate the stack */ - THREAD_IDLE_STACK_SIZE, - CPU_IDLE_TASK_IS_FP, - PRIORITY_MAXIMUM, - TRUE, /* preemptable */ - FALSE, /* not timesliced */ - 0, /* all interrupts enabled */ - _Thread_Idle_name - ); - - /* - * WARNING!!! This is necessary to "kick" start the system and - * MUST be done before _Thread_Start is invoked. - */ - - _Thread_Heir = - _Thread_Executing = _Thread_Idle; - - _Thread_Start( - _Thread_Idle, - THREAD_START_NUMERIC, - idle, - NULL, - 0 - ); - -} - -/*PAGE - * - * _Thread_Start_multitasking - * - * This kernel routine readies the requested thread, the thread chain - * is adjusted. A new heir thread may be selected. - * - * Input parameters: - * system_thread - pointer to system initialization thread control block - * idle_thread - pointer to idle thread control block - * - * Output parameters: NONE - * - * NOTE: This routine uses the "blocking" heir selection mechanism. - * This insures the correct heir after a thread restart. - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Start_multitasking( void ) -{ - /* - * The system is now multitasking and completely initialized. - * This system thread now either "goes away" in a single processor - * system or "turns into" the server thread in an MP system. - */ - - _System_state_Set( SYSTEM_STATE_UP ); - - _Context_Switch_necessary = FALSE; - - _Thread_Executing = _Thread_Heir; - - _Context_Switch( &_Thread_BSP_context, &_Thread_Executing->Registers ); -} - -/*PAGE - * - * _Thread_Dispatch - * - * This kernel routine determines if a dispatch is needed, and if so - * dispatches to the heir thread. Once the heir is running an attempt - * is made to dispatch any ASRs. - * - * ALTERNATE ENTRY POINTS: - * void _Thread_Enable_dispatch(); - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * dispatch thread - * no dispatch thread - */ - -#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) -void _Thread_Enable_dispatch( void ) -{ - if ( --_Thread_Dispatch_disable_level ) - return; - _Thread_Dispatch(); -} -#endif - -void _Thread_Dispatch( void ) -{ - Thread_Control *executing; - Thread_Control *heir; - ISR_Level level; - - executing = _Thread_Executing; - _ISR_Disable( level ); - while ( _Context_Switch_necessary == TRUE ) { - heir = _Thread_Heir; - _Thread_Dispatch_disable_level = 1; - _Context_Switch_necessary = FALSE; - _Thread_Executing = heir; - _ISR_Enable( level ); - - _User_extensions_Thread_switch( executing, heir ); - - _Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice; - - /* - * If the CPU has hardware floating point, then we must address saving - * and restoring it as part of the context switch. - * - * The second conditional compilation section selects the algorithm used - * to context switch between floating point tasks. The deferred algorithm - * can be significantly better in a system with few floating point tasks - * because it reduces the total number of save and restore FP context - * operations. However, this algorithm can not be used on all CPUs due - * to unpredictable use of FP registers by some compilers for integer - * operations. - */ - -#if ( CPU_HARDWARE_FP == TRUE ) -#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) - if ( (heir->fp_context != NULL) && !_Thread_Is_allocated_fp( heir ) ) { - if ( _Thread_Allocated_fp != NULL ) - _Context_Save_fp( &_Thread_Allocated_fp->fp_context ); - _Context_Restore_fp( &heir->fp_context ); - _Thread_Allocated_fp = heir; - } -#else - if ( executing->fp_context != NULL ) - _Context_Save_fp( &executing->fp_context ); - - if ( heir->fp_context != NULL ) - _Context_Restore_fp( &heir->fp_context ); -#endif -#endif - - _Context_Switch( &executing->Registers, &heir->Registers ); - - executing = _Thread_Executing; - - _ISR_Disable( level ); - } - - _Thread_Dispatch_disable_level = 0; - - _ISR_Enable( level ); - - if ( executing->do_post_task_switch_extension ) { - executing->do_post_task_switch_extension = FALSE; - _API_extensions_Run_postswitch(); - } - -} - -/*PAGE - * - * _Thread_Initialize - * - * XXX - */ - -boolean _Thread_Initialize( - Objects_Information *information, - Thread_Control *the_thread, - void *stack_area, /* NULL if to be allocated */ - unsigned32 stack_size, /* insure it is >= min */ - boolean is_fp, /* TRUE if thread uses FP */ - Priority_Control priority, - boolean is_preemptible, - boolean is_timeslice, - unsigned32 isr_level, - Objects_Name name - -) -{ - unsigned32 actual_stack_size; - void *stack; - void *fp_area; - void *extensions_area; - - /* - * Allocate and Initialize the stack for this thread. - */ - - if ( !_Stack_Is_enough( stack_size ) ) - actual_stack_size = STACK_MINIMUM_SIZE; - else - actual_stack_size = stack_size; - - actual_stack_size = _Stack_Adjust_size( actual_stack_size ); - stack = stack_area; - - if ( !stack ) { - stack = _Workspace_Allocate( actual_stack_size ); - - if ( !stack ) - return FALSE; - - the_thread->Start.stack = stack; - } else - the_thread->Start.stack = NULL; - - _Stack_Initialize( - &the_thread->Start.Initial_stack, - stack, - actual_stack_size - ); - - /* - * Allocate the floating point area for this thread - */ - - if ( is_fp ) { - - fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE ); - if ( !fp_area ) { - if ( the_thread->Start.stack ) - (void) _Workspace_Free( the_thread->Start.stack ); - return FALSE; - } - fp_area = _Context_Fp_start( fp_area, 0 ); - - } else - fp_area = NULL; - - the_thread->fp_context = fp_area; - the_thread->Start.fp_context = fp_area; - - - /* - * Allocate the floating point area for this thread - */ - - if ( _Thread_Maximum_extensions ) { - extensions_area = _Workspace_Allocate( - (_Thread_Maximum_extensions + 1) * sizeof( void * ) - ); - - if ( !extensions_area ) { - if ( fp_area ) - (void) _Workspace_Free( fp_area ); - - if ( the_thread->Start.stack ) - (void) _Workspace_Free( the_thread->Start.stack ); - - return FALSE; - } - } else - extensions_area = NULL; - - the_thread->extensions = extensions_area; - - /* - * General initialization - */ - - the_thread->Start.is_preemptible = is_preemptible; - the_thread->Start.is_timeslice = is_timeslice; - the_thread->Start.isr_level = isr_level; - - the_thread->current_state = STATES_DORMANT; - the_thread->resource_count = 0; - the_thread->real_priority = priority; - the_thread->Start.initial_priority = priority; - - _Thread_Set_priority( the_thread, priority ); - - /* - * Open the object - */ - - _Objects_Open( information, &the_thread->Object, name ); - - /* - * Invoke create extensions - */ - - if ( !_User_extensions_Thread_create( the_thread ) ) { - - if ( extensions_area ) - (void) _Workspace_Free( extensions_area ); - - if ( fp_area ) - (void) _Workspace_Free( fp_area ); - - if ( the_thread->Start.stack ) - (void) _Workspace_Free( the_thread->Start.stack ); - - return FALSE; - } - - return TRUE; - -} - -/* - * _Thread_Start - * - * DESCRIPTION: - * - * XXX - */ - -boolean _Thread_Start( - Thread_Control *the_thread, - Thread_Start_types the_prototype, - void *entry_point, - void *pointer_argument, - unsigned32 numeric_argument -) -{ - if ( _States_Is_dormant( the_thread->current_state ) ) { - - the_thread->Start.entry_point = entry_point; - - the_thread->Start.prototype = the_prototype; - the_thread->Start.pointer_argument = pointer_argument; - the_thread->Start.numeric_argument = numeric_argument; - - _Thread_Load_environment( the_thread ); - - _Thread_Ready( the_thread ); - - _User_extensions_Thread_start( the_thread ); - - return TRUE; - } - - return FALSE; - -} - -/* - * _Thread_Restart - * - * DESCRIPTION: - * - * XXX - */ - -boolean _Thread_Restart( - Thread_Control *the_thread, - void *pointer_argument, - unsigned32 numeric_argument -) -{ - if ( !_States_Is_dormant( the_thread->current_state ) ) { - - _Thread_Set_transient( the_thread ); - the_thread->resource_count = 0; - the_thread->is_preemptible = the_thread->Start.is_preemptible; - the_thread->is_timeslice = the_thread->Start.is_timeslice; - - the_thread->Start.pointer_argument = pointer_argument; - the_thread->Start.numeric_argument = numeric_argument; - - if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) { - - if ( _Watchdog_Is_active( &the_thread->Timer ) ) - (void) _Watchdog_Remove( &the_thread->Timer ); - } - - if ( the_thread->current_priority != the_thread->Start.initial_priority ) { - the_thread->real_priority = the_thread->Start.initial_priority; - _Thread_Set_priority( the_thread, the_thread->Start.initial_priority ); - } - - _Thread_Load_environment( the_thread ); - - _Thread_Ready( the_thread ); - - _User_extensions_Thread_restart( the_thread ); - - if ( _Thread_Is_executing ( the_thread ) ) - _Thread_Restart_self(); - - return TRUE; - } - - return FALSE; -} - -/* - * _Thread_Close - * - * DESCRIPTION: - * - * XXX - */ - -void _Thread_Close( - Objects_Information *information, - Thread_Control *the_thread -) -{ - _Objects_Close( information, &the_thread->Object ); - - _Thread_Set_state( the_thread, STATES_TRANSIENT ); - - if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) { - - if ( _Watchdog_Is_active( &the_thread->Timer ) ) - (void) _Watchdog_Remove( &the_thread->Timer ); - } - - _User_extensions_Thread_delete( the_thread ); - -#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) - if ( _Thread_Is_allocated_fp( the_thread ) ) - _Thread_Deallocate_fp(); -#endif - the_thread->fp_context = NULL; - - if ( the_thread->Start.fp_context ) - (void) _Workspace_Free( the_thread->Start.fp_context ); - - if ( the_thread->Start.stack ) - (void) _Workspace_Free( the_thread->Start.stack ); - - if ( the_thread->extensions ) - (void) _Workspace_Free( the_thread->extensions ); - - the_thread->Start.stack = NULL; - the_thread->extensions = NULL; -} - -/*PAGE - * - * _Thread_Ready - * - * This kernel routine readies the requested thread, the thread chain - * is adjusted. A new heir thread may be selected. - * - * Input parameters: - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * NOTE: This routine uses the "blocking" heir selection mechanism. - * This insures the correct heir after a thread restart. - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Ready( - Thread_Control *the_thread -) -{ - ISR_Level level; - Thread_Control *heir; - - _ISR_Disable( level ); - - the_thread->current_state = STATES_READY; - - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - - _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); - - _ISR_Flash( level ); - - _Thread_Calculate_heir(); - - heir = _Thread_Heir; - - if ( !_Thread_Is_executing( heir ) && _Thread_Executing->is_preemptible ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} - -/*PAGE - * - * _Thread_Clear_state - * - * This kernel routine clears the appropriate states in the - * requested thread. The thread ready chain is adjusted if - * necessary and the Heir thread is set accordingly. - * - * Input parameters: - * the_thread - pointer to thread control block - * state - state set to clear - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * priority map - * select heir - */ - -void _Thread_Clear_state( - Thread_Control *the_thread, - States_Control state -) -{ - ISR_Level level; - - _ISR_Disable( level ); - the_thread->current_state = - _States_Clear( state, the_thread->current_state ); - - if ( _States_Is_ready( the_thread->current_state ) ) { - - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - - _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); - - _ISR_Flash( level ); - - if ( the_thread->current_priority < _Thread_Heir->current_priority ) { - _Thread_Heir = the_thread; - if ( _Thread_Executing->is_preemptible || - the_thread->current_priority == 0 ) - _Context_Switch_necessary = TRUE; - } - } - _ISR_Enable( level ); -} - -/*PAGE - * - * _Thread_Set_state - * - * This kernel routine sets the requested state in the THREAD. The - * THREAD chain is adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * state - state to be set - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select map - */ - -void _Thread_Set_state( - Thread_Control *the_thread, - States_Control state -) -{ - ISR_Level level; - Chain_Control *ready; - - ready = the_thread->ready; - _ISR_Disable( level ); - if ( !_States_Is_ready( the_thread->current_state ) ) { - the_thread->current_state = - _States_Set( state, the_thread->current_state ); - _ISR_Enable( level ); - return; - } - - the_thread->current_state = state; - - if ( _Chain_Has_only_one_node( ready ) ) { - - _Chain_Initialize_empty( ready ); - _Priority_Remove_from_bit_map( &the_thread->Priority_map ); - - } else - _Chain_Extract_unprotected( &the_thread->Object.Node ); - - _ISR_Flash( level ); - - if ( _Thread_Is_heir( the_thread ) ) - _Thread_Calculate_heir(); - - if ( _Thread_Is_executing( the_thread ) ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} - -/*PAGE - * - * _Thread_Set_transient - * - * This kernel routine places the requested thread in the transient state - * which will remove it from the ready queue, if necessary. No - * rescheduling is necessary because it is assumed that the transient - * state will be cleared before dispatching is enabled. - * - * Input parameters: - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Thread_Set_transient( - Thread_Control *the_thread -) -{ - ISR_Level level; - unsigned32 old_state; - Chain_Control *ready; - - ready = the_thread->ready; - _ISR_Disable( level ); - - old_state = the_thread->current_state; - the_thread->current_state = _States_Set( STATES_TRANSIENT, old_state ); - - if ( _States_Is_ready( old_state ) ) { - if ( _Chain_Has_only_one_node( ready ) ) { - - _Chain_Initialize_empty( ready ); - _Priority_Remove_from_bit_map( &the_thread->Priority_map ); - - } else - _Chain_Extract_unprotected( &the_thread->Object.Node ); - } - - _ISR_Enable( level ); - -} - -/*PAGE - * - * _Thread_Reset_timeslice - * - * This routine will remove the running thread from the ready chain - * and place it immediately at the rear of this chain and then the - * timeslice counter is reset. The heir THREAD will be updated if - * the running is also the currently the heir. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Reset_timeslice( void ) -{ - ISR_Level level; - Thread_Control *executing; - Chain_Control *ready; - - executing = _Thread_Executing; - ready = executing->ready; - _ISR_Disable( level ); - if ( _Chain_Has_only_one_node( ready ) ) { - _Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice; - _ISR_Enable( level ); - return; - } - _Chain_Extract_unprotected( &executing->Object.Node ); - _Chain_Append_unprotected( ready, &executing->Object.Node ); - - _ISR_Flash( level ); - - if ( _Thread_Is_heir( executing ) ) - _Thread_Heir = (Thread_Control *) ready->first; - - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} - -/*PAGE - * - * _Thread_Tickle_timeslice - * - * This scheduler routine determines if timeslicing is enabled - * for the currently executing thread and, if so, updates the - * timeslice count and checks for timeslice expiration. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -void _Thread_Tickle_timeslice( void ) -{ - if ( !_Thread_Executing->is_timeslice || - !_Thread_Executing->is_preemptible || - !_States_Is_ready( _Thread_Executing->current_state ) ) - return; - - if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) { - _Thread_Reset_timeslice(); - } -} - -/*PAGE - * - * _Thread_Yield_processor - * - * This kernel routine will remove the running THREAD from the ready chain - * and place it immediatly at the rear of this chain. Reset timeslice - * and yield the processor functions both use this routine, therefore if - * reset is TRUE and this is the only thread on the chain then the - * timeslice counter is reset. The heir THREAD will be updated if the - * running is also the currently the heir. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Yield_processor( void ) -{ - ISR_Level level; - Thread_Control *executing; - Chain_Control *ready; - - executing = _Thread_Executing; - ready = executing->ready; - _ISR_Disable( level ); - if ( !_Chain_Has_only_one_node( ready ) ) { - _Chain_Extract_unprotected( &executing->Object.Node ); - _Chain_Append_unprotected( ready, &executing->Object.Node ); - - _ISR_Flash( level ); - - if ( _Thread_Is_heir( executing ) ) - _Thread_Heir = (Thread_Control *) ready->first; - _Context_Switch_necessary = TRUE; - } - else if ( !_Thread_Is_heir( executing ) ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} - -/*PAGE - * - * _Thread_Load_environment - * - * Load starting environment for another thread from its start area in the - * thread. Only called from t_restart and t_start. - * - * Input parameters: - * the_thread - thread control block pointer - * - * Output parameters: NONE - */ - -void _Thread_Load_environment( - Thread_Control *the_thread -) -{ - boolean is_fp = FALSE; - - if ( the_thread->Start.fp_context ) { - the_thread->fp_context = the_thread->Start.fp_context; - _Context_Initialize_fp( &the_thread->fp_context ); - is_fp = TRUE; - } - - the_thread->do_post_task_switch_extension = FALSE; - the_thread->is_preemptible = the_thread->Start.is_preemptible; - the_thread->is_timeslice = the_thread->Start.is_timeslice; - - _Context_Initialize( - &the_thread->Registers, - the_thread->Start.Initial_stack.area, - the_thread->Start.Initial_stack.size, - the_thread->Start.isr_level, - _Thread_Handler, - is_fp - ); - -} - -/*PAGE - * - * _Thread_Handler - * - * This routine is the default thread exitted error handler. It is - * returned to when a thread exits. The configured fatal error handler - * is invoked to process the exit. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -void _Thread_Handler( void ) -{ - Thread_Control *executing; - - executing = _Thread_Executing; - - /* - * Take care that 'begin' extensions get to complete before - * 'switch' extensions can run. This means must keep dispatch - * disabled until all 'begin' extensions complete. - */ - - _User_extensions_Thread_begin( executing ); - - /* - * At this point, the dispatch disable level BETTER be 1. - */ - - _Thread_Enable_dispatch(); - - switch ( executing->Start.prototype ) { - case THREAD_START_NUMERIC: - (*executing->Start.entry_point)( executing->Start.numeric_argument ); - break; - case THREAD_START_POINTER: - (*executing->Start.entry_point)( executing->Start.pointer_argument ); - break; - case THREAD_START_BOTH_POINTER_FIRST: - (*executing->Start.entry_point)( - executing->Start.pointer_argument, - executing->Start.numeric_argument - ); - break; - case THREAD_START_BOTH_NUMERIC_FIRST: - (*executing->Start.entry_point)( - executing->Start.numeric_argument, - executing->Start.pointer_argument - ); - break; - } - - _User_extensions_Thread_exitted( executing ); - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_THREAD_EXITTED - ); -} - -/*PAGE - * - * _Thread_Delay_ended - * - * This routine processes a thread whose delay period has ended. - * It is called by the watchdog handler. - * - * Input parameters: - * id - thread id - * - * Output parameters: NONE - */ - -void _Thread_Delay_ended( - Objects_Id id, - void *ignored -) -{ - Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _Thread_Get( id, &location ); - switch ( location ) { - case OBJECTS_ERROR: - case OBJECTS_REMOTE: /* impossible */ - break; - case OBJECTS_LOCAL: - _Thread_Unblock( the_thread ); - _Thread_Unnest_dispatch(); - break; - } -} - -/*PAGE - * - * _Thread_Change_priority - * - * This kernel routine changes the priority of the thread. The - * thread chain is adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * new_priority - ultimate priority - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Change_priority( - Thread_Control *the_thread, - Priority_Control new_priority -) -{ - ISR_Level level; - - _Thread_Set_transient( the_thread ); - - if ( the_thread->current_priority != new_priority ) - _Thread_Set_priority( the_thread, new_priority ); - - _ISR_Disable( level ); - - the_thread->current_state = - _States_Clear( STATES_TRANSIENT, the_thread->current_state ); - - if ( ! _States_Is_ready( the_thread->current_state ) ) { - _ISR_Enable( level ); - return; - } - - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); - - _ISR_Flash( level ); - - _Thread_Calculate_heir(); - - if ( !_Thread_Is_executing_also_the_heir() && - _Thread_Executing->is_preemptible ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} - -/*PAGE - * - * _Thread_Set_priority - * - * This directive enables and disables several modes of - * execution for the requesting thread. - * - * Input parameters: - * the_thread - pointer to thread priority - * new_priority - new priority - * - * Output: NONE - */ - -void _Thread_Set_priority( - Thread_Control *the_thread, - Priority_Control new_priority -) -{ - the_thread->current_priority = new_priority; - the_thread->ready = &_Thread_Ready_chain[ new_priority ]; - - _Priority_Initialize_information( &the_thread->Priority_map, new_priority ); -} - -/*PAGE - * - * _Thread_Evaluate_mode - * - * XXX - */ - -boolean _Thread_Evaluate_mode( void ) -{ - Thread_Control *executing; - - executing = _Thread_Executing; - - if ( !_States_Is_ready( executing->current_state ) || - ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) ) { - _Context_Switch_necessary = TRUE; - return TRUE; - } - - return FALSE; -} - -/*PAGE - * - * _Thread_Get - * - * NOTE: If we are not using static inlines, this must be a real - * subroutine call. - * - * NOTE: XXX... This routine may be able to be optimized. - */ - -#ifndef USE_INLINES - -Thread_Control *_Thread_Get ( - Objects_Id id, - Objects_Locations *location -) -{ - Objects_Classes the_class; - Objects_Information *information; - - if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { - _Thread_Disable_dispatch(); - *location = OBJECTS_LOCAL; - return( _Thread_Executing ); - } - - the_class = _Objects_Get_class( id ); - - if ( the_class > OBJECTS_CLASSES_LAST ) { - *location = OBJECTS_ERROR; - return (Thread_Control *) 0; - } - - information = _Objects_Information_table[ the_class ]; - - if ( !information || !information->is_thread ) { - *location = OBJECTS_ERROR; - return (Thread_Control *) 0; - } - - return (Thread_Control *) _Objects_Get( information, id, location ); -} - -#endif - -/*PAGE - * - * _Thread_Idle_body - * - * This kernel routine is the idle thread. The idle thread runs any time - * no other thread is ready to run. This thread loops forever with - * interrupts enabled. - * - * Input parameters: - * ignored - this parameter is ignored - * - * Output parameters: NONE - */ - -#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE) -Thread _Thread_Idle_body( - unsigned32 ignored -) -{ - for( ; ; ) ; -} -#endif diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c deleted file mode 100644 index 31f7e5ff62..0000000000 --- a/cpukit/score/src/threadmp.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Multiprocessing Support for the Thread Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/priority.h> -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Thread_MP_Handler_initialization - * - */ - -void _Thread_MP_Handler_initialization ( - unsigned32 maximum_proxies -) -{ - - _Chain_Initialize_empty( &_Thread_MP_Active_proxies ); - - if ( maximum_proxies == 0 ) { - _Chain_Initialize_empty( &_Thread_MP_Inactive_proxies ); - return; - } - - - _Chain_Initialize( - &_Thread_MP_Inactive_proxies, - _Workspace_Allocate_or_fatal_error( - maximum_proxies * sizeof( Thread_Proxy_control ) - ), - maximum_proxies, - sizeof( Thread_Proxy_control ) - ); - -} - -/*PAGE - * - * _Thread_MP_Allocate_proxy - * - */ - -Thread_Control *_Thread_MP_Allocate_proxy ( - States_Control the_state -) -{ - Thread_Control *the_thread; - Thread_Proxy_control *the_proxy; - - the_thread = (Thread_Control *)_Chain_Get( &_Thread_MP_Inactive_proxies ); - - if ( !_Thread_Is_null( the_thread ) ) { - - the_proxy = (Thread_Proxy_control *) the_thread; - - _Thread_Executing->Wait.return_code = THREAD_STATUS_PROXY_BLOCKING; - - the_proxy->receive_packet = _Thread_MP_Receive->receive_packet; - - the_proxy->Object.id = _Thread_MP_Receive->receive_packet->source_tid; - - the_proxy->current_priority = - _Thread_MP_Receive->receive_packet->source_priority; - - the_proxy->current_state = _States_Set( STATES_DORMANT, the_state ); - - the_proxy->Wait = _Thread_Executing->Wait; - - _Chain_Append( &_Thread_MP_Active_proxies, &the_proxy->Active ); - - return the_thread; - } - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_OUT_OF_PROXIES - ); - - /* - * NOTE: The following return insures that the compiler will - * think that all paths return a value. - */ - - return NULL; -} - -/*PAGE - * - * _Thread_MP_Find_proxy - * - */ - -/* - * The following macro provides the offset of the Active element - * in the Thread_Proxy_control structure. This is the logical - * equivalent of the POSITION attribute in Ada. - */ - -#define _Thread_MP_Proxy_Active_offset \ - ((unsigned32)&(((Thread_Proxy_control *)0))->Active) - -Thread_Control *_Thread_MP_Find_proxy ( - Objects_Id the_id -) -{ - - Chain_Node *proxy_node; - Thread_Control *the_thread; - ISR_Level level; - -restart: - - _ISR_Disable( level ); - - for ( proxy_node = _Thread_MP_Active_proxies.first; - !_Chain_Is_tail( &_Thread_MP_Active_proxies, proxy_node ) ; - ) { - - the_thread = _Addresses_Subtract_offset( - proxy_node, - _Thread_MP_Proxy_Active_offset - ); - - if ( _Objects_Are_ids_equal( the_thread->Object.id, the_id ) ) { - _ISR_Enable( level ); - return the_thread; - } - - _ISR_Flash( level ); - - proxy_node = proxy_node->next; - - /* - * A proxy which is only dormant is not in a blocking state. - * Therefore, we are looking at proxy which has been moved from - * active to inactive chain (by an ISR) and need to restart - * the search. - */ - - if ( _States_Is_only_dormant( the_thread->current_state ) ) { - _ISR_Enable( level ); - goto restart; - } - } - - _ISR_Enable( level ); - return NULL; -} diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c deleted file mode 100644 index c02de10ee0..0000000000 --- a/cpukit/score/src/threadq.c +++ /dev/null @@ -1,967 +0,0 @@ -/* - * Thread Queue Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/chain.h> -#include <rtems/score/isr.h> -#include <rtems/score/object.h> -#include <rtems/score/states.h> -#include <rtems/score/thread.h> -#include <rtems/score/threadq.h> -#include <rtems/score/tqdata.h> - -/*PAGE - * - * _Thread_queue_Initialize - * - * This routine initializes the specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_class - class of the object to which this belongs - * discipline - queueing discipline - * state - state of waiting threads - * proxy_extract_callout - MP specific callout - * timeout_status - return on a timeout - * - * Output parameters: NONE - */ - -void _Thread_queue_Initialize( - Thread_queue_Control *the_thread_queue, - Objects_Classes the_class, - Thread_queue_Disciplines the_discipline, - States_Control state, - Thread_queue_Extract_callout proxy_extract_callout, - unsigned32 timeout_status -) -{ - unsigned32 index; - - _Thread_queue_Extract_table[ the_class ] = proxy_extract_callout; - - the_thread_queue->state = state; - the_thread_queue->discipline = the_discipline; - the_thread_queue->timeout_status = timeout_status; - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - switch ( the_discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - for( index=0 ; - index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; - index++) - _Chain_Initialize_empty( &the_thread_queue->Queues.Priority[index] ); - break; - } - -} - -/*PAGE - * - * _Thread_queue_Enqueue - * - * This routine blocks a thread, places it on a thread, and optionally - * starts a timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * timeout - interval to wait - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Thread_queue_Enqueue( - Thread_queue_Control *the_thread_queue, - Watchdog_Interval timeout -) -{ - Thread_Control *the_thread; - - the_thread = _Thread_Executing; - - if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet ) - the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state ); - else - _Thread_Set_state( the_thread, the_thread_queue->state ); - - if ( timeout ) { - _Watchdog_Initialize( - &the_thread->Timer, - _Thread_queue_Timeout, - the_thread->Object.id, - NULL - ); - - _Watchdog_Insert_ticks( &the_thread->Timer, timeout ); - } - - switch( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - _Thread_queue_Enqueue_fifo( the_thread_queue, the_thread, timeout ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - _Thread_queue_Enqueue_priority( the_thread_queue, the_thread, timeout ); - break; - } -} - -/*PAGE - * - * _Thread_queue_Dequeue - * - * This routine removes a thread from the specified threadq. If the - * threadq discipline is FIFO, it unblocks a thread, and cancels its - * timeout timer. Priority discipline is processed elsewhere. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * - * Output parameters: - * returns - thread dequeued or NULL - * - * INTERRUPT LATENCY: - * check sync - */ - -Thread_Control *_Thread_queue_Dequeue( - Thread_queue_Control *the_thread_queue -) -{ - Thread_Control *the_thread; - - switch ( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - the_thread = _Thread_queue_Dequeue_fifo( the_thread_queue ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - the_thread = _Thread_queue_Dequeue_priority( the_thread_queue ); - break; - default: /* this is only to prevent warnings */ - the_thread = NULL; - break; - } - - return( the_thread ); -} - -/*PAGE - * - * _Thread_queue_Extract_with_proxy - * - * This routine extracts the_thread from the_thread_queue - * and insures that if there is a proxy for this task on - * another node, it is also dealt with. - * - * XXX - */ - -boolean _Thread_queue_Extract_with_proxy( - Thread_Control *the_thread -) -{ - States_Control state; - Objects_Classes the_class; - Thread_queue_Extract_callout proxy_extract_callout; - - state = the_thread->current_state; - - if ( _States_Is_waiting_on_thread_queue( state ) ) { - if ( _States_Is_waiting_for_rpc_reply( state ) && - _States_Is_locally_blocked( state ) ) { - - the_class = _Objects_Get_class( the_thread->Wait.id ); - - proxy_extract_callout = _Thread_queue_Extract_table[ the_class ]; - - if ( proxy_extract_callout ) - (*proxy_extract_callout)( the_thread ); - } - _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); - - return TRUE; - } - return FALSE; -} - -/*PAGE - * - * _Thread_queue_Extract - * - * This routine removes a specific thread from the specified threadq, - * deletes any timeout, and unblocks the thread. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_thread - pointer to a thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: NONE - */ - -void _Thread_queue_Extract( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -) -{ - switch ( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - _Thread_queue_Extract_fifo( the_thread_queue, the_thread ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - _Thread_queue_Extract_priority( the_thread_queue, the_thread ); - break; - } -} - -/*PAGE - * - * _Thread_queue_Flush - * - * This kernel routine flushes the given thread queue. - * - * Input parameters: - * the_thread_queue - pointer to threadq to be flushed - * remote_extract_callout - pointer to routine which extracts a remote thread - * status - status to return to the thread - * - * Output parameters: NONE - */ - -void _Thread_queue_Flush( - Thread_queue_Control *the_thread_queue, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -) -{ - Thread_Control *the_thread; - - while ( (the_thread = _Thread_queue_Dequeue( the_thread_queue )) ) { - if ( _Objects_Is_local_id( the_thread->Object.id ) ) - the_thread->Wait.return_code = status; - else - ( *remote_extract_callout )( the_thread ); - } -} - -/*PAGE - * - * _Thread_queue_First - * - * This routines returns a pointer to the first thread on the - * specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to thread queue - * - * Output parameters: - * returns - first thread or NULL - */ - -Thread_Control *_Thread_queue_First( - Thread_queue_Control *the_thread_queue -) -{ - Thread_Control *the_thread; - - switch ( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - the_thread = _Thread_queue_First_fifo( the_thread_queue ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - the_thread = _Thread_queue_First_priority( the_thread_queue ); - break; - default: /* this is only to prevent warnings */ - the_thread = NULL; - break; - } - - return the_thread; -} - -/*PAGE - * - * _Thread_queue_Timeout - * - * This routine processes a thread which timeouts while waiting on - * a thread queue. It is called by the watchdog handler. - * - * Input parameters: - * id - thread id - * - * Output parameters: NONE - */ - -void _Thread_queue_Timeout( - Objects_Id id, - void *ignored -) -{ - Thread_Control *the_thread; - Thread_queue_Control *the_thread_queue; - Objects_Locations location; - - the_thread = _Thread_Get( id, &location ); - switch ( location ) { - case OBJECTS_ERROR: - case OBJECTS_REMOTE: /* impossible */ - break; - case OBJECTS_LOCAL: - the_thread_queue = the_thread->Wait.queue; - - /* - * If the_thread_queue is not synchronized, then it is either - * "nothing happened", "timeout", or "satisfied". If the_thread - * is the executing thread, then it is in the process of blocking - * and it is the thread which is responsible for the synchronization - * process. - * - * If it is not satisfied, then it is "nothing happened" and - * this is the "timeout" transition. After a request is satisfied, - * a timeout is not allowed to occur. - */ - - if ( the_thread_queue->sync_state != THREAD_QUEUE_SYNCHRONIZED && - _Thread_Is_executing( the_thread ) ) { - if ( the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) - the_thread_queue->sync_state = THREAD_QUEUE_TIMEOUT; - } else { - the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; - _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); - } - _Thread_Unnest_dispatch(); - break; - } -} - -/*PAGE - * - * _Thread_queue_Enqueue_fifo - * - * This routine blocks a thread, places it on a thread, and optionally - * starts a timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * the_thread - pointer to the thread to block - * timeout - interval to wait - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Thread_queue_Enqueue_fifo ( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - Watchdog_Interval timeout -) -{ - ISR_Level level; - Thread_queue_States sync_state; - - _ISR_Disable( level ); - - sync_state = the_thread_queue->sync_state; - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - switch ( sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - /* - * This should never happen. It indicates that someone did not - * enter a thread queue critical section. - */ - break; - - case THREAD_QUEUE_NOTHING_HAPPENED: - _Chain_Append_unprotected( - &the_thread_queue->Queues.Fifo, - &the_thread->Object.Node - ); - _ISR_Enable( level ); - return; - - case THREAD_QUEUE_TIMEOUT: - the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; - _ISR_Enable( level ); - break; - - case THREAD_QUEUE_SATISFIED: - if ( _Watchdog_Is_active( &the_thread->Timer ) ) { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - } else - _ISR_Enable( level ); - break; - } - - /* - * Global objects with thread queue's should not be operated on from an - * ISR. But the sync code still must allow short timeouts to be processed - * correctly. - */ - - _Thread_Unblock( the_thread ); - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); - -} - -/*PAGE - * - * _Thread_queue_Dequeue_fifo - * - * This routine removes a thread from the specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * - * Output parameters: - * returns - thread dequeued or NULL - * - * INTERRUPT LATENCY: - * check sync - * FIFO - */ - -Thread_Control *_Thread_queue_Dequeue_fifo( - Thread_queue_Control *the_thread_queue -) -{ - ISR_Level level; - Thread_Control *the_thread; - - _ISR_Disable( level ); - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Fifo ) ) { - - the_thread = (Thread_Control *) - _Chain_Get_first_unprotected( &the_thread_queue->Queues.Fifo ); - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - _Thread_Unblock( the_thread ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - _Thread_Unblock( the_thread ); - } - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); - - return the_thread; - } - - switch ( the_thread_queue->sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - case THREAD_QUEUE_SATISFIED: - _ISR_Enable( level ); - return NULL; - - case THREAD_QUEUE_NOTHING_HAPPENED: - case THREAD_QUEUE_TIMEOUT: - the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; - _ISR_Enable( level ); - return _Thread_Executing; - } - return NULL; /* this is only to prevent warnings */ -} - -/*PAGE - * - * _Thread_queue_Extract_fifo - * - * This routine removes a specific thread from the specified threadq, - * deletes any timeout, and unblocks the thread. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_thread - pointer to the thread to block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * EXTRACT_FIFO - */ - -void _Thread_queue_Extract_fifo( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -) -{ - ISR_Level level; - - _ISR_Disable( level ); - - if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) { - _ISR_Enable( level ); - return; - } - - _Chain_Extract_unprotected( &the_thread->Object.Node ); - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - } - - _Thread_Unblock( the_thread ); - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); - -} - -/*PAGE - * - * _Thread_queue_First_fifo - * - * This routines returns a pointer to the first thread on the - * specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * - * Output parameters: - * returns - first thread or NULL - */ - -Thread_Control *_Thread_queue_First_fifo( - Thread_queue_Control *the_thread_queue -) -{ - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Fifo ) ) - return (Thread_Control *) the_thread_queue->Queues.Fifo.first; - - return NULL; -} - -/*PAGE - * - * _Thread_queue_Enqueue_priority - * - * This routine blocks a thread, places it on a thread, and optionally - * starts a timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * thread - thread to insert - * timeout - timeout interval in ticks - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * forward less than - * forward equal - */ - -void _Thread_queue_Enqueue_priority( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - Watchdog_Interval timeout -) -{ - Priority_Control search_priority; - Thread_Control *search_thread; - ISR_Level level; - Chain_Control *header; - unsigned32 header_index; - Chain_Node *the_node; - Chain_Node *next_node; - Chain_Node *previous_node; - Chain_Node *search_node; - Priority_Control priority; - States_Control block_state; - Thread_queue_States sync_state; - - _Chain_Initialize_empty( &the_thread->Wait.Block2n ); - - priority = the_thread->current_priority; - header_index = _Thread_queue_Header_number( priority ); - header = &the_thread_queue->Queues.Priority[ header_index ]; - block_state = the_thread_queue->state; - - if ( _Thread_queue_Is_reverse_search( priority ) ) - goto restart_reverse_search; - -restart_forward_search: - search_priority = PRIORITY_MINIMUM - 1; - _ISR_Disable( level ); - search_thread = (Thread_Control *) header->first; - while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) { - search_priority = search_thread->current_priority; - if ( priority <= search_priority ) - break; - -#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) - search_thread = (Thread_Control *) search_thread->Object.Node.next; - if ( _Chain_Is_tail( header, (Chain_Node *)search_thread ) ) - break; - search_priority = search_thread->current_priority; - if ( priority <= search_priority ) - break; -#endif - _ISR_Flash( level ); - if ( !_States_Are_set( search_thread->current_state, block_state) ) { - _ISR_Enable( level ); - goto restart_forward_search; - } - search_thread = - (Thread_Control *)search_thread->Object.Node.next; - } - - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto synchronize; - - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - if ( priority == search_priority ) - goto equal_priority; - - search_node = (Chain_Node *) search_thread; - previous_node = search_node->previous; - the_node = (Chain_Node *) the_thread; - - the_node->next = search_node; - the_node->previous = previous_node; - previous_node->next = the_node; - search_node->previous = the_node; - _ISR_Enable( level ); - return; - -restart_reverse_search: - search_priority = PRIORITY_MAXIMUM + 1; - - _ISR_Disable( level ); - search_thread = (Thread_Control *) header->last; - while ( !_Chain_Is_head( header, (Chain_Node *)search_thread ) ) { - search_priority = search_thread->current_priority; - if ( priority >= search_priority ) - break; -#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) - search_thread = (Thread_Control *) search_thread->Object.Node.previous; - if ( _Chain_Is_head( header, (Chain_Node *)search_thread ) ) - break; - search_priority = search_thread->current_priority; - if ( priority >= search_priority ) - break; -#endif - _ISR_Flash( level ); - if ( !_States_Are_set( search_thread->current_state, block_state) ) { - _ISR_Enable( level ); - goto restart_reverse_search; - } - search_thread = (Thread_Control *) - search_thread->Object.Node.previous; - } - - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto synchronize; - - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - if ( priority == search_priority ) - goto equal_priority; - - search_node = (Chain_Node *) search_thread; - next_node = search_node->next; - the_node = (Chain_Node *) the_thread; - - the_node->next = next_node; - the_node->previous = search_node; - search_node->next = the_node; - next_node->previous = the_node; - _ISR_Enable( level ); - return; - -equal_priority: /* add at end of priority group */ - search_node = _Chain_Tail( &search_thread->Wait.Block2n ); - previous_node = search_node->previous; - the_node = (Chain_Node *) the_thread; - - the_node->next = search_node; - the_node->previous = previous_node; - previous_node->next = the_node; - search_node->previous = the_node; - _ISR_Enable( level ); - return; - -synchronize: - - sync_state = the_thread_queue->sync_state; - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - switch ( sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - /* - * This should never happen. It indicates that someone did not - * enter a thread queue critical section. - */ - break; - - case THREAD_QUEUE_NOTHING_HAPPENED: - /* - * This should never happen. All of this was dealt with above. - */ - break; - - case THREAD_QUEUE_TIMEOUT: - the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; - _ISR_Enable( level ); - break; - - case THREAD_QUEUE_SATISFIED: - if ( _Watchdog_Is_active( &the_thread->Timer ) ) { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - } else - _ISR_Enable( level ); - break; - } - - /* - * Global objects with thread queue's should not be operated on from an - * ISR. But the sync code still must allow short timeouts to be processed - * correctly. - */ - - _Thread_Unblock( the_thread ); - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); -} - -/*PAGE - * - * _Thread_queue_Dequeue_priority - * - * This routine removes a thread from the specified PRIORITY based - * threadq, unblocks it, and cancels its timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to thread queue - * - * Output parameters: - * returns - thread dequeued or NULL - * - * INTERRUPT LATENCY: - * only case - */ - -Thread_Control *_Thread_queue_Dequeue_priority( - Thread_queue_Control *the_thread_queue -) -{ - unsigned32 index; - ISR_Level level; - Thread_Control *the_thread = NULL; /* just to remove warnings */ - Thread_Control *new_first_thread; - Chain_Node *new_first_node; - Chain_Node *new_second_node; - Chain_Node *last_node; - Chain_Node *next_node; - Chain_Node *previous_node; - - _ISR_Disable( level ); - for( index=0 ; - index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; - index++ ) { - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) { - the_thread = (Thread_Control *) - the_thread_queue->Queues.Priority[ index ].first; - goto dequeue; - } - } - - switch ( the_thread_queue->sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - case THREAD_QUEUE_SATISFIED: - _ISR_Enable( level ); - return NULL; - - case THREAD_QUEUE_NOTHING_HAPPENED: - case THREAD_QUEUE_TIMEOUT: - the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; - _ISR_Enable( level ); - return _Thread_Executing; - } - -dequeue: - new_first_node = the_thread->Wait.Block2n.first; - new_first_thread = (Thread_Control *) new_first_node; - next_node = the_thread->Object.Node.next; - previous_node = the_thread->Object.Node.previous; - - if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) { - last_node = the_thread->Wait.Block2n.last; - new_second_node = new_first_node->next; - - previous_node->next = new_first_node; - next_node->previous = new_first_node; - new_first_node->next = next_node; - new_first_node->previous = previous_node; - - if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) { - /* > two threads on 2-n */ - new_second_node->previous = - _Chain_Head( &new_first_thread->Wait.Block2n ); - - new_first_thread->Wait.Block2n.first = new_second_node; - new_first_thread->Wait.Block2n.last = last_node; - - last_node->next = _Chain_Tail( &new_first_thread->Wait.Block2n ); - } - } else { - previous_node->next = next_node; - next_node->previous = previous_node; - } - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - _Thread_Unblock( the_thread ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - _Thread_Unblock( the_thread ); - } - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); - return( the_thread ); -} - -/*PAGE - * - * _Thread_queue_Extract_priority - * - * This routine removes a specific thread from the specified threadq, - * deletes any timeout, and unblocks the thread. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_thread - pointer to a thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * EXTRACT_PRIORITY - */ - -void _Thread_queue_Extract_priority( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -) -{ - ISR_Level level; - Chain_Node *the_node; - Chain_Node *next_node; - Chain_Node *previous_node; - Thread_Control *new_first_thread; - Chain_Node *new_first_node; - Chain_Node *new_second_node; - Chain_Node *last_node; - - the_node = (Chain_Node *) the_thread; - _ISR_Disable( level ); - if ( _States_Is_waiting_on_thread_queue( the_thread->current_state ) ) { - next_node = the_node->next; - previous_node = the_node->previous; - - if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) { - new_first_node = the_thread->Wait.Block2n.first; - new_first_thread = (Thread_Control *) new_first_node; - last_node = the_thread->Wait.Block2n.last; - new_second_node = new_first_node->next; - - previous_node->next = new_first_node; - next_node->previous = new_first_node; - new_first_node->next = next_node; - new_first_node->previous = previous_node; - - if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) { - /* > two threads on 2-n */ - new_second_node->previous = - _Chain_Head( &new_first_thread->Wait.Block2n ); - new_first_thread->Wait.Block2n.first = new_second_node; - - new_first_thread->Wait.Block2n.last = last_node; - last_node->next = _Chain_Tail( &new_first_thread->Wait.Block2n ); - } - } else { - previous_node->next = next_node; - next_node->previous = previous_node; - } - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - _Thread_Unblock( the_thread ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - _Thread_Unblock( the_thread ); - } - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); - } - else - _ISR_Enable( level ); -} - -/*PAGE - * - * _Thread_queue_First_priority - * - * This routines returns a pointer to the first thread on the - * specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to thread queue - * - * Output parameters: - * returns - first thread or NULL - */ - -Thread_Control *_Thread_queue_First_priority ( - Thread_queue_Control *the_thread_queue -) -{ - unsigned32 index; - - for( index=0 ; - index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; - index++ ) { - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) - return (Thread_Control *) - the_thread_queue->Queues.Priority[ index ].first; - } - return NULL; -} diff --git a/cpukit/score/src/userext.c b/cpukit/score/src/userext.c deleted file mode 100644 index 6261220d58..0000000000 --- a/cpukit/score/src/userext.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * User Extension Handler - * - * NOTE: XXX - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/userext.h> - -/*PAGE - * - * _User_extensions_Thread_create - */ - -boolean _User_extensions_Thread_create ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - boolean status; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_create != NULL ) { - status = (*the_extension->Callouts.thread_create)( - _Thread_Executing, - the_thread - ); - if ( !status ) - return FALSE; - } - } - - return TRUE; -} - -/*PAGE - * - * _User_extensions_Thread_delete - */ - -void _User_extensions_Thread_delete ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_delete != NULL ) - (*the_extension->Callouts.thread_delete)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_start - * - */ - -void _User_extensions_Thread_start ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_start != NULL ) - (*the_extension->Callouts.thread_start)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_restart - * - */ - -void _User_extensions_Thread_restart ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_restart != NULL ) - (*the_extension->Callouts.thread_restart)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_begin - * - */ - -void _User_extensions_Thread_begin ( - Thread_Control *executing -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_begin != NULL ) - (*the_extension->Callouts.thread_begin)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Thread_exitted - */ - -void _User_extensions_Thread_exitted ( - Thread_Control *executing -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_exitted != NULL ) - (*the_extension->Callouts.thread_exitted)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Fatal - */ - -void _User_extensions_Fatal ( - Internal_errors_Source the_source, - boolean is_internal, - unsigned32 the_error -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.fatal != NULL ) - (*the_extension->Callouts.fatal)( the_source, is_internal, the_error ); - } -} - - diff --git a/cpukit/score/src/watchdog.c b/cpukit/score/src/watchdog.c deleted file mode 100644 index 0f72bd3d5c..0000000000 --- a/cpukit/score/src/watchdog.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Watchdog Handler - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/watchdog.h> - -/*PAGE - * - * _Watchdog_Handler_initialization - * - * This routine initializes the watchdog handler. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -void _Watchdog_Handler_initialization( void ) -{ - _Watchdog_Sync_count = 0; - _Watchdog_Sync_level = 0; - _Chain_Initialize_empty( &_Watchdog_Ticks_chain ); - _Chain_Initialize_empty( &_Watchdog_Seconds_chain ); -} - -/*PAGE - * - * _Watchdog_Remove - * - * The routine removes a watchdog from a delta chain and updates - * the delta counters of the remaining watchdogs. - */ - -Watchdog_States _Watchdog_Remove( - Watchdog_Control *the_watchdog -) -{ - ISR_Level level; - Watchdog_States previous_state; - Watchdog_Control *next_watchdog; - - _ISR_Disable( level ); - previous_state = the_watchdog->state; - switch ( previous_state ) { - case WATCHDOG_INACTIVE: - break; - - case WATCHDOG_BEING_INSERTED: - - /* - * It is not actually on the chain so just change the state and - * the Insert operation we interrupted will be aborted. - */ - the_watchdog->state = WATCHDOG_INACTIVE; - break; - - case WATCHDOG_ACTIVE: - case WATCHDOG_REMOVE_IT: - - the_watchdog->state = WATCHDOG_INACTIVE; - next_watchdog = _Watchdog_Next( the_watchdog ); - - if ( _Watchdog_Next(next_watchdog) ) - next_watchdog->delta_interval += the_watchdog->delta_interval; - - if ( _Watchdog_Sync_count ) - _Watchdog_Sync_level = _ISR_Nest_level; - - _Chain_Extract_unprotected( &the_watchdog->Node ); - break; - } - _ISR_Enable( level ); - return( previous_state ); -} - -/*PAGE - * - * _Watchdog_Adjust - * - * This routine adjusts the delta chain backward or forward in response - * to a time change. - * - * Input parameters: - * header - pointer to the delta chain to be adjusted - * direction - forward or backward adjustment to delta chain - * units - units to adjust - * - * Output parameters: - */ - -void _Watchdog_Adjust( - Chain_Control *header, - Watchdog_Adjust_directions direction, - Watchdog_Interval units -) -{ - if ( !_Chain_Is_empty( header ) ) { - switch ( direction ) { - case WATCHDOG_BACKWARD: - _Watchdog_First( header )->delta_interval += units; - break; - case WATCHDOG_FORWARD: - while ( units ) { - if ( units < _Watchdog_First( header )->delta_interval ) { - _Watchdog_First( header )->delta_interval -= units; - break; - } else { - units -= _Watchdog_First( header )->delta_interval; - _Watchdog_First( header )->delta_interval = 1; - _Watchdog_Tickle( header ); - if ( _Chain_Is_empty( header ) ) - break; - } - } - break; - } - } -} - -/*PAGE - * - * _Watchdog_Insert - * - * This routine inserts a watchdog timer on to the appropriate delta - * chain while updating the delta interval counters. - */ - -void _Watchdog_Insert( - Chain_Control *header, - Watchdog_Control *the_watchdog -) -{ - ISR_Level level; - Watchdog_Control *after; - unsigned32 insert_isr_nest_level; - Watchdog_Interval delta_interval; - - - insert_isr_nest_level = _ISR_Nest_level; - the_watchdog->state = WATCHDOG_BEING_INSERTED; - - _Watchdog_Sync_count++; -restart: - delta_interval = the_watchdog->initial; - - _ISR_Disable( level ); - - for ( after = _Watchdog_First( header ) ; - ; - after = _Watchdog_Next( after ) ) { - - if ( delta_interval == 0 || !_Watchdog_Next( after ) ) - break; - - if ( delta_interval < after->delta_interval ) { - after->delta_interval -= delta_interval; - break; - } - - delta_interval -= after->delta_interval; - - /* - * If you experience problems comment out the _ISR_Flash line. - * 3.2.0 was the first release with this critical section redesigned. - * Under certain circumstances, the PREVIOUS critical section algorithm - * used around this flash point allowed interrupts to execute - * which violated the design assumptions. The critical section - * mechanism used here WAS redesigned to address this. - */ - - _ISR_Flash( level ); - - if ( the_watchdog->state != WATCHDOG_BEING_INSERTED ) { - goto exit_insert; - } - - if ( _Watchdog_Sync_level > insert_isr_nest_level ) { - _Watchdog_Sync_level = insert_isr_nest_level; - _ISR_Enable( level ); - goto restart; - } - } - - _Watchdog_Activate( the_watchdog ); - - the_watchdog->delta_interval = delta_interval; - - _Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node ); - -exit_insert: - _Watchdog_Sync_level = insert_isr_nest_level; - _Watchdog_Sync_count--; - _ISR_Enable( level ); -} - -/*PAGE - * - * _Watchdog_Tickle - * - * This routine decrements the delta counter in response to a tick. The - * delta chain is updated accordingly. - * - * Input parameters: - * header - pointer to the delta chain to be tickled - * - * Output parameters: NONE - */ - -void _Watchdog_Tickle( - Chain_Control *header -) -{ - Watchdog_Control *the_watchdog; - - if ( _Chain_Is_empty( header ) ) - return; - - the_watchdog = _Watchdog_First( header ); - the_watchdog->delta_interval--; - if ( the_watchdog->delta_interval != 0 ) - return; - - do { - switch( _Watchdog_Remove( the_watchdog ) ) { - case WATCHDOG_ACTIVE: - (*the_watchdog->routine)( - the_watchdog->id, - the_watchdog->user_data - ); - break; - - case WATCHDOG_INACTIVE: - /* - * This state indicates that the watchdog is not on any chain. - * Thus, it is NOT on a chain being tickled. This case should - * never occur. - */ - break; - - case WATCHDOG_BEING_INSERTED: - /* - * This state indicates that the watchdog is in the process of - * BEING inserted on the chain. Thus, it can NOT be on a chain - * being tickled. This case should never occur. - */ - break; - - case WATCHDOG_REMOVE_IT: - break; - } - the_watchdog = _Watchdog_First( header ); - } while ( !_Chain_Is_empty( header ) && - (the_watchdog->delta_interval == 0) ); -} diff --git a/cpukit/score/src/wkspace.c b/cpukit/score/src/wkspace.c deleted file mode 100644 index f168e91d62..0000000000 --- a/cpukit/score/src/wkspace.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Workspace Handler - * - * XXX - * - * NOTE: - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/interr.h> - -/*PAGE - * - * _Workspace_Allocate_or_fatal_error - * - */ - -void *_Workspace_Allocate_or_fatal_error( - unsigned32 size -) -{ - void *memory; - - memory = _Workspace_Allocate( size ); - - if ( memory == NULL ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_WORKSPACE_ALLOCATION - ); - - return memory; -} |