Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICS – Software Engineering Group 1 GeneralTime Proposal Status at SNS and Ideas for EPICS base David Thompson Sheng Peng Kay-Uwe Kasemir.

Similar presentations


Presentation on theme: "ICS – Software Engineering Group 1 GeneralTime Proposal Status at SNS and Ideas for EPICS base David Thompson Sheng Peng Kay-Uwe Kasemir."— Presentation transcript:

1 ICS – Software Engineering Group 1 GeneralTime Proposal Status at SNS and Ideas for EPICS base David Thompson Sheng Peng Kay-Uwe Kasemir

2 ICS – Software Engineering Group 2 Times used in EPICS l epicsTimeGetCurrent() “Now”, used to schedule tasks, delays, timeouts, … l epicsTimeGetEvent(event number) Used to time-stamp records. Event number might select … »“Now” (typically event # 0) »Time of last beam pulse »Time of last XYZ event »… l Different implementations for RTEMS, Posix, Win32, … almost all of which ignore the event number and simply pick the ‘system’ time from the OS i.e. GetCurrent() == GetEvent().

3 ICS – Software Engineering Group 3 iocClock l … implements epicsTimeGetCurrent()/GetEvent() for vxWorks as func. ptr. table. l Installs default handlers which call vxWorks’ NTP client routines. »We found some possible errors in the ‘ticksToSkip’ code. l iocClockRegister((*getCurrent)(), (*getEvent)()) allows users to install routines that access site- specific timing hardware »Only one user can register. »This will hide iocClock’s NTP implementation.

4 ICS – Software Engineering Group 4 drvTS l Installs its GetCurrent()/GetEvent() routines via iocClockRegister(). l Supports »NTP from boot host (different code from iocClock) »Custom soft time master & soft time slave protocol »Hooks for hardware timing system l Problem: No fall-back »For example, hardware timing system plug-in can’t tell drvTS to temporarily use NTP, or fall back further to system clock when NTP host is also inaccessible. »Complexity

5 ICS – Software Engineering Group 5 New: generalTime as currently used at SNS l Installs its GetCurrent()/GetEvent() routines via iocClockRegister(). l Supports various time source plug-ins, currently: »SNS hardware (utility board), vxWorks clock, NTP, CMOS clock. l Prioritizes the time sources »Always selects the “best available” time source, depending on whether an event time or the current time is requested. »When timing source reports error (no carrier, no connection to NTP host, …), the next available source is used. »One can add a custom timing source and still benefit from the existing timing sources as a fall-back.

6 ICS – Software Engineering Group 6 API (extending iocClockRegister) l General time calls: iocClockRegister(). l A time driver calls: generalTimeTpRegister(). Arguments: »Tcp_priority: Priority of current time function. »getCurrent: Pointer to current time function in your driver. »syncTime: A pointer to a function that general time calls to synchronize the time in the driver if needed. »Tep_priority: Priority of event time function. »getEvent: The event time function in your driver.

7 ICS – Software Engineering Group 7 API (Continued) l When an EPICS API function requests a current time or an event time, general time calls registered time functions in order of priority. l When a time driver returns OK the search for the time is stopped and that time is returned to the Epics system caller. l If the time function returns ERROR then the next lower priority driver is called. l The lowest priority time is the system time which should always be available, even if it is wrong.

8 ICS – Software Engineering Group 8 General time features: l General time is an Epics driver with device support. l The drvGeneralTime report function reports status and a list of time providers. l Device support provides string and ai record support for status of current time providers for both event time and current time lists.

9 ICS – Software Engineering Group 9 Idea behind generalTime generalTime: Implements epicsTimeGetCurrent & epicsTimeGetEvent Using a prioritized list of time sources drvSystemTime devSystemTime drvHWTimingSystem drvTimeNTP devTimeNTP drvTimeCMOS devTimeCMOS GeneralTime returns the highest priority time source available This is completely transparent to epics time and record processing functions. Each of the time sources also supports dbior and AI records, returning seconds since 1/1/1990 and stat/sevr for diagnostics displays.

10 ICS – Software Engineering Group 10 Proposal for EPICS base l Instead of iocClock (single Current/Event routine, user replaceable), use generalTime (prioritized list of routines, user configurable). l Don’t limit it to vxWorks. Make generalTime the common code. Timing sources are OS specific, with a “System clock” timing source provided for all OS as the default. l Maybe provide soft time slave timing source for all OS? Then drvTS can be simplified to be soft time master.


Download ppt "ICS – Software Engineering Group 1 GeneralTime Proposal Status at SNS and Ideas for EPICS base David Thompson Sheng Peng Kay-Uwe Kasemir."

Similar presentations


Ads by Google