1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2020-2022 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License.
5094332d3Sopenharmony_ci * You may obtain a copy of the License at
6094332d3Sopenharmony_ci *
7094332d3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8094332d3Sopenharmony_ci *
9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and
13094332d3Sopenharmony_ci * limitations under the License.
14094332d3Sopenharmony_ci */
15094332d3Sopenharmony_ci
16094332d3Sopenharmony_ci/**
17094332d3Sopenharmony_ci * @addtogroup USB
18094332d3Sopenharmony_ci * @{
19094332d3Sopenharmony_ci *
20094332d3Sopenharmony_ci * @brief Declares USB-related APIs, including the custom data types and functions used to obtain descriptors,
21094332d3Sopenharmony_ci * interface objects, and request objects, and to submit requests.
22094332d3Sopenharmony_ci *
23094332d3Sopenharmony_ci * @since 1.0
24094332d3Sopenharmony_ci * @version 1.0
25094332d3Sopenharmony_ci */
26094332d3Sopenharmony_ci
27094332d3Sopenharmony_ci/**
28094332d3Sopenharmony_ci * @file usb_session.h
29094332d3Sopenharmony_ci *
30094332d3Sopenharmony_ci * @brief Defines the session context data.
31094332d3Sopenharmony_ci *
32094332d3Sopenharmony_ci * @since 1.0
33094332d3Sopenharmony_ci * @version 1.0
34094332d3Sopenharmony_ci */
35094332d3Sopenharmony_ci#ifndef USB_SESSION_H
36094332d3Sopenharmony_ci#define USB_SESSION_H
37094332d3Sopenharmony_ci
38094332d3Sopenharmony_ci#include "usb_object.h"
39094332d3Sopenharmony_ci
40094332d3Sopenharmony_ci#ifdef __cplusplus
41094332d3Sopenharmony_ciextern "C" {
42094332d3Sopenharmony_ci#endif
43094332d3Sopenharmony_ci
44094332d3Sopenharmony_ci/**
45094332d3Sopenharmony_ci * @brief Defines a session context object.
46094332d3Sopenharmony_ci *
47094332d3Sopenharmony_ci * A session context object allows a program to use the driver development kit (DDK) independently. This can prevent
48094332d3Sopenharmony_ci * interference between users of a single DDK. Such a session can be initiated by using <b>UsbInitHostSdk()</b> or
49094332d3Sopenharmony_ci * <b>UsbRawInit()</b> and destroyed by using <b>UsbExitHostSdk()</b> or <b>UsbRawExit()</b>.
50094332d3Sopenharmony_ci * If a program has only one user, you can ignore the session context. You just need to pass <b>NULL</b> in each
51094332d3Sopenharmony_ci * function call that requires context, and the default session context will be used.
52094332d3Sopenharmony_ci */
53094332d3Sopenharmony_cistruct UsbSession {
54094332d3Sopenharmony_ci    /** Device linked list */
55094332d3Sopenharmony_ci    struct HdfSList usbDevs;
56094332d3Sopenharmony_ci    /** Interface object pool linked list */
57094332d3Sopenharmony_ci    struct DListHead ifacePoolList;
58094332d3Sopenharmony_ci    /** Mutex used for operations on the device linked list and interface object pool linked list */
59094332d3Sopenharmony_ci    struct OsalMutex lock;
60094332d3Sopenharmony_ci    /** Number of references to session context objects */
61094332d3Sopenharmony_ci    OsalAtomic refCount;
62094332d3Sopenharmony_ci};
63094332d3Sopenharmony_ci
64094332d3Sopenharmony_ci#ifdef __cplusplus
65094332d3Sopenharmony_ci}
66094332d3Sopenharmony_ci#endif
67094332d3Sopenharmony_ci
68094332d3Sopenharmony_ci#endif /* USB_SESSION_H */
69094332d3Sopenharmony_ci       /** @} */