From 923aa48126259c13de95131203f1d28bfa5cb889 Mon Sep 17 00:00:00 2001 From: Rafal Jaworowski Date: Fri, 23 Jan 2009 13:27:18 +0100 Subject: API: Improve glue mid-layer of the API demo application. - Extend ub_dev_read() and ub_dev_recv() so they return the length actually read, which allows for better control and error handling (this introduces additional error code API_ESYSC returned by the glue mid-layer). - Clean up definitions naming and usage. - Other minor cosmetics. Note these changes do not touch the API proper, so the interface between U-Boot and standalone applications remains unchanged. Signed-off-by: Rafal Jaworowski --- api_examples/glue.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'api_examples/glue.h') diff --git a/api_examples/glue.h b/api_examples/glue.h index 0adb8b388..6bf47d07c 100644 --- a/api_examples/glue.h +++ b/api_examples/glue.h @@ -32,6 +32,9 @@ #define API_SEARCH_LEN (3 * 1024 * 1024) /* 3MB search range */ +#define UB_MAX_MR 5 /* max mem regions number */ +#define UB_MAX_DEV 6 /* max devices number */ + extern void *syscall_ptr; extern uint32_t search_hint; @@ -39,9 +42,10 @@ int syscall(int, int *, ...); int api_search_sig(struct api_signature **sig); /* - * ub_ library calls are part of the application, not U-Boot code! They are - * front-end wrappers that are used by the consumer application: they prepare - * arguments for particular syscall and jump to the low level syscall() + * The ub_ library calls are part of the application, not U-Boot code! They + * are front-end wrappers that are used by the consumer application: they + * prepare arguments for particular syscall and jump to the low level + * syscall() */ /* console */ @@ -67,10 +71,10 @@ const char * ub_env_enum(const char *last); int ub_dev_enum(void); int ub_dev_open(int handle); int ub_dev_close(int handle); -int ub_dev_read(int handle, void *buf, - lbasize_t len, lbastart_t start); +int ub_dev_read(int handle, void *buf, lbasize_t len, + lbastart_t start, lbasize_t *rlen); int ub_dev_send(int handle, void *buf, int len); -int ub_dev_recv(int handle, void *buf, int len); +int ub_dev_recv(int handle, void *buf, int len, int *rlen); struct device_info * ub_dev_get(int); #endif /* _API_GLUE_H_ */ -- cgit v1.2.3-70-g09d2