+#define LITTLE_ENDIAN 1234
+#define BIG_ENDIAN 4321
+
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+
+#define RAND_MAX 0x7fffffff
+
+#define MAX_ARGC_COUNT 10
+
+/*
+ * Payload information parameters - these are used to pass information
+ * to the entity loading the payload.
+ * Usage: PAYLOAD_INFO(key, value)
+ * Example: PAYLOAD_INFO(name, "CoreInfo!")
+ */
+#define _pstruct(key) __pinfo_ ##key
+#define PAYLOAD_INFO(key, value) \
+static const char _pstruct(key)[] \
+ __attribute__((__used__)) \
+ __attribute__((section(".note.pinfo"),unused)) = #key "=" value
+
+/**
+ * @defgroup nvram NVRAM and RTC functions
+ * @{
+ */
+
+#define NVRAM_RTC_SECONDS 0 /**< RTC Seconds offset in CMOS */
+#define NVRAM_RTC_MINUTES 2 /**< RTC Minutes offset in CMOS */
+#define NVRAM_RTC_HOURS 4 /**< RTC Hours offset in CMOS */
+#define NVRAM_RTC_DAY 7 /**< RTC Days offset in CMOS */
+#define NVRAM_RTC_MONTH 8 /**< RTC Month offset in CMOS */
+#define NVRAM_RTC_YEAR 9 /**< RTC Year offset in CMOS */
+#define NVRAM_RTC_FREQ_SELECT 10 /**< RTC Update Status Register */
+#define NVRAM_RTC_UIP 0x80
+
+/** Broken down time structure */
+struct tm {
+ int tm_sec; /**< Number of seconds after the minute */
+ int tm_min; /**< Number of minutes after the hour */
+ int tm_hour; /**< Number of hours past midnight */
+ int tm_mday; /**< The day of the month */
+ int tm_mon; /**< The month of the year */
+ int tm_year; /**< The number of years since 1900 */
+ int tm_wday; /**< The day of the week */
+ int tm_yday; /**< The number of days since January 1 */
+ int tm_isdst; /**< A flag indicating daylight savings time */
+};
+
+u8 nvram_read(u8 addr);
+void nvram_write(u8 val, u8 addr);
+int nvram_updating(void);
+void rtc_read_clock(struct tm *tm);
+/** @} */
+
+/**
+ * @defgroup usb USB functions
+ * @{
+ */
+int usb_initialize(void);
+int usb_exit (void);
+int usbhid_havechar(void);
+int usbhid_getchar(void);
+/** @} */
+
+/**
+ * @defgroup input Device functions
+ * @{ @}
+ */
+
+extern void (*reset_handler)(void);
+int add_reset_handler(void (*new_handler)(void));
+
+/**
+ * @defgroup keyboard Keyboard functions
+ * @ingroup input
+ * @{
+ */
+void keyboard_init(void);
+int keyboard_havechar(void);
+unsigned char keyboard_get_scancode(void);
+int keyboard_getchar(void);
+int keyboard_set_layout(char *country);
+/** @} */
+
+/**
+ * @defgroup serial Serial functions
+ * @ingroup input
+ * @{
+ */
+void serial_init(void);
+void serial_putchar(unsigned int c);
+int serial_havechar(void);
+int serial_getchar(void);
+void serial_clear(void);
+void serial_start_bold(void);
+void serial_end_bold(void);
+void serial_start_reverse(void);
+void serial_end_reverse(void);
+void serial_start_altcharset(void);
+void serial_end_altcharset(void);
+void serial_set_color(short fg, short bg);
+void serial_cursor_enable(int state);
+void serial_set_cursor(int y, int x);
+/** @} */
+
+/**
+ * @defgroup speaker Speaker functions
+ * @ingroup input
+ * @{
+ */
+void speaker_enable(u16 freq);
+void speaker_disable(void);
+void speaker_tone(u16 freq, unsigned int duration);
+/** @} */
+
+/**
+ * @defgroup video Video functions
+ * @ingroup input
+ * @{
+ */
+int video_console_init(void);
+void video_console_putchar(unsigned int ch);
+void video_console_putc(u8 row, u8 col, unsigned int ch);
+void video_console_clear(void);
+void video_console_cursor_enable(int state);
+void video_console_get_cursor(unsigned int *x, unsigned int *y, unsigned int *en);
+void video_console_set_cursor(unsigned int cursorx, unsigned int cursory);
+/** @} */
+
+/* drivers/option.c */
+struct nvram_accessor {
+ u8 (*read)(u8 reg);
+ void (*write)(u8 val, u8 reg);
+};
+
+extern u8 *mem_accessor_base;
+extern struct nvram_accessor *use_nvram, *use_mem;
+
+struct cb_cmos_option_table *get_system_option_table(void);
+int options_checksum_valid(const struct nvram_accessor *nvram);
+void fix_options_checksum_with(const struct nvram_accessor *nvram);
+void fix_options_checksum(void);
+struct cb_cmos_entries *first_cmos_entry(struct cb_cmos_option_table *option_table);
+struct cb_cmos_entries *next_cmos_entry(struct cb_cmos_entries *cur);
+int get_option_with(const struct nvram_accessor *nvram, struct cb_cmos_option_table *option_table, void *dest, char *name);
+int get_option_from(struct cb_cmos_option_table *option_table, void *dest, char *name);
+int get_option(void *dest, char *name);
+int set_option_with(const struct nvram_accessor *nvram, struct cb_cmos_option_table *option_table, void *value, char *name);
+int set_option(void *value, char *name);
+int get_option_as_string(const struct nvram_accessor *nvram, struct cb_cmos_option_table *option_table, char **dest, char *name);
+int set_option_from_string(const struct nvram_accessor *nvram, struct cb_cmos_option_table *option_table, char *value, char *name);
+
+/**
+ * @defgroup console Console functions
+ * @{
+ */
+void console_init(void);
+int putchar(unsigned int c);
+int puts(const char *s);
+int havekey(void);
+int getchar(void);
+int getchar_timeout(int *ms);