source: mainline/uspace/drv/bus/usb/ohci/hc.h

Last change on this file was 9dfb034, checked in by Jiri Svoboda <jiri@…>, 5 months ago

Implement quiesce for EHCI and OHCI.

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[41b96b4]1/*
[9dfb034]2 * Copyright (c) 2025 Jiri Svoboda
[41b96b4]3 * Copyright (c) 2011 Jan Vesely
[e0a5d4c]4 * Copyright (c) 2018 Ondrej Hlavaty
[41b96b4]5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * - The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
[58563585]30
[bab71635]31/** @addtogroup drvusbohci
[41b96b4]32 * @{
33 */
34/** @file
35 * @brief OHCI host controller driver structure
36 */
[58563585]37
[bab71635]38#ifndef DRV_OHCI_HC_H
39#define DRV_OHCI_HC_H
[41b96b4]40
41#include <adt/list.h>
42#include <ddi.h>
[0d4b110]43#include <ddf/driver.h>
44#include <device/hw_res_parsed.h>
45#include <fibril.h>
46#include <fibril_synch.h>
47#include <stdbool.h>
[8d2dd7f2]48#include <stdint.h>
[41b96b4]49
[e2976bb]50#include <usb/host/hcd.h>
[0d4b110]51#include <usb/host/endpoint.h>
52#include <usb/host/usb_transfer_batch.h>
[41b96b4]53
[42dbb26]54#include "ohci_regs.h"
[171e668]55#include "ohci_rh.h"
[e6b9182]56#include "ohci_bus.h"
[5a2c42b]57#include "endpoint_list.h"
[fc9f88d]58#include "hw_struct/hcca.h"
[41b96b4]59
[1f6eb7d]60/** Main OHCI driver structure */
[bab71635]61typedef struct hc {
[32fb6bce]62 /** Common hcd header */
63 hc_device_t base;
64
[02cacce]65 /** Memory mapped I/O registers area */
[42dbb26]66 ohci_regs_t *registers;
[a35b458]67
[02cacce]68 /** Host controller communication area structure */
[7013b14]69 hcca_t *hcca;
70
[02cacce]71 /** Transfer schedules */
[5a2c42b]72 endpoint_list_t lists[4];
[9876e34]73
[d60115a]74 /** List of active endpoints */
75 list_t pending_endpoints;
[6b6e3ed3]76
[02cacce]77 /** Guards schedule and endpoint manipulation */
[aa9ccf7]78 fibril_mutex_t guard;
[561112f]79
[02cacce]80 /** USB hub emulation structure */
[171e668]81 ohci_rh_t rh;
[e6b9182]82
83 /** USB bookkeeping */
84 ohci_bus_t bus;
[bab71635]85} hc_t;
[41b96b4]86
[ae3a941]87static inline hc_t *hcd_to_hc(hc_device_t *hcd)
[32fb6bce]88{
89 assert(hcd);
90 return (hc_t *) hcd;
91}
92
[5a6cc679]93extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *);
[ae3a941]94extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *,
95 const hw_res_list_parsed_t *, int *);
[5a6cc679]96extern errno_t hc_gain_control(hc_device_t *);
97extern errno_t hc_start(hc_device_t *);
98extern errno_t hc_setup_roothub(hc_device_t *);
99extern errno_t hc_gone(hc_device_t *);
[9dfb034]100extern errno_t hc_quiesce(hc_device_t *);
[41b96b4]101
[58563585]102extern void hc_enqueue_endpoint(hc_t *, const endpoint_t *);
103extern void hc_dequeue_endpoint(hc_t *, const endpoint_t *);
[620c710]104
[5a6cc679]105extern errno_t ohci_hc_schedule(usb_transfer_batch_t *);
106extern errno_t ohci_hc_status(bus_t *, uint32_t *);
[32fb6bce]107extern void ohci_hc_interrupt(bus_t *, uint32_t);
[58563585]108
[41b96b4]109#endif
[58563585]110
[41b96b4]111/**
112 * @}
113 */
Note: See TracBrowser for help on using the repository browser.