libxcoder  3.5.1
ni_rsrc_priv_logan.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (C) 2022 NETINT Technologies
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18  * SOFTWARE.
19  *
20  ******************************************************************************/
21 
22 /*!*****************************************************************************
23 * \file ni_rsrc_priv_logan.h
24 *
25 * \brief Private definitions related to resource management of NI T-408
26 * devices
27 *
28 *******************************************************************************/
29 
30 #pragma once
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include "ni_device_api_logan.h"
37 
38 #ifdef __ANDROID__
39 #define LOCK_DIR "/dev/shm_netint"
40 #define CODERS_LCK_NAME "/dev/shm_netint/NI_LOGAN_LCK_CODERS"
41 #define CODERS_RETRY_DELCK_NAME "/dev/shm_netint/NI_LOGAN_RETRY_LCK_DECODERS"
42 #define CODERS_RETRY_ENLCK_NAME "/dev/shm_netint/NI_LOGAN_RETRY_LCK_ENCODERS"
43 #elif defined(__APPLE__)
44 #define LOCK_DIR "/tmp"
45 #define CODERS_LCK_NAME "/tmp/NI_LOGAN_LCK_CODERS"
46 #define CODERS_RETRY_DELCK_NAME "/tmp/NI_LOGAN_RETRY_LCK_DECODERS"
47 #define CODERS_RETRY_ENLCK_NAME "/tmp/NI_LOGAN_RETRY_LCK_ENCODERS"
48 #else
49 #define LOCK_DIR "/dev/shm"
50 #define CODERS_LCK_NAME "/dev/shm/NI_LOGAN_LCK_CODERS"
51 #define CODERS_RETRY_DELCK_NAME "/dev/shm/NI_LOGAN_RETRY_LCK_DECODERS"
52 #define CODERS_RETRY_ENLCK_NAME "/dev/shm/NI_LOGAN_RETRY_LCK_ENCODERS"
53 #endif
54 
55 #define CODERS_SHM_NAME "NI_LOGAN_SHM_CODERS"
56 
57 
58 #define MAX_LOCK_RETRY 6000
59 #define LOCK_WAIT 10000 // wait in us
60 
61 extern LIB_API uint32_t g_logan_xcoder_stop_process;
62 
63 /*!******************************************************************************
64  * \brief Returns the device lock name
65  *
66  * \param
67  *
68  * \return
69  *******************************************************************************/
71  int32_t guid,
72  char* p_name,
73  size_t max_name_len);
74 
75 /*!******************************************************************************
76  * \brief Returns the name of shared memory of the codec record
77  *
78  * \param
79  *
80  * \return
81  *******************************************************************************/
83  int32_t guid,
84  char* p_name,
85  size_t max_name_len);
86 
87 /*!******************************************************************************
88  * \brief Updates the codec record
89  *
90  * \param
91  *
92  * \return
93  *******************************************************************************/
95  ni_logan_session_context_t *p_session_ctx);
96 
97 /*!******************************************************************************
98  * \brief Retrieve codec record info
99  *
100  * \param
101  *
102  * \return
103  *******************************************************************************/
105 
106 /*!******************************************************************************
107  * \brief Update codec record info with retrieved device info from HW
108  *
109  * \param
110  *
111  * \return
112  *******************************************************************************/
114  ni_codec_t fmt,
116  ni_logan_hw_capability_t* p_hw_cap);
117 
118 /*!******************************************************************************
119  * \brief List NETINT nvme devices
120  *
121  * \param
122  *
123  * \return
124  *******************************************************************************/
125 int ni_logan_rsrc_enumerate_devices(char ni_logan_devices[][NI_LOGAN_MAX_DEVICE_NAME_LEN], int max_handles);
126 
127 
128 /*!******************************************************************************
129  * \brief String comparison function
130  *
131  * \param
132  *
133  * \return
134  *******************************************************************************/
135 int ni_logan_rsrc_strcmp(const void* p_str, const void* p_str1);
136 
137 /*!*****************************************************************************
138  * \brief Check if a FW_rev retrieved from card is supported by libxcoder.
139  * Support is checked for API flavor, API version, and SW/FW release version.
140  *
141  * \param[in] fw_rev FW revision queried from card firmware
142  *
143  * \return If FW is fully compatible return 1
144  * If FW not compatible return 0
145  * If FW is partially compatible return 2
146  ******************************************************************************/
147 int ni_logan_is_fw_compatible(uint8_t fw_rev[8]);
148 
149 #ifdef __cplusplus
150 }
151 #endif
ni_logan_retcode_t
#define NI_LOGAN_MAX_DEVICE_NAME_LEN
ni_logan_device_type_t
Main NETINT device API header file provides the ability to communicate with NI T-408 type hardware tr...
ni_codec_t
void ni_logan_rsrc_get_lock_name(ni_logan_device_type_t device_type, int32_t guid, char *p_name, size_t max_name_len)
Returns the device lock name.
ni_logan_retcode_t ni_logan_rsrc_fill_device_info(ni_logan_device_info_t *p_device_info, ni_codec_t fmt, ni_logan_device_type_t type, ni_logan_hw_capability_t *p_hw_cap)
Update codec record info with retrieved device info from HW.
LIB_API uint32_t g_logan_xcoder_stop_process
void ni_logan_rsrc_get_one_device_info(ni_logan_device_info_t *p_device_info)
Retrieve codec record info.
void ni_logan_rsrc_get_shm_name(ni_logan_device_type_t device_type, int32_t guid, char *p_name, size_t max_name_len)
Returns the name of shared memory of the codec record.
void ni_logan_rsrc_update_record(ni_logan_device_context_t *p_device_context, ni_logan_session_context_t *p_session_ctx)
Updates the codec record.
int ni_logan_is_fw_compatible(uint8_t fw_rev[8])
Check if a FW_rev retrieved from card is supported by libxcoder. Support is checked for API flavor,...
int ni_logan_rsrc_enumerate_devices(char ni_logan_devices[][NI_LOGAN_MAX_DEVICE_NAME_LEN], int max_handles)
List NETINT nvme devices.
int ni_logan_rsrc_strcmp(const void *p_str, const void *p_str1)
String comparison function.
hardware capability type