更新开窗标志,完善相关逻辑
更新FRAME_DATA_LEN_MAX的值
This commit is contained in:
parent
cd37b8f3f9
commit
f4170d06e6
@ -66,6 +66,7 @@ void poTT_callback(rt_alarm_t alarm, time_t timestamp)
|
|||||||
{
|
{
|
||||||
LOG_D("power UP TT.");
|
LOG_D("power UP TT.");
|
||||||
initTT();
|
initTT();
|
||||||
|
setWindowMode();
|
||||||
}
|
}
|
||||||
void pdTT_callback(rt_alarm_t alarm, time_t timestamp)
|
void pdTT_callback(rt_alarm_t alarm, time_t timestamp)
|
||||||
{
|
{
|
||||||
|
@ -282,6 +282,9 @@ void getAndSendFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//发送完毕
|
||||||
|
// rt_sem_take(sem, timeout)
|
||||||
|
resetTM();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chkAndSendFile_thread_entry()
|
static void chkAndSendFile_thread_entry()
|
||||||
@ -294,6 +297,7 @@ static void chkAndSendFile_thread_entry()
|
|||||||
RT_WAITING_FOREVER, RT_NULL) == RT_EOK) //条件1满足
|
RT_WAITING_FOREVER, RT_NULL) == RT_EOK) //条件1满足
|
||||||
{
|
{
|
||||||
LOG_I("等待TT就绪");
|
LOG_I("等待TT就绪");
|
||||||
|
LOG_I("当前规则为:连续%d个采集周期TT信号质量不低于%d",scfg.minTTPeriCnt,scfg.minTTsinal);
|
||||||
initTT();
|
initTT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +352,8 @@ void chkAndSendFile()
|
|||||||
INIT_APP_EXPORT(chkAndSendFile);
|
INIT_APP_EXPORT(chkAndSendFile);
|
||||||
|
|
||||||
static rt_timer_t tmrToPNTT=RT_NULL;
|
static rt_timer_t tmrToPNTT=RT_NULL;
|
||||||
static int isInWindow=0;//winow 关闭时复位
|
static uint8_t isWindowMode=0;//自动或手动引起TT开机
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭超时定时器,定时时间到后关闭TT
|
* 关闭超时定时器,定时时间到后关闭TT
|
||||||
*/
|
*/
|
||||||
@ -360,8 +365,15 @@ void stopTM()
|
|||||||
rt_timer_stop(tmrToPNTT);
|
rt_timer_stop(tmrToPNTT);
|
||||||
rt_timer_stop(tmrToPNTT);
|
rt_timer_stop(tmrToPNTT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setWindowMode(void)
|
||||||
|
{
|
||||||
|
isWindowMode = 1;
|
||||||
|
stopTM();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 重启超时定时器,定时时间到后关闭TT
|
* 重启超时定时器,定时时间到后关闭TT
|
||||||
|
* 逻辑是非开窗(包括自动、手动)状态下TT无接收数据则启动关机倒计时
|
||||||
*/
|
*/
|
||||||
void resetTM()
|
void resetTM()
|
||||||
{
|
{
|
||||||
@ -369,7 +381,7 @@ void resetTM()
|
|||||||
if (tmrToPNTT == RT_NULL) {
|
if (tmrToPNTT == RT_NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isInWindow) {
|
if (isWindowMode) {
|
||||||
stopTM();
|
stopTM();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -380,13 +392,16 @@ void resetTM()
|
|||||||
rt_timer_start(tmrToPNTT);
|
rt_timer_start(tmrToPNTT);
|
||||||
LOG_D("%d minutes from now to power down TT.",scfg.timeout);
|
LOG_D("%d minutes from now to power down TT.",scfg.timeout);
|
||||||
}
|
}
|
||||||
void d_getRemain()
|
void d_remain()
|
||||||
{
|
{
|
||||||
LOG_D("=%d=",rt_tick_from_millisecond(10*60*1000));
|
if (tmrToPNTT == RT_NULL) {
|
||||||
|
LOG_I("tmrToPNTT is NULL");
|
||||||
|
return;
|
||||||
|
}
|
||||||
rt_tick_t arg1,arg2;
|
rt_tick_t arg1,arg2;
|
||||||
arg1=rt_timer_control(tmrToPNTT, RT_TIMER_CTRL_GET_TIME, (void*)&arg1);
|
rt_timer_control(tmrToPNTT, RT_TIMER_CTRL_GET_TIME, (void*)&arg1);
|
||||||
arg2=rt_timer_control(tmrToPNTT, RT_TIMER_CTRL_GET_REMAIN_TIME, (void*)&arg2);
|
rt_timer_control(tmrToPNTT, RT_TIMER_CTRL_GET_REMAIN_TIME, (void*)&arg2);
|
||||||
LOG_D("tm=%d-%d",arg1,arg2);
|
LOG_D("%d / %d min",arg2/60000,arg1/60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 定时器超时函数 */
|
/* 定时器超时函数 */
|
||||||
@ -404,7 +419,7 @@ static void timeoutFunc(void *parameter)
|
|||||||
void initTT_thread_entry()
|
void initTT_thread_entry()
|
||||||
{
|
{
|
||||||
pwTT_thread_entry("1");
|
pwTT_thread_entry("1");
|
||||||
rt_thread_mdelay(15000);//wait TT to boot up
|
// rt_thread_mdelay(15000);//wait TT to boot up
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (!isTTon()) {
|
if (!isTTon()) {
|
||||||
@ -420,15 +435,20 @@ void initTT_thread_entry()
|
|||||||
if (!isEthUP())
|
if (!isEthUP())
|
||||||
{ //只初始化一次
|
{ //只初始化一次
|
||||||
LOG_D("init eth...");
|
LOG_D("init eth...");
|
||||||
|
rt_pin_write(ETH_RESET_PIN, PIN_HIGH);
|
||||||
if (rt_hw_stm32_eth_init() == RT_EOK)
|
if (rt_hw_stm32_eth_init() == RT_EOK)
|
||||||
{
|
{
|
||||||
LOG_D("eth inited DONE.");
|
LOG_D("eth inited DONE.");
|
||||||
|
// lwip_sys_init();
|
||||||
}; //激活网口
|
}; //激活网口
|
||||||
}
|
}
|
||||||
else if (!isTCPok()) //判断TCP连接是否正常,异常自动重连
|
else if (!isTCPok()) //判断TCP连接是否正常,异常自动重连
|
||||||
{
|
{
|
||||||
// LOG_W("TT server is not ready,--%d",isTCPok());
|
// LOG_W("TT server is not ready,--%d",isTCPok());
|
||||||
tcpInit();
|
// tcpInit();
|
||||||
|
if (tcpInit() != RT_EOK) {
|
||||||
|
cmd_free();
|
||||||
|
}
|
||||||
// rt_thread_mdelay(1000);
|
// rt_thread_mdelay(1000);
|
||||||
if (isTCPok())
|
if (isTCPok())
|
||||||
{
|
{
|
||||||
@ -459,6 +479,7 @@ void deInitTT_thread_entry()
|
|||||||
rt_hw_stm32_eth_deinit(); //qu激活网口
|
rt_hw_stm32_eth_deinit(); //qu激活网口
|
||||||
// rt_thread_mdelay(3000);
|
// rt_thread_mdelay(3000);
|
||||||
pwTT_thread_entry("0");
|
pwTT_thread_entry("0");
|
||||||
|
stopTM();
|
||||||
// if (0&& tmrToPNTT)
|
// if (0&& tmrToPNTT)
|
||||||
// {
|
// {
|
||||||
// rt_timer_delete(tmrToPNTT); //关闭倒计时
|
// rt_timer_delete(tmrToPNTT); //关闭倒计时
|
||||||
@ -527,7 +548,8 @@ MSH_CMD_EXPORT(fileIsReady,fileIsReady);
|
|||||||
MSH_CMD_EXPORT(chkAndSendFile, chkAndSendFile);
|
MSH_CMD_EXPORT(chkAndSendFile, chkAndSendFile);
|
||||||
//MSH_CMD_EXPORT(upSendFile, upSendFile);
|
//MSH_CMD_EXPORT(upSendFile, upSendFile);
|
||||||
MSH_CMD_EXPORT(initTT,初始化TT);
|
MSH_CMD_EXPORT(initTT,初始化TT);
|
||||||
MSH_CMD_EXPORT(deInitTT,初始化TT);
|
MSH_CMD_EXPORT(deInitTT,去初始化TT);
|
||||||
MSH_CMD_EXPORT(d_getRemain,d_getRemain);
|
MSH_CMD_EXPORT(d_remain,剩余超时时间);
|
||||||
|
MSH_CMD_EXPORT(resetTM,resetTM);
|
||||||
MSH_CMD_EXPORT(d_upSendFile,d_upSendFile);
|
MSH_CMD_EXPORT(d_upSendFile,d_upSendFile);
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define KEY_LEN 32//密钥长度
|
#define KEY_LEN 32//密钥长度
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t aes_128_cbc_pkcs7(rt_uint8_t *data, size_t len, rt_uint8_t *dout)
|
size_t aes_256_cbc_pkcs7(rt_uint8_t *data, size_t len, rt_uint8_t *dout)
|
||||||
{
|
{
|
||||||
// AES-256
|
// AES-256
|
||||||
// 工作模式 CBC ,填充模式 PKCS7,不同语言要保持一致。
|
// 工作模式 CBC ,填充模式 PKCS7,不同语言要保持一致。
|
||||||
@ -61,7 +61,7 @@ size_t aes_128_cbc_pkcs7(rt_uint8_t *data, size_t len, rt_uint8_t *dout)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t aes_128_cbc_pkcs7_de(rt_uint8_t *data, size_t len, rt_uint8_t *dout)
|
size_t aes_256_cbc_pkcs7_de(rt_uint8_t *data, size_t len, rt_uint8_t *dout)
|
||||||
{
|
{
|
||||||
// AES-256
|
// AES-256
|
||||||
// 工作模式 CBC ,填充模式 PKCS7,不同语言要保持一致。
|
// 工作模式 CBC ,填充模式 PKCS7,不同语言要保持一致。
|
||||||
@ -115,8 +115,7 @@ size_t aes_128_cbc_pkcs7_de(rt_uint8_t *data, size_t len, rt_uint8_t *dout)
|
|||||||
*/
|
*/
|
||||||
size_t decryp_data(const uint8_t *din, size_t len, uint8_t *dout)
|
size_t decryp_data(const uint8_t *din, size_t len, uint8_t *dout)
|
||||||
{
|
{
|
||||||
size_t nlen = aes_128_cbc_pkcs7_de(din, len, dout);
|
return aes_256_cbc_pkcs7_de(din, len, dout);
|
||||||
return nlen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,8 +127,7 @@ size_t decryp_data(const uint8_t *din, size_t len, uint8_t *dout)
|
|||||||
*/
|
*/
|
||||||
size_t cryp_data(const uint8_t *din, int len, uint8_t *dout)
|
size_t cryp_data(const uint8_t *din, int len, uint8_t *dout)
|
||||||
{
|
{
|
||||||
size_t nlen = aes_128_cbc_pkcs7(din, len, dout);
|
return aes_256_cbc_pkcs7(din, len, dout);
|
||||||
return nlen;
|
|
||||||
}
|
}
|
||||||
void aes_string_test(int argc, char **argv)
|
void aes_string_test(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -188,7 +186,7 @@ void aes_file(const char *fin, const char *fout)
|
|||||||
|
|
||||||
read(fd_in, buffer, file_size);
|
read(fd_in, buffer, file_size);
|
||||||
|
|
||||||
size_t len = aes_128_cbc_pkcs7(buffer, file_size, outbuffer);
|
size_t len = aes_256_cbc_pkcs7(buffer, file_size, outbuffer);
|
||||||
write(fd_out, outbuffer, len);
|
write(fd_out, outbuffer, len);
|
||||||
|
|
||||||
LOG_I("AESed to %s done. File size from %d bytes to %d.\n", fout,file_size, len);
|
LOG_I("AESed to %s done. File size from %d bytes to %d.\n", fout,file_size, len);
|
||||||
|
@ -346,7 +346,9 @@ void openWindow(int t)
|
|||||||
{
|
{
|
||||||
|
|
||||||
//开启TT
|
//开启TT
|
||||||
pwTT_thread_entry("1");//开机
|
// pwTT_thread_entry("1");//开机
|
||||||
|
initTT();
|
||||||
|
setWindowMode();
|
||||||
if (!t) {
|
if (!t) {
|
||||||
LOG_D("手动开窗完成,需手动关窗。");
|
LOG_D("手动开窗完成,需手动关窗。");
|
||||||
return;
|
return;
|
||||||
@ -355,8 +357,8 @@ void openWindow(int t)
|
|||||||
//设置定时器,定时器到则关窗
|
//设置定时器,定时器到则关窗
|
||||||
/* 创建定时器,单次定时器 */
|
/* 创建定时器,单次定时器 */
|
||||||
rt_timer_t timer1;
|
rt_timer_t timer1;
|
||||||
timer1 = rt_timer_create("window", pwTT_thread_entry,
|
timer1 = rt_timer_create("window", deInitTT(),
|
||||||
0, rt_tick_from_millisecond(t*60*1000),
|
RT_NULL, rt_tick_from_millisecond(t*60*1000),
|
||||||
RT_TIMER_FLAG_ONE_SHOT);
|
RT_TIMER_FLAG_ONE_SHOT);
|
||||||
/* 启动定时器 */
|
/* 启动定时器 */
|
||||||
if (timer1 != RT_NULL)
|
if (timer1 != RT_NULL)
|
||||||
@ -372,6 +374,7 @@ void openWindow(int t)
|
|||||||
void closeWindow()
|
void closeWindow()
|
||||||
{
|
{
|
||||||
// pwTT_thread_entry("0");//关 机
|
// pwTT_thread_entry("0");//关 机
|
||||||
|
deInitTT();
|
||||||
LOG_D("手动关窗完成。");
|
LOG_D("手动关窗完成。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1253,21 +1256,11 @@ void parseRS232(uint8_t *din, size_t len)
|
|||||||
*/
|
*/
|
||||||
int isEthUP()
|
int isEthUP()
|
||||||
{
|
{
|
||||||
//static void netdev_list_if(void) in netdev.c
|
//netdev.c
|
||||||
|
|
||||||
// struct netdev *netdev = RT_NULL;
|
|
||||||
// netdev = netdev_get_by_name(argv[1]);
|
|
||||||
// if (netdev == RT_NULL)
|
|
||||||
// {
|
|
||||||
// LOG_D("none");
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// LOG_D("--%d",netdev->flags);
|
|
||||||
// }
|
|
||||||
extern struct netdev *netdev_default;
|
extern struct netdev *netdev_default;
|
||||||
int rst = (netdev_default->flags & 0x01U) ? 1:0;
|
int rst = (netdev_default->flags & 0x01U) ? 1:0; //0x01 = NETDEV_FLAG_UP
|
||||||
// LOG_D("eth is %s.",rst?"up":"down");
|
// LOG_D("eth is %s.",rst?"up":"down");
|
||||||
|
// rst &= (netdev_default->flags & 0x04U) ? 1:0;//0x04 NETDEV_FLAG_LINK_UP
|
||||||
return rst;
|
return rst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,12 +179,12 @@ static void rulecheck(void)
|
|||||||
{
|
{
|
||||||
//默认为 TT连续5个周期为激活状态且信号强度不低于5。
|
//默认为 TT连续5个周期为激活状态且信号强度不低于5。
|
||||||
//满足加1,不满足清零
|
//满足加1,不满足清零
|
||||||
static rt_uint16_t okCnt=0;
|
static size_t okCnt=0;
|
||||||
if (!okCnt) {
|
if (!okCnt) {
|
||||||
LOG_D("当前规则为:连续%d个采集周期TT信号质量不低于%d",scfg.minTTPeriCnt,scfg.minTTsinal);
|
// LOG_D("当前规则为:连续%d个采集周期TT信号质量不低于%d",scfg.minTTPeriCnt,scfg.minTTsinal);
|
||||||
}
|
}
|
||||||
int xh=atoi(TTinfo->xh);
|
int xh=atoi(TTinfo->xh);
|
||||||
if (xh == 99) {
|
if (xh > 90) {
|
||||||
xh=0;
|
xh=0;
|
||||||
}
|
}
|
||||||
if (atoi(TTinfo->jh) && !(xh < scfg.minTTsinal) ) {//
|
if (atoi(TTinfo->jh) && !(xh < scfg.minTTsinal) ) {//
|
||||||
@ -193,13 +193,13 @@ static void rulecheck(void)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
okCnt = 0;
|
okCnt = 0;
|
||||||
// LOG_W("不符合。");
|
LOG_W("不符合。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (okCnt >= scfg.minTTPeriCnt) {
|
if (okCnt >= scfg.minTTPeriCnt) {
|
||||||
//TT具备发送条件
|
//TT具备发送条件
|
||||||
TTIsReady();
|
TTIsReady();
|
||||||
// LOG_I("符合规则,TT具备发送状态。");
|
LOG_I("符合规则,TT具备发送状态。");
|
||||||
okCnt = scfg.minTTPeriCnt -1;
|
okCnt = scfg.minTTPeriCnt -1;
|
||||||
}
|
}
|
||||||
// if (okCnt > minTTPeriCnt) {
|
// if (okCnt > minTTPeriCnt) {
|
||||||
@ -222,7 +222,7 @@ static void tt_parse(rt_uint8_t *data)
|
|||||||
root = cJSON_Parse((const char *) data);
|
root = cJSON_Parse((const char *) data);
|
||||||
if (!root)
|
if (!root)
|
||||||
{
|
{
|
||||||
rt_kprintf("No memory for cJSON root!\n");
|
LOG_W("JSON string is not ok, or No memory for cJSON root!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
object = cJSON_GetObjectItem(root, "data");
|
object = cJSON_GetObjectItem(root, "data");
|
||||||
@ -314,8 +314,7 @@ static int webclient_get_data(const char *url)
|
|||||||
LOG_D("webclient GET request response data :");
|
LOG_D("webclient GET request response data :");
|
||||||
LOG_D("%s", buffer);
|
LOG_D("%s", buffer);
|
||||||
|
|
||||||
|
if (buffer && length && buffer[length-1] == 0x7d) //0x7d='}'
|
||||||
if (buffer)
|
|
||||||
{
|
{
|
||||||
tt_parse(buffer);
|
tt_parse(buffer);
|
||||||
web_free(buffer);
|
web_free(buffer);
|
||||||
@ -414,8 +413,8 @@ uint8_t getXh(void)
|
|||||||
|
|
||||||
void repGetTT_thread_entry(void* parameter)
|
void repGetTT_thread_entry(void* parameter)
|
||||||
{
|
{
|
||||||
while(!isTCPok())//第一次运行时未上电则等待
|
// while(!isTCPok())//第一次运行时未上电则等待
|
||||||
{}
|
// {}
|
||||||
while(isTCPok())//中间未上电则退出
|
while(isTCPok())//中间未上电则退出
|
||||||
{
|
{
|
||||||
for (size_t var = 0; var < (sizeof(infoH) / sizeof(infoH[0])); var++) //轮询每个参数
|
for (size_t var = 0; var < (sizeof(infoH) / sizeof(infoH[0])); var++) //轮询每个参数
|
||||||
@ -430,6 +429,7 @@ void repGetTT_thread_entry(void* parameter)
|
|||||||
}
|
}
|
||||||
if (webclient_get_data(url) != RT_EOK)
|
if (webclient_get_data(url) != RT_EOK)
|
||||||
{
|
{
|
||||||
|
LOG_E("---------");
|
||||||
web_free(url);
|
web_free(url);
|
||||||
strcpy(TTinfo->sim,"-");
|
strcpy(TTinfo->sim,"-");
|
||||||
strcpy(TTinfo->xh,"-");
|
strcpy(TTinfo->xh,"-");
|
||||||
@ -460,6 +460,8 @@ void repGetTT_thread_entry(void* parameter)
|
|||||||
*/
|
*/
|
||||||
void repGetTT(void)
|
void repGetTT(void)
|
||||||
{
|
{
|
||||||
|
while(!isTCPok())//第一次运行时未上电则等待
|
||||||
|
{}
|
||||||
memset(rstInfo,0x3f,RST_LEN);//初始化
|
memset(rstInfo,0x3f,RST_LEN);//初始化
|
||||||
/* 创建 serial 线程 */
|
/* 创建 serial 线程 */
|
||||||
rt_thread_t thread = rt_thread_create("repGetTT", repGetTT_thread_entry, RT_NULL, 1024 * 3, 27, 10);
|
rt_thread_t thread = rt_thread_create("repGetTT", repGetTT_thread_entry, RT_NULL, 1024 * 3, 27, 10);
|
||||||
|
@ -37,6 +37,7 @@ int main(void)
|
|||||||
rt_pin_mode(LED_HEART, PIN_MODE_OUTPUT);
|
rt_pin_mode(LED_HEART, PIN_MODE_OUTPUT);
|
||||||
rt_pin_mode(LED_HEART_DEBUG, PIN_MODE_OUTPUT);
|
rt_pin_mode(LED_HEART_DEBUG, PIN_MODE_OUTPUT);
|
||||||
rt_pin_mode(ETH_RESET_PIN, PIN_MODE_OUTPUT);
|
rt_pin_mode(ETH_RESET_PIN, PIN_MODE_OUTPUT);
|
||||||
|
rt_pin_write(ETH_RESET_PIN, PIN_LOW);
|
||||||
|
|
||||||
rt_pin_mode(TT_EN, PIN_MODE_OUTPUT);
|
rt_pin_mode(TT_EN, PIN_MODE_OUTPUT);
|
||||||
rt_pin_write(TT_EN, PIN_LOW);
|
rt_pin_write(TT_EN, PIN_LOW);
|
||||||
@ -50,6 +51,7 @@ int main(void)
|
|||||||
// sysEventInit();
|
// sysEventInit();
|
||||||
if (isInWindowZone()) {//开机检查是否在开窗区间内,是则给TT开机
|
if (isInWindowZone()) {//开机检查是否在开窗区间内,是则给TT开机
|
||||||
initTT();
|
initTT();
|
||||||
|
setWindowMode();
|
||||||
// pwTT_thread_entry("1");
|
// pwTT_thread_entry("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void tcpRecMQ_thread_entry(void)
|
|||||||
{
|
{
|
||||||
// LOG_D("%d Bytes received.",msg.size);
|
// LOG_D("%d Bytes received.",msg.size);
|
||||||
// LOG_HEX("tcpTT", 16, msg.data, msg.size);
|
// LOG_HEX("tcpTT", 16, msg.data, msg.size);
|
||||||
resetTM();
|
// resetTM();
|
||||||
int result = rt_mq_send(&TTrx_mq, &msg, sizeof(msg));
|
int result = rt_mq_send(&TTrx_mq, &msg, sizeof(msg));
|
||||||
if (result == -RT_EFULL)
|
if (result == -RT_EFULL)
|
||||||
{
|
{
|
||||||
|
@ -327,12 +327,13 @@ rt_uint8_t pack_File(const char *fin, rt_uint8_t flag, const rt_uint8_t (*dout)[
|
|||||||
//crypt before pack
|
//crypt before pack
|
||||||
uint8_t tmp[200];
|
uint8_t tmp[200];
|
||||||
uint8_t len = cryptSingleMsg(buffer, block_size, tmp);
|
uint8_t len = cryptSingleMsg(buffer, block_size, tmp);
|
||||||
|
// LOG_HEX("crypt msg",16,tmp,len);
|
||||||
uint8_t col = packMsg(&cfg, tmp, len, dout[index]);
|
uint8_t col = packMsg(&cfg, tmp, len, dout[index]);
|
||||||
|
|
||||||
// uint8_t col = packMsg(&cfg, buffer, block_size, dout[index]);
|
// uint8_t col = packMsg(&cfg, buffer, block_size, dout[index]);
|
||||||
arrLen[index] = col;
|
arrLen[index] = col;
|
||||||
// LOG_D("index/row bef-aft");
|
// LOG_D("index/row bef-aft");
|
||||||
// LOG_D("%5d/%3d %3d-%3d",index+1,row,block_size,col);
|
// LOG_D("%5d/%3d %3d-%3d",index+1,row,len,col);
|
||||||
// LOG_HEX("per msg",27,dout[index],col);
|
// LOG_HEX("per msg",27,dout[index],col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
//#include "posix/string.h"
|
//#include "posix/string.h"
|
||||||
#include <dfs_file.h>
|
#include <dfs_file.h>
|
||||||
|
|
||||||
#define FRAME_DATA_LEN_MAX (180-16)
|
#define FRAME_DATA_LEN_MAX (180-10-20)
|
||||||
#define STR_LEN_MAX 30
|
#define STR_LEN_MAX 30
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -635,9 +635,11 @@ int rt_hw_stm32_eth_init(void)
|
|||||||
if (tid != RT_NULL)
|
if (tid != RT_NULL)
|
||||||
{
|
{
|
||||||
rt_thread_startup(tid);
|
rt_thread_startup(tid);
|
||||||
|
// LOG_I("√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// LOG_E("----------------------------------");
|
||||||
state = -RT_ERROR;
|
state = -RT_ERROR;
|
||||||
}
|
}
|
||||||
__exit:
|
__exit:
|
||||||
@ -675,9 +677,10 @@ void rt_hw_stm32_eth_deinit()
|
|||||||
// HAL_ETH_DeInit(&EthHandle);
|
// HAL_ETH_DeInit(&EthHandle);
|
||||||
rt_timer_delete(stm32_eth_device.poll_link_timer);
|
rt_timer_delete(stm32_eth_device.poll_link_timer);
|
||||||
eth_device_deinit(&(stm32_eth_device.parent));
|
eth_device_deinit(&(stm32_eth_device.parent));
|
||||||
|
rt_pin_write(ETH_RESET_PIN, PIN_LOW);
|
||||||
if (Rx_Buff)
|
if (Rx_Buff)
|
||||||
{
|
{
|
||||||
|
|
||||||
rt_free(Rx_Buff);
|
rt_free(Rx_Buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,9 +698,15 @@ void rt_hw_stm32_eth_deinit()
|
|||||||
{
|
{
|
||||||
rt_free(DMATxDscrTab);
|
rt_free(DMATxDscrTab);
|
||||||
}
|
}
|
||||||
|
HAL_ETH_DeInit(&EthHandle);
|
||||||
|
__HAL_RCC_ETH_CLK_DISABLE() ;
|
||||||
}
|
}
|
||||||
MSH_CMD_EXPORT(rt_hw_stm32_eth_deinit, 去初始化网络。);
|
MSH_CMD_EXPORT(rt_hw_stm32_eth_deinit, 去初始化网络。);
|
||||||
|
void setLinkUp()
|
||||||
|
{
|
||||||
|
/* send link up. */
|
||||||
|
eth_device_linkchange(&stm32_eth_device.parent, RT_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
//INIT_DEVICE_EXPORT(rt_hw_stm32_eth_init);
|
//INIT_DEVICE_EXPORT(rt_hw_stm32_eth_init);
|
||||||
//MSH_CMD_EXPORT(rt_hw_stm32_eth_init, 初始化网络。);
|
//MSH_CMD_EXPORT(rt_hw_stm32_eth_init, 初始化网络。);
|
||||||
|
Loading…
Reference in New Issue
Block a user