Fixed tools/env utilities
[u-boot-openmoko/mini2440.git] / include / bootmenu.h
blob3cc3986b49eccecf5d33b5e787aef1180719353a
1 /*
2 * bootmenu.h - Boot menu
4 * Copyright (C) 2006-2008 by OpenMoko, Inc.
5 * Written by Werner Almesberger <werner@openmoko.org>
6 * All Rights Reserved
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef BOOTMENU_H
24 #define BOOTMENU_H
26 #define MIN_BOOT_MENU_TIMEOUT 10 /* 10 seconds */
27 #define BOOT_MENU_TIMEOUT 60 /* 60 seconds */
28 #define AFTER_COMMAND_WAIT 3 /* wait (2,3] after running commands */
29 #define MAX_MENU_ITEMS 10 /* cut off after that many */
32 struct bootmenu_setup {
33 /* title comment, NULL if none */
34 const char *comment;
36 /* non-zero while the "next" key is being pressed */
37 int (*next_key)(void *user);
39 /* non-zero while the "enter" key is being pressed */
40 int (*enter_key)(void *user);
42 /* return the number of seconds that have passed since the last call
43 to "seconds". It's okay to limit the range to [0, 1]. */
44 int (*seconds)(void *user);
46 /* action to take if the boot menu times out */
47 void (*idle_action)(void *user);
49 /* user-specific data, passed "as is" to the functions above */
50 void *user;
52 /* Action to invoke the "next" function. Begins in upper case. E.g.,
53 "Press [AUX]". */
54 const char *next_key_action;
56 /* Name of the "enter" key, optionally with an action (in lower case).
57 E.g., "[POWER]" or "tap the screen". */
58 const char *enter_key_name;
63 * Initialize the menu from the environment.
66 void bootmenu_init(struct bootmenu_setup *setup);
69 * To add entries on top of the boot menu, call bootmenu_add before
70 * bootmenu_init. To add entries at the end, call it after bootmenu_init.
71 * If "fn" is NULL, the command specified in "user" is executed.
74 void bootmenu_add(const char *label, void (*fn)(void *user), void *user);
77 * Run the boot menu.
80 void bootmenu(void);
82 #endif /* !BOOTMENU_H */