解决平台log存储在rodata问题
This commit is contained in:
parent
44f3da726b
commit
4b86608e44
@ -15,7 +15,54 @@
|
|||||||
#ifndef __SPU_LOG_H__
|
#ifndef __SPU_LOG_H__
|
||||||
#define __SPU_LOG_H__
|
#define __SPU_LOG_H__
|
||||||
|
|
||||||
|
#include "typedef.h"
|
||||||
|
#include "ucp_port.h"
|
||||||
|
#include "ucp_utility.h"
|
||||||
|
#include "ucp_tick.h"
|
||||||
|
#include "ucp_printf.h"
|
||||||
|
#include "log_client.h"
|
||||||
|
#include "spu_hw_queue.h"
|
||||||
|
#include "spu_sw_queue.h"
|
||||||
#define SPU_LOG_TEST_FLAG
|
#define SPU_LOG_TEST_FLAG
|
||||||
|
#define __LOG __attribute__((section(".LOG")))
|
||||||
|
extern uint8_t gu8osp_print_level;
|
||||||
|
#define STSW_MSG_INFO_SET(stsw_msg_info, str_len, core_id)\
|
||||||
|
do{\
|
||||||
|
stsw_msg_info.u8Head[0] = SPU_SW_MSG_INFO_HEAD1;\
|
||||||
|
stsw_msg_info.u8Head[1] = SPU_SW_MSG_INFO_HEAD2;\
|
||||||
|
stsw_msg_info.u16DataLen = str_len;\
|
||||||
|
stsw_msg_info.u8PktType = PKT_TYPE_PLATFORM_LOG;\
|
||||||
|
stsw_msg_info.u8CoreId = core_id;\
|
||||||
|
stsw_msg_info.u16Tail = 0;}while(0)
|
||||||
|
#define SPU_VPRINTF_LOG(level,fmt, args...) do{__LOG static char tmp[] = fmt; \
|
||||||
|
int32_t i32core_id = get_core_id();\
|
||||||
|
int32_t i32ret = 0;\
|
||||||
|
uint32_t u32str_len = 0;\
|
||||||
|
uint16_t u16_index = 0;\
|
||||||
|
uint8_t u8offset = SPU_SW_MSG_INFO_SIZE;\
|
||||||
|
uint8_t *pu8_addr = NULL;\
|
||||||
|
static int8_t i8str[128];\
|
||||||
|
if (level > gu8osp_print_level)\
|
||||||
|
{\
|
||||||
|
break;\
|
||||||
|
}\
|
||||||
|
u32str_len = strlen(fmt);\
|
||||||
|
memcpy_ucp((char *)i8str, (char *)tmp, u32str_len);\
|
||||||
|
__ucps2_synch(0);\
|
||||||
|
pu8_addr = spu_log_client_mem_alloc(&u16_index);\
|
||||||
|
memset(((char *)pu8_addr), 0, SPU_LOG_CLIENT_BUF_SIZE);\
|
||||||
|
u32str_len = spu_vsprint_log(((char *)(pu8_addr+u8offset)), (char *)i8str, ##args);\
|
||||||
|
spu_sw_msg_info_t stsw_msg_info;\
|
||||||
|
STSW_MSG_INFO_SET(stsw_msg_info, u32str_len, i32core_id);\
|
||||||
|
memcpy_ucp((char *)pu8_addr, (void *)&stsw_msg_info, u8offset);\
|
||||||
|
__ucps2_synch(0);\
|
||||||
|
SpuLogMsgInfo_t stlog_msg_info;\
|
||||||
|
stlog_msg_info.cell_id = 0;\
|
||||||
|
stlog_msg_info.core_id = i32core_id;\
|
||||||
|
stlog_msg_info.buf_idx = u16_index;\
|
||||||
|
stlog_msg_info.buf_size = (u32str_len + u8offset);\
|
||||||
|
i32ret=ecs_hw_que_send(ECS_RFM_SPU1_HW_QUEUE, stlog_msg_info.value);\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
typedef enum SPU_LOG_LEVEL
|
typedef enum SPU_LOG_LEVEL
|
||||||
{
|
{
|
||||||
@ -43,6 +90,7 @@ void spu_log_init(uint8_t level);
|
|||||||
void spu_log_output(uint8_t level, const char *fmt, ...);
|
void spu_log_output(uint8_t level, const char *fmt, ...);
|
||||||
uint8_t spu_log_level_set(spu_log_level_e emlog_level);
|
uint8_t spu_log_level_set(spu_log_level_e emlog_level);
|
||||||
uint8_t spu_log_level_get(void);
|
uint8_t spu_log_level_get(void);
|
||||||
|
uint32_t spu_vsprint_log(char *dst, const char *fmt, ...);
|
||||||
|
|
||||||
#ifdef PCIE_BACKHAUL
|
#ifdef PCIE_BACKHAUL
|
||||||
void com_debug_log(const char *fmt, ...);
|
void com_debug_log(const char *fmt, ...);
|
||||||
|
@ -2,18 +2,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "spu_log.h"
|
#include "spu_log.h"
|
||||||
#include "ucp_port.h"
|
|
||||||
#include "ucp_utility.h"
|
|
||||||
#include "ucp_tick.h"
|
|
||||||
#include "ucp_printf.h"
|
|
||||||
#include "log_client.h"
|
|
||||||
#include "spu_log.h"
|
|
||||||
#include "spu_hw_queue.h"
|
|
||||||
#include "spu_sw_queue.h"
|
|
||||||
#include "spu_shell.h"
|
#include "spu_shell.h"
|
||||||
|
|
||||||
#define SPU_LOG_INNER_MAX_SIZE (64)
|
#define SPU_LOG_INNER_MAX_SIZE (64)
|
||||||
#define __LOG __attribute__((section(".LOG")))
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* 对内接口 */
|
/* 对内接口 */
|
||||||
@ -75,6 +67,15 @@ uint8_t spu_log_level_get(void)
|
|||||||
return gu8osp_print_level;
|
return gu8osp_print_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t spu_vsprint_log(char *dst, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
uint32_t u32str_len = 0;
|
||||||
|
va_list st_va_list;
|
||||||
|
va_start(st_va_list, fmt);
|
||||||
|
u32str_len = vsprintf(dst, fmt, st_va_list);
|
||||||
|
va_end(st_va_list);
|
||||||
|
return u32str_len;
|
||||||
|
}
|
||||||
/* 平台打印输出函数 */
|
/* 平台打印输出函数 */
|
||||||
void spu_log_output(uint8_t level, const char *fmt, ...)
|
void spu_log_output(uint8_t level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
@ -332,7 +333,7 @@ char tmp_buf[LOGBUFSIZE] = {0};
|
|||||||
void com_debug_log(const char *fmt, ...)
|
void com_debug_log(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
PcieEpMemBarStruct_t* pUcpMemBar = (PcieEpMemBarStruct_t *)0x08740000;//pMemSection->baseAddr;
|
PcieEpMemBarStruct_t* pUcpMemBar = (PcieEpMemBarStruct_t *)0x08740000;//pMemSection->baseAddr;
|
||||||
uint32_t core_id = get_core_id();
|
//uint32_t core_id = get_core_id();
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
|
@ -34,35 +34,35 @@
|
|||||||
|
|
||||||
#if (UCP_PRINT_LEVEL & PRINT_ERROR)
|
#if (UCP_PRINT_LEVEL & PRINT_ERROR)
|
||||||
//#define UCP_PRINT_ERROR(fmt, args...) printf(__FILE__ ": [ERROR]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
//#define UCP_PRINT_ERROR(fmt, args...) printf(__FILE__ ": [ERROR]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
||||||
#define UCP_PRINT_ERROR(fmt, args...) spu_log_output(LOG_ERROR, "[ERROR]:" fmt "\n", ##args)
|
#define UCP_PRINT_ERROR(fmt, args...) SPU_VPRINTF_LOG(LOG_ERROR, "[ERROR]:" fmt "\n", ##args)
|
||||||
#else
|
#else
|
||||||
#define UCP_PRINT_ERROR(fmt, args...)
|
#define UCP_PRINT_ERROR(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (UCP_PRINT_LEVEL & PRINT_WARN)
|
#if (UCP_PRINT_LEVEL & PRINT_WARN)
|
||||||
//#define UCP_PRINT_WARN(fmt, args...) printf(__FILE__ ": [WARN]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
//#define UCP_PRINT_WARN(fmt, args...) printf(__FILE__ ": [WARN]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
||||||
#define UCP_PRINT_WARN(fmt, args...) spu_log_output(LOG_WARN, "[WARN]:" fmt "\n", ##args)
|
#define UCP_PRINT_WARN(fmt, args...) SPU_VPRINTF_LOG(LOG_WARN, "[WARN]:" fmt "\n", ##args)
|
||||||
#else
|
#else
|
||||||
#define UCP_PRINT_WARN(fmt, args...)
|
#define UCP_PRINT_WARN(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (UCP_PRINT_LEVEL & PRINT_LOG)
|
#if (UCP_PRINT_LEVEL & PRINT_LOG)
|
||||||
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
||||||
#define UCP_PRINT_LOG(fmt, args...) spu_log_output(LOG_INFO, "[LOG]:" fmt "\n", ##args)
|
#define UCP_PRINT_LOG(fmt, args...) SPU_VPRINTF_LOG(LOG_INFO, "[LOG]:" fmt "\n", ##args)
|
||||||
#else
|
#else
|
||||||
#define UCP_PRINT_LOG(fmt, args...)
|
#define UCP_PRINT_LOG(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (UCP_PRINT_LEVEL & PRINT_DEBUG)
|
#if (UCP_PRINT_LEVEL & PRINT_DEBUG)
|
||||||
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
||||||
#define UCP_PRINT_DEBUG(fmt, args...) spu_log_output(LOG_DEBUG, "[DEBUG]:" fmt "\n", ##args)
|
#define UCP_PRINT_DEBUG(fmt, args...) SPU_VPRINTF_LOG(LOG_DEBUG, "[DEBUG]:" fmt "\n", ##args)
|
||||||
#else
|
#else
|
||||||
#define UCP_PRINT_DEBUG(fmt, args...)
|
#define UCP_PRINT_DEBUG(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (UCP_PRINT_LEVEL & PRINT_TICK)
|
#if (UCP_PRINT_LEVEL & PRINT_TICK)
|
||||||
//#define UCP_PRINT_TICK(fmt, args...) printf(__FILE__ ": [TICK]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
//#define UCP_PRINT_TICK(fmt, args...) printf(__FILE__ ": [TICK]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
||||||
#define UCP_PRINT_TICK(fmt, args...) spu_log_output(LOG_TICK, "[TICK]:" fmt "\n", ##args)
|
#define UCP_PRINT_TICK(fmt, args...) SPU_VPRINTF_LOG(LOG_TICK, "[TICK]:" fmt "\n", ##args)
|
||||||
#else
|
#else
|
||||||
#define UCP_PRINT_TICK(fmt, args...)
|
#define UCP_PRINT_TICK(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user