/*******************************************************************************
* Project:      Amped'RF Bluetooth
* File name:    GKI_flash.h
* Description:  Flash abstraction layer
*
* Copyright (c) 2013 Amped'RF Inc., AR Technology  All rights reserved.
*******************************************************************************/
#ifndef _GKI_FLASH_H_
#define _GKI_FLASH_H_


#if defined(STM32F10x)
#define  GKI_FLASH_BUSY         1
#define  GKI_FLASH_ERROR_PG     2
#define  GKI_FLASH_ERROR_WRP    3
#define  GKI_FLASH_COMPLETE     4
#define  GKI_FLASH_TIMEOUT      5

#elif defined(STM32F2xx)
#define  GKI_FLASH_BUSY             1
#define  GKI_FLASH_ERROR_PGS        2
#define  GKI_FLASH_ERROR_PGP        3
#define  GKI_FLASH_ERROR_PGA        4
#define  GKI_FLASH_ERROR_WRP        5
#define  GKI_FLASH_ERROR_PROGRAM    6
#define  GKI_FLASH_ERROR_OPERATION  7
#define  GKI_FLASH_COMPLETE         8

#elif defined(STM32F4xx)
#define  GKI_FLASH_BUSY             1
#define  GKI_FLASH_ERROR_RD         2
#define  GKI_FLASH_ERROR_PGS        3
#define  GKI_FLASH_ERROR_PGP        4
#define  GKI_FLASH_ERROR_PGA        5
#define  GKI_FLASH_ERROR_WRP        6
#define  GKI_FLASH_ERROR_PROGRAM    7
#define  GKI_FLASH_ERROR_OPERATION  8
#define  GKI_FLASH_COMPLETE         9
#endif


typedef u16 tGKI_FlashStatus;


tGKI_FlashStatus GKI_flash_ProgramWord(u32 Address, u32 Data);
tGKI_FlashStatus GKI_flash_ErasePage(u32 Address);

char *GKI_flash_ErrorText(tGKI_FlashStatus status);
void GKI_flash_Unlock(void);
void GKI_flash_Lock(void);



#endif // _GKI_FLASH_H_
//--------------------------------------------------------------
//