Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/usbhub_private.h

    r5097bed4 rf9a0cef  
    3838
    3939#include "usbhub.h"
    40 #include "usblist.h"
    41 
    4240#include <adt/list.h>
    4341#include <bool.h>
    4442#include <driver.h>
    45 #include <futex.h>
    46 
    4743#include <usb/usb.h>
    48 #include <usb/usbdrv.h>
    4944#include <usb/classes/hub.h>
    5045#include <usb/devreq.h>
    51 #include <usb/debug.h>
    5246
    5347//************
     
    6155//************
    6256//
    63 // convenience debug printf
    64 //
    65 //************
    66 #define dprintf(level, format, ...) \
    67         usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
    68 
    69 /**
    70  * create hub structure instance
     57// My private list implementation; I did not like the original helenos list
     58//
     59// This one does not depend on the structure of stored data
     60//
     61//************
     62
     63/** general list structure */
     64
     65
     66typedef struct usb_general_list{
     67        void * data;
     68        struct usb_general_list * prev, * next;
     69} usb_general_list_t;
     70
     71/** create head of usb general list */
     72usb_general_list_t * usb_lst_create(void);
     73
     74/** initialize head of usb general list */
     75void usb_lst_init(usb_general_list_t * lst);
     76
     77
     78/** is the list empty? */
     79static inline bool usb_lst_empty(usb_general_list_t * lst){
     80        return lst?(lst->next==lst):true;
     81}
     82
     83/** append data behind item */
     84void usb_lst_append(usb_general_list_t * lst, void * data);
     85
     86/** prepend data beore item */
     87void usb_lst_prepend(usb_general_list_t * lst, void * data);
     88
     89/** remove list item from list */
     90void usb_lst_remove(usb_general_list_t * item);
     91
     92/** get data o specified type from list item */
     93#define usb_lst_get_data(item, type)  (type *) (item->data)
     94
     95/** get usb_hub_info_t data from list item */
     96static inline usb_hub_info_t * usb_hub_lst_get_data(usb_general_list_t * item) {
     97        return usb_lst_get_data(item,usb_hub_info_t);
     98}
     99
     100/**
     101 * @brief create hub structure instance
    71102 *
    72103 * Set the address and port count information most importantly.
     
    81112extern usb_general_list_t usb_hub_list;
    82113
    83 /** lock for hub list*/
    84 extern futex_t usb_hub_list_lock;
    85 
    86 
    87 /**
    88  * perform complete control read transaction
     114
     115/**
     116 * @brief perform complete control read transaction
    89117 *
    90118 * manages all three steps of transaction: setup, read and finalize
     
    104132
    105133/**
    106  * perform complete control write transaction
    107  *
    108  * manages all three steps of transaction: setup, write and finalize
     134 * @brief perform complete control write transaction
     135 *
     136 * maanges all three steps of transaction: setup, write and finalize
    109137 * @param phone
    110138 * @param target
     
    119147    void * sent_buffer, size_t sent_size
    120148);
     149
     150
     151/**
     152 * set the device request to be a set address request
     153 * @param request
     154 * @param addr
     155 * \TODO this will be obsolete see usb/dev_req.h
     156 */
     157static inline void usb_hub_set_set_address_request(
     158usb_device_request_setup_packet_t * request, uint16_t addr
     159){
     160        request->index = 0;
     161        request->request_type = 0;/// \TODO this is not very nice sollution, we ned constant
     162        request->request = USB_DEVREQ_SET_ADDRESS;
     163        request->value = addr;
     164        request->length = 0;
     165}
    121166
    122167/**
Note: See TracChangeset for help on using the changeset viewer.