Changeset 563ead9 in mainline


Ignore:
Timestamp:
2011-05-23T14:51:41Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fcbcaae9
Parents:
e247d83
Message:

Further cleanup, includes, const, …

Location:
uspace/drv
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/batch.h

    re247d83 r563ead9  
    3535#define DRV_UHCI_BATCH_H
    3636
    37 #include <usbhc_iface.h>
    38 #include <usb/usb.h>
    39 #include <usb/host/device_keeper.h>
    40 #include <usb/host/endpoint.h>
    4137#include <usb/host/batch.h>
    4238
  • uspace/drv/uhci-hcd/hc.c

    re247d83 r563ead9  
    3939#include <usb/debug.h>
    4040#include <usb/usb.h>
    41 #include <usb/ddfiface.h>
    42 #include <usb_iface.h>
    4341
    4442#include "hc.h"
  • uspace/drv/uhci-hcd/hc.h

    re247d83 r563ead9  
    3737
    3838#include <fibril.h>
    39 #include <fibril_synch.h>
    40 #include <adt/list.h>
    4139#include <ddi.h>
    4240
    43 #include <usbhc_iface.h>
    4441#include <usb/host/device_keeper.h>
    4542#include <usb/host/usb_endpoint_manager.h>
     43#include <usb/host/batch.h>
    4644
    47 #include "batch.h"
    4845#include "transfer_list.h"
    4946
  • uspace/drv/uhci-hcd/iface.c

    re247d83 r563ead9  
    3939
    4040#include "iface.h"
     41#include "batch.h"
    4142#include "hc.h"
    4243
     
    122123        return EOK;
    123124}
    124 
     125/*----------------------------------------------------------------------------*/
    125126/** Find device handle by address interface function.
    126127 *
     
    136137        hc_t *hc = fun_to_hc(fun);
    137138        assert(hc);
    138         bool found =
     139        const bool found =
    139140            usb_device_keeper_find_by_address(&hc->manager, address, handle);
    140141        return found ? EOK : ENOENT;
    141142}
    142 
    143143/*----------------------------------------------------------------------------*/
    144144/** Release address interface function
     
    164164    size_t max_packet_size, unsigned int interval)
    165165{
     166        assert(fun);
    166167        hc_t *hc = fun_to_hc(fun);
    167168        assert(hc);
     
    183184    usb_endpoint_t endpoint, usb_direction_t direction)
    184185{
     186        assert(fun);
    185187        hc_t *hc = fun_to_hc(fun);
    186188        assert(hc);
     
    211213        if (ret != EOK)
    212214                return ret;
     215        assert(batch);
     216        assert(hc);
    213217        batch_interrupt_out(batch);
    214218        ret = hc_schedule(hc, batch);
     
    239243        if (ret != EOK)
    240244                return ret;
     245        assert(batch);
     246        assert(hc);
    241247        batch_interrupt_in(batch);
    242248        ret = hc_schedule(hc, batch);
     
    267273        if (ret != EOK)
    268274                return ret;
     275        assert(batch);
     276        assert(hc);
    269277        batch_bulk_out(batch);
    270278        ret = hc_schedule(hc, batch);
     
    295303        if (ret != EOK)
    296304                return ret;
     305        assert(batch);
     306        assert(hc);
    297307        batch_bulk_in(batch);
    298308        ret = hc_schedule(hc, batch);
     
    327337        if (ret != EOK)
    328338                return ret;
     339        assert(batch);
     340        assert(hc);
    329341        usb_endpoint_manager_reset_if_need(&hc->ep_manager, target, setup_data);
    330342        batch_control_write(batch);
     
    360372        if (ret != EOK)
    361373                return ret;
     374        assert(batch);
     375        assert(hc);
    362376        batch_control_read(batch);
    363377        ret = hc_schedule(hc, batch);
  • uspace/drv/uhci-hcd/root_hub.h

    re247d83 r563ead9  
    4343        /** List of resources available to the root hub. */
    4444        hw_resource_list_t resource_list;
    45         /** The only resource in the above list */
     45        /** The only resource in the RH resource list */
    4646        hw_resource_t io_regs;
    4747} rh_t;
  • uspace/drv/uhci-hcd/transfer_list.c

    re247d83 r563ead9  
    3636#include <arch/barrier.h>
    3737
     38
    3839#include "transfer_list.h"
     40#include "batch.h"
    3941
    4042static void transfer_list_remove_batch(
  • uspace/drv/uhci-hcd/transfer_list.h

    re247d83 r563ead9  
    3636
    3737#include <fibril_synch.h>
     38#include <usb/host/batch.h>
    3839
    39 #include "batch.h"
    4040#include "hw_struct/queue_head.h"
    4141
  • uspace/drv/uhci-hcd/utils/malloc32.h

    re247d83 r563ead9  
    5959        uintptr_t result;
    6060        const int ret = as_get_physical_mapping(addr, &result);
    61         assert(ret == EOK);
    62 
    6361        if (ret != EOK)
    6462                return 0;
     
    9896{
    9997        void *free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
    100         assert(free_address); /* TODO: remove this assert */
    10198        if (free_address == 0)
    10299                return NULL;
  • uspace/drv/uhci-rhd/main.c

    re247d83 r563ead9  
    3737#include <errno.h>
    3838#include <str_error.h>
     39
    3940#include <usb_iface.h>
    4041#include <usb/ddfiface.h>
     
    4546#define NAME "uhci-rhd"
    4647
    47 static int hc_get_my_registers(ddf_dev_t *dev,
     48static int hc_get_my_registers(const ddf_dev_t *dev,
    4849    uintptr_t *io_reg_address, size_t *io_reg_size);
    4950/*----------------------------------------------------------------------------*/
     
    130131 */
    131132int hc_get_my_registers(
    132     ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)
     133    const ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)
    133134{
    134         assert(dev != NULL);
     135        assert(dev);
    135136
    136         int parent_phone = devman_parent_device_connect(dev->handle,
     137        const int parent_phone = devman_parent_device_connect(dev->handle,
    137138            IPC_FLAG_BLOCKING);
    138139        if (parent_phone < 0) {
     
    141142
    142143        hw_resource_list_t hw_resources;
    143         int ret = hw_res_get_resource_list(parent_phone, &hw_resources);
     144        const int ret = hw_res_get_resource_list(parent_phone, &hw_resources);
    144145        if (ret != EOK) {
    145146                async_hangup(parent_phone);
  • uspace/drv/uhci-rhd/port.c

    re247d83 r563ead9  
    3636#include <errno.h>
    3737#include <str_error.h>
    38 #include <time.h>
    3938#include <async.h>
    4039
     
    8281 * @param[in] number Port number.
    8382 * @param[in] usec Polling interval.
    84  * @param[in] rh Pointer to ddf instance fo the root hub driver.
     83 * @param[in] rh Pointer to ddf instance of the root hub driver.
    8584 * @return Error code.
    8685 *
     
    9190{
    9291        assert(port);
    93         asprintf(&port->id_string, "Port (%p - %u)", port, number);
    94         if (port->id_string == NULL) {
     92        char *id_string;
     93        asprintf(&id_string, "Port (%p - %u)", port, number);
     94        if (id_string == NULL) {
    9595                return ENOMEM;
    9696        }
    9797
     98        port->id_string = id_string;
    9899        port->address = address;
    99100        port->number = number;
     
    105106            usb_hc_connection_initialize_from_device(&port->hc_connection, rh);
    106107        if (ret != EOK) {
    107                 usb_log_error("Failed to initialize connection to HC.");
     108                usb_log_error("%s: failed to initialize connection to HC.",
     109                    port->id_string);
     110                free(id_string);
    108111                return ret;
    109112        }
     
    113116                usb_log_error("%s: failed to create polling fibril.",
    114117                    port->id_string);
     118                free(id_string);
    115119                return ENOMEM;
    116120        }
     
    132136        assert(port);
    133137        free(port->id_string);
    134         /* TODO: Kill fibril here */
     138        // TODO: Kill fibril here
    135139        return;
    136140}
     
    150154
    151155                /* Read register value */
    152                 port_status_t port_status = uhci_port_read_status(instance);
     156                const port_status_t port_status =
     157                    uhci_port_read_status(instance);
    153158
    154159                /* Print the value if it's interesting */
     
    161166                usb_log_debug("%s: Connected change detected: %x.\n",
    162167                    instance->id_string, port_status);
    163 
    164                 int rc =
    165                     usb_hc_connection_open(&instance->hc_connection);
    166                 if (rc != EOK) {
    167                         usb_log_error("%s: Failed to connect to HC.",
    168                             instance->id_string);
    169                         continue;
    170                 }
    171168
    172169                /* Remove any old device */
     
    175172                            instance->id_string);
    176173                        uhci_port_remove_device(instance);
     174                }
     175
     176                int ret =
     177                    usb_hc_connection_open(&instance->hc_connection);
     178                if (ret != EOK) {
     179                        usb_log_error("%s: Failed to connect to HC.",
     180                            instance->id_string);
     181                        continue;
    177182                }
    178183
     
    190195                }
    191196
    192                 rc = usb_hc_connection_close(&instance->hc_connection);
    193                 if (rc != EOK) {
     197                ret = usb_hc_connection_close(&instance->hc_connection);
     198                if (ret != EOK) {
    194199                        usb_log_error("%s: Failed to disconnect.",
    195200                            instance->id_string);
     
    210215{
    211216        uhci_port_t *port = arg;
     217        assert(port);
    212218
    213219        usb_log_debug2("%s: new_device_enable_port.\n", port->id_string);
     
    283289        usb_log_error("%s: Don't know how to remove device %" PRIun ".\n",
    284290            port->id_string, port->attached_device);
     291        port->attached_device = 0;
    285292        return ENOTSUP;
    286293}
  • uspace/drv/uhci-rhd/port.h

    re247d83 r563ead9  
    5757typedef struct uhci_port
    5858{
    59         char *id_string;
     59        const char *id_string;
    6060        port_status_t *address;
    6161        unsigned number;
Note: See TracChangeset for help on using the changeset viewer.