Changeset e099f26 in mainline for uspace/drv/ohci/hc.h


Ignore:
Timestamp:
2011-03-21T20:22:50Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c56c5b5b
Parents:
4fb6d9ee (diff), 31b568e (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 (including OHCI)

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hc.h

    r4fb6d9ee re099f26  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    29 /** @addtogroup drvusbuhcihc
     28/** @addtogroup drvusbohci
    3029 * @{
    3130 */
    3231/** @file
    33  * @brief UHCI driver
     32 * @brief OHCI host controller driver structure
    3433 */
    35 #ifndef UTILS_DEVICE_KEEPER_H
    36 #define UTILS_DEVICE_KEEPER_H
    37 #include <devman.h>
     34#ifndef DRV_OHCI_HC_H
     35#define DRV_OHCI_HC_H
     36
     37#include <fibril.h>
    3838#include <fibril_synch.h>
     39#include <adt/list.h>
     40#include <ddi.h>
     41
    3942#include <usb/usb.h>
     43#include <usb/host/device_keeper.h>
     44#include <usbhc_iface.h>
    4045
    41 #define USB_ADDRESS_COUNT (USB11_ADDRESS_MAX + 1)
     46#include "batch.h"
     47#include "ohci_regs.h"
     48#include "root_hub.h"
    4249
    43 struct usb_device_info {
    44         usb_speed_t speed;
    45         bool occupied;
    46         uint16_t toggle_status;
    47         devman_handle_t handle;
    48 };
     50typedef struct hc {
     51        ohci_regs_t *registers;
     52        usb_address_t rh_address;
     53        rh_t rh;
     54        ddf_fun_t *ddf_instance;
     55        usb_device_keeper_t manager;
     56        fid_t interrupt_emulator;
     57} hc_t;
    4958
    50 typedef struct device_keeper {
    51         struct usb_device_info devices[USB_ADDRESS_COUNT];
    52         fibril_mutex_t guard;
    53         fibril_condvar_t default_address_occupied;
    54         usb_address_t last_address;
    55 } device_keeper_t;
     59int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev,
     60     uintptr_t regs, size_t reg_size, bool interrupts);
    5661
    57 void device_keeper_init(device_keeper_t *instance);
     62int hc_register_hub(hc_t *instance);
    5863
    59 void device_keeper_reserve_default(
    60     device_keeper_t *instance, usb_speed_t speed);
     64int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch);
    6165
    62 void device_keeper_release_default(device_keeper_t *instance);
     66void hc_interrupt(hc_t *instance, uint32_t status);
    6367
    64 void device_keeper_reset_if_need(
    65     device_keeper_t *instance, usb_target_t target, const unsigned char *setup_data);
     68/** Safely dispose host controller internal structures
     69 *
     70 * @param[in] instance Host controller structure to use.
     71 */
     72static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ };
    6673
    67 int device_keeper_get_toggle(device_keeper_t *instance, usb_target_t target);
    68 
    69 int device_keeper_set_toggle(
    70     device_keeper_t *instance, usb_target_t target, bool toggle);
    71 
    72 usb_address_t device_keeper_request(
    73     device_keeper_t *instance, usb_speed_t speed);
    74 
    75 void device_keeper_bind(
    76     device_keeper_t *instance, usb_address_t address, devman_handle_t handle);
    77 
    78 void device_keeper_release(device_keeper_t *instance, usb_address_t address);
    79 
    80 usb_address_t device_keeper_find(
    81     device_keeper_t *instance, devman_handle_t handle);
    82 
    83 usb_speed_t device_keeper_speed(
    84     device_keeper_t *instance, usb_address_t address);
     74/** Get and cast pointer to the driver data
     75 *
     76 * @param[in] fun DDF function pointer
     77 * @return cast pointer to driver_data
     78 */
     79static inline hc_t * fun_to_hc(ddf_fun_t *fun)
     80        { return (hc_t*)fun->driver_data; }
    8581#endif
    8682/**
Note: See TracChangeset for help on using the changeset viewer.