RTEMS: Timecounter Handler

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Files | Macros | Typedefs | Functions | Variables
Timecounter Handler
Internal » SuperCore

Timecounter Handler. More...

## Files
file | timecounter.h
| Timecounter API.
file | timecounterimpl.h
| Timecounter Implementation.

## Macros
#define | _Timecounter_Acquire(lock_context) _ISR_lock_ISR_disable_and_acquire( &_Timecounter_Lock, lock_context )
| Lock to protect the timecounter mechanic.
#define | _Timecounter_Release(lock_context) _ISR_lock_Release_and_ISR_enable(&_Timecounter_Lock, lock_context)
| Releases the timecounter lock.

## Typedefs
typedef void(* | Timecounter_NTP_update_second) (int64_t *adjustment, time_t *newsec)
| Handler doing the NTP update second processing shall have this type.

## Functions
void | _Timecounter_Bintime (struct bintime *bt)
| Returns the wall clock time in the bintime format.
void | _Timecounter_Nanotime (struct timespec *ts)
| Returns the wall clock time in the timespec format.
void | _Timecounter_Microtime (struct timeval *tv)
| Returns the wall clock time in the timeval format.
void | _Timecounter_Binuptime (struct bintime *bt)
| Returns the uptime in the bintime format.
int64_t | _Timecounter_Sbinuptime (void)
| Returns the uptime in the sbintime_t format.
void | _Timecounter_Nanouptime (struct timespec *ts)
| Returns the uptime in the timespec format.
void | _Timecounter_Microuptime (struct timeval *tv)
| Returns the uptime in the timeval format.
void | _Timecounter_Getbintime (struct bintime *bt)
| Returns the wall clock time in the bintime format.
void | _Timecounter_Getnanotime (struct timespec *ts)
| Returns the wall clock time in the timespec format.
void | _Timecounter_Getmicrotime (struct timeval *tv)
| Returns the wall clock time in the timeval format.
void | _Timecounter_Getbinuptime (struct bintime *bt)
| Returns the uptime in the bintime format.
void | _Timecounter_Getnanouptime (struct timespec *ts)
| Returns the uptime in the timespec format.
void | _Timecounter_Getmicrouptime (struct timeval *tv)
| Returns the uptime in the timeval format.
void | _Timecounter_Getboottime (struct timeval *tv)
| Returns the boot time in the timeval format.
void | _Timecounter_Getboottimebin (struct bintime *bt)
| Returns the boot time in the bintime format.
void | _Timecounter_Install (struct timecounter *tc)
| Installs the timecounter.
void | _Timecounter_Tick (void)
| Performs a timecounter tick.
void | _Timecounter_Tick_simple (uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context)
| Performs a simple timecounter tick.
void | _Timecounter_Set_NTP_update_second (Timecounter_NTP_update_second handler)
| Sets the NTP update second handler.
void | _Timecounter_Set_clock (const struct bintime *bt, ISR_lock_Context *lock_context)
| Sets the timecounter clock to the given value.

## Variables
volatile time_t | _Timecounter_Time_second
| The wall clock time in seconds.
volatile int32_t | _Timecounter_Time_uptime
| The uptime in seconds.
struct timecounter * | _Timecounter
| The current timecounter.

## Detailed Description

Timecounter Handler.

## Macro Definition Documentation

## ◆ _Timecounter_Acquire

#define _Timecounter_Acquire | ( |  | lock_context | ) | _ISR_lock_ISR_disable_and_acquire( &_Timecounter_Lock, lock_context )

Lock to protect the timecounter mechanic.

Acquires the timecounter lock.

Parameters

  lock_context | The lock context.

See _Timecounter_Tick_simple().

## ◆ _Timecounter_Release

#define _Timecounter_Release | ( |  | lock_context | ) | _ISR_lock_Release_and_ISR_enable(&_Timecounter_Lock, lock_context)

Releases the timecounter lock.

Parameters

  lock_context | The lock context.

See _Timecounter_Tick_simple().

## Typedef Documentation

## ◆ Timecounter_NTP_update_second

typedef void(* Timecounter_NTP_update_second) (int64_t *adjustment, time_t *newsec)

Handler doing the NTP update second processing shall have this type.

Parameters

  [in,out] | adjustment | is the NTP time adjustment.
  [in,out] | newsec | is the number of seconds since Unix epoch.

## Function Documentation

## ◆ _Timecounter_Bintime()

void _Timecounter_Bintime | ( | struct bintime * | bt | ) |

Returns the wall clock time in the bintime format.

Parameters

  [out] | bt | Returns the wall clock time.

## ◆ _Timecounter_Binuptime()

void _Timecounter_Binuptime | ( | struct bintime * | bt | ) |

Returns the uptime in the bintime format.

Parameters

  [out] | bt | Returns the uptime.

## ◆ _Timecounter_Getbintime()

