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 PRIVATE 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 PRIVATE S16 STmrRegHndlr ARGS((
98 SsTmrActvFn ssTmrActvFn
100 #endif /* SS_MULTIPLE_PROCS */
102 /* ss041.103 Declaration for STmrDeregHndlr */
103 #ifndef SS_MULTIPLE_PROCS
104 PRIVATE 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 PRIVATE 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
151 Ent ent, /* entity */
152 Inst inst, /* instance */
153 S16 period, /* period */
154 S16 units, /* period units */
155 PFS16 tmrFnct /* timer function, typically SActvTmr */
158 S16 SRegCfgTmr(ent, inst, period, units, tmrFnct)
159 Ent ent; /* entity */
160 Inst inst; /* instance */
161 S16 period; /* period */
162 S16 units; /* period units*/
163 PFS16 tmrFnct; /* timer function, typically SActvTmr */
167 /* ss015.301 - Enclosed all timer activation functions in a union. */
168 SsTmrActvFn ssTmrActvFn;
169 /* ss041.103 - Moved handling to STmrRegHndlr */
171 ssTmrActvFn.mtFlag = FALSE;
172 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
173 ret = STmrRegHndlr(ent, inst, period, units, ssTmrActvFn);
178 #else /* SS_MULTIPLE_PROCS */
183 ProcId proc, /* processor */
184 Ent ent, /* entity */
185 Inst inst, /* instance */
186 S16 period, /* period */
187 S16 units, /* period units */
188 PAIFTMRS16 tmrFnct /* timer function, typically SActvTmr */
191 S16 SRegCfgTmr(proc, ent, inst, period, units, tmrFnct)
192 ProcId proc; /* processor */
193 Ent ent; /* entity */
194 Inst inst; /* instance */
195 S16 period; /* period */
196 S16 units; /* period units*/
197 PAIFTMRS16 tmrFnct; /* timer function, typically SActvTmr */
202 /* ss015.301 - Enclosed all timer activation functions in a union. */
203 SsTmrActvFn ssTmrActvFn;
204 /* ss041.103 - Moved handling to STmrRegHndlr */
206 ssTmrActvFn.mtFlag = FALSE;
207 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
208 ret = STmrRegHndlr(proc, ent, inst, period, units, ssTmrActvFn);
213 #endif /* SS_MULTIPLE_PROCS */
216 #ifndef SS_MULTIPLE_PROCS
217 /* ss041.103 - New function for MT timer reg */
221 * Fun: Register Configurable Timer Task - timer
223 * Desc: This function is used to register a timer function for the
224 * layer. The system services will periodically invoke the
225 * function passed to it. The timer function will be used by the
226 * layer to manage the layers internal protocol timers.
229 * RFAILED - failed, general (optional)
230 * ROUTRES - failed, out of resources (optional)
232 * Notes: By invoking this function, Ent and Inst are passed in the
233 * timer activation function.
241 Ent ent, /* entity */
242 Inst inst, /* instance */
243 S16 period, /* period */
244 S16 units, /* period units */
245 PAIFTMRS16 tmrFnctMt /* timer function, typically SActvTmr */
248 S16 SRegCfgTmrMt(ent, inst, period, units, tmrFnctMt)
249 Ent ent; /* entity */
250 Inst inst; /* instance */
251 S16 period; /* period */
252 S16 units; /* period units*/
253 PAIFTMRS16 tmrFnctMt; /* timer function, typically SActvTmr */
257 /* ss015.301 - Enclosed all timer activation functions in a union. */
258 SsTmrActvFn ssTmrActvFn;
260 ssTmrActvFn.actvFnc.tmrActvFnMt = tmrFnctMt;
261 ssTmrActvFn.mtFlag = TRUE;
262 ret = STmrRegHndlr(ent, inst, period, units, ssTmrActvFn);
266 #endif /* SS_MT_TMR */
267 #endif /* not SS_MULTIPLE_PROCS */
269 /* ss041.103 - Function for timer registration handling */
272 * Fun: Timer registration handler function
274 * Desc: This function is called by the timer registration interface
275 * functions, and does the actual handling for timer
279 * RFAILED - failed, general (optional)
280 * ROUTRES - failed, out of resources (optional)
288 /* ss015.301 Changed the timer activation function type as all timer activation
289 * functions are enclosed in a union.
292 #ifndef SS_MULTIPLE_PROCS
295 PRIVATE S16 STmrRegHndlr
297 Ent ent, /* entity */
298 Inst inst, /* instance */
299 S16 period, /* period */
300 S16 units, /* period units */
301 SsTmrActvFn ssTmrActvFn /* timer function, typically SActvTmr */
304 PRIVATE S16 STmrRegHndlr(ent, inst, period, units, ssTmrActvFn)
305 Ent ent; /* entity */
306 Inst inst; /* instance */
307 S16 period; /* period */
308 S16 units; /* period units*/
309 SsTmrActvFn ssTmrActvFn; /* timer function, typically SActvTmr */
311 /* ss015.301: Removed the timer handler prototypes guarded
312 * under SS_MT_TMR and handled mtFlag in existing timer handlers.
315 #else /* SS_MULTIPLE_PROCS */
318 PRIVATE S16 STmrRegHndlr
320 ProcId proc, /* processor */
321 Ent ent, /* entity */
322 Inst inst, /* instance */
323 S16 period, /* period */
324 S16 units, /* period units */
325 SsTmrActvFn ssTmrActvFn /* timer function */
328 PRIVATE S16 STmrRegHndlr(proc, ent, inst, period, units, ssTmrActvFn)
329 ProcId proc; /* processor */
330 Ent ent; /* entity */
331 Inst inst; /* instance */
332 S16 period; /* period */
333 S16 units; /* period units*/
334 SsTmrActvFn ssTmrActvFn; /* timer function */
337 #endif /* SS_MULTIPLE_PROCS */
339 #if (ERRCLASS & ERRCLS_INT_PAR)
344 #ifdef SS_MULTIPLE_PROCS
345 #if (ERRCLASS & ERRCLS_INT_PAR)
347 #endif /* ERRCLASS & ERRCLS_INT_PAR */
348 #endif /* SS_MULTPLE_PROCS */
350 #if (ERRCLASS & ERRCLS_INT_PAR)
352 #ifdef SS_MULTIPLE_PROCS
353 if ((proc == SS_INV_PROCID) || (ent >= SS_MAX_ENT) || (inst >= SS_MAX_INST))
355 SSLOGERROR(ERRCLS_INT_PAR, ESS528, ERRZERO, "Invalid processor/entity/instance");
358 #else /* SS_MULTIPLE_PROCS */
359 if (ent >= SS_MAX_ENT || inst >= SS_MAX_INST)
361 SSLOGERROR(ERRCLS_INT_PAR, ESS529, ERRZERO, "Invalid entity/instance");
364 #endif /* SS_MULTIPLE_PROCS */
369 SSLOGERROR(ERRCLS_INT_PAR, ESS530, ERRZERO, "Invalid period");
373 /* check period units*/
374 if ((units < 1) || (units > SS_TICKS_SEC))
376 SSLOGERROR(ERRCLS_INT_PAR, ESS531, ERRZERO, "Invalid period units");
380 if(ssTmrActvFn.mtFlag == TRUE)
382 /* ss015.301 Enclosed all timer activation functions in a union. */
383 #ifndef SS_MULTIPLE_PROCS
385 if (ssTmrActvFn.actvFnc.tmrActvFnMt == NULLP)
387 SSLOGERROR(ERRCLS_INT_PAR, ESS532, ERRZERO, "Null pointer");
399 if (ssTmrActvFn.actvFnc.tmrActvFn == NULLP)
401 SSLOGERROR(ERRCLS_INT_PAR, ESS532, ERRZERO, "Null pointer");
406 #ifdef SS_MULTIPLE_PROCS
407 /* check if the procId has been registered with SSI */
408 procIdIdx = SGetProcIdIdx(proc);
410 if (procIdIdx == SS_INV_PROCID_IDX)
412 SSLOGERROR(ERRCLS_INT_PAR, ESS533, ERRZERO,
413 "Could not find proc id index");
416 #endif /* SS_MULTIPLE_PROCS */
420 /* lock TAPA task table */
421 SS_ACQUIRE_SEMA(&osCp.tTskTblSem, ret);
424 SSLOGERROR(ERRCLS_DEBUG, ESS534, ERRZERO,
425 "Could not lock TAPA task table");
429 #ifdef SS_MULTIPLE_PROCS
430 if (osCp.tTskIds[procIdIdx][ent][inst] == SS_TSKNC)
431 #else /* SS_MULTIPLE_PROCS */
432 if (osCp.tTskIds[ent][inst] == SS_TSKNC)
433 #endif /* SS_MULTIPLE_PROCS */
435 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
437 #if (ERRCLASS & ERRCLS_DEBUG)
438 SSLOGERROR(ERRCLS_DEBUG, ESS535, ERRZERO,
439 "Could not release the semaphore");
443 SSLOGERROR(ERRCLS_INT_PAR, ESS536, ERRZERO, "Unknown task");
446 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
448 #if (ERRCLASS & ERRCLS_DEBUG)
449 SSLOGERROR(ERRCLS_DEBUG, ESS537, ERRZERO,
450 "Could not release the semaphore");
457 /* lock the timer table */
458 ret = SLock(&osCp.tmrTblLock);
462 #if (ERRCLASS & ERRCLS_DEBUG)
463 SSLOGERROR(ERRCLS_DEBUG, ESS538, (ErrVal) ret,
464 "Could not lock timer table");
470 /* check if we've got room for another timer */
471 if (osCp.numTmrs == SS_MAX_TMRS)
473 if ( SUnlock(&osCp.tmrTblLock) != ROK)
475 #if (ERRCLASS & ERRCLS_DEBUG)
476 SSLOGERROR(ERRCLS_DEBUG, ESS539, ERRZERO,
477 "Could not unlock the semaphore");
482 #if (ERRCLASS & ERRCLS_DEBUG)
483 SSLOGERROR(ERRCLS_DEBUG, ESS540, ERRZERO, "Too many timers");
489 #if (ERRCLASS & ERRCLS_INT_PAR)
490 /* check through the timer table for a matching timer entry */
491 for (i = 0; i < SS_MAX_TMRS; i++)
493 if ((osCp.tmrTbl[i].ownerEnt == ent)
494 #ifdef SS_MULTIPLE_PROCS
495 && (osCp.tmrTbl[i].ownerProc == proc)
496 #endif /* SS_MULTIPLE_PROCS */
497 && (osCp.tmrTbl[i].ownerInst == inst)
498 /* ss041.103 - Added mtFlag check */
499 /* ss015.301 Enclosed all timer activation functions in a union. */
500 #ifndef SS_MULTIPLE_PROCS
502 && (osCp.tmrTbl[i].ssTmrActvFn.mtFlag == ssTmrActvFn.mtFlag)
503 && ((ssTmrActvFn.mtFlag == FALSE
504 && osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
505 || osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFnMt == ssTmrActvFn.actvFnc.tmrActvFnMt)
507 && (osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
510 && (osCp.tmrTbl[i].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
512 && (osCp.tmrTbl[i].interval == (U32) ((period * SS_TICKS_SEC) / units)))
514 /* is this timer in use ? (unexpired) */
515 if (osCp.tmrTbl[i].used == TRUE)
517 /* to prevent the same timer to be registered with SS UNLOCK and */
519 if (SUnlock(&osCp.tmrTblLock) != ROK)
521 #if (ERRCLASS & ERRCLS_DEBUG)
522 SSLOGERROR(ERRCLS_DEBUG, ESS541, ERRZERO, "Could not unlock the semaphore");
532 /* fill in the information we have into the timer entry */
533 tmr = &osCp.tmrTbl[osCp.nxtTmrEntry];
534 tmr->tmrId = osCp.nxtTmrEntry;
535 #ifdef SS_MULTIPLE_PROCS
536 tmr->ownerProc = proc;
537 #endif /* SS_MULTIPLE_PROCS */
539 tmr->ownerInst = inst;
540 tmr->interval = (U32) ((period * SS_TICKS_SEC) / units);
541 tmr->ssTmrActvFn.mtFlag = ssTmrActvFn.mtFlag;
544 /* ss015.301 Enclosed all timer activation functions in a union. */
545 #ifndef SS_MULTIPLE_PROCS
547 if (ssTmrActvFn.mtFlag == TRUE)
549 tmr->ssTmrActvFn.actvFnc.tmrActvFnMt = ssTmrActvFn.actvFnc.tmrActvFnMt;
555 tmr->ssTmrActvFn.actvFnc.tmrActvFn = ssTmrActvFn.actvFnc.tmrActvFn;
559 /* ask the implementation to start the timer */
560 ret = ssdRegTmr(tmr);
564 #ifdef SS_MULTIPLE_PROCS
565 tmr->ownerProc = PROCNC;
566 #endif /* SS_MULTIPLE_PROCS */
567 tmr->ownerEnt = ENTNC;
568 tmr->ownerInst = INSTNC;
570 /* ss015.301 Enclosed all timer activation functions in a union. */
571 tmr->ssTmrActvFn.mtFlag = FALSE;
572 tmr->ssTmrActvFn.actvFnc.tmrActvFn = NULLP;
573 #ifndef SS_MULTIPLE_PROCS
575 tmr->ssTmrActvFn.actvFnc.tmrActvFnMt = NULLP;
582 osCp.nxtTmrEntry = tmr->nxt;
587 /* unlock the timer table */
588 if ( SUnlock(&osCp.tmrTblLock) != ROK)
590 #if (ERRCLASS & ERRCLS_DEBUG)
591 SSLOGERROR(ERRCLS_DEBUG, ESS542, ERRZERO,
592 "Could not unlock the semaphore");
606 * Desc: This function is used to deregister a timer function.
609 * RFAILED - failed, general (optional)
616 /* ss029.103: addition: procId added and timer function type modified */
617 #ifndef SS_MULTIPLE_PROCS
622 Ent ent, /* entity */
623 Inst inst, /* instance */
624 S16 period, /* period */
625 S16 units, /* period units */
626 PFS16 tmrFnct /* timer function */
629 S16 SDeregCfgTmr(ent, inst, period, units, tmrFnct)
630 Ent ent; /* entity */
631 Inst inst; /* instance */
632 S16 period; /* period */
633 S16 units; /* period units*/
634 PFS16 tmrFnct; /* timer function */
638 /* ss015.301 Enclosed all timer activation functions in a union. */
639 SsTmrActvFn ssTmrActvFn;
640 /* ss041.103 - Moved handling to STmrDeregHndlr */
642 ssTmrActvFn.mtFlag = FALSE;
643 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
644 ret = STmrDeregHndlr(ent, inst, period, units, ssTmrActvFn);
649 #else /* SS_MULTIPLE_PROCS */
654 ProcId proc, /* processor */
655 Ent ent, /* entity */
656 Inst inst, /* instance */
657 S16 period, /* period */
658 S16 units, /* period units */
659 PAIFTMRS16 tmrFnct /* timer function */
662 S16 SDeregCfgTmr(proc, ent, inst, period, units, tmrFnct)
663 ProcId proc; /* processor */
664 Ent ent; /* entity */
665 Inst inst; /* instance */
666 S16 period; /* period */
667 S16 units; /* period units*/
668 PAIFTMRS16 tmrFnct; /* timer function */
672 /* ss015.301 Enclosed all timer activation functions in a union. */
673 SsTmrActvFn ssTmrActvFn;
675 /* ss041.103 - Moved handling to STmrDeregHndlr */
677 ssTmrActvFn.mtFlag = FALSE;
678 ssTmrActvFn.actvFnc.tmrActvFn = tmrFnct;
679 ret = STmrDeregHndlr(proc, ent, inst, period, units, ssTmrActvFn);
684 #endif /* SS_MULTIPLE_PROCS */
687 /* ss041.103 - Addition to support MT timer dereg */
688 #ifndef SS_MULTIPLE_PROCS
692 * Fun: SDeregCfgTmrMt
694 * Desc: This function is used to deregister an MT timer function.
697 * RFAILED - failed, general (optional)
707 Ent ent, /* entity */
708 Inst inst, /* instance */
709 S16 period, /* period */
710 S16 units, /* period units */
711 PAIFTMRS16 tmrFnctMt /* timer function */
714 S16 SDeregCfgTmrMt(ent, inst, period, units, tmrFnctMt)
715 Ent ent; /* entity */
716 Inst inst; /* instance */
717 S16 period; /* period */
718 S16 units; /* period units*/
719 PAIFTMRS16 tmrFnctMt; /* timer function */
723 /* ss015.301 Enclosed all timer activation functions in a union. */
724 SsTmrActvFn ssTmrActvFn;
726 ssTmrActvFn.actvFnc.tmrActvFnMt = tmrFnctMt;
727 ssTmrActvFn.mtFlag = TRUE;
729 ret = STmrDeregHndlr(ent, inst, period, units, ssTmrActvFn);
733 #endif /* SS_MT_TMR */
734 #endif /* not SS_MULTIPLE_PROCS */
737 /* ss041.103 - Addition of STmrDeregHndlr */
740 * Fun: STmrDeregHndlr
742 * Desc: This function is used to deregister a timer function.
745 * RFAILED - failed, general (optional)
752 /* ss029.103: addition: procId added and timer function type modified */
754 /* ss015.301 Changed the timer activation function type as all timer activation
755 * functions are enclosed in a union.
757 #ifndef SS_MULTIPLE_PROCS
759 PRIVATE S16 STmrDeregHndlr
761 Ent ent, /* entity */
762 Inst inst, /* instance */
763 S16 period, /* period */
764 S16 units, /* period units */
765 SsTmrActvFn ssTmrActvFn /* timer function */
768 /* ss017.301: Modified the prototype of STmrDeregHndlr for Non-ANSI
771 PRIVATE S16 STmrDeregHndlr(ent, inst, period, units, ssTmrActvFn)
772 Ent ent; /* entity */
773 Inst inst; /* instance */
774 S16 period; /* period */
775 S16 units; /* period units*/
776 SsTmrActvFn ssTmrActvFn; /* timer function */
778 /* ss015.301: Removed the timer handler prototypes guarded under SS_MT_TMR
779 * and handled mtFlag in existing timer handlers.
782 #else /* SS_MULTIPLE_PROCS */
785 PRIVATE S16 STmrDeregHndlr
787 ProcId proc, /* processor */
788 Ent ent, /* entity */
789 Inst inst, /* instance */
790 S16 period, /* period */
791 S16 units, /* period units */
792 SsTmrActvFn ssTmrActvFn /* timer function */
795 PRIVATE S16 STmrDeregHndlr(proc, ent, inst, period, units, ssTmrActvFn)
796 ProcId proc; /* processor */
797 Ent ent; /* entity */
798 Inst inst; /* instance */
799 S16 period; /* period */
800 S16 units; /* period units*/
801 SsTmrActvFn ssTmrActvFn; /* timer function */
804 #endif /* SS_MULTIPLE_PROCS */
809 #ifdef SS_MULTIPLE_PROCS
810 #if (ERRCLASS & ERRCLS_INT_PAR)
812 #endif /* ERRCLASS & ERRCLS_INT_PAR */
813 #endif /* SS_MULTIPLE_PROCS */
816 #if (ERRCLASS & ERRCLS_INT_PAR)
818 #ifdef SS_MULTIPLE_PROCS
819 if ((proc == SS_INV_PROCID) || (ent >= SS_MAX_ENT) || (inst >= SS_MAX_INST))
821 SSLOGERROR(ERRCLS_INT_PAR, ESS543, ERRZERO, "Invalid processor/entity/instance");
825 #else /* SS_MULTIPLE_PROCS */
826 if (ent >= SS_MAX_ENT || inst >= SS_MAX_INST)
828 SSLOGERROR(ERRCLS_INT_PAR, ESS544, ERRZERO, "Invalid entity/instance");
831 #endif /* SS_MULTIPLE_PROCS */
835 SSLOGERROR(ERRCLS_INT_PAR, ESS545, ERRZERO, "Invalid period");
839 /* check period units */
840 if ((units < 1) || (units > SS_TICKS_SEC))
842 SSLOGERROR(ERRCLS_INT_PAR, ESS546, ERRZERO, "Invalid period units");
846 /* check timer function */
847 if(ssTmrActvFn.mtFlag == TRUE)
849 #ifndef SS_MULTIPLE_PROCS
851 if (ssTmrActvFn.actvFnc.tmrActvFnMt == NULLP)
853 SSLOGERROR(ERRCLS_INT_PAR, ESS547, ERRZERO, "Null pointer");
866 if (ssTmrActvFn.actvFnc.tmrActvFn == NULLP)
868 SSLOGERROR(ERRCLS_INT_PAR, ESS547, ERRZERO, "Null pointer");
873 #ifdef SS_MULTIPLE_PROCS
874 /* check if the procId has been registered with SSI */
875 procIdIdx = SGetProcIdIdx(proc);
877 if (procIdIdx == SS_INV_PROCID_IDX)
879 SSLOGERROR(ERRCLS_INT_PAR, ESS548, ERRZERO,
880 "Could not find proc id index");
883 #endif /* SS_MULTIPLE_PROCS */
886 /* lock TAPA task table */
887 SS_ACQUIRE_SEMA(&osCp.tTskTblSem, ret);
890 SSLOGERROR(ERRCLS_DEBUG, ESS549, ERRZERO,
891 "Could not lock TAPA task table");
895 #ifdef SS_MULTIPLE_PROCS
896 if (osCp.tTskIds[procIdIdx][ent][inst] == SS_TSKNC)
897 #else /* SS_MULTIPLE_PROCS */
898 if (osCp.tTskIds[ent][inst] == SS_TSKNC)
899 #endif /* SS_MULTIPLE_PROCS */
901 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
903 #if (ERRCLASS & ERRCLS_DEBUG)
904 SSLOGERROR(ERRCLS_DEBUG, ESS550, ERRZERO,
905 "Could not release the semaphore");
909 SSLOGERROR(ERRCLS_INT_PAR, ESS551, ERRZERO, "Unknown task");
912 if ( SS_RELEASE_SEMA(&osCp.tTskTblSem) != ROK)
914 #if (ERRCLASS & ERRCLS_DEBUG)
915 SSLOGERROR(ERRCLS_DEBUG, ESS552, ERRZERO,
916 "Could not release the semaphore");
923 /* lock the timer table */
924 ret = SLock(&osCp.tmrTblLock);
928 #if (ERRCLASS & ERRCLS_DEBUG)
929 SSLOGERROR(ERRCLS_DEBUG, ESS553, (ErrVal) ret,
930 "Could not lock timer table");
936 /* Note: Right now, we're using ent, inst and tmrActvFn to locate
937 * the timer,, this will change to using tmrId, some day.
940 /* locate the timer to delete in the timer table */
941 for (idx = 0; idx < SS_MAX_TMRS; idx++)
943 /* ss021.103 - Modification find timer by ent, inst, func, and period */
944 /* ss029.103: addition: multiple procId related changes */
945 if (osCp.tmrTbl[idx].ownerEnt == ent
946 #ifdef SS_MULTIPLE_PROCS
947 && osCp.tmrTbl[idx].ownerProc == proc
948 #endif /* SS_MULTIPLE_PROCS */
949 && osCp.tmrTbl[idx].ownerInst == inst
950 #ifndef SS_MULTIPLE_PROCS
953 * ss015.301 - Modifed as timer activation functions
954 * enclosed in a union.
956 && osCp.tmrTbl[idx].ssTmrActvFn.mtFlag == ssTmrActvFn.mtFlag
957 && ((ssTmrActvFn.mtFlag == FALSE
958 && osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn)
959 || osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFnMt == ssTmrActvFn.actvFnc.tmrActvFnMt)
961 && osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn
964 && osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn == ssTmrActvFn.actvFnc.tmrActvFn
966 && osCp.tmrTbl[idx].interval == (U32) ((period * SS_TICKS_SEC) / units))
972 if (idx == SS_MAX_TMRS)
974 if ( SUnlock(&osCp.tmrTblLock) != ROK)
976 #if (ERRCLASS & ERRCLS_DEBUG)
977 SSLOGERROR(ERRCLS_DEBUG, ESS554, ERRZERO,
978 "Could not unlock the semaphore");
983 #if (ERRCLASS & ERRCLS_DEBUG)
984 SSLOGERROR(ERRCLS_DEBUG, ESS555, ERRZERO, "Could not locate timer");
991 /* ask the implementation to shut down this timer */
992 tmr = &osCp.tmrTbl[idx];
993 ret = ssdDeregTmr(tmr);
998 #ifdef SS_MULTIPLE_PROCS
999 tmr->ownerProc = PROCNC;
1000 #endif /* SS_MULTIPLE_PROCS */
1001 tmr->ownerEnt = ENTNC;
1002 tmr->ownerInst = INSTNC;
1005 * ss015.301: Modifed as timer activation functions enclosed in a union.
1007 tmr->ssTmrActvFn.mtFlag = FALSE;
1008 tmr->ssTmrActvFn.actvFnc.tmrActvFn = NULLP;
1009 #ifndef SS_MULTIPLE_PROCS
1011 tmr->ssTmrActvFn.actvFnc.tmrActvFnMt = NULLP;
1015 tmr->nxt = osCp.nxtTmrEntry;
1016 osCp.nxtTmrEntry = (SsIdx)idx;
1021 /* unlock the timer table */
1022 if ( SUnlock(&osCp.tmrTblLock) != ROK)
1024 #if (ERRCLASS & ERRCLS_DEBUG)
1025 SSLOGERROR(ERRCLS_DEBUG, ESS556, ERRZERO,
1026 "Could not unlock the semaphore");
1035 /**********************************************************************
1037 **********************************************************************/