source: mainline/uspace/drv/usbhub/usblist.h@ 281ebae

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

Hub driver put inside Doxygen group

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 * Copyright (c) 2010 Matus Dekanek
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
29/** @addtogroup drvusbhub
30 * @{
31 */
32/** @file
33 * @brief HC driver and hub driver.
34 *
35 * My private list implementation; I did not like the original helenos list.
36 * This one does not depend on the structure of stored data and has
37 * much simpler and more straight-forward semantics.
38 */
39#ifndef USBLIST_H
40#define USBLIST_H
41
42/**
43 * general list structure
44 */
45typedef struct usb_general_list{
46 void * data;
47 struct usb_general_list * prev, * next;
48} usb_general_list_t;
49
50/** create head of usb general list */
51usb_general_list_t * usb_lst_create(void);
52
53/** initialize head of usb general list */
54void usb_lst_init(usb_general_list_t * lst);
55
56
57/** is the list empty? */
58static inline bool usb_lst_empty(usb_general_list_t * lst){
59 return lst?(lst->next==lst):true;
60}
61
62/** append data behind item */
63void usb_lst_append(usb_general_list_t * lst, void * data);
64
65/** prepend data beore item */
66void usb_lst_prepend(usb_general_list_t * lst, void * data);
67
68/** remove list item from list */
69void usb_lst_remove(usb_general_list_t * item);
70
71/** get data o specified type from list item */
72#define usb_lst_get_data(item, type) (type *) (item->data)
73
74/** get usb_hub_info_t data from list item */
75static inline usb_hub_info_t * usb_hub_lst_get_data(usb_general_list_t * item) {
76 return usb_lst_get_data(item,usb_hub_info_t);
77}
78
79#endif /* USBLIST_H */
80/**
81 * @}
82 */
Note: See TracBrowser for help on using the repository browser.