Changeset 88d594a in rtems for cpukit


Ignore:
Timestamp:
May 24, 1995, 9:39:42 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
5b9d6ddf
Parents:
bf61e45c
Message:

Fully tested on all in-house targets

Location:
cpukit
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/__brk.c

    rbf61e45c r88d594a  
     1#if !defined(RTEMS_UNIX)
     2
    13/*
    24 *  RTEMS "Broken" __brk/__sbrk Implementation
     
    1315 *  notice must appear in all copies of this file and its derivatives.
    1416 *
    15  *  $Id$
     17 *  __brk.c,v 1.2 1995/05/09 20:24:28 joel Exp
    1618 */
    1719
     
    3941  return -1;
    4042}
     43
     44#endif
  • cpukit/libcsupport/src/__gettod.c

    rbf61e45c r88d594a  
    1212 *  notice must appear in all copies of this file and its derivatives.
    1313 *
    14  *  $Id$
     14 *  __gettod.c,v 1.2 1995/05/09 20:24:31 joel Exp
    1515 */
    1616
     
    2020#include <sys/reent.h>
    2121#endif
     22
    2223#include <time.h>
    2324#include <sys/time.h>
     25
    2426#include <errno.h>
    2527#include <assert.h>
     
    3032
    3133int gettimeofday(
    32    struct timeval  *tp,
    33    struct timezone *tzp
     34  struct timeval  *tp,
     35  struct timezone *tzp
    3436)
    3537{
     
    3739  rtems_clock_time_value time;
    3840
    39   if ( !tp || !tzp ) {
     41  if ( !tp ) {
    4042    errno = EFAULT;
    4143    return -1;
     
    5254  tp->tv_usec = time.microseconds;
    5355
    54 #if 0
    55   tzp->minuteswest = timezone / 60; /* from seconds to minutes */
    56   tzp->dsttime = daylight;
    57 #endif
    58 
    5956  /*
    6057   * newlib does not have timezone and daylight savings time
     
    6259   */
    6360
    64   tzp->tz_minuteswest = 0;  /* at UTC */
    65   tzp->tz_dsttime = 0;      /* no daylight savings */
     61  if ( tzp ) {
     62    tzp->tz_minuteswest = 0;  /* at UTC */
     63    tzp->tz_dsttime = 0;      /* no daylight savings */
     64#if 0
     65  tzp->minuteswest = timezone / 60; /* from seconds to minutes */
     66  tzp->dsttime = daylight;
     67#endif
     68  }
    6669  return 0;
    6770}
    6871
     72#if defined(RTEMS_NEWLIB)
     73
     74#if 0
    6975/*
    70  *  "Reentrant" versions of the above routines implemented above.
     76 *  "Reentrant" version
    7177 */
    7278
    73 #if 0
    7479int _gettimeofday_r(
    75    struct _reent   *ignored_reentrancy_stuff,
    76    struct timeval  *tp,
    77    struct timezone *tzp
     80  struct _reent   *ignored_reentrancy_stuff,
     81  struct timeval  *tp,
     82  struct timezone *tzp
    7883)
    7984{
     
    8287#endif
    8388
     89/*
     90 *  "System call" version
     91 */
     92
     93int _gettimeofday(
     94  struct timeval  *tp,
     95  struct timezone *tzp
     96)
     97{
     98  return gettimeofday( tp, tzp );
     99}
     100
     101#endif /* defined(RTEMS_NEWLIB) */
     102
    84103#endif
  • cpukit/libcsupport/src/newlibc.c

    rbf61e45c r88d594a  
    11/*
    2  *      @(#)newlibc.c   1.8 - 95/04/25
     2 *      @(#)newlibc.c   1.9 - 95/05/16
    33 *     
    44 */
     
    77
    88/*
    9  *  File:       $RCSfile$
     9 *  File:       newlibc.c,v
    1010 *  Project:    PixelFlow
    1111 *  Created:    94/12/7
    12  *  Revision:   $Revision$
    13  *  Last Mod:   $Date$
     12 *  Revision:   1.2
     13 *  Last Mod:   1995/05/09 20:24:37
    1414 *
    1515 *  COPYRIGHT (c) 1994 by Division Incorporated
     
    3636 *  NOTE:
    3737 *
    38  *  $Id$
     38 *  newlibc.c,v 1.2 1995/05/09 20:24:37 joel Exp
    3939 *
    4040 */
  • cpukit/libmisc/stackchk/check.c

    rbf61e45c r88d594a  
    330330   */
    331331
     332  base += 4;
    332333  for (ebase = base + length; base < ebase; base++)
    333334      if (*base != U32_PATTERN)
  • cpukit/rtems/src/rtemstimer.c

    rbf61e45c r88d594a  
    147147      return( RTEMS_INTERNAL_ERROR );
    148148    case OBJECTS_LOCAL:
    149       if ( !_Timer_Is_dormant_class( the_timer->the_class ) ) {
     149      if ( !_Timer_Is_dormant_class( the_timer->the_class ) )
    150150        (void) _Watchdog_Remove( &the_timer->Ticker );
    151         _Thread_Enable_dispatch();
    152         return( RTEMS_SUCCESSFUL );
    153       }
    154       _Thread_Enable_dispatch();
    155       return( RTEMS_INCORRECT_STATE );
     151      _Thread_Enable_dispatch();
     152      return( RTEMS_SUCCESSFUL );
    156153  }
    157154
  • cpukit/sapi/include/rtems/io.h

    rbf61e45c r88d594a  
    188188
    189189rtems_status_code _IO_Handler_routine(
    190   IO_operations     operation,
    191   rtems_device_major_number  major,
    192   rtems_device_minor_number  minor,
    193   void             *argument,
    194   unsigned32       *return_value
     190  IO_operations              operation,
     191  rtems_device_major_number  major,
     192  rtems_device_minor_number  minor,
     193  void                      *argument,
     194  unsigned32                *return_value
    195195);
    196196
  • cpukit/sapi/src/exinit.c

    rbf61e45c r88d594a  
    108108  _CPU_Initialize( cpu_table, _Thread_Dispatch );
    109109
     110  /*
     111   *  Do this as early as possible to insure no debugging output
     112   *  is even attempted to be printed.
     113   */
     114
     115  _Debug_Manager_initialization();
     116
    110117  multiprocessing_table = configuration_table->User_multiprocessing_table;
    111118  if ( multiprocessing_table == NULL )
  • cpukit/sapi/src/io.c

    rbf61e45c r88d594a  
    257257
    258258rtems_status_code _IO_Handler_routine(
    259   IO_operations     operation,
    260   rtems_device_major_number  major,
    261   rtems_device_minor_number  minor,
    262   void             *argument,
    263   unsigned32       *return_value
     259  IO_operations              operation,
     260  rtems_device_major_number  major,
     261  rtems_device_minor_number  minor,
     262  void                      *argument,
     263  unsigned32                *return_value
    264264)
    265265{
  • cpukit/score/cpu/hppa1.1/cpu.c

    rbf61e45c r88d594a  
    1515 *      suitability of this software for any purpose.
    1616 *
    17  *  $Id$
     17 *  cpu.c,v 1.2 1995/05/09 20:11:35 joel Exp
    1818 */
    1919
  • cpukit/score/cpu/i386/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <i386.h>
     34#include <rtems/i386.h>
    3535
    3636/*
  • cpukit/score/cpu/i386/rtems/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <i386.h>
     34#include <rtems/i386.h>
    3535
    3636/*
  • cpukit/score/cpu/i960/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <i960.h>
     34#include <rtems/i960.h>
    3535
    3636/*
  • cpukit/score/cpu/m68k/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <m68k.h>
     34#include <rtems/m68k.h>
    3535
    3636/*
  • cpukit/score/cpu/m68k/rtems/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <m68k.h>
     34#include <rtems/m68k.h>
    3535
    3636/*
  • cpukit/score/cpu/no_cpu/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <no_cpu.h>
     34#include <rtems/no_cpu.h>
    3535
    3636/*
  • cpukit/score/cpu/no_cpu/rtems/asm.h

    rbf61e45c r88d594a  
    3232
    3333#define ASM
    34 #include <no_cpu.h>
     34#include <rtems/no_cpu.h>
    3535
    3636/*
  • cpukit/score/cpu/unix/cpu.c

    rbf61e45c r88d594a  
    3636#include <stdlib.h>
    3737#include <unistd.h>
    38 #include <string.h>
    3938#include <signal.h>
    4039#include <time.h>
     
    226225  unsigned32        _size,
    227226  unsigned32        _new_level,
    228   proc_ptr         *_entry_point
     227  void             *_entry_point
    229228)
    230229{
    231230    unsigned32  *addr;
    232231    unsigned32   jmp_addr;
    233     unsigned32   _stack;
     232    unsigned32   _stack_low;   /* lowest "stack aligned" address */
     233    unsigned32   _stack_high;  /* highest "stack aligned" address */
    234234    unsigned32   _the_size;
    235235
    236236    jmp_addr = (unsigned32) _entry_point;
    237237
    238     _stack = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
    239     _stack &= ~(CPU_STACK_ALIGNMENT - 1);
     238    /*
     239     *  On CPUs with stacks which grow down, we build the stack
     240     *  based on the _stack_high address.  On CPUs with stacks which
     241     *  grow up, we build the stack based on the _stack_low address. 
     242     */
     243
     244    _stack_low = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
     245    _stack_low &= ~(CPU_STACK_ALIGNMENT - 1);
     246
     247    _stack_high = ((unsigned32)(_stack_base) + _size);
     248    _stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
    240249
    241250    _the_size = _size & ~(CPU_STACK_ALIGNMENT - 1);
     
    251260#if defined(hppa1_1)
    252261    *(addr + RP_OFF) = jmp_addr;
    253     *(addr + SP_OFF) = (unsigned32)(_stack + CPU_FRAME_SIZE);
     262    *(addr + SP_OFF) = (unsigned32)(_stack_low + CPU_FRAME_SIZE);
    254263
    255264    /*
     
    275284
    276285    *(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
    277     *(addr + SP_OFF) = (unsigned32)(_stack +_the_size - CPU_FRAME_SIZE);
    278     *(addr + FP_OFF) = (unsigned32)(_stack +_the_size);
     286    *(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
     287    *(addr + FP_OFF) = (unsigned32)(_stack_high);
    279288#else
    280289#error "UNKNOWN CPU!!!"
  • cpukit/score/include/rtems/score/watchdog.h

    rbf61e45c r88d594a  
    101101
    102102/*
    103  *  The following type is used for synchronization purposes
     103 *  The following are used for synchronization purposes
    104104 *  during an insert on a watchdog delta chain.
    105  *
    106  *  NOTE:  Watchdog_Pointer is only used to insure that
    107  *         Watchdog_Synchronization_pointer is a pointer
    108  *         which is volatile rather than a pointer to a
    109  *         volatile block of memory.
    110  */
    111 
    112 typedef Watchdog_Control          *Watchdog_Pointer;
    113 typedef volatile Watchdog_Pointer  Watchdog_Synchronization_pointer;
     105 */
     106
     107volatile unsigned32  _Watchdog_Sync_level;
     108volatile unsigned32  _Watchdog_Sync_count;
    114109
    115110/*
     
    120115EXTERN Chain_Control _Watchdog_Ticks_chain;
    121116EXTERN Chain_Control _Watchdog_Seconds_chain;
    122 
    123 /*
    124  *  The following defines the synchronization variable used to
    125  *  allow interrupts to be enabled while inserting a watchdog
    126  *  on a watchdog chain.
    127  */
    128 
    129 EXTERN Watchdog_Synchronization_pointer _Watchdog_Sync;
    130117
    131118/*
     
    377364
    378365/*
    379  *
    380  *  _Watchdog_Get_sync
    381  *
    382  *  DESCRIPTION:
    383  *
    384  *  This routine returns the current synchronization timer.  This
    385  *  routine is used so that interrupts can be enabled while a
    386  *  watchdog timer is being inserted into a watchdog chain.
    387  */
    388 
    389 STATIC INLINE Watchdog_Control *_Watchdog_Get_sync( void );
    390 
    391 /*
    392  *
    393  *  _Watchdog_Set_sync
    394  *
    395  *  DESCRIPTION:
    396  *
    397  *  This routine sets the current synchronization timer.  This
    398  *  routine is used so that interrupts can be enabled while a
    399  *  watchdog timer is being inserted into a watchdog chain.
    400  */
    401 
    402 STATIC INLINE void _Watchdog_Set_sync(
    403   Watchdog_Control *the_watchdog
    404 );
    405 
    406 /*
    407  *
    408  *  _Watchdog_Clear_sync
    409  *
    410  *  DESCRIPTION:
    411  *
    412  *  This routine will set the watchdog synchronization flag to a
    413  *  NULL address indicating synchronization is unnecessary.
    414  */
    415 
    416 STATIC INLINE void _Watchdog_Clear_sync( void );
    417 
    418 /*
    419366 *  _Watchdog_Adjust
    420367 *
     
    428375  Chain_Control              *header,
    429376  Watchdog_Adjust_directions  direction,
    430   rtems_interval           units
     377  rtems_interval              units
    431378);
    432379
  • cpukit/score/inline/rtems/score/watchdog.inl

    rbf61e45c r88d594a  
    258258}
    259259
    260 /*PAGE
    261  *
    262  *  _Watchdog_Get_sync
    263  *
    264  */
    265 
    266 STATIC INLINE Watchdog_Control *_Watchdog_Get_sync( void )
    267 {
    268   return (Watchdog_Control *) _Watchdog_Sync;
    269 }
    270 
    271 /*PAGE
    272  *
    273  *  _Watchdog_Set_sync
    274  *
    275  */
    276 
    277 STATIC INLINE void _Watchdog_Set_sync(
    278   Watchdog_Control *the_watchdog
    279 )
    280 {
    281   _Watchdog_Sync = (Watchdog_Synchronization_pointer) the_watchdog;
    282 }
    283 
    284 /*PAGE
    285  *
    286  *  _Watchdog_Clear_sync
    287  *
    288  */
    289 
    290 STATIC INLINE void _Watchdog_Clear_sync( void )
    291 {
    292   _Watchdog_Sync = NULL;
    293 }
    294 
    295260#endif
    296261/* end of include file */
  • cpukit/score/macros/rtems/score/watchdog.inl

    rbf61e45c r88d594a  
    172172  ((Watchdog_Control *) (_header)->last)
    173173
    174 /*PAGE
    175  *
    176  *  _Watchdog_Get_sync
    177  *
    178  */
    179 
    180 #define _Watchdog_Get_sync() \
    181    ((Watchdog_Control *) _Watchdog_Sync)
    182 
    183 /*PAGE
    184  *
    185  *  _Watchdog_Set_sync
    186  *
    187  */
    188 
    189 #define _Watchdog_Set_sync( _the_watchdog ) \
    190   _Watchdog_Sync = (Watchdog_Synchronization_pointer) (_the_watchdog)
    191 
    192 /*PAGE
    193  *
    194  *  _Watchdog_Clear_sync
    195  *
    196  */
    197 
    198 #define _Watchdog_Clear_sync() \
    199   _Watchdog_Sync = NULL;
    200 
    201174#endif
    202175/* end of include file */
  • cpukit/score/src/heap.c

    rbf61e45c r88d594a  
    117117{
    118118  Heap_Block        *the_block;
    119   Heap_Block        *next_block;
    120   Heap_Block        *previous_block;
     119 
     120  /*
     121   *  The overhead was taken from the original heap memory.
     122   */
     123
     124  Heap_Block  *old_final;
     125  Heap_Block  *new_final;
    121126
    122127  /*
     
    151156  /*
    152157   *  Currently only case 4 should make it to this point.
    153    */
    154 
    155   *amount_extended = size - HEAP_BLOCK_USED_OVERHEAD;
    156 
    157   previous_block = the_heap->last;
    158 
    159   the_block              = (Heap_Block *) starting_address;
    160   the_block->front_flag  = size;
    161   the_block->next        = previous_block->next;
    162   the_block->previous    = previous_block;
    163 
    164   previous_block->next   = the_block;
    165   the_heap->last         = the_block;
    166 
    167   next_block             = _Heap_Next_block( the_block );
    168   next_block->back_flag  = size;
    169   next_block->front_flag = HEAP_DUMMY_FLAG;
    170   the_heap->final        = next_block;
     158   *  The basic trick is to make the extend area look like a used
     159   *  block and free it.
     160   */
     161
     162  *amount_extended = size;
     163
     164  old_final = the_heap->final;
     165  new_final = _Addresses_Add_offset( old_final, size );
     166  /* SAME AS: _Addresses_Add_offset( starting_address, size-HEAP_OVERHEAD ); */
     167
     168  the_heap->final = new_final;
     169
     170  old_final->front_flag =
     171  new_final->back_flag  = _Heap_Build_flag( size, HEAP_BLOCK_USED );
     172  new_final->front_flag = HEAP_DUMMY_FLAG;
     173
     174  /*
     175   *  Must pass in address of "user" area
     176   */
     177
     178  _Heap_Free( the_heap, &old_final->next );
    171179
    172180  return HEAP_EXTEND_SUCCESSFUL;
     
    393401)
    394402{
    395   Heap_Block *the_block;
    396   Heap_Block *next_block;
     403  Heap_Block *the_block  = 0;  /* avoid warnings */
     404  Heap_Block *next_block = 0;  /* avoid warnings */
    397405  int         notdone = 1;
    398406
  • cpukit/score/src/watchdog.c

    rbf61e45c r88d594a  
    3131void _Watchdog_Handler_initialization( void )
    3232{
    33   _Watchdog_Clear_sync();
     33  _Watchdog_Sync_count = 0;
     34  _Watchdog_Sync_level = 0;
    3435  _Chain_Initialize_empty( &_Watchdog_Ticks_chain );
    3536  _Chain_Initialize_empty( &_Watchdog_Seconds_chain );
     
    5758    case WATCHDOG_INACTIVE:
    5859      break;
     60
     61    case WATCHDOG_REINSERT: 
     62   
     63      /*
     64       *  It is not actually on the chain so just change the state and
     65       *  the Insert operation we interrupted will be aborted.
     66       */
     67      the_watchdog->state = WATCHDOG_INACTIVE;
     68      break;
     69
    5970    case WATCHDOG_ACTIVE:
    60     case WATCHDOG_REINSERT:
    6171    case WATCHDOG_REMOVE_IT:
    6272
     
    6777        next_watchdog->delta_interval += the_watchdog->delta_interval;
    6878
    69       if ( the_watchdog == _Watchdog_Sync )
    70         _Watchdog_Sync = _Watchdog_Previous( the_watchdog );
     79      if ( _Watchdog_Sync_count )
     80        _Watchdog_Sync_level = _ISR_Nest_level;
    7181
    7282      _Chain_Extract_unprotected( &the_watchdog->Node );
     
    95105  Chain_Control               *header,
    96106  Watchdog_Adjust_directions   direction,
    97   rtems_interval            units
     107  rtems_interval               units
    98108)
    99109{
     
    137147  ISR_Level         level;
    138148  Watchdog_Control *after;
    139 
    140   the_watchdog->state          = WATCHDOG_REINSERT;
    141   the_watchdog->delta_interval = the_watchdog->initial;
     149  unsigned32        insert_isr_nest_level;
     150  rtems_interval    delta_interval;
     151 
     152
     153  insert_isr_nest_level   = _ISR_Nest_level;
     154  the_watchdog->state = WATCHDOG_REINSERT;
     155
     156  _Watchdog_Sync_count++;
     157restart:
     158  delta_interval = the_watchdog->initial;
    142159
    143160  _ISR_Disable( level );
     
    145162  for ( after = _Watchdog_First( header ) ;
    146163        ;
    147         after = _Watchdog_Next( _Watchdog_Get_sync() ) ) {
    148 
    149      if ( the_watchdog->delta_interval == 0 || !_Watchdog_Next( after ) )
     164        after = _Watchdog_Next( after ) ) {
     165
     166     if ( delta_interval == 0 || !_Watchdog_Next( after ) )
    150167       break;
    151168
    152      if ( the_watchdog->delta_interval < after->delta_interval ) {
    153        after->delta_interval -= the_watchdog->delta_interval;
     169     if ( delta_interval < after->delta_interval ) {
     170       after->delta_interval -= delta_interval;
    154171       break;
    155172     }
    156173
    157      the_watchdog->delta_interval -= after->delta_interval;
    158      _Watchdog_Set_sync( after );
     174     delta_interval -= after->delta_interval;
    159175
    160176     /*
    161       *  If you experience problems comment out the _ISR_Flash line.  Under
    162       *  certain circumstances, this flash allows interrupts to execute
    163       *  which violate the design assumptions.  The critical section
    164       *  mechanism used here must be redesigned to address this.
     177      *  If you experience problems comment out the _ISR_Flash line.  This
     178      *  (3.2.0) is the first release with this critical section redesigned.
     179      *  Under certain circumstances, the PREVIOUS critical section algorithm
     180      *  used around this flash point allows interrupts to execute
     181      *  which violated the design assumptions.  The critical section
     182      *  mechanism used here WAS redesigned to address this.
    165183      */
    166184
    167185     _ISR_Flash( level );
     186
     187     if ( the_watchdog->state != WATCHDOG_REINSERT ) {
     188       goto exit_insert;
     189     }
     190
     191     if ( _Watchdog_Sync_level > insert_isr_nest_level ) {
     192       _Watchdog_Sync_level = insert_isr_nest_level;
     193       _ISR_Enable( level );
     194       goto restart;
     195     }
    168196  }
    169197
     
    171199    _Watchdog_Activate( the_watchdog );
    172200
     201  the_watchdog->delta_interval = delta_interval;
     202
    173203  _Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node );
    174204
    175   _Watchdog_Clear_sync();
    176 
    177   _ISR_Enable(  level );
     205exit_insert:
     206  _Watchdog_Sync_level = insert_isr_nest_level;
     207  _Watchdog_Sync_count--;
     208  _ISR_Enable( level );
    178209}
    179210
Note: See TracChangeset for help on using the changeset viewer.