Mistake on this page?
Report an issue in GitHub or email us
USBPhyHw.h
1 /*
2  * Copyright (c) 2018-2019, Arm Limited and affiliates.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef USBPHYHW_H
19 #define USBPHYHW_H
20 
21 #include "mbed.h"
22 #include "USBPhy.h"
23 
24 
25 class USBPhyHw : public USBPhy {
26 public:
27  USBPhyHw();
28  virtual ~USBPhyHw();
29  virtual void init(USBPhyEvents *events);
30  virtual void deinit();
31  virtual bool powered();
32  virtual void connect();
33  virtual void disconnect();
34  virtual void configure();
35  virtual void unconfigure();
36  virtual void sof_enable();
37  virtual void sof_disable();
38  virtual void set_address(uint8_t address);
39  virtual void remote_wakeup();
40  virtual const usb_ep_table_t *endpoint_table();
41 
42  virtual uint32_t ep0_set_max_packet(uint32_t max_packet);
43  virtual void ep0_setup_read_result(uint8_t *buffer, uint32_t size);
44  virtual void ep0_read(uint8_t *data, uint32_t size);
45  virtual uint32_t ep0_read_result();
46  virtual void ep0_write(uint8_t *buffer, uint32_t size);
47  virtual void ep0_stall();
48 
49  virtual bool endpoint_add(usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type);
50  virtual void endpoint_remove(usb_ep_t endpoint);
51  virtual void endpoint_stall(usb_ep_t endpoint);
52  virtual void endpoint_unstall(usb_ep_t endpoint);
53 
54  virtual bool endpoint_read(usb_ep_t endpoint, uint8_t *data, uint32_t size);
55  virtual uint32_t endpoint_read_result(usb_ep_t endpoint);
56  virtual bool endpoint_write(usb_ep_t endpoint, uint8_t *data, uint32_t size);
57  virtual void endpoint_abort(usb_ep_t endpoint);
58 
59  virtual void process();
60 
61 private:
62  USBPhyEvents *events;
63 
64  static void _usbisr(void);
65 };
66 
67 #endif
virtual bool endpoint_write(usb_ep_t endpoint, uint8_t *data, uint32_t size)
Start a write on the given endpoint.
virtual void configure()
Set this device to the configured state.
virtual void process()
Callback used for performing USB processing.
virtual uint32_t ep0_set_max_packet(uint32_t max_packet)
Set wMaxPacketSize of endpoint 0.
virtual bool endpoint_add(usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type)
Configure and enable an endpoint.
virtual void ep0_read(uint8_t *data, uint32_t size)
Start receiving a packet of up to wMaxPacketSize on endpoint 0.
virtual void ep0_write(uint8_t *buffer, uint32_t size)
Write a packet on endpoint 0.
virtual bool endpoint_read(usb_ep_t endpoint, uint8_t *data, uint32_t size)
Start a read on the given endpoint.
virtual void endpoint_stall(usb_ep_t endpoint)
Perform a functional stall on the given endpoint.
Abstract interface to physical USB hardware.
Definition: USBPhy.h:82
virtual void sof_disable()
Disable the start of frame interrupt.
virtual void connect()
Make the USB phy visible to the USB host.
virtual bool powered()
Check if USB power is present.
virtual void ep0_stall()
Protocol stall on endpoint 0.
virtual uint32_t ep0_read_result()
Read the contents of a received packet.
virtual void endpoint_unstall(usb_ep_t endpoint)
Un-stall the endpoint.
virtual void unconfigure()
Leave the configured state.
virtual void remote_wakeup()
Wake upstream devices.
virtual void disconnect()
Detach the USB phy.
virtual void endpoint_abort(usb_ep_t endpoint)
Abort the current transfer if it has not yet been sent.
virtual void sof_enable()
Enable the start of frame interrupt.
virtual void ep0_setup_read_result(uint8_t *buffer, uint32_t size)
Read the contents of the SETUP packet.
virtual uint32_t endpoint_read_result(usb_ep_t endpoint)
Finish a read on the given endpoint.
virtual void init(USBPhyEvents *events)
Initialize this USBPhy instance.
virtual void set_address(uint8_t address)
Set the USBPhy's address.
virtual void endpoint_remove(usb_ep_t endpoint)
Disable an endpoint.
virtual const usb_ep_table_t * endpoint_table()
Get the endpoint table.
virtual void deinit()
Power down this USBPhy instance.
Event handler for USBPhy.
Definition: USBPhyEvents.h:31
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.