arch/arm: add up_systempoweroff()
Co-authored-by: Neo Xu <neo.xu1990@gmail.com> Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
parent
85a7b94a2e
commit
c429438f0d
@ -230,3 +230,53 @@ int arm_psci_init(const char *method)
|
||||
|
||||
return psci_detect();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Name: up_systempoweroff
|
||||
*
|
||||
* Description:
|
||||
* Internal, arm poweroff logic.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void up_systempoweroff(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Set up for the system poweroff */
|
||||
|
||||
ret = psci_cpu_off();
|
||||
if (ret)
|
||||
{
|
||||
sinfo("Failed to power off CPU, error code: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Wait for power off */
|
||||
|
||||
for (; ; );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Name: up_systemreset
|
||||
*
|
||||
* Description:
|
||||
* Internal, arm reset logic.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void up_systemreset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Set up for the system reset */
|
||||
|
||||
ret = psci_cpu_reset();
|
||||
if (ret)
|
||||
{
|
||||
sinfo("Failed to reset CPU, error code: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Wait for the reset */
|
||||
|
||||
for (; ; );
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ if(CONFIG_ARCH_HAVE_MPU)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARM64_PSCI)
|
||||
list(APPEND SRCS arm64_cpu_psci.c arm64_systemreset.c)
|
||||
list(APPEND SRCS arm64_cpu_psci.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SMP)
|
||||
|
@ -76,7 +76,7 @@ CMN_CSRCS += arm64_mpu.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARM64_PSCI),y)
|
||||
CMN_CSRCS += arm64_cpu_psci.c arm64_systemreset.c
|
||||
CMN_CSRCS += arm64_cpu_psci.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SMP),y)
|
||||
|
@ -232,3 +232,53 @@ int arm64_psci_init(const char * method)
|
||||
|
||||
return psci_detect();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Name: up_systempoweroff
|
||||
*
|
||||
* Description:
|
||||
* Internal, arm64 poweroff logic.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void up_systempoweroff(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Set up for the system poweroff */
|
||||
|
||||
ret = psci_cpu_off();
|
||||
if (ret)
|
||||
{
|
||||
serr("Failed to power off CPU, error code: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Wait for power off */
|
||||
|
||||
for (; ; );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Name: up_systemreset
|
||||
*
|
||||
* Description:
|
||||
* Internal, arm64 reset logic.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void up_systemreset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Set up for the system reset */
|
||||
|
||||
ret = psci_cpu_reset();
|
||||
if (ret)
|
||||
{
|
||||
serr("Failed to reset CPU, error code: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Wait for the reset */
|
||||
|
||||
for (; ; );
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/common/arm64_systemreset.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "arm64_internal.h"
|
||||
#include "arm64_cpu_psci.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_systemreset
|
||||
*
|
||||
* Description:
|
||||
* Internal, arm64 reset logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_systemreset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Set up for the system reset */
|
||||
|
||||
ret = psci_cpu_reset();
|
||||
if (ret)
|
||||
{
|
||||
sinfo("Failed to reset CPU, error code: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Wait for the reset */
|
||||
|
||||
for (; ; );
|
||||
}
|
@ -213,6 +213,18 @@ pid_t up_fork(void);
|
||||
|
||||
void up_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_systempoweroff
|
||||
*
|
||||
* Description:
|
||||
* The function up_systempoweroff() will power down the MCU. Optional!
|
||||
* Availability of this function is dependent upon the architecture
|
||||
* support.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_systempoweroff(void) noreturn_function;
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_systemreset
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user