From 215c5d954bbc6312e0f17656da37a234b1daffae Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 6 Mar 2018 01:45:21 -0800 Subject: [PATCH 1/3] Modify generalTimeGetEventPriority() to allow eventNumber > 256. eventNumbers between 0 and NUM_TIME_EVENTS will continue to get checked for advancing timestamps. Support for eventNumbers > NUM_TIME_EVENTS will be up to the generalTime provider. --- src/libCom/osi/epicsGeneralTime.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libCom/osi/epicsGeneralTime.c b/src/libCom/osi/epicsGeneralTime.c index 3054175ef..6fb42f755 100644 --- a/src/libCom/osi/epicsGeneralTime.c +++ b/src/libCom/osi/epicsGeneralTime.c @@ -231,8 +231,8 @@ static int generalTimeGetEventPriority(epicsTimeStamp *pDest, int eventNumber, IFDEBUG(2) printf("generalTimeGetEventPriority(eventNum=%d)\n", eventNumber); - if ((eventNumber < 0 || eventNumber >= NUM_TIME_EVENTS) && - (eventNumber != epicsTimeEventBestTime)) + STATIC_ASSERT ( epicsTimeEventBestTime == -1 ); + if (eventNumber < epicsTimeEventBestTime) return S_time_badEvent; epicsMutexMustLock(gtPvt.eventListLock); @@ -245,7 +245,9 @@ static int generalTimeGetEventPriority(epicsTimeStamp *pDest, int eventNumber, if (pPrio) *pPrio = ptp->priority; - if (eventNumber == epicsTimeEventBestTime) { + if (eventNumber >= NUM_TIME_EVENTS) { + *pDest = ts; + } else if (eventNumber == epicsTimeEventBestTime) { if (epicsTimeGreaterThanEqual(&ts, >Pvt.lastProvidedBestTime)) { *pDest = ts; From 3d88c8495b8eef6b71223ff28329fba9304a2baa Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 31 Oct 2018 20:30:58 -0700 Subject: [PATCH 2/3] Added comments re handling of event numbers >= NUM_TIME_EVENTS. --- src/libCom/osi/epicsGeneralTime.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libCom/osi/epicsGeneralTime.h b/src/libCom/osi/epicsGeneralTime.h index 3adc23705..6bbb0b21b 100644 --- a/src/libCom/osi/epicsGeneralTime.h +++ b/src/libCom/osi/epicsGeneralTime.h @@ -17,7 +17,11 @@ extern "C" { #endif #define NUM_TIME_EVENTS 256 -/* Time Events are numbered 0 through (NUM_TIME_EVENTS-1) */ +/* Time Events numbered 0 through (NUM_TIME_EVENTS-1) are validated by */ +/* code in epicsGeneralTime.c that tests for advancing timestamps and */ +/* enforces that restriction. Event numbers greater than or equal to */ +/* NUM_TIME_EVENTS are now allowed if supported by a custom time provider */ +/* which should provide its own advancing timestamp validation. */ epicsShareFunc void generalTime_Init(void); From fcb5675040ba5be3f9bf86cfa686e12a1f0bcad1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 31 Oct 2018 20:35:52 -0700 Subject: [PATCH 3/3] Added release notes re handling of event numbers >= NUM_TIME_EVENTS. --- documentation/RELEASE_NOTES.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 366721455..b8cc55aa6 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -19,6 +19,15 @@ --> +

Support for event codes greater than or equal to NUM_TIME_EVENTS

+

Event numbers greater than or equal to +NUM_TIME_EVENTS are now allowed if supported by a custom time provider +which should provide its own advancing timestamp validation.

+ +

Time Events numbered 0 through (NUM_TIME_EVENTS-1) are still validated by +code in epicsGeneralTime.c that tests for advancing timestamps and +enforces that restriction.

+

Type-safe Device and Driver Support Tables

Type-safe versions of the device and driver support structures dset