867 lines
30 KiB
C
867 lines
30 KiB
C
|
|
/***********************************<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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - У<EFBFBD><EFBFBD>APP
|
|||
|
|
* Input :
|
|||
|
|
state :״̬
|
|||
|
|
0x00:<EFBFBD><EFBFBD>ͬ
|
|||
|
|
0x01:<EFBFBD><EFBFBD>ͬ
|
|||
|
|
* 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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - У<EFBFBD><EFBFBD>APP
|
|||
|
|
* Input :
|
|||
|
|
state :״̬
|
|||
|
|
0x00:<EFBFBD>ɹ<EFBFBD>
|
|||
|
|
0x01:ʧ<EFBFBD><EFBFBD>
|
|||
|
|
* 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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - Flashд<EFBFBD><EFBFBD>
|
|||
|
|
* Input :
|
|||
|
|
addr :д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
|
len :д<EFBFBD>볤<EFBFBD><EFBFBD>
|
|||
|
|
* 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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD>ָ<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - PHY״̬<EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
state :״̬
|
|||
|
|
0x00:<EFBFBD>γ<EFBFBD>
|
|||
|
|
0x01:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
0x02:TCP<EFBFBD><EFBFBD>ʱ
|
|||
|
|
0x03:TCP<EFBFBD>Ͽ<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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
dev :<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
addr :<EFBFBD>豸<EFBFBD><EFBFBD>ַ
|
|||
|
|
info_addr :<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>洢<EFBFBD><EFBFBD>ַ
|
|||
|
|
* 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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - API״̬<EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
API_way :<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|||
|
|
0x01:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
0x02:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
state :״̬
|
|||
|
|
0x01:д<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|||
|
|
0x02:д<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
|||
|
|
0x03:<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
0x04:MD5У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
0x05:CRCУ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
0x06:<EFBFBD><EFBFBD>ת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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
IP :<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD>ַ - 4Byte
|
|||
|
|
MAC :<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>MAC<EFBFBD><EFBFBD>ַ - 4Byte
|
|||
|
|
DNS_IP1 :DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP1 - <EFBFBD>ƶ˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 4Byte
|
|||
|
|
DNS_IP2 :DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP2 - TFTP<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 4Byte
|
|||
|
|
DNS_IP3 :DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP3 - MQTT<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - MQTT<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
productkey :<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD>Կ - 12Byte
|
|||
|
|
devname :<EFBFBD>豸<EFBFBD><EFBFBD> - 65Byte
|
|||
|
|
devsecret :<EFBFBD>豸<EFBFBD><EFBFBD>Կ - 33Byte
|
|||
|
|
publish :<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ - 65Byte
|
|||
|
|
sublish :<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD>ƶ<EFBFBD>ͨѶ״̬<EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
state :״̬
|
|||
|
|
0x00:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
0x01:<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
IP :Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD>ַ - 4Byte
|
|||
|
|
Gateway :Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ַ - 4Byte
|
|||
|
|
IP_Mask :Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 4Byte
|
|||
|
|
DNS_Add :DNS<EFBFBD><EFBFBD>ַ - 4Byte
|
|||
|
|
ArgcFlag :<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ - 1Byte
|
|||
|
|
DHCPFlag :DHCPʹ<EFBFBD>ܱ<EFBFBD>־ - 1Byte
|
|||
|
|
ServerFlag :<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
state<EFBFBD><EFBFBD>״̬
|
|||
|
|
0x01<EFBFBD><EFBFBD><EFBFBD>㰴
|
|||
|
|
0x02<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
0x03<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿ<EFBFBD>
|
|||
|
|
0x04<EFBFBD><EFBFBD><EFBFBD>ﵽ<EFBFBD>ָ<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - RCU<EFBFBD><EFBFBD>ѯ<EFBFBD>ظ<EFBFBD><EFBFBD>仯<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
port :<EFBFBD>˿ں<EFBFBD>
|
|||
|
|
baud :ͨѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
data_tick :ѯ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
buff :<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - RCU<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
port :<EFBFBD>˿ں<EFBFBD>
|
|||
|
|
baud :ͨѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
buff :<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - RCY<EFBFBD><EFBFBD><EFBFBD>ƻظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
port :<EFBFBD>˿ں<EFBFBD>
|
|||
|
|
baud :ͨѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
buff :<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* Input :
|
|||
|
|
dev_type :<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dev_addr :<EFBFBD>豸<EFBFBD><EFBFBD>ַ
|
|||
|
|
baud :ͨѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
way :<EFBFBD>ı䷽ʽ<EFBFBD><EFBFBD>0x01:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶʧ<EFBFBD>ܴﵽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0x02:ͨѶʧ<EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﵽ<EFBFBD>ٷֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
fail_num :ʧ<EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
sum :<EFBFBD>ܰ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
num :<EFBFBD><EFBFBD>ǰͨѶ<EFBFBD>±<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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
dev :<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
addr :<EFBFBD>豸<EFBFBD><EFBFBD>ַ
|
|||
|
|
state :<EFBFBD>豸״̬ - 0x00<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>0x01<EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - ȫ<EFBFBD>ֲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<EFBFBD><EFBFBD><EFBFBD>Ӽ<EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
buff :<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD>豸<EFBFBD><EFBFBD>ַ
|
|||
|
|
* 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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - ȫ<EFBFBD>ֲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<EFBFBD><EFBFBD><EFBFBD>Ӽ<EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
buff :<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD>豸<EFBFBD><EFBFBD>ַ
|
|||
|
|
* 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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
SocketId:<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1~4)
|
|||
|
|
ip :<EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>IP<EFBFBD><EFBFBD>ַ
|
|||
|
|
port :<EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>Port
|
|||
|
|
buff :<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<EFBFBD><EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
SocketId:<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1~4)
|
|||
|
|
ip :<EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>IP<EFBFBD><EFBFBD>ַ
|
|||
|
|
port :<EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>Port
|
|||
|
|
buff :<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ <EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>¼
|
|||
|
|
* Input :
|
|||
|
|
buff :<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
len :<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|