1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: System Services -- Timing
25 Desc: Source code for System Services related to timing.
29 *********************************************************************21*/
32 /* header include files (.h) */
34 #include "envopt.h" /* environment options */
35 #include "envdep.h" /* environment dependent */
36 #include "envind.h" /* environment independent */
38 #include "gen.h" /* general layer */
39 #include "ssi.h" /* system services */
41 #include "ss_err.h" /* errors */
42 #include "ss_dep.h" /* implementation-specific */
43 #include "ss_queue.h" /* queues */
44 #include "ss_msg.h" /* messaging */
45 #include "ss_mem.h" /* memory management interface */
46 #include "ss_gen.h" /* general */
47 #include "cm_mem.h" /* memory management */
51 /* header/extern include files (.x) */
53 #include "gen.x" /* general layer */
54 #include "ssi.x" /* system services */
56 #include "ss_dep.x" /* implementation-specific */
57 #include "ss_queue.x" /* queues */
58 #include "ss_task.x" /* tasking */
59 #include "ss_timer.x" /* timers */
60 #include "ss_strm.x" /* STREAMS */
61 #include "ss_msg.x" /* messaging */
62 #include "ss_mem.x" /* memory management interface */
63 #include "ss_drvr.x" /* driver tasks */
64 #ifdef SS_LOCKLESS_MEMORY
67 #include "cm_mem_wl.x" /* common memory manager */
69 #include "cm_mem.x" /* common memory manager */
70 #endif /* SS_LOCKLESS_MEMORY */
71 #include "ss_gen.x" /* general */
74 /* Forward declarations */
76 /* ss041.103 Declaration for STmrRegHndlr */
77 /* ss015.301 Changed the timer activation function type as all timer activation
78 * functions are enclosed in a union.
80 #ifndef SS_MULTIPLE_PROCS
81 static S16 STmrRegHndlr ARGS((
86 SsTmrActvFn ssTmrActvFn
88 /* ss015.301: Removed the timer handler prototypes guarded under SS_MT_TMR and
89 * handled mtFlag in existing timer handlers.
91 #else /* SS_MULTIPLE_PROCS */
92 static S16 STmrRegHndlr ARGS((
98 SsTmrActvFn ssTmrActvFn
100 #endif /* SS_MULTIPLE_PROCS */
102 /* ss041.103 Declaration for STmrDeregHndlr */
103 #ifndef SS_MULTIPLE_PROCS
104 static S16 STmrDeregHndlr ARGS((
109 SsTmrActvFn ssTmrActvFn
111 /* ss015.301 Removed the timer handler prototypes guarded under SS_MT_TMR and
112 * handled mtFlag in existing timer handlers.
114 #else /* SS_MULTIPLE_PROCS */
115 static S16 STmrDeregHndlr ARGS((
121 SsTmrActvFn ssTmrActvFn
123 #endif /* SS_MULTIPLE_PROCS */
127 /* ss028.103 - Modification for SRegCfgTmr Support */
130 * Fun: Register Configurable Timer Task - timer
132 * Desc: This function is used to register a timer function for the
133 * layer. The system services will periodically invoke the
134 * function passed to it. The timer function will be used by the
135 * layer to manage the layers internal protocol timers.
138 * RFAILED - failed, general (optional)
139 * ROUTRES - failed, out of resources (optional)
146 /* ss029.103: addition: procId added and timer function type modified */
147 #ifndef SS_MULTIPLE_PROCS
150 Ent ent, /* entity */
151 Inst inst, /* instance */
152 S16 period, /* period */
153 S16 units, /* period units */
154 PFS16 tmrFnct /* timer function, typically SActvTmr */
158 /* ss015.301 - Enclosed all timer activation functions in a union. */
159 SsTmrActvFn ssTmrActvFn;
160 /* ss041.103 - Moved handling to STmrRegHndlr */
162 ssTmrActvFn.mtFlag = FALSE;
163 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
164 ret = STmrRegHndlr(ent, inst, period, units, ssTmrActvFn);
169 #else /* SS_MULTIPLE_PROCS */
173 ProcId proc, /* processor */
174 Ent ent, /* entity */
175 Inst inst, /* instance */
176 S16 period, /* period */
177 S16 units, /* period units */
178 PAIFTMRS16 tmrFnct /* timer function, typically SActvTmr */
182 /* ss015.301 - Enclosed all timer activation functions in a union. */
183 SsTmrActvFn ssTmrActvFn;
184 /* ss041.103 - Moved handling to STmrRegHndlr */
186 ssTmrActvFn.mtFlag = FALSE;
187 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
188 ret = STmrRegHndlr(proc, ent, inst, period, units, ssTmrActvFn);
193 #endif /* SS_MULTIPLE_PROCS */
196 #ifndef SS_MULTIPLE_PROCS
197 /* ss041.103 - New function for MT timer reg */
201 * Fun: Register Configurable Timer Task - timer
203 * Desc: This function is used to register a timer function for the
204 * layer. The system services will periodically invoke the
205 * function passed to it. The timer function will be used by the
206 * layer to manage the layers internal protocol timers.
209 * RFAILED - failed, general (optional)
210 * ROUTRES - failed, out of resources (optional)
212 * Notes: By invoking this function, Ent and Inst are passed in the
213 * timer activation function.
220 Ent ent, /* entity */
221 Inst inst, /* instance */
222 S16 period, /* period */
223 S16 units, /* period units */
224 PAIFTMRS16 tmrFnctMt /* timer function, typically SActvTmr */
228 /* ss015.301 - Enclosed all timer activation functions in a union. */
229 SsTmrActvFn ssTmrActvFn;
231 ssTmrActvFn.actvFnc.tmrActvFnMt = tmrFnctMt;
232 ssTmrActvFn.mtFlag = TRUE;
233 ret = STmrRegHndlr(ent, inst, period, units, ssTmrActvFn);
237 #endif /* SS_MT_TMR */
238 #endif /* not SS_MULTIPLE_PROCS */
240 /* ss041.103 - Function for timer registration handling */
243 * Fun: Timer registration handler function
245 * Desc: This function is called by the timer registration interface
246 * functions, and does the actual handling for timer
250 * RFAILED - failed, general (optional)
251 * ROUTRES - failed, out of resources (optional)
259 /* ss015.301 Changed the timer activation function type as all timer activation
260 * functions are enclosed in a union.
263 #ifndef SS_MULTIPLE_PROCS
265 static S16 STmrRegHndlr
267 Ent ent, /* entity */
268 Inst inst, /* instance */
269 S16 period, /* period */
270 S16 units, /* period units */
271 SsTmrActvFn ssTmrActvFn /* timer function, typically SActvTmr */
273 /* ss015.301: Removed the timer handler prototypes guarded
274 * under SS_MT_TMR and handled mtFlag in existing timer handlers.
277 #else /* SS_MULTIPLE_PROCS */
279 static S16 STmrRegHndlr
281 ProcId proc, /* processor */
282 Ent ent, /* entity */
283 Inst inst, /* instance */
284 S16 period, /* period */
285 S16 units, /* period units */
286 SsTmrActvFn ssTmrActvFn /* timer function */
288 #endif /* SS_MULTIPLE_PROCS */
290 #if (ERRCLASS & ERRCLS_INT_PAR)
295 #ifdef SS_MULTIPLE_PROCS
296 #if (ERRCLASS & ERRCLS_INT_PAR)
298 #endif /* ERRCLASS & ERRCLS_INT_PAR */
299 #endif /* SS_MULTPLE_PROCS */
301 #if (ERRCLASS & ERRCLS_INT_PAR)
303 #ifdef SS_MULTIPLE_PROCS
304 if ((proc == SS_INV_PROCID) || (ent >= SS_MAX_ENT) || (inst >= SS_MAX_INST))
306 SSLOGERROR(ERRCLS_INT_PAR, ESS528, ERRZERO, "Invalid processor/entity/instance");
309 #else /* SS_MULTIPLE_PROCS */
310 if (ent >= SS_MAX_ENT || inst >= SS_MAX_INST)
312 SSLOGERROR(ERRCLS_INT_PAR, ESS529, ERRZERO, "Invalid entity/instance");
315 #endif /* SS_MULTIPLE_PROCS */
320 SSLOGERROR(ERRCLS_INT_PAR, ESS530, ERRZERO, "Invalid period");
324 /* check period units*/
325 if ((units < 1) || (units > SS_TICKS_SEC))
327 SSLOGERROR(ERRCLS_INT_PAR, ESS531, ERRZERO, "Invalid period units");
331 if(ssTmrActvFn.mtFlag == TRUE)
333 /* ss015.301 Enclosed all timer activation functions in a union. */
334 #ifndef SS_MULTIPLE_PROCS
336 if (ssTmrActvFn.actvFnc.tmrActvFnMt == NULLP)
338 SSLOGERROR(ERRCLS_INT_PAR, ESS532, ERRZERO, "Null pointer");
350 if (ssTmrActvFn.actvFnc.tmrActvFn == NULLP)
352 SSLOGERROR(ERRCLS_INT_PAR, ESS532, ERRZERO, "Null pointer");
357 #ifdef SS_MULTIPLE_PROCS
358 /* check if the procId has been registered with SSI */
359 procIdIdx = SGetProcIdIdx(proc);
361 if (procIdIdx == SS_INV_PROCID_IDX)
363 SSLOGERROR(ERRCLS_INT_PAR, ESS533, ERRZERO,
364 "Could not find proc id index");
367 #endif /* SS_MULTIPLE_PROCS */
371 /* lock TAPA task table */
372 SS_ACQUIRE_SEMA(&osCp.tTskTblSem, ret);
375 SSLOGERROR(ERRCLS_DEBUG, ESS534, ERRZERO,
376 "Could not lock TAPA task table");
380 #ifdef SS_MULTIPLE_PROCS
381 if (osCp.tTskIds[procIdIdx][ent][inst] == SS_TSKNC)
382 #else /* SS_MULTIPLE_PROCS */
383 if (osCp.tTskIds[ent][inst] == SS_TSKNC)
384 #endif /* SS_MULTIPLE_PROCS */
386 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
388 #if (ERRCLASS & ERRCLS_DEBUG)
389 SSLOGERROR(ERRCLS_DEBUG, ESS535, ERRZERO,
390 "Could not release the semaphore");
394 SSLOGERROR(ERRCLS_INT_PAR, ESS536, ERRZERO, "Unknown task");
397 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
399 #if (ERRCLASS & ERRCLS_DEBUG)
400 SSLOGERROR(ERRCLS_DEBUG, ESS537, ERRZERO,
401 "Could not release the semaphore");
408 /* lock the timer table */
409 ret = SLock(&osCp.tmrTblLock);
413 #if (ERRCLASS & ERRCLS_DEBUG)
414 SSLOGERROR(ERRCLS_DEBUG, ESS538, (ErrVal) ret,
415 "Could not lock timer table");
421 /* check if we've got room for another timer */
422 if (osCp.numTmrs == SS_MAX_TMRS)
424 if ( SUnlock(&osCp.tmrTblLock) != ROK)
426 #if (ERRCLASS & ERRCLS_DEBUG)
427 SSLOGERROR(ERRCLS_DEBUG, ESS539, ERRZERO,
428 "Could not unlock the semaphore");
433 #if (ERRCLASS & ERRCLS_DEBUG)
434 SSLOGERROR(ERRCLS_DEBUG, ESS540, ERRZERO, "Too many timers");
440 #if (ERRCLASS & ERRCLS_INT_PAR)
441 /* check through the timer table for a matching timer entry */
442 for (i = 0; i < SS_MAX_TMRS; i++)
444 if ((osCp.tmrTbl[i].ownerEnt == ent)
445 #ifdef SS_MULTIPLE_PROCS
446 && (osCp.tmrTbl[i].ownerProc == proc)
447 #endif /* SS_MULTIPLE_PROCS */
448 && (osCp.tmrTbl[i].ownerInst == inst)
449 /* ss041.103 - Added mtFlag check */
450 /* ss015.301 Enclosed all timer activation functions in a union. */
451 #ifndef SS_MULTIPLE_PROCS
453 && (osCp.tmrTbl[i].ssTmrActvFn.mtFlag == ssTmrActvFn.mtFlag)
454 && ((ssTmrActvFn.mtFlag == FALSE
455 && osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
456 || osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFnMt == ssTmrActvFn.actvFnc.tmrActvFnMt)
458 && (osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
461 && (osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
463 && (osCp.tmrTbl[i].interval == (uint32_t) ((period * SS_TICKS_SEC) / units)))
465 /* is this timer in use ? (unexpired) */
466 if (osCp.tmrTbl[i].used == TRUE)
468 /* to prevent the same timer to be registered with SS UNLOCK and */
470 if (SUnlock(&osCp.tmrTblLock) != ROK)
472 #if (ERRCLASS & ERRCLS_DEBUG)
473 SSLOGERROR(ERRCLS_DEBUG, ESS541, ERRZERO, "Could not unlock the semaphore");
483 /* fill in the information we have into the timer entry */
484 tmr = &osCp.tmrTbl[osCp.nxtTmrEntry];
485 tmr->tmrId = osCp.nxtTmrEntry;
486 #ifdef SS_MULTIPLE_PROCS
487 tmr->ownerProc = proc;
488 #endif /* SS_MULTIPLE_PROCS */
490 tmr->ownerInst = inst;
491 tmr->interval = (uint32_t) ((period * SS_TICKS_SEC) / units);
492 tmr->ssTmrActvFn.mtFlag = ssTmrActvFn.mtFlag;
495 /* ss015.301 Enclosed all timer activation functions in a union. */
496 #ifndef SS_MULTIPLE_PROCS
498 if (ssTmrActvFn.mtFlag == TRUE)
500 tmr->ssTmrActvFn.actvFnc.tmrActvFnMt = ssTmrActvFn.actvFnc.tmrActvFnMt;
506 tmr->ssTmrActvFn.actvFnc.tmrActvFn = ssTmrActvFn.actvFnc.tmrActvFn;
510 /* ask the implementation to start the timer */
511 ret = ssdRegTmr(tmr);
515 #ifdef SS_MULTIPLE_PROCS
516 tmr->ownerProc = PROCNC;
517 #endif /* SS_MULTIPLE_PROCS */
518 tmr->ownerEnt = ENTNC;
519 tmr->ownerInst = INSTNC;
521 /* ss015.301 Enclosed all timer activation functions in a union. */
522 tmr->ssTmrActvFn.mtFlag = FALSE;
523 tmr->ssTmrActvFn.actvFnc.tmrActvFn = NULLP;
524 #ifndef SS_MULTIPLE_PROCS
526 tmr->ssTmrActvFn.actvFnc.tmrActvFnMt = NULLP;
533 osCp.nxtTmrEntry = tmr->nxt;
538 /* unlock the timer table */
539 if ( SUnlock(&osCp.tmrTblLock) != ROK)
541 #if (ERRCLASS & ERRCLS_DEBUG)
542 SSLOGERROR(ERRCLS_DEBUG, ESS542, ERRZERO,
543 "Could not unlock the semaphore");
557 * Desc: This function is used to deregister a timer function.
560 * RFAILED - failed, general (optional)
567 /* ss029.103: addition: procId added and timer function type modified */
568 #ifndef SS_MULTIPLE_PROCS
572 Ent ent, /* entity */
573 Inst inst, /* instance */
574 S16 period, /* period */
575 S16 units, /* period units */
576 PFS16 tmrFnct /* timer function */
580 /* ss015.301 Enclosed all timer activation functions in a union. */
581 SsTmrActvFn ssTmrActvFn;
582 /* ss041.103 - Moved handling to STmrDeregHndlr */
584 ssTmrActvFn.mtFlag = FALSE;
585 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
586 ret = STmrDeregHndlr(ent, inst, period, units, ssTmrActvFn);
591 #else /* SS_MULTIPLE_PROCS */
595 ProcId proc, /* processor */
596 Ent ent, /* entity */
597 Inst inst, /* instance */
598 S16 period, /* period */
599 S16 units, /* period units */
600 PAIFTMRS16 tmrFnct /* timer function */
604 /* ss015.301 Enclosed all timer activation functions in a union. */
605 SsTmrActvFn ssTmrActvFn;
607 /* ss041.103 - Moved handling to STmrDeregHndlr */
609 ssTmrActvFn.mtFlag = FALSE;
610 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
611 ret = STmrDeregHndlr(proc, ent, inst, period, units, ssTmrActvFn);
616 #endif /* SS_MULTIPLE_PROCS */
619 /* ss041.103 - Addition to support MT timer dereg */
620 #ifndef SS_MULTIPLE_PROCS
624 * Fun: SDeregCfgTmrMt
626 * Desc: This function is used to deregister an MT timer function.
629 * RFAILED - failed, general (optional)
638 Ent ent, /* entity */
639 Inst inst, /* instance */
640 S16 period, /* period */
641 S16 units, /* period units */
642 PAIFTMRS16 tmrFnctMt /* timer function */
646 /* ss015.301 Enclosed all timer activation functions in a union. */
647 SsTmrActvFn ssTmrActvFn;
649 ssTmrActvFn.actvFnc.tmrActvFnMt = tmrFnctMt;
650 ssTmrActvFn.mtFlag = TRUE;
652 ret = STmrDeregHndlr(ent, inst, period, units, ssTmrActvFn);
656 #endif /* SS_MT_TMR */
657 #endif /* not SS_MULTIPLE_PROCS */
660 /* ss041.103 - Addition of STmrDeregHndlr */
663 * Fun: STmrDeregHndlr
665 * Desc: This function is used to deregister a timer function.
668 * RFAILED - failed, general (optional)
675 /* ss029.103: addition: procId added and timer function type modified */
677 /* ss015.301 Changed the timer activation function type as all timer activation
678 * functions are enclosed in a union.
680 #ifndef SS_MULTIPLE_PROCS
681 static S16 STmrDeregHndlr
683 Ent ent, /* entity */
684 Inst inst, /* instance */
685 S16 period, /* period */
686 S16 units, /* period units */
687 SsTmrActvFn ssTmrActvFn /* timer function */
689 /* ss015.301: Removed the timer handler prototypes guarded under SS_MT_TMR
690 * and handled mtFlag in existing timer handlers.
693 #else /* SS_MULTIPLE_PROCS */
695 static S16 STmrDeregHndlr
697 ProcId proc, /* processor */
698 Ent ent, /* entity */
699 Inst inst, /* instance */
700 S16 period, /* period */
701 S16 units, /* period units */
702 SsTmrActvFn ssTmrActvFn /* timer function */
705 #endif /* SS_MULTIPLE_PROCS */
710 #ifdef SS_MULTIPLE_PROCS
711 #if (ERRCLASS & ERRCLS_INT_PAR)
713 #endif /* ERRCLASS & ERRCLS_INT_PAR */
714 #endif /* SS_MULTIPLE_PROCS */
717 #if (ERRCLASS & ERRCLS_INT_PAR)
719 #ifdef SS_MULTIPLE_PROCS
720 if ((proc == SS_INV_PROCID) || (ent >= SS_MAX_ENT) || (inst >= SS_MAX_INST))
722 SSLOGERROR(ERRCLS_INT_PAR, ESS543, ERRZERO, "Invalid processor/entity/instance");
726 #else /* SS_MULTIPLE_PROCS */
727 if (ent >= SS_MAX_ENT || inst >= SS_MAX_INST)
729 SSLOGERROR(ERRCLS_INT_PAR, ESS544, ERRZERO, "Invalid entity/instance");
732 #endif /* SS_MULTIPLE_PROCS */
736 SSLOGERROR(ERRCLS_INT_PAR, ESS545, ERRZERO, "Invalid period");
740 /* check period units */
741 if ((units < 1) || (units > SS_TICKS_SEC))
743 SSLOGERROR(ERRCLS_INT_PAR, ESS546, ERRZERO, "Invalid period units");
747 /* check timer function */
748 if(ssTmrActvFn.mtFlag == TRUE)
750 #ifndef SS_MULTIPLE_PROCS
752 if (ssTmrActvFn.actvFnc.tmrActvFnMt == NULLP)
754 SSLOGERROR(ERRCLS_INT_PAR, ESS547, ERRZERO, "Null pointer");
767 if (ssTmrActvFn.actvFnc.tmrActvFn == NULLP)
769 SSLOGERROR(ERRCLS_INT_PAR, ESS547, ERRZERO, "Null pointer");
774 #ifdef SS_MULTIPLE_PROCS
775 /* check if the procId has been registered with SSI */
776 procIdIdx = SGetProcIdIdx(proc);
778 if (procIdIdx == SS_INV_PROCID_IDX)
780 SSLOGERROR(ERRCLS_INT_PAR, ESS548, ERRZERO,
781 "Could not find proc id index");
784 #endif /* SS_MULTIPLE_PROCS */
787 /* lock TAPA task table */
788 SS_ACQUIRE_SEMA(&osCp.tTskTblSem, ret);
791 SSLOGERROR(ERRCLS_DEBUG, ESS549, ERRZERO,
792 "Could not lock TAPA task table");
796 #ifdef SS_MULTIPLE_PROCS
797 if (osCp.tTskIds[procIdIdx][ent][inst] == SS_TSKNC)
798 #else /* SS_MULTIPLE_PROCS */
799 if (osCp.tTskIds[ent][inst] == SS_TSKNC)
800 #endif /* SS_MULTIPLE_PROCS */
802 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
804 #if (ERRCLASS & ERRCLS_DEBUG)
805 SSLOGERROR(ERRCLS_DEBUG, ESS550, ERRZERO,
806 "Could not release the semaphore");
810 SSLOGERROR(ERRCLS_INT_PAR, ESS551, ERRZERO, "Unknown task");
813 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
815 #if (ERRCLASS & ERRCLS_DEBUG)
816 SSLOGERROR(ERRCLS_DEBUG, ESS552, ERRZERO,
817 "Could not release the semaphore");
824 /* lock the timer table */
825 ret = SLock(&osCp.tmrTblLock);
829 #if (ERRCLASS & ERRCLS_DEBUG)
830 SSLOGERROR(ERRCLS_DEBUG, ESS553, (ErrVal) ret,
831 "Could not lock timer table");
837 /* Note: Right now, we're using ent, inst and tmrActvFn to locate
838 * the timer,, this will change to using tmrId, some day.
841 /* locate the timer to delete in the timer table */
842 for (idx = 0; idx < SS_MAX_TMRS; idx++)
844 /* ss021.103 - Modification find timer by ent, inst, func, and period */
845 /* ss029.103: addition: multiple procId related changes */
846 if (osCp.tmrTbl[idx].ownerEnt == ent
847 #ifdef SS_MULTIPLE_PROCS
848 && osCp.tmrTbl[idx].ownerProc == proc
849 #endif /* SS_MULTIPLE_PROCS */
850 && osCp.tmrTbl[idx].ownerInst == inst
851 #ifndef SS_MULTIPLE_PROCS
854 * ss015.301 - Modifed as timer activation functions
855 * enclosed in a union.
857 && osCp.tmrTbl[idx].ssTmrActvFn.mtFlag == ssTmrActvFn.mtFlag
858 && ((ssTmrActvFn.mtFlag == FALSE
859 && osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
860 || osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFnMt == ssTmrActvFn.actvFnc.tmrActvFnMt)
862 && osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn
865 && osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn
867 && osCp.tmrTbl[idx].interval == (uint32_t) ((period * SS_TICKS_SEC) / units))
873 if (idx == SS_MAX_TMRS)
875 if ( SUnlock(&osCp.tmrTblLock) != ROK)
877 #if (ERRCLASS & ERRCLS_DEBUG)
878 SSLOGERROR(ERRCLS_DEBUG, ESS554, ERRZERO,
879 "Could not unlock the semaphore");
884 #if (ERRCLASS & ERRCLS_DEBUG)
885 SSLOGERROR(ERRCLS_DEBUG, ESS555, ERRZERO, "Could not locate timer");
892 /* ask the implementation to shut down this timer */
893 tmr = &osCp.tmrTbl[idx];
894 ret = ssdDeregTmr(tmr);
899 #ifdef SS_MULTIPLE_PROCS
900 tmr->ownerProc = PROCNC;
901 #endif /* SS_MULTIPLE_PROCS */
902 tmr->ownerEnt = ENTNC;
903 tmr->ownerInst = INSTNC;
906 * ss015.301: Modifed as timer activation functions enclosed in a union.
908 tmr->ssTmrActvFn.mtFlag = FALSE;
909 tmr->ssTmrActvFn.actvFnc.tmrActvFn = NULLP;
910 #ifndef SS_MULTIPLE_PROCS
912 tmr->ssTmrActvFn.actvFnc.tmrActvFnMt = NULLP;
916 tmr->nxt = osCp.nxtTmrEntry;
917 osCp.nxtTmrEntry = (SsIdx)idx;
922 /* unlock the timer table */
923 if ( SUnlock(&osCp.tmrTblLock) != ROK)
925 #if (ERRCLASS & ERRCLS_DEBUG)
926 SSLOGERROR(ERRCLS_DEBUG, ESS556, ERRZERO,
927 "Could not unlock the semaphore");
936 /**********************************************************************
938 **********************************************************************/