97b65af6abc96e21fa0b0bf8e5c8deb822ce1830
[platform/upstream/dldt.git] / inference-engine / thirdparty / movidius / XLink / shared / include / XLinkStream.h
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #ifndef _XLINKSTREAM_H
6 #define _XLINKSTREAM_H
7
8 #include "XLinkPublicDefines.h"
9
10 # if (defined(_WIN32) || defined(_WIN64))
11 #  include "win_semaphore.h"
12 # else
13 #  ifdef __APPLE__
14 #   include "pthread_semaphore.h"
15 #  else
16 #   include <semaphore.h>
17 # endif
18 # endif
19
20 /**
21  * @brief Streams opened to device
22  */
23 typedef struct{
24     char name[MAX_STREAM_NAME_LENGTH];
25     streamId_t id;
26     uint32_t writeSize;
27     uint32_t readSize;  /*No need of read buffer. It's on remote,
28     will read it directly to the requested buffer*/
29     streamPacketDesc_t packets[XLINK_MAX_PACKETS_PER_STREAM];
30     uint32_t availablePackets;
31     uint32_t blockedPackets;
32
33     uint32_t firstPacket;
34     uint32_t firstPacketUnused;
35     uint32_t firstPacketFree;
36
37     uint32_t remoteFillLevel;
38     uint32_t localFillLevel;
39     uint32_t remoteFillPacketLevel;
40
41     uint32_t closeStreamInitiated;
42
43     sem_t sem;
44 }streamDesc_t;
45
46 XLinkError_t XLinkStreamInitialize(
47     streamDesc_t* stream, streamId_t id, const char* name);
48
49 void XLinkStreamReset(streamDesc_t* stream);
50
51 #endif //_XLINKSTREAM_H