API for external applications.

This is an API for external (standalone) applications running on top of
U-Boot, and is meant to be more extensible and robust than the existing
jumptable mechanism. It is similar to UNIX syscall approach. See api/README
for more details.

Included is the demo application using this new framework (api_examples).

Please note this is still an experimental feature, and is turned off by
default.

Signed-off-by: Rafal Jaworowski <raj@semihalf.com>
diff --git a/Makefile b/Makefile
index 47db5b7..0e94875 100644
--- a/Makefile
+++ b/Makefile
@@ -243,6 +243,9 @@
 	"post/board/$(BOARDDIR)/libpost$(BOARD).a"; fi)
 LIBS += common/libcommon.a
 LIBS += libfdt/libfdt.a
+ifeq ($(CONFIG_API),y)
+LIBS += api/libapi.a
+endif
 
 LIBS := $(addprefix $(obj),$(LIBS))
 .PHONY : $(LIBS)
@@ -255,6 +258,10 @@
 SUBDIRS	= tools \
 	  examples
 
+ifeq ($(CONFIG_API),y)
+SUBDIRS += api_examples
+endif
+
 .PHONY : $(SUBDIRS)
 
 ifeq ($(CONFIG_NAND_U_BOOT),y)
@@ -2749,6 +2756,7 @@
 	rm -f $(obj)board/bf537-stamp/u-boot.lds $(obj)board/bf561-ezkit/u-boot.lds
 	rm -f $(obj)include/bmp_logo.h
 	rm -f $(obj)nand_spl/u-boot-spl $(obj)nand_spl/u-boot-spl.map
+	rm -f $(obj)api_examples/demo
 
 clobber:	clean
 	find $(OBJTREE) -type f \( -name .depend \
@@ -2762,6 +2770,8 @@
 	rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
 	rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
 	[ ! -d $(OBJTREE)/nand_spl ] || find $(obj)nand_spl -lname "*" -print | xargs rm -f
+	find $(obj)api_examples -lname "*" -print | xargs rm -f
+	rm -f $(obj)api_examples/demo
 
 ifeq ($(OBJTREE),$(SRCTREE))
 mrproper \