Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #ifndef ADX_HDC_EPOLL_H
12 : #define ADX_HDC_EPOLL_H
13 : #include "ascend_hal.h"
14 : #include "adx_epoll.h"
15 : namespace Adx {
16 : #define HDC_EPOLL_EVENT_MASK (HDC_EPOLL_DATA_IN | HDC_EPOLL_CONN_IN | HDC_EPOLL_SESSION_CLOSE)
17 : class AdxHdcEpoll : public AdxEpoll {
18 : public:
19 24 : AdxHdcEpoll() : ep_(nullptr), epEvent_(nullptr) { epMaxSize_ = DEFAULT_EPOLL_SIZE; }
20 43 : ~AdxHdcEpoll() override {}
21 : int32_t EpollCreate(const int32_t size) override;
22 : int32_t EpollDestroy() override;
23 : int32_t EpollCtl(EpollHandle handle, EpollEvent &event, int32_t op) override;
24 : int32_t EpollAdd(EpollHandle target, EpollEvent &event) override;
25 : int32_t EpollDel(EpollHandle target, EpollEvent &event) override;
26 : int32_t EpollWait(std::vector<EpollEvent> &events, int32_t size, int32_t timeout) override;
27 : int32_t EpollErrorHandle() override;
28 : int32_t EpollGetSize() override;
29 : private:
30 : uint32_t EpollEventToHdcEvent(uint32_t events) const;
31 : uint32_t HdcEventToEpollEvent(uint32_t events) const;
32 : private:
33 : HDC_EPOLL ep_ = nullptr;
34 : struct drvHdcEvent *epEvent_ = nullptr;
35 : };
36 : }
37 : #endif
|