/*
 * flashdll.h
 *
 *  Created on: 2019-4-11
 *      Author: zhangguojun
 */

#ifndef FLASHDLL_H_
#define FLASHDLL_H_

//#define DATALENGTH 401
//Uint16 paradata[DATALENGTH];///////参数数组
//Uint16 paradata_bk[DATALENGTH];//////备份参数
typedef struct {

                Uint16  Limit_up_shift ;
                Uint16  Limit_down_shift ;
                Uint16  *Flash_ptr0 ;
                Uint16  *Flash_ptr1 ;
                float32 data_f_read;
                Uint16  data_i_read;
                Uint16  data_return;
                Uint16  type;
                Uint16  shift;
                Uint16  crc;
                Uint16   data_i_write;
                float32  data_f_write;
                Uint16  Status;
                float32  VersionFloat;
                Uint16   VersionHex;
                void    (*init)();
                void    (*wr_i)();   //wrtoarray_i(Uint16 type,Uint16 shift,Uint16 data);///修改数组中参数；
                void    (*wr_f)();   //wrtoarray_f(Uint16 type,Uint16 shift,float32 data);///修改数组中参数
                void    (*wr_flash)();     //wrtoflash(Uint16 type);//参数写到flash的常用区域和备份区域
                void    (*read_i)();   //read_i_para(Uint16 type,int16 shift);//读取整形参数
                void    (*read_f)();   //read_f_para(Uint16 type,int16 shift);//读取浮点参数
                void    (*read_all)();    //read_f_all(Uint16 type);

                }FLASHWR;
typedef FLASHWR *FLASHWR_handle;
#define FLASHWR_DEFAULTS { 400, \
                          4, \
                          (Uint16 *)0x3D8000, \
                          (Uint16 *)0x3DA000, \
                          0, \
                          0, \
                          0, \
                          0, \
                          0, \
                          0, \
                          0, \
                          0, \
                          0, \
                          0, \
                          0, \
                          (void (*)(Uint32))flash_init,\
                          (void (*)(Uint32))wrtoarray_i,\
                          (void (*)(Uint32))wrtoarray_f,\
                          (void (*)(Uint32))wrtoflash,\
                          (void (*)(Uint32))read_i_para,\
                          (void (*)(Uint32))read_f_para,\
                          (void (*)(Uint32))read_f_all\
                          }

void flash_init(FLASHWR_handle);
void wrtoarray_i(FLASHWR_handle);
void wrtoarray_f(FLASHWR_handle);
void wrtoflash(FLASHWR_handle);
void read_i_para(FLASHWR_handle);
void read_f_para(FLASHWR_handle);
void read_f_all(FLASHWR_handle);
#endif /* FLASHDLL_H_ */
