Index: uspace/drv/ohci/Makefile
===================================================================
--- uspace/drv/ohci/Makefile	(revision 96b8f3222438a558cf7926a03934e7e6e0ca3f20)
+++ uspace/drv/ohci/Makefile	(revision 7786ceaf45f3a567ed0606a2410243ebbf625e6f)
@@ -40,5 +40,6 @@
 	pci.c \
 	root_hub.c \
-	transfer_list.c
+	transfer_list.c \
+	hw_struct/endpoint_descriptor.c
 
 
Index: uspace/drv/ohci/batch.c
===================================================================
--- uspace/drv/ohci/batch.c	(revision 96b8f3222438a558cf7926a03934e7e6e0ca3f20)
+++ uspace/drv/ohci/batch.c	(revision 7786ceaf45f3a567ed0606a2410243ebbf625e6f)
@@ -51,4 +51,5 @@
 } ohci_batch_t;
 
+static void batch_control(usb_transfer_batch_t *instance);
 static void batch_call_in_and_dispose(usb_transfer_batch_t *instance);
 static void batch_call_out_and_dispose(usb_transfer_batch_t *instance);
@@ -83,6 +84,7 @@
 	instance->private_data = data;
 
+	/* we needs + 1 transfer descriptor as the last one won't be executed */
 	data->td_count =
-	    (buffer_size + OHCI_MAX_TRANSFER - 1) / OHCI_MAX_TRANSFER;
+	    1 + ((buffer_size + OHCI_MAX_TRANSFER - 1) / OHCI_MAX_TRANSFER);
 	if (ep->transfer_type == USB_TRANSFER_CONTROL) {
 		data->td_count += 2;
@@ -135,5 +137,5 @@
 	    instance->buffer_size);
 	instance->next_step = batch_call_out_and_dispose;
-	/* TODO: implement */
+	batch_control(instance);
 	usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance);
 }
@@ -143,5 +145,5 @@
 	assert(instance);
 	instance->next_step = batch_call_in_and_dispose;
-	/* TODO: implement */
+	batch_control(instance);
 	usb_log_debug("Batch(%p) CONTROL READ initialized.\n", instance);
 }
