基本完成demo 版本1.9(demo)

This commit is contained in:
CSSC-WORK\murmur 2023-06-19 15:56:45 +08:00
parent 40c903ca57
commit 99c8764fe8
15 changed files with 227 additions and 71 deletions

16
.config
View File

@ -81,7 +81,7 @@ CONFIG_RT_USING_DEVICE=y
# CONFIG_RT_USING_INTERRUPT_INFO is not set # CONFIG_RT_USING_INTERRUPT_INFO is not set
CONFIG_RT_USING_CONSOLE=y CONFIG_RT_USING_CONSOLE=y
CONFIG_RT_CONSOLEBUF_SIZE=256 CONFIG_RT_CONSOLEBUF_SIZE=256
CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" CONFIG_RT_CONSOLE_DEVICE_NAME="uart3"
# end of Kernel Device Object # end of Kernel Device Object
CONFIG_RT_VER_NUM=0x40101 CONFIG_RT_VER_NUM=0x40101
@ -179,7 +179,13 @@ CONFIG_RT_USING_ADC=y
CONFIG_RT_USING_RTC=y CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_ALARM is not set # CONFIG_RT_USING_ALARM is not set
# CONFIG_RT_USING_SOFT_RTC is not set # CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RT_USING_SDIO is not set CONFIG_RT_USING_SDIO=y
CONFIG_RT_SDIO_STACK_SIZE=512
CONFIG_RT_SDIO_THREAD_PRIORITY=15
CONFIG_RT_MMCSD_STACK_SIZE=1024
CONFIG_RT_MMCSD_THREAD_PREORITY=22
CONFIG_RT_MMCSD_MAX_PARTITION=16
# CONFIG_RT_SDIO_DEBUG is not set
CONFIG_RT_USING_SPI=y CONFIG_RT_USING_SPI=y
# CONFIG_RT_USING_SPI_BITOPS is not set # CONFIG_RT_USING_SPI_BITOPS is not set
# CONFIG_RT_USING_QSPI is not set # CONFIG_RT_USING_QSPI is not set
@ -270,8 +276,8 @@ CONFIG_RT_LWIP_DNS=y
# #
# Static IPv4 Address # Static IPv4 Address
# #
CONFIG_RT_LWIP_IPADDR="192.168.0.30" CONFIG_RT_LWIP_IPADDR="10.10.10.10"
CONFIG_RT_LWIP_GWADDR="192.168.0.1" CONFIG_RT_LWIP_GWADDR="10.10.10.1"
CONFIG_RT_LWIP_MSKADDR="255.255.255.0" CONFIG_RT_LWIP_MSKADDR="255.255.255.0"
# end of Static IPv4 Address # end of Static IPv4 Address
@ -686,7 +692,7 @@ CONFIG_SYSWATCH_EXCEPT_TIMEOUT=60
CONFIG_SYSWATCH_EXCEPT_CONFIRM_TMO=15 CONFIG_SYSWATCH_EXCEPT_CONFIRM_TMO=15
CONFIG_SYSWATCH_EXCEPT_RESUME_DLY=15 CONFIG_SYSWATCH_EXCEPT_RESUME_DLY=15
CONFIG_SYSWATCH_THREAD_PRIO=0 CONFIG_SYSWATCH_THREAD_PRIO=0
CONFIG_SYSWATCH_THREAD_STK_SIZE=512 CONFIG_SYSWATCH_THREAD_STK_SIZE=1024
CONFIG_SYSWATCH_THREAD_NAME="syswatch" CONFIG_SYSWATCH_THREAD_NAME="syswatch"
CONFIG_SYSWATCH_WDT_NAME="wdt" CONFIG_SYSWATCH_WDT_NAME="wdt"
CONFIG_SYSWATCH_WDT_TIMEOUT=5 CONFIG_SYSWATCH_WDT_TIMEOUT=5

View File

