Changeset d142e75 in mainline


Ignore:
Timestamp:
2011-03-17T13:23:05Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
87037c48
Parents:
eb2a48a (diff), 039c66c (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:

Development branch changes

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/doc/doxygroups.h

    reb2a48a rd142e75  
    256256         */
    257257
    258         /**
    259         * @defgroup drvusbuhcirh UHCI root hub driver
    260         * @ingroup drvusbuhci
    261         * @brief Driver for UHCI complaint root hub.
    262         */
    263 
    264         /**
    265          * @defgroup drvusbuhcirh UHCI host controller driver
    266         * @ingroup drvusbuhci
    267         * @brief Driver for UHCI complaint USB host controller.
    268         */
     258                /**
     259                * @defgroup drvusbuhcirh UHCI root hub driver
     260                * @ingroup drvusbuhci
     261                * @brief Driver for UHCI complaint root hub.
     262                */
     263
     264                /**
     265                 * @defgroup drvusbuhcihc UHCI host controller driver
     266                * @ingroup drvusbuhci
     267                * @brief Driver for UHCI complaint USB host controller.
     268                */
    269269
    270270        /**
  • uspace/drv/usbhub/usbhub.c

    reb2a48a rd142e75  
    7272int usb_hub_control_loop(void * hub_info_param){
    7373        usb_hub_info_t * hub_info = (usb_hub_info_t*)hub_info_param;
    74         while(true){
    75                 usb_hub_check_hub_changes(hub_info);
     74        int errorCode = EOK;
     75
     76        while(errorCode == EOK){
     77                errorCode = usb_hub_check_hub_changes(hub_info);
    7678                async_usleep(1000 * 1000 );/// \TODO proper number once
    7779        }
     80        dprintf(USB_LOG_LEVEL_ERROR,
     81                                "something in ctrl loop went wrong, errno %d",errorCode);
    7882        return 0;
    7983}
     
    380384 * @param target
    381385 */
    382 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port) {
     386static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port,
     387                bool isLowSpeed) {
    383388        usb_device_request_setup_packet_t request;
    384389        int opResult;
     
    386391        assert(hub->endpoints.control.hc_phone);
    387392        //get default address
    388         //opResult = usb_drv_reserve_default_address(hc);
    389         opResult = usb_hc_reserve_default_address(&hub->connection, USB_SPEED_LOW);
     393        usb_speed_t speed = isLowSpeed?USB_SPEED_LOW:USB_SPEED_FULL;
     394        opResult = usb_hc_reserve_default_address(&hub->connection, speed);
    390395       
    391396        if (opResult != EOK) {
     
    446451        usb_address_t new_device_address = usb_hc_request_address(
    447452                        &hub->connection,
    448                         speed/// \TODO fullspeed??
     453                        speed
    449454                        );
    450455        if (new_device_address < 0) {
     
    510515static void usb_hub_removed_device(
    511516    usb_hub_info_t * hub,uint16_t port) {
    512         //usb_device_request_setup_packet_t request;
    513         int opResult;
    514        
     517               
    515518        /** \TODO remove device from device manager - not yet implemented in
    516519         * devide manager
     
    519522        //close address
    520523        if(hub->attached_devs[port].address!=0){
    521                 //opResult = usb_drv_release_address(hc,hub->attached_devs[port].address);
     524                /*uncomment this code to use it when DDF allows device removal
    522525                opResult = usb_hc_unregister_device(
    523526                                &hub->connection, hub->attached_devs[port].address);
     
    528531                hub->attached_devs[port].address = 0;
    529532                hub->attached_devs[port].handle = 0;
     533                 */
    530534        }else{
    531535                dprintf(USB_LOG_LEVEL_WARNING, "this is strange, disconnected device had no address");
     
    597601                if (usb_port_dev_connected(&status)) {
    598602                        dprintf(USB_LOG_LEVEL_INFO, "some connection changed");
    599                         usb_hub_init_add_device(hub, port);
     603                        usb_hub_init_add_device(hub, port, usb_port_low_speed(&status));
    600604                } else {
    601605                        usb_hub_removed_device(hub, port);
     
    635639/**
    636640 * Check changes on particular hub
    637  * @param hub_info_param
    638  */
    639 void usb_hub_check_hub_changes(usb_hub_info_t * hub_info){
     641 * @param hub_info_param pointer to usb_hub_info_t structure
     642 * @return error code if there is problem when initializing communication with
     643 * hub, EOK otherwise
     644 */
     645int usb_hub_check_hub_changes(usb_hub_info_t * hub_info){
    640646        int opResult;
    641647        opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.status_change);
     
    643649                dprintf(USB_LOG_LEVEL_ERROR,
    644650                                "could not initialize communication for hub; %d", opResult);
    645                 return;
     651                return opResult;
    646652        }
    647653
     
    665671                dprintf(USB_LOG_LEVEL_WARNING, "something went wrong while getting status of hub");
    666672                usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
    667                 return;
     673                return opResult;
    668674        }
    669675        unsigned int port;
     
    673679                                opResult);
    674680                usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
    675                 return;
     681                return opResult;
    676682        }
    677683        opResult = usb_hc_connection_open(&hub_info->connection);
     
    681687                usb_endpoint_pipe_end_session(&hub_info->endpoints.control);
    682688                usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
    683                 return;
     689                return opResult;
    684690        }
    685691
     
    697703        usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
    698704        free(change_bitmap);
     705        return EOK;
    699706}
    700707
  • uspace/drv/usbhub/usbhub.h

    reb2a48a rd142e75  
    8787
    8888/**
    89  * check changes on specified hub
     89 * Check changes on specified hub
    9090 * @param hub_info_param pointer to usb_hub_info_t structure
     91 * @return error code if there is problem when initializing communication with
     92 * hub, EOK otherwise
    9193 */
    92 void usb_hub_check_hub_changes(usb_hub_info_t * hub_info_param);
     94int usb_hub_check_hub_changes(usb_hub_info_t * hub_info_param);
    9395
    9496
Note: See TracChangeset for help on using the changeset viewer.