Files
OpenCellular/include/usb_api.h
Vic Yang b16bcb0eb0 stm32: Do not wait for USB host if USB is disabled
For USB console, we wait for USB host to grab the data before writing
the next chunk of characters. However, if the USB peripheral is
disabled, the current implementation is confused as to whether the host
has grabbed the previous chunk of data.

Fix this by explicitly checking for USB peripheral enabled.

BRANCH=ryu
BUG=None
TEST=Boot on Ryu and check console isn't slow.

Signed-off-by: Vic Yang <victoryang@chromium.org>
Change-Id: I438c95835e56707b7ca1796734f2e47062799f44
Reviewed-on: https://chromium-review.googlesource.com/231115
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-21 02:44:07 +00:00

46 lines
1.3 KiB
C

/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* USB API definitions.
*
* This file includes definitions needed by common code that wants to control
* the state of the USB peripheral, but doesn't need to know about the specific
* implementation.
*/
#ifndef USB_API_H
#define USB_API_H
/*
* Initialize the USB peripheral, enabling its clock and configuring the DP/DN
* GPIOs correctly. This function is called via an init hook (unless the board
* defined CONFIG_USB_INHIBIT_INIT), but may need to be called again if
* usb_release is called. This function will call usb_connect by default
* unless CONFIG_USB_INHIBIT_CONNECT is defined.
*/
void usb_init(void);
/* Check if USB peripheral is enabled. */
int usb_is_enabled(void);
/*
* Enable the pullup on the DP line to signal that this device exists to the
* host and to start the enumeration process.
*/
void usb_connect(void);
/*
* Disable the pullup on the DP line. This causes the device to be disconnected
* from the host.
*/
void usb_disconnect(void);
/*
* Disconnect from the host by calling usb_disconnect and then turn off the USB
* peripheral, releasing its GPIOs and disabling its clock.
*/
void usb_release(void);
#endif /* USB_API_H */