• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef HDF_IO_SERVICE_H
10 #define HDF_IO_SERVICE_H
11 
12 #include "hdf_io_service_if.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17 
18 #define DEV_NODE_PATH "/dev/hdf/"
19 #define DEV_PATH "/dev/"
20 #define DEV_MGR_NODE "dev_mgr"
21 #define MAX_MODE_SIZE 0777
22 #define DEV_NODE_PATH_MODE 0750
23 #define HDF_WRITE_READ _IO('b', 1)
24 #define HDF_READ_DEV_EVENT _IO('b', 2)
25 #define HDF_LISTEN_EVENT_START _IO('b', 3)
26 #define HDF_LISTEN_EVENT_STOP _IO('b', 4)
27 #define HDF_LISTEN_EVENT_WAKEUP _IO('b', 5)
28 #define HDF_LISTEN_EVENT_EXIT _IO('b', 6)
29 
30 typedef enum {
31     DEVMGR_LOAD_SERVICE = 0,
32     DEVMGR_UNLOAD_SERVICE,
33     DEVMGR_GET_SERVICE,
34 } DevMgrCmd;
35 
36 struct HdfWriteReadBuf {
37     uint32_t writeSize;     // bytes to write
38     uint32_t writeConsumed; // bytes consumed by driver (for ERESTARTSYS)
39     uint64_t writeBuffer;
40     uint32_t readSize; // bytes to read
41     uint32_t readConsumed; // bytes consumed by driver (for ERESTARTSYS)
42     uint64_t readBuffer;
43     int32_t cmdCode;
44 };
45 
46 struct HdfIoService *HdfIoServicePublish(const char *serviceName, uint32_t mode);
47 void HdfIoServiceRemove(struct HdfIoService *service);
48 
49 struct HdfIoService *HdfIoServiceAdapterObtain(const char *serviceName);
50 void HdfIoServiceAdapterRecycle(struct HdfIoService *service);
51 struct HdfIoService *HdfIoServiceAdapterPublish(const char *serviceName, uint32_t mode) __attribute__((weak));
52 void HdfIoServiceAdapterRemove(struct HdfIoService *service) __attribute__((weak));
53 int32_t HdfLoadDriverByServiceName(const char *serviceName);
54 
55 #ifdef __cplusplus
56 }
57 #endif  /* __cplusplus */
58 
59 #endif /* HDF_IO_SERVICE_H */
60 
61