@ -21,7 +21,7 @@
#include <ttTR.h> #include <ttTR.h>
static struct rt_event sw_check;//软件条件 static struct rt_event sw_check;//软件条件
static struct rt_event hw_check;//硬件条件 static struct rt_event hw_check;//硬件条件
struct rt_event tcp_chk;//tcp条件 //struct rt_event tcp_chk;//tcp条件
//#define FILE_IS_OK 1 //#define FILE_IS_OK 1
//#define TIMER_IS_OUT 1<<1 //#define TIMER_IS_OUT 1<<1
//#define TT_IS_OK 1<<2 //#define TT_IS_OK 1<<2
@ -36,7 +36,7 @@ static void initEvent(void)
rt_err_t result = rt_event_init(&sw_check, "SHcheck", RT_IPC_FLAG_PRIO); rt_err_t result = rt_event_init(&sw_check, "SHcheck", RT_IPC_FLAG_PRIO);
result = rt_event_init(&hw_check, "HWcheck", RT_IPC_FLAG_PRIO) | result; result = rt_event_init(&hw_check, "HWcheck", RT_IPC_FLAG_PRIO) | result;
result = rt_event_init(&tcp_chk, "tcpTT", RT_IPC_FLAG_PRIO) | result; // result = rt_event_init(&tcp_chk, "tcpTT", RT_IPC_FLAG_PRIO) | result;
if (result != RT_EOK) if (result != RT_EOK)
{ {
@ -360,5 +360,5 @@ void smsg()
return; return;
} }
} }
INIT_COMPONENT_EXPORT(smsg); //INIT_COMPONENT_EXPORT(smsg);
MSH_CMD_EXPORT(smsg,smsg); MSH_CMD_EXPORT(smsg,smsg);

View File

