TRC 630401

auxfunc.h

Committer:
supawat
Date:
2020-04-02
Revision:
0:a140efde67cf

File content as of revision 0:a140efde67cf:

#ifndef AUXFUNC_H
#define AUXFUNC_H

#include "mbed.h"

//#include "mbed_assert.h"
//#include "U201SARA.h"
//#include "auxfunc.h"

//#define FW_NO "621028"
//#define DEV_GROUP "3G_LOT1"

#define Bootloader_address 0x00030000

//#define ADDRESS_EEPROM_FLAG_OTA 0x90
//#define ADDRESS_EEPROM_JSON_OTA 0xA0

//json_ota myota;

typedef struct Instruction_FILE {
    int firm_vers;
    char device[16];
    char dir[20];
    int fsize;
    uint16_t chksum[64];
    char filename[30];
}json_ota;

typedef struct struct_flag{
			uint8_t check_ota;
			uint8_t get_frm;
			uint8_t get_nfs;
			uint8_t crc_match;
			uint32_t last_check_rtc;
}ota_flag;



//typedef enum{CHECKING,CHECK_OTA,GETBIN_PRP,GETBIN,READFS_FWBIN,CRCMATCHED,DEEPSLEEP}app_state;

//unsigned short CRC16_CCITT(unsigned char *pu8Data, unsigned int i16Len);

// >>> Bootloader Programmer
void bootValidApp();
void jump_bootloader(void);
// Bootloader Programmer <<<

bool chkgrant_upgradeFW(int vers,char *device);
//void eflash_block(char *data,int block);
void eflash_block(char data[4096],int block);
void eflash_eraseBlock(int block);

bool check_ota();
bool readFS_ota();
bool getBIN();
bool readFLASH_bin();

#endif