Initial commit
[o-du/l2.git] / src / cm / ssi.x
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /********************************************************************20**
20   
21      Name:     system services interface
22   
23      Type:     C include file
24   
25      Desc:     Structures, variables and typedefs required by the
26                System Services service user.
27   
28      File:     ssi.x
29   
30 *********************************************************************21*/
31   
32 #ifndef __SSIX__
33 #define __SSIX__
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39
40 \f   
41 /* typedefs */
42
43 typedef S16 Status;               /* status */
44
45 typedef U32 Ticks;                /* system clock ticks */
46
47 #ifdef LONG_MSG
48 typedef S32 MsgLen;               /* message length */
49 #else
50 typedef S16 MsgLen;               /* message length */
51 #endif
52
53 typedef S16 Order;                /* message or queue order */
54
55 #ifdef DOS
56 typedef U16 Size;                 /* size (for number of bytes per region or per s-pool) */
57 #else
58 typedef U32 Size;                 /* size (for number of bytes per region or per s-pool) */
59 typedef S32 PtrOff;               /* signed pointer offset */
60 #endif
61
62 typedef U32 QLen;                 /* queue length */
63
64 typedef QLen BufQLen;             /* buffer queue length */
65
66 typedef S16 RegSize;              /* region size (for number of regions per processor) */
67
68 typedef S16 DPoolSize;            /* dynamic pool size (for number of buffers per d-pool) */
69
70 typedef U16 Random;               /* random number */
71
72 typedef S16 Seq;                  /* sequence */
73 /* ssi_x_001.main_64 Additions */
74 typedef U32 CoreId;               /* core id */
75
76 /* Error */
77 typedef U32 ErrCls;               /* Error Class */
78
79 typedef U32 ErrCode;              /* Error Code  */
80
81 typedef U32 ErrVal;               /* Error Value */
82
83 typedef S16 VectNmb;              /* vector number */
84
85 typedef S16 Ttype;                /* task type */
86
87 typedef S8 Sema;                  /* semaphore */
88
89
90 /* post */
91
92 \f
93 /*
94    This section contains specific typedefs, structures and
95    prototypes for the following operating systems:
96
97    MOS      - MOSVER
98    MOS, v2  - MSVER2
99    psos     - PS
100    vrtxsa   - VX
101    vxworks  - VW
102    sslib    - system service library for elvis
103    other    - 
104  
105    The defines PORTVER, MOSVER and MSVER2 are mutually exclusive. The define PORTVER
106    must be set in conjunction with the define PS, VX, VW or other.
107
108 */
109
110 \f
111 #ifdef MOSVER                     /* mos version */
112 /* mos typedefs, structures and prototypes */
113
114 /* forward definitions */
115  
116 #ifndef CMFILE_REORG_1
117 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
118 #endif
119  
120 typedef struct ss_queue Queue;    /* forward definition - queue */
121
122 /* chain */
123  
124 typedef struct chn                /* chain */
125 {
126    Buffer *fwd;                   /* forward */
127    Buffer *bck;                   /* backward */
128 } Chn;
129  
130 typedef Chn Chain;                /* chain */
131  
132 /* queue - typdef'd earlier */
133
134 struct ss_queue                   /* queue - typdef'd earlier */
135 {
136    Chn chn;                       /* chain */
137    QLen crntSize;                 /* current size */
138    QLen maxSize;                  /* maximum size */
139 };
140   
141 /* buffer - typedef'd earlier */
142   
143 struct ss_buffer                  /* buffer - typdef'd earlier */
144 {
145    Chn chn;                       /* chain */
146    Mem mem;                       /* memory */
147    S8 bufType;                    /* buffer type */
148    union {
149   
150       struct
151       {
152          MsgLen strtIdx;          /* start index */
153          MsgLen endIdx;           /* end index */
154          MsgLen size;             /* size */
155          Data data[DSIZE];        /* data */
156       } dat;                      /* data buffer */
157   
158       struct
159       {
160          Queue bq;                /* buffer queue */
161          MsgLen msgLen;           /* message length */
162          S16 refCnt;              /* reference count */
163          Pst pst;                 /* post (optional) */
164          U32 wsU32[2];            /* workspace unsigned 32 bit values (optional) */
165          U16 wsU16[1];            /* workspace unsigned 16 bit values (optional) */
166          U8  wsU8[2];             /* workspace unsigned 8 bit values (optional) */
167       } msg;                      /* message buffer */
168   
169       struct
170       {
171          Buffer *entry[MAXEXTENT];/* entry */
172       } ext;                      /* extension buffer */
173  
174       struct
175       {
176          Size size;               /* size */
177       } stc;                      /* static buffer */
178  
179       struct
180       {
181          MsgLen strtIdx;          /* start index */
182          MsgLen endIdx;           /* end index */
183          MsgLen size;             /* size */
184          Data *data;              /* data pointer */
185       } dma;                      /* dma buffer */
186  
187    } t;
188 };
189
190 EXTERN  S16 msOptInd;
191 EXTERN  S8  *msOptArg;
192 EXTERN  Txt **msArgv;
193 EXTERN  S16 msArgc;
194
195 #else 
196 #ifdef MSVER2                     /* mos version 2 */
197
198 /* forward definitions */
199 #ifndef CMFILE_REORG_1
200 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
201 #endif
202  
203 typedef struct sBuf SBuf;         /* forward definition - static buffer */
204  
205 typedef struct ss_queue Queue;    /* forward definition - queue */
206
207 /* buffer identifier */
208
209 /* dynamic chain (4b ALIGNED) */
210  
211 typedef struct dChn               /* dynamic chain */
212 {
213    Buffer *prev;                  /* previous */
214    Buffer *crnt;                  /* current */
215    Buffer *next;                  /* next */
216 } DChn;
217  
218 /* static chain (4b ALIGNED)*/
219  
220 typedef struct sChn               /* static chain */
221 {
222    SBuf *fwd;                     /* forward */
223 } SChn;
224  
225 /* buffer queue (4b ALIGNED) */
226   
227 typedef struct bufQ               /* buffer queue */
228 {
229    DChn dChn;                     /* dynamic chain */
230    BufQLen crntSize;              /* current size */
231 } BufQ;
232 /* queue (4b ALIGNED) */
233   
234 struct ss_queue                   /* queue - typdef'd earlier */
235 {
236    DChn dChn;                     /* dynamic chain */
237    QLen crntSize;                 /* current size */
238 };
239   
240 /* 4Byte aligned */
241 typedef struct ss_dat             /* data buffer */
242 {
243    MsgLen strtIdx;                /* start index (2b) */
244    MsgLen endIdx;                 /* end index (2b) */
245    MsgLen size;                   /* size (2b) */
246    Pool pool;                     /* size (1b); Not used for MOS as of now */
247    U8 spare;                      /* spare for alignment (1b) */
248    Data data[DSIZE];              /* data (4b) */
249 } Dat;
250
251 /* 4Byte aligned */
252 typedef struct ss_msg             /* message buffer */
253 {
254    Queue bufQ;                    /* buffer queue */
255    Buffer *nxtDBuf;               /* next DBuf */
256    MsgLen msgLen;                 /* message length */
257    Pool pool;                     /* size (1b); Not used for MOS as of now */
258    U8 spare;                      /* spare for alingment */
259 } Msg;
260   
261 /* buffer - typedef'd earlier */
262   
263 struct ss_buffer                  /* buffer - typedef'd earlier */
264 {
265    DChn dChn;                     /* dynamic chain */
266    S8 bufType;                    /* buffer type */
267    U8 spare1;                     /* spare for alignment */
268    U16 spare2;                    /* spare for alignment */
269    union {
270       Dat dat;                    /* data buffer */
271       Msg msg;                    /* message buffer */
272    } t;
273 };
274
275 /* static buffer - typedef'd earlier */
276   
277 struct sBuf                       /* static buffer - typedef'd earlier */
278 {
279    SChn sChn;                     /* static chain */
280    Size size;                     /* size */
281    S8 bufType;                    /* buffer type */
282    U8 spare1;                     /* spare 1 */
283    U16 spare2;                    /* spare 2 */
284 };
285
286 EXTERN  S16 msOptInd;
287 EXTERN  S8  *msOptArg;
288 EXTERN  Txt **msArgv;
289 EXTERN  S16 msArgc;
290
291 #else
292 #ifdef PS                         /* psos version */
293 /* psos typedefs, structures and prototypes */
294
295 /* forward definitions */
296  
297 #ifndef CMFILE_REORG_1
298 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
299 #endif
300  
301 typedef struct ss_queue Queue;       /* forward definition - queue */
302
303 /* chain */
304  
305 typedef struct chn                /* chain */
306 {
307    Buffer *fwd;                   /* forward */
308    Buffer *bck;                   /* backward */
309 } Chn;
310
311 /* queue - typdef'd earlier */
312
313 struct ss_queue                   /* queue - typdef'd earlier */
314 {
315    Chn chn;                       /* chain */
316    QLen crntSize;                 /* current size */
317    QLen maxSize;                  /* maximum size */
318 };
319
320 /* buffer - typedef'd earlier */
321   
322 struct ss_buffer                  /* buffer - typedef'd earlier */
323 {
324    Chn chn;                       /* chain */
325    Mem mem;                       /* memory */
326    S8 bufType;                    /* buffer type */
327    union {
328   
329       struct
330       {
331          MsgLen strtIdx;          /* start index */
332          MsgLen endIdx;           /* end index */
333          MsgLen size;             /* size */
334          Data data[DSIZE];        /* data */
335       } dat;                      /* data buffer */
336   
337       struct
338       {
339          Queue bq;                /* buffer queue */
340          MsgLen msgLen;           /* message length */
341          S16 refCnt;              /* reference count */
342       } msg;                      /* message buffer */
343   
344       struct
345       {
346          Buffer *entry[MAXEXTENT];/* entry */
347       } ext;                      /* extension buffer */
348  
349       struct
350       {
351          Size size;               /* size */
352       } stc;                      /* static buffer */
353
354       struct
355       {
356          MsgLen strtIdx;          /* start index */
357          MsgLen endIdx;           /* end index */
358          MsgLen size;             /* size */
359          Data *data;              /* data pointer */
360       } dma;                      /* dma buffer */
361  
362    } t;
363 };
364
365 #else
366 #ifdef VX                         /* vrtxsa version */
367 /* vrtxsa typedefs, structures and prototypes */
368
369 /* forward definitions */
370  
371 #ifndef CMFILE_REORG_1
372 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
373 #endif
374  
375 typedef struct ss_queue Queue;       /* forward definition - queue */
376
377 /* buffer - typedef'd earlier */
378
379 struct ss_buffer                  /* buffer - typedef'd earlier */
380 {
381    Buffer *fwd;                   /* forward chain pointer for queues */
382    Buffer *bck;                   /* backward chain pointer for queues */
383    U16 mPid;                      /* VRTXsa memory partition ID */
384    S16 start;                     /* starting index of message in byte array */
385    S16 end;                       /* ending index of message in byte array */
386    U16 status;                    /* buffer status */
387 };
388
389 /* chain */
390  
391 typedef struct chn                /* chain */
392 {
393    Buffer *fwd;                   /* forward */
394    Buffer *bck;                   /* backward */
395 } Chn;
396
397 /* queue - typdef'd earlier */
398  
399 struct ss_queue                   /* queue - typdef'd earlier */
400 {
401    Chn chn;                       /* chain */
402    QLen crntSize;                 /* current size */
403    QLen maxSize;                  /* maximum size */
404 };
405
406 #else
407 #ifdef VW                         /* vxworks version */
408 /* vxworks typedefs, structures and prototypes */
409
410 /* forward definitions */
411  
412 #ifndef CMFILE_REORG_1
413 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
414 #endif
415  
416 typedef struct ss_queue Queue;    /* forward definition - queue */
417
418 typedef struct dChn               /* dynamic chain */
419 {
420    Buffer *prev;                    /* previous */
421    Buffer *crnt;                    /* current */
422    Buffer *next;                    /* next */
423 } DChn;
424  
425 /* static chain (4b ALIGNED)*/
426  
427 /* buffer queue (4b ALIGNED) */
428   
429 typedef struct bufQ               /* buffer queue */
430 {
431    DChn dChn;                     /* dynamic chain */
432    BufQLen crntSize;              /* current size */
433 } BufQ;
434   
435 /* queue (4b ALIGNED) */
436   
437 struct ss_queue                   /* queue - typdef'd earlier */
438 {
439    DChn dChn;                     /* dynamic chain */
440    QLen crntSize;                 /* current size */
441 };
442   
443 typedef struct ss_dat             /* data buffer */
444 {
445    MsgLen strtIdx;                /* start index */
446    MsgLen endIdx;                 /* end index */
447    MsgLen size;                   /* size */
448    Pool pool;                     /* pool id */
449    U8 spare;                      /* spare */
450    Data *data;                    /* data */
451 } Dat;
452
453 typedef struct ss_msg             /* message buffer */
454 {
455    Queue bufQ;                    /* buffer queue */
456    Buffer *nxtDBuf;               /* next DBuf */
457    MsgLen msgLen;                 /* message length */
458    Pool pool;                     /* pool id */
459    U8 spare;                      /* spare */
460 } Msg;
461   
462 /* buffer - typedef'd earlier */
463   
464 struct ss_buffer                  /* buffer - typedef'd earlier */
465 {
466    DChn dChn;                     /* dynamic chain */
467    S8 bufType;                    /* buffer type */
468    U8 spare1;                     /* spare for alignment */
469    U16 spare2;                    /* spare for alignment */
470    union {
471       Dat dat;                    /* data buffer */
472       Msg msg;                    /* message buffer */
473    } t;
474 };
475
476 #else
477 #ifdef SSLIB                      /* system service library */
478 /* forward definitions */
479 #ifndef CMFILE_REORG_1
480 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
481 #endif
482  
483 typedef struct sBuf SBuf;         /* forward definition - static buffer */
484  
485 typedef struct ss_queue Queue;    /* forward definition - queue */
486
487
488 /* queue - typdef'd earlier */
489  
490 struct ss_queue                   /* queue - typdef'd earlier */
491 {
492    S16 dummy;                     /* dummy placeholder */
493 };
494
495 /* buffer - typedef'd earlier */
496   
497 struct ss_buffer                  /* buffer - typedef'd earlier */
498 {
499    S32 sIdx;                      /* start index */
500    S32 len;                       /* buffer length */
501    S8 dat[MAXBUFSIZ];             /* data */
502 };
503
504 #else                             /* portable/other version */
505 #ifdef SSRYLIB                      /* system service library */
506 /* forward definitions */
507 #ifndef CMFILE_REORG_1
508 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
509 #endif
510  
511 typedef struct sBuf SBuf;         /* forward definition - static buffer */
512  
513 typedef struct ss_queue Queue;    /* forward definition - queue */
514
515  
516 typedef S16 RyBufId;
517 /* dynamic chain (aligned) */
518 typedef struct ryDChn                 /* dynamic chain */
519 {
520    RyBufId back;                      /* backward (2b) */
521    RyBufId crnt;                      /* current  (2b) */
522    RyBufId next;                      /* next     (2b) */
523    RyBufId pad;                       /* pad      (2b) */
524 } RyDChn;
525 /* 
526  * queue - typdef'd earlier 
527  * This is exactly same as RyBufQ
528  */
529 struct ss_queue                   /* queue - typdef'd earlier */
530 {
531    RyDChn dChn;
532    QLen crntSize;                 /* current size */
533    U16  ryChanId;                 /* relay channel Id */
534 };
535
536 /* buffer - typedef'd earlier */
537   
538 struct ss_buffer                  /* buffer - typedef'd earlier */
539 {
540    S32 sIdx;                      /* start index */
541    S32 len;                       /* buffer length */
542    S8 dat[MAXBUFSIZ];             /* data */
543 };
544
545 #else                             /* portable/other version */
546 #ifdef WINNT_IATM                 /* Windows NT Integrated ATM */
547
548 #ifndef CMFILE_REORG_1
549 #ifndef CFG_APP                   /* Don't include ndis.h for config app. */ 
550 #include "ndis.h"                 /* to support NDIS calls (listed above) */
551 #endif /* CFG_APP */
552
553 typedef struct _NDIS_PACKET Buffer; /* forward definition - buffer */
554
555 #endif /* CMFILE_REORG_1 */
556
557 typedef struct ss_queue Queue;      /* forward definition - queue */
558
559 /* Trillium Queue is built upon the NDIS library list functions.
560  * No spin locks are applied for queues.
561  */
562
563 struct ss_queue {
564    LIST_ENTRY ListHead;           /* LIST_ENTRY to support NDIS list calls */
565    QLen CurQLen;                  /* current queue length */
566    QLen MaxQLen;                  /* maximum queue length */
567 };
568 #else  /* WINNT_IATM */
569 #ifdef MT                         /* multi-threaded version */
570 /* multi-threaded typedefs, structures and prototypes */
571
572 /* forward definitions */
573  
574 #ifndef CMFILE_REORG_1
575 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
576 #endif
577  
578 typedef struct ss_queue Queue;    /* forward definition - queue */
579
580 typedef struct sBuf      SBuf;    /* forward definition - static buffer */
581
582 typedef struct dChn               /* dynamic chain */
583 {
584    Buffer *prev;                    /* previous */
585    Buffer *crnt;                    /* current */
586    Buffer *next;                    /* next */
587 } DChn;
588
589 /* static chain (4b ALIGNED)*/
590 typedef struct sChn
591 {
592    SBuf *fwd;                     /* forward */
593 } SChn;
594  
595 /* static chain (4b ALIGNED)*/
596  
597 /* buffer queue (4b ALIGNED) */
598   
599 /* queue (4b ALIGNED) */
600   
601 struct ss_queue                   /* queue - typdef'd earlier */
602 {
603    DChn dChn;                     /* dynamic chain */
604    QLen crntSize;                 /* current size */
605 };
606   
607 typedef struct ss_dat             /* data buffer */
608 {
609    MsgLen strtIdx;                /* start index */
610    MsgLen endIdx;                 /* end index */
611    MsgLen size;                   /* size */
612    Pool pool;                     /* pool id */
613    U8 spare;                      /* spare */
614    Data *data;                    /* data */
615 } Dat;
616
617 typedef struct ss_msg             /* message buffer */
618 {
619    Queue bufQ;                    /* buffer queue */
620    Buffer *nxtDBuf;               /* next DBuf */
621    MsgLen msgLen;                 /* message length */
622    Pool pool;                     /* pool id */
623    U8 spare;                      /* spare */
624 } Msg;
625   
626 /* buffer - typedef'd earlier */
627   
628 struct ss_buffer                  /* buffer - typedef'd earlier */
629 {
630    DChn dChn;                     /* dynamic chain */
631    S8 bufType;                    /* buffer type */
632    U8 spare1;                     /* spare for alignment */
633    U16 spare2;                    /* spare for alignment */
634    union {
635       Dat dat;                    /* data buffer */
636       Msg msg;                    /* message buffer */
637    } t;
638 };
639
640 /* static buffer - typedef'd earlier */
641   
642 struct sBuf
643 {
644    SChn sChn;                     /* static chain */
645    Size size;                     /* size */
646    S8 bufType;                    /* buffer type */
647    U8 spare1;                     /* spare 1 */
648    U16 spare2;                    /* spare 2 */
649 };
650
651 typedef S32 MtRwLockId;
652 typedef S32 MtSemaId;
653 typedef S32 MtCondId;
654 typedef S32 MtMtxId;
655 typedef S32 MtThrdId;
656 typedef S32 MtThrdFlags;
657 typedef S32 MtThrdPrior;
658
659 typedef Void *(MtThrd) ARGS((Void *)); 
660
661 #else  /* not MT */
662 #ifdef PORTVER
663 /* portable typedefs, structures and prototypes */
664
665 /* forward definitions */
666  
667 #ifndef CMFILE_REORG_1
668 typedef struct ss_buffer Buffer;  /* forward definition - buffer */
669 #endif
670  
671 typedef struct ss_queue Queue;       /* forward definition - queue */
672
673 /* queue - typdef'd earlier */
674  
675 struct ss_queue                   /* queue - typdef'd earlier */
676 {
677    S16 dummy;                     /* dummy placeholder */
678 };
679  
680 /* buffer - typedef'd earlier */
681   
682 struct ss_buffer                  /* buffer - typedef'd earlier */
683 {
684    S16 dummy;                     /* dummy placeholder */
685 };
686
687 /* task related stuff */
688 /* data range modified */
689 #ifndef SS_MULTIPLE_PROCS
690 typedef U8  SSTskId;             /* System Task Id */
691 #else /* SS_MULTIPLE_PROCS */
692 typedef U16 SSTskId;             /* System Task Id */
693 #endif /* SS_MULTIPLE_PROCS */
694
695 typedef S32 SSTskPrior;          /* System Task Priority */
696 #ifdef SS_AEHDPR_SUPPORT
697 typedef Void (*PISR) ARGS((PTR cxt)); /* pointer to ISR function handler */
698 typedef Void (*PDPR) ARGS((PTR cxt)); /* pointer to DPR function handler */
699 #endif /* SS_AEHDPR_SUPPORT */
700 #else  /* not PORTVER */
701 #ifdef SS                        /* Common System Services */
702
703 /* for SGetOpt() */
704 EXTERN  S16 msOptInd;
705 EXTERN  S8  *msOptArg;
706 EXTERN  Txt **msArgv;
707 EXTERN  S16 msArgc;
708
709 /* task related stuff */
710 /* data range modified */
711 #ifndef SS_MULTIPLE_PROCS
712 typedef U8  SSTskId;             /* System Task Id */
713 #else /* SS_MULTIPLE_PROCS */
714 typedef U16 SSTskId;             /* System Task Id */
715 #endif /* SS_MULTIPLE_PROCS */
716
717 typedef S32 SSTskPrior;          /* System Task Priority */
718
719 #ifndef CMFILE_REORG_1
720
721 /* Buffer type is necessary */
722 typedef struct ssmsgb Buffer;
723
724 #endif /* CMFILE_REORG_1 */
725
726 /* message block */
727 struct ssmsgb
728 {
729    S8                   refCnt;     /* Counter to Free Buff */
730    struct ssmsgb        *b_next;     /* next message */
731    struct ssmsgb        *b_prev;     /* previous message */
732    struct ssmsgb        *b_cont;     /* next message block */
733    U8                   *b_rptr;     /* 1st unread data byte of buffer */
734    U8                   *b_wptr;     /* 1st unwritten data byte of buffer */
735    struct ssdatab       *b_datap;    /* pointer to data block */
736 };
737
738 /* Queue data structure */
739 typedef struct ssQueue
740 {
741    Buffer *head;                     /* head of queue */
742    Buffer *tail;                     /* tail of queue */
743    QLen   crntSize;                  /* current szie of queue */
744
745 } Queue;
746
747
748 /* Memory CTL operations structure */
749 typedef struct sMemCtl
750 {
751    U8 op;                           /* operation */
752
753    union
754    {
755       struct
756       {
757          Data *vaddr;               /* virtual address */
758          Data **paddr;              /* physical address */
759       } vtop;
760
761       struct
762       {
763          Size size;                 /* size */
764          Status *status;            /* status */
765       } chkres;
766    } u;
767
768 } SMemCtl;
769
770
771 /* memory management handler function types */
772 /* ssi_x_001.main_47 - addition for introducing additional parameter memType(static/dynamic) */
773 /* ssi_x_001.main_57 : Additions */
774 #ifdef SS_HISTOGRAM_SUPPORT 
775 #ifdef SSI_DEBUG_LEVEL1
776 typedef S16 (*SsAlloc) ARGS((Void *, Size *, U32, Data **, U32, U32, U8*, U8, Bool));
777 #else
778 typedef S16 (*SsAlloc) ARGS((Void *, Size *, U32, Data **, U32, U8*, U8, Bool));
779 #endif /* SSI_DEBUG_LEVEL1 */
780 typedef S16 (*SsFree) ARGS((Void *, Data *, Size, U32, U8*, U8, Bool));
781 typedef S16 (*SsCtl) ARGS((Void *, Event, SMemCtl *));
782 #elif defined(SS_LIGHT_MEM_LEAK_STS)
783 typedef S16 (*SsAlloc) ARGS((Void *, Size *, U32 , Data **, U32, U32 , U8 *));
784 typedef S16 (*SsFree) ARGS((Void *, Data *, Size, U32, U8 *));
785 typedef S16 (*SsCtl) ARGS((Void *, Event, SMemCtl *));
786 #else
787 #ifdef SSI_DEBUG_LEVEL1
788 typedef S16 (*SsAlloc) ARGS((Void *, Size *, U32, Data **, U32));
789 #else
790 #ifdef T2K_MEM_LEAK_DBG
791 typedef S16 (*SsAlloc) ARGS((Void *, Size *, U32, Data **,char*, U32));
792 #else
793 typedef S16 (*SsAlloc) ARGS((Void *, Size *, U32, Data **));
794 #endif
795 #endif /* SSI_DEBUG_LEVEL1 */
796 #ifdef T2K_MEM_LEAK_DBG
797 typedef S16 (*SsFree) ARGS((Void *, Data *, Size,char*, U32));
798 #else
799 typedef S16 (*SsFree) ARGS((Void *, Data *, Size));
800 #endif
801 typedef S16 (*SsCtl) ARGS((Void *, Event, SMemCtl *));
802 #endif /* SS_HISTOGRAM_SUPPORT */
803
804
805 /* region information structure -- passed to SRegRegion() */
806 typedef struct sRegInfo
807 {
808    Void         *regCb;            /* region control block pointer */
809    U32          flags;             /* region characteristics flags  */
810 /* ssi_x_001.main_64 Additions */
811 #ifdef SS_CAVIUM
812    cvmx_arena_list_t  regArena;    /* arena for the region */
813 #endif
814    Data         *start;            /* start address of region */
815    Size         size;              /* size of region */
816    SsAlloc      alloc;             /* allocation function pointer */
817    SsFree       free;              /* deallocation function pointer */
818    SsCtl        ctl;               /* control request function pointer */
819
820 } SRegInfo;
821
822
823 #ifdef SS_OLD_THREAD
824
825 /* types for SGetThread(), SGetMutex, etc. */
826 typedef Void    *(SThrd) ARGS((Void *));
827
828 typedef S32     SThrdId;           /* thread Id */
829 typedef S32     SMtxId;            /* mutex Id */
830 typedef S32     SCondId;           /* condition Id */
831
832 #endif /* SS_OLD_THREAD */
833
834 /*ssi_x_001.main_63 ss_dep.x guarded under flag*/
835 #ifdef SS_CAVIUM
836 #include "jz_dep.x"
837 #else
838 #ifdef SS_4GMX_LCORE
839 #include "ss_dep.x"
840 #else
841 #include "ss_dep.x"
842 #endif /* SS_4GMX_LCORE */
843 #endif/*SS_CAVIUM*/
844
845 #endif /* SS */
846 #endif /* PORTVER */
847 #endif /* MT */
848 #endif /* WINNT_IATM */
849 #endif /* SSRYLIB */
850 #endif /* SSLIB */
851 #endif /* VW */
852 #endif /* VX */
853 #endif /* PS */
854 #endif /* MSVER2 */
855 #endif /* MOSVER */
856 /* ssi_x_001.main_57 : Additions */
857 #ifdef SS_HISTOGRAM_SUPPORT  
858 /*
859 typedef struct entInfo
860 {
861    U8                 entid;
862 }EntInfo;
863
864 typedef struct secondIndex
865 {
866     EntInfo           info[26];
867 }SecondIndex;
868
869 typedef struct firstIndex
870 {
871     SecondIndex       info[26];
872 }FirstIndex; */
873 #endif /* SS_HISTOGRAM_SUPPORT */
874
875 \f
876 /* functions */
877
878 /* procId and control block added */ 
879 #ifndef SS_MULTIPLE_PROCS
880 typedef S16  (*PAIFS16) ARGS((Ent ent,Inst inst,Region region,Reason reason ));
881 /* ssi_x_001.main_54 */
882 /* ssi_x_001.main_53 */
883 /* ssi_x_001.main_69: Removed the SS_MT_TMR guard from PAIFTMRS16
884                       timer activation function typedef. */
885
886 typedef S16  (*PAIFTMRS16) ARGS((Ent ent, Inst inst));
887 #else
888 typedef S16  (*PAIFS16) ARGS((ProcId proc, 
889                               Ent ent,
890                               Inst inst,
891                               Region region,
892                               Reason reason,
893                               Void **xxCb));
894
895 /* time activation function typedef */
896 typedef S16  (*PAIFTMRS16) ARGS((ProcId proc, 
897                                  Ent ent,
898                                  Inst inst));
899 #endif /* SS_MULTIPLE_PROCS */
900
901 #ifndef VX
902 typedef S16  (*PATFS16) ARGS((Prior prior,Route route,Ent ent,Inst inst,Buffer *mBuf));
903 #else
904 typedef void  (*PATFS16) ARGS((void *vPtr));
905 #endif
906 typedef S16  (*ActvTsk) ARGS((Pst *pst, Buffer *mBuf));
907 #ifdef ENB_RELAY
908 typedef struct uProc UProc;  /* forward definition - uproc */
909 #ifdef RYINT1
910 typedef void (*ISTsk) ARGS((Inst inst));
911 #else  /* for backward compatibility */
912 typedef void (*ISTsk) ARGS((UProc *uProc));
913 #endif /* RYINT1 */
914
915 struct uProc
916 {
917    Inst inst;                         /* instance */
918    ProcId low;                        /* procId low value */
919    ProcId high;                       /* procId high value */
920    ActvTsk actvTsk;                   /* activation function for drvr task */ 
921    U16 isFlag;                        /* interrupt service flag */
922    ISTsk isTsk;                       /* interrupt service task */
923 };
924  
925
926 #endif /* ENB_RELAY */
927
928 \f
929 /* functions */
930 EXTERN S16 SChekMemUtilization ARGS((Region region,Bool *memAlarm));
931
932 EXTERN  Void prntMem ARGS((Data *strtAdr,S16 len));
933 EXTERN  Void prntMsg ARGS((Buffer *mBuf));
934 EXTERN  Void prntMsg1 ARGS((Buffer *mBuf,S16 src,S16 dst));
935 EXTERN  S16 tst ARGS((void ));
936 EXTERN  S16 rdConQ ARGS((Data data));
937
938 EXTERN  S16 SPkS8 ARGS((S8 val,Buffer *mBuf));
939 EXTERN  S16 SPkU8 ARGS((U8 val,Buffer *mBuf));
940 EXTERN  S16 SPkS16 ARGS((S16 val,Buffer *mBuf));
941 EXTERN  S16 SPkU16 ARGS((U16 val,Buffer *mBuf));
942 EXTERN  S16 SPkS32 ARGS((S32 val,Buffer *mBuf));
943 EXTERN  S16 SPkU32 ARGS((U32 val,Buffer *mBuf));
944 /* ssi_x_001.main_49 : added packing of F32 and F64*/
945 #ifdef SS_FLOAT
946 EXTERN  S16 SPkF32 ARGS((F32 val,Buffer *mBuf));
947 EXTERN  S16 SPkF64 ARGS((F64 val,Buffer *mBuf));
948 #endif /* SS_FLOAT */
949 EXTERN  S16 SUnpkS8 ARGS((S8 *val,Buffer *mBuf));
950 EXTERN  S16 SUnpkU8 ARGS((U8 *val,Buffer *mBuf));
951 EXTERN  S16 SUnpkS16 ARGS((S16 *val,Buffer *mBuf));
952 EXTERN  S16 SUnpkU16 ARGS((U16 *val,Buffer *mBuf));
953 EXTERN  S16 SUnpkS32 ARGS((S32 *val,Buffer *mBuf));
954 EXTERN  S16 SUnpkU32 ARGS((U32 *val,Buffer *mBuf));
955 /* ssi_x_001.main_49 : added unpacking of F32 and F64*/
956 #ifdef SS_FLOAT
957 EXTERN  S16 SUnpkF32 ARGS((F32 *val,Buffer *mBuf));
958 EXTERN  S16 SUnpkF64 ARGS((F64 *val,Buffer *mBuf));
959 #endif /* SS_FLOAT */
960 EXTERN  S16 SPrint ARGS((Txt *buf));
961 EXTERN  S16 SDisplay ARGS((S16 chan,Txt *buf));
962 EXTERN  S16 SPrntMsg ARGS((Buffer *mBuf,S16 src,S16 dst));
963 EXTERN  S16 SInitQueue ARGS((Queue *q));
964 #ifndef SS_ENABLE_MACROS
965 EXTERN  S16 SQueueFirst ARGS((Buffer *buf,Queue *q));
966 EXTERN  S16 SQueueLast ARGS((Buffer *buf,Queue *q));
967 EXTERN  S16 SDequeueFirst ARGS((Buffer * *bufPtr,Queue *q));
968 EXTERN  S16 SDequeueLast ARGS((Buffer * *bufPtr,Queue *q));
969 #endif /* SS_ENABLE_MACROS */
970 EXTERN  S16 SFlushQueue ARGS((Queue *q));
971 EXTERN  S16 SCatQueue ARGS((Queue *q1,Queue *q2,Order order));
972 EXTERN  S16 SFndLenQueue ARGS((Queue *q,QLen *lngPtr));
973 EXTERN  S16 SExamQueue ARGS((Buffer **bufPtr,Queue *q,QLen idx));
974 EXTERN  S16 SAddQueue ARGS((Buffer *buf,Queue *q,QLen idx));
975 EXTERN  S16 SRemQueue ARGS((Buffer **bufPtr,Queue *q,QLen idx));
976 #ifndef SS_ENABLE_MACROS
977 #ifdef T2K_MEM_LEAK_DBG
978 #define SGetDBuf(region,pool,buf) SGetDBufNew(region,pool,buf,__FILE__,__LINE__)
979 #define SPutDBuf(region,pool,buf) SPutDBufNew(region,pool,buf,file,line)
980 EXTERN  S16 SGetDBufNew ARGS((Region region,Pool pool,Buffer * *bufPtr,char*,U32));
981 EXTERN  S16 SPutDBufNew ARGS((Region region,Pool pool,Buffer *buf,char*,U32));
982 EXTERN  S16 SAttachPtrToBufNew ARGS((Region   region, Pool     pool, Data
983          *ptr, MsgLen   totalLen, Buffer** mBuf, char* file, U32 line));
984 #define SAttachPtrToBuf(region,pool,ptr,totalLen,mBuf) SAttachPtrToBufNew(region,pool,ptr,totalLen,mBuf,__FILE__,__LINE__)
985 #define SPutZbcDBuf(region,buf) SPutZbcDBufNew(region,buf,__FILE__,__LINE__)
986 #elif SS_LIGHT_MEM_LEAK_STS
987 EXTERN  S16 SGetDBufNew ARGS((Region region,Pool pool,Buffer * *bufPtr,U32 line,U8 *fnName));
988 EXTERN  S16 SPutDBufNew ARGS((Region region,Pool pool,Buffer *buf, U32 line, U8 *fnName));
989 #else
990
991 EXTERN  S16 SGetDBuf ARGS((Region region,Pool pool,Buffer * *bufPtr));
992 EXTERN  S16 SPutDBuf ARGS((Region region,Pool pool,Buffer *buf));
993 #endif
994 #else /* SS_ENABLE_MACROS */
995 #ifdef T2K_MEM_LEAK_DBG
996 #define SGetDBuf(region,pool,buf) SGetDBufNew(region,pool,buf,__FILE__,__LINE__)
997 #define SPutDBuf(region,pool,buf) SPutDBufNew(region,pool,buf,__FILE__,__LINE__)
998 EXTERN  S16 SGetDBufNew ARGS((Region region,Pool pool,Buffer * *bufPtr,char*,U32));
999 EXTERN  S16 SPutDBufNew ARGS((Region region,Pool pool,Buffer *buf,char*,U32));
1000 #elif SS_LIGHT_MEM_LEAK_STS
1001 EXTERN  S16 SGetDBufNew ARGS((Region region,Pool pool,Buffer * *bufPtr,U32 line,U8 *fnName));
1002 EXTERN  S16 SPutDBufNew ARGS((Region region,Pool pool,Buffer *buf, U32 line, U8 *fnName));
1003 #else
1004 EXTERN  S16 SGetDBuf ARGS((Region region,Pool pool,Buffer * *bufPtr));
1005 EXTERN  S16 SPutDBuf ARGS((Region region,Pool pool,Buffer *buf));
1006 #endif
1007 #endif /* SS_ENABLE_MACROS */
1008 EXTERN S16 SPutMsgToRegion ARGS((Region region, Buffer *buf));
1009 #ifdef SS_USE_ICC_MEMORY
1010 EXTERN Void *ssGetIccHdl ARGS((Region region));
1011 #endif /* SS_USE_ICC_MEMORY */
1012
1013 /* ssi_x_001.main_57 : Additions */
1014 /* ssi_x_001.main_59 : Added compile time flag */
1015 #ifdef SS_LIGHT_MEM_LEAK_STS
1016 EXTERN  S16 SGetMsgNew ARGS((Region region, Pool pool, Buffer * *mBufPtr, U32 line, U8 *fnName));
1017 EXTERN  S16 SGetSBufNew ARGS((Region region,Pool pool, Data * *bufPtr, Size size, U32 line, U8* fnName));
1018 EXTERN  S16 SPutMsgNew ARGS((Buffer *mBuf, U32 line,  U8 *fnName));
1019 EXTERN  S16 SPutSBufNew ARGS((Region region, Pool pool, Data *buf, Size size, U32 line, U8 *fnName));
1020 #else /*SS_LIGHT_MEM_LEAK_STS */
1021 #ifdef SS_HISTOGRAM_SUPPORT 
1022 EXTERN  S16 SPutMsgNew ARGS((Buffer *mBuf, U32 line,  U8 *fileName));
1023 EXTERN  S16 SGetMsgNew ARGS((Region region, Pool pool, Buffer * *mBufPtr, U32 line,  U8 *fileName));
1024 EXTERN  S16 SGetSBufNew ARGS((Region region,Pool pool, Data * *bufPtr, Size size, U32 line, U8 *fileName));
1025 EXTERN  S16 SPutSBufNew ARGS((Region region, Pool pool, Data *buf, Size size, U32 line, U8 *fileName));
1026 #else
1027 /*ssi_x_001.main_67 : RMIOS specific changes*/
1028 #ifndef SS_RMIOS
1029 #ifdef T2K_MEM_LEAK_DBG
1030 #define SPutMsg(mBuf) SPutMsgNew(mBuf,__FILE__,__LINE__)
1031 #define SGetMsg(region,pool,mBuf) SGetMsgNew(region,pool,mBuf,__FILE__,__LINE__)
1032 EXTERN  S16 SPutMsgNew ARGS((Buffer *mBuf,char*, U32));
1033 EXTERN  S16 SGetMsgNew ARGS((Region region, Pool pool, Buffer * *mBufPtr, char*,U32));
1034 #else
1035 EXTERN  S16 SPutMsg ARGS((Buffer *mBuf));
1036 EXTERN  S16 SGetMsg ARGS((Region region, Pool pool, Buffer * *mBufPtr));
1037 #endif
1038 #else
1039 #define SPutMsg(m) SPutMsgRmi(__FILE__, __LINE__, m)
1040 #define SGetMsg(r, p, m)    SGetMsgRmi(__FILE__, __LINE__, r, p, m)
1041 EXTERN  S16 SPutMsgRmi ARGS((char *file, int line, Buffer *mBuf));
1042 EXTERN  S16 SGetMsgRmi ARGS((char *file, int line, Region region, Pool pool, Buffer * *mBufPtr));
1043 #endif
1044 #if (defined(SSI_STATIC_MEM_LEAK_DETECTION)|| defined(T2K_MEM_LEAK_DBG))
1045 #define SGetSBuf(region,pool,bufPtr,size) SGetSBuf1(region,pool,bufPtr,size,__FILE__,__LINE__)
1046 EXTERN  S16 SGetSBuf1 ARGS((Region region,Pool pool, Data * *bufPtr, Size size, char* file, U32 line));
1047 EXTERN void DumpStaticMemLeakFiles ARGS((void));
1048 EXTERN void DumpT2kMemLeakInfoToFile ARGS((void)); 
1049 #define SPutSBuf(region,pool,buf,size) SPutSBuf1(region,pool,buf,size,__FILE__,__LINE__)
1050 EXTERN  S16 SPutSBuf1 ARGS((Region region, Pool pool, Data *buf, Size size, char*, U32));
1051 #else
1052 EXTERN  S16 SGetSBuf ARGS((Region region,Pool pool, Data * *bufPtr, Size size));
1053 EXTERN  S16 SPutSBuf ARGS((Region region, Pool pool, Data *buf, Size size));
1054 #endif
1055 #endif /* SS_HISTOGRAM_SUPPORT */
1056 #endif /*SS_LIGHT_MEM_LEAK_STS */
1057 #ifdef INTEL_WLS
1058 #ifdef T2K_MEM_LEAK_DBG
1059 #define SGetSBufWls(region,pool,bufPtr,size) SGetSBufWls1(region,pool,bufPtr,size,__FILE__,__LINE__) 
1060 #define SPutSBufWls(region,pool,bufPtr,size) SPutSBufWls1(region,pool,bufPtr,size,__FILE__,__LINE__) 
1061 EXTERN S16 SPutSBufWls1(Region region, Pool pool, Data *ptr, Size size,char* file, U32 line);
1062 EXTERN S16 SGetSBufWls1(Region region, Pool pool, Data **ptr, Size size,char* file, U32 line);  
1063 #define SAttachWlsPtrToMBuf(region,pool,bufPtr,rPtr,size,pLen,mBuf) SAttachWlsPtrToMBuf1(region,pool,bufPtr,rPtr,size,pLen,mBuf,__FILE__,__LINE__)
1064 EXTERN S16 SAttachWlsPtrToMBuf1(Region region, Pool pool, Data *ptr, Data *readPtr, MsgLen totalLen, MsgLen ptrLen, Buffer** mBuf,char* file, U32 line);
1065 #define SAttachPtrToMBuf(region,pool,bufPtr,size,pLen,mBuf) SAttachPtrToMBuf1(region,pool,bufPtr,size,pLen,mBuf,__FILE__,__LINE__)
1066
1067 #else
1068 EXTERN S16 SPutSBufWls(Region region, Pool pool, Data *ptr, Size size);
1069 EXTERN S16 SGetSBufWls(Region region, Pool pool, Data **ptr, Size size);   
1070 EXTERN S16 SAttachWlsPtrToMBuf(Region region, Pool pool, Data *ptr, Data *readPtr, MsgLen totalLen, MsgLen ptrLen, Buffer** mBuf);
1071 #endif
1072 #endif
1073 EXTERN  S16 SGetStaticBuffer ARGS((Region region,Pool pool, Data * *bufPtr, Size size, U8 memType));
1074 EXTERN  S16 SPutStaticBuffer ARGS((Region region, Pool pool, Data *buf, Size size, U8 memType));
1075 /* ssi_x_001.main_65: Additions */
1076 #ifdef SS_SEUM_CAVIUM
1077 EXTERN S16 ssInitRcvWork ARGS((void));
1078 EXTERN S16 SConvPtrPhy ARGS(( Buffer  **mBuf));
1079 EXTERN S16 SConvPhyPtr ARGS((Buffer  **workPtr));
1080 EXTERN S16 SCpyFpaMsg ARGS((Buffer *srcBuf, Region dstRegion,Pool dstPool, Buffer **dstBuf));
1081 EXTERN S16 SCpyMsgFpa ARGS(( Buffer *srcBuf, Buffer **dstBuf));
1082 EXTERN S16 SPutFpaMsg ARGS(( Buffer *fpaBuf));
1083 #endif /* SS_SEUM_CAVIUM */
1084
1085 EXTERN  S16 SGetSMem ARGS((Region region,Size size,Pool *poolPtr));
1086 EXTERN  S16 SPutSMem ARGS((Region region,Pool pool));
1087 EXTERN  S16 SInitMsg ARGS((Buffer *mBuf));
1088 EXTERN  S16 SAddPreMsg ARGS((Data data,Buffer *mBuf));
1089 EXTERN  S16 SAddPstMsg ARGS((Data data,Buffer *mBuf));
1090 /* ssi_x_001.main_70 - Added prototype for SAddPreMsgMultInOrder */
1091 EXTERN  S16 SAddPreMsgMultInOrder ARGS((Data *src,MsgLen cnt,Buffer *mBuf));
1092 EXTERN  S16 SRemPreMsg ARGS((Data *dataPtr,Buffer *mBuf));
1093 EXTERN  S16 SRemPreMsgRegion ARGS((Region region, Data *dataPtr,Buffer *mBuf));
1094 EXTERN  S16 SCatMsgRegion ARGS((Region region, Buffer *mBuf1,Buffer *mBuf2,Order order));
1095 EXTERN  S16 SSegMsgRegion ARGS((Region region, Buffer *mBuf1,MsgLen idx,Buffer **mBuf2));
1096 EXTERN  int SCreatePThread ARGS((pthread_t* tid, pthread_attr_t* attr, void *(*start_routine) (void *), void* arg));
1097 EXTERN  S16 SRemPstMsg ARGS((Data *dataPtr,Buffer *mBuf));
1098 #ifdef T2K_MEM_LEAK_DBG
1099 #define SAddPreMsgMult(src, cnt, mBuf) SAddPreMsgMult1(src, cnt, mBuf, __FILE__,__LINE__)
1100 #define SAddPstMsgMult(src, cnt, mBuf) SAddPstMsgMult1(src, cnt, mBuf, __FILE__,__LINE__)
1101
1102 EXTERN  S16 SAddPreMsgMult1 ARGS((Data *src,MsgLen cnt,Buffer *mBuf, char *file, U32 line));
1103 EXTERN  S16 SAddPstMsgMult1 ARGS((Data *src,MsgLen cnt,Buffer *mBuf, char *file, U32 line));
1104 #else
1105 EXTERN  S16 SAddPreMsgMult ARGS((Data *src,MsgLen cnt,Buffer *mBuf));
1106 EXTERN  S16 SAddPstMsgMult ARGS((Data *src,MsgLen cnt,Buffer *mBuf));
1107 #endif
1108 EXTERN  S16 SGetPstMsgMult ARGS((MsgLen cnt,Buffer *mBuf));
1109 EXTERN  S16 SRemPreMsgMult ARGS((Data *dst,MsgLen cnt,Buffer *mBuf));
1110 EXTERN  S16 SRemPstMsgMult ARGS((Data *dst,MsgLen cnt,Buffer *mBuf));
1111 EXTERN  S16 SRepMsg ARGS((Data data,Buffer *mBuf,MsgLen idx));
1112 EXTERN  S16 SExamMsg ARGS((Data *dataPtr,Buffer *mBuf,MsgLen idx));
1113 /*ssi_x_001.main_60 */
1114 EXTERN S16 SGetDataFrmMsg ARGS ((Buffer *mBuf, Data *dataPtr, MsgLen idx, MsgLen dataLen));
1115 EXTERN  S16 SFndLenMsg ARGS((Buffer *mBuf,MsgLen *lngPtr));
1116 EXTERN  S16 SCatMsg ARGS((Buffer *mBuf1,Buffer *mBuf2,Order order));
1117 #ifdef T2K_MEM_LEAK_DBG
1118 #define SSegMsg(mBuf1, idx, mBuf2) SSegMsgNew(mBuf1, idx, mBuf2, __FILE__, __LINE__)
1119 EXTERN  S16 SSegMsgNew ARGS((Buffer *mBuf1,MsgLen idx,Buffer **mBuf2,char*,U32));
1120 #else
1121 EXTERN  S16 SSegMsg ARGS((Buffer *mBuf1,MsgLen idx,Buffer **mBuf2));
1122 #endif
1123 EXTERN  S16 SSwapMsg ARGS((Buffer *mBuf1, Buffer *mBuf2));
1124 EXTERN  S16 SCpyMsgFix ARGS((Buffer *srcMbuf,MsgLen srcIdx,MsgLen cnt,
1125             Data *dstBuf,MsgLen *cCnt));
1126 EXTERN  S16 SCpyFixMsg ARGS((Data *srcBuf,Buffer *dstMbuf,
1127             MsgLen dstIdx,MsgLen cnt,MsgLen *cCnt));
1128 EXTERN  S16 SCompressMsg ARGS((Buffer *mBuf));
1129 #ifdef T2K_MEM_LEAK_DBG
1130 #define SAddMsgRef(mBuf,region,pool,dstBuf) SAddMsgRefNew(mBuf,region,pool,dstBuf,__FILE__,__LINE__)
1131 #define SCpyMsgMsg(mBuf,region,pool, dstBuf) SCpyMsgMsgNew(mBuf,region,pool, dstBuf, __FILE__, __LINE__)
1132 EXTERN  S16 SAddMsgRefNew ARGS((Buffer *mBuf, Region region, Pool pool, 
1133             Buffer **dstBuf,char*,U32));
1134 EXTERN  S16 SCpyMsgMsgNew ARGS((Buffer *mBuf, Region region, Pool pool, 
1135             Buffer **dstBuf,char* , U32));
1136 #else
1137 EXTERN  S16 SCpyMsgMsg ARGS((Buffer *mBuf, Region region, Pool pool, 
1138             Buffer **dstBuf));
1139 EXTERN  S16 SAddMsgRef ARGS((Buffer *mBuf, Region region, Pool pool, 
1140             Buffer **dstBuf));
1141 EXTERN  S16 SIncMsgRef(Buffer *srcBuf, Region dstRegion, Pool dstPool, Buffer **dstBuf);
1142
1143 #ifdef SS_RBUF
1144 /* EXTERN  S16 SIncMsgRef ARGS((Buffer *srcBuf, Buffer **dstBuf)); */
1145 EXTERN Void SIncMsgLen ARGS((Buffer *mBuf));
1146 #endif
1147 #endif
1148 EXTERN  S16 SChkRes ARGS((Region region,Pool pool,Status *status));
1149 EXTERN  S16 SChkResUtl ARGS((Region region,U8 *wSum));
1150 EXTERN  S16 SSetDateTime ARGS((DateTime *dt));
1151 EXTERN  S16 SGetDateTime ARGS((DateTime *dt));
1152 #ifdef L2_OPTMZ
1153 EXTERN Void SResetMBuf ARGS ((Buffer *mBuf));
1154 #endif
1155  /* ssi_x_001.main_57 : Additions */
1156  /* ssi_x_001.main_58 : Additions */
1157  /* ssi_x_001.main_60 : Modifications */
1158 EXTERN  S16 SGetEpcTime ARGS((EpcTime *et));  
1159 /* ssi_x_001.main_48: Added Timestamp changes */
1160 EXTERN  S16 SGetTimeStamp ARGS(( S8    *ts));
1161 EXTERN  S16 SGetSysTime ARGS((Ticks *sysTime));
1162 EXTERN  S16 SGetRefTime ARGS((U32 refTime, U32 *sec, U32 *usec));
1163 EXTERN  S16 SRandom ARGS((Random *value));
1164 EXTERN  S16 SError ARGS((Seq seq,Reason reason));
1165 EXTERN  Void SLogError ARGS((Ent ent, Inst inst, ProcId procId, Txt *file,
1166                        S32 line, ErrCls errCls, ErrCode errCode,
1167                        ErrVal errVal, Txt *errDesc));
1168 /* ssi_x_001.main_49 : added prototype for SGetSystemTsk() */
1169 EXTERN U32 SGetSystemTsk ARGS ((Void));
1170 /* changes to support multiple processors in single SSI */
1171 /* multiple proc id changes: 
1172    these functions are not supported with multiple proc Ids */ 
1173 #ifndef SS_MULTIPLE_PROCS
1174 EXTERN  S16 SRegInit ARGS((Ent ent,Inst inst,PAIFS16 initFnct));
1175 EXTERN  S16 SRegActvTsk ARGS((Ent ent,Inst inst,Ttype ttype,Prior prior,
1176                               ActvTsk actvTsk));
1177 #endif /* SS_MULTIPLE_PROCS */
1178
1179 /* multiple proc id changes: procId added and time function type modified */ 
1180 #ifndef SS_MULTIPLE_PROCS
1181 EXTERN  S16 SRegCfgTmr ARGS((Ent ent,
1182                              Inst inst,
1183                              S16 period,
1184                              S16 units,
1185                              PFS16 tmrFnct));
1186 #ifdef SS_MT_TMR
1187 /* ssi_x_001.main_53 */
1188 EXTERN  S16 SRegCfgTmrMt ARGS((Ent ent,
1189                                Inst inst,
1190                                S16 period,
1191                                S16 units,
1192                                PAIFTMRS16 tmrFnctMt));
1193 #endif
1194 EXTERN  S16 SDeregCfgTmr ARGS((Ent ent,
1195                                Inst inst,
1196                                S16 period,
1197                                S16 units,
1198                                PFS16 tmrFnct));
1199 #ifdef SS_MT_TMR
1200 /* ssi_x_001.main_53 */
1201 EXTERN  S16 SDeregCfgTmrMt ARGS((Ent ent,
1202                                  Inst inst,
1203                                  S16 period,
1204                                  S16 units,
1205                                  PAIFTMRS16 tmrFnctMt));
1206 #endif
1207 #else
1208 EXTERN  S16 SRegCfgTmr ARGS((ProcId proc, 
1209                              Ent ent,
1210                              Inst inst,
1211                              S16 period,
1212                              S16 units,
1213                              PAIFTMRS16 tmrFnct));
1214 EXTERN  S16 SDeregCfgTmr ARGS((ProcId proc, 
1215                                Ent ent,
1216                                Inst inst,
1217                                S16 period,
1218                                S16 units,
1219                                PAIFTMRS16 tmrFnct));
1220 #endif /* SS_MULTIPLE_PROCS */
1221
1222 EXTERN  S16 SPstTsk ARGS((Pst *pst, Buffer *mBuf));
1223
1224 #ifdef SS_ROUTE_MSG_CORE1
1225 EXTERN  S16 SPstTskIcpu ARGS((Pst *pst, Buffer *mBuf));
1226 #endif
1227
1228 #ifdef ENB_RELAY
1229 EXTERN  S16 SRegDrvrTsk ARGS((Inst inst, ProcId low, ProcId high, 
1230                               ActvTsk actvTsk, ISTsk isTsk));
1231 /*ssi_x_001.main_56*/
1232 EXTERN S16 SDeregDrvrTsk ARGS((Inst channel));
1233 #endif /* ENB_RELAY */
1234
1235 #ifdef SS_RTR_SUPPORT
1236 EXTERN  S16 SRegRtrTsk ARGS((Route *, Cntr, ActvTsk));
1237 EXTERN  S16 SDeregRtrTsk ARGS((Route *, Cntr));
1238 #endif /* SS_RTR_SUPPORT */
1239
1240 #ifdef SS_USE_ZBC_MEMORY
1241 EXTERN S16 SAttachPtrToBuf ARGS((
1242 Region   region,
1243 Pool     pool,
1244 Data    *ptr,
1245 MsgLen   totalLen,
1246 Buffer** mBuf
1247 ));
1248 #endif
1249 /* multi-core support ssi_x_001.main_55 */
1250 /*ssi_x_001.main_68 Added SS_AFFINITY_SUPPORT*/
1251 #if defined(SS_MULTICORE_SUPPORT) || defined(SS_AFFINITY_SUPPORT)
1252
1253 typedef S8 SsAffinityMode;
1254
1255
1256 typedef struct {
1257   U32 numCores;                   /* total number of cores available */
1258   U32 threadsPerCore;             /* total number of threads available per core */
1259   U32 threadRegister[SS_MAX_CORES]; /* available threads per core */
1260 } SCpuInfo;
1261
1262 EXTERN S16 SRegCpuInfo ARGS((SCpuInfo *cpuInfo));
1263 EXTERN S16 SSetAffinity ARGS((SSTskId *tskId, SsAffinityMode mode, U32 coreId, SSTskId *tskAssociatedTskId));
1264 EXTERN S16 SGetAffinity ARGS((SSTskId *tskId, U32 *coreId));
1265
1266 #endif /* SS_MULTICORE_SUPPORT || SS_AFFINITY_SUPPORT*/
1267
1268 #ifdef SS_AEHDPR_SUPPORT
1269 EXTERN  S16 SSetAehDpr ARGS((ProcId procId, VectNmb vectNmb,PISR pisr,PTR ptr1,PDPR pdpr,PTR ptr2));
1270 EXTERN S16 SRemoveAehDpr ARGS((ProcId chipNum, VectNmb vectNmb));
1271 #endif
1272 EXTERN S16 SAddDBufPst ARGS((Buffer *mBuf, Buffer *dBuf));
1273 EXTERN S16 SAddDBufPre ARGS((Buffer *mBuf, Buffer *dBuf));
1274 EXTERN S16 SRemDBufPst ARGS((Buffer *mBuf, Buffer **dBuf));
1275 EXTERN S16 SRemDBufPre ARGS((Buffer *mBuf, Buffer **dBuf));
1276 EXTERN S16 SGetDataRx ARGS((Buffer *dBuf, MsgLen pad, Data **dat, MsgLen *mLen));
1277 EXTERN S16 SGetDataTx ARGS((Buffer *dBuf, Data **dat, MsgLen *mLen));
1278 EXTERN S16 SUpdMsg ARGS((Buffer *mBuf, Buffer *dBuf, MsgLen mLen));
1279 EXTERN S16 SCacheFlush ARGS( (U16 cache_type, Data *addr, Size size));
1280 EXTERN S16 SCacheInvalidate ARGS( (U16 cache_type, Data *addr, Size size));
1281 EXTERN S16 SAlignDBufEven ARGS((Buffer *dBuf));
1282 EXTERN S16 SAlignDBuf ARGS((Buffer *dBuf, U32 align));
1283 EXTERN S16 SInitNxtDBuf ARGS((Buffer *mBuf));
1284 EXTERN S16 SGetNxtDBuf ARGS((Buffer *mBuf, Buffer **dBuf));
1285 EXTERN S16 SChkNxtDBuf ARGS((Buffer *mBuf));
1286 EXTERN S16 SSetIntPend ARGS((U16 id, Bool flag));
1287 EXTERN S16 SChkMsg ARGS((Buffer *mBuf));
1288 EXTERN  S16 SDeregInitTskTmr ARGS((Ent ent,Inst inst));
1289 EXTERN  S16 SExitTsk ARGS((void ));
1290 EXTERN  S16 SExitInt ARGS((void ));
1291 EXTERN  S16 SHoldInt ARGS((void ));
1292 EXTERN  S16 SRelInt ARGS((void ));
1293 EXTERN  S16 SEnbInt ARGS((void ));
1294 EXTERN  S16 SDisInt ARGS((void ));
1295 EXTERN  S16 SGetVect ARGS((VectNmb vectNmb,PIF *vectFnct));
1296 EXTERN  S16 SPutVect ARGS((VectNmb vectNmb,PIF vectFnct));
1297 #ifdef WINNT_KERN
1298 EXTERN  S16 SPutIsrDpr ARGS((VectNmb vectNmb, Void *context, PIF isrFnct, 
1299                              PIF dprFnct));
1300 EXTERN  S16 SSyncInt   ARGS((U16 adapterNmb, PFVOID syncFnct, 
1301                              Void *syncContext));
1302 #endif
1303 EXTERN  S16 SInitSema ARGS((Region region, Sema *sema));
1304 EXTERN  S16 SRelSema ARGS((Region region, Sema sema));
1305 EXTERN  S16 SGetSema ARGS((Region region, Sema sema));
1306 EXTERN  S16 SActvInit ARGS((Ent ent,Inst inst,Region region,Reason reason));
1307 EXTERN  S16 SActvTsk ARGS((Prior prior,Route route,Ent srcEnt,
1308             Inst srcInst,Buffer *mBuf));
1309 EXTERN  S16 SActvTmr ARGS((void ));
1310 EXTERN  S16 SGetOpt ARGS((int argc,char **argv,char *opts));
1311 /* multiple proc id changes: 
1312    These functions not supported with multiple procIds */
1313 #ifndef SS_MULTIPLE_PROCS
1314 EXTERN  S16 SGetEntInst ARGS((Ent *ent, Inst *inst));
1315 EXTERN  S16 SSetEntInst ARGS((Ent ent, Inst inst));
1316 EXTERN  ProcId SFndProcId ARGS((void));
1317 EXTERN  Void SSetProcId ARGS((ProcId pId));
1318 #endif /* SS_MULTIPLE_PROCS */
1319
1320 EXTERN S16 SGetDBufSiz ARGS((Region region, Pool pool, S16 *size));
1321 EXTERN S16 SGetStrtIdx ARGS((Region region, Pool pool,  S16 *idx));
1322 EXTERN S16 SGetEndIdx ARGS((Region region, Pool pool,  S16 *idx));
1323 EXTERN S16 SGetStrtPad ARGS((Region region, Pool pool,  S16 *pad));
1324 /* multiple proc id changes: control block retrieval function */
1325 #ifdef SS_MULTIPLE_PROCS
1326 EXTERN S16 SGetXxCb ARGS((ProcId proc, Ent ent, Inst inst, Void **xxCb));
1327 #endif /* SS_MULTIPLE_PROCS */
1328
1329 #ifdef MT
1330 /*
1331  * These routines are only available for multi-threaded
1332  * system service implementations
1333  */
1334 EXTERN S16 SGetMutex ARGS((MtMtxId *mId));
1335 EXTERN S16 SPutMutex ARGS((MtMtxId mId));
1336 EXTERN S16 SLockMutex ARGS((MtMtxId mId));
1337 EXTERN S16 SUnlockMutex ARGS((MtMtxId mId));
1338 EXTERN S16 SGetCond ARGS((MtCondId *cId));
1339 EXTERN S16 SPutCond ARGS((MtCondId cId));
1340 EXTERN S16 SCondWait ARGS((MtMtxId mId,MtCondId cId));
1341 EXTERN S16 SCondSignal ARGS((MtCondId cId));
1342 EXTERN S16 SCondBroadcast ARGS((MtCondId cId));
1343 EXTERN S16 SGetThread ARGS((MtThrd thrd, MtThrdFlags thr_flgs, 
1344                             Ptr arg, MtThrdId *thrdId));
1345 EXTERN S16 SPutThread ARGS((MtThrdId thrdId));
1346 EXTERN Void SThreadYield ARGS((void));
1347 EXTERN Void SThreadExit ARGS((Ptr *status));
1348 EXTERN Void SSetThrdPrior ARGS((MtThrdId tId, MtThrdPrior tPr));
1349 EXTERN Void SGetThrdPrior ARGS((MtThrdId tId, MtThrdPrior *tPr));
1350 #endif /* MT */
1351
1352 EXTERN Void SExit ARGS((Void));
1353 #ifdef SS
1354 /* multiple proc id changes: procId added */ 
1355 #ifndef SS_MULTIPLE_PROCS
1356
1357 EXTERN S16 SRegTTsk ARGS((Ent ent, 
1358                           Inst inst, 
1359                           Ttype type, 
1360                           Prior prior, 
1361                           PAIFS16 initTsk, 
1362                           ActvTsk actvTsk));
1363 /* ssi_x_001.main_60 */
1364 EXTERN S16 SRegCbTsk ARGS((Ent ent, 
1365                           Inst inst, 
1366                           ActvTsk actvTsk));
1367 EXTERN S16 SDeregTTsk ARGS((Ent ent, Inst inst));
1368
1369 #else
1370
1371 EXTERN S16 SRegTTsk ARGS((ProcId proc, 
1372                           Ent ent, 
1373                           Inst inst, 
1374                           Ttype type, 
1375                           Prior prior, 
1376                           PAIFS16 initTsk, 
1377                           ActvTsk actvTsk));
1378 EXTERN S16 SDeregTTsk ARGS((ProcId proc, Ent ent, Inst inst));
1379
1380 EXTERN S16 SRegCbTsk ARGS((ProcId proc,
1381                                                                   Ent ent, 
1382                           Inst inst, 
1383                           ActvTsk actvTsk));
1384 #endif /* SS_MULTIPLE_PROCS */
1385
1386 EXTERN S16 SCreateSTsk ARGS((SSTskPrior tskPrior, SSTskId *tskId));
1387 EXTERN S16 SDestroySTsk ARGS((SSTskId tskId));
1388 /* multiple proc id changes: procId added */ 
1389 #ifndef SS_MULTIPLE_PROCS
1390
1391 EXTERN S16 SAttachTTsk ARGS((Ent ent, Inst inst, SSTskId tskId));
1392 EXTERN S16 SDetachTTsk ARGS((Ent ent, Inst inst));
1393
1394 #else
1395
1396 EXTERN S16 SAttachTTsk ARGS((ProcId proc, Ent ent, Inst inst, SSTskId tskId));
1397 EXTERN S16 SDetachTTsk ARGS((ProcId proc, Ent ent, Inst inst));
1398
1399 #endif /* SS_MULTIPLE_PROCS */
1400 EXTERN S16 SRegRegion ARGS((Region region, SRegInfo *regInfo));
1401 EXTERN S16 SDeregRegion ARGS((Region region));
1402 EXTERN S16 SRegDynRegion ARGS((Region region, SRegInfo *regInfo)); 
1403 /*ssi_x_001.main_62-prototype for SAlloc and SFree, gaurded under flag*/
1404 #ifndef SS_FAP
1405  /* ssi_x_001.main_57 : Additions */
1406 #ifdef SS_HISTOGRAM_SUPPORT 
1407 EXTERN S16 SAlloc ARGS((Region region, Size *size, U32 flags, Data **ptr,U32 line, U8 *fileName, U8 entId));
1408 EXTERN S16 SFree ARGS((Region region, Data *ptr, Size size, U32 line, U8 *fileName, U8 entId));
1409 #else
1410 #ifdef T2K_MEM_LEAK_DBG
1411 #define SAlloc(region,size,flags,ptr) SAllocNew(region,size,flags,ptr,file,line)
1412 #define SFree(region,ptr,size) SFreeNew(region,ptr,size,file,line)
1413 EXTERN S16 SAllocNew ARGS((Region region, Size *size, U32 flags, Data **ptr,char*,U32));
1414 EXTERN S16 SFreeNew ARGS((Region region, Data *ptr, Size size,char*,U32));
1415 #elif defined(SS_LIGHT_MEM_LEAK_STS)
1416 EXTERN S16 SAlloc ARGS((Region region, Size *size, U32 flags, Data **ptr,U32 line, U8 *fnName));
1417 EXTERN S16 SFree ARGS((Region region, Data *ptr, Size size, U32 line, U8 *fnName));
1418 #else
1419 EXTERN S16 SAlloc ARGS((Region region, Size *size, U32 flags, Data **ptr));
1420 EXTERN S16 SFree ARGS((Region region, Data *ptr, Size size));
1421 #endif
1422 #endif
1423 EXTERN S16 SGetBufRegionPool ARGS((Buffer *mBuf, Region *region, Pool *pool));
1424 #endif /* SS_ENABLE_MACROS */
1425
1426 #ifdef SS_OLD_THREAD
1427 EXTERN S16 SGetMutex      ARGS((SMtxId *mId));
1428 EXTERN S16 SPutMutex      ARGS((SMtxId mId));
1429 EXTERN S16 SLockMutex     ARGS((SMtxId mId));
1430 EXTERN S16 SUnlockMutex   ARGS((SMtxId mId));
1431 EXTERN S16 SGetCond       ARGS((SCondId *cId));
1432 EXTERN S16 SPutCond       ARGS((SCondId cId));
1433 EXTERN S16 SCondWait      ARGS((SMtxId mId,SCondId cId));
1434 EXTERN S16 SCondSignal    ARGS((SCondId cId));
1435 EXTERN S16 SCondBroadcast ARGS((SCondId cId));
1436 EXTERN S16 SGetThread     ARGS((SThrd thrd, S32 thr_flgs, 
1437                                                  Ptr arg, SThrdId *thrdId));
1438 EXTERN S16 SPutThread     ARGS((SThrdId thrdId));
1439 EXTERN Void SThreadYield  ARGS((void));
1440 EXTERN Void SThreadExit   ARGS((Ptr status));
1441 EXTERN Void SSetThrdPrior ARGS((SThrdId tId, S32 tPr));
1442 EXTERN Void SGetThrdPrior ARGS((SThrdId tId, S32 *tPr));
1443 EXTERN Void SExit         ARGS((void));
1444 #else /* SS_OLD_THREAD */
1445 EXTERN S16 SThreadYield  ARGS((void));
1446 #endif /* SS_OLD_THREAD */
1447
1448 EXTERN S16 SInitLock     ARGS((SLockId *lock,U8 type));
1449 EXTERN S16 SLock         ARGS((SLockId *lock));
1450 EXTERN S16 SUnlock       ARGS((SLockId *lock));
1451 EXTERN S16 SDestroyLock  ARGS((SLockId *lock));
1452
1453
1454 EXTERN S16 SInitSemaphore ARGS((SsSemaId *sem, U8 value));
1455 EXTERN S16 SWaitSemaphore ARGS((SsSemaId *sem));
1456 EXTERN S16 SPostSemaphore ARGS((SsSemaId *sem));
1457 EXTERN S16 SDestroySemaphore ARGS((SsSemaId *sem));
1458
1459 /* multiple proc id changes: 
1460    new function required to implement multiple procIds */
1461 #ifdef SS_MULTIPLE_PROCS
1462 EXTERN S16 SAddProcIdLst ARGS((U16 numPIds, ProcId *pIdLst));
1463 EXTERN S16 SRemProcIdLst ARGS((U16 numPIds, ProcId *pIdLst));
1464 EXTERN S16 SGetProcIdLst ARGS((U16 *numPIds, ProcId *pIdLst));
1465 #endif /* SS_MULTIPLE_PROCS */
1466
1467 #endif /* SS */
1468
1469 #ifdef SS_SEGV_SIG_HDLR
1470 #ifndef SS_MULTIPLE_PROCS
1471 EXTERN S16 SRegIntrptHdlr ARGS((Ent ent, Inst inst, PFS16 intrptActvFn));
1472 #else
1473 EXTERN S16 SRegIntrptHdlr ARGS((ProcId proc, Ent ent, Inst inst, PFS16 intrptActvFn));
1474 #endif/*SS_MULTIPLE_PROCS*/
1475 #endif /* SS_SEGV_SIG_HDLR */
1476
1477 #ifdef PORTVER
1478 /* procId added */ 
1479 #ifndef SS_MULTIPLE_PROCS
1480 EXTERN S16 SRegTTsk ARGS((Ent ent, 
1481                           Inst inst, 
1482                           Ttype type, 
1483                           Prior prior, 
1484                           PAIFS16 initTsk, 
1485                           ActvTsk actvTsk));
1486 /* ssi_x_001.main_60 */
1487 EXTERN S16 SRegCbTsk ARGS((Ent ent, 
1488                           Inst inst, 
1489                           ActvTsk actvTsk));
1490 EXTERN S16 SDeregTTsk ARGS((Ent ent, Inst inst));
1491 EXTERN S16 SAttachTTsk ARGS((Ent ent, Inst inst, SSTskId tskId));
1492 EXTERN S16 SDetachTTsk ARGS((Ent ent, Inst inst));
1493 #else
1494 EXTERN S16 SRegTTsk ARGS((ProcId proc, 
1495                           Ent ent, 
1496                           Inst inst, 
1497                           Ttype type, 
1498                           Prior prior, 
1499                           PAIFS16 initTsk, 
1500                           ActvTsk actvTsk));
1501 EXTERN S16 SRegCbTsk ARGS((ProcId proc,
1502                                                                   Ent ent, 
1503                           Inst inst, 
1504                           ActvTsk actvTsk));
1505 EXTERN S16 SDeregTTsk ARGS((ProcId proc, Ent ent, Inst inst));
1506 EXTERN S16 SAttachTTsk ARGS((ProcId proc, Ent ent, Inst inst, SSTskId tskId));
1507 EXTERN S16 SDetachTTsk ARGS((ProcId proc, Ent ent, Inst inst));
1508 #endif /* SS_MULTIPLE_PROCS */
1509
1510 EXTERN S16 SCreateSTsk ARGS((SSTskPrior tskPrior, SSTskId *tskId));
1511 EXTERN S16 SDestroySTsk ARGS((SSTskId tskId));
1512 #ifndef SS_ENABLE_MACROS
1513 EXTERN S16 SGetBufRegionPool ARGS((Buffer *mBuf, Region *region, Pool *pool));
1514 #endif /* SS_ENABLE_MACROS */
1515
1516 EXTERN S16 SInitLock     ARGS((SLockId *lock,U8 type));
1517 EXTERN S16 SLock         ARGS((SLockId *lock));
1518 EXTERN S16 SUnlock       ARGS((SLockId *lock));
1519 EXTERN S16 SDestroyLock  ARGS((SLockId *lock));
1520
1521 EXTERN S16 SInitSemaphore ARGS((SsSemaId *sem, U8 value));
1522 EXTERN S16 SWaitSemaphore ARGS((SsSemaId *sem));
1523 EXTERN S16 SPostSemaphore ARGS((SsSemaId *sem));
1524 EXTERN S16 SDestroySemaphore ARGS((SsSemaId *sem));
1525 /* functions required to implement multiple procIds */ 
1526 #ifdef SS_MULTIPLE_PROCS
1527 EXTERN S16 SAddProcIdLst ARGS((U16 numPIds, ProcId *pIdLst));
1528 EXTERN S16 SRemProcIdLst ARGS((U16 numPIds, ProcId *pIdLst));
1529 EXTERN S16 SGetProcIdLst ARGS((U16 *numPIds, ProcId *pIdLst));
1530 #endif /* SS_MULTIPLE_PROCS */
1531
1532 #endif /* PORTVER */
1533
1534 \f  
1535 /* function prototypes */
1536  
1537 /* stack manager initialization function */
1538 /* multiple proc id changes: procId added */ 
1539 #ifndef SS_MULTIPLE_PROCS
1540 EXTERN S16 smActvInit ARGS((Ent ent, Inst inst, Region region, Reason reason));
1541 #else /* SS_MULTIPLE_PROCS */
1542 EXTERN S16 smActvInit ARGS((ProcId proc, 
1543                             Ent ent, 
1544                             Inst inst, 
1545                             Region region, 
1546                             Reason reason,
1547                             Void **xxCb));
1548 #endif /* SS_MULTIPLE_PROCS */
1549
1550 /* stack manager external initialization function */
1551 EXTERN S16 smInitExt ARGS((void));
1552  
1553 /* stack manager activation function */
1554 EXTERN S16 smActvTsk ARGS((Pst *pst, Buffer *mBuf));
1555
1556 /* ssi_x_001.main_54 */
1557 #ifdef SS_SID_CHANGE
1558 /* ssi_x_001.main_53 */
1559 EXTERN  S16 SGetInDepSId ARGS((SystemId *s));
1560 EXTERN  S16 SGetDepSId ARGS((SystemId *s));
1561 #endif
1562
1563 /* Macros... */
1564  
1565 #define SS_INITDCHN(chn) (chn)->next = NULLP; (chn)->prev = NULLP
1566 #define SS_INITQUE(qu) \
1567    SS_INITDCHN(&(qu)->dChn); (qu)->crntSize = 0
1568 #define SS_QLEN(bq)  ((bq)->crntSize)
1569 #define SS_MLEN(mb) ((mb)->t.msg.msgLen)
1570
1571 /* ssi_x_001.main_50 : Added declarations for mutex related functions
1572  * to protect demand queue and memory allocation 
1573  */
1574 /* ssi_x_001.main_51 : Added control flag as these are only used by windows */
1575 #ifdef SS_WIN
1576 EXTERN S16 WTInitLock     ARGS((SLockId *lock,U8 type));
1577 EXTERN S16 WTLock         ARGS((SLockId *lock));
1578 EXTERN S16 WTUnlock       ARGS((SLockId *lock));
1579 EXTERN S16 WTDestroyLock  ARGS((SLockId *lock));
1580 #endif /* End of SS_WIN */
1581  /* ssi_x_001.main_57 : Additions */
1582 #ifdef SS_LOGGER_SUPPORT  
1583 EXTERN S16 SRegLogCfg ARGS(( U8 mode, S8 *path, U32 size, S8 *IPA, U16 port));
1584 EXTERN S16 SWrtLogBuf ARGS(( Txt *buf ));
1585 /* ssi_x_001.main_60 */
1586 EXTERN S16 SDeregLogCfg ARGS((Void ));
1587 #endif /* SS_LOGGER_SUPPORT */
1588
1589 #ifdef SS_HISTOGRAM_SUPPORT
1590 EXTERN S16 SRegForHstGrm ARGS((Ent ent));
1591 EXTERN S16 SHstGrmInfoShow ARGS((Ent *entId));
1592 EXTERN S16 SFillEntIds ARGS((Void));
1593 EXTERN S16 SGetEntInd ARGS((Ent *entId, U8 *fileName));
1594 #endif /* SS_HISTOGRAM_SUPPORT */
1595 /* ssi_x_001.main_68  Multiple declaration removed , one already in cm_task.x */
1596 /* ssi_x_001.main_61: Lock support guraded under the flag */
1597 #ifdef SS_LOCK_SUPPORT
1598 EXTERN S16 SLockNew ARGS((SLockInfo *LockId, U8 lockType));
1599 EXTERN S16 SInitLockNew ARGS((SLockInfo *LockId, U8 lockType));
1600 EXTERN S16 SUnlockNew ARGS((SLockInfo *LockId, U8 lockType));
1601 EXTERN S16 SDestroyLockNew ARGS((SLockInfo *LockId, U8 lockType));
1602 #endif /* SS_LOCK_SUPPORT */
1603 EXTERN S8* SGetConfigPath ARGS((Void));
1604
1605 /* ssi_x_001.main_66 : Added new Buffer manegement APIs */
1606 EXTERN S16 SCpyPartMsg ARGS((Buffer *srcBuf, MsgLen idx, MsgLen cnt, Buffer *dstBuf));
1607 EXTERN S16 SRepPartMsg ARGS((Buffer *srcBuf, MsgLen idx, MsgLen cnt, Buffer *dstBuf));
1608 EXTERN S16 SMovPartMsg ARGS((Buffer *srcBuf, MsgLen idx, Buffer *dstBuf));
1609 EXTERN S16 SPkMsgMult ARGS((Data *src, MsgLen cnt, Buffer *mBuf));
1610 EXTERN S16 SGetReadPtr ARGS((Buffer *mBuf, U8** data, MsgLen *len));
1611
1612 typedef enum
1613 {
1614    SS_SHARABLE_MEMORY,
1615    SS_NON_SHARABLE_MEMORY
1616 }ssMemoryType;
1617 #ifdef TENB_T2K3K_SPECIFIC_CHANGES                              
1618 EXTERN S16 SReInitTmr ARGS((Void ));                            
1619 #endif
1620 /* ssi_x_001.main_69: Added MSPD debug macro */
1621 #ifdef MSPD
1622 extern U32 ysGT;
1623 extern char ys_global_printbuf[256];
1624 EXTERN Void rbCallstackShow ARGS((Void));
1625 EXTERN Void rbCallstackShowForCore ARGS((U32 coreId));
1626 EXTERN U32 MacGetTick ARGS ((void));
1627 #endif /* MSPD */
1628 #ifdef LTE_L2_MEAS
1629 extern U64  glblTtiCnt;
1630 #endif
1631
1632 EXTERN S16 SStartTask ARGS((VOLATILE U32 *startTime, U32 tarkId));
1633 EXTERN S16 SStopTask ARGS((VOLATILE U32 startTime,U32 taskId));
1634 #ifdef MSPD_MLOG_NEW
1635 /* Removed for C++ Compilation
1636 EXTERN unsigned int MLogTask (unsigned int taskid, unsigned int resourceid , 
1637                        unsigned int ticksstart,unsigned int ticksstop);
1638 --*/
1639 #endif
1640
1641 #if defined(MSPD) && defined(MSPD_DBG_ENABLE)
1642 #define MSPD_DBG_RLC(...) 
1643 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
1644 #ifndef ALIGN_64BIT
1645 #define MSPD_DBG(...) do { \
1646    char _local_printbuf[SS_MEMLOG_MAXSTRLEN]; \
1647    int _len1 = snprintf(_local_printbuf, SS_MEMLOG_MAXSTRLEN, "%s():%u @%lu ", __func__, __LINE__, ysGT); \
1648    int _len2 = snprintf(&_local_printbuf[_len1],SS_MEMLOG_MAXSTRLEN - _len1, __VA_ARGS__) + _len1; \
1649    ssMemlog(_local_printbuf, _len2); \
1650 } while (0)
1651 #else
1652 #define MSPD_DBG(...) do { \
1653    char _local_printbuf[SS_MEMLOG_MAXSTRLEN]; \
1654    int _len1 = snprintf(_local_printbuf, SS_MEMLOG_MAXSTRLEN, "%s():%u @%u ", __func__, __LINE__, ysGT); \
1655    int _len2 = snprintf(&_local_printbuf[_len1],SS_MEMLOG_MAXSTRLEN - _len1, __VA_ARGS__) + _len1; \
1656    ssMemlog(_local_printbuf, _len2); \
1657 } while (0)
1658 #endif
1659 #define MSPD_DBG_RAW(...) do { \
1660    char _local_printbuf[SS_MEMLOG_MAXSTRLEN]; \
1661    int _len = snprintf(_local_printbuf,SS_MEMLOG_MAXSTRLEN, __VA_ARGS__); \
1662    ssMemlog(_local_printbuf, _len); \
1663 } while (0)
1664 #ifndef ALIGN_64BIT
1665 #define MSPD_LOG(...) do { \
1666    char _local_printbuf[SS_MEMLOG_MAXSTRLEN]; \
1667    int _len1 = snprintf(_local_printbuf, SS_MEMLOG_MAXSTRLEN,"%s():%u @%lu ", __func__, __LINE__, ysGT); \
1668    int _len2 = snprintf(&_local_printbuf[_len1],SS_MEMLOG_MAXSTRLEN - _len1, __VA_ARGS__) + _len1; \
1669    ssMemlog(_local_printbuf, _len2); \
1670 } while (0)
1671 #else
1672 #define MSPD_LOG(...) do { \
1673    char _local_printbuf[SS_MEMLOG_MAXSTRLEN]; \
1674    int _len1 = snprintf(_local_printbuf, SS_MEMLOG_MAXSTRLEN,"%s():%u @%u ", __func__, __LINE__, ysGT); \
1675    int _len2 = snprintf(&_local_printbuf[_len1],SS_MEMLOG_MAXSTRLEN - _len1, __VA_ARGS__) + _len1; \
1676    ssMemlog(_local_printbuf, _len2); \
1677 } while (0)
1678
1679 #endif
1680 #ifndef ALIGN_64BIT
1681 #define MSPD_ERR(...) do { \
1682    char _local_printbuf[SS_MEMLOG_MAXSTRLEN]; \
1683    int _len1 = snprintf(_local_printbuf, SS_MEMLOG_MAXSTRLEN, "ERROR: %s():%u @%lu ", __func__, __LINE__, ysGT); \
1684    int _len2 = snprintf(&_local_printbuf[_len1],SS_MEMLOG_MAXSTRLEN - _len1, __VA_ARGS__) + _len1; \
1685    ssMemlog(_local_printbuf, _len2); \
1686 } while (0)
1687 #else
1688 #define MSPD_ERR(...) do { \
1689    char _local_printbuf[SS_MEMLOG_MAXSTRLEN]; \
1690    int _len1 = snprintf(_local_printbuf, SS_MEMLOG_MAXSTRLEN, "ERROR: %s():%u @%u ", __func__, __LINE__, ysGT); \
1691    int _len2 = snprintf(&_local_printbuf[_len1],SS_MEMLOG_MAXSTRLEN - _len1, __VA_ARGS__) + _len1; \
1692    ssMemlog(_local_printbuf, _len2); \
1693 } while (0)
1694
1695 #endif
1696
1697 EXTERN Void ssMlogInit(Void);
1698 EXTERN Void ssMlogIncrCounter(Void);
1699 EXTERN Void ssMemlogInit(Void);
1700 EXTERN Void ssMemlog(char *, U32 size);
1701 EXTERN Void ssMemlogWrite(Void);
1702
1703 #endif /* TENB_T2K3K_SPECIFIC_CHANGES */
1704 #endif
1705
1706 #ifdef __cplusplus
1707 }
1708 #endif
1709
1710 EXTERN Void SIncrementTtiCount(Void);
1711 EXTERN Ticks SGetTtiCount(Void);
1712 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
1713 EXTERN Void mtStopHndlr(Void);
1714 #endif
1715
1716 #ifdef TENB_RTLIN_CHANGES
1717 EXTERN Void ysPrntBkTrace(Void);
1718 EXTERN Void ssMlogInit(Void);
1719 EXTERN Void ssMlogIncrCounter(Void);
1720 #endif
1721 #ifdef SS_THR_REG_MAP
1722 EXTERN Void ssRegMainThread(Void);
1723 #endif
1724
1725 #ifdef T2K_MEM_LEAK_DBG
1726 #define ssGetDBufOfSize(region,size,dBuf) ssGetDBufOfSizeNew(region,size,dBuf,__FILE__,__LINE__)
1727 PUBLIC S16 ssGetDBufOfSizeNew ARGS((Region region, Size size, Buffer **dBuf,char*,U32));
1728 #else
1729 EXTERN  S16 ssGetDBufOfSize(Region region,Size size,Buffer **dBuf);
1730 #endif
1731
1732 /* ssi_x_001.main_69: Added MSPD debug macro */
1733 #ifdef MSPD
1734 EXTERN void SEND_DBG_MSG(U8 *str, ...);
1735 #endif
1736
1737 #endif /* __SSIX__ */
1738
1739 \f
1740 /********************************************************************30**
1741   
1742          End of file
1743 **********************************************************************/