@ -81,7 +81,7 @@ int get_cfg(const char *k)
} }
else { else {
// LOG_I("%s = %s",k,buf); // LOG_I("%s = %s",k,buf);
LOG_I("%s = %d",k,rst); // LOG_I("%s = %d",k,rst);
} }
return rst; return rst;
} }
@ -164,6 +164,7 @@ int set_val(const char *k, long v)
int add_val(const char *k) int add_val(const char *k)
{ {
long ori = get_val(k); long ori = get_val(k);
rt_thread_mdelay(100);
if (ori != -1) { if (ori != -1) {
return set_val(k, ori+1); return set_val(k, ori+1);
} }

View File

@ -143,7 +143,7 @@ static void rulecheck(void)
//满足加1不满足清零 //满足加1不满足清零
static rt_uint16_t okCnt=0; static rt_uint16_t okCnt=0;
if (!okCnt) { if (!okCnt) {
LOG_I("当前规则为:连续%d个采集周期TT信号质量不低于%d",minTTPeriCnt,minTTsinal); LOG_D("当前规则为:连续%d个采集周期TT信号质量不低于%d",minTTPeriCnt,minTTsinal);
} }
int xh=atoi(TTinfo->xh); int xh=atoi(TTinfo->xh);
if (xh == 99) { if (xh == 99) {
@ -161,7 +161,7 @@ static void rulecheck(void)
if (okCnt >= minTTPeriCnt) { if (okCnt >= minTTPeriCnt) {
//TT具备发送条件 //TT具备发送条件
// rt_event_send(&sw_check, TT_IS_OK); // rt_event_send(&sw_check, TT_IS_OK);
upTTflag(); // upTTflag();
upTTflagtmp(); upTTflagtmp();
LOG_I("符合规则TT具备发送状态。"); LOG_I("符合规则TT具备发送状态。");
// updateSta(); // updateSta();
@ -269,6 +269,10 @@ static int webclient_get_data(const char *url)
if (webclient_request(url, RT_NULL, RT_NULL, 0, (void **) &buffer, &length) < 0) if (webclient_request(url, RT_NULL, RT_NULL, 0, (void **) &buffer, &length) < 0)
{ {
LOG_E("TT server is not ready."); LOG_E("TT server is not ready.");
if (buffer)
{
web_free(buffer);
}
return -RT_ERROR; return -RT_ERROR;
} }
@ -390,10 +394,12 @@ void repGetTT_thread_entry(void* parameter)
if (url == RT_NULL) if (url == RT_NULL)
{ {
LOG_E("no memory for create getTT url buffer.\n"); LOG_E("no memory for create getTT url buffer.\n");
break;
// return -RT_ENOMEM; // return -RT_ENOMEM;
} }
if (webclient_get_data(url) != RT_EOK) if (webclient_get_data(url) != RT_EOK)
{ {
web_free(url);
strcpy(TTinfo->sim,"-"); strcpy(TTinfo->sim,"-");
strcpy(TTinfo->xh,"-"); strcpy(TTinfo->xh,"-");
strcpy(TTinfo->jh,"-"); strcpy(TTinfo->jh,"-");
@ -403,7 +409,7 @@ void repGetTT_thread_entry(void* parameter)
break; break;
} }
web_free(url); web_free(url);
rt_thread_mdelay(100); // rt_thread_mdelay(100);
} }
rulecheck(); rulecheck();
rt_thread_mdelay(3 * 1000);//间隔3s更新一次数据 rt_thread_mdelay(3 * 1000);//间隔3s更新一次数据
@ -416,7 +422,7 @@ void repGetTT_thread_entry(void* parameter)
void repGetTT(void) void repGetTT(void)
{ {
/* 创建 serial 线程 */ /* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("repGetTT", repGetTT_thread_entry, RT_NULL, 1024 * 3, 25, 10); rt_thread_t thread = rt_thread_create("repGetTT", repGetTT_thread_entry, RT_NULL, 1024 * 3, 27, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
if (thread != RT_NULL) if (thread != RT_NULL)
{ {
@ -429,3 +435,35 @@ void repGetTT(void)
return RT_ERROR; return RT_ERROR;
} }
} }
MSH_CMD_EXPORT(repGetTT,gett);
//由于
//
//static rt_timer_t timer1;
///* 定时器1超时函数 */
//static void timeout1(void *parameter)
//{
//
//// LOG_D("定时时间到,准备发送数据");
// if (isTTon()) {
// repGetTT();
// }
// else {
// rt_timer_stop(timer1);
// }
//// rt_event_send(&readyToSend, TIME_IS_UP);
//}
//void runTT()
//{
///* 创建定时器1 周期定时器 */
//timer1 = rt_timer_create("TTinfotimer", timeout1,
// RT_NULL, rt_tick_from_millisecond(3*1000),
// RT_TIMER_FLAG_PERIODIC);
//
///* 启动定时器1 */
//if (timer1 != RT_NULL && isTTon())
// rt_timer_start(timer1);
//}

View File

@ -34,7 +34,7 @@ typedef enum
motion_id, motion_id,
}ulog_file_be_name; }ulog_file_be_name;
#define ROOT_PATH "/log" //设置保存路径 #define ROOT_PATH "/sd/syslog" //设置保存路径
#define FILE_SIZE 512 * 1024 //设置单个文件大小 #define FILE_SIZE 512 * 1024 //设置单个文件大小
#define BUFF_SIZE 512 //设备缓存区大小 #define BUFF_SIZE 512 //设备缓存区大小
@ -43,8 +43,8 @@ static struct ulog_file_be sys_log_file;
static struct _log_file table[] = static struct _log_file table[] =
{ {
{"motion" ,ROOT_PATH,5,FILE_SIZE,BUFF_SIZE}, {"motion" ,&sys_log_backend,&sys_log_file,ROOT_PATH,5,FILE_SIZE,BUFF_SIZE},
{"sys" ,&sys_log_backend,&sys_log_file,ROOT_PATH,10,FILE_SIZE,BUFF_SIZE}, {"23-sys" ,&sys_log_backend,&sys_log_file,ROOT_PATH,10,FILE_SIZE,BUFF_SIZE},
}; };
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
/** /**

View File

@ -18,30 +18,6 @@
//#include <cfg.h> //#include <cfg.h>
void pfdemo(void)
{
// #define cmb_println(...) rt_kprintf(__VA_ARGS__);rt_kprintf("\r\n");
// char *f = "1023_05_19_15_29_59_254.txt";
// char *f = "2023_05_19_15_29_59_255.txt";
char *f = "2023_06_16_10_28_00_123.bin";
static rt_uint8_t d[50][200] = { };
static rt_uint8_t s[50] = { };
rt_uint8_t len = 0;
LOG_D("%p--%p",d,s);
LOG_I("pack %s ...",f);
len = pack_File(f, 0, d, s);
rt_kprintf("len is %d\n", len);
if (len)
{
for (size_t var = 0; var < len; var++) {
LOG_HEX("d",27,d[var],s[var]);
}
// LOG_HEX("pkdata:",27,d[0],s[0]);
// LOG_D("%p--%p",d,s);
// LOG_D("%d--%d--%02X",len,s[0],d[0][0]);
LOG_I("Done.");
}
}
@ -94,7 +70,31 @@ int main(void)
return RT_EOK; return RT_EOK;
} }
//fastlz_test -c demo.bin f.bin //fastlz_test -c demo.bin f.bin
#ifdef DEMO
void pfdemo(void)
{
// #define cmb_println(...) rt_kprintf(__VA_ARGS__);rt_kprintf("\r\n");
// char *f = "1023_05_19_15_29_59_254.txt";
// char *f = "2023_05_19_15_29_59_255.txt";
char *f = "2023_06_16_10_28_00_123.bin";
static rt_uint8_t d[10][200] = { };
static rt_uint8_t s[10] = { };
rt_uint8_t len = 0;
LOG_D("%p--%p",d,s);
LOG_I("pack %s ...",f);
len = pack_File(f, 0, d, s);
rt_kprintf("len is %d\n", len);
if (len)
{
for (size_t var = 0; var < len; var++) {
LOG_HEX("d",27,d[var],s[var]);
}
// LOG_HEX("pkdata:",27,d[0],s[0]);
// LOG_D("%p--%p",d,s);
// LOG_D("%d--%d--%02X",len,s[0],d[0][0]);
LOG_I("Done.");
}
}
void pp(int argc, char **argv) void pp(int argc, char **argv)
{ {
// if (argc == 2) // if (argc == 2)
@ -116,12 +116,14 @@ void pp(int argc, char **argv)
} }
MSH_CMD_EXPORT(pp, ); MSH_CMD_EXPORT(pp, );
#endif
extern int rt_hw_stm32_eth_init(void); extern int rt_hw_stm32_eth_init(void);
MSH_CMD_EXPORT(rt_hw_stm32_eth_init, ); MSH_CMD_EXPORT(rt_hw_stm32_eth_init, );
void show_version(void) void show_version(void)
{ {
rt_kprintf("SW Version: %s\n","1.5(temp)"); rt_kprintf("SW Version: %s\n","1.9(temp)");
} }
MSH_CMD_EXPORT(show_version,); MSH_CMD_EXPORT(show_version,);

View File

@ -20,13 +20,26 @@
/* 定时器的控制块 */ /* 定时器的控制块 */
static rt_timer_t timer1; static rt_timer_t timer1;
static struct rt_event readyToSend; static struct rt_event readyToSend;
static rt_sem_t ttack= RT_NULL;
#define TIME_IS_UP 1<<1 #define TIME_IS_UP 1<<1
void upTTflagtmp(void) void upTTflagtmp(void)
{ {
rt_event_send(&readyToSend, TT_IS_OK); // rt_event_send(&readyToSend, TT_IS_OK);
rt_sem_release(ttack);
} }
void repeatSend_thread_entry() void repeatSend_thread_entry()
{ {
static rt_uint8_t d[10][200] = { };
static rt_uint8_t s[10] = { };
while(tcpInit() != RT_EOK)
{
LOG_W("TT server is not ready.");
rt_thread_mdelay(100);
}
LOG_D("TT server is ready.");
while (1) while (1)
{ {
if (rt_event_recv(&readyToSend, TIME_IS_UP, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER, if (rt_event_recv(&readyToSend, TIME_IS_UP, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER,
@ -35,25 +48,28 @@ void repeatSend_thread_entry()
//记录次数 //记录次数
//此次数为总定时超时次数 //此次数为总定时超时次数
add_val("allCnt"); add_val("allCnt");
if (rt_event_recv(&readyToSend, TT_IS_OK, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, // if (rt_event_recv(&readyToSend, TT_IS_OK, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
rt_tick_from_millisecond(1 * 60 * 1000), // rt_tick_from_millisecond(1 * 60 * 1000),
RT_NULL) == RT_EOK) // RT_NULL) == RT_EOK)//等待1分钟
if(rt_sem_take(ttack, rt_tick_from_millisecond(1 * 60 * 1000)) == RT_EOK)
{ {
LOG_D("TT is ready."); LOG_D("TT is ready.");
char *f = "2023_06_17_16_30_00_000.bin"; char *f = "2023_06_17_16_30_00_000.bin";
static rt_uint8_t d[30][200] = { };
static rt_uint8_t s[30] = { };
rt_uint8_t len = 0; rt_uint8_t len = 0;
len = pack_File(f, 0, d, s); len = pack_File(f, 0, d, s);
if (len && (tcpInit() == RT_EOK)) LOG_D("Pack done.");
if (len)
{ {
for (size_t var = 0; var < len; var++) for (size_t var = 0; var < len; var++)
{ {
sendMsg(d[var], s[var]); sendMsg(d[var], s[var]);
rt_uint8_t rd[30];
tcpRec(rd);
LOG_HEX("ack",16,rd,30);
rt_thread_mdelay(1000); rt_thread_mdelay(1000);
// LOG_HEX("d", 27, d[var], s[var]); // LOG_HEX("d", 27, d[var], s[var]);
} }
tcpClose(); // tcpClose();
LOG_I("send msg Done."); LOG_I("send msg Done.");
//记录次数 //记录次数
//此次数为发送成功次数 //此次数为发送成功次数
@ -83,7 +99,7 @@ void repeatSend_thread_entry()
{ {
/* 创建定时器1 周期定时器 */ /* 创建定时器1 周期定时器 */
timer1 = rt_timer_create("repeatSendtimer", timeout1, timer1 = rt_timer_create("repeatSendtimer", timeout1,
RT_NULL, rt_tick_from_millisecond(1*60*1000), RT_NULL, rt_tick_from_millisecond(5*60*1000),
RT_TIMER_FLAG_PERIODIC); RT_TIMER_FLAG_PERIODIC);
/* 启动定时器1 */ /* 启动定时器1 */
@ -91,7 +107,7 @@ void repeatSend_thread_entry()
rt_timer_start(timer1); rt_timer_start(timer1);
/* 创建 serial 线程 */ /* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("repsendT", repeatSend_thread_entry, RT_NULL, 1024*3, 25+1, 10); rt_thread_t thread = rt_thread_create("repSendT", repeatSend_thread_entry, RT_NULL, 1024*3, 25+1, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
if (thread != RT_NULL) if (thread != RT_NULL)
{ {
@ -107,10 +123,13 @@ void inievt()
{ {
pwTT_thread_entry("1");//开机 pwTT_thread_entry("1");//开机
rt_err_t result = rt_event_init(&readyToSend, "repSend", RT_IPC_FLAG_PRIO); rt_event_init(&readyToSend, "repSend", RT_IPC_FLAG_PRIO);
ttack = rt_sem_create("ttack", 0, RT_IPC_FLAG_PRIO);
rt_hw_stm32_eth_init();//激活网口 rt_hw_stm32_eth_init();//激活网口
rt_thread_mdelay(10*1000); rt_thread_mdelay(10*1000);
repGetTT();//持续更新 repGetTT();//持续更新
// runTT();
} }
INIT_APP_EXPORT(inievt); INIT_APP_EXPORT(inievt);
INIT_APP_EXPORT(timer_demo); INIT_APP_EXPORT(timer_demo);

View File

@ -166,6 +166,18 @@ void sDemo()
MSH_CMD_EXPORT(sDemo,); MSH_CMD_EXPORT(sDemo,);
/**
*
*/
RT_WEAK void rt_hw_stm32_eth_deinit()
{
}
MSH_CMD_EXPORT(rt_hw_stm32_eth_deinit, );
static struct rt_thread infoTT_thread; static struct rt_thread infoTT_thread;
void ttinfoInit() void ttinfoInit()
{ {

View File

@ -85,6 +85,7 @@ static int tcpSend(const rt_uint8_t *send_data, size_t len)
if (ret == len) if (ret == len)
{ {
LOG_D("send %d Bytes ok.",len);
ret = RT_EOK; ret = RT_EOK;
} }
else else
@ -182,14 +183,15 @@ int sendMsg(const rt_uint8_t *msg, size_t len)
tcpClose(); tcpClose();
return RT_ERROR; return RT_ERROR;
} }
//#define CHK_ACK
#ifdef CHK_ACK
if (tcpAck() != RT_EOK)
{
return RT_ERROR;
// break;
};
// if (tcpRec() != RT_EOK) #endif
// {
// tcpClose();
// return RT_ERROR;
// };
// tcpClose();
return RT_EOK; return RT_EOK;
} }

View File

@ -372,13 +372,13 @@ rt_uint8_t pack_File(const char *fin, rt_uint8_t flag, const rt_uint8_t (*dout)[
return len; return len;
} }
static char d[40][200]; #ifdef PF
static char s[40];
// static rt_uint8_t *buffer = RT_NULL; // static rt_uint8_t *buffer = RT_NULL;
// static MSG cfg; // static MSG cfg;
static int pf_thread_entry(void* parameter) static int pf_thread_entry(void* parameter)
{ {
static char d[30][200];
static char s[30];
char *f = (char *) parameter; char *f = (char *) parameter;
// static char d[5][200]; // static char d[5][200];
// static char s[5]; // static char s[5];
@ -471,7 +471,7 @@ static int pf_thread_entry(void* parameter)
{ {
sendMsg(d[var], s[var]); sendMsg(d[var], s[var]);
LOG_D("i = %d",var); LOG_D("i = %d",var);
LOG_HEX("d", 27, d[var], s[var]); // LOG_HEX("d", 27, d[var], s[var]);
} }
tcpClose(); tcpClose();
LOG_I("Done."); LOG_I("Done.");
@ -487,7 +487,7 @@ static int pmsg(int argc, char **argv)
strcpy(c, argv[1]); strcpy(c, argv[1]);
/* 创建线程 */ /* 创建线程 */
rt_thread_t thread = rt_thread_create("pmsg", pf_thread_entry, (void *) c, 1024 * 20, 25, 10); rt_thread_t thread = rt_thread_create("pmsg", pf_thread_entry, (void *) c, 1024 * 2, 25, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
if (thread != RT_NULL) if (thread != RT_NULL)
{ {
@ -510,6 +510,7 @@ static int pmsg(int argc, char **argv)
#include <finsh.h> #include <finsh.h>
MSH_CMD_EXPORT(pmsg, ); MSH_CMD_EXPORT(pmsg, );
#endif
/** /**
* *

View File

@ -54,9 +54,6 @@ void w25q128_mount(void)
rt_kprintf("spi_flash mount to spi failed!\n"); rt_kprintf("spi_flash mount to spi failed!\n");
} }
} }
rt_kprintf("%d ms since boot.\n",rt_tick_get_millisecond());
add_val("bootCnt");
} }
@ -64,3 +61,26 @@ void w25q128_mount(void)
INIT_COMPONENT_EXPORT(w25q128_mount); INIT_COMPONENT_EXPORT(w25q128_mount);
void sdmnt_init(void)
{
rt_thread_mdelay(100);//这段延时必须加上系统上电过程中存在延时否则会出现先挂载后注册块设备sd0的情况
// mkfs("elm","sd0");//挂在前需格式化
if(dfs_mount("sd0","/sd","elm",0,0)==0) //挂载文件系统参数块设备名称、挂载目录、文件系统类型、读写标志、私有数据0
{
// rt_kprintf("dfs mount success\r\n");
}
else
{
rt_kprintf("dfs mount failed\r\n");
}
}
/* 导出到自动初始化 */
INIT_COMPONENT_EXPORT(sdmnt_init);
void bootinfo()
{
rt_kprintf("%d ms since boot.\n", rt_tick_get_millisecond());
add_val("bootCnt");
}
/* 导出到自动初始化 */
INIT_COMPONENT_EXPORT(bootinfo);

View File

@ -179,3 +179,52 @@ void phy_reset(void)
} }
//242.16 KB /51556-64564-70868 add ETH //242.16 KB /51556-64564-70868 add ETH
/**
* @brief SD MSP Initialization
* This function configures the hardware resources used in this example
* @param hsd: SD handle pointer
* @retval None
*/
void HAL_SD_MspInit(SD_HandleTypeDef* hsd)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hsd->Instance==SDIO)
{
/* USER CODE BEGIN SDIO_MspInit 0 */
/* USER CODE END SDIO_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
/**SDIO GPIO Configuration
PC8 ------> SDIO_D0
PC9 ------> SDIO_D1
PC10 ------> SDIO_D2
PC11 ------> SDIO_D3
PC12 ------> SDIO_CK
PD2 ------> SDIO_CMD
*/
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/* USER CODE BEGIN SDIO_MspInit 1 */
/* USER CODE END SDIO_MspInit 1 */
}
}

View File

@ -284,7 +284,7 @@ extern "C"
* *
*/ */
/*#define BSP_USING_SDIO*/ #define BSP_USING_SDIO
/*-------------------------- SDIO CONFIG END --------------------------*/ /*-------------------------- SDIO CONFIG END --------------------------*/

View File

@ -71,7 +71,7 @@
/* #define HAL_RNG_MODULE_ENABLED */ /* #define HAL_RNG_MODULE_ENABLED */
#define HAL_RTC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED
/* #define HAL_SAI_MODULE_ENABLED */ /* #define HAL_SAI_MODULE_ENABLED */
/* #define HAL_SD_MODULE_ENABLED */ #define HAL_SD_MODULE_ENABLED
/* #define HAL_MMC_MODULE_ENABLED */ /* #define HAL_MMC_MODULE_ENABLED */
#define HAL_SPI_MODULE_ENABLED #define HAL_SPI_MODULE_ENABLED
/* #define HAL_TIM_MODULE_ENABLED */ /* #define HAL_TIM_MODULE_ENABLED */

View File

@ -111,6 +111,12 @@
#define RT_USING_PIN #define RT_USING_PIN
#define RT_USING_ADC #define RT_USING_ADC
#define RT_USING_RTC #define RT_USING_RTC
#define RT_USING_SDIO
#define RT_SDIO_STACK_SIZE 512
#define RT_SDIO_THREAD_PRIORITY 15
#define RT_MMCSD_STACK_SIZE 1024
#define RT_MMCSD_THREAD_PREORITY 22
#define RT_MMCSD_MAX_PARTITION 16
#define RT_USING_SPI #define RT_USING_SPI
#define RT_USING_SFUD #define RT_USING_SFUD
#define RT_SFUD_USING_SFDP #define RT_SFUD_USING_SFDP
@ -296,7 +302,7 @@
#define SYSWATCH_EXCEPT_CONFIRM_TMO 15 #define SYSWATCH_EXCEPT_CONFIRM_TMO 15
#define SYSWATCH_EXCEPT_RESUME_DLY 15 #define SYSWATCH_EXCEPT_RESUME_DLY 15
#define SYSWATCH_THREAD_PRIO 0 #define SYSWATCH_THREAD_PRIO 0
#define SYSWATCH_THREAD_STK_SIZE 512*2 #define SYSWATCH_THREAD_STK_SIZE 1024
#define SYSWATCH_THREAD_NAME "syswatch" #define SYSWATCH_THREAD_NAME "syswatch"
#define SYSWATCH_WDT_NAME "wdt" #define SYSWATCH_WDT_NAME "wdt"
#define SYSWATCH_WDT_TIMEOUT 5 #define SYSWATCH_WDT_TIMEOUT 5