blob: f9745604b6c2fee5c94deaf24174dfe71da9c6b3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Rafal Jaworowskia19be782008-01-09 19:39:36 +01002/*
3 * (C) Copyright 2007 Semihalf
4 *
5 * Written by: Rafal Jaworowski <raj@semihalf.com>
Rafal Jaworowskia19be782008-01-09 19:39:36 +01006 */
7
8/*
9 * This is the header file for conveniency wrapper routines (API glue)
10 */
11
12#ifndef _API_GLUE_H_
13#define _API_GLUE_H_
14
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010015#define API_SEARCH_LEN (3 * 1024 * 1024) /* 3MB search range */
Rafal Jaworowskia19be782008-01-09 19:39:36 +010016
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010017#define UB_MAX_MR 5 /* max mem regions number */
18#define UB_MAX_DEV 6 /* max devices number */
19
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010020extern void *syscall_ptr;
21extern uint32_t search_hint;
Rafal Jaworowskia19be782008-01-09 19:39:36 +010022
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010023int syscall(int, int *, ...);
Rafal Jaworowskia19be782008-01-09 19:39:36 +010024int api_search_sig(struct api_signature **sig);
25
26/*
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010027 * The ub_ library calls are part of the application, not U-Boot code! They
28 * are front-end wrappers that are used by the consumer application: they
29 * prepare arguments for particular syscall and jump to the low level
30 * syscall()
Rafal Jaworowskia19be782008-01-09 19:39:36 +010031 */
32
33/* console */
34int ub_getc(void);
35int ub_tstc(void);
36void ub_putc(char c);
37void ub_puts(const char *s);
38
39/* system */
40void ub_reset(void);
41struct sys_info * ub_get_sys_info(void);
42
43/* time */
44void ub_udelay(unsigned long);
45unsigned long ub_get_timer(unsigned long);
46
47/* env vars */
48char * ub_env_get(const char *name);
49void ub_env_set(const char *name, char *value);
50const char * ub_env_enum(const char *last);
51
52/* devices */
53int ub_dev_enum(void);
54int ub_dev_open(int handle);
55int ub_dev_close(int handle);
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010056int ub_dev_read(int handle, void *buf, lbasize_t len,
57 lbastart_t start, lbasize_t *rlen);
Rafal Jaworowskia19be782008-01-09 19:39:36 +010058int ub_dev_send(int handle, void *buf, int len);
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010059int ub_dev_recv(int handle, void *buf, int len, int *rlen);
Rafal Jaworowskia19be782008-01-09 19:39:36 +010060struct device_info * ub_dev_get(int);
61
Che-Liang Chiou0d460412011-10-20 23:04:22 +000062/* display */
63int ub_display_get_info(int type, struct display_info *di);
64int ub_display_draw_bitmap(ulong bitmap, int x, int y);
65void ub_display_clear(void);
66
Rafal Jaworowskia19be782008-01-09 19:39:36 +010067#endif /* _API_GLUE_H_ */