WXK
2025-03-03 82eaf74eda0c8ee343bd8a5bbf3f75b3b6ae4a87
keil/ymodem.c
@@ -253,14 +253,14 @@
  *         1: abort by user
  */
uint16_t current_seqno,flash_seqno,i2;
uint8_t c;
uint8_t c,temp5,temp6,temp7,temp8,temp9,temp10,temp11,temp12;
static int32_t Receive_Packet (uint8_t *data, int32_t *length, uint32_t timeout)
{
  uint16_t packet_size, computedcrc;
  
  *length = 0;
  if (Receive_Byte(&c, timeout) != 0)//返回0成功收取数据,-1为没收到数据
  {
  {temp5=1;
    return -1;
  }
  switch (c)
@@ -282,11 +282,13 @@
      else
      {
        return -1;
            temp6=1;
      }
    case ABORT1:
    case ABORT2:
      return 1;
    default:
         temp7=1;
      return -1;
  }
  *data = c;//放到1024+5字节的包里面
@@ -294,6 +296,7 @@
  {
    if (Receive_Byte(data + i2, timeout) != 0)//不断的接收1024字节放入
    {
         temp8=1;
      return -1;
    }
  }
@@ -339,6 +342,7 @@
uint8_t temp111[256];
uint8_t tempchangdu;
extern uint8_t Get_anchor_appdata_num;
uint8_t temp1,temp2,temp3,temp4;
int32_t Ymodem_Receive (uint8_t *buf)
{  
@@ -403,6 +407,7 @@
                      /* End session */
                      Send_Byte(CA);
                      Send_Byte(CA);
                                 temp1=1;
                      return -1;
                    }
                    /* erase user application area */
@@ -411,6 +416,7 @@
                              flash_erase(FLASH_ID0, APP_CONFIG_APPLICATION_ADDRESS, APP_CONFIG_APPLICATION_SIZE);//擦除APP
                    Send_Byte(ACK);
                    Send_Byte(CRC16);
                              temp10=1;
                  }
                  /* Filename packet is empty, end session */
                  else
@@ -451,6 +457,7 @@
                            /* End session */
                            Send_Byte(CA);
                            Send_Byte(CA);
                                          temp2=1;
                            return -2;
                        }
                }
@@ -462,6 +469,7 @@
        case 1:
          Send_Byte(CA);
          Send_Byte(CA);
               temp3=1;
          return -3;
        default://检验错误
          if (session_begin > 0)
@@ -472,10 +480,12 @@
          {
            Send_Byte(CA);
            Send_Byte(CA);
                  temp4=1;
            return 0;
          }
            
          Send_Byte(CRC16); //发送校验值
               temp9=1;
          break;
      }