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: Radisys Logging Framework
23 Desc: This file contains logging framework implementation.
26 *********************************************************************21*/
27 /**********************************************************************
28 @ description: This source file has SOC specific functions required for
30 ************************************************************************/
34 #include "rl_interface.h"
36 #include "rl_platform.h"
53 //////////////////////////////////////////////////////////////////////////
54 // @Function : rlInitL2Log
55 // @Description : This will be trigigered from cl init function to
56 // allocate buffer from shared memory and to intialize
60 //////////////////////////////////////////////////////////////////////////
62 PUBLIC void rlInitL2SocSpecific(void)
64 #ifndef RLOG_ENABLE_TEXT_LOGGING
66 if (SGetStaticBuffer(0, /* region - value does not matter in this case */
67 0, /* pool - value does not matter in this case */
69 L2LOG_BUFF_BLOCK_SIZE, /* Buffer size to be allocated */
70 0) != ROK) /* Memory type is SS_SHARABLE_MEMORY */
72 printf("Memory allocation failed for g_l2rlogBuf!!!\n");
75 memset(g_l2rlogBuf, 0, L2LOG_BUFF_SIZE);
77 g_l2LogBufBasePtr = g_l2rlogBuf;
78 g_l2LogBufStartPtr = g_l2rlogBuf + sizeof(g_l2LogBufLen);
84 //////////////////////////////////////////////////////////////////////////
85 // @Function : processL2LogBuff
86 // @Description : This function will get triggered after every 10 tti
87 // and this will reset log buffers for L2 and also sends log
88 // buffer to L3 which was collected
91 //////////////////////////////////////////////////////////////////////////
93 PUBLIC void processL2LogBuff(void)
95 #ifndef RLOG_ENABLE_TEXT_LOGGING
100 /* Log buffer position in flat buffer. If position is last wrap to first buffer */
101 if (g_l2logBuffPos++ >=4)
106 g_writeCirBuf = 1; /* This will avoid contention while switching log buffers */
108 l2rlogBuf_post = g_l2LogBufBasePtr; /* copy logBufferPointer for later use */
109 /* Set L2 Log Buffer length in first 4 bytes of flat buffer */
110 *((U32*) g_l2LogBufBasePtr) = g_l2LogBufLen; /* Set L2 Log Buffer length in
111 first 4 bytes of flat buffer */
113 /* Re-setting pointer so that L2 will use this to write logs */
114 g_l2LogBufBasePtr = g_l2rlogBuf + (g_l2logBuffPos * L2LOG_BUFF_BLOCK_SIZE) ;
115 g_l2LogBufStartPtr = g_l2LogBufBasePtr + sizeof(g_l2LogBufLen);
119 g_writeCirBuf = 0; /* This will avoid contention while switching log buffers */
126 //////////////////////////////////////////////////////////////////////////
127 // @Function : rlGetL2LogBufPtr
128 // @Description : This function reads LogBufPointer and Length of log Buffer
129 // and stores pointer and length variable so that these
130 // values can be used while reading L2 Log Buffer
131 // @in : mBuf - Log Buffer
132 // @out : logLen - Length of log Buffer
133 // logPtr - Address of log Buffer
134 //////////////////////////////////////////////////////////////////////////
136 PUBLIC void rlGetL2LogBufPtr
143 /* Get Buffer pointer and length */
144 *logPtr = ((Data *)mBuf) + sizeof(logLen);
145 *logLen = *((U32 *) mBuf);
148 //////////////////////////////////////////////////////////////////////////
149 // @Function : rlInvalidateL2LogsInCache
150 // @Description : Dummy function which is not used for this SOC.
152 // @in : ptr - starting address to be invalidated.
153 // len - Length to be invalidated.
155 //////////////////////////////////////////////////////////////////////////
157 PUBLIC void rlInvalidateL2LogsInCache
166 /**********************************************************************
168 ***********************************************************************/