source: mainline/uspace/lib/usbhost/include/usb/host/batch.h@ 160b75e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 160b75e was 160b75e, checked in by Vojtech Horky <vojtechhorky@…>, 14 years ago

Fix Doxygen groups of USB libraries

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2011 Jan Vesely
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28/** @addtogroup libusbhost
29 * @{
30 */
31/** @file
32 * USB transfer transaction structures.
33 */
34#ifndef LIBUSBHOST_HOST_BATCH_H
35#define LIBUSBHOST_HOST_BATCH_H
36
37#include <adt/list.h>
38
39#include <usbhc_iface.h>
40#include <usb/usb.h>
41#include <usb/host/endpoint.h>
42
43typedef struct usb_transfer_batch usb_transfer_batch_t;
44struct usb_transfer_batch {
45 endpoint_t *ep;
46 link_t link;
47 usbhc_iface_transfer_in_callback_t callback_in;
48 usbhc_iface_transfer_out_callback_t callback_out;
49 void *arg;
50 char *buffer;
51 char *data_buffer;
52 size_t buffer_size;
53 char *setup_buffer;
54 size_t setup_size;
55 size_t transfered_size;
56 void (*next_step)(usb_transfer_batch_t *);
57 int error;
58 ddf_fun_t *fun;
59 void *private_data;
60 void (*private_data_dtor)(void *p_data);
61};
62
63void usb_transfer_batch_init(
64 usb_transfer_batch_t *instance,
65 endpoint_t *ep,
66 char *buffer,
67 char *data_buffer,
68 size_t buffer_size,
69 char *setup_buffer,
70 size_t setup_size,
71 usbhc_iface_transfer_in_callback_t func_in,
72 usbhc_iface_transfer_out_callback_t func_out,
73 void *arg,
74 ddf_fun_t *fun,
75 void *private_data,
76 void (*private_data_dtor)(void *p_data)
77);
78
79void usb_transfer_batch_call_in_and_dispose(usb_transfer_batch_t *instance);
80void usb_transfer_batch_call_out_and_dispose(usb_transfer_batch_t *instance);
81void usb_transfer_batch_finish(usb_transfer_batch_t *instance);
82void usb_transfer_batch_dispose(usb_transfer_batch_t *instance);
83
84static inline void usb_transfer_batch_finish_error(
85 usb_transfer_batch_t *instance, int error)
86{
87 assert(instance);
88 instance->error = error;
89 usb_transfer_batch_finish(instance);
90}
91
92static inline usb_transfer_batch_t *usb_transfer_batch_from_link(link_t *l)
93{
94 assert(l);
95 return list_get_instance(l, usb_transfer_batch_t, link);
96}
97
98#endif
99/**
100 * @}
101 */
Note: See TracBrowser for help on using the repository browser.