Browse Source

add reboot cmd for arm and delete shutcmd from Wang Wei_gen

it is OK
pull/3/head
xuedongliang 1 year ago
parent
commit
86d96159fe
  1. 8
      arch/arm/shared/prepare_ahwstack.c
  2. 11
      arch/risc-v/shared/prepare_rhwstack.c
  3. 33
      board/aiit-riscv64-board/board.c
  4. 26
      board/kd233/board.c
  5. 28
      board/maix-go/board.c
  6. 4
      fs/shared/src/iot-vfs.c
  7. 2
      tool/shell/letter-shell/shell.c

8
arch/arm/shared/prepare_ahwstack.c

@ -16,6 +16,7 @@
#include "svc_handle.h"
#include "stm32f4xx.h"
#include <board.h>
#include <shell.h>
#if (defined ( __GNUC__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__))
#define USE_FPU 1
@ -410,13 +411,8 @@ void MemFaultHandle(uintptr_t *sp)
}
void ShutdownCpu(void)
{
KPrintf("shutdown...\n");
CHECK(0);
}
__attribute__((weak)) void HwCpuReset(void)
{
SCB_AIRCR = SCB_RESET_VALUE;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0), Reboot, HwCpuReset, reset machine );

11
arch/risc-v/shared/prepare_rhwstack.c

@ -96,17 +96,6 @@ uint8 KTaskStackSetup(struct TaskDescriptor *task)
return EOK;
}
void ShutdownCpu()
{
uint32 level;
KPrintf("shutdown...\n");
level = DISABLE_INTERRUPT();
while (level)
CHECK(0);
}
#ifdef TASK_ISOLATION
void RestoreMstatus(uintptr_t *sp)
{

33
board/aiit-riscv64-board/board.c

@ -53,7 +53,6 @@ Modification:
extern x_base cpu2_boot_flag;
extern void entry(void);
extern void SecondaryCpuCStart(void);
extern void ShutdownCpu(void);
extern int IoConfigInit(void);
extern int HwCh438Init(void);
extern int HwSpiInit(void);
@ -98,7 +97,7 @@ void Kd233Start(uint32_t mhartid)
}
}
int freq(void)
int Freq(void)
{
uint64 value = 0;
@ -124,7 +123,7 @@ int freq(void)
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),freq, freq, show freq info );
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),Freq, Freq, show frequency information );
#ifdef ARCH_SMP
extern int EnableHwclintIpi(void);
@ -218,30 +217,6 @@ void HwCpuReset(void)
while(RET_TRUE);
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
reboot, HwCpuReset, reset machine );
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0), Reboot, HwCpuReset, reset machine );
static void (*pre_shutdown_action)(void *);
static void *pre_shutdown_action_arg;
void SetPreShutdownAction(void (*func)(void *), void *arg)
{
pre_shutdown_action = func;
pre_shutdown_action_arg = arg;
}
void cmd_shutdown()
{
#ifdef FS_VFS
SyncOpenedFiles();
#endif
if (pre_shutdown_action != NULL)
pre_shutdown_action(pre_shutdown_action_arg);
ShutdownCpu();
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
shutdown,cmd_shutdown,shutdown machine);

26
board/kd233/board.c

@ -54,7 +54,6 @@ Modification:
extern x_base cpu2_boot_flag;
extern void entry(void);
extern void SecondaryCpuCStart(void);
extern void ShutdownCpu(void);
extern int IoConfigInit(void);
extern int HwSpiInit(void);
extern int HwI2cInit(void);
@ -121,7 +120,7 @@ int Freq(void)
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),freq, Freq, show freq info );
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),Freq, Freq, show frequency information );
#ifdef ARCH_SMP
extern int EnableHwclintIpi(void);
@ -205,27 +204,6 @@ void HwCpuReset(void)
while(RET_TRUE);
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
reboot, HwCpuReset, reset machine );
static void (*pre_shutdown_action)(void *);
static void *pre_shutdown_action_arg;
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),Reboot, HwCpuReset, reset machine );
void SetPreShutdownAction(void (*func)(void *), void *arg)
{
pre_shutdown_action = func;
pre_shutdown_action_arg = arg;
}
void CmdShutdown()
{
#ifdef FS_VFS
SyncOpenedFiles();
#endif
if (pre_shutdown_action != NULL)
pre_shutdown_action(pre_shutdown_action_arg);
ShutdownCpu();
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
shutdown,CmdShutdown,shutdown machine);

28
board/maix-go/board.c

@ -51,7 +51,6 @@ Modification:
extern x_base cpu2_boot_flag;
extern void entry(void);
extern void SecondaryCpuCStart(void);
extern void ShutdownCpu(void);
extern int IoConfigInit(void);
extern int HwSpiInit(void);
extern int HwI2cInit(void);
@ -117,7 +116,7 @@ int Freq(void)
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),freq, Freq, show freq info );
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),Freq, Freq, show frequency information );
#ifdef ARCH_SMP
extern int EnableHwclintIpi(void);
@ -170,27 +169,6 @@ void HwCpuReset(void)
while(RET_TRUE);
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
reboot, HwCpuReset, reset machine );
static void (*pre_shutdown_action)(void *);
static void *pre_shutdown_action_arg;
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),Reboot, HwCpuReset, reset machine );
void SetPreShutdownAction(void (*func)(void *), void *arg)
{
pre_shutdown_action = func;
pre_shutdown_action_arg = arg;
}
void CmdShutdown()
{
#ifdef FS_VFS
SyncOpenedFiles();
#endif
if (pre_shutdown_action != NULL)
pre_shutdown_action(pre_shutdown_action_arg);
ShutdownCpu();
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
shutdown,CmdShutdown,shutdown machine);

4
fs/shared/src/iot-vfs.c

@ -1164,7 +1164,7 @@ int VfsInit()
return 0;
}
int showfd()
int ShowFd()
{
for (int i = 0; i < FD_MAX - FD_OFFSET; i++) {
struct FileDescriptor *fdp = fdtable[i];
@ -1178,4 +1178,4 @@ int showfd()
KPrintf("%s\n", fdp->path);
}
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),showfd, showfd, list file descriptor );
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),ShowFd, ShowFd, show file descriptor );

2
tool/shell/letter-shell/shell.c

@ -1545,7 +1545,7 @@ void shellHelp(int argc, char *argv[])
}
SHELL_EXPORT_CMD(
SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
help, shellHelp, show command info\r\nhelp [cmd]);
Help, shellHelp, show command info\r\nhelp [cmd]);
/**
* @brief shell Input processing

Loading…
Cancel
Save