40 #define __FILE_ID__ "yprog" 42 #ifdef YAPI_IN_YDEVICE 43 #include "Yocto/yocto.h" 46 #include <Yocto/yapi_ext.h> 60 #ifndef YAPI_IN_YDEVICE 81 memset(&fctx, 0,
sizeof(fctx));
83 memset(&firm_dev, 0,
sizeof(firm_dev));
112 memset(&fctx, 0,
sizeof(fctx));
126 #ifndef MICROCHIP_API 128 return "PIC24FJ128DA206";
130 return "PIC24FJ128DA106";
132 return "PIC24FJ128DA210";
134 return "PIC24FJ128DA110";
136 return "PIC24FJ256DA206";
138 return "PIC24FJ256DA106";
140 return "PIC24FJ256DA210";
142 return "PIC24FJ256DA110";
144 res =
"Unknown CPU model(family PIC24FJ256DA210)";
148 return "PIC24FJ256DA206";
155 #ifndef MICROCHIP_API 157 return "PIC24FJ32GB002";
159 return "PIC24FJ64GB002";
161 return "PIC24FJ32GB004";
163 return "PIC24FJ64GB004";
165 res=
"Unknown CPU model(family PIC24FJ64GB004)";
169 return "PIC24FJ64GB002";
208 switch(head->
h.
rev) {
258 switch(head->
h.
rev) {
271 #ifndef YBUILD_PATCH_WITH_BUILD 291 #ifndef YBUILD_PATCH_WITH_BUILD 292 if ((flags & YPROG_FORCE_FW_UPDATE) == 0 && head->
v6.
prog_version[0]){
326 #ifndef MICROCHIP_API 340 if(memcmp(md5res, head->
v6.
md5chk, 16)) {
348 #ifdef CPU_BIG_ENDIAN 350 #define BSWAP_U16(NUM) (((NUM )>> 8) | ((NUM) << 8)) 351 #define BSWAP_U32(NUM) ((((NUM) >> 24) & 0xff) | (((NUM) << 8) & 0xff0000) | (((NUM) >> 8) & 0xff00) | (((NUM) << 24) & 0xff000000 )) 356 head->
h.
rev = BSWAP_U16(head->
h.
rev);
357 switch (head->
h.
rev) {
379 zone->
len = BSWAP_U32(zone->
len);
385 #if !defined(MICROCHIP_API) 421 #if !defined(MICROCHIP_API) 473 for(i=0, curif = runifaces ; i < nbifaces ; i++, curif++){
478 if(name !=NULL &&
YSTRICMP(curif->devicePath,name)==0){
501 #ifndef YAPI_IN_YDEVICE 510 if (
YFOPEN(&f, filename,
"rb") != 0) {
513 fseek(f, 0, SEEK_END);
514 size = (int)ftell(f);
515 if (size > 0x100000 || size <= 0){
524 fseek(f, 0, SEEK_SET);
525 readed = (int)fread(ptr, 1, size, f);
527 if (readed != size) {
540 memcpy(dst, fctx.
firmware + ofs, size);
548 #ifdef YAPI_IN_YDEVICE 550 #define ulogU16 ylogU16 551 #define ulogChar ylogChar 552 #define uLogProgress(msg) yProgLogProgress(msg) 564 #define ytime() ((u32) yapiGetTickCount()) 565 #define Flash_ready() 1 566 #define ulog(str) dbglog("%s",str) 567 #define ulogU16(val) dbglog("%x",val) 568 #define ulogChar(val) dbglog("%c",val) 571 #define setOsGlobalProgress(prog, msg) osProgLogProgressEx(__FILE_ID__,__LINE__, prog, msg) 572 #define uLogProgress(msg) yProgLogProgress(msg) 590 if (msg != NULL && *msg != 0){
591 #ifdef DEBUG_FIRMWARE 592 dbglog(
"%s:%d:(%d%%) %s\n", fileid, line, prog, msg);
604 #define uGetBootloader(serial,ifaceptr) yGetBootloaderPort(serial,ifaceptr) 606 #define uGetBootloader(serial,ifaceptr) yUSBGetBooloader(serial, NULL, ifaceptr,NULL) 625 #ifdef DEBUG_FIRMWARE 626 ulog(
"Cannot send GetInfo pkt\n");
639 #ifdef DEBUG_FIRMWARE 640 ulog(
"Bootloader did not respond to GetInfo pkt\n");
651 #ifdef DEBUG_FIRMWARE 652 ulog(
"PROG_INFO received\n");
663 #ifndef MICROCHIP_API 673 #ifndef MICROCHIP_API 675 #ifdef DEBUG_FIRMWARE 676 ulog(
"PROG_INFO_EXT received\n");
697 #ifdef DEBUG_FIRMWARE 698 ulog(
"Not a PROG_INFO pkt\n");
704 #ifdef DEBUG_FIRMWARE 706 ulog(
"invalid step in uGetDeviceInfo\n");
726 fctx.
stepA = nextState;
745 #if defined(DEBUG_FIRMWARE) 753 u32toa(fctx.
zOfs, p);
793 fctx.
zOfs += datasize;
807 #if defined(DEBUG_FIRMWARE) && !defined(MICROCHIP_API) 840 #ifndef MICROCHIP_API 852 fctx.
stepA = nextState;
867 fctx.
stepA = nextState;
890 #ifdef DEBUG_FIRMWARE 909 #ifdef DEBUG_FIRMWARE 910 dbglog(
"Drop ROM data past firmware boundary (zone %d at offset %x)\n", fctx.
currzone, fctx.
zOfs);
932 #ifdef DEBUG_FIRMWARE 937 dbglog(
"Flash at 0x%x:0x%x (0x%x bytes) found at 0x%x (0x%x more in zone)\n",page, pos,
943 dbglog(
"Unable to send prog pkt\n");
947 fctx.
zOfs += datasize;
948 fctx.
stepB += datasize;
962 dbglog(
"Unable to send verif pkt\n");
972 #ifdef DEBUG_FIRMWARE 981 dbglog(
"Invalid verif pkt\n");
986 #ifdef DEBUG_FIRMWARE 987 dbglog(
"Verif at 0x%x:0x%x (up to 0x%x bytes)\n",pageno,
1000 if(memcmp(buff, firm_pkt.
prog.
pkt_ext.
opt.data, datasize) != 0) {
1001 dbglog(
"Flash verification failed at %x (%x:%x)\n", addr, pageno, addr);
1005 #ifdef DEBUG_FIRMWARE 1007 dbglog(
"Skip verification for block at addr 0x%x (block ends at %x)\n", addr, fctx.
bz.
addr_page + fctx.
stepB);
1021 #ifdef DEBUG_FIRMWARE 1022 dbglog(
"Drop ROM data past firmware boundary (zone %d at offset %x)\n", fctx.
currzone, fctx.
zOfs);
1027 if(fctx.
bz.
len == 0){
1030 #ifdef DEBUG_FIRMWARE 1036 #ifdef DEBUG_FIRMWARE 1066 #ifndef MICROCHIP_API 1072 #ifdef DEBUG_FIRMWARE 1073 ulog(
"device not present\n");
1080 #if defined(DEBUG_FIRMWARE) && defined(MICROCHIP_API) 1081 ulog(
"Bootloader ");
1084 #ifdef MICROCHIP_API 1091 #ifndef MICROCHIP_API 1106 #ifdef DEBUG_FIRMWARE 1107 ulog(
"uGetDeviceInfo failed\n");
1114 #ifdef DEBUG_FIRMWARE 1117 ulog(
" detected\n");
1121 #ifdef DEBUG_FIRMWARE 1122 ulog(
"ValidateBynCompat failed:");
1130 switch(head.
h.
rev) {
1150 #ifdef DEBUG_FIRMWARE 1151 ulog(
"Unsupported file format (upgrade our VirtualHub)\n");
1158 #ifndef MICROCHIP_API 1163 #ifdef DEBUG_FIRMWARE 1165 ulog(
" ROM zones to flash\n");
1171 #ifdef MICROCHIP_API 1177 #ifdef DEBUG_FIRMWARE 1179 ulog(
" pages still to flash\n");
1181 if(npages > maxpages) npages = maxpages;
1189 #ifdef DEBUG_FIRMWARE 1190 ulog(
"FlashErase failed\n");
1197 if(fctx.
stepB == 0) {
1198 #ifndef MICROCHIP_API 1212 #ifndef MICROCHIP_API 1218 #ifdef DEBUG_FIRMWARE 1219 ulog(
"FlashErase failed\n");
1224 #ifdef DEBUG_FIRMWARE 1225 ulog(
"clear time: ");
1239 u32 delay = 1000 + (firm_dev.
last_addr>>5);
1249 #ifdef MICROCHIP_API 1259 #ifdef DEBUG_FIRMWARE 1260 ulog(
"Flash failed\n");
1272 #ifdef DEBUG_FIRMWARE 1273 ulog(
"uGetDeviceInfo failed\n");
1277 }
else if(res == 1) {
1284 #ifdef DEBUG_FIRMWARE 1285 ulog(
"Send reboot\n");
1288 #ifdef MICROCHIP_API 1291 #ifdef DEBUG_FIRMWARE 1292 ulog(
"reboot failed\n");
1308 #ifdef DEBUG_FIRMWARE 1309 ulog(
"device not present\n");
1317 #if defined(DEBUG_FIRMWARE) && defined(MICROCHIP_API) 1318 ulog(
"Bootloader ");
1321 #ifdef MICROCHIP_API 1328 if (fctx.
zOfs == 0){
1340 #ifndef MICROCHIP_API 1348 #ifdef DEBUG_FIRMWARE 1349 ulog(
"Flash succeeded\n");
1356 #ifdef DEBUG_FIRMWARE 1357 ulog(
"Flash disconnect\n");
1359 #ifndef MICROCHIP_API 1371 #ifndef MICROCHIP_API 1373 typedef int(*
yprogTcpReqCb)(
void *ctx,
const char* buffer, u32 len,
char *errmsg);
1399 if (!strcmp(j.
token,
"list")) {
1422 const char * req =
"GET /flash.json?a=list \r\n\r\n";
1442 #ifndef YAPI_IN_YDEVICE 1458 for (i = 0, iface = runifaces; i < nbifaces; i++, iface++){
1478 for (j = 0, serial = bootloaders; j < res; j++, serial +=
YOCTO_SERIAL_LEN){
1479 if (
YSTRCMP(devserial,serial) == 0) {
1508 int count = 0, return_code = 0;;
1529 if (!strcmp(j.
token,
"state")) {
1539 }
else if (!strcmp(j.
token,
"firmware")) {
1549 }
else if (!strcmp(j.
token,
"message")) {
1559 if (!strcmp(j.
token,
"state")) {
1579 if (!strcmp(j.
token,
"logs")) {
1587 }
else if (!strcmp(j.
token,
"progress")) {
1592 progress = atoi(j.
token);
1593 if (progress < 100) {
1606 if (return_code < 0) {
1631 static int upload(
const char *hubserial,
const char *subpath,
const char *filename, u8 *data, u32 data_len,
char *errmsg)
1635 int buffer_size = 1024 + data_len;
1636 char *buffer =
yMalloc(buffer_size);
1644 YSPRINTF(boundary, 32,
"Zz%06xzZ", rand() & 0xffffff);
1645 }
while (
ymemfind(data, data_len, (u8*)boundary,
YSTRLEN(boundary)) >= 0);
1647 YSTRCPY(buffer, buffer_size,
"POST ");
1648 YSTRCAT(buffer, buffer_size, subpath);
1649 YSTRCAT(buffer, buffer_size,
"upload.html HTTP/1.1\r\nContent-Type: multipart/form-data; boundary=");
1650 YSTRCAT(buffer, buffer_size, boundary);
1654 YSTRCAT(buffer, buffer_size, boundary);
1655 YSTRCAT(buffer, buffer_size,
"\r\nContent-Disposition: form-data; name=\"");
1656 YSTRCAT(buffer, buffer_size, filename);
1657 YSTRCAT(buffer, buffer_size,
"\"; filename=\"api\"\r\n" 1658 "Content-Type: application/octet-stream\r\n" 1659 "Content-Transfer-Encoding: binary\r\n\r\n");
1661 memcpy(p, data, data_len);
1663 YASSERT(p - buffer < buffer_size);
1664 buffer_size -= (int)(p - buffer);
1665 YSTRCPY(p, buffer_size,
"\r\n--");
1666 YSTRCAT(p, buffer_size, boundary);
1667 YSTRCAT(p, buffer_size,
"--\r\n");
1668 buffer_size = (int)(p - buffer) +
YSTRLEN(p);
1691 const char *cmd_str;
1711 YSPRINTF(buffer, 512,
"GET %sflash.json?a=%s%s \r\n\r\n", subpath, cmd_str, args);
1726 if (
YSTRNCMP(path,
"http://", 7) == 0){
1728 }
else if (
YSTRNCMP(path,
"www.yoctopuce.com",17) == 0){
1738 int res, len, ofs, i;
1739 const char * http_ok =
"HTTP/1.1 200 OK";
1742 for (i = 0; i < 255 && i <
YSTRLEN(url) && url[i] !=
'/'; i++){
1752 res =
yTcpDownload(host, url+i, &buffer, 10000, errmsg);
1761 ofs =
ymemfind(buffer, res, (u8*)
"\r\n\r\n", 4);
1770 memcpy(*out_buffer, buffer + ofs, len);
1788 const char* reboot_req =
"GET %sapi/module/rebootCountdown?rebootCountdown=-3 \r\n\r\n";
1789 const char* reboot_hub =
"GET %sapi/module/rebootCountdown?rebootCountdown=-1003 \r\n\r\n";
1790 const char* get_api_fmt =
"GET %sapi.json \r\n\r\n";
1841 YSPRINTF(buffer,
sizeof(buffer), reboot_req, subpath);
1842 res =
yapiHTTPRequest(hubserial, buffer, replybuf,
sizeof(replybuf), NULL, errmsg);
1849 if (res < 0 ||
YSTRNCMP(hubserial,
"VIRTHUB", 7) == 0) {
1856 for (i = 0; i < res; i++) {
1871 for (i = 0; i < res; i++) {
1882 YSPRINTF(buffer,
sizeof(buffer), reboot_req, subpath);
1883 res =
yapiHTTPRequest(hubserial, buffer, replybuf,
sizeof(replybuf), NULL, errmsg);
1888 if (replybuf[0] !=
'O' || replybuf[1] !=
'K') {
1889 dbglog(
"Reboot to firmware update mode:\n%s\n", replybuf);
1908 if (
YSTRCMP(hubserial,
"usb") == 0) {
1939 const char *settingsOnly, *services;
1940 u8 *startupconf_data;
1943 int startupconf_data_len;
1944 if (service_len > 0) {
1945 int first_len = (services - settingsOnly) & 0xffffffff;
1946 int sec_len = ((settingsOnly + settings_len) - (services + service_len)) & 0xffffffff;
1947 startupconf_data =
yMalloc(settings_len - service_len + 2);
1948 memcpy(startupconf_data, settingsOnly, first_len);
1949 startupconf_data[first_len] =
'{';
1950 startupconf_data[first_len + 1] =
'}';
1951 memcpy(startupconf_data + first_len + 2, services + service_len, sec_len);
1952 startupconf_data_len = first_len + sec_len;
1954 startupconf_data_len = settings_len;
1955 startupconf_data =
yMalloc(settings_len);
1956 memcpy(startupconf_data, settingsOnly, settings_len);
1960 res =
upload(hubserial, subpath,
"startupConf.json", startupconf_data, startupconf_data_len, errmsg);
1962 yFree(startupconf_data);
1967 res =
upload(hubserial, subpath,
"firmwareConf", startupconf_data, startupconf_data_len, errmsg);
1968 yFree(startupconf_data);
1997 YSPRINTF(buffer,
sizeof(buffer), reboot_hub, subpath);
1998 res =
yapiHTTPRequest(hubserial, buffer, replybuf,
sizeof(replybuf), NULL, errmsg);
2003 for (i = 0; i < 8; i++){
2018 }
else if (res > 0) {
2019 for (i = 0; i < res; i++) {
2060 YSPRINTF(buffer,
sizeof(buffer), get_api_fmt, subpath);
2064 const char * real_fw;
2073 if (
YSTRNCMP(real_fw,p, fw_len)==0) {
2110 static int yStartFirmwareUpdate(
const char *serial,
const char *firmwarePath,
const char *settings, u16 flags,
char *msg)
2143 static YRETCODE yapiCheckFirmwareFile(
const char *serial,
int current_rev, u16 flags,
const char *path,
char *buffer,
int buffersize,
int *fullsize,
char *errmsg)
2146 int size, res, file_rev;
2150 if (
YISERR(size) || p == NULL){
2162 if (file_rev > current_rev) {
2163 int pathsize =
YSTRLEN(path) + 1;
2166 if (pathsize <= buffersize) {
2167 YSTRCPY(buffer, buffersize, path);
2181 static YRETCODE yapiCheckFirmware_r(
const char *serial,
int current_rev, u16 flags,
const char *path,
char *buffer,
int buffersize,
int *fullsize,
char *errmsg)
2183 int best_rev = current_rev;
2187 WIN32_FIND_DATAA ffd;
2190 struct dirent *pDirent;
2197 pDir = opendir(path);
2199 return yapiCheckFirmwareFile(serial, current_rev, flags, path, buffer, buffersize, fullsize, errmsg);
2203 if (pathlen == 0 || pathlen >= 1024 - 32) {
2208 if (abspath[pathlen - 1] !=
'/' && abspath[pathlen - 1] !=
'\\') {
2210 abspath[pathlen] =
'\\';
2212 abspath[pathlen] =
'/';
2214 abspath[++pathlen] = 0;
2221 hFind = FindFirstFileA(abspath, &ffd);
2222 if (INVALID_HANDLE_VALUE == hFind) {
2223 return yapiCheckFirmwareFile(serial, current_rev, flags, path, buffer, buffersize, fullsize, errmsg);
2226 char *name = ffd.cFileName;
2228 while ((pDirent = readdir(pDir)) != NULL) {
2229 char *name = pDirent->d_name;
2237 abspath[pathlen] = 0;
2240 isdir = ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
2242 stat(abspath, &buf);
2243 isdir = S_ISDIR(buf.st_mode);
2247 frev =
yapiCheckFirmware_r(serial, best_rev, flags, abspath, buffer, buffersize, fullsize, errmsg);
2250 if (len < 32 &&
'b' == name[len - 3] &&
'y' == name[len - 2] &&
'n' == name[len - 1]) {
2251 frev =
yapiCheckFirmwareFile(serial, best_rev, flags, abspath, buffer, buffersize, fullsize, errmsg);
2259 }
while (FindNextFileA(hFind, &ffd) != 0);
2268 static int checkFirmwareFromWeb(
const char * serial,
char * out_url,
int url_max_len,
int *fullsize,
char * errmsg)
2275 YSPRINTF(request, 256,
"/FR/common/getLastFirmwareLink.php?serial=%s" , serial);
2276 res =
yTcpDownload(
"www.yoctopuce.com", request, &buffer, 10000, errmsg);
2281 j.
src = (
char*)buffer;
2302 if (!strcmp(j.
token,
"link")) {
2311 if (url_max_len < len + 1){
2318 }
else if (!strcmp(j.
token,
"version")) {
2323 res = atoi(j.
token);
2335 int current_rev = 0;
2342 current_rev = atoi(rev);
2347 best_rev =
yapiCheckFirmware_r(serial, current_rev, (u16)flags, path, buffer, buffersize, fullsize, errmsg);
2352 if (best_rev <= current_rev) {
HubSt * nethub[NBMAX_NET_HUB]
#define BLOCK_FLASH_TIMEOUT
static int sendHubFlashCmd(const char *hubserial, const char *subpath, const char *devserial, FLASH_HUB_CMD cmd, const char *args, char *errmsg)
#define YERRMSG(code, message)
static int getTCPBootloaders(void *ctx, const char *buffer, u32 len, char *errmsg)
static int uSendCmd(u8 cmd, FLASH_DEVICE_STATE nextState)
static int yLoadFirmwareFile(const char *filename, u8 **buffer, char *errmsg)
void yInitializeCriticalSection(yCRITICAL_SECTION *cs)
#define uGetFirmware(ofs, dst, size)
YRETCODE yPktQueueWaitAndPopD2H(yInterfaceSt *iface, pktItem **pkt, int ms, char *errmsg)
#define YOCTO_DEVID_BOOTLOADER
#define YOCTO_PRODUCTNAME_LEN
#define FAMILY_PIC24FJ256DA210
void yHashGetStr(yHash yhash, char *destbuf, u16 bufsize)
#define MAX_ROM_ZONES_PER_FILES
#define MAX_INSTR_IN_PACKET
int ValidateBynCompat(const byn_head_multi *head, u32 size, const char *serial, u16 flags, BootloaderSt *dev, char *errmsg)
#define YOCTO_BASE_SERIAL_LEN
#define YSTRCAT(dst, dstsize, src)
#define YPROG_FORCE_FW_UPDATE
int ypGetBootloaderReply(BootloaderSt *dev, USB_Packet *pkt, char *errmsg)
int yThreadCreate(yThread *yth, void *(*fun)(void *), void *arg)
struct USB_Prog_Packet::@38 pkt_ext
#define FLASH_NB_REBOOT_RETRY
int yNetHubGetBootloaders(const char *hubserial, char *buffer, char *errmsg)
u8 data[MAX_BYTE_IN_PACKET]
#define YOCTO_FIRMWARE_LEN
static YRETCODE yapiCheckFirmware_r(const char *serial, int current_rev, u16 flags, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg)
int IsValidBynFile(const byn_head_multi *head, u32 size, const char *serial, u16 flags, char *errmsg)
int yyySetup(yInterfaceSt *iface, char *errmsg)
yJsonRetCode yJsonParse(yJsonStateMachine *j)
#define decode_byn_zone(dummy)
int yyyUSBGetInterfaces(yInterfaceSt **ifaces, int *nbifaceDetect, char *errmsg)
yAsbUrlType yHashGetUrlPort(yUrlRef urlref, char *url, u16 *port, yAsbUrlProto *proto, yStrRef *user, yStrRef *password)
#define uGetFirmwareBynZone(offset, zone_ptr)
#define YPROG_BOOTLOADER_TIMEOUT
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
#define MAX_BYTE_IN_PACKET
static int yDownloadFirmware(const char *url, u8 **out_buffer, char *errmsg)
char errmsg[FLASH_ERRMSG_LEN]
int yTcpDownload(const char *host, const char *url, u8 **out_buffer, u32 mstimeout, char *errmsg)
void yJsonSkip(yJsonStateMachine *j, int nitems)
static int getBootloaderInfos(const char *devserial, char *out_hubserial, char *errmsg)
static void uSendReboot(u16 signature, FLASH_DEVICE_STATE nextState)
struct USB_Prog_Packet::@39 pktinfo_ext
void MD5Calculate(HASH_SUM *ctx, u8 digest[16])
int wpGetDeviceUrl(YAPI_DEVICE devdesc, char *roothubserial, char *request, int requestsize, int *neededsize)
#define yApproximateSleep(ms)
#define JEDEC_SPANSION_4MB
#define YSTRCPY(dst, dstsize, src)
#define uGetFirmwareBynHead(head_ptr)
static int checkHardwareCompat(BootloaderSt *dev, const char *pictype)
char product[YOCTO_PRODUCTNAME_LEN]
int ypBootloaderShutdown(BootloaderSt *dev)
#define START_AUTOFLASHER_SIGN
static int yStartFirmwareUpdate(const char *serial, const char *firmwarePath, const char *settings, u16 flags, char *msg)
int yapiJsonGetPath_internal(const char *path, const char *json_data, int json_size, int withHTTPheader, const char **output, char *errmsg)
#define ZONE_VERIF_TIMEOUT
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static int uGetDeviceInfo(void)
char serial[YOCTO_SERIAL_LEN *2]
#define SET_PROG_POS_PAGENO(PKT_EXT, PAGENO, POS)
static int upload(const char *hubserial, const char *subpath, const char *filename, u8 *data, u32 data_len, char *errmsg)
static int isWebPath(const char *path)
static void yProgLogProgress(const char *msg)
char prog_version[YOCTO_FIRMWARE_LEN]
static void * yFirmwareUpdate_thread(void *ctx)
struct USB_Prog_Packet::@37 pktinfo
int(* yprogTcpReqCb)(void *ctx, const char *buffer, u32 len, char *errmsg)
void yDeleteCriticalSection(yCRITICAL_SECTION *cs)
void MD5Initialize(HASH_SUM *ctx)
#define MAX_FLASH_ZONES_PER_FILES
int SendDataPacket(BootloaderSt *dev, int program, u32 address, u8 *data, int nbinstr, char *errmsg)
int ypIsSendBootloaderBusy(BootloaderSt *dev)
static int checkHTTPHeader(void *ctx, const char *buffer, u32 len, char *errmsg)
union USB_Prog_Packet::@38::@40 opt
int IsValidBynHead(const byn_head_multi *head, u32 size, u16 flags, char *errmsg)
YRETCODE yapiCheckFirmware_internal(const char *serial, const char *rev, u32 flags, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg)
YPROG_RESULT uFlashDevice(void)
#define JEDEC_SPANSION_8MB
static void yGetFirmware(u32 ofs, u8 *dst, u16 size)
u64 YAPI_FUNCTION_EXPORT yapiGetTickCount(void)
void yyyPacketShutdown(yInterfaceSt *iface)
#define uLogProgress(msg)
#define PROG_GET_INFO_TIMEOUT
void yThreadSignalEnd(yThread *yth)
int ymemfind(const u8 *haystack, u32 haystack_len, const u8 *needle, u32 needle_len)
static YRETCODE yapiCheckFirmwareFile(const char *serial, int current_rev, u16 flags, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg)
static void osProgLogProgressEx(const char *fileid, int line, int prog, const char *msg)
const char * prog_GetCPUName(BootloaderSt *dev)
YRETCODE yapiHTTPRequestSyncStartEx_internal(YIOHDL *iohdl, int tcpchan, const char *device, const char *request, int requestsize, char **reply, int *replysize, yapiRequestProgressCallback progress_cb, void *progress_ctx, char *errmsg)
YAPI_DEVICE wpSearch(const char *device_str)
static int checkFirmwareFromWeb(const char *serial, char *out_url, int url_max_len, int *fullsize, char *errmsg)
#define FAMILY_PIC24FJ64GB004
char prog_version[YOCTO_FIRMWARE_LEN]
YRETCODE yyySendPacket(yInterfaceSt *iface, const USB_Packet *pkt, char *errmsg)
char global_message[YOCTO_ERRMSG_LEN]
#define YSTRNCMP(A, B, len)
YRETCODE yapiHTTPRequestSyncDone_internal(YIOHDL *iohdl, char *errmsg)
int ypSendBootloaderCmd(BootloaderSt *dev, const USB_Packet *pkt, char *errmsg)
void yThreadSignalStart(yThread *yth)
struct USB_Prog_Packet::@36 pkt
#define decode_byn_head_multi(dummy)
YRETCODE yapiUpdateFirmware_internal(const char *serial, const char *firmwarePath, const char *settings, int force, int startUpdate, char *msg)
#define setOsGlobalProgress(prog, msg)
static int uSendErase(u16 firstPage, u16 nPages, FLASH_DEVICE_STATE nextState)
char firmware[YOCTO_FIRMWARE_LEN]
#define YSTRNCPY(dst, dstsize, src, len)
#define uGetBootloader(serial, ifaceptr)
static int checkRequestHeader(void *ctx_ptr, const char *buffer, u32 len, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiUpdateDeviceList(u32 forceupdate, char *errmsg)
int BlockingRead(BootloaderSt *dev, USB_Packet *pkt, int maxwait, char *errmsg)
int YFOPEN(FILE **f, const char *filename, const char *mode)
#define GET_PROG_POS_PAGENO(PKT_EXT, PAGENO, POS)
char serial[YOCTO_SERIAL_LEN]
void MD5AddData(HASH_SUM *ctx, const u8 *buf, u32 len)
#define YOCTO_API_BUILD_NO
int yUSBGetBooloader(const char *serial, const char *name, yInterfaceSt *iface, char *errmsg)
int YAPI_FUNCTION_EXPORT yapiHTTPRequest(const char *device, const char *request, char *buffer, int buffsize, int *fullsize, char *errmsg)
yUrlRef wpGetDeviceUrlRef(YAPI_DEVICE devdesc)