Changeset 28779c7 in rtems


Ignore:
Timestamp:
Mar 7, 2014, 11:53:41 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
b4b86b82
Parents:
d50acdbb
git-author:
Sebastian Huber <sebastian.huber@…> (03/07/14 11:53:41)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/11/14 09:58:09)
Message:

score: Add function to destroy SMP locks

Files:
9 edited

Legend:

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

    rd50acdbb r28779c7  
    446446        (tty->device.outputUsesInterrupts == TERMIOS_TASK_DRIVEN))
    447447      rtems_semaphore_delete (tty->rawInBuf.Semaphore);
     448    rtems_interrupt_lock_destroy (&tty->interrupt_lock);
    448449    free (tty->rawInBuf.theBuf);
    449450    free (tty->rawOutBuf.theBuf);
  • cpukit/rtems/include/rtems/rtems/intr.h

    rd50acdbb r28779c7  
    181181
    182182/**
     183 * @brief Destroys an interrupt lock.
     184 *
     185 * Concurrent destruction leads to unpredictable results.
     186 *
     187 * @param[in,out] _lock The interrupt lock control.
     188 */
     189#define rtems_interrupt_lock_destroy( _lock ) \
     190  _ISR_lock_Destroy( _lock )
     191
     192/**
    183193 * @brief Acquires an interrupt lock.
    184194 *
  • cpukit/score/include/rtems/score/isrlock.h

    rd50acdbb r28779c7  
    9696
    9797/**
     98 * @brief Destroys an ISR lock.
     99 *
     100 * Concurrent destruction leads to unpredictable results.
     101 *
     102 * @param[in,out] lock The ISR lock control.
     103 */
     104static inline void _ISR_lock_Destroy( ISR_lock_Control *lock )
     105{
     106#if defined( RTEMS_SMP )
     107  _SMP_lock_Destroy( &lock->lock );
     108#else
     109  (void) lock;
     110#endif
     111}
     112
     113/**
    98114 * @brief Acquires an ISR lock.
    99115 *
  • cpukit/score/include/rtems/score/smplock.h

    rd50acdbb r28779c7  
    6565
    6666/**
    67  * @brief Initializes an SMP ticket lock control.
     67 * @brief Initializes an SMP ticket lock.
    6868 *
    6969 * Concurrent initialization leads to unpredictable results.
    7070 *
    71  * @param[out] lock The SMP ticket lock control.
     71 * @param[in,out] lock The SMP ticket lock control.
    7272 */
    7373static inline void _SMP_ticket_lock_Initialize( SMP_ticket_lock_Control *lock )
     
    7575  _Atomic_Init_uint( &lock->next_ticket, 0U );
    7676  _Atomic_Init_uint( &lock->now_serving, 0U );
     77}
     78
     79/**
     80 * @brief Destroys an SMP ticket lock.
     81 *
     82 * Concurrent destruction leads to unpredictable results.
     83 *
     84 * @param[in,out] lock The SMP ticket lock control.
     85 */
     86static inline void _SMP_ticket_lock_Destroy( SMP_ticket_lock_Control *lock )
     87{
     88  (void) lock;
    7789}
    7890
     
    132144
    133145/**
    134  * @brief Initializes an SMP lock control.
     146 * @brief Initializes an SMP lock.
    135147 *
    136148 * Concurrent initialization leads to unpredictable results.
    137149 *
    138  * @param[out] lock The SMP lock control.
     150 * @param[in,out] lock The SMP lock control.
    139151 */
    140152static inline void _SMP_lock_Initialize( SMP_lock_Control *lock )
    141153{
    142154  _SMP_ticket_lock_Initialize( &lock->ticket_lock );
     155}
     156
     157/**
     158 * @brief Destroys an SMP lock.
     159 *
     160 * Concurrent destruction leads to unpredictable results.
     161 *
     162 * @param[in,out] lock The SMP lock control.
     163 */
     164static inline void _SMP_lock_Destroy( SMP_lock_Control *lock )
     165{
     166  _SMP_ticket_lock_Destroy( &lock->ticket_lock );
    143167}
    144168
  • testsuites/smptests/smplock01/init.c

    rd50acdbb r28779c7  
    139139{
    140140  unsigned long counter = 0;
    141   SMP_lock_Control lock = SMP_LOCK_INITIALIZER;
    142   SMP_lock_Context lock_context;
     141  SMP_lock_Control lock;
     142  SMP_lock_Context lock_context;
     143
     144  _SMP_lock_Initialize(&lock);
    143145
    144146  while (assert_state(ctx, START_TEST)) {
     
    148150  }
    149151
     152  _SMP_lock_Destroy(&lock);
     153
    150154  ctx->test_counter[test][cpu_self] = counter;
    151155}
     
    160164{
    161165  unsigned long counter = 0;
    162   SMP_lock_Control lock = SMP_LOCK_INITIALIZER;
    163   SMP_lock_Context lock_context;
     166  SMP_lock_Control lock;
     167  SMP_lock_Context lock_context;
     168
     169  _SMP_lock_Initialize(&lock);
    164170
    165171  while (assert_state(ctx, START_TEST)) {
     
    172178    ++counter;
    173179  }
     180
     181  _SMP_lock_Destroy(&lock);
    174182
    175183  ctx->test_counter[test][cpu_self] = counter;
  • testsuites/sptests/sp37/init.c

    rd50acdbb r28779c7  
    179179
    180180  rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );
     181
     182  _ISR_lock_Destroy( &lock );
     183  _ISR_lock_Destroy( &initialized );
    181184}
    182185
     
    213216
    214217  rtems_test_assert( normal_interrupt_level == get_interrupt_level() );
     218
     219  rtems_interrupt_lock_destroy( &lock );
     220  rtems_interrupt_lock_destroy( &initialized );
    215221}
    216222
  • testsuites/sptests/spcache01/init.c

    rd50acdbb r28779c7  
    9191
    9292    rtems_interrupt_lock_release(&lock, &lock_context);
     93    rtems_interrupt_lock_destroy(&lock);
    9394
    9495    printf(
     
    365366    d[2]
    366367  );
     368
     369  rtems_interrupt_lock_destroy(&lock);
    367370}
    368371
  • testsuites/sptests/spnsext01/init.c

    rd50acdbb r28779c7  
    6666  }
    6767  rtems_interrupt_lock_release(&lock, &lock_context);
     68  rtems_interrupt_lock_destroy(&lock);
    6869
    6970  puts("*** END OF TEST NANO SECONDS EXTENSION 1 ***");
  • testsuites/tmtests/tmcontext01/init.c

    rd50acdbb r28779c7  
    130130static void test_by_function_level(int fl, bool dirty)
    131131{
    132   rtems_interrupt_lock lock = RTEMS_INTERRUPT_LOCK_INITIALIZER;
     132  rtems_interrupt_lock lock;
    133133  rtems_interrupt_lock_context lock_context;
    134134  int s;
     
    139139  uint64_t max;
    140140
     141  rtems_interrupt_lock_initialize(&lock);
    141142  rtems_interrupt_lock_acquire(&lock, &lock_context);
    142143
     
    146147
    147148  rtems_interrupt_lock_release(&lock, &lock_context);
     149  rtems_interrupt_lock_destroy(&lock);
    148150
    149151  sort_t();
Note: See TracChangeset for help on using the changeset viewer.