103 lines
2.7 KiB
C
103 lines
2.7 KiB
C
|
/*************************************************
|
||
|
File name : hal_interface_pmu.c
|
||
|
Module : hal pmu library interface typedefs
|
||
|
Author :
|
||
|
Version :
|
||
|
Created on : 2020-10-20
|
||
|
Description :
|
||
|
Data structure and function definitions required by
|
||
|
the pmu interface
|
||
|
|
||
|
Modify History:
|
||
|
1. Date: Author: Modification:
|
||
|
2020-10-20 amir.liang create
|
||
|
*************************************************/
|
||
|
#include "pal.h"
|
||
|
#include "hal_interface_pmu.h"
|
||
|
#include "hal_product_config.h"
|
||
|
|
||
|
|
||
|
#ifndef HAL_CFG_PMU_TYPE
|
||
|
#error HAL_CFG_PMU_TYPE undefined !!! Go to "hal_gernerate_product_config_h.sh" settings
|
||
|
#endif
|
||
|
|
||
|
|
||
|
#if (HAL_CFG_PMU_TYPE == HAL_CFG_PMU_TYPE_MCU)
|
||
|
#include "pmu_stm32.h"
|
||
|
#elif (HAL_CFG_PMU_TYPE == HAL_CFG_PMU_TYPE_6441)
|
||
|
#include "pmu_atbm6441.h"
|
||
|
#endif
|
||
|
|
||
|
|
||
|
static ST_HAL_PMU_INTERFACE gHalPmuInterface[] =
|
||
|
{
|
||
|
#if (HAL_CFG_PMU_TYPE == HAL_CFG_PMU_TYPE_MCU)
|
||
|
{
|
||
|
.pfnInit = stm32_pmu_init,
|
||
|
.pfnDeinit = stm32_pmu_deinit,
|
||
|
.pfnGetFwVersion = stm32_pmu_get_fw_ver,
|
||
|
.pfnSetWifiEnable = stm32_pmu_set_wifi_enable,
|
||
|
.pfnGetWifiEnable = stm32_pmu_get_wifi_enable,
|
||
|
#if (HAL_CFG_WIFI_TYPE == HAL_CFG_WIFI_TYPE_6441)
|
||
|
.pfnRestAP = stm32_pmu_reset_wifi,
|
||
|
#else
|
||
|
.pfnRestAP = stm32_pmu_reset_ap,
|
||
|
#endif
|
||
|
.pfnResetWifi = stm32_pmu_reset_wifi,
|
||
|
.pfnRestAPOta = stm32_pmu_reset_ap_by_ota,
|
||
|
.pfnPowerOffAP = stm32_pmu_poweroff_ap,
|
||
|
|
||
|
.pfnSetTime = stm32_pmu_set_time,
|
||
|
.pfnGetTime = stm32_pmu_get_time,
|
||
|
.pfnSetWakeUpDelay = stm32_pmu_set_wakeup_delay,
|
||
|
.pfnSyncMode = stm32_pmu_sync_state,
|
||
|
.pfnGetWakeupReason = stm32_pmu_get_wakeup_reason,
|
||
|
.pfnSetMcuHeartbeatEnable = stm32_pmu_SetMcuHeartbeatEnable,
|
||
|
},
|
||
|
#elif (HAL_CFG_PMU_TYPE == HAL_CFG_PMU_TYPE_6441)
|
||
|
{
|
||
|
.pfnInit = atbm6441_pmu_init,
|
||
|
.pfnDeinit = atbm6441_pmu_deinit,
|
||
|
.pfnGetFwVersion = NULL,
|
||
|
.pfnSetWifiEnable = NULL,
|
||
|
.pfnGetWifiEnable = NULL,
|
||
|
.pfnRestAP = atbm6441_pmu_reset_ap,
|
||
|
.pfnResetWifi = NULL,
|
||
|
.pfnRestAPOta = atbm6441_pmu_reset_ap_by_ota,
|
||
|
.pfnPowerOffAP = NULL,
|
||
|
.pfnSetTime = NULL,
|
||
|
.pfnGetTime = NULL,
|
||
|
.pfnSetWakeUpDelay = NULL,
|
||
|
.pfnSyncMode = NULL,
|
||
|
.pfnGetWakeupReason = atbm6441_pmu_get_wakeup_reason,
|
||
|
.pfnSetMcuHeartbeatEnable = NULL,
|
||
|
},
|
||
|
#endif
|
||
|
};
|
||
|
|
||
|
|
||
|
ST_HAL_PMU_INTERFACE* HAL_PMU_GetInterface(int32_t channel)
|
||
|
{
|
||
|
|
||
|
#if (HAL_CFG_PMU_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 &gHalPmuInterface[idx];
|
||
|
#endif
|
||
|
|
||
|
}
|
||
|
|