/**
  ***********************************************************
  * You can change the value in usb_desc.h in order to config
  * the endpoint transmit. When usb insert, something will be
  * init in function "usb_insert_callback", you can init what
  * you want. And the function "usb_event_process" will be
  * executed continuously in USB mode.
  * Note: usb will use the PB3 and PB4, so you need to change
  * the printer IO if you need.
  ***********************************************************
  */
#ifndef _USB_TRANSFER_H
#define _USB_TRANSFER_H

#include "include.h"

typedef struct __attribute__((packed)){
    u16 remote_ver;
    u32 total_len;//每此写的长度
    u32 sum_len;//升级文件的总长度
    u32 remain_len;\
    u32 rec_len;
    u32 hash;
    u16 data_pos;
    u8 fot_recv_ok;
    u8 fot_cmd_flag;
    u32 addr;
    u32 tick;
}fot_s;
extern fot_s fot_var;
extern u8 fot_data[512];

void usb_insert_callback(void);
void usb_event_process(void);
void usb_upgrade(u8 *upgrade_buf, u8 upgrade_len);

#endif // _USB_TRANSFER_H
