#include "ydef.h"
#include "yproto.h"
#include <dirent.h>
#include <sys/stat.h>
#include "yhash.h"
#include "yjson.h"
#include "yprog.h"
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | ckReqHeadCtx |
Macros | |
#define | __FILE_ID__ "yprog" |
#define | Flash_ready() 1 |
#define | setOsGlobalProgress(prog, msg) osProgLogProgressEx(__FILE_ID__,__LINE__, prog, msg) |
#define | uGetBootloader(serial, ifaceptr) yUSBGetBooloader(serial, NULL, ifaceptr,NULL) |
#define | ulog(str) dbglog("%s",str) |
#define | ulogChar(val) dbglog("%c",val) |
#define | uLogProgress(msg) yProgLogProgress(msg) |
#define | ulogU16(val) dbglog("%x",val) |
#define | ytime() ((u32) yapiGetTickCount()) |
Typedefs | |
typedef int(* | yprogTcpReqCb) (void *ctx, const char *buffer, u32 len, char *errmsg) |
Enumerations | |
enum | FLASH_HUB_CMD { FLASH_HUB_AVAIL = 0u, FLASH_HUB_STATE, FLASH_HUB_FLASH, FLASH_HUB_NOT_BUSY, FLASH_HUB_NONE } |
enum | FLASH_TYPE { FLASH_USB = 0u, FLASH_NET_SELF, FLASH_NET_SUBDEV } |
Functions | |
int | BlockingRead (BootloaderSt *dev, USB_Packet *pkt, int maxwait, char *errmsg) |
static int | checkFirmwareFromWeb (const char *serial, char *out_url, int url_max_len, int *fullsize, char *errmsg) |
static int | checkHardwareCompat (BootloaderSt *dev, const char *pictype) |
static int | checkHTTPHeader (void *ctx, const char *buffer, u32 len, char *errmsg) |
static int | checkRequestHeader (void *ctx_ptr, const char *buffer, u32 len, char *errmsg) |
static int | getBootloaderInfos (const char *devserial, char *out_hubserial, char *errmsg) |
static int | getTCPBootloaders (void *ctx, const char *buffer, u32 len, char *errmsg) |
int | IsValidBynFile (const byn_head_multi *head, u32 size, const char *serial, u16 flags, char *errmsg) |
int | IsValidBynHead (const byn_head_multi *head, u32 size, u16 flags, char *errmsg) |
static int | isWebPath (const char *path) |
static void | osProgLogProgressEx (const char *fileid, int line, int prog, const char *msg) |
const char * | prog_GetCPUName (BootloaderSt *dev) |
int | SendDataPacket (BootloaderSt *dev, int program, u32 address, u8 *data, int nbinstr, char *errmsg) |
static int | sendHubFlashCmd (const char *hubserial, const char *subpath, const char *devserial, FLASH_HUB_CMD cmd, const char *args, char *errmsg) |
YPROG_RESULT | uFlashDevice (void) |
static int | uFlashFlash () |
static int | uFlashZone () |
static int | uGetDeviceInfo (void) |
static int | upload (const char *hubserial, const char *subpath, const char *filename, u8 *data, u32 data_len, char *errmsg) |
static int | uSendCmd (u8 cmd, FLASH_DEVICE_STATE nextState) |
static int | uSendErase (u16 firstPage, u16 nPages, FLASH_DEVICE_STATE nextState) |
static void | uSendReboot (u16 signature, FLASH_DEVICE_STATE nextState) |
int | ValidateBynCompat (const byn_head_multi *head, u32 size, const char *serial, u16 flags, BootloaderSt *dev, char *errmsg) |
YRETCODE | yapiCheckFirmware_internal (const char *serial, const char *rev, u32 flags, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg) |
static YRETCODE | yapiCheckFirmware_r (const char *serial, int current_rev, u16 flags, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg) |
static YRETCODE | yapiCheckFirmwareFile (const char *serial, int current_rev, u16 flags, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg) |
YRETCODE | yapiUpdateFirmware_internal (const char *serial, const char *firmwarePath, const char *settings, int force, int startUpdate, char *msg) |
static int | yDownloadFirmware (const char *url, u8 **out_buffer, char *errmsg) |
static void * | yFirmwareUpdate_thread (void *ctx) |
static void | yGetFirmware (u32 ofs, u8 *dst, u16 size) |
static int | yLoadFirmwareFile (const char *filename, u8 **buffer, char *errmsg) |
int | yNetHubGetBootloaders (const char *hubserial, char *buffer, char *errmsg) |
int | ypGetBootloaderReply (BootloaderSt *dev, USB_Packet *pkt, char *errmsg) |
int | ypIsSendBootloaderBusy (BootloaderSt *dev) |
void | yProgFree (void) |
void | yProgInit (void) |
static void | yProgLogProgress (const char *msg) |
int | ypSendBootloaderCmd (BootloaderSt *dev, const USB_Packet *pkt, char *errmsg) |
static int | yStartFirmwareUpdate (const char *serial, const char *firmwarePath, const char *settings, u16 flags, char *msg) |
int | yUSBGetBooloader (const char *serial, const char *name, yInterfaceSt *iface, char *errmsg) |
Variables | |
FIRMWARE_CONTEXT | fctx |
BootloaderSt | firm_dev |
USB_Packet | firm_pkt |
#define setOsGlobalProgress | ( | prog, | |
msg | |||
) | osProgLogProgressEx(__FILE_ID__,__LINE__, prog, msg) |
#define uGetBootloader | ( | serial, | |
ifaceptr | |||
) | yUSBGetBooloader(serial, NULL, ifaceptr,NULL) |
#define uLogProgress | ( | msg | ) | yProgLogProgress(msg) |
#define ytime | ( | ) | ((u32) yapiGetTickCount()) |
typedef int(* yprogTcpReqCb) (void *ctx, const char *buffer, u32 len, char *errmsg) |
enum FLASH_HUB_CMD |
enum FLASH_TYPE |
int BlockingRead | ( | BootloaderSt * | dev, |
USB_Packet * | pkt, | ||
int | maxwait, | ||
char * | errmsg | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
int IsValidBynFile | ( | const byn_head_multi * | head, |
u32 | size, | ||
const char * | serial, | ||
u16 | flags, | ||
char * | errmsg | ||
) |
int IsValidBynHead | ( | const byn_head_multi * | head, |
u32 | size, | ||
u16 | flags, | ||
char * | errmsg | ||
) |
|
static |
const char* prog_GetCPUName | ( | BootloaderSt * | dev | ) |
int SendDataPacket | ( | BootloaderSt * | dev, |
int | program, | ||
u32 | address, | ||
u8 * | data, | ||
int | nbinstr, | ||
char * | errmsg | ||
) |
|
static |
YPROG_RESULT uFlashDevice | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
int ValidateBynCompat | ( | const byn_head_multi * | head, |
u32 | size, | ||
const char * | serial, | ||
u16 | flags, | ||
BootloaderSt * | dev, | ||
char * | errmsg | ||
) |
YRETCODE yapiCheckFirmware_internal | ( | const char * | serial, |
const char * | rev, | ||
u32 | flags, | ||
const char * | path, | ||
char * | buffer, | ||
int | buffersize, | ||
int * | fullsize, | ||
char * | errmsg | ||
) |
|
static |
|
static |
YRETCODE yapiUpdateFirmware_internal | ( | const char * | serial, |
const char * | firmwarePath, | ||
const char * | settings, | ||
int | force, | ||
int | startUpdate, | ||
char * | msg | ||
) |
|
static |
|
static |
|
static |
int yNetHubGetBootloaders | ( | const char * | hubserial, |
char * | buffer, | ||
char * | errmsg | ||
) |
int ypGetBootloaderReply | ( | BootloaderSt * | dev, |
USB_Packet * | pkt, | ||
char * | errmsg | ||
) |
int ypIsSendBootloaderBusy | ( | BootloaderSt * | dev | ) |
int ypSendBootloaderCmd | ( | BootloaderSt * | dev, |
const USB_Packet * | pkt, | ||
char * | errmsg | ||
) |
|
static |
int yUSBGetBooloader | ( | const char * | serial, |
const char * | name, | ||
yInterfaceSt * | iface, | ||
char * | errmsg | ||
) |
FIRMWARE_CONTEXT fctx |
BootloaderSt firm_dev |
USB_Packet firm_pkt |