/*************************************************  
  File name     : hal_interface_button.c
  Module        : hal nv library interface typedefs
  Author        : Eric.wu@anker.com
  Version       :
  Created on    : 2020-10-28
  Description   :
      Data structure and function definitions required by 
      the nv interface
    
  Modify History:   
  1. Date:        Author:         Modification:
  2020-10-28    amir.liang         create
*************************************************/
#include "pal.h"
#include "hal_interface_storage.h"
#include "hal_product_config.h"
#include "hal_interface.h"
#if (HAL_CFG_STORAGE_ENABLE == HAL_CFG_STORAGE_TYPE_EMMC)
#include "emmc.h"
#elif (HAL_CFG_STORAGE_ENABLE == HAL_CFG_STORAGE_TYPE_NAND_FLASH)
#include "nand_flash.h"
#else
#include "emmc.h"
#endif


ST_HAL_STORAGE_INTERFACE g_HAL_Storage_Itf[] =
{
#if (HAL_CFG_STORAGE_ENABLE == HAL_CFG_STORAGE_TYPE_EMMC)
    {
        .pfnInit = EMMC_Storage_Init,
        .pfnDeinit = EMMC_Storage_DeInit,
        .pfnFormatDisk = EMMC_Storage_FormatDisk,
        .pfnGetDiskInfo = EMMC_Storage_GetDiskInfo,
        .pfnRegStatusCb = EMMC_Storage_RegStatusCb,
    },
#elif (HAL_CFG_STORAGE_ENABLE == HAL_CFG_STORAGE_TYPE_NAND_FLASH)
    {
        .pfnInit = NandFlash_Storage_Init,
        .pfnDeinit = NandFlash_Storage_DeInit,
        .pfnFormatDisk = NandFlash_Storage_FormatDisk,
        .pfnGetDiskInfo = NandFlash_Storage_GetDiskInfo,
        .pfnRegStatusCb = NandFlash_Storage_RegStatusCb,
    },
#else
    {
        .pfnInit = EMMC_Storage_Init,
        .pfnDeinit = EMMC_Storage_DeInit,
        .pfnFormatDisk = EMMC_Storage_FormatDisk,
        .pfnGetDiskInfo = EMMC_Storage_GetDiskInfo,
        .pfnRegStatusCb = EMMC_Storage_RegStatusCb,
    },
#endif
};

ST_HAL_STORAGE_INTERFACE *HAL_Storage_GetInterface(int32_t Channel)
{
    HAL_ITF_INDEX idx = HAL_SELF;
    if ( Channel == HAL_CHANNEL_SELF )
    {
        idx = HAL_SELF;
    }
    else
    {
        return NULL;
    }
    return &g_HAL_Storage_Itf[idx];
}
