Merge Bruce Hill's allow-gt-256-time-events branch into 3.16

This commit is contained in:
Andrew Johnson
2018-11-26 16:29:51 -06:00
3 changed files with 20 additions and 4 deletions

View File

@@ -19,6 +19,16 @@
-->
<h3>Support for event codes greater than or equal to NUM_TIME_EVENTS</h3>
<p>Event numbers greater than or equal to NUM_TIME_EVENTS are now allowed if
supported by the registered event time provider, which must provide its own
advancing timestamp validation for such events.</p>
<p>Time events numbered 0 through (NUM_TIME_EVENTS-1) are still validated by
code in epicsGeneralTime.c that checks for advancing timestamps and enforces
that restriction.</p>
<h3>Type-safe Device and Driver Support Tables</h3>
<p>Type-safe versions of the device and driver support structures <tt>dset</tt>

View File

@@ -225,14 +225,14 @@ static int generalTimeGetEventPriority(epicsTimeStamp *pDest, int eventNumber,
gtProvider *ptp;
int status = S_time_noProvider;
epicsTimeStamp ts;
STATIC_ASSERT ( epicsTimeEventBestTime == -1 );
generalTime_Init();
IFDEBUG(2)
printf("generalTimeGetEventPriority(eventNum=%d)\n", eventNumber);
if ((eventNumber < 0 || eventNumber >= NUM_TIME_EVENTS) &&
(eventNumber != epicsTimeEventBestTime))
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,
&gtPvt.lastProvidedBestTime)) {
*pDest = ts;

View File

@@ -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);