#ifndef INTERNAL_EEPROM_H
#define INTERNAL_EEPROM_H

#include "TYW_stdint.h"
#include "r_eel_types.h"

typedef enum
{
    INTERNAL_EE_BLOCK_00 = 1u,
    INTERNAL_EE_BLOCK_01,
    INTERNAL_EE_BLOCK_02,
    INTERNAL_EE_BLOCK_03,
    INTERNAL_EE_BLOCK_04,
    INTERNAL_EE_BLOCK_05,
    INTERNAL_EE_BLOCK_06,
    INTERNAL_EE_BLOCK_07,
    INTERNAL_EE_BLOCK_08,
    INTERNAL_EE_BLOCK_09,
    INTERNAL_EE_BLOCK_10,
    INTERNAL_EE_BLOCK_11,
    INTERNAL_EE_BLOCK_12,
    INTERNAL_EE_BLOCK_13,
    INTERNAL_EE_BLOCK_14,
    INTERNAL_EE_BLOCK_15,
    INTERNAL_EE_BLOCK_16,
    INTERNAL_EE_BLOCK_17,
    INTERNAL_EE_BLOCK_18,
    INTERNAL_EE_BLOCK_19,
    INTERNAL_EE_BLOCK_20,
    INTERNAL_EE_BLOCK_21,
    INTERNAL_EE_BLOCK_22,
    INTERNAL_EE_BLOCK_23,
    INTERNAL_EE_BLOCK_24,
    INTERNAL_EE_BLOCK_25,
    INTERNAL_EE_BLOCK_26,
    INTERNAL_EE_BLOCK_27,
    INTERNAL_EE_BLOCK_28,
    INTERNAL_EE_BLOCK_29,
    INTERNAL_EE_BLOCK_30,
    INTERNAL_EE_BLOCK_31,
    INTERNAL_EE_BLOCK_32,
    INTERNAL_EE_BLOCK_33,
    INTERNAL_EE_BLOCK_34,
    INTERNAL_EE_BLOCK_35,
    INTERNAL_EE_BLOCK_36,
    INTERNAL_EE_BLOCK_37,
    INTERNAL_EE_BLOCK_38,
    INTERNAL_EE_BLOCK_39,
    INTERNAL_EE_BLOCK_40,
    INTERNAL_EE_BLOCK_41,
    INTERNAL_EE_BLOCK_42,
    INTERNAL_EE_BLOCK_43,
    INTERNAL_EE_BLOCK_44,
    INTERNAL_EE_BLOCK_45,
    INTERNAL_EE_BLOCK_46,
    INTERNAL_EE_BLOCK_47,
    INTERNAL_EE_BLOCK_48,
    INTERNAL_EE_BLOCK_49,
    INTERNAL_EE_BLOCK_50,
    INTERNAL_EE_BLOCK_51,
    INTERNAL_EE_BLOCK_52,
    INTERNAL_EE_BLOCK_53,
    INTERNAL_EE_BLOCK_54,
    INTERNAL_EE_BLOCK_55,
    INTERNAL_EE_BLOCK_56,
    INTERNAL_EE_BLOCK_57,
    INTERNAL_EE_BLOCK_58,
    INTERNAL_EE_BLOCK_59,
    INTERNAL_EE_BLOCK_60,
    INTERNAL_EE_BLOCK_61,
    INTERNAL_EE_BLOCK_62,
    INTERNAL_EE_BLOCK_63,
} EE_BLOCK_NB;

#define INTERNAL_EE_BLOCK_00_size 16         //boot  flag
#define INTERNAL_EE_BLOCK_01_size 12         //27 boot
#define INTERNAL_EE_BLOCK_02_size 108        //2E boot
#define INTERNAL_EE_BLOCK_03_size 40         //2E app
#define INTERNAL_EE_BLOCK_04_size 384        //dtc
#define INTERNAL_EE_BLOCK_05_size 4 + 196    //CAFD
#define INTERNAL_EE_BLOCK_06_size 4 + 1      //CAFD CTROL
#define INTERNAL_EE_BLOCK_07_size 4 + 20     //user setting
#define INTERNAL_EE_BLOCK_08_size 232        //DTC_CAFD

