新增:首次提交

首次提交,上传Launcher工程
This commit is contained in:
caocong
2026-01-05 09:40:42 +08:00
commit 094fd76a72
70 changed files with 20365 additions and 0 deletions

175
MCU_Driver/log_api.c Normal file
View File

@@ -0,0 +1,175 @@
/*
* log_api.c
*
* Created on: Jul 29, 2025
* Author: cc
*/
#include "rw_logging.h"
#include "SPI_SRAM.h"
#include "Log_api.h"
#include "string.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><>ͬ<EFBFBD><CDAC>
0x01:<3A><EFBFBD>Ų<EFBFBD>ͬ<EFBFBD><CDAC>
0x02:CRCУ<43>鲻ͬ<E9B2BB><CDAC>
0x03:Flash<73><68>APP<50><50>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0x04:Flash APP<50><50><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0x05:Flash<73><68>APP<50><50>־δ<D6BE><CEB4>λ<EFBFBD><CEBB>
0x06:Flash <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRCУ<43><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0x07:MCU Flash<73><68><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0x08:MCU Flash<73><68>APP<50><50>־δ<D6BE><CEB4>λ<EFBFBD><CEBB>
0x09:MCU Flash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRCУ<43><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Return : None
*******************************************************************************/
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
*******************************************************************************/
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
*******************************************************************************/
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 :
state<74><65>
0x01:д<><D0B4><EFBFBD>ɹ<EFBFBD>
0x02:д<><D0B4>ʧ<EFBFBD><CAA7> - û<>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0x03:д<><D0B4>ʧ<EFBFBD><CAA7> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ʧ<EFBFBD><CAA7>
* Return : None
*******************************************************************************/
void LOG_Launcher_Factory_Reset_Record(uint8_t state)
{
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] = state;
Log_write_sram(LogType_Launcher,temp_buff,2);
}
}
/*******************************************************************************
* Function Name : LOG_Launcher_Factory_Reset_Record
* Description : Launcher<65><72><EFBFBD><EFBFBD> - <20><>λԴ
* Input :
sour<75><72><EFBFBD><EFBFBD>λ<EFBFBD>ź<EFBFBD>ֵ
0x00<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
0x01<30><31><EFBFBD>ϵ縴λ
0x02<30><32><EFBFBD><EFBFBD><EFBFBD>Ź<EFBFBD><C5B9><EFBFBD>λ
0x03<30><33><EFBFBD>ⲿ<EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>λ
0x05<30><35><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>ʱ<EFBFBD>ĸ<EFBFBD>λ - ͨ<><CDA8>WCHISPTool<6F><6C>¼<EFBFBD><C2BC><EFBFBD>ĸ<EFBFBD>λ
* Return : None
*******************************************************************************/
void LOG_Launcher_Reset_Source_Record(uint8_t sour)
{
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Launcher_bit )) )
{
uint8_t temp_buff[3] = {0};
temp_buff[0] = LLauncher_Reset_Source;
temp_buff[1] = sour;
Log_write_sram(LogType_Launcher,temp_buff,2);
}
}
/*******************************************************************************
* Function Name : LOG_Launcher_Factory_Reset_Record
* Description : Launcher<65><72><EFBFBD><EFBFBD> - RCU<43><55><EFBFBD>ذ<EFBFBD><D8B0><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
*******************************************************************************/
void LOG_Launcher_RCU_Key_State_Record(uint8_t state)
{
if(LogType_Enable && (SYS_Log_Switch & (1 << LogType_Launcher_bit )) )
{
uint8_t temp_buff[3] = {0};
temp_buff[0] = LLauncher_RCUKey_State;
temp_buff[1] = state;
Log_write_sram(LogType_Launcher,temp_buff,2);
}
}