| | |
| | | * 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) |
| | |
| | | else |
| | | { |
| | | return -1; |
| | | temp6=1; |
| | | } |
| | | case ABORT1: |
| | | case ABORT2: |
| | | return 1; |
| | | default: |
| | | temp7=1; |
| | | return -1; |
| | | } |
| | | *data = c;//放到1024+5字节的包里面 |
| | |
| | | { |
| | | if (Receive_Byte(data + i2, timeout) != 0)//不断的接收1024字节放入 |
| | | { |
| | | temp8=1; |
| | | return -1; |
| | | } |
| | | } |
| | |
| | | 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) |
| | | { |
| | | |
| | |
| | | /* End session */ |
| | | Send_Byte(CA); |
| | | Send_Byte(CA); |
| | | temp1=1; |
| | | return -1; |
| | | } |
| | | /* erase user application area */ |
| | |
| | | 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 |
| | |
| | | /* End session */ |
| | | Send_Byte(CA); |
| | | Send_Byte(CA); |
| | | temp2=1; |
| | | return -2; |
| | | } |
| | | } |
| | |
| | | case 1: |
| | | Send_Byte(CA); |
| | | Send_Byte(CA); |
| | | temp3=1; |
| | | return -3; |
| | | default://检验错误 |
| | | if (session_begin > 0) |
| | |
| | | { |
| | | Send_Byte(CA); |
| | | Send_Byte(CA); |
| | | temp4=1; |
| | | return 0; |
| | | } |
| | | |
| | | Send_Byte(CRC16); //发送校验值 |
| | | temp9=1; |
| | | break; |
| | | } |
| | | |