#define INTERNAL_EE_BLOCK_09_size 1
#define INTERNAL_EE_BLOCK_10_size 1
#define INTERNAL_EE_BLOCK_11_size 1
#define INTERNAL_EE_BLOCK_12_size 1
#define INTERNAL_EE_BLOCK_13_size 1
#define INTERNAL_EE_BLOCK_14_size 1
#define INTERNAL_EE_BLOCK_15_size 1
#define INTERNAL_EE_BLOCK_16_size 1
#define INTERNAL_EE_BLOCK_17_size 1
#define INTERNAL_EE_BLOCK_18_size 1
#define INTERNAL_EE_BLOCK_19_size 1
#define INTERNAL_EE_BLOCK_20_size 1
#define INTERNAL_EE_BLOCK_21_size 1
#define INTERNAL_EE_BLOCK_22_size 1
#define INTERNAL_EE_BLOCK_23_size 1
#define INTERNAL_EE_BLOCK_24_size 1
#define INTERNAL_EE_BLOCK_25_size 1
#define INTERNAL_EE_BLOCK_26_size 1
#define INTERNAL_EE_BLOCK_27_size 1
#define INTERNAL_EE_BLOCK_28_size 1
#define INTERNAL_EE_BLOCK_29_size 1
#define INTERNAL_EE_BLOCK_30_size 1
#define INTERNAL_EE_BLOCK_31_size 1
#define INTERNAL_EE_BLOCK_32_size 1
#define INTERNAL_EE_BLOCK_33_size 1
#define INTERNAL_EE_BLOCK_34_size 1
#define INTERNAL_EE_BLOCK_35_size 1
#define INTERNAL_EE_BLOCK_36_size 1
#define INTERNAL_EE_BLOCK_37_size 1
#define INTERNAL_EE_BLOCK_38_size 1
#define INTERNAL_EE_BLOCK_39_size 1
#define INTERNAL_EE_BLOCK_40_size 1
#define INTERNAL_EE_BLOCK_41_size 1
#define INTERNAL_EE_BLOCK_42_size 1
#define INTERNAL_EE_BLOCK_43_size 1
#define INTERNAL_EE_BLOCK_44_size 1
#define INTERNAL_EE_BLOCK_45_size 1
#define INTERNAL_EE_BLOCK_46_size 1
#define INTERNAL_EE_BLOCK_47_size 1
#define INTERNAL_EE_BLOCK_48_size 1
#define INTERNAL_EE_BLOCK_49_size 1
#define INTERNAL_EE_BLOCK_50_size 1
#define INTERNAL_EE_BLOCK_51_size 1
#define INTERNAL_EE_BLOCK_52_size 1
#define INTERNAL_EE_BLOCK_53_size 1
#define INTERNAL_EE_BLOCK_54_size 1
#define INTERNAL_EE_BLOCK_55_size 1
#define INTERNAL_EE_BLOCK_56_size 1
#define INTERNAL_EE_BLOCK_57_size 1
#define INTERNAL_EE_BLOCK_58_size 1
#define INTERNAL_EE_BLOCK_59_size 1
#define INTERNAL_EE_BLOCK_60_size 1
#define INTERNAL_EE_BLOCK_61_size 1
#define INTERNAL_EE_BLOCK_62_size 1
#define INTERNAL_EE_BLOCK_63_size 1

void           Internal_EEPROM_OPEN(void);
void           Internal_EEPROM_CLOSE(void);
void           Internal_EEL_Init(void);
r_eel_status_t Internal_EEL_Write(uint16_t blockID, uint8_t pbuf [], uint32_t length);
r_eel_status_t Internal_EEL_Read(uint8_t blockID, uint8_t pbuf [], uint32_t length);
void           Internal_EEL_DEINIT(void);

#endif