aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2013-07-24 14:26:31 +0530
committerNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2013-07-24 14:46:22 +0530
commitc4ddc59f676ee4fbdb03d3905904c48b150abf85 (patch)
treeb2d60e398b47a10ebd953c5fbac4739f27c237ea /lib/libusb
parent3c7febb48f971621ac368807d6e2a2a60ab06ce4 (diff)
downloadSLOF-c4ddc59f676ee4fbdb03d3905904c48b150abf85.zip
SLOF-c4ddc59f676ee4fbdb03d3905904c48b150abf85.tar.gz
SLOF-c4ddc59f676ee4fbdb03d3905904c48b150abf85.tar.bz2
usb-core: registration and makefiles
* Introduce libusb * USB core register routine and required forth changes * USB OHCI skeleton file Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Acked-by: Thomas Huth <thuth@de.ibm.com>
Diffstat (limited to 'lib/libusb')
-rw-r--r--lib/libusb/Makefile49
-rw-r--r--lib/libusb/usb-core.c20
-rw-r--r--lib/libusb/usb-core.h35
-rw-r--r--lib/libusb/usb-ohci.c43
-rw-r--r--lib/libusb/usb.code26
-rw-r--r--lib/libusb/usb.h25
-rw-r--r--lib/libusb/usb.in16
7 files changed, 214 insertions, 0 deletions
diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
index e69de29..25c8002 100644
--- a/lib/libusb/Makefile
+++ b/lib/libusb/Makefile
@@ -0,0 +1,49 @@
+# *****************************************************************************
+# * Copyright (c) 2004, 2008 IBM Corporation
+# * All rights reserved.
+# * This program and the accompanying materials
+# * are made available under the terms of the BSD License
+# * which accompanies this distribution, and is available at
+# * http://www.opensource.org/licenses/bsd-license.php
+# *
+# * Contributors:
+# * IBM Corporation - initial implementation
+# ****************************************************************************/
+
+TOPCMNDIR ?= ../..
+
+ASFLAGS = $(FLAG) $(RELEASE) $(CPUARCHDEF) -Wa,-mregnames
+CPPFLAGS = -I../libc/include $(CPUARCHDEF) -I$(INCLBRDDIR) \
+ -I$(INCLCMNDIR) -I$(INCLCMNDIR)/$(CPUARCH)
+LDFLAGS = -nostdlib
+
+TARGET = ../libusb.a
+
+
+all: $(TARGET)
+
+SRCS = usb-core.c usb-ohci.c
+
+OBJS = $(SRCS:%.c=%.o)
+
+$(TARGET): $(OBJS)
+ $(AR) -rc $@ $(OBJS)
+ $(RANLIB) $@
+
+clean:
+ $(RM) $(TARGET) $(OBJS)
+
+distclean: clean
+ $(RM) Makefile.dep
+
+
+# Rules for creating the dependency file:
+depend:
+ $(RM) Makefile.dep
+ $(MAKE) Makefile.dep
+
+Makefile.dep: Makefile
+ $(CC) -M $(CPPFLAGS) $(CFLAGS) $(SRCS) $(SRCSS) > Makefile.dep
+
+# Include dependency file if available:
+-include Makefile.dep
diff --git a/lib/libusb/usb-core.c b/lib/libusb/usb-core.c
new file mode 100644
index 0000000..7aa918a
--- /dev/null
+++ b/lib/libusb/usb-core.c
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2013 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include "usb-core.h"
+
+void usb_hcd_register(struct usb_hcd_ops *ops)
+{
+ if (!ops)
+ printf("Error");
+ printf("Registering %s\n", ops->name);
+}
diff --git a/lib/libusb/usb-core.h b/lib/libusb/usb-core.h
new file mode 100644
index 0000000..649cb95
--- /dev/null
+++ b/lib/libusb/usb-core.h
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2013 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#ifndef __USB_CORE_H
+#define __USB_CORE_H
+
+#include <stdio.h>
+
+enum usb_hcd_type {
+ USB_OHCI = 1,
+ USB_EHCI = 2,
+ USB_XHCI = 3,
+};
+
+struct usb_hcd_ops {
+ const char *name;
+ void (*init)(void);
+ void (*detect)(void);
+ void (*disconnect)(void);
+ struct usb_hcd_ops *next;
+ unsigned int usb_type;
+};
+
+extern void usb_hcd_register(struct usb_hcd_ops *ops);
+
+#endif
diff --git a/lib/libusb/usb-ohci.c b/lib/libusb/usb-ohci.c
new file mode 100644
index 0000000..7f65b71
--- /dev/null
+++ b/lib/libusb/usb-ohci.c
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2013 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include "usb.h"
+#include "usb-core.h"
+
+static void ohci_init(void)
+{
+
+}
+
+static void ohci_detect(void)
+{
+
+}
+
+static void ohci_disconnect(void)
+{
+
+}
+
+struct usb_hcd_ops ohci_ops = {
+ .name = "ohci-hcd",
+ .init = ohci_init,
+ .detect = ohci_detect,
+ .disconnect = ohci_disconnect,
+ .usb_type = USB_OHCI,
+ .next = NULL,
+};
+
+void usb_ohci_register(void)
+{
+ usb_hcd_register(&ohci_ops);
+}
diff --git a/lib/libusb/usb.code b/lib/libusb/usb.code
new file mode 100644
index 0000000..73b77cb
--- /dev/null
+++ b/lib/libusb/usb.code
@@ -0,0 +1,26 @@
+/******************************************************************************
+ * Copyright (c) 2013 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+/*
+ * libusb bindings for SLOF - implementation
+ */
+
+#include <usb.h>
+
+
+/************************************************/
+/* Register with the usb-core */
+/* SLOF: USB-OHCI-REGISTER ( -- ) */
+/* LIBNEWUSB: usb_ohci_register(void) */
+/************************************************/
+PRIM(USB_X2d_OHCI_X2d_REGISTER)
+ usb_ohci_register();
+MIRP
diff --git a/lib/libusb/usb.h b/lib/libusb/usb.h
new file mode 100644
index 0000000..ef944ad
--- /dev/null
+++ b/lib/libusb/usb.h
@@ -0,0 +1,25 @@
+/******************************************************************************
+ * Copyright (c) 2006, 2012, 2013 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+/*
+ * prototypes for libusb implementation used in libusb.code
+ */
+
+#ifndef __LIBUSB_H
+#define __LIBUSB_H
+
+/*******************************************/
+/* SLOF: USB-OHCI-REGISTER */
+/*******************************************/
+extern void usb_ohci_register(void);
+
+#endif
+
diff --git a/lib/libusb/usb.in b/lib/libusb/usb.in
new file mode 100644
index 0000000..ad2dad1
--- /dev/null
+++ b/lib/libusb/usb.in
@@ -0,0 +1,16 @@
+/******************************************************************************
+ * Copyright (c) 2007, 2012, 2013 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+/*
+ * libusb bindings for SLOF - definitions
+ */
+
+cod(USB-OHCI-REGISTER)