XLinkPlatform.h 2.9 KB
Newer Older
1
// Copyright (C) 2018-2020 Intel Corporation
2 3
// SPDX-License-Identifier: Apache-2.0
//
4

5 6 7 8
///
/// @brief     Application configuration Leon header
///

9 10
#ifndef _XLINK_LINKPLATFORM_H
#define _XLINK_LINKPLATFORM_H
11 12

#include "XLinkPrivateDefines.h"
13
#include <stdint.h>
14

15 16 17 18 19 20 21 22
#ifdef __cplusplus
extern "C"
{
#endif

#define MAX_POOLS_ALLOC 32
#define PACKET_LENGTH (64*1024)

23 24 25 26 27
typedef enum {
    X_LINK_PLATFORM_SUCCESS = 0,
    X_LINK_PLATFORM_DEVICE_NOT_FOUND = -1,
    X_LINK_PLATFORM_ERROR = -2,
    X_LINK_PLATFORM_TIMEOUT = -3,
28 29
    X_LINK_PLATFORM_DRIVER_NOT_LOADED = -4,
    X_LINK_PLATFORM_INVALID_PARAMETERS = -5
30 31
} xLinkPlatformErrorCode_t;

32 33 34
// ------------------------------------
// Device management. Begin.
// ------------------------------------
35

36
void XLinkPlatformInit();
37

38
#ifdef __PC__
39
/**
40
 * @brief Return Myriad device description which meets the requirements
41
 */
42 43 44 45 46
xLinkPlatformErrorCode_t XLinkPlatformFindDeviceName(XLinkDeviceState_t state,
                                                     const deviceDesc_t in_deviceRequirements,
                                                     deviceDesc_t* out_foundDevice);

xLinkPlatformErrorCode_t XLinkPlatformFindArrayOfDevicesNames(
47
    XLinkDeviceState_t state,
48 49 50 51
    const deviceDesc_t in_deviceRequirements,
    deviceDesc_t* out_foundDevicePtr,
    const unsigned int devicesArraySize,
    unsigned int *out_amountOfFoundDevices);
52

53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
int XLinkPlatformBootRemote(deviceDesc_t* deviceDesc, const char* binaryPath);
int XLinkPlatformConnect(const char* devPathRead, const char* devPathWrite,
                         XLinkProtocol_t protocol, void** fd);
#endif // __PC__

int XLinkPlatformCloseRemote(xLinkDeviceHandle_t* deviceHandle);

// ------------------------------------
// Device management. End.
// ------------------------------------



// ------------------------------------
// Data management. Begin.
// ------------------------------------
69

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
int XLinkPlatformWrite(xLinkDeviceHandle_t *deviceHandle, void *data, int size);
int XLinkPlatformRead(xLinkDeviceHandle_t *deviceHandle, void *data, int size);

void* XLinkPlatformAllocateData(uint32_t size, uint32_t alignment);
void XLinkPlatformDeallocateData(void *ptr, uint32_t size, uint32_t alignment);

// ------------------------------------
// Data management. End.
// ------------------------------------



// ------------------------------------
// Helpers. Begin.
// ------------------------------------

#ifdef __PC__

int XLinkPlatformIsDescriptionValid(const deviceDesc_t *in_deviceDesc, const XLinkDeviceState_t state);
char* XLinkPlatformErrorToStr(const xLinkPlatformErrorCode_t errorCode);

// for deprecated API
92
XLinkPlatform_t XLinkPlatformPidToPlatform(const int pid);
93
XLinkDeviceState_t XLinkPlatformPidToState(const int pid);
94
// for deprecated API
95

96
#endif // __PC__
97

98 99 100
// ------------------------------------
// Helpers. End.
// ------------------------------------
101 102 103 104 105 106 107 108

#ifdef __cplusplus
}
#endif

#endif

/* end of include file */