Changeset 2d1bdc8 in rtems


Ignore:
Timestamp:
Dec 24, 2013, 5:38:42 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11, master
Children:
9f9c0bb
Parents:
c2b7528
git-author:
Chris Johns <chrisj@…> (12/24/13 05:38:42)
git-committer:
Chris Johns <chrisj@…> (12/24/13 05:46:19)
Message:

cpukit/rtems: Add rtems_clock_get_uptime_nanoseconds to the RTEMS API.

Add Timestamp support in the score to return a timestamp in nanoseconds.
Add a test.
Update the RTEMS API documentation.

Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/Makefile.am

    rc2b7528 r2d1bdc8  
    152152librtems_a_SOURCES += src/clockgetuptimetimeval.c
    153153librtems_a_SOURCES += src/clockgetuptimeseconds.c
     154librtems_a_SOURCES += src/clockgetuptimenanoseconds.c
    154155librtems_a_SOURCES += src/clockset.c
    155156librtems_a_SOURCES += src/clocksetnsecshandler.c
  • cpukit/rtems/include/rtems/rtems/clock.h

    rc2b7528 r2d1bdc8  
    258258
    259259/**
     260 * @brief Returns the system uptime in nanoseconds.
     261 *
     262 * @retval The system uptime in nanoseconds.
     263 */
     264uint64_t rtems_clock_get_uptime_nanoseconds( void );
     265
     266/**
    260267 * @brief TOD Validate
    261268 *
  • cpukit/score/Makefile.am

    rc2b7528 r2d1bdc8  
    216216    src/schedulersimpleschedule.c \
    217217    src/schedulersimpleunblock.c \
    218     src/schedulersimpleyield.c 
     218    src/schedulersimpleyield.c
    219219
    220220## SCHEDULEREDF_C_FILES
     
    276276    src/threadstartmultitasking.c src/iterateoverthreads.c \
    277277    src/threadblockingoperationcancel.c
    278    
     278
    279279if HAS_SMP
    280280libscore_a_SOURCES += src/threaddispatchdisablelevel.c
     
    295295    src/timespecisvalid.c src/timespeclessthan.c \
    296296    src/timespecsubtract.c src/timespectoticks.c src/timespecdivide.c \
    297     src/timespecdividebyinteger.c
     297    src/timespecdividebyinteger.c src/timespecgetasnanoseconds.c
    298298
    299299## TIMESTAMP_INT64_C_FILES
  • cpukit/score/include/rtems/score/timespec.h

    rc2b7528 r2d1bdc8  
    9090
    9191/**
     92 *  @brief Get the timestamp as nanoseconds.
     93 *
     94 *  This method returns the timestamp as nanoseconds.
     95 *
     96 *  @param[in] time points to the timestamp.
     97 *  @param[in] nanoseconds the nanoseconds since the last tick.
     98 *
     99 *  @retval The time in nanoseconds.
     100 */
     101uint64_t _Timespec_Get_As_nanoseconds(
     102  const struct timespec *time,
     103  const uint32_t nanoseconds
     104);
     105
     106/**
    92107 * @brief Check if timespec is valid.
    93108 *
  • cpukit/score/include/rtems/score/timestamp.h

    rc2b7528 r2d1bdc8  
    331331
    332332/**
     333 *  @brief Get the timestamp as nanoseconds.
     334 *
     335 *  This method returns the timestamp as nanoseconds.
     336 *
     337 *  @param[in] _time points to the timestamp
     338 *
     339 *  @retval The time in nanoseconds.
     340 */
     341#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
     342  #define _Timestamp_Get_As_nanoseconds( _timestamp, _nanoseconds ) \
     343          _Timespec_Get_As_nanoseconds( _timestamp, _nanoseconds )
     344#else
     345  #define _Timestamp_Get_As_nanoseconds( _timestamp, _nanoseconds ) \
     346          _Timestamp64_Get_As_nanoseconds( _timestamp, _nanoseconds )
     347#endif
     348
     349/**
    333350 *  @brief Convert timestamp to struct timespec.
    334351 *
  • cpukit/score/include/rtems/score/timestamp64.h

    rc2b7528 r2d1bdc8  
    368368#endif
    369369
     370static inline uint64_t _Timestamp64_implementation_Get_As_nanoseconds(
     371  const Timestamp64_Control *_time,
     372  const uint32_t nanoseconds
     373)
     374{
     375  return *_time + (uint64_t) nanoseconds;
     376}
     377
     378/**
     379 *  @brief Get the 64-bit timestamp as nanoseconds.
     380 *
     381 *  This method returns the 64-bit timestamp as it is already in nanoseconds.
     382 *
     383 *  @param[in] _time points to the timestamp
     384 *
     385 *  @retval The nanoseconds portion of @a _time.
     386 */
     387#define _Timestamp64_Get_As_nanoseconds( _time, _nanoseconds ) \
     388  _Timestamp64_implementation_Get_As_nanoseconds( _time, _nanoseconds )
     389
    370390static inline void _Timestamp64_implementation_To_timespec(
    371391  const Timestamp64_Control *_timestamp,
  • doc/user/clock.t

    rc2b7528 r2d1bdc8  
    1919@item @code{@value{DIRPREFIX}clock_get_tod} - Get date and time in TOD format
    2020@item @code{@value{DIRPREFIX}clock_get_tod_timeval} - Get date and time in timeval format
    21 @item @code{@value{DIRPREFIX}clock_get_seconds_since_epoch} - Get seconds since epoch 
     21@item @code{@value{DIRPREFIX}clock_get_seconds_since_epoch} - Get seconds since epoch
    2222@item @code{@value{DIRPREFIX}clock_get_ticks_per_second} - Get ticks per second
    2323@item @code{@value{DIRPREFIX}clock_get_ticks_since_boot} - Get ticks since boot
     
    2525@item @code{@value{DIRPREFIX}clock_get_uptime_timeval} - Get time since boot in timeval format
    2626@item @code{@value{DIRPREFIX}clock_get_uptime_seconds} - Get seconds since boot
     27@item @code{@value{DIRPREFIX}clock_get_uptime_nanoseconds} - Get nanoseconds since boot
    2728@item @code{@value{DIRPREFIX}clock_set_nanoseconds_extension} - Install the nanoseconds since last tick handler
    2829@item @code{@value{DIRPREFIX}clock_tick} - Announce a clock tick
     
    8687supported when setting the system date and time using the
    8788@code{@value{DIRPREFIX}clock_set} directive.  Some applications
    88 expect to operate on a "UNIX-style" date and time data structure.  The 
     89expect to operate on a "UNIX-style" date and time data structure.  The
    8990@code{@value{DIRPREFIX}clock_get_tod_timeval} always returns
    90 the date and time in @code{struct timeval} format.  The 
     91the date and time in @code{struct timeval} format.  The
    9192@code{@value{DIRPREFIX}clock_get} directive can optionally return
    92 the current date and time in this format. 
     93the current date and time in this format.
    9394
    9495The @code{struct timeval} data structure has two fields: @code{tv_sec}
     
    143144@code{@value{DIRPREFIX}event_receive},
    144145@code{@value{DIRPREFIX}semaphore_obtain} and
    145 @code{@value{DIRPREFIX}region_get_segment} directives. 
    146 Each task may have one and only one timeout active at a time. 
     146@code{@value{DIRPREFIX}region_get_segment} directives.
     147Each task may have one and only one timeout active at a time.
    147148When a timeout expires, it unblocks the task with a timeout status code.
    148149
     
    193194@code{@value{DIRPREFIX}clock_get_options}:
    194195
    195 @findex rtems_clock_get_options 
     196@findex rtems_clock_get_options
    196197
    197198@itemize @bullet
     
    323324has not been set with a previous call to
    324325@code{@value{DIRPREFIX}clock_set}, then the
    325 @code{@value{RPREFIX}NOT_DEFINED} status code is returned. 
     326@code{@value{RPREFIX}NOT_DEFINED} status code is returned.
    326327The caller can always obtain the number of ticks per second (option is
    327328@code{@value{RPREFIX}CLOCK_GET_TICKS_PER_SECOND}) and the number of
     
    334335indicated below:
    335336
    336 @findex rtems_clock_get_options 
     337@findex rtems_clock_get_options
    337338@ifset is-C
    338339@itemize @bullet
     
    418419has not been set with a previous call to
    419420@code{@value{DIRPREFIX}clock_set}, then the
    420 @code{@value{RPREFIX}NOT_DEFINED} status code is returned. 
     421@code{@value{RPREFIX}NOT_DEFINED} status code is returned.
    421422
    422423@subheading NOTES:
     
    469470has not been set with a previous call to
    470471@code{@value{DIRPREFIX}clock_set}, then the
    471 @code{@value{RPREFIX}NOT_DEFINED} status code is returned. 
     472@code{@value{RPREFIX}NOT_DEFINED} status code is returned.
    472473
    473474@subheading NOTES:
     
    520521has not been set with a previous call to
    521522@code{@value{DIRPREFIX}clock_set}, then the
    522 @code{@value{RPREFIX}NOT_DEFINED} status code is returned. 
     523@code{@value{RPREFIX}NOT_DEFINED} status code is returned.
    523524
    524525@subheading NOTES:
     
    621622
    622623This directive simply returns the number of times the dirivective
    623 @code{@value{DIRPREFIX}clock_tick} has been invoked since the 
     624@code{@value{DIRPREFIX}clock_tick} has been invoked since the
    624625system was booted.
    625626
     
    737738@c
    738739@page
     740@subsection CLOCK_GET_UPTIME_NANOSECONDS - Get the nanoseconds since boot
     741
     742@cindex clock get nanoseconds uptime
     743@cindex uptime
     744
     745@subheading CALLING SEQUENCE:
     746
     747@ifset is-C
     748@findex rtems_clock_get_uptime_nanoseconds
     749@example
     750uint64_t rtems_clock_get_uptime_nanoseconds(void);
     751@end example
     752@end ifset
     753
     754@subheading DIRECTIVE STATUS CODES:
     755
     756The system uptime in nanoseconds.
     757
     758@subheading DESCRIPTION:
     759
     760This directive returns the nanoseconds since the system was booted.
     761
     762@subheading NOTES:
     763
     764This directive may be called from an ISR.
     765
     766@c
     767@c
     768@c
     769@page
    739770@subsection CLOCK_SET_NANOSECONDS_EXTENSION - Install the nanoseconds since last tick handler
    740771
     
    766797@subheading DESCRIPTION:
    767798
    768 This directive is used by the Clock device driver to install the 
     799This directive is used by the Clock device driver to install the
    769800@code{routine} which will be invoked by the internal RTEMS method used to
    770801obtain a highly accurate time of day.  It is usually called during
     
    781812This directive may be called from an ISR.
    782813
    783 This directive is called as part of every service to obtain the 
     814This directive is called as part of every service to obtain the
    784815current date and time as well as timestamps.
    785816
     
    829860microseconds per tick and number of ticks per timeslice,
    830861respectively.
    831 
  • testsuites/sptests/sp09/screen02.c

    rc2b7528 r2d1bdc8  
    9090  rtems_clock_get_uptime_seconds();
    9191
     92  puts( "TA1 - rtems_clock_get_uptime_nanoseconds" );
     93  rtems_clock_get_uptime_nanoseconds();
     94
    9295  puts( "TA1 - rtems_clock_get_tod_timeval - RTEMS_INVALID_ADDRESS" );
    9396  status = rtems_clock_get_tod_timeval( NULL );
  • testsuites/sptests/sp09/sp09.scn

    rc2b7528 r2d1bdc8  
    3434TA1 - rtems_clock_get_uptime_timeval
    3535TA1 - rtems_clock_get_uptime_seconds
     36TA1 - rtems_clock_get_uptime_nanoseconds
    3637TA1 - rtems_clock_get_tod_timeval - RTEMS_INVALID_ADDRESS
    3738TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED
Note: See TracChangeset for help on using the changeset viewer.