diff --git a/ReadMe.txt b/ReadMe.txt index d22ff29..44304b1 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -5,4 +5,6 @@ 电机控制、按键、ADC在M4上实现 2023.6.27 在m4上使用定时器,实现pwm控制的时候没有找到光感输入脚 - 如果发现程序不能运行,检查RTE文件 \ No newline at end of file + 如果发现程序不能运行,检查RTE文件 +2023.7.14 + 使用单线程方式执行命令 \ No newline at end of file diff --git a/checker_m4.uvoptx b/checker_m4.uvoptx index 1238780..ff5fa8e 100644 --- a/checker_m4.uvoptx +++ b/checker_m4.uvoptx @@ -103,7 +103,7 @@ 1 0 0 - 0 + 4 @@ -114,9 +114,14 @@ - BIN\UL2CM3.DLL + Segger\JL2CM3.dll + + 0 + JL2CM3 + -U -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD10020000 -FC1000 -FN0 + 0 UL2CM3 @@ -290,6 +295,18 @@ 0 0 + + 1 + 10 + 1 + 0 + 0 + 0 + .\source\main\mymain.c + mymain.c + 0 + 0 + @@ -300,7 +317,7 @@ 0 2 - 10 + 11 2 0 0 @@ -320,7 +337,7 @@ 0 3 - 11 + 12 1 0 0 @@ -332,7 +349,7 @@ 3 - 12 + 13 2 0 0 @@ -344,7 +361,7 @@ 3 - 13 + 14 1 0 0 @@ -356,7 +373,7 @@ 3 - 14 + 15 1 0 0 @@ -368,7 +385,7 @@ 3 - 15 + 16 1 0 0 @@ -380,7 +397,7 @@ 3 - 16 + 17 1 0 0 @@ -392,7 +409,7 @@ 3 - 17 + 18 1 0 0 @@ -404,7 +421,7 @@ 3 - 18 + 19 1 0 0 @@ -416,7 +433,7 @@ 3 - 19 + 20 1 0 0 @@ -428,7 +445,7 @@ 3 - 20 + 21 1 0 0 @@ -440,7 +457,7 @@ 3 - 21 + 22 1 0 0 @@ -452,7 +469,7 @@ 3 - 22 + 23 1 0 0 @@ -464,7 +481,7 @@ 3 - 23 + 24 1 0 0 @@ -476,7 +493,7 @@ 3 - 24 + 25 1 0 0 @@ -488,7 +505,7 @@ 3 - 25 + 26 1 0 0 @@ -500,7 +517,7 @@ 3 - 26 + 27 1 0 0 @@ -512,7 +529,7 @@ 3 - 27 + 28 1 0 0 @@ -524,7 +541,7 @@ 3 - 28 + 29 1 0 0 @@ -536,7 +553,7 @@ 3 - 29 + 30 1 0 0 @@ -556,7 +573,7 @@ 0 4 - 30 + 31 1 0 0 @@ -568,7 +585,7 @@ 4 - 31 + 32 1 0 0 @@ -580,7 +597,7 @@ 4 - 32 + 33 1 0 0 @@ -592,7 +609,7 @@ 4 - 33 + 34 1 0 0 @@ -604,7 +621,7 @@ 4 - 34 + 35 1 0 0 @@ -616,7 +633,7 @@ 4 - 35 + 36 1 0 0 @@ -628,7 +645,7 @@ 4 - 36 + 37 1 0 0 @@ -640,7 +657,7 @@ 4 - 37 + 38 1 0 0 @@ -652,7 +669,7 @@ 4 - 38 + 39 1 0 0 @@ -664,7 +681,7 @@ 4 - 39 + 40 1 0 0 @@ -676,7 +693,7 @@ 4 - 40 + 41 1 0 0 @@ -688,7 +705,7 @@ 4 - 41 + 42 1 0 0 @@ -700,7 +717,7 @@ 4 - 42 + 43 1 0 0 @@ -712,7 +729,7 @@ 4 - 43 + 44 1 0 0 @@ -732,7 +749,7 @@ 0 5 - 44 + 45 1 0 0 @@ -744,7 +761,7 @@ 5 - 45 + 46 1 0 0 @@ -756,7 +773,7 @@ 5 - 46 + 47 1 0 0 @@ -768,7 +785,7 @@ 5 - 47 + 48 1 0 0 @@ -780,7 +797,7 @@ 5 - 48 + 49 1 0 0 @@ -792,7 +809,7 @@ 5 - 49 + 50 1 0 0 @@ -804,7 +821,7 @@ 5 - 50 + 51 1 0 0 @@ -816,7 +833,7 @@ 5 - 51 + 52 1 0 0 @@ -828,7 +845,7 @@ 5 - 52 + 53 1 0 0 @@ -840,7 +857,7 @@ 5 - 53 + 54 1 0 0 @@ -852,7 +869,7 @@ 5 - 54 + 55 1 0 0 @@ -864,7 +881,7 @@ 5 - 55 + 56 1 0 0 @@ -876,7 +893,7 @@ 5 - 56 + 57 1 0 0 @@ -888,7 +905,7 @@ 5 - 57 + 58 1 0 0 @@ -900,7 +917,7 @@ 5 - 58 + 59 1 0 0 @@ -912,7 +929,7 @@ 5 - 59 + 60 1 0 0 @@ -924,7 +941,7 @@ 5 - 60 + 61 1 0 0 @@ -936,7 +953,7 @@ 5 - 61 + 62 1 0 0 @@ -948,7 +965,7 @@ 5 - 62 + 63 1 0 0 @@ -968,7 +985,7 @@ 0 6 - 63 + 64 1 0 0 @@ -980,7 +997,7 @@ 6 - 64 + 65 1 0 0 @@ -992,7 +1009,7 @@ 6 - 65 + 66 1 0 0 @@ -1012,7 +1029,7 @@ 0 7 - 66 + 67 1 0 0 @@ -1032,7 +1049,7 @@ 0 8 - 67 + 68 1 0 0 @@ -1044,7 +1061,7 @@ 8 - 68 + 69 1 0 0 @@ -1056,7 +1073,7 @@ 8 - 69 + 70 1 0 0 @@ -1068,7 +1085,7 @@ 8 - 70 + 71 1 0 0 @@ -1080,7 +1097,7 @@ 8 - 71 + 72 1 0 0 @@ -1092,7 +1109,7 @@ 8 - 72 + 73 1 0 0 @@ -1104,7 +1121,7 @@ 8 - 73 + 74 1 0 0 @@ -1116,7 +1133,7 @@ 8 - 74 + 75 1 0 0 @@ -1128,7 +1145,7 @@ 8 - 75 + 76 1 0 0 @@ -1140,7 +1157,7 @@ 8 - 76 + 77 1 0 0 @@ -1152,7 +1169,7 @@ 8 - 77 + 78 1 0 0 @@ -1172,7 +1189,7 @@ 0 9 - 78 + 79 1 0 0 @@ -1184,7 +1201,7 @@ 9 - 79 + 80 1 0 0 @@ -1196,7 +1213,7 @@ 9 - 80 + 81 1 0 0 diff --git a/checker_m4.uvprojx b/checker_m4.uvprojx index 5b2e568..fdd4b9d 100644 --- a/checker_m4.uvprojx +++ b/checker_m4.uvprojx @@ -134,11 +134,11 @@ 0 1 1 - -1 + 4096 1 BIN\UL2CM3.DLL - + "" () @@ -427,6 +427,11 @@ 1 .\source\main\system_stm32mp1xx.c + + mymain.c + 1 + .\source\main\mymain.c + @@ -441,6 +446,75 @@ rtthread + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + cpuport.c @@ -536,6 +610,57 @@ core_delay.c 1 .\source\rt_thread\core_delay.c + + + 2 + 0 + 0 + 0 + 0 + 1 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + @@ -611,6 +736,57 @@ stm32mp1xx_hal_tim.c 1 .\source\stm32lib\STM32MP1xx_HAL_Driver\Src\stm32mp1xx_hal_tim.c + + + 2 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + @@ -716,6 +892,75 @@ interface + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + if_pwm.c @@ -746,6 +991,75 @@ soft + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + buff.c @@ -806,6 +1120,75 @@ task + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + key.c diff --git a/source/main/main.c b/source/main/main.c index 1036317..ec458c7 100644 --- a/source/main/main.c +++ b/source/main/main.c @@ -26,6 +26,8 @@ /* USER CODE BEGIN Includes */ #include "debug.h" #include "board.h" +#include "mymain.h" +#include "string.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -66,6 +68,17 @@ static void MX_IPCC_Init(void); /* USER CODE BEGIN PFP */ void VIRT_UART0_RxCpltCallback(VIRT_UART_HandleTypeDef *huart); void VIRT_UART1_RxCpltCallback(VIRT_UART_HandleTypeDef *huart); + +void send_str_to_a7(const char *str) +{ + static uint8_t send_buff[512]; + int len=strlen(str); + send_buff[0]=0xff; + send_buff[1]=len; + memcpy(send_buff+2,str,len); + VIRT_UART_Transmit(&huart0, send_buff, len+2); +} + /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ @@ -79,12 +92,12 @@ void VIRT_UART1_RxCpltCallback(VIRT_UART_HandleTypeDef *huart); int main(void) { /* USER CODE BEGIN 1 */ - debug_init(); + //debug_init(); /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ - DBG_LOG("mcu start."); + //DBG_LOG("mcu start."); /* Reset of all peripherals, Initialize the Systick. */ HAL_Init(); @@ -141,10 +154,8 @@ int main(void) Error_Handler(); } - pwm_def *pwm=dev_get("pwm"); - pwm->init(pwm); - DBG_LOG("pwm start."); - pwm->start(pwm,1); + void *mymain=mymain_init(); + /* USER CODE END 2 */ /* Infinite loop */ @@ -153,11 +164,13 @@ int main(void) { OPENAMP_check_for_message(); - + mymain_scan(mymain); /* USER CODE END WHILE */ if (VirtUart0RxMsg) { VirtUart0RxMsg = RESET; + // +2֡ͷͳλ VIRT_UART_Transmit(&huart0, VirtUart0ChannelBuffRx, VirtUart0ChannelRxSize); + mymain_loop(mymain,(char *)VirtUart0ChannelBuffRx+2); } if (VirtUart1RxMsg) { @@ -307,6 +320,7 @@ void VIRT_UART0_RxCpltCallback(VIRT_UART_HandleTypeDef *huart) /* copy received msg in a variable to sent it back to master processor in main infinite loop*/ VirtUart0ChannelRxSize = huart->RxXferSize < MAX_BUFFER_SIZE? huart->RxXferSize : MAX_BUFFER_SIZE-1; memcpy(VirtUart0ChannelBuffRx, huart->pRxBuffPtr, VirtUart0ChannelRxSize); + VirtUart0ChannelBuffRx[VirtUart0ChannelRxSize]=0; VirtUart0RxMsg = SET; } @@ -318,6 +332,7 @@ void VIRT_UART1_RxCpltCallback(VIRT_UART_HandleTypeDef *huart) /* copy received msg in a variable to sent it back to master processor in main infinite loop*/ VirtUart1ChannelRxSize = huart->RxXferSize < MAX_BUFFER_SIZE? huart->RxXferSize : MAX_BUFFER_SIZE-1; memcpy(VirtUart1ChannelBuffRx, huart->pRxBuffPtr, VirtUart1ChannelRxSize); + VirtUart1ChannelBuffRx[VirtUart1ChannelRxSize]=0; VirtUart1RxMsg = SET; } /* USER CODE END 4 */ diff --git a/source/main/mymain.c b/source/main/mymain.c new file mode 100644 index 0000000..727a247 --- /dev/null +++ b/source/main/mymain.c @@ -0,0 +1,284 @@ +#include "mymain.h" +#include "main.h" +#include "board.h" +#include "debug.h" +#include "core_delay.h" +#include "string.h" +#include "stdio.h" + + +typedef struct{ + pwm_def *pwm; + int key_old; + int key; + int sen; + char str_buff[200]; +}mymain_def; + +static mymain_def g_m={0}; + +void *mymain_init(void) +{ + + delay_init(); +// m.pwm=dev_get("pwm"); +// m.pwm->init(m.pwm); + //DBG_LOG("pwm start."); +// m.pwm->start(m.pwm,1); + GPIO_InitTypeDef init={0}; + __HAL_RCC_GPIOF_CLK_ENABLE(); + __HAL_RCC_GPIOE_CLK_ENABLE(); + __HAL_RCC_GPIOH_CLK_ENABLE(); + __HAL_RCC_GPIOG_CLK_ENABLE(); + __HAL_RCC_GPIOI_CLK_ENABLE(); + + + // + init.Mode = GPIO_MODE_OUTPUT_PP; + init.Pull = GPIO_PULLUP; + init.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9; + PERIPH_LOCK(GPIOF); + HAL_GPIO_Init(GPIOF, &init); + HAL_GPIO_WritePin(GPIOF,GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9,GPIO_PIN_RESET); + PERIPH_UNLOCK(GPIOF); + + + // λ + init.Mode = GPIO_MODE_INPUT; + init.Pull = GPIO_NOPULL; + init.Pin = GPIO_PIN_6; + PERIPH_LOCK(GPIOI); + HAL_GPIO_Init(GPIOI, &init); + PERIPH_UNLOCK(GPIOI); + + // + init.Mode = GPIO_MODE_INPUT; + init.Pull = GPIO_NOPULL; + init.Pin = GPIO_PIN_3; + PERIPH_LOCK(GPIOG); + HAL_GPIO_Init(GPIOG, &init); + PERIPH_UNLOCK(GPIOG); + + // + init.Mode = GPIO_MODE_INPUT; + init.Pull = GPIO_NOPULL; + init.Pin = GPIO_PIN_1|GPIO_PIN_6; + PERIPH_LOCK(GPIOE); + HAL_GPIO_Init(GPIOE, &init); + PERIPH_UNLOCK(GPIOE); + init.Mode = GPIO_MODE_INPUT; + init.Pull = GPIO_NOPULL; + init.Pin = GPIO_PIN_8|GPIO_PIN_9; + PERIPH_LOCK(GPIOH); + HAL_GPIO_Init(GPIOH, &init); + PERIPH_UNLOCK(GPIOH); + + return &g_m; +} + + +void send_str_to_a7(const char *str); + + +// 1=PF9;2=PF8;3=PF7 +void out_set(int index,int power) +{ + mymain_def *m=&g_m; + PERIPH_LOCK(GPIOF); + HAL_GPIO_WritePin(GPIOF,1<<(10-index),power?GPIO_PIN_SET:GPIO_PIN_RESET); + PERIPH_UNLOCK(GPIOF); + sprintf(m->str_buff,"out_set:%d,%d",index,power); + send_str_to_a7(m->str_buff); +} + + + +// һ +void moter_plused(int us) +{ + // out3 + //HAL_GPIO_TogglePin(GPIOF,1<<7); + // out1 + HAL_GPIO_TogglePin(GPIOF,1<<9); + delay_us(us); +} + + + +// PF7-PWM PF8-DST PI6_STOP +// ͵ƽ£Ϊ +void moter_run(int pwm,int count) +{ + int use_sen=0; + if(count>0){ + HAL_GPIO_WritePin(GPIOF,1<<8,GPIO_PIN_RESET); + }else{ + HAL_GPIO_WritePin(GPIOF,1<<8,GPIO_PIN_SET); + count=-count; + use_sen=1; + } + int max_=500; + int min_=35; + int temp=max_; + int add_count=0; + int step_sub=0; + for(int i=0;imin_) {step_sub+=temp; if(step_sub>=1000) {temp--; step_sub=0;}} + else add_count++; + }else{ + if(add_count>0) add_count--; + else {step_sub+=temp; if(step_sub>=1000) {temp++; step_sub=0;}} + } + }else{ + // pwm!=0ʱ + temp=1000000/pwm; + } + } + // out3 + //HAL_GPIO_WritePin(GPIOF,1<<7,GPIO_PIN_SET); + // out1 + HAL_GPIO_WritePin(GPIOF,1<<9,GPIO_PIN_SET); +} + + + + + + + +static int str_ainttoi(const char *s) +{ + int ret=0; + int sig=1; + if(*s=='-'){ + s++; + sig=-1; + } + while(*s) + { + if(*s>='0'&&*s<='9') + { + ret*=10; + ret+=*s-'0'; + } + else return ret*sig; + s++; + } + return ret*sig; +} + + + + + + + +void mymain_scan(void *mymain) +{ + mymain_def *m=mymain; + m->key=HAL_GPIO_ReadPin(GPIOG,1<<3); + m->sen=HAL_GPIO_ReadPin(GPIOI,1<<6); + if(m->key_old!=m->key){ + if(m->key==RESET) + { + send_str_to_a7("key press"); + }else + { + send_str_to_a7("key up"); + } + m->key_old=m->key; + } +} + + +int read_sw(void *mymain) +{ + int ret=0; + ret|=HAL_GPIO_ReadPin(GPIOE,1<<6); + ret|=HAL_GPIO_ReadPin(GPIOH,1<<9)<<1; + ret|=HAL_GPIO_ReadPin(GPIOE,1<<1)<<2; + ret|=HAL_GPIO_ReadPin(GPIOH,1<<8)<<3; + return ret; +} + + + + +void mymain_loop(void *mymain,char *cmd_str) +{ + mymain_def *m=mymain; + if(strncmp(cmd_str,"moter ",6)==0) + { + // ½ + int count=str_ainttoi(cmd_str+6); + if(count!=0){ + send_str_to_a7(m->str_buff); + moter_run(0,count); + if(count>0){ + send_str_to_a7("moter down"); + }else{ + send_str_to_a7("moter up"); + } + } + }else if(strncmp(cmd_str,"moterinit",9)==0) + { + // ʼ + moter_run(2000,-25000); + send_str_to_a7("moterinited"); + } + else if(strncmp(cmd_str,"motertest ",10)==0) + { + // ʼ + int count=str_ainttoi(cmd_str+10); + moter_run(2000,count); + send_str_to_a7("motertest end"); + } + else if(strncmp(cmd_str,"readsw",6)==0) + { + int sw=read_sw(mymain); + sprintf(m->str_buff,"readsw %d",sw); + send_str_to_a7(m->str_buff); + } + else if(strncmp(cmd_str,"readkey",7)==0){ + if(m->key) + send_str_to_a7("key up"); + else + send_str_to_a7("key press"); + } + else if(strncmp(cmd_str,"readsen",7)==0){ + // + if(m->sen) + send_str_to_a7("sen high"); + else + send_str_to_a7("sen low"); + } + else if(strncmp(cmd_str,"out",3)==0){ + if((cmd_str[3]>='1')&&(cmd_str[3]<='3')){ + if(strncmp(cmd_str+5,"on",2)==0){ + out_set(cmd_str[3]-'0',1); + }else if(strncmp(cmd_str+5,"off",3)==0){ + out_set(cmd_str[3]-'0',0); + } + } + } +} + + +void mymain_loop__(void *mymain,char *cmd_str) +{ + while(1){ + HAL_GPIO_TogglePin(GPIOF,1<<7); + HAL_GPIO_TogglePin(GPIOF,1<<8); + HAL_GPIO_TogglePin(GPIOF,1<<9); + HAL_Delay(2000); + } +} + + diff --git a/source/main/mymain.h b/source/main/mymain.h new file mode 100644 index 0000000..81cb022 --- /dev/null +++ b/source/main/mymain.h @@ -0,0 +1,23 @@ + +#ifndef mymain_h__ +#define mymain_h__ + + + + +void *mymain_init(void); + + + +void mymain_loop(void *mymain,char *cmd_str); + + + + + + + + +#endif + + diff --git a/source/main/stm32mp1xx_it.c b/source/main/stm32mp1xx_it.c index 55be38e..7918eb1 100644 --- a/source/main/stm32mp1xx_it.c +++ b/source/main/stm32mp1xx_it.c @@ -182,16 +182,16 @@ void DebugMon_Handler(void) /** * @brief This function handles System tick timer. */ -//void SysTick_Handler(void) -//{ -// /* USER CODE BEGIN SysTick_IRQn 0 */ +void SysTick_Handler(void) +{ + /* USER CODE BEGIN SysTick_IRQn 0 */ -// /* USER CODE END SysTick_IRQn 0 */ -// HAL_IncTick(); -// /* USER CODE BEGIN SysTick_IRQn 1 */ + /* USER CODE END SysTick_IRQn 0 */ + HAL_IncTick(); + /* USER CODE BEGIN SysTick_IRQn 1 */ -// /* USER CODE END SysTick_IRQn 1 */ -//} + /* USER CODE END SysTick_IRQn 1 */ +} /******************************************************************************/ /* STM32MP1xx Peripheral Interrupt Handlers */ diff --git a/source/task/commend.c b/source/task/commend.c index d86715b..18ec807 100644 --- a/source/task/commend.c +++ b/source/task/commend.c @@ -84,7 +84,7 @@ int cmd_print(const char *fmt,...) s->data[length]=0; array_def *arr=arr_creat(); arr_appends(arr,s->data,length); - emit cmd_reply_signal(s,0,arr_temp(arr)); + //emit cmd_reply_signal(s,0,arr_temp(arr)); return length; } diff --git a/source/task/moter.c b/source/task/moter.c index 69b7098..11eb468 100644 --- a/source/task/moter.c +++ b/source/task/moter.c @@ -74,7 +74,7 @@ static void moter_run(void *t) } s->stat=STOP; DBG_LOG("moter stoped."); - emit moter_end_signal(s); + //emit moter_end_signal(s); if(s->fun_in_end){ s->fun_in_end(s->t); s->fun_in_end=0;