blob: 6bf47d07c8f5484dffee1ed7e4d8b790d310807a [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 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 * MA 02111-1307 USA
23 *
24 */
25
26/*
27 * This is the header file for conveniency wrapper routines (API glue)
28 */
29
30#ifndef _API_GLUE_H_
31#define _API_GLUE_H_
32
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010033#define API_SEARCH_LEN (3 * 1024 * 1024) /* 3MB search range */
Rafal Jaworowskia19be782008-01-09 19:39:36 +010034
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010035#define UB_MAX_MR 5 /* max mem regions number */
36#define UB_MAX_DEV 6 /* max devices number */
37
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010038extern void *syscall_ptr;
39extern uint32_t search_hint;
Rafal Jaworowskia19be782008-01-09 19:39:36 +010040
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010041int syscall(int, int *, ...);
Rafal Jaworowskia19be782008-01-09 19:39:36 +010042int api_search_sig(struct api_signature **sig);
43
44/*
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010045 * The ub_ library calls are part of the application, not U-Boot code! They
46 * are front-end wrappers that are used by the consumer application: they
47 * prepare arguments for particular syscall and jump to the low level
48 * syscall()
Rafal Jaworowskia19be782008-01-09 19:39:36 +010049 */
50
51/* console */
52int ub_getc(void);
53int ub_tstc(void);
54void ub_putc(char c);
55void ub_puts(const char *s);
56
57/* system */
58void ub_reset(void);
59struct sys_info * ub_get_sys_info(void);
60
61/* time */
62void ub_udelay(unsigned long);
63unsigned long ub_get_timer(unsigned long);
64
65/* env vars */
66char * ub_env_get(const char *name);
67void ub_env_set(const char *name, char *value);
68const char * ub_env_enum(const char *last);
69
70/* devices */
71int ub_dev_enum(void);
72int ub_dev_open(int handle);
73int ub_dev_close(int handle);
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010074int ub_dev_read(int handle, void *buf, lbasize_t len,
75 lbastart_t start, lbasize_t *rlen);
Rafal Jaworowskia19be782008-01-09 19:39:36 +010076int ub_dev_send(int handle, void *buf, int len);
Rafal Jaworowski6feb82d2009-01-23 13:27:18 +010077int ub_dev_recv(int handle, void *buf, int len, int *rlen);
Rafal Jaworowskia19be782008-01-09 19:39:36 +010078struct device_info * ub_dev_get(int);
79
80#endif /* _API_GLUE_H_ */