Changeset 42dbb26 in mainline


Ignore:
Timestamp:
2011-03-20T18:36:09Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e7bc999
Parents:
b8e9acb
Message:

Enable access to device registers

Location:
uspace/drv/ohci
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/ohci_hc.c

    rb8e9acb r42dbb26  
    4848{
    4949        assert(instance);
    50         ohci_rh_init(&instance->rh, regs, reg_size);
     50        int ret = pio_enable((void*)regs, reg_size, (void**)&instance->registers);
     51        if (ret != EOK) {
     52                usb_log_error("Failed to gain access to device registers.\n");
     53                return ret;
     54        }
     55
     56        ohci_rh_init(&instance->rh, instance->registers);
    5157        /* TODO: implement */
    5258        /* TODO: register root hub */
  • uspace/drv/ohci/ohci_hc.h

    rb8e9acb r42dbb26  
    4545
    4646#include "batch.h"
     47#include "ohci_regs.h"
    4748#include "ohci_rh.h"
    4849
    49 typedef struct ohci_regs {
    50 } regs_t;
    51 
    52 
    5350typedef struct ohci_hc {
     51        ohci_regs_t *registers;
    5452        usb_address_t rh_address;
    5553        ohci_rh_t rh;
  • uspace/drv/ohci/ohci_rh.c

    rb8e9acb r42dbb26  
    3535#include <errno.h>
    3636#include <str_error.h>
    37 #include <stdio.h>
    3837
    3938#include <usb/debug.h>
     
    4241
    4342/** Root hub initialization
    44  * @param[in] instance RH structure to initialize
    45  * @param[in] fun DDF function representing UHCI root hub
    46  * @param[in] reg_addr Address of root hub status and control registers.
    47  * @param[in] reg_size Size of accessible address space.
    4843 * @return Error code.
    4944 */
    50 int ohci_rh_init(ohci_rh_t *instance, uintptr_t reg_addr, size_t reg_size)
     45int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs)
    5146{
    5247        assert(instance);
    5348        instance->address = 0;
     49        instance->registers = regs;
     50
     51        usb_log_info("OHCI root hub with %d ports.\n", regs->rh_desc_a & 0xff);
     52
    5453        /* TODO: implement */
    5554        return EOK;
  • uspace/drv/ohci/ohci_rh.h

    rb8e9acb r42dbb26  
    3838#include <usb/usb.h>
    3939
     40#include "ohci_regs.h"
    4041#include "batch.h"
    4142
    4243typedef struct ohci_rh {
     44        ohci_regs_t *registers;
    4345        usb_address_t address;
    4446} ohci_rh_t;
    4547
    46 int ohci_rh_init(ohci_rh_t *instance, uintptr_t reg_addr, size_t reg_size);
     48int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs);
    4749
    4850void ohci_rh_request(ohci_rh_t *instance, batch_t *request);
Note: See TracChangeset for help on using the changeset viewer.