Changeset 98c7eaca in rtems for cpukit/sapi


Ignore:
Timestamp:
07/23/13 07:48:38 (11 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
2445bda
Parents:
b5ffa5e
git-author:
Sebastian Huber <sebastian.huber@…> (07/23/13 07:48:38)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/23/13 13:12:51)
Message:

sapi: Merge timespec API into one file

Location:
cpukit/sapi
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/Makefile.am

    rb5ffa5e r98c7eaca  
    2222include_rtems_HEADERS += inline/rtems/extension.inl
    2323include_rtems_HEADERS += inline/rtems/rbtree.inl
    24 include_rtems_HEADERS += inline/rtems/timespec.inl
    2524
    2625## src
  • cpukit/sapi/include/rtems/timespec.h

    rb5ffa5e r98c7eaca  
    2121#include <rtems/score/timespec.h>
    2222
     23#ifdef __cplusplus
     24extern "C" {
     25#endif
     26
    2327/**
    2428 *  @defgroup TimespecAPI Timespec
     
    3236 */
    3337
    34 #include <stdbool.h> /* bool */
    35 #include <stdint.h> /* uint32_t */
    36 #include <time.h> /* struct timespec */
    37 
    38 #ifdef __cplusplus
    39 extern "C" {
    40 #endif
    41 
    42 #include <rtems/timespec.inl>
     38/**
     39 * @brief Is timespec valid
     40 *
     41 * This method determines the validity of a timespec.
     42 *
     43 * @param[in] time is the timespec instance to validate.
     44 *
     45 * @retval true The timespec is valid.
     46 * @retval false The timespec is not valid.
     47 */
     48RTEMS_INLINE_ROUTINE bool rtems_timespec_is_valid(
     49  const struct timespec *time
     50)
     51{
     52  return _Timespec_Is_valid(time);
     53}
     54
     55/**
     56 * @brief Timespec less than operator.
     57 *
     58 * This method is the less than operator for timespecs.
     59 *
     60 * @param[in] lhs is the left hand side timespec
     61 * @param[in] rhs is the right hand side timespec
     62 *
     63 * @retval true @a lhs is less than @a rhs.
     64 * @retval false @a lhs is not less than @a rhs.
     65 *
     66 */
     67RTEMS_INLINE_ROUTINE bool rtems_timespec_less_than(
     68  const struct timespec *lhs,
     69  const struct timespec *rhs
     70)
     71{
     72  return _Timespec_Less_than(lhs,rhs);
     73}
     74
     75/**
     76 * @brief Add to a timespec.
     77 *
     78 * This routine adds two timespecs.  The second argument is added
     79 * to the first.
     80 *
     81 * @param[in] time is the base time to be added to
     82 * @param[in] add is the timespec to add to the first argument
     83 *
     84 * @return This method returns the number of seconds @a time increased by.
     85 */
     86RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_add_to(
     87  struct timespec       *time,
     88  const struct timespec *add
     89)
     90{
     91  return _Timespec_Add_to(time,add);
     92}
     93
     94/**
     95 * @brief Convert timespec to number of ticks.
     96 *
     97 * This routine convert the @a time timespec to the corresponding number
     98 * of clock ticks.
     99 *
     100 * @param[in] time is the time to be converted
     101 *
     102 * @return This method returns the number of ticks computed.
     103 */
     104RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_to_ticks(
     105  const struct timespec *time
     106)
     107{
     108  return _Timespec_To_ticks(time);
     109}
     110
     111/**
     112 * @brief Convert ticks to timespec.
     113 *
     114 * This routine converts the @a ticks value to the corresponding
     115 * timespec format @a time.
     116 *
     117 * @param[in] time is the timespec format time result
     118 * @param[in] ticks is the number of ticks to convert
     119 */
     120
     121RTEMS_INLINE_ROUTINE void rtems_timespec_from_ticks(
     122  uint32_t         ticks,
     123  struct timespec *time
     124)
     125{
     126  _Timespec_From_ticks(ticks,time);
     127}
     128
     129/**
     130 * @brief Subtract two timespec.
     131 *
     132 * This routine subtracts two timespecs.  @a result is set to
     133 * @a end - @a start.
     134 *
     135 * @param[in] start is the starting time
     136 * @param[in] end is the ending time
     137 * @param[in] result is the difference between starting and ending time.
     138 *
     139 * @return This method fills in @a result.
     140 */
     141RTEMS_INLINE_ROUTINE void rtems_timespec_subtract(
     142  const struct timespec *start,
     143  const struct timespec *end,
     144  struct timespec       *result
     145)
     146{
     147  _Timespec_Subtract(start,end,result);
     148}
     149
     150/**
     151 * @brief Divide timespec by integer.
     152 *
     153 * This routine divides a timespec by an integer value.  The expected
     154 * use is to assist in benchmark calculations where you typically
     155 * divide a duration by a number of iterations.
     156 *
     157 * @param[in] time is the total
     158 * @param[in] iterations is the number of iterations
     159 * @param[in] result is the average time.
     160 *
     161 * @return This method fills in @a result.
     162 */
     163RTEMS_INLINE_ROUTINE void rtems_timespec_divide_by_integer(
     164  const struct timespec *time,
     165  uint32_t               iterations,
     166  struct timespec       *result
     167)
     168{
     169  _Timespec_Divide_by_integer(time,iterations,result);
     170}
     171
     172/**
     173 * @brief Divide timespec.
     174 *
     175 * This routine divides a timespec by another timespec.  The
     176 * intended use is for calculating percentages to three decimal points.
     177 *
     178 * @param[in] lhs is the left hand number
     179 * @param[in] rhs is the right hand number
     180 * @param[in] ival_percentage is the integer portion of the average
     181 * @param[in] fval_percentage is the thousandths of percentage
     182 *
     183 * @return This method fills in @a result.
     184 */
     185RTEMS_INLINE_ROUTINE void rtems_timespec_divide(
     186  const struct timespec *lhs,
     187  const struct timespec *rhs,
     188  uint32_t              *ival_percentage,
     189  uint32_t              *fval_percentage
     190)
     191{
     192  _Timespec_Divide(lhs,rhs,ival_percentage,fval_percentage);
     193}
     194
     195/**
     196 * @brief Set timespec to seconds nanosecond.
     197 *
     198 * This method sets the timespec to the specified seconds and nanoseconds
     199 * value.
     200 *
     201 * @param[in] _time points to the timespec instance to validate.
     202 * @param[in] _seconds is the seconds portion of the timespec
     203 * @param[in] _nanoseconds is the nanoseconds portion of the timespec
     204 */
     205RTEMS_INLINE_ROUTINE void rtems_timespec_set(
     206  struct timespec *_time,
     207  time_t _seconds,
     208  uint32_t _nanoseconds
     209)
     210{
     211  _Timespec_Set( _time, _seconds, _nanoseconds );
     212}
     213
     214/**
     215 * @brief Zero timespec.
     216 *
     217 * This method sets the timespec to zero.
     218 * value.
     219 *
     220 * @param[in] _time points to the timespec instance to zero.
     221 */
     222RTEMS_INLINE_ROUTINE void rtems_timespec_zero(
     223  struct timespec *_time
     224)
     225{
     226  _Timespec_Set_to_zero( _time );
     227}
     228
     229/**
     230 * @brief Get seconds portion of timespec.
     231 *
     232 * This method returns the seconds portion of the specified timespec
     233 *
     234 * @param[in] _time points to the timespec
     235 *
     236 * @return The seconds portion of @a _time.
     237 */
     238RTEMS_INLINE_ROUTINE time_t rtems_timespec_get_seconds(
     239  struct timespec *_time
     240)
     241{
     242  return _Timespec_Get_seconds( _time );
     243}
     244
     245/**
     246 * @brief Get nanoseconds portion of timespec.
     247 *
     248 * This method returns the nanoseconds portion of the specified timespec
     249 *
     250 * @param[in] _time points to the timespec
     251 *
     252 * @return The nanoseconds portion of @a _time.
     253 */
     254RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_get_nanoseconds(
     255  struct timespec *_time
     256)
     257{
     258  return _Timespec_Get_nanoseconds( _time );
     259}
     260
     261/**
     262 * @brief Timespec greater than operator.
     263 *
     264 * This method is the greater than operator for timespecs.
     265 *
     266 * @param[in] _lhs is the left hand side timespec
     267 * @param[in] _rhs is the right hand side timespec
     268 *
     269 * @retval true @a _lhs is greater than @a _rhs.
     270 * @retval false @a _lhs is not greater than @a _rhs.
     271 */
     272RTEMS_INLINE_ROUTINE bool rtems_timespec_greater_than(
     273  const struct timespec *_lhs,
     274  const struct timespec *_rhs
     275)
     276{
     277  return _Timespec_Greater_than( _lhs, _rhs );
     278}
     279/**
     280 * @brief Timespec equal to Operator
     281 *
     282 * This method is the is equal to than operator for timespecs.
     283 *
     284 * @param[in] lhs is the left hand side timespec
     285 * @param[in] rhs is the right hand side timespec
     286 *
     287 * @retval true @a lhs is equal to @a rhs.
     288 * @retval false @a lhs is not equal to @a rhs.
     289 */
     290RTEMS_INLINE_ROUTINE bool rtems_timespec_equal_to(
     291  const struct timespec *lhs,
     292  const struct timespec *rhs
     293)
     294{
     295  return _Timespec_Equal_to( lhs, rhs);
     296}
    43297
    44298/** @} */
  • cpukit/sapi/preinstall.am

    rb5ffa5e r98c7eaca  
    8989PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rbtree.inl
    9090
    91 $(PROJECT_INCLUDE)/rtems/timespec.inl: inline/rtems/timespec.inl $(PROJECT_INCLUDE)/rtems/$(dirstamp)
    92         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/timespec.inl
    93 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/timespec.inl
    94 
    9591$(PROJECT_LIB)/libsapi.a: libsapi.a $(PROJECT_LIB)/$(dirstamp)
    9692        $(INSTALL_DATA) $< $(PROJECT_LIB)/libsapi.a
Note: See TracChangeset for help on using the changeset viewer.