source: mainline/uspace/drv/bus/usb/ehci/hc.h@ 3f932a7e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3f932a7e was ae3a941, checked in by Ondřej Hlavatý <aearsis@…>, 7 years ago

usb: cstyle

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 * Copyright (c) 2011 Jan Vesely
3 * Copyright (c) 2018 Ondrej Hlavaty
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29/** @addtogroup drvusbehci
30 * @{
31 */
32/** @file
33 * @brief EHCI host controller driver structure
34 */
35#ifndef DRV_EHCI_HC_H
36#define DRV_EHCI_HC_H
37
38#include <adt/list.h>
39#include <ddi.h>
40#include <ddf/driver.h>
41#include <device/hw_res_parsed.h>
42#include <fibril.h>
43#include <fibril_synch.h>
44#include <stdbool.h>
45#include <stdint.h>
46
47#include <usb/host/hcd.h>
48#include <usb/host/endpoint.h>
49#include <usb/host/usb_transfer_batch.h>
50
51#include "ehci_regs.h"
52#include "ehci_rh.h"
53#include "hw_struct/link_pointer.h"
54#include "endpoint_list.h"
55
56/** Main EHCI driver structure */
57typedef struct hc {
58 /* Common device header */
59 hc_device_t base;
60
61 /** Memory mapped CAPS register area */
62 ehci_caps_regs_t *caps;
63 /** Memory mapped I/O registers area */
64 ehci_regs_t *registers;
65
66 /** Iso transfer list, backed by dma_buffer */
67 link_pointer_t *periodic_list;
68
69 dma_buffer_t dma_buffer;
70
71 /** CONTROL and BULK schedules */
72 endpoint_list_t async_list;
73
74 /** INT schedule */
75 endpoint_list_t int_list;
76
77 /** List of active transfers */
78 list_t pending_endpoints;
79
80 /** Guards schedule and endpoint manipulation */
81 fibril_mutex_t guard;
82
83 /** Wait for hc to restart async chedule */
84 fibril_condvar_t async_doorbell;
85
86 /** USB hub emulation structure */
87 ehci_rh_t rh;
88
89 /** USB bookkeeping */
90 ehci_bus_t bus;
91} hc_t;
92
93static inline hc_t *hcd_to_hc(hc_device_t *hcd)
94{
95 assert(hcd);
96 return (hc_t *) hcd;
97}
98
99void hc_enqueue_endpoint(hc_t *, const endpoint_t *);
100void hc_dequeue_endpoint(hc_t *, const endpoint_t *);
101
102/* Boottime operations */
103extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *);
104extern errno_t hc_start(hc_device_t *);
105extern errno_t hc_setup_roothub(hc_device_t *);
106extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *,
107 const hw_res_list_parsed_t *, int *);
108extern errno_t hc_gone(hc_device_t *);
109
110/** Runtime operations */
111extern void ehci_hc_interrupt(bus_t *, uint32_t);
112extern errno_t ehci_hc_status(bus_t *, uint32_t *);
113extern errno_t ehci_hc_schedule(usb_transfer_batch_t *);
114
115#endif
116/**
117 * @}
118 */
Note: See TracBrowser for help on using the repository browser.