Changeset 3a42e6fd in rtems
- Timestamp:
- 09/28/11 14:42:12 (12 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 33c0f97
- Parents:
- c18be8ee
- Location:
- cpukit
- Files:
-
- 2 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/ChangeLog
rc18be8ee r3a42e6fd 1 2011-09-28 Sebastian Huber <sebastian.huber@embedded-brains.de> 2 3 PR 1914/cpukit 4 * score/src/timespecgreaterthan.c, score/src/ts64greaterthan.c: 5 Removed files. 6 * score/Makefile.am: Reflect changes above. 7 * score/include/rtems/score/timespec.h, 8 score/include/rtems/score/timestamp.h, 9 score/include/rtems/score/timestamp64.h, score/src/ts64addto.c, 10 score/src/ts64divide.c, score/src/ts64dividebyinteger.c, 11 score/src/ts64equalto.c, score/src/ts64getnanoseconds.c, 12 score/src/ts64getseconds.c, score/src/ts64lessthan.c, 13 score/src/ts64set.c, score/src/ts64settozero.c, 14 score/src/ts64subtract.c, score/src/ts64toticks.c, 15 score/src/ts64totimespec.c: Use CPU_TIMESTAMP_USE_STRUCT_TIMESPEC, 16 CPU_TIMESTAMP_USE_INT64, and CPU_TIMESTAMP_USE_INT64_INLINE. Removed 17 copy and paste. 18 1 19 2011-09-26 Petr Benes <benesp16@fel.cvut.cz> 2 20 -
cpukit/score/Makefile.am
rc18be8ee r3a42e6fd 296 296 ## TIMESPEC_C_FILES 297 297 libscore_a_SOURCES += src/timespecaddto.c src/timespecfromticks.c \ 298 src/timespecisvalid.c src/timespeclessthan.c src/timespecgreaterthan.c\298 src/timespecisvalid.c src/timespeclessthan.c \ 299 299 src/timespecsubtract.c src/timespectoticks.c src/timespecdivide.c \ 300 300 src/timespecdividebyinteger.c … … 304 304 src/ts64divide.c src/ts64equalto.c \ 305 305 src/ts64getnanoseconds.c src/ts64getseconds.c \ 306 src/ts64 greaterthan.c src/ts64lessthan.c \306 src/ts64lessthan.c \ 307 307 src/ts64set.c src/ts64settozero.c src/ts64subtract.c \ 308 308 src/ts64toticks.c src/ts64totimespec.c -
cpukit/score/include/rtems/score/timespec.h
rc18be8ee r3a42e6fd 132 132 * false otherwise. 133 133 */ 134 bool _Timespec_Greater_than( 135 const struct timespec *lhs, 136 const struct timespec *rhs 137 ); 134 #define _Timespec_Greater_than( _lhs, _rhs ) \ 135 _Timespec_Less_than( _rhs, _lhs ) 138 136 139 137 /** -
cpukit/score/include/rtems/score/timestamp.h
rc18be8ee r3a42e6fd 41 41 /**@{*/ 42 42 43 #include <rtems/score/cpu.h> 43 44 #include <rtems/score/timespec.h> 44 45 … … 47 48 #endif 48 49 49 /* 50 * NOTE: Eventually each port should select what it should use!!! 51 * 52 * These control which implementation of SuperCore Timestamp is used. 53 * 54 * if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) 55 * struct timespec is used 56 * else if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) 57 * int64_t is used 58 * 59 * When int64_t is used, then 60 * if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 61 * the methods are inlined 62 * else 63 * the methods are NOT inlined 64 * 65 * Performance of int64_t versus struct timespec 66 * ============================================= 67 * 68 * On PowerPC/psim, inlined int64_t saves ~50 instructions on each 69 * _Thread_Dispatch operation which results in a context switch. 70 * This works out to be about 10% faster dispatches and 7.5% faster 71 * blocking semaphore obtains. The following numbers are in instructions 72 * and from tm02 and tm26. 73 * 74 * timespec int64 inlined int64 75 * dispatch: 446 446 400 76 * blocking sem obtain: 627 626 581 77 * 78 * On SPARC/sis, inlined int64_t shows the same percentage gains. 79 * The following numbers are in microseconds and from tm02 and tm26. 80 * 81 * timespec int64 inlined int64 82 * dispatch: 59 61 53 83 * blocking sem obtain: 98 100 92 84 * 85 * Inlining appears to have a tendency to increase the size of 86 * some executables. 87 * Not inlining reduces the execution improvement but does not seem to 88 * be an improvement on the PowerPC and SPARC. The struct timespec 89 * and the executables with int64 not inlined are about the same size. 90 * 91 * Once there has some analysis of which algorithm and configuration 92 * is best suited to each target, these defines should be moved to 93 * the appropriate score/cpu cpu.h file. In the meantime, it is 94 * appropriate to select an implementation here using CPU macros. 95 */ 96 97 #define CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC 98 /* 99 #define CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64 100 #define CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE 101 */ 102 103 /* 104 * Verify something is defined. 105 */ 106 #if !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) && \ 107 !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) 108 #error "No SuperCore Timestamp implementation selected." 109 #endif 110 111 /* 112 * Verify that more than one is not defined. 113 */ 114 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) && \ 115 defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) 116 #error "Too many SuperCore Timestamp implementations selected." 117 #endif 118 119 /** 120 * Include any implementation specific header files 121 */ 122 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) 50 #if ! ( ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE \ 51 && CPU_TIMESTAMP_USE_INT64 == FALSE \ 52 && CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \ 53 || ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \ 54 && CPU_TIMESTAMP_USE_INT64 == TRUE \ 55 && CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \ 56 || ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \ 57 && CPU_TIMESTAMP_USE_INT64 == FALSE \ 58 && CPU_TIMESTAMP_USE_INT64_INLINE == TRUE ) ) 59 #error "Invalid SuperCore Timestamp implementations selection." 60 #endif 61 62 #if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 123 63 #include <rtems/score/timestamp64.h> 124 64 #endif … … 127 67 * Define the Timestamp control type. 128 68 */ 129 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)69 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 130 70 typedef struct timespec Timestamp_Control; 131 71 #else … … 143 83 * @param[in] _nanoseconds is the nanoseconds portion of the timestamp 144 84 */ 145 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)85 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 146 86 #define _Timestamp_Set( _time, _seconds, _nanoseconds ) \ 147 87 _Timespec_Set( _time, _seconds, _nanoseconds ) … … 159 99 * @param[in] _time points to the timestamp instance to zero. 160 100 */ 161 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)101 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 162 102 #define _Timestamp_Set_to_zero( _time ) \ 163 103 _Timespec_Set_to_zero( _time ) … … 177 117 * false otherwise. 178 118 */ 179 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)119 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 180 120 #define _Timestamp_Is_valid( _time ) \ 181 121 _Timespec_Is_valid( _time ) … … 196 136 * false otherwise. 197 137 */ 198 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)138 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 199 139 #define _Timestamp_Less_than( _lhs, _rhs ) \ 200 140 _Timespec_Less_than( _lhs, _rhs ) … … 215 155 * false otherwise. 216 156 */ 217 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) 218 #define _Timestamp_Greater_than( _lhs, _rhs ) \ 219 _Timespec_Greater_than( _lhs, _rhs ) 220 #else 221 #define _Timestamp_Greater_than( _lhs, _rhs ) \ 222 _Timestamp64_Greater_than( _lhs, _rhs ) 223 #endif 157 #define _Timestamp_Greater_than( _lhs, _rhs ) \ 158 _Timestamp_Less_than( _rhs, _lhs ) 224 159 225 160 /** … … 234 169 * false otherwise. 235 170 */ 236 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)171 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 237 172 #define _Timestamp_Equal_to( _lhs, _rhs ) \ 238 173 _Timespec_Equal_to( _lhs, _rhs ) … … 253 188 * @return This method returns the number of seconds @a time increased by. 254 189 */ 255 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)190 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 256 191 #define _Timestamp_Add_to( _time, _add ) \ 257 192 _Timespec_Add_to( _time, _add ) … … 278 213 * @return This method returns the number of seconds @a time increased by. 279 214 */ 280 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)215 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 281 216 #define _Timestamp_Add_to_at_tick( _time, _add ) \ 282 217 _Timespec_Add_to( _time, _add ) … … 296 231 * @return This method returns the number of ticks computed. 297 232 */ 298 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)233 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 299 234 #define _Timestamp_To_ticks( _time ) \ 300 235 _Timespec_To_ticks( _time ) … … 313 248 * @param[in] _ticks points to the number of ticks to be filled in 314 249 */ 315 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)250 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 316 251 #define _Timestamp_From_ticks( _ticks, _time ) \ 317 252 _Timespec_From_ticks( _ticks, _time ) … … 334 269 * @return This method fills in @a _result. 335 270 */ 336 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)271 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 337 272 #define _Timestamp_Subtract( _start, _end, _result ) \ 338 273 _Timespec_Subtract( _start, _end, _result ) … … 355 290 * @return This method fills in @a result. 356 291 */ 357 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)292 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 358 293 #define _Timestamp_Divide_by_integer( _time, _iterations, _result ) \ 359 294 _Timespec_Divide_by_integer(_time, _iterations, _result ) … … 376 311 * @return This method fills in @a result. 377 312 */ 378 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)313 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 379 314 #define _Timestamp_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage ) \ 380 315 _Timespec_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage ) … … 393 328 * @return The seconds portion of @a _time. 394 329 */ 395 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)330 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 396 331 #define _Timestamp_Get_seconds( _time ) \ 397 332 _Timespec_Get_seconds( _time ) … … 410 345 * @return The nanoseconds portion of @a _time. 411 346 */ 412 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)347 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 413 348 #define _Timestamp_Get_nanoseconds( _time ) \ 414 349 _Timespec_Get_nanoseconds( _time ) … … 426 361 * @param[in] _timespec points to the timespec 427 362 */ 428 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)363 #if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE 429 364 /* in this case we know they are the same type so use simple assignment */ 430 365 #define _Timestamp_To_timespec( _timestamp, _timespec ) \ -
cpukit/score/include/rtems/score/timestamp64.h
rc18be8ee r3a42e6fd 45 45 * Verify something is defined. 46 46 */ 47 #if !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)47 #if CPU_TIMESTAMP_USE_INT64 != TRUE && CPU_TIMESTAMP_USE_INT64_INLINE != TRUE 48 48 #error "SuperCore Timestamp64 implementation included but not defined." 49 49 #endif … … 53 53 */ 54 54 typedef int64_t Timestamp64_Control; 55 56 static inline void _Timestamp64_implementation_Set( 57 Timestamp64_Control *_time, 58 long _seconds, 59 long _nanoseconds 60 ) 61 { 62 Timestamp64_Control _seconds64 = _seconds; 63 Timestamp64_Control _nanoseconds64 = _nanoseconds; 64 65 *_time = _seconds64 * 1000000000L + _nanoseconds64; 66 } 55 67 56 68 /** … … 64 76 * @param[in] _nanoseconds is the nanoseconds portion of the timestamp 65 77 */ 66 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)78 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 67 79 #define _Timestamp64_Set( _time, _seconds, _nanoseconds ) \ 68 do { \ 69 *(_time) = ((int64_t)_seconds * 1000000000); \ 70 *(_time) += (int64_t)(_nanoseconds); \ 71 } while (0) 80 _Timestamp64_implementation_Set( _time, _seconds, _nanoseconds ) 72 81 #else 73 82 void _Timestamp64_Set( … … 78 87 #endif 79 88 89 static inline void _Timestamp64_implementation_Set_to_zero( 90 Timestamp64_Control *_time 91 ) 92 { 93 *_time = 0; 94 } 95 80 96 /** 81 97 * @brief Zero Timestamp … … 86 102 * @param[in] _time points to the timestamp instance to zero. 87 103 */ 88 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)104 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 89 105 #define _Timestamp64_Set_to_zero( _time ) \ 90 *(_time) = 0 106 _Timestamp64_implementation_Set_to_zero( _time ) 91 107 #else 92 108 void _Timestamp64_Set_to_zero( … … 106 122 */ 107 123 #define _Timestamp64_Is_valid( _time ) \ 108 (1) 124 (1) 125 126 static inline bool _Timestamp64_implementation_Less_than( 127 const Timestamp64_Control *_lhs, 128 const Timestamp64_Control *_rhs 129 ) 130 { 131 return *_lhs < *_rhs; 132 } 109 133 110 134 /** … … 119 143 * false otherwise. 120 144 */ 121 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)145 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 122 146 #define _Timestamp64_Less_than( _lhs, _rhs ) \ 123 (*(_lhs) < *(_rhs))147 _Timestamp64_implementation_Less_than( _lhs, _rhs ) 124 148 #else 125 149 bool _Timestamp64_Less_than( 126 Timestamp64_Control *_lhs, 127 Timestamp64_Control *_rhs 128 ); 129 #endif 130 131 /** 132 * @brief Timestamp Greater Than Operator 133 * 134 * This method is the greater than operator for timestamps. 150 const Timestamp64_Control *_lhs, 151 const Timestamp64_Control *_rhs 152 ); 153 #endif 154 155 static inline bool _Timestamp64_implementation_Equal_to( 156 const Timestamp64_Control *_lhs, 157 const Timestamp64_Control *_rhs 158 ) 159 { 160 return *_lhs == *_rhs; 161 } 162 163 #define _Timestamp64_Greater_than( _lhs, _rhs ) \ 164 _Timestamp64_Less_than( _rhs, _lhs ) 165 166 /** 167 * @brief Timestamp equal to Operator 168 * 169 * This method is the is equal to than operator for timestamps. 135 170 * 136 171 * @param[in] _lhs points to the left hand side timestamp 137 172 * @param[in] _rhs points to the right hand side timestamp 138 173 * 139 * @return This method returns true if @a _lhs is greater than the @a _rhs and140 * false otherwise.141 */142 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)143 #define _Timestamp64_Greater_than( _lhs, _rhs ) \144 (*(_lhs) > *(_rhs))145 #else146 bool _Timestamp64_Greater_than(147 Timestamp64_Control *_lhs,148 Timestamp64_Control *_rhs149 );150 #endif151 152 /**153 * @brief Timestamp equal to Operator154 *155 * This method is the is equal to than operator for timestamps.156 *157 * @param[in] _lhs points to the left hand side timestamp158 * @param[in] _rhs points to the right hand side timestamp159 *160 174 * @return This method returns true if @a _lhs is equal to @a _rhs and 161 175 * false otherwise. 162 176 */ 163 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)177 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 164 178 #define _Timestamp64_Equal_to( _lhs, _rhs ) \ 165 (*(_lhs) == *(_rhs))179 _Timestamp64_implementation_Equal_to( _lhs, _rhs ) 166 180 #else 167 181 bool _Timestamp64_Equal_to( 168 Timestamp64_Control *_lhs, 169 Timestamp64_Control *_rhs 170 ); 171 #endif 182 const Timestamp64_Control *_lhs, 183 const Timestamp64_Control *_rhs 184 ); 185 #endif 186 187 static inline void _Timestamp64_implementation_Add_to( 188 Timestamp64_Control *_time, 189 const Timestamp64_Control *_add 190 ) 191 { 192 *_time += *_add; 193 } 172 194 173 195 /** … … 182 204 * @return This method returns the number of seconds @a time increased by. 183 205 */ 184 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)206 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 185 207 #define _Timestamp64_Add_to( _time, _add ) \ 186 *(_time) += *(_add)208 _Timestamp64_implementation_Add_to( _time, _add ) 187 209 #else 188 210 void _Timestamp64_Add_to( 189 Timestamp64_Control *_time,190 Timestamp64_Control *_add211 Timestamp64_Control *_time, 212 const Timestamp64_Control *_add 191 213 ); 192 214 #endif … … 211 233 static inline uint32_t _Timestamp64_Add_to_at_tick( 212 234 Timestamp64_Control *_time, 213 Timestamp64_Control *_add214 ) 215 { 216 Timestamp64_Control start = *_time / 1000000000;235 const Timestamp64_Control *_add 236 ) 237 { 238 Timestamp64_Control _start = *_time / 1000000000L; 217 239 *_time += *_add; 218 if ( ((*_time) / 1000000000 ) !=start ) {240 if ( ((*_time) / 1000000000L) != _start ) { 219 241 return 1; 220 242 } … … 243 265 * 244 266 * @param[in] _time points to the timestamp format time result 245 * @param[ in] _ticks points to the number of ticks to be filled in267 * @param[out] _ticks points to the number of ticks to be filled in 246 268 */ 247 269 void _Timestamp64_From_ticks( … … 250 272 ); 251 273 274 static inline void _Timestamp64_implementation_Subtract( 275 const Timestamp64_Control *_start, 276 const Timestamp64_Control *_end, 277 Timestamp64_Control *_result 278 ) 279 { 280 *_result = *_end - *_start; 281 } 282 252 283 /** 253 284 * @brief Subtract Two Timestamp … … 258 289 * @param[in] _start points to the starting time 259 290 * @param[in] _end points to the ending time 260 * @param[ in] _result points to the difference between291 * @param[out] _result points to the difference between 261 292 * starting and ending time. 262 * 263 * @return This method fills in @a _result. 264 */ 265 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 293 */ 294 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 266 295 #define _Timestamp64_Subtract( _start, _end, _result ) \ 267 do { \ 268 *(_result) = *(_end) - *(_start); \ 269 } while (0) 296 _Timestamp64_implementation_Subtract( _start, _end, _result ) 270 297 #else 271 298 void _Timestamp64_Subtract( 272 Timestamp64_Control *_start, 273 Timestamp64_Control *_end, 274 Timestamp64_Control *_result 275 ); 276 #endif 299 const Timestamp64_Control *_start, 300 const Timestamp64_Control *_end, 301 Timestamp64_Control *_result 302 ); 303 #endif 304 305 static inline void _Timestamp64_implementation_Divide_by_integer( 306 const Timestamp64_Control *_time, 307 uint32_t _iterations, 308 Timestamp64_Control *_result 309 ) 310 { 311 *_result = *_time / _iterations; 312 } 277 313 278 314 /** … … 285 321 * @param[in] _time points to the total 286 322 * @param[in] _iterations is the number of iterations 287 * @param[in] _result points to the average time. 288 * 289 * @return This method fills in @a result. 290 */ 291 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 323 * @param[out] _result points to the average time. 324 */ 325 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 292 326 #define _Timestamp64_Divide_by_integer( _time, _iterations, _result ) \ 293 do { \ 294 *(_result) = *(_time) / (_iterations); \ 295 } while (0) 327 _Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result ) 296 328 #else 297 329 void _Timestamp64_Divide_by_integer( 298 Timestamp64_Control *_time,299 uint32_t _iterations,300 Timestamp64_Control *_result330 const Timestamp64_Control *_time, 331 uint32_t _iterations, 332 Timestamp64_Control *_result 301 333 ); 302 334 #endif … … 310 342 * @param[in] _lhs points to the left hand number 311 343 * @param[in] _rhs points to the right hand number 312 * @param[in] _ival_percentage points to the integer portion of the average 313 * @param[in] _fval_percentage points to the thousandths of percentage 314 * 315 * @return This method fills in @a result. 344 * @param[out] _ival_percentage points to the integer portion of the average 345 * @param[out] _fval_percentage points to the thousandths of percentage 316 346 */ 317 347 void _Timestamp64_Divide( … … 322 352 ); 323 353 354 static inline uint32_t _Timestamp64_implementation_Get_seconds( 355 const Timestamp64_Control *_time 356 ) 357 { 358 return (uint32_t) (*_time / 1000000000L); 359 } 360 324 361 /** 325 362 * @brief Get Seconds Portion of Timestamp … … 331 368 * @return The seconds portion of @a _time. 332 369 */ 333 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)370 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 334 371 #define _Timestamp64_Get_seconds( _time ) \ 335 (*(_time) / 1000000000)372 _Timestamp64_implementation_Get_seconds( _time ) 336 373 #else 337 374 uint32_t _Timestamp64_Get_seconds( 338 Timestamp64_Control *_time 339 ); 340 #endif 375 const Timestamp64_Control *_time 376 ); 377 #endif 378 379 static inline uint32_t _Timestamp64_implementation_Get_nanoseconds( 380 const Timestamp64_Control *_time 381 ) 382 { 383 return (uint32_t) (*_time % 1000000000L); 384 } 341 385 342 386 /** … … 349 393 * @return The nanoseconds portion of @a _time. 350 394 */ 351 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)395 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 352 396 #define _Timestamp64_Get_nanoseconds( _time ) \ 353 (*(_time) % 1000000000)397 _Timestamp64_implementation_Get_nanoseconds( _time ) 354 398 #else 355 399 uint32_t _Timestamp64_Get_nanoseconds( 356 Timestamp64_Control *_time 357 ); 358 #endif 400 const Timestamp64_Control *_time 401 ); 402 #endif 403 404 static inline void _Timestamp64_implementation_To_timespec( 405 const Timestamp64_Control *_timestamp, 406 struct timespec *_timespec 407 ) 408 { 409 _timespec->tv_sec = *_timestamp / 1000000000L; 410 _timespec->tv_nsec = *_timestamp % 1000000000L; 411 } 359 412 360 413 /** … … 364 417 * 365 418 * @param[in] _timestamp points to the timestamp 366 * @param[ in] _timespec points to the timespec367 */ 368 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)419 * @param[out] _timespec points to the timespec 420 */ 421 #if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 369 422 #define _Timestamp64_To_timespec( _timestamp, _timespec ) \ 370 do { \ 371 (_timespec)->tv_sec = *(_timestamp) / 1000000000; \ 372 (_timespec)->tv_nsec = *(_timestamp) % 1000000000; \ 373 } while (0) 423 _Timestamp64_implementation_To_timespec( _timestamp, _timespec ) 374 424 #else 375 425 void _Timestamp64_To_timespec( 376 Timestamp64_Control *_timestamp,377 struct timespec *_timespec426 const Timestamp64_Control *_timestamp, 427 struct timespec *_timespec 378 428 ); 379 429 #endif -
cpukit/score/src/ts64addto.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 void _Timestamp64_Add_to( 28 Timestamp64_Control *_time,29 Timestamp64_Control *_add24 Timestamp64_Control *_time, 25 const Timestamp64_Control *_add 30 26 ) 31 27 { 32 *_time += *_add;28 _Timestamp64_implementation_Add_to( _time, _add ); 33 29 } 34 30 #endif -
cpukit/score/src/ts64divide.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <rtems/system.h>21 #include <sys/types.h>22 20 #include <rtems/score/timestamp.h> 23 21 24 22 /* This method is never inlined. */ 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)23 #if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE 26 24 void _Timestamp64_Divide( 27 25 const Timestamp64_Control *_lhs, -
cpukit/score/src/ts64dividebyinteger.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 void _Timestamp64_Divide_by_integer( 28 Timestamp64_Control *_time,29 uint32_t _iterations,30 Timestamp64_Control *_result24 const Timestamp64_Control *_time, 25 uint32_t _iterations, 26 Timestamp64_Control *_result 31 27 ) 32 28 { 33 *_result = *_time / _iterations;29 _Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result ); 34 30 } 35 31 #endif -
cpukit/score/src/ts64equalto.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 bool _Timestamp64_Equal_to( 28 Timestamp64_Control *_lhs,29 Timestamp64_Control *_rhs24 const Timestamp64_Control *_lhs, 25 const Timestamp64_Control *_rhs 30 26 ) 31 27 { 32 return (*(_lhs) == *(_rhs));28 _Timestamp64_implementation_Equal_to( _lhs, _rhs ); 33 29 } 34 30 #endif -
cpukit/score/src/ts64getnanoseconds.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 uint32_t _Timestamp64_Get_nanoseconds( 28 Timestamp64_Control *_time24 const Timestamp64_Control *_time 29 25 ) 30 26 { 31 return *(_time) % 1000000000;27 _Timestamp64_implementation_Get_nanoseconds( _time ); 32 28 } 33 29 #endif -
cpukit/score/src/ts64getseconds.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 uint32_t _Timestamp64_Get_seconds( 28 Timestamp64_Control *_time24 const Timestamp64_Control *_time 29 25 ) 30 26 { 31 return *(_time) / 1000000000;27 _Timestamp64_implementation_Get_seconds( _time ); 32 28 } 33 29 #endif -
cpukit/score/src/ts64lessthan.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 bool _Timestamp64_Less_than( 28 Timestamp64_Control *_lhs,29 Timestamp64_Control *_rhs24 const Timestamp64_Control *_lhs, 25 const Timestamp64_Control *_rhs 30 26 ) 31 27 { 32 return (*(_lhs) < *(_rhs));28 _Timestamp64_implementation_Less_than( _lhs, _rhs ); 33 29 } 34 30 #endif -
cpukit/score/src/ts64set.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 void _Timestamp64_Set( 28 24 Timestamp64_Control *_time, … … 31 27 ) 32 28 { 33 int64_t time; 34 35 time = (int64_t)_seconds * 1000000000; 36 time += (int64_t)_nanoseconds; 37 *_time = time; 29 _Timestamp64_implementation_Set( _time, _seconds, _nanoseconds ); 38 30 } 39 31 #endif -
cpukit/score/src/ts64settozero.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 void _Timestamp64_Set_to_zero( 28 24 Timestamp64_Control *_time 29 25 ) 30 26 { 31 *_time = 0;27 _Timestamp64_implementation_Set_to_zero( _time ); 32 28 } 33 29 #endif -
cpukit/score/src/ts64subtract.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 void _Timestamp64_Subtract( 28 Timestamp64_Control *_start,29 Timestamp64_Control *_end,30 Timestamp64_Control *_result24 const Timestamp64_Control *_start, 25 const Timestamp64_Control *_end, 26 Timestamp64_Control *_result 31 27 ) 32 28 { 33 *_result = *_end - *_start;29 _Timestamp64_implementation_Subtract( _start, _end, _result ); 34 30 } 35 31 #endif -
cpukit/score/src/ts64toticks.c
rc18be8ee r3a42e6fd 25 25 #include <rtems/score/tod.h> 26 26 27 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 28 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 27 #if CPU_TIMESTAMP_USE_INT64 == TRUE 29 28 uint32_t _Timestamp64_To_ticks( 30 29 const Timestamp64_Control *time -
cpukit/score/src/ts64totimespec.c
rc18be8ee r3a42e6fd 18 18 #endif 19 19 20 #include <sys/types.h>21 22 #include <rtems/system.h>23 20 #include <rtems/score/timestamp.h> 24 21 25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \ 26 !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE) 22 #if CPU_TIMESTAMP_USE_INT64 == TRUE 27 23 void _Timestamp64_To_timespec( 28 Timestamp64_Control *_timestamp,29 struct timespec *_timespec24 const Timestamp64_Control *_timestamp, 25 struct timespec *_timespec 30 26 ) 31 27 { 32 _timespec->tv_sec = *_timestamp / 1000000000; 33 _timespec->tv_nsec = *_timestamp % 1000000000; 28 _Timestamp64_implementation_To_timespec( _timestamp, _timespec ); 34 29 } 35 30 #endif
Note: See TracChangeset
for help on using the changeset viewer.