94 lines
2.5 KiB
C
Executable File
94 lines
2.5 KiB
C
Executable File
/*************************************************
|
|
File name : hal_interface_ota.c
|
|
Module : hal ota library interface typedefs
|
|
Author :
|
|
Version :
|
|
Created on : 2020-10-20
|
|
Description :
|
|
Data structure and function definitions required by
|
|
the ota interface
|
|
|
|
Modify History:
|
|
1. Date: Author: Modification:
|
|
2020-10-20 amir.liang create
|
|
*************************************************/
|
|
#include "pal.h"
|
|
#include "hal_interface.h"
|
|
#include "hal_interface_ota.h"
|
|
#include "hal_product_config.h"
|
|
|
|
|
|
#ifndef HAL_CFG_OTA_TYPE
|
|
#error HAL_CFG_OTA_TYPE undefined !!! Go to "hal_gernerate_product_config_h.sh" settings
|
|
#endif
|
|
|
|
#if (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_T31)
|
|
#include "t31_ota.h"
|
|
#elif (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_MCU)
|
|
|
|
#elif (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_BBM_T8350)
|
|
#include "rk3326_ota.h"
|
|
#elif (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_BATTERY_CAMERA)
|
|
#include "battery_cam_ota.h"
|
|
#endif
|
|
|
|
ST_HAL_OTA_INTERFACE otaInterface[] =
|
|
{
|
|
|
|
#if (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_BBM_T8350)
|
|
{
|
|
.pfnInit = bbm_t8350_ota_init,
|
|
.pfnDeinit = bbm_t8350_ota_deinit,
|
|
.pfnGetPackageTable = bbm_t8350_ota_get_package_table,
|
|
.pfnOtaUpgrade = bbm_t8350_ota_upgrade,
|
|
.pfnOtaOpenPartition = NULL;
|
|
},
|
|
#elif (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_T31)
|
|
{
|
|
.pfnInit = t31_ota_init,
|
|
.pfnDeinit = t31_ota_deinit,
|
|
.pfnGetPackageTable = t31_ota_get_package_table,
|
|
.pfnOtaUpgrade = t31_ota_upgrade
|
|
.pfnOtaOpenPartition = t31_ota_open_partition;
|
|
},
|
|
#elif (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_MCU)
|
|
{
|
|
.pfnInit = NULL,
|
|
.pfnDeinit = NULL,
|
|
.pfnGetPackageTable = NULL,
|
|
.pfnOtaUpgrade = NULL,
|
|
.pfnOtaOpenPartition = NULL
|
|
},
|
|
#elif (HAL_CFG_OTA_TYPE == HAL_CFG_OTA_TYPE_BATTERY_CAMERA)
|
|
{
|
|
.pfnInit = battery_cam_ota_init,
|
|
.pfnDeinit = battery_cam_ota_deinit,
|
|
.pfnGetPackageTable = battery_cam_ota_get_package_table,
|
|
.pfnOtaUpgrade = battery_cam_ota_upgrade,
|
|
.pfnOtaOpenPartition = battery_cam_ota_open_partition
|
|
},
|
|
#endif
|
|
};
|
|
|
|
ST_HAL_OTA_INTERFACE* HAL_OTA_GetInterface(int32_t channel)
|
|
{
|
|
|
|
#if (HAL_CFG_OTA_TYPE == HAL_TYPE_NONE)
|
|
return NULL;
|
|
#else
|
|
HAL_ITF_INDEX idx = HAL_SELF;
|
|
if (channel == HAL_CHANNEL_SELF)
|
|
{
|
|
idx = HAL_SELF;
|
|
}
|
|
else
|
|
{
|
|
// 需要从NV获取通道号Channel对应的设备类型对应的hal
|
|
//idx = HAL_REMOTE_SUB1G;
|
|
return NULL;
|
|
}
|
|
return &otaInterface[0];
|
|
#endif
|
|
|
|
}
|