2 * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file drm_intf_tapps.h
19 * @brief This file includes declarations of the drm TAPPS intf APIs.
22 #ifndef __DRM_INTF_TAPPS_H__
23 #define __DRM_INTF_TAPPS_H__
29 #include <sys/types.h>
31 #include <sys/syscall.h>
32 #include <linux/unistd.h>
44 #include <semaphore.h>
52 #include "drm-tizen-mid.h"
53 #include <openssl/aes.h>
55 /* Enable this flag during development time */
56 #define _TAPPS_DEBUG_ENABLE_
58 /* IMEI and other VCONF Paths */
60 #define DTAPPS_DUID_SIZE 32
63 #define DTAPPS_IMEI_PATH VCONFKEY_TELEPHONY_IMEI
66 /*************************************************************************************************************/
82 /*************************************************************************************************************/
85 /* drm db schema name */
86 #define DTAPPS_DB_NAME DB_PATH
91 TAPPSDB_TYPE_DATETIME,
96 TAPPSDB_TYPE_UNKNOWN = 0xFFFFFFFF
99 /* Enable this Flag if CEK is to be stored in DB */
100 #define DTAPPS_STORE_CEK_IN_DB
102 /*************************************************************************************************************/
104 /* Logs and Macros */
107 #define MID_EXCEPTION 100
109 #define MCATCH_B _M_catch:
118 M_LOGLINE("Throw error") \
123 #define MCFG_DISPLAY_ERROR_LINE
125 #define DRM_LINUX_SYSDEBUG(dbg_lvl, FMT, ARG...) \
127 if ((dbg_lvl) == MID_EXCEPTION) \
128 DRM_TAPPS_EXCEPTION(FMT, ##ARG); \
129 else if((dbg_lvl) == MID_DRM) \
130 DRM_TAPPS_LOG(FMT, ##ARG); \
132 DRM_TAPPS_FRQ_LOG(FMT, ##ARG); \
135 #ifdef MCFG_DISPLAY_ERROR_LINE
136 #define M_LOGLINE(log_prefix) DRM_LINUX_SYSDEBUG(MID_EXCEPTION, "(%s)[Statement] "#log_prefix"", __func__)
138 #define M_LOGLINE(log_prefix)
139 #endif // MCFG_DISPLAY_ERROR_LINE
144 M_LOGLINE("Try catched("#f")") \
149 /*************************************************************************************************************/
150 /* Mutex structure */
151 typedef pthread_mutex_t dtapps_mutex_t;
153 #define dtappslockarg dtapps_mutex_t*
155 int dtapps_mutex_lock (dtappslockarg dtapps_mutex);
156 int dtapps_mutex_unlock (dtappslockarg dtapps_mutex);
158 /*************************************************************************************************************/
159 /* Memory Operations Wrapper APIs */
161 #define DTAPPS_MEMSET memset
162 #define DTAPPS_MEMCPY memcpy
163 #define DTAPPS_MALLOC malloc
164 #define DTAPPS_MEMCPY memcpy
165 #define DTAPPS_MEMCMP memcmp
166 #define DTAPPS_FREE free
168 /*************************************************************************************************************/
170 /* Time Wrapper APIs */
172 #define DTAPPS_TIME time
173 #define DTAPPS_MKTIME mktime
174 #define DTAPPS_GMTIME gmtime
175 #define DTAPPS_GMTIME_THREAD_SAFE gmtime_r
176 #define DTAPPS_ASCTIME asctime
178 /* String Operations Wrapper APIs */
179 #ifdef _TAPPS_DEBUG_ENABLE_
180 unsigned int TAPPS_gstrlcat(char* s1,const char* s2,unsigned int destsize,const char* funName, unsigned int lineno);
181 unsigned int TAPPS_gstrlcpy(char* s1,const char* s2,unsigned int destsize,const char* funName, unsigned int lineno);
182 unsigned int TAPPS_strlen(const char* s,const char* funName, unsigned int lineno);
184 #define TAPPS_GSTRLCPY(dest,src,LenDest) TAPPS_gstrlcpy(dest,src,LenDest,__func__,__LINE__)
185 #define TAPPS_GSTRLCAT(dest,src,LenDest) TAPPS_gstrlcat(dest,src,LenDest,__func__,__LINE__)
186 #define TAPPS_STRLEN(string) TAPPS_strlen(string,__func__,__LINE__)
188 #define TAPPS_GSTRLCPY(dest,src,LenDest) g_strlcpy(dest, src, LenDest)
189 #define TAPPS_GSTRLCAT(dest,src,LenDest) g_strlcat(dest, src, LenDest)
190 #define TAPPS_STRLEN(string) strlen(string)
193 #define DTAPPS_SNPRINTF snprintf
194 #define DTAPPS_ATOI atoi
195 #define DTAPPS_STRNCMP strncmp
197 int TAPPS_strnicmp(const char * s1, const char * s2, unsigned int sz);
198 /*************************************************************************************************************/
201 void dtapps_sleep(unsigned int TimeInSec,unsigned int TimeInMicroSec);
203 /*************************************************************************************************************/
205 /*************************************************************************************************************/
207 #define DTAPPS_AES_SET_ENCR_KEY AES_set_encrypt_key
208 #define DTAPPS_AES_SET_DECR_KEY AES_set_decrypt_key
209 #define DTAPPS_AES_WRAP_KEY AES_wrap_key
210 #define DTAPPS_AES_UNWRAP_KEY AES_unwrap_key
212 /*************************************************************************************************************/
217 #endif /* __DRM_INTF_TAPPS_H__ */