TRC 630401
auxfunc.h@0:a140efde67cf, 2020-04-02 (annotated)
- Committer:
- supawat
- Date:
- Thu Apr 02 03:42:12 2020 +0000
- Revision:
- 0:a140efde67cf
TRC 630401
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
supawat | 0:a140efde67cf | 1 | #ifndef AUXFUNC_H |
supawat | 0:a140efde67cf | 2 | #define AUXFUNC_H |
supawat | 0:a140efde67cf | 3 | |
supawat | 0:a140efde67cf | 4 | #include "mbed.h" |
supawat | 0:a140efde67cf | 5 | |
supawat | 0:a140efde67cf | 6 | //#include "mbed_assert.h" |
supawat | 0:a140efde67cf | 7 | //#include "U201SARA.h" |
supawat | 0:a140efde67cf | 8 | //#include "auxfunc.h" |
supawat | 0:a140efde67cf | 9 | |
supawat | 0:a140efde67cf | 10 | //#define FW_NO "621028" |
supawat | 0:a140efde67cf | 11 | //#define DEV_GROUP "3G_LOT1" |
supawat | 0:a140efde67cf | 12 | |
supawat | 0:a140efde67cf | 13 | #define Bootloader_address 0x00030000 |
supawat | 0:a140efde67cf | 14 | |
supawat | 0:a140efde67cf | 15 | //#define ADDRESS_EEPROM_FLAG_OTA 0x90 |
supawat | 0:a140efde67cf | 16 | //#define ADDRESS_EEPROM_JSON_OTA 0xA0 |
supawat | 0:a140efde67cf | 17 | |
supawat | 0:a140efde67cf | 18 | //json_ota myota; |
supawat | 0:a140efde67cf | 19 | |
supawat | 0:a140efde67cf | 20 | typedef struct Instruction_FILE { |
supawat | 0:a140efde67cf | 21 | int firm_vers; |
supawat | 0:a140efde67cf | 22 | char device[16]; |
supawat | 0:a140efde67cf | 23 | char dir[20]; |
supawat | 0:a140efde67cf | 24 | int fsize; |
supawat | 0:a140efde67cf | 25 | uint16_t chksum[64]; |
supawat | 0:a140efde67cf | 26 | char filename[30]; |
supawat | 0:a140efde67cf | 27 | }json_ota; |
supawat | 0:a140efde67cf | 28 | |
supawat | 0:a140efde67cf | 29 | typedef struct struct_flag{ |
supawat | 0:a140efde67cf | 30 | uint8_t check_ota; |
supawat | 0:a140efde67cf | 31 | uint8_t get_frm; |
supawat | 0:a140efde67cf | 32 | uint8_t get_nfs; |
supawat | 0:a140efde67cf | 33 | uint8_t crc_match; |
supawat | 0:a140efde67cf | 34 | uint32_t last_check_rtc; |
supawat | 0:a140efde67cf | 35 | }ota_flag; |
supawat | 0:a140efde67cf | 36 | |
supawat | 0:a140efde67cf | 37 | |
supawat | 0:a140efde67cf | 38 | |
supawat | 0:a140efde67cf | 39 | //typedef enum{CHECKING,CHECK_OTA,GETBIN_PRP,GETBIN,READFS_FWBIN,CRCMATCHED,DEEPSLEEP}app_state; |
supawat | 0:a140efde67cf | 40 | |
supawat | 0:a140efde67cf | 41 | //unsigned short CRC16_CCITT(unsigned char *pu8Data, unsigned int i16Len); |
supawat | 0:a140efde67cf | 42 | |
supawat | 0:a140efde67cf | 43 | // >>> Bootloader Programmer |
supawat | 0:a140efde67cf | 44 | void bootValidApp(); |
supawat | 0:a140efde67cf | 45 | void jump_bootloader(void); |
supawat | 0:a140efde67cf | 46 | // Bootloader Programmer <<< |
supawat | 0:a140efde67cf | 47 | |
supawat | 0:a140efde67cf | 48 | bool chkgrant_upgradeFW(int vers,char *device); |
supawat | 0:a140efde67cf | 49 | //void eflash_block(char *data,int block); |
supawat | 0:a140efde67cf | 50 | void eflash_block(char data[4096],int block); |
supawat | 0:a140efde67cf | 51 | void eflash_eraseBlock(int block); |
supawat | 0:a140efde67cf | 52 | |
supawat | 0:a140efde67cf | 53 | bool check_ota(); |
supawat | 0:a140efde67cf | 54 | bool readFS_ota(); |
supawat | 0:a140efde67cf | 55 | bool getBIN(); |
supawat | 0:a140efde67cf | 56 | bool readFLASH_bin(); |
supawat | 0:a140efde67cf | 57 | |
supawat | 0:a140efde67cf | 58 | #endif |