feat:新建项目文件
BLV主机C1P模块
This commit is contained in:
866
MCU_Driver/log_api.c
Normal file
866
MCU_Driver/log_api.c
Normal file
@@ -0,0 +1,866 @@
|
||||
/***********************************<2A><><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD>ݴ洢<DDB4><E6B4A2><EFBFBD><EFBFBD> - <20>ṩ<EFBFBD><E1B9A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><C3BA><EFBFBD>***************************************/
|
||||
#include "rw_logging.h"
|
||||
#include "SPI_SRAM.h"
|
||||
#include "Log_api.h"
|
||||
#include "string.h"
|
||||
#include "spi_flash.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
uint32_t SYS_Log_Switch = (LogType_Launcher_SWITCH << LogType_Launcher_bit) + \
|
||||
(LogType_SYS_Record_SWITCH << LogType_SYS_Record_bit) + \
|
||||
(LogType_Device_COMM_SWITCH << LogType_Device_COMM_bit) + \
|
||||
(LogType_Device_Online_SWITCH << LogType_Device_Online_bit) + \
|
||||
(LogType_Global_Parameters_SWITCH << LogType_Global_Parameters_bit) + \
|
||||
(LogType_Net_COMM_SWITCH << LogType_Net_COMM_bit) + \
|
||||
(LogType_Logic_Record_SWITCH << LogType_Logic_Record_bit);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Launcher_APP_Check_Record
|
||||
* Description : Launcher<65><72><EFBFBD><EFBFBD> - У<><D0A3>APP
|
||||
* Input :
|
||||
state :״̬
|
||||
0x00:<3A><>ͬ
|
||||
0x01:<3A><>ͬ
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Launcher_APP_Check_Record(uint8_t state)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Launcher_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[3] = {0};
|
||||
|
||||
temp_buff[0] = LLauncher_App_Check;
|
||||
temp_buff[1] = state;
|
||||
|
||||
Log_write_sram(LogType_Launcher,temp_buff,2);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Launcher_APP_Check_Record
|
||||
* Description : Launcher<65><72><EFBFBD><EFBFBD> - У<><D0A3>APP
|
||||
* Input :
|
||||
state :״̬
|
||||
0x00:<3A>ɹ<EFBFBD>
|
||||
0x01:ʧ<><CAA7>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Launcher_Read_App_Record(uint8_t state)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Launcher_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[3] = {0};
|
||||
|
||||
temp_buff[0] = LLauncher_Read_App;
|
||||
temp_buff[1] = state;
|
||||
|
||||
Log_write_sram(LogType_Launcher,temp_buff,2);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Launcher_Write_Flash_Record
|
||||
* Description : Launcher<65><72><EFBFBD><EFBFBD> - Flashд<68><D0B4>
|
||||
* Input :
|
||||
addr :д<><D0B4><EFBFBD><EFBFBD>ַ
|
||||
len :д<>볤<EFBFBD><EBB3A4>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Launcher_Write_Flash_Record(uint32_t addr,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Launcher_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[7] = {0};
|
||||
|
||||
temp_buff[0] = LLauncher_Write_Flash;
|
||||
temp_buff[1] = addr & 0xFF;
|
||||
temp_buff[2] = (addr >> 8) & 0xFF;
|
||||
temp_buff[3] = (addr >> 16) & 0xFF;
|
||||
temp_buff[4] = (addr >> 24) & 0xFF;
|
||||
temp_buff[5] = len & 0xFF;
|
||||
temp_buff[6] = (len >> 8) & 0xFF;
|
||||
|
||||
Log_write_sram(LogType_Launcher,temp_buff,7);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Launcher_Factory_Reset_Record
|
||||
* Description : Launcher<65><72><EFBFBD><EFBFBD> - <20>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input :
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Launcher_Factory_Reset_Record(void)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Launcher_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[3] = {0};
|
||||
|
||||
temp_buff[0] = LLauncher_Factory_Reset;
|
||||
temp_buff[1] = 0x00;
|
||||
|
||||
Log_write_sram(LogType_Launcher,temp_buff,2);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_PHY_Change_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - PHY״̬<D7B4><CCAC>¼
|
||||
* Input :
|
||||
state :״̬
|
||||
0x00:<3A>γ<EFBFBD>
|
||||
0x01:<3A><><EFBFBD><EFBFBD>
|
||||
0x02:TCP<43><50>ʱ
|
||||
0x03:TCP<43>Ͽ<EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_PHY_Change_Record(uint8_t state)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[3] = {0};
|
||||
|
||||
temp_buff[0] = LSYS_PHY_Change;
|
||||
temp_buff[1] = state;
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,temp_buff,2);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_DevInfo_Error_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
* Input :
|
||||
dev :<3A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
addr :<3A>豸<EFBFBD><E8B1B8>ַ
|
||||
info_addr :<3A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>洢<EFBFBD><E6B4A2>ַ
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_DevInfo_Error_Record(uint8_t dev,uint8_t addr,uint32_t info_addr)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[8] = {0};
|
||||
|
||||
temp_buff[0] = LSYS_DevInfo_Error;
|
||||
temp_buff[1] = dev;
|
||||
temp_buff[2] = addr;
|
||||
temp_buff[3] = info_addr & 0xFF;
|
||||
temp_buff[4] = (info_addr >> 8) & 0xFF;
|
||||
temp_buff[5] = (info_addr >> 16) & 0xFF;
|
||||
temp_buff[6] = (info_addr >> 24) & 0xFF;
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,temp_buff,7);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_API_State_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - API״̬<D7B4><CCAC>¼
|
||||
* Input :
|
||||
API_way :<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
0x01:<3A><><EFBFBD><EFBFBD>
|
||||
0x02:<3A><><EFBFBD><EFBFBD>
|
||||
state :״̬
|
||||
0x01:д<><D0B4><EFBFBD>ɹ<EFBFBD>
|
||||
0x02:д<><D0B4>ʧ<EFBFBD><CAA7>
|
||||
0x03:<3A>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
0x04:MD5У<35><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
0x05:CRCУ<43><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
0x06:<3A><>תLauncher
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_API_State_Record(uint8_t API_way,uint8_t state)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[8] = {0};
|
||||
uint8_t temp_len = 0;
|
||||
|
||||
temp_buff[temp_len++] = LSYS_API_State;
|
||||
temp_buff[temp_len++] = API_way;
|
||||
temp_buff[temp_len++] = state;
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_NET_Argc_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
* Input :
|
||||
IP :<3A><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>IP<49><50>ַ - 4Byte
|
||||
MAC :<3A><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>MAC<41><43>ַ - 4Byte
|
||||
DNS_IP1 :DNS<4E><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP1 - <20>ƶ˷<C6B6><CBB7><EFBFBD><EFBFBD><EFBFBD> - 4Byte
|
||||
DNS_IP2 :DNS<4E><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP2 - TFTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 4Byte
|
||||
DNS_IP3 :DNS<4E><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP3 - MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 4Byte
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_NET_Argc_Record(uint8_t *IP,uint8_t *MAC,uint8_t *DNS_IP1,uint8_t *DNS_IP2,uint8_t *DNS_IP3)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[40] = {0};
|
||||
uint8_t temp_len = 0;
|
||||
|
||||
temp_buff[temp_len++] = LSYS_NET_ARGC;
|
||||
temp_buff[temp_len++] = IP[0];
|
||||
temp_buff[temp_len++] = IP[1];
|
||||
temp_buff[temp_len++] = IP[2];
|
||||
temp_buff[temp_len++] = IP[3];
|
||||
|
||||
temp_buff[temp_len++] = MAC[0];
|
||||
temp_buff[temp_len++] = MAC[1];
|
||||
temp_buff[temp_len++] = MAC[2];
|
||||
temp_buff[temp_len++] = MAC[3];
|
||||
temp_buff[temp_len++] = MAC[4];
|
||||
temp_buff[temp_len++] = MAC[5];
|
||||
|
||||
temp_buff[temp_len++] = DNS_IP1[0];
|
||||
temp_buff[temp_len++] = DNS_IP1[1];
|
||||
temp_buff[temp_len++] = DNS_IP1[2];
|
||||
temp_buff[temp_len++] = DNS_IP1[3];
|
||||
|
||||
temp_buff[temp_len++] = DNS_IP2[0];
|
||||
temp_buff[temp_len++] = DNS_IP2[1];
|
||||
temp_buff[temp_len++] = DNS_IP2[2];
|
||||
temp_buff[temp_len++] = DNS_IP2[3];
|
||||
|
||||
temp_buff[temp_len++] = DNS_IP3[0];
|
||||
temp_buff[temp_len++] = DNS_IP3[1];
|
||||
temp_buff[temp_len++] = DNS_IP3[2];
|
||||
temp_buff[temp_len++] = DNS_IP3[3];
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_MQTT_Argc_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
* Input :
|
||||
productkey :<3A><>Ʒ<EFBFBD><C6B7>Կ - 12Byte
|
||||
devname :<3A>豸<EFBFBD><E8B1B8> - 65Byte
|
||||
devsecret :<3A>豸<EFBFBD><E8B1B8>Կ - 33Byte
|
||||
publish :<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ - 65Byte
|
||||
sublish :<3A><><EFBFBD>ĵ<EFBFBD>ַ - 65Byte
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_MQTT_Argc_Record(uint8_t *productkey,uint8_t *devname,uint8_t *devsecret,uint8_t *publish,uint8_t *sublish)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LSYS_MQTT_ARGC;
|
||||
|
||||
for(uint8_t i=0;i<12;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = productkey[i];
|
||||
}
|
||||
|
||||
for(uint8_t i=0;i<65;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = devname[i];
|
||||
}
|
||||
|
||||
for(uint8_t i=0;i<33;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = devsecret[i];
|
||||
}
|
||||
|
||||
for(uint8_t i=0;i<65;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = publish[i];
|
||||
}
|
||||
|
||||
for(uint8_t i=0;i<65;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = sublish[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_Server_Comm_State_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - <20>ƶ<EFBFBD>ͨѶ״̬<D7B4><CCAC>¼
|
||||
* Input :
|
||||
state :״̬
|
||||
0x00:<3A><><EFBFBD><EFBFBD>
|
||||
0x01:<3A><><EFBFBD><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_Server_Comm_State_Record(uint8_t state)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[8] = {0};
|
||||
uint8_t temp_len = 0;
|
||||
|
||||
temp_buff[temp_len++] = LSYS_Server_Comm_State;
|
||||
temp_buff[temp_len++] = state;
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_NET_Argc_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
* Input :
|
||||
IP :Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ - 4Byte
|
||||
Gateway :Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ַ - 4Byte
|
||||
IP_Mask :Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 4Byte
|
||||
DNS_Add :DNS<4E><53>ַ - 4Byte
|
||||
ArgcFlag :<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ - 1Byte
|
||||
DHCPFlag :DHCPʹ<50>ܱ<EFBFBD>־ - 1Byte
|
||||
ServerFlag :<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ - 1Byte
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_NET_Argc_Init_Record(uint8_t *IP,uint8_t *Gateway,uint8_t *IP_Mask,uint8_t *DNS_Add,uint8_t ArgcFlag,uint8_t DHCPFlag,uint8_t ServerFlag)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[40] = {0};
|
||||
uint8_t temp_len = 0;
|
||||
|
||||
temp_buff[temp_len++] = LSYS_NET_DefaultARGC;
|
||||
temp_buff[temp_len++] = IP[0];
|
||||
temp_buff[temp_len++] = IP[1];
|
||||
temp_buff[temp_len++] = IP[2];
|
||||
temp_buff[temp_len++] = IP[3];
|
||||
|
||||
temp_buff[temp_len++] = Gateway[0];
|
||||
temp_buff[temp_len++] = Gateway[1];
|
||||
temp_buff[temp_len++] = Gateway[2];
|
||||
temp_buff[temp_len++] = Gateway[3];
|
||||
|
||||
temp_buff[temp_len++] = IP_Mask[0];
|
||||
temp_buff[temp_len++] = IP_Mask[1];
|
||||
temp_buff[temp_len++] = IP_Mask[2];
|
||||
temp_buff[temp_len++] = IP_Mask[3];
|
||||
|
||||
temp_buff[temp_len++] = DNS_Add[0];
|
||||
temp_buff[temp_len++] = DNS_Add[1];
|
||||
temp_buff[temp_len++] = DNS_Add[2];
|
||||
temp_buff[temp_len++] = DNS_Add[3];
|
||||
|
||||
temp_buff[temp_len++] = ArgcFlag;
|
||||
temp_buff[temp_len++] = DHCPFlag;
|
||||
temp_buff[temp_len++] = ServerFlag;
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_SYS_NET_Argc_Record
|
||||
* Description : SYS_Record<72><64><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
* Input :
|
||||
state<74><65>״̬
|
||||
0x01<30><31><EFBFBD>㰴
|
||||
0x02<30><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
0x03<30><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿ<EFBFBD>
|
||||
0x04<30><34><EFBFBD>ﵽ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_SYS_RCUKey_State_Record(uint8_t state)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_SYS_Record_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[5] = {0};
|
||||
uint8_t temp_len = 0;
|
||||
|
||||
temp_buff[temp_len++] = LSYS_RCUKey_State;
|
||||
temp_buff[temp_len++] = state;
|
||||
|
||||
Log_write_sram(LogType_SYS_Record,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Device_COMM_ASK_TO_Reply_Record
|
||||
* Description : Device_COMM<4D><4D><EFBFBD><EFBFBD> - RCU<43><55>ѯ<EFBFBD>ظ<EFBFBD><D8B8>仯<EFBFBD><E4BBAF><EFBFBD>ݼ<EFBFBD>¼
|
||||
* Input :
|
||||
port :<3A>˿ں<CBBF>
|
||||
baud :ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
data_tick :ѯ<><D1AF>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
buff :<3A><><EFBFBD><EFBFBD>
|
||||
len :<3A><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_ASK_TO_Reply_Record(uint8_t port,uint32_t baud,uint32_t data_tick,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LCOMM_ASK_TO_Reply;
|
||||
Temp_Flash_Buff[temp_len++] = port;
|
||||
Temp_Flash_Buff[temp_len++] = baud & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 8) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 16) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 24) & 0xFF;
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_ASK_TO_Reply_Record2(uint32_t port_addr,uint32_t baud_addr,uint32_t data_tick,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LCOMM_ASK_TO_Reply;
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(port_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 1);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 2);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 3);
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Device_COMM_Send_Control_Record
|
||||
* Description : Device_COMM<4D><4D><EFBFBD><EFBFBD> - RCU<43>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>¼
|
||||
* Input :
|
||||
port :<3A>˿ں<CBBF>
|
||||
baud :ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
buff :<3A><><EFBFBD><EFBFBD>
|
||||
len :<3A><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_Send_Control_Record(uint8_t port,uint32_t baud,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LCOMM_Send_Control;
|
||||
Temp_Flash_Buff[temp_len++] = port;
|
||||
Temp_Flash_Buff[temp_len++] = baud & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 8) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 16) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 24) & 0xFF;
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_Send_Control_Record2(uint32_t port_addr,uint32_t baud_addr,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LCOMM_Send_Control;
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(port_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 1);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 2);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 3);
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Device_COMM_Control_Reply_Record
|
||||
* Description : Device_COMM<4D><4D><EFBFBD><EFBFBD> - RCY<43><59><EFBFBD>ƻظ<C6BB><D8B8><EFBFBD><EFBFBD>ݼ<EFBFBD>¼
|
||||
* Input :
|
||||
port :<3A>˿ں<CBBF>
|
||||
baud :ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
buff :<3A><><EFBFBD><EFBFBD>
|
||||
len :<3A><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_Control_Reply_Record(uint8_t port,uint32_t baud,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LCOMM_Control_Reply;
|
||||
Temp_Flash_Buff[temp_len++] = port;
|
||||
Temp_Flash_Buff[temp_len++] = baud & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 8) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 16) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (baud >> 24) & 0xFF;
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_Control_Reply_Record2(uint32_t port_addr,uint32_t baud_addr,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LCOMM_Control_Reply;
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(port_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 1);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 2);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 3);
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_Control_Reply_Record3(uint32_t port_addr,uint32_t baud_addr,uint32_t buff_addr,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LCOMM_Control_Reply;
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(port_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 1);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 2);
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(baud_addr + 3);
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = SRAM_Read_Byte(buff_addr + i);
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Device_COMM_Adjust_Baud_Record
|
||||
* Description : Device_COMM<4D><4D><EFBFBD><EFBFBD> - <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>
|
||||
* Input :
|
||||
dev_type :<3A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
dev_addr :<3A>豸<EFBFBD><E8B1B8>ַ
|
||||
baud :ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
way :<3A>ı䷽ʽ<E4B7BD><CABD>0x01:<3A><><EFBFBD><EFBFBD>ͨѶʧ<D1B6>ܴﵽ<DCB4><EFB5BD><EFBFBD><EFBFBD>,0x02:ͨѶʧ<D1B6>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD>ﵽ<EFBFBD>ٷֱ<D9B7><D6B1><EFBFBD><EFBFBD><EFBFBD>
|
||||
fail_num :ʧ<>ܴ<EFBFBD><DCB4><EFBFBD>
|
||||
sum :<3A>ܰ<EFBFBD><DCB0><EFBFBD>
|
||||
num :<3A><>ǰͨѶ<CDA8>±<EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_Adjust_Baud_Record(uint8_t dev_type,uint8_t dev_addr,uint32_t baud,uint8_t way,uint8_t fail_num,uint8_t sum,uint8_t num)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[12];
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(temp_buff,0,sizeof(temp_buff));
|
||||
|
||||
temp_buff[temp_len++] = LCOMM_Adjust_Baud;
|
||||
temp_buff[temp_len++] = dev_type;
|
||||
temp_buff[temp_len++] = dev_addr;
|
||||
temp_buff[temp_len++] = baud & 0xFF;
|
||||
temp_buff[temp_len++] = (baud >> 8) & 0xFF;
|
||||
temp_buff[temp_len++] = (baud >> 16) & 0xFF;
|
||||
temp_buff[temp_len++] = (baud >> 24) & 0xFF;
|
||||
temp_buff[temp_len++] = way;
|
||||
temp_buff[temp_len++] = fail_num;
|
||||
temp_buff[temp_len++] = sum;
|
||||
temp_buff[temp_len++] = num;
|
||||
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_COMM_Adjust_Baud_Record2(uint32_t dev_type,uint32_t dev_addr,uint32_t baud_addr)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_COMM_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[8];
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(temp_buff,0,sizeof(temp_buff));
|
||||
|
||||
temp_buff[temp_len++] = LCOMM_Adjust_Baud;
|
||||
temp_buff[temp_len++] = SRAM_Read_Byte(dev_type);
|
||||
temp_buff[temp_len++] = SRAM_Read_Byte(dev_addr);
|
||||
temp_buff[temp_len++] = SRAM_Read_Byte(baud_addr);
|
||||
temp_buff[temp_len++] = SRAM_Read_Byte(baud_addr + 1);
|
||||
temp_buff[temp_len++] = SRAM_Read_Byte(baud_addr + 2);
|
||||
temp_buff[temp_len++] = SRAM_Read_Byte(baud_addr + 3);
|
||||
|
||||
Log_write_sram(LogType_Device_COMM,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Device_Online_Record
|
||||
* Description : Device_Online<6E><65><EFBFBD><EFBFBD> - <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>¼
|
||||
* Input :
|
||||
dev :<3A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
addr :<3A>豸<EFBFBD><E8B1B8>ַ
|
||||
state :<3A>豸״̬ - 0x00<30><30><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>0x01<30><31><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Device_Online_Record(uint8_t dev,uint8_t addr,uint8_t state)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Device_Online_bit )) )
|
||||
{
|
||||
uint8_t temp_buff[6];
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(temp_buff,0,sizeof(temp_buff));
|
||||
|
||||
temp_buff[temp_len++] = dev;
|
||||
temp_buff[temp_len++] = addr;
|
||||
temp_buff[temp_len++] = state;
|
||||
|
||||
Log_write_sram(LogType_Device_Online,temp_buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Global_ParaInfo_Record
|
||||
* Description : Global_Parameters<72><73><EFBFBD><EFBFBD> - ȫ<>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>¼ <20><><EFBFBD><EFBFBD>10<31><30><EFBFBD>Ӽ<EFBFBD>¼
|
||||
* Input :
|
||||
buff :<3A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
len :<3A>豸<EFBFBD><E8B1B8>ַ
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Global_ParaInfo_Record(uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Global_Parameters_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LGlobal_Para;
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Global_Parameters,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_Global_ParaInfo_Record
|
||||
* Description : Global_Parameters<72><73><EFBFBD><EFBFBD> - ȫ<>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>¼ <20><><EFBFBD><EFBFBD>10<31><30><EFBFBD>Ӽ<EFBFBD>¼
|
||||
* Input :
|
||||
buff :<3A>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
len :<3A>豸<EFBFBD><E8B1B8>ַ
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_Global_DevInfo_Record(uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Global_Parameters_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LGlobal_Dev;
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Global_Parameters,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_NET_COMM_Record
|
||||
* Description : Net_COMM<4D><4D><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6>¼
|
||||
* Input :
|
||||
SocketId:<3A><EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1~4)
|
||||
ip :<3A><><EFBFBD>յ<EFBFBD>IP<49><50>ַ
|
||||
port :<3A><><EFBFBD>յ<EFBFBD>Port
|
||||
buff :<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
len :<3A><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_NET_COMM_Send_Record(uint8_t SocketId,uint8_t *ip,uint16_t port,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Net_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LNetComm_Send;
|
||||
Temp_Flash_Buff[temp_len++] = SocketId;
|
||||
Temp_Flash_Buff[temp_len++] = ip[0];
|
||||
Temp_Flash_Buff[temp_len++] = ip[1];
|
||||
Temp_Flash_Buff[temp_len++] = ip[2];
|
||||
Temp_Flash_Buff[temp_len++] = ip[3];
|
||||
Temp_Flash_Buff[temp_len++] = (port) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (port >> 8) & 0xFF;
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Net_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_NET_COMM_Record
|
||||
* Description : Net_COMM<4D><4D><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6>¼
|
||||
* Input :
|
||||
SocketId:<3A><EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1~4)
|
||||
ip :<3A><><EFBFBD>յ<EFBFBD>IP<49><50>ַ
|
||||
port :<3A><><EFBFBD>յ<EFBFBD>Port
|
||||
buff :<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
len :<3A><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_NET_COMM_Recv_Record(uint8_t SocketId,uint8_t *ip,uint16_t port,uint8_t *buff,uint16_t len)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Net_COMM_bit )) )
|
||||
{
|
||||
uint16_t buff_len = len ;
|
||||
if(buff_len >= 512) buff_len = 512; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>512Byte
|
||||
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LNetComm_Recv;
|
||||
Temp_Flash_Buff[temp_len++] = SocketId;
|
||||
Temp_Flash_Buff[temp_len++] = ip[0];
|
||||
Temp_Flash_Buff[temp_len++] = ip[1];
|
||||
Temp_Flash_Buff[temp_len++] = ip[2];
|
||||
Temp_Flash_Buff[temp_len++] = ip[3];
|
||||
Temp_Flash_Buff[temp_len++] = (port) & 0xFF;
|
||||
Temp_Flash_Buff[temp_len++] = (port >> 8) & 0xFF;
|
||||
|
||||
for(uint16_t i=0;i<buff_len;i++)
|
||||
{
|
||||
Temp_Flash_Buff[temp_len++] = buff[i];
|
||||
}
|
||||
|
||||
Log_write_sram(LogType_Net_COMM,Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LOG_LogicInfo_DebugRecord
|
||||
* Description : Logic_Rec<65><63><EFBFBD><EFBFBD> - <20><EFBFBD><DFBC><EFBFBD>Ϣ <20><><EFBFBD>Լ<EFBFBD>¼
|
||||
* Input :
|
||||
buff :<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
len :<3A><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
__attribute__((section(".non_0_wait"))) void LOG_LogicInfo_DebugRecord(char *fmt,...)
|
||||
{
|
||||
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Logic_Record_bit )) )
|
||||
{
|
||||
uint16_t temp_len = 0;
|
||||
|
||||
memset(Temp_Flash_Buff,0,sizeof(Temp_Flash_Buff));
|
||||
|
||||
Temp_Flash_Buff[temp_len++] = LLogic_DebugString;
|
||||
|
||||
va_list ap; //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>char<61><72><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
va_start(ap, fmt); //ָ<><D6B8><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ֵ--<2D><>ʼ<EFBFBD><CABC>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD>ʽ<EFBFBD><CABD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>-<2D><><EFBFBD>ŵ<EFBFBD>strָ<72><D6B8><EFBFBD>Ŀռ<C4BF>
|
||||
temp_len += vsnprintf((char *)&Temp_Flash_Buff[1],512,fmt,ap);
|
||||
va_end(ap); //<2F><>apָ<70><D6B8><EFBFBD><EFBFBD>ΪNULL
|
||||
|
||||
Log_write_sram(LogType_Logic_Record,(uint8_t *)Temp_Flash_Buff,temp_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user