Skip to content

Commit

Permalink
[init]rename some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jianjunjiang committed Sep 23, 2017
1 parent c149447 commit c5df776
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
22 changes: 19 additions & 3 deletions src/arch/x64/mach-sandbox/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,28 @@

extern int xboot_main(int argc, char * argv[]);

const char * auto_boot_command(void)
void do_autoboot(void)
{
struct sandbox_t * sandbox = sandbox_get();
int delay = CONFIG_AUTO_BOOT_DELAY * 1000;

do {
if(getchar() != EOF)
{
printf("\r\n");
return;
}
mdelay(10);
delay -= 10;
if(delay < 0)
delay = 0;
printf("\rPress any key to stop autoboot:%3d.%03d%s", delay / 1000, delay % 1000, (delay == 0) ? "\r\n" : "");
} while(delay > 0);

if(sandbox && sandbox->app)
return sandbox->app;
return CONFIG_AUTO_BOOT_COMMAND;
system(sandbox->app);
else
system(CONFIG_AUTO_BOOT_COMMAND);
}

int main(int argc, char * argv[])
Expand Down
4 changes: 2 additions & 2 deletions src/include/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ extern "C" {

#include <xboot.h>

void do_show_logo(void);
void do_auto_boot(void);
void do_showlogo(void);
void do_autoboot(void);

#ifdef __cplusplus
}
Expand Down
14 changes: 4 additions & 10 deletions src/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <fb/fb.h>
#include <init.h>

void do_show_logo(void)
void do_showlogo(void)
{
struct device_t * pos, * n;
cairo_surface_t * logo;
Expand Down Expand Up @@ -68,13 +68,7 @@ void do_show_logo(void)
cairo_surface_destroy(logo);
}

static const char * __auto_boot_command(void)
{
return CONFIG_AUTO_BOOT_COMMAND;
}
extern __typeof(__auto_boot_command) auto_boot_command __attribute__((weak, alias("__auto_boot_command")));

void do_auto_boot(void)
static void __do_autoboot(void)
{
int delay = CONFIG_AUTO_BOOT_DELAY * 1000;

Expand All @@ -84,13 +78,13 @@ void do_auto_boot(void)
printf("\r\n");
return;
}

mdelay(10);
delay -= 10;
if(delay < 0)
delay = 0;
printf("\rPress any key to stop autoboot:%3d.%03d%s", delay / 1000, delay % 1000, (delay == 0) ? "\r\n" : "");
} while(delay > 0);

system(auto_boot_command());
system(CONFIG_AUTO_BOOT_COMMAND);
}
extern __typeof(__do_autoboot) do_autoboot __attribute__((weak, alias("__do_autoboot")));
6 changes: 3 additions & 3 deletions src/init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ int xboot_main(int argc, char * argv[])
do_initcalls();

/* Do show logo */
do_show_logo();
do_showlogo();

/* Do run auto boot command */
do_auto_boot();
/* Do auto boot */
do_autoboot();

/* Run loop */
while(1)
Expand Down

0 comments on commit c5df776

Please sign in to comment.