Changeset bab71635 in mainline


Ignore:
Timestamp:
2011-03-21T11:13:26Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b0beee82
Parents:
c15070c
Message:

Renames, remove ohci prefix

Location:
uspace/drv/ohci
Files:
3 edited
5 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/Makefile

    rc15070c rbab71635  
    3333
    3434SOURCES = \
    35         hc_iface.c \
     35        iface.c \
    3636        batch.c \
    3737        main.c \
    38         ohci_hc.c \
    39         ohci_rh.c \
     38        hc.c \
     39        root_hub.c \
    4040        pci.c
    4141
  • uspace/drv/ohci/hc.c

    rc15070c rbab71635  
    4242#include <usb_iface.h>
    4343
    44 #include "ohci_hc.h"
     44#include "hc.h"
    4545
    46 int ohci_hc_init(ohci_hc_t *instance, ddf_fun_t *fun,
     46int hc_init(hc_t *instance, ddf_fun_t *fun,
    4747    uintptr_t regs, size_t reg_size, bool interrupts)
    4848{
     
    5353                return ret;
    5454        }
    55         instance->registers->interrupt_disable = 0;
    56         /* enable interrupt on root hub status change */
    57         instance->registers->interupt_enable |= IE_RHSC | IE_MIE;
     55        device_keeper_init(&instance->manager);
    5856
    5957
    60         ohci_rh_init(&instance->rh, instance->registers);
     58        rh_init(&instance->rh, instance->registers);
    6159        /* TODO: implement */
    6260        /* TODO: register root hub */
     
    6462}
    6563/*----------------------------------------------------------------------------*/
    66 int ohci_hc_schedule(ohci_hc_t *instance, batch_t *batch)
     64int hc_schedule(hc_t *instance, batch_t *batch)
    6765{
    6866        assert(instance);
    6967        assert(batch);
    7068        if (batch->target.address == instance->rh.address) {
    71                 ohci_rh_request(&instance->rh, batch);
     69                rh_request(&instance->rh, batch);
    7270                return EOK;
    7371        }
     
    7674}
    7775/*----------------------------------------------------------------------------*/
    78 void ohci_hc_interrupt(ohci_hc_t *instance, uint16_t status)
     76void hc_interrupt(hc_t *instance, uint16_t status)
    7977{
    8078        assert(instance);
    8179        /* TODO: Check for interrupt cause */
    82         ohci_rh_interrupt(&instance->rh);
     80        rh_interrupt(&instance->rh);
    8381        /* TODO: implement */
    8482}
  • uspace/drv/ohci/hc.h

    rc15070c rbab71635  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    29 /** @addtogroup drvusbohcihc
     28/** @addtogroup drvusbohci
    3029 * @{
    3130 */
     
    3332 * @brief OHCI host controller driver structure
    3433 */
    35 #ifndef DRV_OHCI_OHCI_HC_H
    36 #define DRV_OHCI_OHCI_HC_H
     34#ifndef DRV_OHCI_HC_H
     35#define DRV_OHCI_HC_H
    3736
    3837#include <fibril.h>
     
    4241
    4342#include <usb/usb.h>
     43#include <usb/host/device_keeper.h>
    4444#include <usbhc_iface.h>
    4545
    4646#include "batch.h"
    4747#include "ohci_regs.h"
    48 #include "ohci_rh.h"
     48#include "root_hub.h"
    4949
    50 typedef struct ohci_hc {
     50typedef struct hc {
    5151        ohci_regs_t *registers;
    5252        usb_address_t rh_address;
    5353        ohci_rh_t rh;
    5454        ddf_fun_t *ddf_instance;
    55 } ohci_hc_t;
     55        device_keeper_t manager;
     56} hc_t;
    5657
    57 int ohci_hc_init(ohci_hc_t *instance, ddf_fun_t *fun,
     58int hc_init(hc_t *instance, ddf_fun_t *fun,
    5859     uintptr_t regs, size_t reg_size, bool interrupts);
    5960
    60 int ohci_hc_schedule(ohci_hc_t *instance, batch_t *batch);
     61int hc_schedule(hc_t *instance, batch_t *batch);
    6162
    62 void ohci_hc_interrupt(ohci_hc_t *instance, uint16_t status);
     63void hc_interrupt(hc_t *instance, uint16_t status);
    6364
    6465/** Safely dispose host controller internal structures
     
    6667 * @param[in] instance Host controller structure to use.
    6768 */
    68 static inline void ohci_hc_fini(ohci_hc_t *instance) { /* TODO: implement*/ };
     69static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ };
    6970
    7071/** Get and cast pointer to the driver data
     
    7374 * @return cast pointer to driver_data
    7475 */
    75 static inline ohci_hc_t * fun_to_ohci_hc(ddf_fun_t *fun)
    76         { return (ohci_hc_t*)fun->driver_data; }
     76static inline hc_t * fun_to_hc(ddf_fun_t *fun)
     77        { return (hc_t*)fun->driver_data; }
    7778#endif
    7879/**
  • uspace/drv/ohci/iface.c

    rc15070c rbab71635  
    4343
    4444#include "iface.h"
     45#include "hc.h"
    4546
    4647#define UNSUPPORTED(methodname) \
     
    5960static int reserve_default_address(ddf_fun_t *fun, usb_speed_t speed)
    6061{
    61         UNSUPPORTED("reserve_default_address");
    62 
    63         return ENOTSUP;
     62  assert(fun);
     63  hc_t *hc = fun_to_hc(fun);
     64  assert(hc);
     65  usb_log_debug("Default address request with speed %d.\n", speed);
     66  device_keeper_reserve_default(&hc->manager, speed);
     67  return EOK;
    6468}
    6569
     
    323327
    324328/** Host controller interface implementation for OHCI. */
    325 usbhc_iface_t ohci_hc_iface = {
     329usbhc_iface_t hc_iface = {
    326330        .reserve_default_address = reserve_default_address,
    327331        .release_default_address = release_default_address,
  • uspace/drv/ohci/iface.h

    rc15070c rbab71635  
    4040#define NAME "ohci"
    4141
    42 extern usbhc_iface_t ohci_hc_iface;
     42extern usbhc_iface_t hc_iface;
    4343
    4444#endif
  • uspace/drv/ohci/main.c

    rc15070c rbab71635  
    4545#include "pci.h"
    4646#include "iface.h"
    47 #include "ohci_hc.h"
     47#include "hc.h"
    4848
    4949static int ohci_add_device(ddf_dev_t *device);
     
    5858{
    5959        assert(dev);
    60         ohci_hc_t *hc = (ohci_hc_t*)dev->driver_data;
     60        hc_t *hc = (hc_t*)dev->driver_data;
    6161        assert(hc);
    62         ohci_hc_interrupt(hc, 0);
     62        hc_interrupt(hc, 0);
    6363}
    6464/*----------------------------------------------------------------------------*/
     
    7272};
    7373static ddf_dev_ops_t hc_ops = {
    74         .interfaces[USBHC_DEV_IFACE] = &ohci_hc_iface,
     74        .interfaces[USBHC_DEV_IFACE] = &hc_iface,
    7575};
    7676
     
    105105            "Failed(%d) disable legacy USB: %s.\n", ret, str_error(ret));
    106106
    107         ohci_hc_t *hcd = malloc(sizeof(ohci_hc_t));
     107        hc_t *hcd = malloc(sizeof(hc_t));
    108108        if (hcd == NULL) {
    109109                usb_log_error("Failed to allocate OHCI driver.\n");
     
    129129        }
    130130
    131         ret = ohci_hc_init(hcd, hc_fun, mem_reg_base, mem_reg_size, interrupts);
     131        ret = hc_init(hcd, hc_fun, mem_reg_base, mem_reg_size, interrupts);
    132132        if (ret != EOK) {
    133133                usb_log_error("Failed to initialize OHCI driver.\n");
  • uspace/drv/ohci/root_hub.c

    rc15070c rbab71635  
    3838#include <usb/debug.h>
    3939
    40 #include "ohci_rh.h"
     40#include "root_hub.h"
    4141
    4242/** Root hub initialization
    4343 * @return Error code.
    4444 */
    45 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs)
     45int rh_init(ohci_rh_t *instance, ohci_regs_t *regs)
    4646{
    4747        assert(instance);
     
    5555}
    5656/*----------------------------------------------------------------------------*/
    57 void ohci_rh_request(ohci_rh_t *instance, batch_t *request)
     57void rh_request(ohci_rh_t *instance, batch_t *request)
    5858{
    5959        /* TODO: implement */
    6060}
    6161/*----------------------------------------------------------------------------*/
    62 void ohci_rh_interrupt(ohci_rh_t *instance)
     62void rh_interrupt(ohci_rh_t *instance)
    6363{
    6464        usb_log_info("Interrupt!!.\n");
  • uspace/drv/ohci/root_hub.h

    rc15070c rbab71635  
    3333 * @brief OHCI driver
    3434 */
    35 #ifndef DRV_OHCI_OHCI_RH_H
    36 #define DRV_OHCI_OHCI_RH_H
     35#ifndef DRV_OHCI_ROOT_HUB_H
     36#define DRV_OHCI_ROOT_HUB_H
    3737
    3838#include <usb/usb.h>
     
    4646} ohci_rh_t;
    4747
    48 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs);
     48int rh_init(ohci_rh_t *instance, ohci_regs_t *regs);
    4949
    50 void ohci_rh_request(ohci_rh_t *instance, batch_t *request);
     50void rh_request(ohci_rh_t *instance, batch_t *request);
    5151
    52 void ohci_rh_interrupt(ohci_rh_t *instance);
     52void rh_interrupt(ohci_rh_t *instance);
    5353#endif
    5454/**
Note: See TracChangeset for help on using the changeset viewer.