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