Changeset c01cd32 in mainline


Ignore:
Timestamp:
2011-03-21T22:42:47Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
33fbe95
Parents:
c56c5b5b
Message:

Rename uhci_hc ⇒ hc, follow common hcd names

Location:
uspace/drv/uhci-hcd
Files:
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/Makefile

    rc56c5b5b rc01cd32  
    3737        transfer_list.c \
    3838        uhci.c \
    39         uhci_hc.c \
     39        hc.c \
    4040        uhci_rh.c \
    4141        uhci_struct/transfer_descriptor.c \
  • uspace/drv/uhci-hcd/batch.c

    rc56c5b5b rc01cd32  
    4040#include "batch.h"
    4141#include "transfer_list.h"
    42 #include "uhci_hc.h"
    4342#include "utils/malloc32.h"
    4443#include "uhci_struct/transfer_descriptor.h"
  • uspace/drv/uhci-hcd/hc.c

    rc56c5b5b rc01cd32  
    4242#include <usb_iface.h>
    4343
    44 #include "uhci_hc.h"
     44#include "hc.h"
    4545
    4646static irq_cmd_t uhci_cmds[] = {
     
    6060};
    6161/*----------------------------------------------------------------------------*/
    62 static int uhci_hc_init_transfer_lists(uhci_hc_t *instance);
    63 static int uhci_hc_init_mem_structures(uhci_hc_t *instance);
    64 static void uhci_hc_init_hw(uhci_hc_t *instance);
    65 
    66 static int uhci_hc_interrupt_emulator(void *arg);
    67 static int uhci_hc_debug_checker(void *arg);
     62static int hc_init_transfer_lists(hc_t *instance);
     63static int hc_init_mem_structures(hc_t *instance);
     64static void hc_init_hw(hc_t *instance);
     65
     66static int hc_interrupt_emulator(void *arg);
     67static int hc_debug_checker(void *arg);
    6868
    6969static bool allowed_usb_packet(
     
    8282 * interrupt fibrils.
    8383 */
    84 int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun,
     84int hc_init(hc_t *instance, ddf_fun_t *fun,
    8585    void *regs, size_t reg_size, bool interrupts)
    8686{
     
    112112            io, reg_size);
    113113
    114         ret = uhci_hc_init_mem_structures(instance);
     114        ret = hc_init_mem_structures(instance);
    115115        CHECK_RET_DEST_FUN_RETURN(ret,
    116116            "Failed to initialize UHCI memory structures.\n");
    117117
    118         uhci_hc_init_hw(instance);
     118        hc_init_hw(instance);
    119119        if (!interrupts) {
    120120                instance->cleaner =
    121                     fibril_create(uhci_hc_interrupt_emulator, instance);
     121                    fibril_create(hc_interrupt_emulator, instance);
    122122                fibril_add_ready(instance->cleaner);
    123123        } else {
     
    126126
    127127        instance->debug_checker =
    128             fibril_create(uhci_hc_debug_checker, instance);
     128            fibril_create(hc_debug_checker, instance);
    129129//      fibril_add_ready(instance->debug_checker);
    130130
     
    138138 * For magic values see UHCI Design Guide
    139139 */
    140 void uhci_hc_init_hw(uhci_hc_t *instance)
     140void hc_init_hw(hc_t *instance)
    141141{
    142142        assert(instance);
     
    186186 *  - frame list page (needs to be one UHCI hw accessible 4K page)
    187187 */
    188 int uhci_hc_init_mem_structures(uhci_hc_t *instance)
     188int hc_init_mem_structures(hc_t *instance)
    189189{
    190190        assert(instance);
     
    215215
    216216        /* Init transfer lists */
    217         ret = uhci_hc_init_transfer_lists(instance);
     217        ret = hc_init_transfer_lists(instance);
    218218        CHECK_RET_DEST_CMDS_RETURN(ret, "Failed to init transfer lists.\n");
    219219        usb_log_debug("Initialized transfer lists.\n");
     
    252252 * USB scheduling. Sets pointer table for quick access.
    253253 */
    254 int uhci_hc_init_transfer_lists(uhci_hc_t *instance)
     254int hc_init_transfer_lists(hc_t *instance)
    255255{
    256256        assert(instance);
     
    318318 * Checks for bandwidth availability and appends the batch to the proper queue.
    319319 */
    320 int uhci_hc_schedule(uhci_hc_t *instance, usb_transfer_batch_t *batch)
     320int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch)
    321321{
    322322        assert(instance);
     
    351351 * - resume from suspend state (not implemented)
    352352 */
    353 void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status)
     353void hc_interrupt(hc_t *instance, uint16_t status)
    354354{
    355355        assert(instance);
     
    373373                if (instance->hw_failures < UHCI_ALLOWED_HW_FAIL) {
    374374                        /* reinitialize hw, this triggers virtual disconnect*/
    375                         uhci_hc_init_hw(instance);
     375                        hc_init_hw(instance);
    376376                } else {
    377377                        usb_log_fatal("Too many UHCI hardware failures!.\n");
    378                         uhci_hc_fini(instance);
     378                        hc_fini(instance);
    379379                }
    380380        }
     
    386386 * @return EOK (should never return)
    387387 */
    388 int uhci_hc_interrupt_emulator(void* arg)
     388int hc_interrupt_emulator(void* arg)
    389389{
    390390        usb_log_debug("Started interrupt emulator.\n");
    391         uhci_hc_t *instance = (uhci_hc_t*)arg;
     391        hc_t *instance = (hc_t*)arg;
    392392        assert(instance);
    393393
     
    398398                if (status != 0)
    399399                        usb_log_debug2("UHCI status: %x.\n", status);
    400                 uhci_hc_interrupt(instance, status);
     400                hc_interrupt(instance, status);
    401401                async_usleep(UHCI_CLEANER_TIMEOUT);
    402402        }
     
    409409 * @return EOK (should never return)
    410410 */
    411 int uhci_hc_debug_checker(void *arg)
    412 {
    413         uhci_hc_t *instance = (uhci_hc_t*)arg;
     411int hc_debug_checker(void *arg)
     412{
     413        hc_t *instance = (hc_t*)arg;
    414414        assert(instance);
    415415
  • uspace/drv/uhci-hcd/hc.h

    rc56c5b5b rc01cd32  
    8282#define UHCI_ALLOWED_HW_FAIL 5
    8383
    84 typedef struct uhci_hc {
     84typedef struct hc {
    8585        usb_device_keeper_t device_manager;
    8686
     
    104104
    105105        ddf_fun_t *ddf_instance;
    106 } uhci_hc_t;
     106} hc_t;
    107107
    108 int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun,
     108int hc_init(hc_t *instance, ddf_fun_t *fun,
    109109    void *regs, size_t reg_size, bool interupts);
    110110
    111 int uhci_hc_schedule(uhci_hc_t *instance, usb_transfer_batch_t *batch);
     111int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch);
    112112
    113 void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status);
     113void hc_interrupt(hc_t *instance, uint16_t status);
    114114
    115115/** Safely dispose host controller internal structures
     
    117117 * @param[in] instance Host controller structure to use.
    118118 */
    119 static inline void uhci_hc_fini(uhci_hc_t *instance) { /* TODO: implement*/ };
     119static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ };
    120120
    121121/** Get and cast pointer to the driver data
     
    124124 * @return cast pointer to driver_data
    125125 */
    126 static inline uhci_hc_t * fun_to_uhci_hc(ddf_fun_t *fun)
    127         { return (uhci_hc_t*)fun->driver_data; }
     126static inline hc_t * fun_to_hc(ddf_fun_t *fun)
     127        { return (hc_t*)fun->driver_data; }
    128128#endif
    129129/**
  • uspace/drv/uhci-hcd/iface.c

    rc56c5b5b rc01cd32  
    4040
    4141#include "iface.h"
    42 #include "uhci_hc.h"
     42#include "hc.h"
    4343
    4444/** Reserve default address interface function
     
    5252{
    5353        assert(fun);
    54         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     54        hc_t *hc = fun_to_hc(fun);
    5555        assert(hc);
    5656        usb_log_debug("Default address request with speed %d.\n", speed);
     
    6767{
    6868        assert(fun);
    69         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     69        hc_t *hc = fun_to_hc(fun);
    7070        assert(hc);
    7171        usb_log_debug("Default address release.\n");
     
    8585{
    8686        assert(fun);
    87         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     87        hc_t *hc = fun_to_hc(fun);
    8888        assert(hc);
    8989        assert(address);
     
    108108{
    109109        assert(fun);
    110         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     110        hc_t *hc = fun_to_hc(fun);
    111111        assert(hc);
    112112        usb_log_debug("Address bind %d-%d.\n", address, handle);
     
    124124{
    125125        assert(fun);
    126         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     126        hc_t *hc = fun_to_hc(fun);
    127127        assert(hc);
    128128        usb_log_debug("Address release %d.\n", address);
     
    147147{
    148148        assert(fun);
    149         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     149        hc_t *hc = fun_to_hc(fun);
    150150        assert(hc);
    151151        usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);
     
    160160                return ENOMEM;
    161161        batch_interrupt_out(batch);
    162         const int ret = uhci_hc_schedule(hc, batch);
     162        const int ret = hc_schedule(hc, batch);
    163163        if (ret != EOK) {
    164164                batch_dispose(batch);
     
    184184{
    185185        assert(fun);
    186         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     186        hc_t *hc = fun_to_hc(fun);
    187187        assert(hc);
    188188        usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);
     
    196196                return ENOMEM;
    197197        batch_interrupt_in(batch);
    198         const int ret = uhci_hc_schedule(hc, batch);
     198        const int ret = hc_schedule(hc, batch);
    199199        if (ret != EOK) {
    200200                batch_dispose(batch);
     
    220220{
    221221        assert(fun);
    222         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     222        hc_t *hc = fun_to_hc(fun);
    223223        assert(hc);
    224224        usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);
     
    233233                return ENOMEM;
    234234        batch_bulk_out(batch);
    235         const int ret = uhci_hc_schedule(hc, batch);
     235        const int ret = hc_schedule(hc, batch);
    236236        if (ret != EOK) {
    237237                batch_dispose(batch);
     
    257257{
    258258        assert(fun);
    259         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     259        hc_t *hc = fun_to_hc(fun);
    260260        assert(hc);
    261261        usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);
     
    269269                return ENOMEM;
    270270        batch_bulk_in(batch);
    271         const int ret = uhci_hc_schedule(hc, batch);
     271        const int ret = hc_schedule(hc, batch);
    272272        if (ret != EOK) {
    273273                batch_dispose(batch);
     
    296296{
    297297        assert(fun);
    298         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     298        hc_t *hc = fun_to_hc(fun);
    299299        assert(hc);
    300300        usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);
     
    312312        usb_device_keeper_reset_if_need(&hc->device_manager, target, setup_data);
    313313        batch_control_write(batch);
    314         const int ret = uhci_hc_schedule(hc, batch);
     314        const int ret = hc_schedule(hc, batch);
    315315        if (ret != EOK) {
    316316                batch_dispose(batch);
     
    339339{
    340340        assert(fun);
    341         uhci_hc_t *hc = fun_to_uhci_hc(fun);
     341        hc_t *hc = fun_to_hc(fun);
    342342        assert(hc);
    343343        usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);
     
    351351                return ENOMEM;
    352352        batch_control_read(batch);
    353         const int ret = uhci_hc_schedule(hc, batch);
    354         if (ret != EOK) {
    355                 batch_dispose(batch);
    356                 return ret;
    357         }
    358         return EOK;
    359 }
    360 /*----------------------------------------------------------------------------*/
    361 usbhc_iface_t uhci_hc_iface = {
     353        const int ret = hc_schedule(hc, batch);
     354        if (ret != EOK) {
     355                batch_dispose(batch);
     356                return ret;
     357        }
     358        return EOK;
     359}
     360/*----------------------------------------------------------------------------*/
     361usbhc_iface_t hc_iface = {
    362362        .reserve_default_address = reserve_default_address,
    363363        .release_default_address = release_default_address,
  • uspace/drv/uhci-hcd/iface.h

    rc56c5b5b rc01cd32  
    3838#include <usbhc_iface.h>
    3939
    40 extern usbhc_iface_t uhci_hc_iface;
     40extern usbhc_iface_t hc_iface;
    4141
    4242#endif
  • uspace/drv/uhci-hcd/uhci.c

    rc56c5b5b rc01cd32  
    5454{
    5555        assert(dev);
    56         uhci_hc_t *hc = &((uhci_t*)dev->driver_data)->hc;
     56        hc_t *hc = &((uhci_t*)dev->driver_data)->hc;
    5757        uint16_t status = IPC_GET_ARG1(*call);
    5858        assert(hc);
    59         uhci_hc_interrupt(hc, status);
     59        hc_interrupt(hc, status);
    6060}
    6161/*----------------------------------------------------------------------------*/
     
    107107};
    108108/*----------------------------------------------------------------------------*/
    109 static ddf_dev_ops_t uhci_hc_ops = {
     109static ddf_dev_ops_t hc_ops = {
    110110        .interfaces[USB_DEV_IFACE] = &usb_iface,
    111         .interfaces[USBHC_DEV_IFACE] = &uhci_hc_iface, /* see iface.h/c */
     111        .interfaces[USBHC_DEV_IFACE] = &hc_iface, /* see iface.h/c */
    112112};
    113113/*----------------------------------------------------------------------------*/
     
    190190            "Failed(%d) to create HC function.\n", ret);
    191191
    192         ret = uhci_hc_init(&instance->hc, instance->hc_fun,
     192        ret = hc_init(&instance->hc, instance->hc_fun,
    193193            (void*)io_reg_base, io_reg_size, interrupts);
    194194        CHECK_RET_DEST_FUN_RETURN(ret, "Failed(%d) to init uhci-hcd.\n", ret);
    195         instance->hc_fun->ops = &uhci_hc_ops;
     195        instance->hc_fun->ops = &hc_ops;
    196196        instance->hc_fun->driver_data = &instance->hc;
    197197        ret = ddf_fun_bind(instance->hc_fun);
     
    208208        if (instance->rh_fun) \
    209209                ddf_fun_destroy(instance->rh_fun); \
    210         uhci_hc_fini(&instance->hc); \
     210        hc_fini(&instance->hc); \
    211211        return ret; \
    212212}
  • uspace/drv/uhci-hcd/uhci.h

    rc56c5b5b rc01cd32  
    3838#include <ddf/driver.h>
    3939
    40 #include "uhci_hc.h"
     40#include "hc.h"
    4141#include "uhci_rh.h"
    4242
     
    4545        ddf_fun_t *rh_fun;
    4646
    47         uhci_hc_t hc;
     47        hc_t hc;
    4848        uhci_rh_t rh;
    4949} uhci_t;
  • uspace/drv/uhci-hcd/uhci_rh.c

    rc56c5b5b rc01cd32  
    4040
    4141#include "uhci_rh.h"
    42 #include "uhci_hc.h"
    4342
    4443/** Root hub initialization
Note: See TracChangeset for help on using the changeset viewer.