@@ -150,5 +152,5 @@
 {
 	assert(instance);
-	instance->direction = USB_DIRECTION_IN;
+	assert(instance->direction == USB_DIRECTION_IN);
 	instance->next_step = batch_call_in_and_dispose;
 	/* TODO: implement */
@@ -159,5 +161,5 @@
 {
 	assert(instance);
-	instance->direction = USB_DIRECTION_OUT;
+	assert(instance->direction == USB_DIRECTION_OUT);
 	/* We are data out, we are supposed to provide data */
 	memcpy(instance->transport_buffer, instance->buffer,
@@ -188,5 +190,16 @@
 ed_t * batch_ed(usb_transfer_batch_t *instance)
 {
-	return NULL;
+	assert(instance);
+	ohci_batch_t *data = instance->private_data;
+	assert(data);
+	return data->ed;
+}
+/*----------------------------------------------------------------------------*/
+static void batch_control(usb_transfer_batch_t *instance)
+{
+	assert(instance);
+	ohci_batch_t *data = instance->private_data;
+	assert(data);
+	ed_init(data->ed, instance->ep);
 }
 /*----------------------------------------------------------------------------*/
Index: uspace/drv/ohci/hw_struct/endpoint_descriptor.c
===================================================================
--- uspace/drv/ohci/hw_struct/endpoint_descriptor.c	(revision 7786ceaf45f3a567ed0606a2410243ebbf625e6f)
+++ uspace/drv/ohci/hw_struct/endpoint_descriptor.c	(revision 7786ceaf45f3a567ed0606a2410243ebbf625e6f)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup drvusbohci
+ * @{
+ */
+/** @file
+ * @brief OHCI driver
+ */
+#include "endpoint_descriptor.h"
+
+static unsigned direc[3] =
+    { ED_STATUS_D_IN, ED_STATUS_D_OUT, ED_STATUS_D_TRANSFER };
+
+void ed_init(ed_t *instance, endpoint_t *ep)
+{
+	assert(instance);
+	bzero(instance, sizeof(ed_t));
+	if (ep == NULL) {
+		instance->status |= ED_STATUS_K_FLAG;
+		return;
+	}
+	assert(ep);
+	instance->status = 0
+	    | ((ep->address & ED_STATUS_FA_MASK) << ED_STATUS_FA_SHIFT)
+	    | ((ep->endpoint & ED_STATUS_EN_MASK) << ED_STATUS_EN_SHIFT)
+	    | ((direc[ep->direction] & ED_STATUS_D_MASK) << ED_STATUS_D_SHIFT)
+	    | ((ep->max_packet_size & ED_STATUS_MPS_MASK)
+	        << ED_STATUS_MPS_SHIFT);
+
+	if (ep->speed == USB_SPEED_LOW)
+		instance->status |= ED_STATUS_S_FLAG;
+	if (ep->transfer_type == USB_TRANSFER_ISOCHRONOUS)
+		instance->status |= ED_STATUS_F_FLAG;
+
+}
+
+/**
+ * @}
+ */
Index: uspace/drv/ohci/hw_struct/endpoint_descriptor.h
===================================================================
--- uspace/drv/ohci/hw_struct/endpoint_descriptor.h	(revision 96b8f3222438a558cf7926a03934e7e6e0ca3f20)
+++ uspace/drv/ohci/hw_struct/endpoint_descriptor.h	(revision 7786ceaf45f3a567ed0606a2410243ebbf625e6f)
@@ -38,4 +38,6 @@
 #include <stdint.h>
 
+#include <usb/host/endpoint.h>
+
 #include "utils/malloc32.h"
 
@@ -52,6 +54,7 @@
 #define ED_STATUS_D_IN (0x1)
 #define ED_STATUS_D_OUT (0x2)
+#define ED_STATUS_D_TRANSFER (0x3)
 
-#define ED_STATUS_S_FLAG (1 << 13) /* speed flag */
+#define ED_STATUS_S_FLAG (1 << 13) /* speed flag: 1 = low */
 #define ED_STATUS_K_FLAG (1 << 14) /* skip flag (no not execute this ED) */
 #define ED_STATUS_F_FLAG (1 << 15) /* format: 1 = isochronous*/
@@ -75,9 +78,11 @@
 } __attribute__((packed)) ed_t;
 
-static inline void ed_init_dummy(ed_t *instance)
+void ed_init(ed_t *instance, endpoint_t *ep);
+
+static inline void ed_add_tds(ed_t *instance, uint32_t head, uint32_t tail)
 {
 	assert(instance);
-	bzero(instance, sizeof(ed_t));
-	instance->status |= ED_STATUS_K_FLAG;
+	instance->td_head = head & ED_TDHEAD_PTR_MASK;
+	instance->td_tail = tail & ED_TDTAIL_PTR_MASK;
 }
 
Index: uspace/drv/ohci/transfer_list.c
===================================================================
--- uspace/drv/ohci/transfer_list.c	(revision 96b8f3222438a558cf7926a03934e7e6e0ca3f20)
+++ uspace/drv/ohci/transfer_list.c	(revision 7786ceaf45f3a567ed0606a2410243ebbf625e6f)
@@ -61,5 +61,5 @@
 	    name, instance->list_head, instance->list_head_pa);
 
-	ed_init_dummy(instance->list_head);
+	ed_init(instance->list_head, NULL);
 	list_initialize(&instance->batch_list);
 	fibril_mutex_initialize(&instance->guard);
Index: uspace/drv/ohci/utils/malloc32.h
===================================================================
--- uspace/drv/ohci/utils/malloc32.h	(revision 96b8f3222438a558cf7926a03934e7e6e0ca3f20)
+++ uspace/drv/ohci/utils/malloc32.h	(revision 7786ceaf45f3a567ed0606a2410243ebbf625e6f)
@@ -37,4 +37,5 @@
 #include <assert.h>
 #include <malloc.h>
+#include <errno.h>
 #include <mem.h>
 #include <as.h>
