Initial commit
[o-du/l2.git] / src / rlog / rl_rlog.h
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:     Radisys Logging Framework
22      Type:     C include file
23      Desc:     This file contains logging framework include file for library.
24      File:     rl.h
25
26 *********************************************************************21*/
27 /****************************************************************************
28 @ description: This is header file is used by logging framework module. This
29 file should not be included by any other application. This is internal
30 header file logging framework.
31 *****************************************************************************/
32
33 #ifndef __RL_H__
34 #define __RL_H__
35
36 #include <stdio.h>
37 #include <time.h>
38 #include <ctype.h>
39 #include <sys/types.h>
40 #include <stdlib.h>
41 #include <signal.h>
42 #include <errno.h>
43 #include "rl_common.h"
44
45 #define MAX_FILE_SIZE                   3145728 /* 3MB */
46 #define MAX_LOG_LEN                             256
47 #define MAX_FILENAME_LEN                300
48 #define LOG_TIME_LEN                    64
49 #define MAX_LOG_BUF_SIZE                5000
50 #define RLOG_MAX_CIRBUF_SIZE                    (1024*100)
51 #define RLOG_REMOTE_LOGGING_PORT                9099
52 #define RLOG_MAX_FILES                                  5
53 #define RLOG_MAX_TIME_STAMP                     80
54 #define RLOG_MAX_TAX_NAME                               16
55 #define RLOG_FIFO_FILE                                  "/tmp/l2logs"
56 #define RLOG_CIRBUF_READ_INTERVAL       1       /* 60 seconds read interval */
57 #define RLOG_MAX_THREADS                                16
58 #define RLOG_TIME_ZONE_LEN                              8
59 #define RLOG_MAX_STACK_DEPTH            24
60 #define RLOG_MAX_BACKTRACE_BUFSZ        2048
61 #define RLOG_READ_POS_THRESHOLD 300
62 #define RLOG_FIXED_LENGTH_BUFFER_SIZE 50
63 #define RLOGTICKSCNTTOPRCL2LOGS 10
64
65 /* Console handling */
66 #define RLOG_CTRL_L    12
67 #define RLOG_CTRL_Y    25
68 #define RLOG_ENTER_KEY 10
69 #define RLOG_SET_LOGLEVEL  1
70 #define RLOG_SET_MODMASK   2
71
72 /*L2 Logging */
73 #define PROCESS_L2LOG_TTI 10
74
75 typedef enum {
76 LOG_ARG_INT,
77 LOG_ARG_STR,
78 LOG_ARG_HEX,
79 LOG_ARG_SPL
80 } LOG_ARG_TYPE;
81
82 typedef enum rlLogCntLmt
83 {
84    RL_LOG_COUNT_LIMIT_START = 1,
85    RL_LOG_COUNT_LIMIT_STOP
86 }RLLogCntLmt;
87
88 typedef struct {
89         
90         char    szTaskName[RLOG_MAX_TAX_NAME];
91         U8*     logBuff;                /* LOG Buffer */
92         U32     logBufLen;  /* Data Written till now */
93         U32     logReadPos; /* Reader thread position */
94         U8      listIndex;      /* Index to global list */
95
96 } THREAD_DATA;
97
98 extern void readL2LogBuff(void);
99 extern void processL2LogBuff(void);
100 extern S16  sendL2LogBuftoL3(void);
101 extern void rlInitL2Log(void);
102 /* Extern for soc specific file */
103 extern void rlProcessLogBufFromL2(void *mBuf);
104 extern void rlInitL2SocSpecific(void);
105 //extern void processL2LogBuff(void);
106 extern void rlProcessTicks(void);
107 extern void rlGetL2LogBufPtr (void *mBuf, U32 *logLen,U8 **logPtr);
108 extern void rlInvalidateL2LogsInCache(U8 *ptr,U32 len);
109
110 extern U8     *g_l2rlogBuf;        /* buffer pointer for shared memory allocation */
111 extern U8     *g_l2LogBufStartPtr; /* buffer pointer where logs has to be written */
112 extern U8     *g_l2LogBufBasePtr;  /* Base pointer for log buffer */
113 extern U8     *g_logBufRcvdFromL2; /* Buffer pointer received from L2 at L3*/
114 extern U8     *g_l2LogBaseBuff;    /* Base log buffer received at L3 */
115 extern U32     g_l2LogBufLen;      /* Log Buffer length written at L2 */
116 extern U32     startL2Logging;     /* flag to start processing of L2 logs */
117 extern U32     g_l2logBuffPos;     /* Log Buffer block which is in use for L2 logging */
118 extern U8      g_writeCirBuf;      /* Flag to indicate whether to write logs or not */
119 //extern Pst    g_rlog_pst;
120
121 #endif /* __RL_H__*/