Changeset 76ac1ee3 in rtems for cpukit/sapi


Ignore:
Timestamp:
Dec 23, 2015, 6:29:47 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
2e8c4ad
Parents:
2b9374e1
git-author:
Sebastian Huber <sebastian.huber@…> (12/23/15 06:29:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/19/16 07:36:14)
Message:

score: Fix simple timecounter support

Update #2502.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/include/rtems/timecounter.h

    r2b9374e1 r76ac1ee3  
    9595
    9696/**
     97 * @brief At tick handling done under protection of the timecounter lock.
     98 */
     99typedef void rtems_timecounter_simple_at_tick(
     100  rtems_timecounter_simple *tc
     101);
     102
     103/**
    97104 * @brief Returns the current value of a simple timecounter.
    98105 */
     
    200207 * @param[in] tc The simple timecounter.
    201208 * @param[in] get The method to get the value of the simple timecounter.
     209 * @param[in] at_tick The method to perform work under timecounter lock
     210 * protection at this tick, e.g. clear a pending flag.
    202211 */
    203212RTEMS_INLINE_ROUTINE void rtems_timecounter_simple_downcounter_tick(
    204   rtems_timecounter_simple     *tc,
    205   rtems_timecounter_simple_get  get
    206 )
    207 {
     213  rtems_timecounter_simple         *tc,
     214  rtems_timecounter_simple_get      get,
     215  rtems_timecounter_simple_at_tick  at_tick
     216)
     217{
     218  ISR_lock_Context lock_context;
    208219  uint32_t current;
     220
     221  _Timecounter_Acquire( &lock_context );
     222
     223  ( *at_tick )( tc );
    209224
    210225  current = rtems_timecounter_simple_scale(
     
    213228  );
    214229
    215   _Timecounter_Tick_simple( tc->binary_interval, current );
     230  _Timecounter_Tick_simple( tc->binary_interval, current, &lock_context );
    216231}
    217232
     
    221236 * @param[in] tc The simple timecounter.
    222237 * @param[in] get The method to get the value of the simple timecounter.
     238 * @param[in] at_tick The method to perform work under timecounter lock
     239 * protection at this tick, e.g. clear a pending flag.
    223240 */
    224241RTEMS_INLINE_ROUTINE void rtems_timecounter_simple_upcounter_tick(
    225   rtems_timecounter_simple     *tc,
    226   rtems_timecounter_simple_get  get
    227 )
    228 {
     242  rtems_timecounter_simple         *tc,
     243  rtems_timecounter_simple_get      get,
     244  rtems_timecounter_simple_at_tick  at_tick
     245)
     246{
     247  ISR_lock_Context lock_context;
    229248  uint32_t current;
    230249
     250  _Timecounter_Acquire( &lock_context );
     251
     252  ( *at_tick )( tc );
     253
    231254  current = rtems_timecounter_simple_scale( tc, ( *get )( tc ) );
    232255
    233   _Timecounter_Tick_simple( tc->binary_interval, current );
     256  _Timecounter_Tick_simple( tc->binary_interval, current, &lock_context );
    234257}
    235258
Note: See TracChangeset for help on using the changeset viewer.