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