Changeset 93fb170c in mainline for uspace/drv/usbhub/usbhub_private.h


Ignore:
Timestamp:
2011-01-08T18:51:31Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
15be932
Parents:
8f748215 (diff), a523af4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from main branch

File:
1 edited

Legend:

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

    r8f748215 r93fb170c  
    3838
    3939#include "usbhub.h"
     40#include "usblist.h"
     41
    4042#include <adt/list.h>
    4143#include <bool.h>
    4244#include <driver.h>
     45#include <futex.h>
     46
    4347#include <usb/usb.h>
     48#include <usb/usbdrv.h>
    4449#include <usb/classes/hub.h>
    4550#include <usb/devreq.h>
     51#include <usb/debug.h>
    4652
    4753//************
     
    5561//************
    5662//
    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
     63// convenience debug printf
    6064//
    6165//************
    62 
    63 /** general list structure */
    64 
    65 
    66 typedef 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 */
    72 usb_general_list_t * usb_lst_create(void);
    73 
    74 /** initialize head of usb general list */
    75 void usb_lst_init(usb_general_list_t * lst);
    76 
    77 
    78 /** is the list empty? */
    79 static inline bool usb_lst_empty(usb_general_list_t * lst){
    80         return lst?(lst->next==lst):true;
    81 }
    82 
    83 /** append data behind item */
    84 void usb_lst_append(usb_general_list_t * lst, void * data);
    85 
    86 /** prepend data beore item */
    87 void usb_lst_prepend(usb_general_list_t * lst, void * data);
    88 
    89 /** remove list item from list */
    90 void 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 */
    96 static 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 }
     66#define dprintf(level, format, ...) \
     67        usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
    9968
    10069/**
    101  * @brief create hub structure instance
     70 * create hub structure instance
    10271 *
    10372 * Set the address and port count information most importantly.
     
    11281extern usb_general_list_t usb_hub_list;
    11382
     83/** lock for hub list*/
     84extern futex_t usb_hub_list_lock;
     85
    11486
    11587/**
    116  * @brief perform complete control read transaction
     88 * perform complete control read transaction
    11789 *
    11890 * manages all three steps of transaction: setup, read and finalize
     
    132104
    133105/**
    134  * @brief perform complete control write transaction
     106 * perform complete control write transaction
    135107 *
    136  * maanges all three steps of transaction: setup, write and finalize
     108 * manages all three steps of transaction: setup, write and finalize
    137109 * @param phone
    138110 * @param target
     
    147119    void * sent_buffer, size_t sent_size
    148120);
    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  */
    157 static inline void usb_hub_set_set_address_request(
    158 usb_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 }
    166121
    167122/**
Note: See TracChangeset for help on using the changeset viewer.