core: move reboot.c to a general power.c file
feature: halt added
This commit is contained in:
parent
e7a8d39ad7
commit
963bf46b62
@ -43,7 +43,17 @@ static const char *POOP =
|
||||
" \\_ \\___\"\"\"/\"\" / `\"\"/\"\" "
|
||||
"\n";
|
||||
|
||||
typedef enum { HELP, REBOOT, POWEROFF, ECHO, COLOR, MERDELLA, ERROR } CMD_TOK;
|
||||
typedef enum {
|
||||
HELP,
|
||||
REBOOT,
|
||||
POWEROFF,
|
||||
HALT,
|
||||
ECHO,
|
||||
COLOR,
|
||||
MERDELLA,
|
||||
ERROR
|
||||
} CMD_TOK;
|
||||
|
||||
void reboot(void);
|
||||
void halt(void);
|
||||
void shell_init(void);
|
||||
|
@ -27,6 +27,8 @@ static CMD_TOK find_command(char *line)
|
||||
command = REBOOT;
|
||||
else if (!strcmp(line, "poweroff"))
|
||||
command = POWEROFF;
|
||||
else if (!strcmp(line, "halt"))
|
||||
command = HALT;
|
||||
else if (!strcmp(line, "echo"))
|
||||
command = ECHO;
|
||||
else if (!strcmp(line, "color"))
|
||||
@ -85,12 +87,14 @@ void shell_init(void)
|
||||
"poweroff, echo, color, merdella\n");
|
||||
break;
|
||||
case REBOOT:
|
||||
kprintf(0, "rebooting...\n");
|
||||
reboot();
|
||||
break;
|
||||
case POWEROFF:
|
||||
kprintf(0, "powering off\n");
|
||||
break;
|
||||
case HALT:
|
||||
halt();
|
||||
break;
|
||||
case ECHO:
|
||||
kprintf(0, "echoing\n");
|
||||
break;
|
||||
|
@ -30,3 +30,8 @@ loop:
|
||||
asm volatile("hlt"); /* if that didn't work, halt the CPU */
|
||||
goto loop; /* if a NMI is received, halt again */
|
||||
}
|
||||
|
||||
void halt(void)
|
||||
{
|
||||
asm volatile("hlt");
|
||||
}
|
Loading…
Reference in New Issue
Block a user