vaseboot/include/VasEBoot/uboot/uboot.h

88 lines
3.2 KiB
C

/* uboot.h - declare variables and functions for U-Boot support */
/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VAS_EBOOT_UBOOT_UBOOT_HEADER
#define VAS_EBOOT_UBOOT_UBOOT_HEADER 1
#include <VasEBoot/types.h>
#include <VasEBoot/dl.h>
/* Functions. */
void VasEBoot_uboot_mm_init (void);
void VasEBoot_uboot_init (void);
void VasEBoot_uboot_fini (void);
void VasEBoot_uboot_return (int) __attribute__ ((noreturn));
VasEBoot_addr_t VasEBoot_uboot_get_real_bss_start (void);
VasEBoot_err_t VasEBoot_uboot_probe_hardware (void);
extern VasEBoot_addr_t EXPORT_VAR (start_of_ram);
VasEBoot_uint32_t EXPORT_FUNC (VasEBoot_uboot_get_machine_type) (void);
VasEBoot_addr_t EXPORT_FUNC (VasEBoot_uboot_get_boot_data) (void);
/*
* The U-Boot API operates through a "syscall" interface, consisting of an
* entry point address and a set of syscall numbers. The location of this
* entry point is described in a structure allocated on the U-Boot heap.
* We scan through a defined region around the hint address passed to us
* from U-Boot.
*/
#define UBOOT_API_SEARCH_LEN (3 * 1024 * 1024)
int VasEBoot_uboot_api_init (void);
/*
* All functions below are wrappers around the uboot_syscall() function,
* implemented in VasEBoot-core/kern/uboot/uboot.c
*/
int VasEBoot_uboot_getc (void);
int VasEBoot_uboot_tstc (void);
void VasEBoot_uboot_putc (int c);
void VasEBoot_uboot_puts (const char *s);
void EXPORT_FUNC (VasEBoot_uboot_reset) (void);
struct sys_info *VasEBoot_uboot_get_sys_info (void);
void VasEBoot_uboot_udelay (VasEBoot_uint32_t usec);
VasEBoot_uint32_t VasEBoot_uboot_get_timer (VasEBoot_uint32_t base);
int EXPORT_FUNC (VasEBoot_uboot_dev_enum) (void);
struct device_info * EXPORT_FUNC (VasEBoot_uboot_dev_get) (int index);
int EXPORT_FUNC (VasEBoot_uboot_dev_open) (struct device_info *dev);
int EXPORT_FUNC (VasEBoot_uboot_dev_close) (struct device_info *dev);
int VasEBoot_uboot_dev_write (struct device_info *dev, const void *buf,
VasEBoot_size_t blocks, VasEBoot_uint32_t start);
int VasEBoot_uboot_dev_read (struct device_info *dev, void *buf, VasEBoot_size_t blocks,
VasEBoot_uint32_t start, VasEBoot_size_t * real_blocks);
int EXPORT_FUNC (VasEBoot_uboot_dev_recv) (struct device_info *dev, void *buf,
int size, int *real_size);
int EXPORT_FUNC (VasEBoot_uboot_dev_send) (struct device_info *dev, void *buf,
int size);
char *VasEBoot_uboot_env_get (const char *name);
void VasEBoot_uboot_env_set (const char *name, const char *value);
#endif /* ! VAS_EBOOT_UBOOT_UBOOT_HEADER */