2021-12-22 11:31:06 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef XHCI_H
|
|
|
|
#define XHCI_H
|
2022-02-19 10:17:40 -06:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
*
|
2021-12-22 11:31:06 -06:00
|
|
|
* Provides support for USB keyboards connected via an XHCI controller.
|
|
|
|
*
|
2022-02-19 13:56:55 -06:00
|
|
|
*//*
|
2022-01-08 17:00:28 -06:00
|
|
|
* Copyright (C) 2021-2022 Martin Whitaker.
|
2021-12-22 11:31:06 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-01-08 17:14:50 -06:00
|
|
|
#include "usbhcd.h"
|
2022-01-08 17:00:28 -06:00
|
|
|
|
2022-02-19 10:17:40 -06:00
|
|
|
/**
|
2022-10-07 03:32:09 -05:00
|
|
|
* If necessary, takes ownership of the XHCI device at the specified base
|
|
|
|
* address, then resets it.
|
|
|
|
*
|
|
|
|
* \param base_addr - the base address of the device in virtual memory
|
|
|
|
*
|
|
|
|
* \returns
|
|
|
|
* true if ownership was acquired and the device was successfully reset,
|
|
|
|
* otherwise false.
|
|
|
|
*/
|
|
|
|
bool xhci_reset(uintptr_t base_addr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialises the XHCI device at the specified base address, probes all
|
|
|
|
* the attached USB devices, and configures any HID USB keyboard devices
|
|
|
|
* it finds to generate periodic interrupt transfers that report key
|
|
|
|
* presses. If successful, initialises the specified host controller
|
|
|
|
* driver object accordingly.
|
|
|
|
*
|
|
|
|
* \param base_addr - the base address of the device in virtual memory
|
|
|
|
* \param hcd - a pointer to a pre-allocated host controller
|
|
|
|
* driver object that can be used for this device
|
|
|
|
*
|
|
|
|
* \returns
|
|
|
|
* true if the device was successfully initialised and one or more
|
|
|
|
* keyboards were found, otherwise false.
|
2021-12-22 11:31:06 -06:00
|
|
|
*/
|
2022-10-07 03:32:09 -05:00
|
|
|
bool xhci_probe(uintptr_t base_addr, usb_hcd_t *hcd);
|
2021-12-22 11:31:06 -06:00
|
|
|
|
|
|
|
#endif // XHCI_H
|