Mistake on this page?
Report an issue in GitHub or email us
USBPhyEvents.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 USBPHY_EVENTS_H
19 #define USBPHY_EVENTS_H
20 
21 #include "USBPhyTypes.h"
22 
23 /** Event handler for USBPhy
24  *
25  * This class is the event handler for the USBPhy class. Any events generated
26  * by USBPhy are passed to this class via the virtual functions.
27  *
28  * @ingroup usb_device_core
29  *
30  */
31 class USBPhyEvents {
32 public:
33  USBPhyEvents() {};
34  virtual ~USBPhyEvents() {};
35 
36  /**
37  * Callback called when a bus reset occurs
38  * @note called in the contex of USBPhy::process
39  */
40  virtual void reset() = 0;
41 
42  /**
43  * Callback called when an endpoint 0 setup packet is received
44  * @note called in the contex of USBPhy::process
45  */
46  virtual void ep0_setup() = 0;
47 
48  /**
49  * Callback called when an endpoint 0 out packet is received
50  * @note called in the contex of USBPhy::process
51  */
52  virtual void ep0_out() = 0;
53 
54  /**
55  * Callback called when an endpoint 0 in packet is received
56  * @note called in the contex of USBPhy::process
57  */
58  virtual void ep0_in() = 0;
59 
60  /**
61  * Callback called USB power is applied or removed
62  *
63  * @param powered true if USB power is present, false otherwise
64  * @note called in the contex of USBPhy::process
65  */
66  virtual void power(bool powered) = 0;
67 
68  /**
69  * Callback called when entering or leaving suspend mode
70  *
71  * @param suspended true if entering suspend mode false otherwise
72  * @note called in the contex of USBPhy::process
73  */
74  virtual void suspend(bool suspended) = 0;
75 
76  /**
77  * Callback called on start of frame
78  *
79  * @param frame_number The current frame number
80  * @note This callback is enabled/disabled by
81  * calling USBPhy::sof_enable / USBPhy::sof_disable
82  * @note called in the contex of USBPhy::process
83  */
84  virtual void sof(int frame_number) = 0;
85 
86  /**
87  * Callback called on the reception of an OUT packet
88  *
89  * @param endpoint Endpoint which received the OUT packet
90  * @note called in the contex of USBPhy::process
91  */
92  virtual void out(usb_ep_t endpoint) = 0;
93 
94  /**
95  * Callback called on the transmission of an IN packet
96  *
97  * @param endpoint Endpoint which sent the IN packet
98  * @note called in the contex of USBPhy::process
99  */
100  virtual void in(usb_ep_t endpoint) = 0;
101 
102  /**
103  * Callback called to indicate the USB processing needs to be done
104  */
105  virtual void start_process() = 0;
106 };
107 
108 #endif
virtual void ep0_out()=0
Callback called when an endpoint 0 out packet is received.
virtual void ep0_setup()=0
Callback called when an endpoint 0 setup packet is received.
virtual void suspend(bool suspended)=0
Callback called when entering or leaving suspend mode.
virtual void out(usb_ep_t endpoint)=0
Callback called on the reception of an OUT packet.
virtual void power(bool powered)=0
Callback called USB power is applied or removed.
virtual void ep0_in()=0
Callback called when an endpoint 0 in packet is received.
virtual void start_process()=0
Callback called to indicate the USB processing needs to be done.
virtual void in(usb_ep_t endpoint)=0
Callback called on the transmission of an IN packet.
virtual void reset()=0
Callback called when a bus reset occurs.
Event handler for USBPhy.
Definition: USBPhyEvents.h:31
virtual void sof(int frame_number)=0
Callback called on start of frame.
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.