• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup USB
18  * @{
19  *
20  * @brief Declares USB-related APIs, including the custom data types and functions used to obtain descriptors,
21  * interface objects, and request objects, and to submit requests.
22  *
23  * @since 1.0
24  * @version 1.0
25  */
26 
27 /**
28  * @file usb_session.h
29  *
30  * @brief Defines the session context data.
31  *
32  * @since 1.0
33  * @version 1.0
34  */
35 #ifndef USB_SESSION_H
36 #define USB_SESSION_H
37 
38 #include "usb_object.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**
45  * @brief Defines a session context object.
46  *
47  * A session context object allows a program to use the driver development kit (DDK) independently. This can prevent
48  * interference between users of a single DDK. Such a session can be initiated by using <b>UsbInitHostSdk()</b> or
49  * <b>UsbRawInit()</b> and destroyed by using <b>UsbExitHostSdk()</b> or <b>UsbRawExit()</b>.
50  * If a program has only one user, you can ignore the session context. You just need to pass <b>NULL</b> in each
51  * function call that requires context, and the default session context will be used.
52  */
53 struct UsbSession {
54     /** Device linked list */
55     struct HdfSList usbDevs;
56     /** Interface object pool linked list */
57     struct DListHead ifacePoolList;
58     /** Mutex used for operations on the device linked list and interface object pool linked list */
59     struct OsalMutex lock;
60     /** Number of references to session context objects */
61     OsalAtomic refCount;
62 };
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif /* USB_SESSION_H */
69        /** @} */