Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2007 Semihalf |
| 4 | * |
| 5 | * Written by: Rafal Jaworowski <raj@semihalf.com> |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 6 | */ |
| 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 Jaworowski | 3d25ba5 | 2009-01-23 13:27:15 +0100 | [diff] [blame] | 15 | #define API_SEARCH_LEN (3 * 1024 * 1024) /* 3MB search range */ |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 16 | |
Rafal Jaworowski | 6feb82d | 2009-01-23 13:27:18 +0100 | [diff] [blame] | 17 | #define UB_MAX_MR 5 /* max mem regions number */ |
| 18 | #define UB_MAX_DEV 6 /* max devices number */ |
| 19 | |
Rafal Jaworowski | 3d25ba5 | 2009-01-23 13:27:15 +0100 | [diff] [blame] | 20 | extern void *syscall_ptr; |
| 21 | extern uint32_t search_hint; |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 22 | |
Rafal Jaworowski | 3d25ba5 | 2009-01-23 13:27:15 +0100 | [diff] [blame] | 23 | int syscall(int, int *, ...); |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 24 | int api_search_sig(struct api_signature **sig); |
| 25 | |
| 26 | /* |
Rafal Jaworowski | 6feb82d | 2009-01-23 13:27:18 +0100 | [diff] [blame] | 27 | * 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 Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | /* console */ |
| 34 | int ub_getc(void); |
| 35 | int ub_tstc(void); |
| 36 | void ub_putc(char c); |
| 37 | void ub_puts(const char *s); |
| 38 | |
| 39 | /* system */ |
| 40 | void ub_reset(void); |
| 41 | struct sys_info * ub_get_sys_info(void); |
| 42 | |
| 43 | /* time */ |
| 44 | void ub_udelay(unsigned long); |
| 45 | unsigned long ub_get_timer(unsigned long); |
| 46 | |
| 47 | /* env vars */ |
| 48 | char * ub_env_get(const char *name); |
| 49 | void ub_env_set(const char *name, char *value); |
| 50 | const char * ub_env_enum(const char *last); |
| 51 | |
| 52 | /* devices */ |
| 53 | int ub_dev_enum(void); |
| 54 | int ub_dev_open(int handle); |
| 55 | int ub_dev_close(int handle); |
Rafal Jaworowski | 6feb82d | 2009-01-23 13:27:18 +0100 | [diff] [blame] | 56 | int ub_dev_read(int handle, void *buf, lbasize_t len, |
| 57 | lbastart_t start, lbasize_t *rlen); |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 58 | int ub_dev_send(int handle, void *buf, int len); |
Rafal Jaworowski | 6feb82d | 2009-01-23 13:27:18 +0100 | [diff] [blame] | 59 | int ub_dev_recv(int handle, void *buf, int len, int *rlen); |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 60 | struct device_info * ub_dev_get(int); |
| 61 | |
Che-Liang Chiou | 0d46041 | 2011-10-20 23:04:22 +0000 | [diff] [blame] | 62 | /* display */ |
| 63 | int ub_display_get_info(int type, struct display_info *di); |
| 64 | int ub_display_draw_bitmap(ulong bitmap, int x, int y); |
| 65 | void ub_display_clear(void); |
| 66 | |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 67 | #endif /* _API_GLUE_H_ */ |