[osal]: match system implementation with compiler marco

It would make the build system more simple, and the cross
toolchains would do the rest to you.

Toolchains like buildroot default not enable the __gnu_linux__
marco in the pre-processor will surfure from the systsm unknown
problem. You should enable the marco in building toolchains
or have a look on those scripts in build directory.

Change-Id: I8f6af3391aa3d94d602ec8d84ba5e43839859169
Signed-off-by: Randy Li <randy.li@rock-chips.com>
This commit is contained in:
Randy Li
2016-10-27 17:07:35 +08:00
committed by Herman Chen
parent 01943db26d
commit 5fa4ff0d48
15 changed files with 29 additions and 8 deletions

View File

@@ -9,4 +9,4 @@ SET(CMAKE_SYSTEM_PROCESSOR "armv8")
add_definitions(-fPIC)
add_definitions(-DARMLINUX)
add_definitions(-D__gnu_linux__)

View File

@@ -9,4 +9,4 @@ SET(CMAKE_SYSTEM_PROCESSOR "armv7-a_hardfp")
add_definitions(-fPIC)
add_definitions(-DARMLINUX)
add_definitions(-D__gnu_linux__)

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__ANDROID__)
#include "allocator_std.h"
#include "allocator_ion.h"
#include "allocator_drm.h"
@@ -47,4 +48,4 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
}
return ret;
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__ANDROID__)
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -74,4 +75,4 @@ RK_S32 os_set_env_str(const char *name, char *value)
return (len) ? (0) : (-1);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__ANDROID__)
#include <android/log.h>
void os_log(const char* tag, const char* msg, va_list list)
@@ -25,4 +26,4 @@ void os_err(const char* tag, const char* msg, va_list list)
{
__android_log_vprint(ANDROID_LOG_ERROR, tag, msg, list);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__ANDROID__)
#include <stdlib.h>
#include "os_mem.h"
@@ -45,4 +46,4 @@ void os_free(void *ptr)
{
free(ptr);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__gnu_linux__)
#include "mpp_log.h"
#include "allocator_std.h"
@@ -57,3 +58,4 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
return ret;
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__gnu_linux__)
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -60,4 +61,4 @@ RK_S32 os_set_env_str(const char *name, char *value)
return setenv(name, value, 1);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__gnu_linux__)
#include <stdio.h>
#include <stdarg.h>
#include "os_log.h"
@@ -34,3 +35,4 @@ void os_err(const char* tag, const char* msg, va_list list)
vfprintf(stderr, line, list);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(__gnu_linux__)
#include <stdlib.h>
#include "os_mem.h"
@@ -34,3 +35,4 @@ void os_free(void *ptr)
free(ptr);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(_WIN32)
#include "os_allocator.h"
#include "allocator_std.h"
@@ -37,3 +38,4 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
return ret;
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(_WIN32)
#include <stdio.h>
#include <stdlib.h>
#include "os_env.h"
@@ -61,4 +62,4 @@ RK_S32 os_set_env_str(const char *name, char *value)
return _putenv(buf);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(_WIN32)
#include <stdio.h>
#include <stdarg.h>
@@ -33,3 +34,4 @@ void os_err(const char* tag, const char* msg, va_list list)
vfprintf(stderr, line, list);
}
#endif

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#if defined(_WIN32)
#include <malloc.h>
#include "os_mem.h"
@@ -34,3 +35,4 @@ void os_free(void *ptr)
_aligned_free(ptr);
}
#endif

View File

@@ -1,3 +1,4 @@
#if defined(_WIN32)
#pragma once
/* a minimal set of C99 types for use with MSVC */
@@ -11,3 +12,5 @@ typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
#endif