4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jonghyuk Choi <jhchoi.choi@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __AVSYS_COMMON_H__
23 #define __AVSYS_COMMON_H__
26 #include <sys/syscall.h>
31 #define EXPORT_API __attribute__((__visibility__("default")))
33 #define AVSYS_MAGIC_START "TSVA"
34 #define AVSYS_MAGIC_END "NEVA"
36 #define AVSYS_KEY_PREFIX_AUDIO 0x10
37 #define AVSYS_KEY_PREFIX_GEN(X,Y) ((X) + (Y))
51 #define LOCK_TIMEOUT_SEC 6
53 /* get thread id : Not implemented 'gettid' at system libs. */
54 #define avsys_gettid() (long int)syscall(__NR_gettid)
57 void * avsys_malloc(size_t size);
58 void avsys_free(void *ptr);
59 #define avsys_mem_check(ptr) ( (memcmp(AVSYS_MAGIC_START, ((char*)(ptr))-8, 4) == 0) && \
60 (memcmp(AVSYS_MAGIC_END, ((char*)(ptr))+(*((int*)((ptr)-4))), 4) == 0) )
63 int avsys_create_shm(const avsys_shm_param_t* param);
64 int avsys_remove_shm(const avsys_shm_param_t* param);
65 void* avsys_get_shm(const avsys_shm_param_t* param);
68 int avsys_create_sync(const avsys_sync_param_t *param);
69 int avsys_remove_sync(const avsys_sync_param_t *param);
70 int avsys_lock_sync(const avsys_sync_param_t *param);
71 int avsys_unlock_sync(const avsys_sync_param_t *param);
74 int avsys_check_root_privilege(void);
80 #endif /* __AVSYS_COMMON_H__ */