void _Timecounter_Getbintime | ( | struct bintime * | bt | ) |

Returns the wall clock time in the bintime format.

This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Bintime() variant.

Parameters

  [out] | ts | Returns the wall clock time.

## ◆ _Timecounter_Getbinuptime()

void _Timecounter_Getbinuptime | ( | struct bintime * | bt | ) |

Returns the uptime in the bintime format.

This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Binuptime() variant.

Parameters

  [out] | ts | Returns the uptime.

## ◆ _Timecounter_Getboottime()

void _Timecounter_Getboottime | ( | struct timeval * | tv | ) |

Returns the boot time in the timeval format.

Parameters

  [out] | tv | Returns the boot time.

## ◆ _Timecounter_Getboottimebin()

void _Timecounter_Getboottimebin | ( | struct bintime * | bt | ) |

Returns the boot time in the bintime format.

Parameters

  [out] | tv | Returns the boot time.

## ◆ _Timecounter_Getmicrotime()

void _Timecounter_Getmicrotime | ( | struct timeval * | tv | ) |

Returns the wall clock time in the timeval format.

This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Microtime() variant.

Parameters

  [out] | tv | Returns the wall clock time.

See also
  _Timecounter_Getbintime().

## ◆ _Timecounter_Getmicrouptime()

void _Timecounter_Getmicrouptime | ( | struct timeval * | tv | ) |

Returns the uptime in the timeval format.

This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Microuptime() variant.

Parameters

  [out] | tv | Returns the uptime.

## ◆ _Timecounter_Getnanotime()

void _Timecounter_Getnanotime | ( | struct timespec * | ts | ) |

Returns the wall clock time in the timespec format.

This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Nanotime() variant.

Parameters

  [out] | ts | Returns the wall clock time.

See also
  _Timecounter_Getbintime().

## ◆ _Timecounter_Getnanouptime()

void _Timecounter_Getnanouptime | ( | struct timespec * | ts | ) |

Returns the uptime in the timespec format.

This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Nanouptime() variant.

Parameters

  [out] | ts | Returns the uptime.

## ◆ _Timecounter_Install()

void _Timecounter_Install | ( | struct timecounter * | tc | ) |

Installs the timecounter.

The timecounter structure must contain valid values in the fields tc_get_timecount, tc_counter_mask, tc_frequency and tc_quality. All other fields must be zero initialized.

Parameters

  tc | The timecounter.

## ◆ _Timecounter_Microtime()

void _Timecounter_Microtime | ( | struct timeval * | tv | ) |

Returns the wall clock time in the timeval format.

Parameters

  [out] | tv | Returns the wall clock time.

## ◆ _Timecounter_Microuptime()

void _Timecounter_Microuptime | ( | struct timeval * | tv | ) |

Returns the uptime in the timeval format.

Parameters

  [out] | tv | Returns the uptime.

## ◆ _Timecounter_Nanotime()

void _Timecounter_Nanotime | ( | struct timespec * | ts | ) |

Returns the wall clock time in the timespec format.

Parameters

  [out] | ts | Returns the wall clock time.

## ◆ _Timecounter_Nanouptime()

void _Timecounter_Nanouptime | ( | struct timespec * | ts | ) |

Returns the uptime in the timespec format.

Parameters

  [out] | ts | Returns the uptime.

## ◆ _Timecounter_Sbinuptime()

int64_t _Timecounter_Sbinuptime | ( | void |  | ) |

Returns the uptime in the sbintime_t format.

Returns
  Returns the uptime.

## ◆ _Timecounter_Set_clock()

void _Timecounter_Set_clock | ( | const struct bintime * | bt,
|  | ISR_lock_Context * | lock_context
| ) |  |

Sets the timecounter clock to the given value.

Parameters

  bt | The value to set the clock to.
  lock_context | The interrupt lock context.

## ◆ _Timecounter_Set_NTP_update_second()

void _Timecounter_Set_NTP_update_second | ( | Timecounter_NTP_update_second | handler | ) |

Sets the NTP update second handler.

Parameters

  handler | is the new NTP update second handler used to carry out the NTP update second processing.

## ◆ _Timecounter_Tick_simple()

void _Timecounter_Tick_simple | ( | uint32_t | delta,
|  | uint32_t | offset,
|  | ISR_lock_Context * | lock_context
| ) |  |

Performs a simple timecounter tick.

This is a special purpose tick function for simple timecounter to support legacy clock drivers.

Parameters

  delta | The time in timecounter ticks elapsed since the last call to _Timecounter_Tick_simple().
  offset | The current value of the timecounter.
  ] | lock_context The lock context of the corresponding _Timecounter_Acquire().

## Variable Documentation

## ◆ _Timecounter_Time_uptime

volatile int32_t _Timecounter_Time_uptime
| extern

The uptime in seconds.

For compatibility with the FreeBSD network stack the initial value is one second.