Ignore:
Timestamp:
2011-09-19T15:18:23Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ea6de35
Parents:
7a05ced0
Message:

usbhub: Refactor handling of global hub events.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port_status.h

    r7a05ced0 rbf73a02  
    5050/**
    5151 * structure holding hub status and changes flags.
    52  * should not be accessed directly, use supplied getter/setter methods.
    5352 *
    5453 * For more information refer to table 11.16.2.5 in
     
    5756 */
    5857typedef uint32_t usb_hub_status_t;
     58// TODO Mind the endiannes, changes are in the first byte of the second word
     59// status is int he first byte of the first word
     60#define USB_HUB_STATUS_OVER_CURRENT \
     61    (1 << (USB_HUB_FEATURE_HUB_OVER_CURRENT))
     62#define USB_HUB_STATUS_LOCAL_POWER \
     63    (1 << (USB_HUB_FEATURE_HUB_LOCAL_POWER))
     64
     65#define USB_HUB_STATUS_C_OVER_CURRENT \
     66    (1 << (16 + USB_HUB_FEATURE_C_HUB_OVER_CURRENT))
     67#define USB_HUB_STATUS_C_LOCAL_POWER \
     68    (1 << (16 + USB_HUB_FEATURE_C_HUB_LOCAL_POWER))
    5969
    6070/**
     
    6474 */
    6575static inline void usb_hub_set_port_status_request(
    66     usb_device_request_setup_packet_t *request, uint16_t port) {
     76    usb_device_request_setup_packet_t *request, uint16_t port)
     77{
    6778        request->index = port;
    6879        request->request_type = USB_HUB_REQ_TYPE_GET_PORT_STATUS;
     
    7384
    7485/**
    75  * set values in request to be it a port status request
    76  * @param request
    77  * @param port
    78  */
    79 static inline void usb_hub_set_hub_status_request(
    80     usb_device_request_setup_packet_t *request) {
    81         request->index = 0;
    82         request->request_type = USB_HUB_REQ_TYPE_GET_HUB_STATUS;
    83         request->request = USB_HUB_REQUEST_GET_STATUS;
    84         request->value = 0;
    85         request->length = 4;
    86 }
    87 
    88 /**
    8986 * create request for usb hub port status
    9087 * @param port
     
    9289 */
    9390static inline usb_device_request_setup_packet_t *
    94 usb_hub_create_port_status_request(uint16_t port) {
     91    usb_hub_create_port_status_request(uint16_t port)
     92{
    9593        usb_device_request_setup_packet_t *result =
    96             malloc(sizeof (usb_device_request_setup_packet_t));
     94            malloc(sizeof(usb_device_request_setup_packet_t));
    9795        usb_hub_set_port_status_request(result, port);
    9896        return result;
     
    355353
    356354#endif  /* HUB_PORT_STATUS_H */
    357 
    358355/**
    359356 * @}
Note: See TracChangeset for help on using the changeset viewer.