[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/cp/ps/plat/inc/oss/os_ose.h b/cp/ps/plat/inc/oss/os_ose.h
new file mode 100644
index 0000000..145f1b4
--- /dev/null
+++ b/cp/ps/plat/inc/oss/os_ose.h
@@ -0,0 +1,2 @@
+#include "../oss_api.h"

+

diff --git a/cp/ps/plat/inc/oss/os_win.h b/cp/ps/plat/inc/oss/os_win.h
new file mode 100644
index 0000000..145f1b4
--- /dev/null
+++ b/cp/ps/plat/inc/oss/os_win.h
@@ -0,0 +1,2 @@
+#include "../oss_api.h"

+

diff --git a/cp/ps/plat/inc/oss/osa_api.h b/cp/ps/plat/inc/oss/osa_api.h
new file mode 100644
index 0000000..145f1b4
--- /dev/null
+++ b/cp/ps/plat/inc/oss/osa_api.h
@@ -0,0 +1,2 @@
+#include "../oss_api.h"

+

diff --git a/cp/ps/plat/inc/oss/oss_api.h b/cp/ps/plat/inc/oss/oss_api.h
new file mode 100644
index 0000000..145f1b4
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_api.h
@@ -0,0 +1,2 @@
+#include "../oss_api.h"

+

diff --git a/cp/ps/plat/inc/oss/oss_clib.h b/cp/ps/plat/inc/oss/oss_clib.h
new file mode 100644
index 0000000..9e1c883
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_clib.h
@@ -0,0 +1,279 @@
+/**

+ * @file oss_clib.h

+ * @brief C¿âÍ·Îļþ

+ *

+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.

+ * 

+ */

+#ifndef _OSS_CLIB_H

+#define _OSS_CLIB_H

+

+#define _USE_CLIB

+

+#ifdef _USE_CLIB

+/*******************************************************************************

+ *                           Include header files                              *

+ ******************************************************************************/

+#if defined (_OS_LINUX)

+#include <linux/kernel.h>

+#include <linux/slab.h>

+#include <linux/string.h>

+#else

+#include <stdio.h>

+#include <stdlib.h>

+#include <string.h>

+#include <assert.h>

+#include <time.h>

+#include <math.h>

+#include <ctype.h>

+#endif

+

+#ifdef _OS_WIN

+#include <stddef.h>

+#endif

+#include "oss_pub.h"

+#include "oss_compiler.h"

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/*******************************************************************************

+ *                             Macro definitions                               *

+ ******************************************************************************/

+#ifdef _OS_LINUX

+/*

+ * stdio.h

+ */

+#define printf(fmt, ...)  printk(fmt, ##__VA_ARGS__)

+

+/*

+ * random

+ */

+#define RAND_MAX        (0x7FFFFFFF)

+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))

+# define srand(s)        prandom_seed(s)

+# define rand()          (prandom_u32() & RAND_MAX)

+#else

+# define srand(s)        srandom32(s)

+# define rand()          (random32() & RAND_MAX)

+#endif

+

+/*

+ * stdlib.h

+ */

+#define atol(nptr)      simple_strtol(nptr, (char **)NULL, 10)

+#define atoi(nptr)      simple_strtoul(nptr, (char **)NULL, 10)

+

+#define strtol          simple_strtol

+#define strtoul         simple_strtoul

+

+#define malloc(size)    kmalloc(size, GFP_ATOMIC)

+#define free(ptr)       kfree(ptr)

+

+/*

+ * assert.h

+ */

+#define assert(exp)     zOss_ASSERT(exp)

+

+/*

+ * time

+ */

+#define settimeofday    sys_settimeofday

+

+/*

+ * unistd.h

+ */

+#define exit(nr)        do_exit(nr)

+

+#define zOss_Malloc(size)                           kmalloc(size, GFP_ATOMIC)  

+#define zOss_MallocEx(size)                         kmalloc(size, GFP_KERNEL | __GFP_PAGEMODEM)

+#define zOss_Realloc(mem_ptr, new_size)             krealloc(mem_ptr, new_size, GFP_ATOMIC)

+#define zOss_Free(mem_ptr)                          kfree(mem_ptr) 

+#define zOss_Memcpy(dest_ptr, src_ptr, size)        memcpy(dest_ptr, src_ptr, size)

+#define zOss_Memset(dest_ptr, value, size)          memset(dest_ptr, value, size)

+    

+#define zOss_Memmove(dest_ptr, src_ptr, count)      memmove(dest_ptr, src_ptr, count)

+#define zOss_Memcmp(f_buf_ptr, s_buf_ptr, count)    memcmp(f_buf_ptr, s_buf_ptr, count)

+

+#else

+/**

+ * @brief ¶¯Ì¬ÉêÇëÄڴ溯Êýºê

+ * @param size Èë²Î£¬ÉêÇëÄÚ´æµÄ´óС

+ * @return ³É¹¦·µ»Ø·ÖÅäµÄÄÚ´æÖ¸Õ룬ʧ°Ü·µ»Ø¿ÕÖ¸Õë

+ * @retval void*ÀàÐ͵ÄÖ¸Õë   ³É¹¦

+ * @retval NULL              ʧ°Ü

+ */

+#define zOss_Malloc(size)                           mem_malloc(size, ZOSS_FILE, ZOSS_LINE)    

+

+/**

+ * @brief ¶¯Ì¬ÄÚ´æµ÷Õûº¯Êýºê

+ * @param mem_ptr  Èë²Î£¬Òªµ÷ÕûµÄÄÚ´æÖ¸Õë

+ * @param new_size Èë²Î£¬Òªµ÷ÕûµÄÄÚ´æ´óС

+ * @return ³É¹¦·µ»Øµ÷ÕûºóµÄÄÚ´æÖ¸Õ룬ʧ°Ü·µ»Ø¿ÕÖ¸Õë

+ * @retval void*ÀàÐ͵ÄÖ¸Õë   ³É¹¦

+ * @retval NULL              ʧ°Ü

+ */

+#define zOss_Realloc(mem_ptr, new_size)             mem_re_alloc(mem_ptr, new_size, ZOSS_FILE, ZOSS_LINE)

+

+/**

+ * @brief ÊÍ·ÅÄڴ溯Êýºê

+ * @param mem_ptr Èë²Î£¬ÒªÊͷŵÄÄÚ´æÖ¸Õë

+ * @return void

+ */

+#define zOss_Free(mem_ptr)                          mem_free_extend(mem_ptr, ZOSS_FILE, ZOSS_LINE) 

+

+/**

+ * @brief Äڴ濽±´º¯Êýºê

+ * @param dest_ptr  Èë²Î£¬Ä¿±êÄÚ´æÖ¸Õë

+ * @param src_ptr   Èë²Î£¬Ô´ÄÚ´æÖ¸Õë

+ * @param size      Èë²Î£¬Òª¿½±´µÄ´óС

+ * @return ·µ»Ødest_ptrµÄÖ¸Õë

+ */

+#define zOss_Memcpy(dest_ptr, src_ptr, size)        mem_memcpy(dest_ptr, src_ptr, size, ZOSS_FILE, ZOSS_LINE)

+

+/**

+ * @brief ÄÚ´æ³õʼ»¯º¯Êýºê

+ * @param dest_ptr  Èë²Î£¬Òª³õʼ»¯µÄÄ¿±êÄÚ´æÖ¸Õë

+ * @param value     Èë²Î£¬³õʼ»¯µÄÖµ

+ * @param size      Èë²Î£¬³õʼ»¯µÄÄÚ´æ´óС

+ * @return ·µ»Ø±»³õʼ»¯ÄÚ´æµÄÖ¸Õ루void*£©

+ */

+#define zOss_Memset(dest_ptr, value, size)          mem_memset(dest_ptr, value, size, ZOSS_FILE, ZOSS_LINE)

+    

+/**

+ * @brief ÄÚ´æ°áÒÆ

+ * @param dest_ptr  Èë²Î£¬Òª°áÒÆµÄÄ¿±êÄÚ´æÖ¸Õë

+ * @param src_ptr   Èë²Î£¬°áÒÆµÄÔ´ÄÚ´æÖ¸Õë

+ * @param count     Èë²Î£¬°áÒÆÄÚ´æ´óС

+ * @return ·µ»Ødest_ptrµÄÖ¸Õë

+ */

+#define zOss_Memmove(dest_ptr, src_ptr, count)      mem_memmove(dest_ptr, src_ptr, count)

+

+/**

+ * @brief ÄÚ´æ±È½Ïº¯Êýºê

+ * @param f_buf_ptr  Èë²Î£¬Òª±È½ÏµÄÒ»·½ÄÚ´æÖ¸Õë

+ * @param s_buf_ptr  Èë²Î£¬Òª±È½ÏµÄÁíÒ»·½ÄÚ´æÖ¸Õë

+ * @param count      Èë²Î£¬Òª±È½ÏµÄÄÚ´æ´óС

+ * @return Ïàͬ·µ»Ø0£¬·ñÔò²»Ïàͬ

+ */

+#define zOss_Memcmp(f_buf_ptr, s_buf_ptr, count)    mem_memcmp(f_buf_ptr, s_buf_ptr, count)

+

+#endif

+

+/*******************************************************************************

+ *                             Type definitions                                *

+ ******************************************************************************/

+

+/**

+ * @brief ZOSS_TIME_TµÄÀàÐͶ¨Òå

+ */

+typedef UINT32  ZOSS_TIME_T;

+

+/*******************************************************************************

+ *                       Global variable declarations                          *

+ ******************************************************************************/

+

+

+/*******************************************************************************

+ *                       Global function declarations                          *

+ ******************************************************************************/

+/**

+ * @brief ·µ»Ø´Ó¹«Ôª1970Äê1ÔÂ1ÈÕµÄUTCʱ¼ä´Ó0ʱ0·Ö0ÃëËãÆðµ½ÏÖÔÚËù¾­¹ýµÄÃëÊý

+ * @param t       ³ö²Î£¬±£´æ´Ó¹«Ôª1970Äê1ÔÂ1ÈÕµÄUTCʱ¼ä´Ó0ʱ0·Ö0ÃëËãÆðµ½ÏÖÔÚËù¾­¹ýµÄ

+                    ÃëÊý£¬¸Ã²ÎÊý¿ÉΪNULL

+ * @return ´Ó¹«Ôª1970Äê1ÔÂ1ÈÕµÄUTCʱ¼ä´Ó0ʱ0·Ö0ÃëËãÆðµ½ÏÖÔÚËù¾­¹ýµÄÃëÊý

+ * @note 

+ * @warning 

+ */

+ZOSS_TIME_T zOss_Time(ZOSS_TIME_T *t);

+

+#ifndef DOXYGEN_SHOULD_SKIP_THIS

+

+VOID *zOss_CacheMalloc(UINT32 size);

+

+VOID zOss_CacheFree(VOID *ptr);

+

+/* ÕûÊýת³É×Ö·û */

+char *itoa(int num, char *str, int radix);

+

+/*******************************************************************************

+ *                      Inline function implementations                        *

+ ******************************************************************************/

+#if defined(_MEM_USE_HEAP)

+

+#if defined (_OS_TOS)

+static inline VOID *mem_malloc(UINT32 size, const CHAR *file, UINT32 line)

+{

+    return (VOID *)tos_heap_alloc(size, file, line);

+}

+

+static inline VOID *mem_re_alloc(VOID *mem_ptr, UINT32 new_size, const CHAR *file, UINT32 line)

+{

+    return (VOID *)tos_heap_realloc(mem_ptr, new_size, file, line);

+}

+

+static inline VOID mem_free_extend(VOID *mem_ptr, const CHAR *file, UINT32 line)

+{

+    (VOID)tos_heap_free(mem_ptr, file, line);

+}

+#elif defined (_OS_LINUX)

+static inline VOID *mem_malloc(UINT32 size, const CHAR *file, UINT32 line)

+{

+    return (VOID *)kmalloc(size, GFP_KERNEL);

+}

+

+static inline VOID *mem_re_alloc(VOID *mem_ptr, UINT32 new_size, const CHAR *file, UINT32 line)

+{

+    return (VOID *)krealloc(mem_ptr, new_size, GFP_KERNEL);

+}

+

+static inline VOID mem_free_extend(VOID *mem_ptr, const CHAR *file, UINT32 line)

+{

+    (VOID)kfree(mem_ptr);

+}

+#endif

+

+static inline VOID *mem_memcpy(VOID *dest_ptr, const VOID *src_ptr, UINT32 size, const CHAR *file, UINT32 line)

+{

+    return memcpy(dest_ptr, src_ptr, size);

+}

+

+static inline VOID *mem_memset(VOID *dest_ptr, SINT32 value, UINT32 size, const CHAR *file, UINT32 line)

+{

+    return memset(dest_ptr, value, size);

+}

+

+static inline VOID *mem_memmove(VOID *dest_ptr, const VOID *src_ptr, UINT32 count)

+{

+    return memmove(dest_ptr, src_ptr, count);

+}

+

+static inline SINT32 mem_memcmp(const VOID *f_buf_ptr, const VOID *s_buf_ptr, UINT32 count)

+{

+    return memcmp(f_buf_ptr, s_buf_ptr, count);

+}

+

+#else

+

+VOID *mem_malloc(UINT32 size, const CHAR *file, UINT32 line);

+VOID *mem_re_alloc(VOID *mem_ptr, UINT32 new_size, const CHAR *file, UINT32 line);

+VOID mem_free_extend(VOID *mem_ptr, const CHAR *file, UINT32 line);

+VOID *mem_memcpy(VOID *dest_ptr, const VOID *src_ptr, UINT32 size, const CHAR *file, UINT32 line);

+VOID *mem_memset(VOID *dest_ptr, SINT32 value, UINT32 size, const CHAR *file, UINT32 line);

+VOID *mem_memmove(VOID *dest_ptr, const VOID *src_ptr, UINT32 count);

+SINT32 mem_memcmp(const VOID *f_buf_ptr, const VOID *s_buf_ptr, UINT32 count);

+

+#endif

+

+#endif//#ifndef DOXYGEN_SHOULD_SKIP_THIS

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif //#ifdef _USE_CLIB

+

+#endif //#ifndef _OSS_CLIB_H

+

diff --git a/cp/ps/plat/inc/oss/oss_compiler.h b/cp/ps/plat/inc/oss/oss_compiler.h
new file mode 100755
index 0000000..320dfb1
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_compiler.h
@@ -0,0 +1,167 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_compiler.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : Óë±àÒëÆ÷ºêÏà¹ØµÄºê¶¨Òå

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10 

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_COMPILER_H

+#define _OSS_COMPILER_H

+

+#define _USE_COMPILER

+#ifdef _USE_COMPILER

+

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef _OS_TOS

+# include "tos_link_info.h"

+#endif

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+#ifdef _OS_LINUX

+

+#ifdef _USE_TCM

+# define __tcm_func          __tcmfunc

+# define __tcm_call_func     __attribute__((long_call))

+# define __tcm_local_func    __tcmlocalfunc

+# define __tcm_data          __tcmdata

+# define __tcm_const         __tcmconst

+# define __gprof             __attribute__((section(".gprof"), instrument_functions))

+#else

+# define __tcm_func

+# define __tcm_call_func

+# define __tcm_local_func

+# define __tcm_data

+# define __tcm_const

+# define __gprof

+#endif

+#ifdef CONFIG_MODEM_CODE_IS_MAPPING

+# define __ps_static_func         __attribute__((section(".ps_static_func"), long_call)) noinline

+# define __ps_4g_func             __attribute__((section(".ps_4g_func"), long_call)) noinline

+# define __ps_3g_func             __attribute__((section(".ps_3g_func"), long_call)) noinline

+# define __ps_2g_func             __attribute__((section(".ps_2g_func"), long_call)) noinline

+# define __ps_comm_func             __attribute__((section(".ps_comm_func"), long_call)) noinline

+#else

+# define __ps_static_func         

+# define __ps_4g_func             

+# define __ps_3g_func             

+# define __ps_2g_func             

+# define __ps_comm_func           

+#endif

+#else   // #ifdef _OS_LINUX

+

+#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) && (__GNUC_PATCHLEVEL__ == 2)

+# define barrier()  asm volatile( "" : : : "memory" )

+#else

+# define barrier()

+#endif

+

+#if defined(__GNUC__) && defined (_USE_TCM)

+# define __tcm_func         __attribute__((section(".itcm"), long_call)) noinline

+# define __tcm_call_func    __attribute__((long_call))

+# define __tcm_data         __attribute__((section(".dtcm")))

+# define __gprof            __attribute__((section(".gprof"), instrument_functions))

+#elif defined (__ARMCC_VERSION) && defined (_USE_TCM)

+# define __tcm_func         __attribute__((section(".itcm")))

+# define __tcm_call_func    

+# define __tcm_data         __attribute__((section(".dtcm")))

+# define __gprof 

+#else

+# define __tcm_func

+# define __tcm_call_func

+# define __tcm_data

+# define __gprof

+#endif

+

+#ifdef __GNUC__

+# define inline         __inline__

+# define always_inline  __inline__ __attribute__((always_inline))

+# define noinline       __attribute__((noinline))

+#elif defined (__ARMCC_VERSION)

+# define inline         __inline

+# define always_inline  __forceinline

+# define noinline

+#elif defined (_MSC_VER)

+# define inline         inline

+# define always_inline  inline

+# define noinline

+#else

+# define inline

+# define always_inline

+# define noinline

+#endif

+

+#endif  // #ifdef _OS_LINUX

+

+#ifdef __GNUC__

+//#pragma GCC optimize("-O0")

+//#pragma GCC optimize("-O2")

+# define __optimize(x)  __attribute__((optimize(__str(x))))

+#else

+# define __optimize(x)

+#endif

+

+#ifdef __ARMCC_VERSION

+# define PRAGMA(X)          _Pragma(#X)

+# define RODATA_BEGIN(X)    PRAGMA(arm section rodata=#X)   

+# define RWDATA_BEGIN(X)    PRAGMA(arm section rwdata=#X)   

+# define ZIDATA_BEGIN(X)    PRAGMA(arm section zidata=#X)  

+# define CODE_BEGIN(X)      PRAGMA(arm section code=#X)   

+

+# define RODATA_END         _Pragma("arm section rodata")

+# define RWDATA_END         _Pragma("arm section rwdata")

+# define ZIDATA_END         _Pragma("arm section zidata")

+# define CODE_END           _Pragma("arm section code")

+#else

+# define PRAGMA(X)

+# define RODATA_BEGIN(X)

+# define RWDATA_BEGIN(X)

+# define ZIDATA_BEGIN(X)

+# define CODE_BEGIN(X)

+

+# define RODATA_END

+# define RWDATA_END

+# define ZIDATA_END

+# define CODE_END

+#endif

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _USE_COMPILER    */

+

+#endif  /* _OSS_COMPILER_H  */

+

+

diff --git a/cp/ps/plat/inc/oss/oss_fs.h b/cp/ps/plat/inc/oss/oss_fs.h
new file mode 100644
index 0000000..2ed7e13
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_fs.h
@@ -0,0 +1,147 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_fs.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : Îļþϵͳ

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_FS_H

+#define _OSS_FS_H

+

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+/* ¶ÁдλÖà */

+#define ZOSS_SEEK_SET               0x0           /* set to offset                            */

+#define ZOSS_SEEK_CUR               0x1           /* set to current position plus offset      */

+#define ZOSS_SEEK_END               0x2           /* set to the size of the file plus offset  */

+

+/* ÅäÖòÎÊý */

+#define ZOSS_MAX_FILENAME_LEN       255         /* Îļþ¡¢Ä¿Â¼Ãû×î´ó³¤¶È, °üº¬Â·¾¶   */

+

+/* Îļþ¡¢Ä¿Â¼ÊôÐÔ£¬°Ë½øÖƱíʾ */

+#define ZOSS_ATTR_IFDIR             040000      /* Ŀ¼λ                       */

+    

+#define ZOSS_ATTR_RD_USR            0400        /* user¶Á                       */

+#define ZOSS_ATTR_WR_USR            0200        /* userд                       */

+#define ZOSS_ATTR_EX_USR            0100        /* userÖ´ÐÐ                     */

+    

+#define ZOSS_ATTR_RD_GRP            0040        /* group¶Á                      */

+#define ZOSS_ATTR_WR_GRP            0020        /* groupд                      */

+#define ZOSS_ATTR_EX_GRP            0010        /* groupÖ´ÐÐ                    */

+    

+#define ZOSS_ATTR_RD_OTH            0004        /* other¶Á                      */

+#define ZOSS_ATTR_WR_OTH            0002        /* otherд                      */

+#define ZOSS_ATTR_EX_OTH            0001        /* otherÖ´ÐÐ                    */

+    

+#define ZOSS_ATTR_RWX_USR           0700        /* userµÄ¶ÁдִÐÐ               */

+#define ZOSS_ATTR_RWX_GRP           0070        /* groupµÄ¶ÁдִÐÐ              */

+#define ZOSS_ATTR_RWX_OTH           0007        /* otherµÄ¶ÁдִÐÐ              */

+    

+#define ZOSS_ATTR_RD_ALL            0444        /* user,group,otherµÄ¶Á         */

+#define ZOSS_ATTR_WR_ALL            0222        /* user,group,otherµÄд         */

+#define ZOSS_ATTR_EX_ALL            0111        /* user£¬group,otherµÄÖ´ÐÐ      */

+    

+#define ZOSS_ATTR_RWX_ALL           0777        /* user£¬group,otherµÄ¶ÁдִÐÐ  */

+

+#ifdef _OS_LINUX

+# define FILE   int

+#endif

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+typedef struct  

+{

+#if defined(_OS_TOS) && defined(CYGPKG_FILEIO_DIRENT_DTYPE)

+    mode_t  d_type;

+#endif

+

+    CHAR    d_name[ZOSS_MAX_FILENAME_LEN + 1];

+}ZOSS_S_DIRENT;

+

+typedef struct  

+{

+    UINT32  st_dev;     /* Device ID number             */

+    UINT32  st_ino;     /* File serial number           */

+    mode_t  st_mode;    /* Mode of file                 */

+    UINT16  st_nlink;   /* Number of hard links to file */

+    UINT32  st_uid;     /* User ID of file              */

+    UINT32  st_gid;     /* Group ID of file             */

+    UINT32  st_rdev;    /* Device ID if special file    */

+    UINT32  st_size;    /* File size in bytes           */

+    time_t  st_atime;   /* Time of last access          */

+    time_t  st_mtime;   /* Time of last modification    */

+    time_t  st_ctime;   /* Time of last status change   */

+}ZOSS_S_STAT;

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+UINT32  zOss_FCreate(const CHAR *filename);

+FILE   *zOss_FOpen(const CHAR *filename, const CHAR *mode);

+UINT32  zOss_FSeek(FILE *stream, SINT32 offset, SINT32 whence);

+SSIZE_T zOss_FRead(VOID *data, SSIZE_T size, SSIZE_T count, FILE *stream);

+SSIZE_T zOss_FWrite(const VOID *data, SSIZE_T size, SSIZE_T count, FILE *stream);

+UINT32  zOss_FEof(FILE *stream);

+UINT32  zOss_FError(FILE *stream);

+UINT32  zOss_FTruncate(FILE *stream, UINT32 size);

+UINT32  zOss_FFlush(FILE *stream);

+UINT32  zOss_FTell(FILE *stream);

+UINT32  zOss_FClose(FILE *stream);

+UINT32  zOss_FRename(const CHAR *old_filename, const CHAR *new_filename);

+UINT32  zOss_FDelete(const CHAR *filename);

+UINT32  zOss_FLength(FILE *stream);

+BOOL    zOss_FExist(const CHAR *filename);

+UINT32  zOss_Mkdir(const CHAR *dirname);

+UINT32  zOss_Rmdir(const CHAR *dirname);

+UINT32  zOss_Rndir(const CHAR *old_dirname, const CHAR *new_dirname);

+UINT32  zOss_GetPwd(CHAR *dirname, UINT32 dirnamelen);

+UINT32  zOss_ChDir(CHAR *dirname);

+BOOL    zOss_IsDir(const CHAR *dirname);

+UINT32  zOss_OpenDir(const CHAR *dirname, VOID **dir_entry_ptr);

+UINT32  zOss_CloseDir(VOID **dir_entry_ptr);

+UINT32  zOss_ReadDir(VOID **dir_entry_ptr, ZOSS_S_DIRENT *dir_item_ptr);

+VOID    zOss_Rewinddir(VOID *dir_entry_ptr);

+UINT32  zOss_ChMod(const CHAR *pathname, mode_t attrs);

+UINT32  zOss_Stat(const CHAR *pathname, ZOSS_S_STAT *buf);

+UINT32  zOss_MountDisk(CHAR diskname);

+UINT32  zOss_UnMountDisk(CHAR diskname);

+UINT32  zOss_UnMountAllDisk(VOID);

+UINT32  zOss_GetDiskFreeSpace(CHAR diskname, UINT64 *space);

+UINT32  zOss_GetDiskCapacity(CHAR diskname, UINT64 *space);

+UINT32  zOss_GetAllDynamicDisk(CHAR *disk, UINT32 size);

+UINT32  zOss_SyncFS(VOID);

+UINT32  zOss_MountDynamicDisk(CHAR *pWinDir, CHAR *pLinuxDir, CHAR *pDevName, char *pFsName);

+UINT32  zOss_UnMountDynamicDisk(CHAR *pWinDir);

+UINT32  zOss_FsMount(VOID);

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _OSS_FS_H    */

+

diff --git a/cp/ps/plat/inc/oss/oss_irq.h b/cp/ps/plat/inc/oss/oss_irq.h
new file mode 100644
index 0000000..5314d39
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_irq.h
@@ -0,0 +1,292 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_irq.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : ÖжÏÇëÇóÄ£¿é

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_IRQ_H

+#define _OSS_IRQ_H

+

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef _OS_LINUX

+#include <linux/irqflags.h>

+#endif

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+#ifdef _OS_TOS

+extern long tos_irq_level;

+extern long tos_isr_level;

+extern long tos_dsr_level;

+#endif

+

+#if defined _OS_TOS    

+#define TOS_STATISTIC_IRQ

+    

+#define TOS_TRACE_IRQ

+    

+#define TOS_DISABLE_IRQ()                               \

+        {                                               \

+            CYG_INTERRUPT_STATE old_intr;               \

+                                                        \

+            HAL_DISABLE_INTERRUPTS(old_intr);

+    

+#define TOS_ENABLE_IRQ()                                \

+            HAL_RESTORE_INTERRUPTS(old_intr);           \

+        }

+    

+/* TOS 3.0²Ù×÷ϵͳµÄȥʹÄÜ¡¢Ê¹ÄÜ¡¢±£´æ¡¢»Ö¸´ÖжϷ½°¸ */

+#define TOS_DISABLE_IRQ_FAST()      HAL_DISABLE_INTERRUPTS(old_intr)

+#define TOS_ENABLE_IRQ_FAST()       HAL_RESTORE_INTERRUPTS(old_intr)

+#define TOS_SAVE_IRQ(old_intr)      HAL_DISABLE_INTERRUPTS(old_intr)

+#define TOS_RESTORE_IRQ(old_intr)   HAL_RESTORE_INTERRUPTS(old_intr)

+#define TOS_QUERY_IRQ(old_intr)     HAL_QUERY_INTERRUPTS(old_intr)

+    

+/* Ö§³ÅµÄȥʹÄÜ¡¢Ê¹ÄÜ¡¢±£´æ¡¢»Ö¸´ÖжϷ½°¸£¬ÐèÒªÕë¶Ô²»Í¬µÄ²Ù×÷ϵͳƽ̨½øÐÐÒÆÖ² */

+#define ZOSS_INTR                   CYG_INTERRUPT_STATE

+#define ZOSS_DISABLE_IRQ()          TOS_DISABLE_IRQ()

+#define ZOSS_ENABLE_IRQ()           TOS_ENABLE_IRQ()

+#define ZOSS_DISABLE_IRQ_FAST()     TOS_DISABLE_IRQ_FAST()

+#define ZOSS_ENABLE_IRQ_FAST()      TOS_ENABLE_IRQ_FAST()

+#define ZOSS_SAVE_IRQ(old_intr)     TOS_SAVE_IRQ(old_intr)

+#define ZOSS_RESTORE_IRQ(old_intr)  TOS_RESTORE_IRQ(old_intr)

+#define ZOSS_QUERY_IRQ(old_intr)    TOS_QUERY_IRQ(old_intr)

+    

+/* ÊÊÅäÔ­ÓдúÂëÖеÄȥʹÄÜ¡¢Ê¹ÄÜ¡¢±£´æ¡¢»Ö¸´ÖжϷ½°¸ */

+#define LOCK_SAVE(old_intr)         ZOSS_SAVE_IRQ(old_intr)

+#define LOCK_RESTORE(old_intr)      ZOSS_RESTORE_IRQ(old_intr)

+#elif defined _OS_OSE

+#define ZOSS_INTR   unsigned long

+    

+#define ZOSS_DISABLE_IRQ()              \

+        {                               \

+            unsigned long msr;          \

+            LOCK_SAVE(msr);

+     

+#define ZOSS_ENABLE_IRQ()               \

+            LOCK_RESTORE(msr);          \

+        }      

+    

+#define ZOSS_DISABLE_IRQ_FAST()     LOCK_SAVE(old_intr)

+#define ZOSS_ENABLE_IRQ_FAST()      LOCK_RESTORE(old_intr)

+    

+#define ZOSS_SAVE_IRQ(old_intr)     LOCK_SAVE(old_intr)

+#define ZOSS_RESTORE_IRQ(old_intr)  LOCK_RESTORE(old_intr)

+#elif defined _OS_LINUX

+#define LINUX_STATISTIC_IRQ

+#define LINUX_TRACE_IRQ

+#define LINUX_DISABLE_IRQ()                             \

+        {                                               \

+            unsigned long flags;                        \

+                                                        \

+            local_irq_save(flags);

+    

+#define LINUX_ENABLE_IRQ()                              \

+            local_irq_restore(flags);                   \

+        }

+

+/* LINUX ²Ù×÷ϵͳµÄȥʹÄÜ¡¢Ê¹ÄÜ¡¢±£´æ¡¢»Ö¸´ÖжϷ½°¸ */

+#define LINUX_DISABLE_IRQ_FAST()    local_irq_save(old_intr)

+#define LINUX_ENABLE_IRQ_FAST()     local_irq_restore(old_intr)

+#define LINUX_SAVE_IRQ(old_intr)    local_irq_save(old_intr)

+#define LINUX_RESTORE_IRQ(old_intr) local_irq_restore(old_intr)

+#define LINUX_QUERY_IRQ(old_intr)   local_save_flags(old_intr)

+

+/* Ö§³ÅµÄȥʹÄÜ¡¢Ê¹ÄÜ¡¢±£´æ¡¢»Ö¸´ÖжϷ½°¸£¬ÐèÒªÕë¶Ô²»Í¬µÄ²Ù×÷ϵͳƽ̨½øÐÐÒÆÖ² */

+#define ZOSS_INTR                   unsigned long

+#define ZOSS_DISABLE_IRQ()          LINUX_DISABLE_IRQ()

+#define ZOSS_ENABLE_IRQ()           LINUX_ENABLE_IRQ()

+#define ZOSS_DISABLE_IRQ_FAST()     LINUX_DISABLE_IRQ_FAST()

+#define ZOSS_ENABLE_IRQ_FAST()      LINUX_ENABLE_IRQ_FAST()

+#define ZOSS_SAVE_IRQ(old_intr)     LINUX_SAVE_IRQ(old_intr)

+#define ZOSS_RESTORE_IRQ(old_intr)  LINUX_RESTORE_IRQ(old_intr)

+#define ZOSS_QUERY_IRQ(old_intr)    LINUX_QUERY_IRQ(old_intr)

+    

+/* ÊÊÅäÔ­ÓдúÂëÖеÄȥʹÄÜ¡¢Ê¹ÄÜ¡¢±£´æ¡¢»Ö¸´ÖжϷ½°¸ */

+#define LOCK_SAVE(old_intr)         ZOSS_SAVE_IRQ(old_intr)

+#define LOCK_RESTORE(old_intr)      ZOSS_RESTORE_IRQ(old_intr)

+#endif

+

+#define zDrv_DisableIrq()           ZOSS_DISABLE_IRQ()

+#define zDrv_EnableIrq()            ZOSS_ENABLE_IRQ()

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+#ifdef _OS_TOS

+typedef UINT32 tos_isr_t(UINT32 vector, UINT32 data);

+typedef VOID tos_dsr_t(UINT32 vector, UINT32 count, UINT32 data);

+#elif defined _OS_LINUX

+typedef UINT32 linux_isr_t(UINT32 vector, UINT32 data);

+typedef VOID linux_dsr_t(UINT32 vector, UINT32 count, UINT32 data);

+#endif

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+#ifdef _OS_TOS

+UINT32 tos_default_isr( UINT32 vector, UINT32 data);

+#ifdef _USE_OSS_MIN

+UINT32 tos_create_irq(UINT32 vector, UINT32 priority, UINT32 data, tos_isr_t isr, tos_dsr_t dsr, cyg_interrupt *interrupt); 

+#else

+UINT32 tos_create_irq(UINT32 vector, UINT32 priority, UINT32 data, tos_isr_t isr, tos_dsr_t dsr); 

+#endif

+void tos_delete_irq(UINT32 interrupt_handle);

+    

+#ifdef TOS_STATISTIC_IRQ

+void tos_statistic_irq_open(void);

+void tos_statistic_irq_close(void);

+void tos_statistic_irq_assert(void);

+void tos_statistic_irq_thread_start(void);

+void tos_statistic_irq_thread_end(void);

+#endif

+    

+#ifdef TOS_TRACE_IRQ

+void tos_trace_irq_open(void);

+void tos_trace_irq_close(void);

+void tos_trace_irq_assert(void);

+#endif

+    

+static inline SINT32 tos_get_irq_nesting_level(VOID)

+{

+    return tos_irq_level;

+}

+

+static inline SINT32 tos_get_isr_nesting_level(VOID)

+{

+    return tos_isr_level;

+}

+

+static inline SINT32 tos_get_dsr_nesting_level(VOID)

+{

+    return tos_dsr_level;

+}

+

+#ifdef _USE_OSS_MIN

+static inline UINT32 tos_create_isr(UINT32 vector,           /* ÖжÏÏòÁ¿         */

+                                     UINT32 priority,           /* ÖжÏÓÅÏȼ¶       */

+                                     UINT32 data,               /* Êý¾ÝÖ¸Õë         */

+                                     tos_isr_t isr,             /* ÖжϷþÎñÀý³Ì     */

+                                     cyg_interrupt *interrupt)  /* ÖжϽṹÌåÖ¸Õë   */

+{

+    return tos_create_irq(vector,       /* ÖжÏÏòÁ¿         */

+                           priority,    /* ÖжÏÓÅÏȼ¶       */

+                           data,        /* Êý¾ÝÖ¸Õë         */

+                           isr,         /* ÖжϷþÎñÀý³Ì     */

+                           NULL,        /* ÖжÏÑÓ³Ù·þÎñÀý³Ì */

+                           interrupt);  /* ÖжϽṹÌåÖ¸Õë   */

+}

+

+static inline UINT32 tos_create_dsr(UINT32 vector,          /* ÖжÏÏòÁ¿         */

+                                     UINT32 priority,           /* ÖжÏÓÅÏȼ¶       */

+                                     UINT32 data,               /* Êý¾ÝÖ¸Õë         */

+                                     tos_dsr_t dsr,             /* ÖжϷþÎñÀý³Ì     */

+                                     cyg_interrupt *interrupt)  /* ÖжϽṹÌåÖ¸Õë   */

+{

+    return tos_create_irq(vector,           /* ÖжÏÏòÁ¿         */

+                           priority,        /* ÖжÏÓÅÏȼ¶       */

+                           data,            /* Êý¾ÝÖ¸Õë         */

+                           tos_default_isr, /* ÖжϷþÎñÀý³Ì     */

+                           dsr,             /* ÖжÏÑÓ³Ù·þÎñÀý³Ì */

+                           interrupt);      /* ÖжϽṹÌåÖ¸Õë   */

+}

+#else

+static inline UINT32 tos_create_isr(UINT32 vector,      /* ÖжÏÏòÁ¿     */

+                                    UINT32 priority,    /* ÖжÏÓÅÏȼ¶   */

+                                    UINT32 data,        /* Êý¾ÝÖ¸Õë     */

+                                    tos_isr_t isr)      /* ÖжϷþÎñÀý³Ì */

+{

+    return tos_create_irq(vector, 

+                          priority, 

+                          data, 

+                          isr, 

+                          NULL);                        /* ÖжϷþÎñÀý³Ì */

+}

+

+static inline UINT32 tos_create_dsr(UINT32 vector,      /* ÖжÏÏòÁ¿     */

+                                    UINT32 priority,    /* ÖжÏÓÅÏȼ¶   */

+                                    UINT32 data,        /* Êý¾ÝÖ¸Õë     */

+                                    tos_dsr_t dsr)      /* ÖжϷþÎñÀý³Ì */

+{

+    return tos_create_irq(vector, 

+                          priority, 

+                          data, 

+                          tos_default_isr,              /* ÖжϷþÎñÀý³Ì */

+                          dsr);  

+}

+#endif

+

+static inline VOID tos_delete_isr(UINT32 interrupt_handle)

+{

+    tos_delete_irq(interrupt_handle);

+}

+

+static inline VOID tos_delete_dsr(UINT32 interrupt_handle)

+{

+    tos_delete_irq(interrupt_handle);

+}

+#elif defined _OS_LINUX

+UINT32 linux_default_isr( UINT32 vector, UINT32 data);

+

+UINT32 linux_create_irq(UINT32 vector, UINT32 priority, UINT32 data, linux_isr_t isr, linux_dsr_t dsr); 

+

+void linux_delete_irq(UINT32 interrupt_handle);

+

+static inline UINT32 linux_create_isr(UINT32 vector,      /* ÖжÏÏòÁ¿     */

+                                    UINT32 priority,    /* ÖжÏÓÅÏȼ¶   */

+                                    UINT32 data,        /* Êý¾ÝÖ¸Õë     */

+                                    linux_isr_t isr)      /* ÖжϷþÎñÀý³Ì */

+{

+    return 0x00;

+}

+

+static inline UINT32 linux_create_dsr(UINT32 vector,      /* ÖжÏÏòÁ¿     */

+                                    UINT32 priority,    /* ÖжÏÓÅÏȼ¶   */

+                                    UINT32 data,        /* Êý¾ÝÖ¸Õë     */

+                                    linux_dsr_t dsr)      /* ÖжϷþÎñÀý³Ì */

+{

+    return 0x00;

+}

+

+static inline VOID linux_delete_isr(UINT32 interrupt_handle)

+{

+    linux_delete_irq(interrupt_handle);

+}

+

+static inline VOID linux_delete_dsr(UINT32 interrupt_handle)

+{

+    linux_delete_irq(interrupt_handle);

+}

+#endif

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _OSS_IRQ_H */

+

+

diff --git a/cp/ps/plat/inc/oss/oss_kernel.h b/cp/ps/plat/inc/oss/oss_kernel.h
new file mode 100644
index 0000000..6c05ab7
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_kernel.h
@@ -0,0 +1,634 @@
+/**

+ * @file oss_kernel.h

+ * @brief ²Ù×÷ϵͳÊÊÅä²ã½Ó¿ÚÍ·Îļþ

+ *

+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.

+ * 

+ * 

+ */

+

+#ifndef _OSS_KERNEL_H

+#define _OSS_KERNEL_H

+

+/*******************************************************************************

+ *                           Include header files                              *

+ ******************************************************************************/

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/*******************************************************************************

+ *                             Macro definitions                               *

+ ******************************************************************************/

+/* ¶ÏÑÔ */

+/**

+ * @brief assert¶ÏÑÔ

+ * @param _EXP Èë²Î£¬Òì³£±í´ïʽ

+ */

+#ifdef _DEBUG

+# if defined _OS_WIN

+#  define zOss_ASSERT(_EXP) do {if(!(_EXP)) EXP_Handler(#_EXP, __FILE__, NULL, __LINE__);} while(0)

+# else

+#  define zOss_ASSERT(_EXP) do {if(!(_EXP)) EXP_Handler(#_EXP, NULL, NULL, __LINE__);} while(0)

+# endif

+#else

+# define zOss_ASSERT(_EXP)

+#endif

+    

+/**

+ * @brief ´ø·µ»ØÖµµÄassert¶ÏÑÔ

+ * @param _EXP Èë²Î£¬Òì³£±í´ïʽ

+ * @param _RET Èë²Î£¬·µ»ØÖµ

+ */

+#define zOss_AssertEx(_EXP, _RET) do {if(!(_EXP)) {zOss_ASSERT((_EXP)); return (_RET);}} while(0)

+

+/**

+ * @brief ´ø·µ»ØÖµºÍ¸½¼ÓÖ´ÐвÙ×÷µÄassert¶ÏÑÔ

+ * @param _EXP Èë²Î£¬Òì³£±í´ïʽ

+ * @param _ACT Èë²Î£¬¸½¼ÓÖ´ÐвÙ×÷

+ * @param _RET Èë²Î£¬·µ»ØÖµ

+ */

+#define zOss_AssertExA(_EXP, _ACT, _RET) do {if(!(_EXP)) {zOss_ASSERT((_EXP)); _ACT; return (_RET);}} while(0)

+

+/**

+ * @brief ²»´ø·µ»ØÖµµÄassert¶ÏÑÔ

+ * @param _EXP Èë²Î£¬Òì³£±í´ïʽ

+ */

+#define zOss_AssertExN(_EXP) do {if(!(_EXP)) {zOss_ASSERT((_EXP)); return;}} while(0)

+

+/* ³£Ó÷µ»ØÖµ */

+/**

+ * @brief ZOSS_SUCCESSºê¶¨Òå

+ */

+#define ZOSS_SUCCESS            0x0

+

+/**

+ * @brief ZOSS_ERRORºê¶¨Òå

+ */

+#define ZOSS_ERROR              0xffffffff

+

+/**

+ * @brief ZOSS_NULLºê¶¨Òå

+ */

+#define ZOSS_NULL               NULL        

+

+/**

+ * @brief ÎÞЧÏß³ÌIDºê¶¨Òå

+ */

+#define ZOSS_INVALID_THREAD_ID  NULL

+

+/**

+ * @brief ÎÞЧÈÎÎñIDºê¶¨Òå

+ */

+#define ZOSS_INVALID_TASK_ID    NULL    

+

+/**

+ * @brief ÎÞЧ¶¨Ê±Æ÷IDºê¶¨Òå

+ */

+#define ZOSS_INVALID_TIMER_ID   NULL

+

+/**

+ * @brief Ïß³ÌÃû×î´ó³¤¶È

+ */ 

+#define MAX_THREADNAME_LEN      63

+

+/**

+ * @brief ¼ÆÊýÐźÅÁ¿Ãû³Æ×î´ó³¤¶È

+ */

+#define MAX_SEMNAME_LEN         63

+

+/**

+ * @brief »¥³âÐźÅÁ¿Ãû³Æ×î´ó³¤¶È

+ */

+#define MAX_MUTEXNAME_LEN       63

+

+

+/**

+ * @brief µÈ´ý³¬Ê±ÊôÐÔ£¬²»µÈ´ý

+ */

+#define ZOSS_NO_WAIT            0x0          

+

+/**

+ * @brief µÈ´ý³¬Ê±ÊôÐÔ£¬Ò»Ö±µÈ´ýÏÂÈ¥

+ */

+#define ZOSS_WAIT_FOREVER       0xffffffff

+    

+

+/**

+ * @brief »¥³âÌåÊôÐÔ£¬°´ÓÅÏȼ¶»ñÈ¡

+ */

+#define ZOSS_INHERIT            0x1

+

+/**

+ * @brief »¥³âÌåÊôÐÔ£¬°´Ë³Ðò»ñÈ¡

+ */

+#define ZOSS_NO_INHERIT         0x0

+

+#ifdef _OS_LINUX

+# define ZOSS_PREEMPT_IRQ_THREAD    (0xffffffff)

+#endif

+

+/*******************************************************************************

+ *                             Type definitions                                *

+ ******************************************************************************/

+/**

+ * @brief ÐźÅÁ¿IDÊý¾ÝÀàÐͶ¨Òå

+ */

+typedef VOID    *ZOSS_SEMAPHORE_ID;

+

+/**

+ * @brief »¥³âÌåIDÊý¾ÝÀàÐͶ¨Òå

+ */

+typedef VOID    *ZOSS_MUTEX_ID;

+

+/**

+ * @brief ¶¨Ê±Æ÷IDÊý¾ÝÀàÐͶ¨Òå

+ */

+typedef VOID    *ZOSS_TIMER_ID;

+

+/**

+ * @brief Ïß³ÌIDÊý¾ÝÀàÐͶ¨Òå

+ */

+typedef VOID    *ZOSS_THREAD_ID;

+

+/**

+ * @brief ÈÎÎñIDÊý¾ÝÀàÐͶ¨Òå

+ */

+typedef VOID    *ZOSS_TASK_ID;

+

+/**

+ * @brief ¶ÓÁÐIDÊý¾ÝÀàÐͶ¨Òå

+ */

+typedef VOID    *ZOSS_QUEUE_ID;

+

+/**

+ * @brief ʼþIDÊý¾ÝÀàÐͶ¨Òå

+ */

+typedef VOID    *ZOSS_EVENT_ID;

+

+/**

+ * @brief Ï̺߳¯ÊýÀàÐͶ¨Òå

+ */

+typedef VOID    (*ZOSS_THREAD_FUN)(SINT32);

+

+/**

+ * @brief ¶¨Ê±Æ÷»Øµ÷º¯ÊýÀàÐͶ¨Òå

+ */

+typedef VOID    (*ZOSS_TIMER_FUN)(SINT32);

+

+/**

+ * @brief Ï̹߳³×Óº¯ÊýÀàÐͶ¨Òå

+ */

+typedef UINT32  (*THREAD_MSG_HOOK)(UINT32 msg_id, VOID *p_buf, UINT32 buf_size, UINT8 dire);

+

+#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/* Ï̹߳ÜÀí */

+/**

+ * @brief Ï̹߳ÜÀí½á¹¹

+ * @param threadid         Ïß³Ìid

+ * @param threadname       Ïß³ÌÃû³Æ

+ * @param runstatus        Ïß³ÌÔËÐÐ״̬

+ * @param priority         Ïß³ÌÓÅÏȼ¶

+ * @param maxstack         Ïß³ÌÕ»×î´óջʹÓÃÂÊ

+ * @param cpupercent       Ïß³ÌCPUÕ¼ÓÃÂÊ

+ * @param stacksize        Ï̶߳ÑÕ»´óС 

+ * @param cputime          Ïß³ÌCPUÕ¼ÓÃÂÊʱ¼ä 

+ * @param topstack         Ïß³ÌÕ»¶¥µØÖ· 

+ * @param runtime          Ïß³ÌÔËÐÐʱ¼ä 

+ * @param RunTimeInMs      

+ * @param msgnum           Ïß³ÌÏûÏ¢¶ÓÁÐÏûÏ¢Êý 

+ * @param runcount         Ïß³ÌÔËÐдÎÊý 

+ * @param curpath          Ï̵߳±Ç°Â·¾¶£¬ÓëosÓÐ¹Ø 

+ * @param ptrf             µ÷ÊÔÏ̵߳ǼDZí 

+ * @param curtaskid        µ±Ç°ÈÎÎñID 

+ * @param heapsize         Ïß³ÌÉêÇë¶ÑÄÚ´æ´óС 

+ * @param ubsize           Ïß³ÌÉêÇëÄÚ´æ³Ø´óС 

+ * @param psmCpuTime       Ïß³Ìpsm¼ÆÊ±Ê±¼ä 

+ * @param sleepTimerId     Ïß³Ì˯Ãßʱ´´½¨µÄ¶¨Ê±Æ÷ID 

+ * @param sleepsem         Ïß³Ì˯Ãßʱ´´½¨µÄÐźÅÁ¿ID 

+ */

+typedef struct

+{

+    ZOSS_THREAD_ID    threadid;                           /* Ïß³ÌID                   */

+    CHAR              threadname[MAX_THREADNAME_LEN + 1]; /* Ïß³ÌÃû                   */

+    UINT8             runstatus;                          /* Ïß³ÌÔËÐÐ״̬             */

+    UINT8             priority;                           /* Ïß³ÌÓÅÏȼ¶               */

+    UINT8             maxstack;                           /* Ïß³ÌÕ»×î´óջʹÓÃÂÊ       */

+    FLOAT             cpupercent;                         /* Ïß³ÌCPUÕ¼ÓÃÂÊ            */ 

+    UINT32            stacksize;                          /* Ï̶߳ÑÕ»´óС             */

+    UINT32            cputime;                            /* Ïß³ÌCPUÕ¼ÓÃÂÊʱ¼ä        */

+    UINT32            topstack;                           /* Ïß³ÌÕ»¶¥µØÖ·             */

+    UINT32            runtime;                            /* Ïß³ÌÔËÐÐʱ¼ä             */

+    UINT32            RunTimeInMs;

+    UINT32            msgnum;                             /* Ïß³ÌÏûÏ¢¶ÓÁÐÏûÏ¢Êý       */

+    UINT32            runcount;                           /* Ïß³ÌÔËÐдÎÊý             */

+    CHAR              *curpath;                           /* Ï̵߳±Ç°Â·¾¶£¬ÓëosÓÐ¹Ø   */

+    VOID              *ptrf;                              /* µ÷ÊÔÏß³ÌµÇ¼Ç±í           */

+    VOID              *curtaskid;                         /* µ±Ç°ÈÎÎñID               */ 

+    UINT32            heapsize;                           /* Ïß³ÌÉêÇë¶ÑÄÚ´æ´óС       */

+    UINT32            ubsize;                             /* Ïß³ÌÉêÇëÄÚ´æ³Ø´óС       */

+    UINT32            psmCpuTime;                         /* Ïß³Ìpsm¼ÆÊ±Ê±¼ä          */

+    ZOSS_TIMER_ID     sleepTimerId;                       /* Ïß³Ì˯Ãßʱ´´½¨µÄ¶¨Ê±Æ÷ID */

+    ZOSS_SEMAPHORE_ID sleepsem;                           /* Ïß³Ì˯Ãßʱ´´½¨µÄÐźÅÁ¿ID */    

+}T_ZOsa_ThreadUserArea;                                   /* Ïß³ÌÓû§¿Õ¼ä             */

+#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/*******************************************************************************

+ *                       Global variable declarations                          *

+ ******************************************************************************/

+

+/*******************************************************************************

+ *                       Global function declarations                          *

+ ******************************************************************************/

+/* Ï̹߳ÜÀí */

+ 

+ /**

+ * @brief »ñÈ¡ÓÅÏȼ¶Öµ½Ó¿Ú

+ * @param offset Èë²Î£¬È¡Öµ0~31

+ * @return Èô³É¹¦£¬·µ»ØÓÅÏȼ¶ÊýÖµ£»·ñÔò·µ»ØZOSS_ERROR

+ * @retval ÓÅÏȼ¶ÊýÖµ   ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note

+ * @warning 

+ */

+UINT32 zOss_GetPrioCfg(UINT8 offset);

+

+/**

+ * @brief ´´½¨Ï߳̽ӿÚ

+ * @param thread_name     Èë²Î£¬Ïß³ÌÃû³Æ

+ * @param entry           Èë²Î£¬Ïß³ÌÈë¿ÚʵÌ庯Êý

+ * @param arg             Èë²Î£¬Ïß³ÌʵÌ庯ÊýµÄ²ÎÊý

+ * @param stack_size      Èë²Î£¬Ïß³ÌÓµÓеĶÑÕ»´óС

+ * @param priority        Èë²Î£¬Ï̵߳ÄÓÅÏȵȼ¶0~31

+ * @param preempt         Èë²Î£¬Í¬ÓÅÏȼ¶Ïß³ÌÊÇ·ñÔÊÐíÇÀÕ¼£¬·Ç0ֵΪÇÀÕ¼Ị̈߳¬·ñÔòΪ²»¿ÉÇÀÕ¼Ị̈߳¬¼´Ö´ÐÐʱ¼äƬµ÷¶È

+ * @param auto_start      Èë²Î£¬´´½¨Ï̺߳óÊÇ·ñ×Ô¶¯Ö´ÐÐ

+ * @return Èç¹û´´½¨³É¹¦·µ»ØÏß³ÌID£¬Ê§°Ü·µ»ØZOSS_INVALID_THREAD_ID

+ * @retval ZOSS_THREAD_IDÀàÐ͵ÄÏß³Ìid    ³É¹¦

+ * @retval ZOSS_INVALID_THREAD_ID        ʧ°Ü

+ * @note   

+ * @warning 

+ */

+ZOSS_THREAD_ID zOss_CreateThread(const CHAR *thread_name, VOID (*entry)(SINT32), SINT32 arg, UINT32 stack_size, UINT32 priority, UINT32 preempt, UINT32 auto_start);

+

+/**

+ * @brief Í˳öµ±Ç°Ï߳̽ӿÚ

+ * @param void

+ * @return void

+ * @note   

+ * @warning 

+ */

+VOID zOss_ExitThread(VOID);

+

+/**

+ * @brief Ïß³Ì¹ÒÆð½Ó¿Ú

+ * @param thread_id     Èë²Î£¬ÐèÒª¹ÒÆðµÄÏß³Ìid

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note   ±¾º¯Êý¿ÉÒÔÓÃÓÚÏ̵߳Ä×ÔÎÒ¹ÒÆð

+ * @warning 

+ */

+UINT32 zOss_SuspendThread(ZOSS_THREAD_ID thread_id);

+

+/**

+ * @brief Ïָ̻߳´½Ó¿Ú

+ * @param thread_id     Èë²Î£¬ÐèÒª»Ö¸´µÄÏß³Ìid

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note

+ * @warning 

+ */

+UINT32 zOss_ResumeThread(ZOSS_THREAD_ID thread_id);

+

+/**

+ * @brief Ïß³Ì˯Ãß½Ó¿Ú

+ * @param time_in_ms     Èë²Î£¬Ï߳̽«ÒªË¯ÃßµÄʱ¼ä£¬µ¥Î»£ºms

+ * @return void

+ * @note

+ * @warning 

+ */

+VOID zOss_Sleep(UINT32 time_in_ms);

+

+/**

+ * @brief Ïß³Ìɾ³ý½Ó¿Ú

+ * @param thread_id     Èë²Î£¬±»É¾³ýµÄÏß³Ìid

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note   zOss_CreateThreadº¯ÊýÖÐÉêÇëµÄÏß³ÌÕ»¿Õ¼äºÍÏ߳̿ØÖÆ¿é½á¹¹¿Õ¼ä»áÔÚ

+ *         Cyg_Thread::exitº¯ÊýÖÐÊÍ·Å£¬ÒòΪÔÚcyg_thread_deleteº¯ÊýÖ´ÐÐÍêºó£¬

+ *         ºóÃæµÄËùÓдúÂëËæ×ű¾Ï̵߳ÄÏûÍö¶ø±äµÃÎÞЧÁË¡£

+ * @warning 

+ */

+UINT32 zOss_DeleteThread(ZOSS_THREAD_ID thread_id);

+

+/**

+ * @brief »ñÈ¡µ±Ç°Ïß³Ìid½Ó¿Ú

+ * @param void

+ * @return µ±Ç°Ïß³Ìid

+ * @note

+ * @warning 

+ */

+ZOSS_THREAD_ID zOss_GetCurThreadID(VOID);

+

+/**

+ * @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³ÌÃû³Æ£¬²éÕÒ¸ÃÏ̵߳ÄÏß³Ìid

+ * @param thread_name     Èë²Î£¬Ïß³ÌÃû³Æ

+ * @return Èô²éÕҳɹ¦£¬·µ»ØÏ̵߳ÄÓÐЧÏß³Ìid£»·ñÔòϵͳ¶ÏÑÔ

+ * @note

+ * @warning 

+ */

+ZOSS_THREAD_ID zOss_GetThreadIDByName(const CHAR *thread_name); 

+

+/**

+ * @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬»ñÈ¡¸ÃÏ̵߳ÄÏß³ÌÃû³Æ

+ * @param thread_id     Èë²Î£¬´ý»ñÈ¡Ïß³ÌÃû³ÆµÄÏß³Ìid

+ * @param thread_name   ³ö²Î£¬Ïß³ÌÃû³Æ´æ·ÅµØÖ·

+ * @return Èô³É¹¦£¬·µ»ØÏß³ÌÃû³ÆÖ¸Õ룻·ñÔòϵͳ¶ÏÑÔ»ò·µ»Ø¿ÕÖ¸Õë

+ * @retval Ïß³ÌÃû³ÆÖ¸Õë ³É¹¦

+ * @retval NULL   ʧ°Ü

+ * @note

+ * @warning 

+ */

+CHAR *zOss_GetThreadName(ZOSS_THREAD_ID thread_id, CHAR *thread_name);

+

+/**

+ * @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬»ñÈ¡¸ÃÏ̵߳ÄÏß³ÌÐÅÏ¢

+ * @param thread_id     Èë²Î£¬´ý»ñÈ¡Ïß³ÌÐÅÏ¢µÄÏß³Ìid

+ * @param thread_name   ³ö²Î£¬Ïß³ÌÃû³Æ´æ·ÅµØÖ·

+ * @param stat          ³ö²Î£¬Ïß³Ì״̬´æ·ÅµØÖ·

+ * @param priority      ³ö²Î£¬Ïß³ÌÓÅÏȼ¶´æ·ÅµØÖ·

+ * @param preempt       ³ö²Î£¬Ï߳̿ÉÇÀÕ¼´æ·ÅµØÖ·

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note

+ * @warning 

+ */

+UINT32 zOss_GetThreadInfo(ZOSS_THREAD_ID thread_id, CHAR *thread_name, UINT32 *stat, UINT32 *priority, UINT32 *preempt);

+

+/**

+ * @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬ÉèÖøÃÏ̵߳ÄÏß³ÌÓÅÏȼ¶

+ * @param thread_id     Èë²Î£¬´ýÉèÖÃÓÅÏȼ¶µÄÏß³Ìid

+ * @param priority      Èë²Î£¬Ï߳̽«±»ÉèÖõÄÓÅÏȼ¶

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note

+ * @warning 

+ */

+UINT32 zOss_SetThreadPri(ZOSS_THREAD_ID thread_id, UINT32 priority);

+

+/**

+ * @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬»ñÈ¡¸ÃÏ̵߳ÄÏß³ÌÓÅÏȼ¶

+ * @param thread_id     Èë²Î£¬´ýÉèÖÃÓÅÏȼ¶µÄÏß³Ìid

+ * @param priority      ³ö²Î£¬»ñÈ¡µÄÏß³ÌÓÅÏȼ¶´æ·ÅµØÖ·

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note

+ * @warning 

+ */

+UINT32 zOss_GetThreadPri(ZOSS_THREAD_ID thread_id, UINT32 *priority);

+

+/**

+ * @brief ÑéÖ¤Ò»¸öÏß³ÌÊÇ·ñÓÐЧ

+ * @param threadID     Èë²Î£¬´ýÑéÖ¤µÄÏß³Ìid

+ * @return ÈôÏß³ÌÓÐЧ£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note

+ * @warning 

+ */

+UINT32 zOss_IdentifyThread(ZOSS_THREAD_ID threadID);

+

+/* Ïß³ÌÏûÏ¢¹ÜÀíÄ£¿é */

+/**

+ * @brief ´ÓÄÚ´æ³ØÉêÇëÏûϢͷ+»º³åÇø£¬²¢·µ»Ø»º³åÇøÖ¸Õë

+ * @param size     Èë²Î£¬»º³åÇø´óС

+ * @return »º³åÇøÖ¸Õë

+ * @note ¸ÃÉêÇë½Ó¿Ú£¬»á´ø×ÅÏûϢͷһÆðÉêÇ룬µ«·µ»Ø¸øÓû§µÄÊǰþÀëÁËÏûϢͷµÄÓû§Ê¹ÓÃ¿Õ¼äµØÖ·

+ * @warning ±ØÐëºÍzOss_ThreadRetMsgBufÅä¶ÔʵÏÖ

+ */

+VOID *zOss_ThreadGetMsgBuf(UINT32 size); 

+

+/**

+ * @brief ÏòÄÚ´æ³ØÊÍ·ÅÏûϢͷ+»º³åÇø

+ * @param p_buf     Èë²Î£¬»º³åÇøÖ¸Õë

+ * @return void

+ * @note ¸ÃÊÍ·Å½Ó¿Ú»á´ø×ÅÏûϢͷһÆðÊÍ·Å

+ * @warning ±ØÐëºÍzOss_ThreadGetMsgBufÅä¶ÔʵÏÖ

+ */

+VOID zOss_ThreadRetMsgBuf(VOID *p_buf);

+

+/**

+ * @brief Ïòthread_idÏ̷߳¢ËÍÏûÏ¢

+ * @param msg_id       Èë²Î£¬ÏûÏ¢id

+ * @param p_buf        Èë²Î£¬»º³åÇøÖ¸Õë

+ * @param buf_size     Èë²Î£¬»º³åÇø´óС

+ * @param thread_id    Èë²Î£¬Ä¿±êÏß³Ìid

+ * @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note ±ØÐëºÍzOss_ThreadRecvMsgÅä¶ÔʵÏÖ

+ * @warning 

+ */

+UINT32 zOss_ThreadSendMsg(UINT32 msg_id, VOID *p_buf, UINT16 buf_size, ZOSS_THREAD_ID thread_id);

+

+/**

+ * @brief Ï߳̽ÓÊÕÏûÏ¢

+ * @param p_msg_id     Èë²Î£¬ÏûÏ¢idµÄ´æ·ÅµØÖ·

+ * @param p_buf        Èë²Î£¬ÏûÏ¢Ö¸ÕëµÄ´æ·ÅµØÖ·

+ * @param p_buf_size   Èë²Î£¬ÏûÏ¢´óСµÄ´æ·ÅµØÖ·

+ * @param timeout      Èë²Î£¬½ÓÊÕÏûÏ¢µÄ³¬Ê±Ê±¼ä

+ * @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  ±ØÐëºÍzOss_ThreadSendMsgÅä¶ÔʵÏÖ

+ * @warning 

+ */

+UINT32 zOss_ThreadRecvMsg(UINT32 *p_msg_id, VOID **p_buf, UINT32 *p_buf_size, UINT32 timeout);

+

+/**

+ * @brief ×¢²áÏß³ÌÏûÏ¢¹³×Óº¯Êý

+ * @param thread_id   Èë²Î£¬Ïß³Ìid

+ * @param type        Èë²Î£¬¹³×Óº¯ÊýÀàÐÍ

+ * @param dire        Èë²Î£¬¹³×Óº¯ÊýÅäÖÃ

+ * @param func        Èë²Î£¬¹³×Óº¯ÊýÖ¸Õë

+ * @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_RegThreadMsgHook(ZOSS_THREAD_ID thread_id, UINT8 type, UINT8 dire, THREAD_MSG_HOOK func);

+

+/* ÏûϢͨѶ */

+

+/**

+ * @brief ÏòÖ¸¶¨µÄÏ̷߳¢ËÍÏûÏ¢

+ * @param thread_id     Èë²Î£¬Ä¿±êÏ̵߳ÄÏß³Ìid

+ * @param msg_ptr       Èë²Î£¬ÏûÏ¢Êý¾ÝµÄÖ¸Õë

+ * @param size          Èë²Î£¬ÏûÏ¢µÄ´óС

+ * @param timeout       Èë²Î£¬·¢ËÍÏûÏ¢µÄ³¬Ê±Ê±¼ä

+ * @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  Èô²ÎÊýtimeoutÊÇZOSS_WAIT_FOREVER£¬ÔòÒ»Ö±µÈ´ýÏûÏ¢·¢Ëͳɹ¦ÔÙ·µ»Ø£»

+          Èô²ÎÊýtimeoutÊÇZOSS_NO_WAIT£¬Ôò³¢ÊÔ·¢ËÍÏûÏ¢£¬·¢ËÍʧ°Ü£¬Ö±½Ó·µ»Ø£»

+          ·ñÔòtimeoutÊdz¬Ê±µÄʱ¼ä£¬¼ÆËã·½·¨Êǽ«µ±Ç°ÏµÍ³Ê±¼äºÍtimeoutÏà¼Ó£¬

+                ³ÉΪabs_timeout,È»ºóÆô¶¯Ò»¸ö¶¨Ê±Æ÷£¬Ö±ÖÁÏûÏ¢·¢Ëͳɹ¦»ò³¬Ê±

+ * @warning 

+ */

+UINT32 zOss_SendMsg(ZOSS_THREAD_ID thread_id, VOID *msg_ptr, UINT32 size, UINT32 timeout);

+

+/**

+ * @brief ½ÓÊÕÏûÏ¢

+ * @param msg_ptr     ³ö²Î£¬ÏûÏ¢Ö¸ÕëµÄ´æ·ÅµØÖ·

+ * @param size        ³ö²Î£¬ÏûÏ¢Êý¾Ý´óСµÄ´æ·ÅµØÖ·

+ * @param timeout     Èë²Î£¬½ÓÊÕÏûÏ¢µÄ³¬Ê±Ê±¼ä

+ * @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  Èô²ÎÊýtimeoutÊÇZOSS_WAIT_FOREVER£¬ÔòÒ»Ö±µÈ´ýÏûÏ¢·¢Ëͳɹ¦ÔÙ·µ»Ø£»

+          Èô²ÎÊýtimeoutÊÇZOSS_NO_WAIT£¬Ôò³¢ÊÔ·¢ËÍÏûÏ¢£¬·¢ËÍʧ°Ü£¬Ö±½Ó·µ»Ø£»

+          ·ñÔòtimeoutÊdz¬Ê±µÄʱ¼ä£¬¼ÆËã·½·¨Êǽ«µ±Ç°ÏµÍ³Ê±¼äºÍtimeoutÏà¼Ó£¬

+                ³ÉΪabs_timeout,È»ºóÆô¶¯Ò»¸ö¶¨Ê±Æ÷£¬Ö±ÖÁÏûÏ¢·¢Ëͳɹ¦»ò³¬Ê±

+ * @warning 

+ */

+UINT32 zOss_RecvMsg(VOID **msg_ptr, UINT32 *size, UINT32 timeout);

+

+/* ¼ÆÊýÐźÅÁ¿ */

+/**

+ * @brief ´´½¨ÐźÅÁ¿

+ * @param name_ptr        Èë²Î£¬ÐźÅÁ¿µÄÃû³Æ

+ * @param initial_count   Èë²Î£¬ÐźÅÁ¿µÄ³õʼ¼ÆÊýÖµ

+ * @return ´´½¨³É¹¦£¬·µ»ØÐźÅÁ¿µÄ¾ä±ú£»·ñÔòϵͳ¶ÏÑÔ

+ * @note  

+ * @warning 

+ */

+ZOSS_SEMAPHORE_ID zOss_CreateSemaphore(const CHAR *name_ptr, UINT32 initial_count);

+

+/**

+ * @brief »ñÈ¡ÐźÅÁ¿

+ * @param sem_id   Èë²Î£¬ÕýÔÚ»ñÈ¡µÄÐźÅÁ¿id

+ * @param timeout  Èë²Î£¬³¬Ê±¼ÆÊý

+ * @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  Èô²ÎÊýtimeoutÊÇZOSS_WAIT_FOREVER£¬ÔòÒ»Ö±µÈ´ýÏûÏ¢·¢Ëͳɹ¦ÔÙ·µ»Ø£»

+                Èô²ÎÊýtimeoutÊÇZOSS_NO_WAIT£¬Ôò³¢ÊÔ·¢ËÍÏûÏ¢£¬·¢ËÍʧ°Ü£¬Ö±½Ó·µ»Ø£»

+                ·ñÔòtimeoutÊdz¬Ê±µÄʱ¼ä£¬¼ÆËã·½·¨Êǽ«µ±Ç°ÏµÍ³Ê±¼äºÍtimeoutÏà¼Ó£¬

+                ³ÉΪabs_timeout,È»ºóÆô¶¯Ò»¸ö¶¨Ê±Æ÷£¬Ö±ÖÁÏûÏ¢·¢Ëͳɹ¦»ò³¬Ê±

+ * @warning 

+ */

+UINT32 zOss_GetSemaphore(ZOSS_SEMAPHORE_ID sem_id, UINT32 timeout);

+

+/**

+ * @brief ÊÍ·ÅÐźÅÁ¿

+ * @param sem_id   Èë²Î£¬ÕýÔÚÊͷŵÄÐźÅÁ¿id

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_PutSemaphore(ZOSS_SEMAPHORE_ID sem_id);

+

+/**

+ * @brief »ñÈ¡ÐźÅÁ¿µÄµ±Ç°¼ÆÊýÖµ

+ * @param sem_id   Èë²Î£¬ÕýÔÚ±»»ñÈ¡¼ÆÊýÖµµÄÐźÅÁ¿id

+ * @return ¸ÃÐźÅÁ¿µÄµ±Ç°¼ÆÊýÖµ

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_GetSemaphoreCount(ZOSS_SEMAPHORE_ID sem_id);

+

+/**

+ * @brief ɾ³ýÐźÅÁ¿

+ * @param sem_id   Èë²Î£¬±»É¾³ýµÄÐźÅÁ¿id

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_DeleteSemaphore(ZOSS_SEMAPHORE_ID sem_id);

+

+/* »¥³âÐźÅÁ¿ */

+/**

+ * @brief ´´½¨»¥³âÌå

+ * @param name_ptr          Èë²Î£¬»¥³âÌåÃû³Æ

+ * @param priority_inherit  Èë²Î£¬»¥³âÌåÊôÐÔ£¬Èç¹ûÊÇZOSS_INHERIT£¬ÔòÏß³ÌÖ®¼ä°´

+                ÓÅÏȼ¶Ë³Ðò»ñÈ¡»¥³âÌ壻Èç¹ûÊÇZOSS_NO_INHERIT£¬Ôò°´µÈ´ýµÄ˳Ðò»ñÈ¡

+                »¥³âÌå

+ * @return Èô³É¹¦£¬·µ»Ø´´½¨µÄ»¥³âÌå¾ä±ú£»·ñÔòϵͳ¶ÏÑÔ

+ * @note 

+ * @warning 

+ */

+ZOSS_MUTEX_ID zOss_CreateMutex(const CHAR *name_ptr, UINT32 priority_inherit);

+

+/**

+ * @brief »ñÈ¡»¥³âÌå

+ * @param mutex_id   Èë²Î£¬´ý»ñÈ¡µÄ»¥³âÌåid

+ * @param timeout    Èë²Î£¬»ñÈ¡µÄ³¬Ê±Ê±¼ä

+ * @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_GetMutex(ZOSS_MUTEX_ID mutex_id, UINT32 timeout);

+

+/**

+ * @brief ÊÍ·Å»¥³âÌå

+ * @param mutex_id   Èë²Î£¬´ýÊͷŵĻ¥³âÌåid

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note 

+ * @warning 

+ */

+UINT32 zOss_PutMutex(ZOSS_MUTEX_ID mutex_id);

+

+/**

+ * @brief Ïú»Ù»¥³âÌå

+ * @param mutex_id   Èë²Î£¬´ýÏú»ÙµÄ»¥³âÌåid

+ * @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ

+ * @retval ZOSS_SUCCESS ³É¹¦

+ * @retval ZOSS_ERROR   ʧ°Ü

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_DeleteMutex(ZOSS_MUTEX_ID mutex_id);

+

+/* ʱ¼ä */

+/**

+ * @brief »ñÈ¡²Ù×÷ϵͳµÄµ±Ç°µÎ´ðÊý

+ * @param void 

+ * @return ·µ»Ø²Ù×÷ϵͳµÄµ±Ç°µÎ´ðÊý

+ * @retval µÎ´ðÊý

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_GetTickCount(VOID);

+

+#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/* CPUʹÓÃÂÊͳ¼Æ */

+UINT8 zOss_GetCPU(VOID);

+

+/* Òì³£´¦Àí */

+VOID EXP_Handler(const CHAR *pExp, const CHAR *pcFileName, const CHAR *pcFuncName, SINT32 dwLineNum);

+

+#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/*******************************************************************************

+ *                      Inline function implementations                        *

+ ******************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  // #ifndef _OSS_KERNEL_H

+

diff --git a/cp/ps/plat/inc/oss/oss_mem.h b/cp/ps/plat/inc/oss/oss_mem.h
new file mode 100644
index 0000000..0c5383c
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_mem.h
@@ -0,0 +1,195 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_mem.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : ÄÚ´æÉêÇë¡¢ÊͷŽӿÚ

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10 

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_MEM_H

+#define _OSS_MEM_H

+

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef _OS_TOS

+#include "tos_pool.h"

+#include "tos_heap.h"

+#elif defined _OS_LINUX

+#include "oss_pool.h"

+#include "linux/mm.h"

+#endif

+#include "oss_pub.h"

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+/* UB */

+#define zOss_GetUB(size)            mem_getub(size, ZOSS_FILE, ZOSS_LINE)

+#define zOss_RetUB(msg_ptr)         mem_retub(msg_ptr, ZOSS_FILE, ZOSS_LINE)

+

+/* UBÄÚ´æÅäÖòÎÊý */

+#define MEM_MAX_LEAK_UB             200     /* ÄÚ´æÐ¹Â¶²éѯ·µ»ØµÄ×î´óÌõÊý   */ 

+#define ZOSS_UB_MAX_POOLNUM         15      /* ÄÚ´æ³Ø¸öÊý, ×î´ó²»Äܳ¬¹ý255  */

+#define ZOSS_UBHEAD_FILENAME_LEN    31      /* UBÄÚ´æÉêÇëÎļþÃû             */

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+typedef VOID *ZOSS_UB_BLOCK;    /* ÄÚ´æ¿éµØÖ·Ö¸Õë */

+

+typedef struct 

+{

+    UINT32 nMemUsed;            /* ÒÑʹÓÃÄÚ´æ´óС£¬ÒÔ×Ö½Ú±íʾ   */

+    UINT32 nMemTotal;           /* ÄÚ´æ×ܵĴóС£¬ÒÔ×Ö½Ú±íʾ     */

+    UINT32 nMemMaxFree;			/* ¿ÉÒÔÉêÇëµÄ×î´óÄÚ´æ           */

+}T_Mem_MemInfo;              /* ÄÚ´æ»ù±¾ÐÅÏ¢                 */

+

+typedef struct 

+{

+    UINT32  pool_size;          /* ÄÚ´æ³Ø´óС,µ¥Î»Îªbyte    */

+    UINT32  total_block_num;    /* Ô¤¶¨ÄÚ´æ¿éÊýÄ¿           */

+}T_ZOss_UBPOOL;              /* ÄÚ´æ³ØÅäÖÃ±í             */

+

+typedef struct 

+{

+    UINT32  pool_size;          /* ÄÚ´æ³Ø´óС,µ¥Î»Îªbyte    */

+    UINT16  total_block_num;    /* ÄÚ´æ¿é×ÜÊýÄ¿             */

+    UINT16  free_block_num;     /* ¿ÕÏÐÄÚ´æ¿éÊýÄ¿           */

+    UINT32  peak_value;         /* ÄÚ´æ¿é×î´óʹÓøöÊý       */

+}T_Mem_UBPoolInfo;          /* ÄÚ´æ³ØÐÅÏ¢               */

+

+typedef struct 

+{

+    ZOSS_UB_BLOCK   ubBlock;                            /* ÄÚ´æ¿éÖ¸Õë               */

+    UINT32          ubBlockSize;                        /* ÄÚ´æ¿é´óС,µ¥Î»Îªbyte    */

+    UINT32          usingSize;                          /* ʵ¼ÊÕ¼ÓôóС             */

+    CHAR            name[ZOSS_UBHEAD_FILENAME_LEN + 1]; /* ÉêÇëλÖÃÎļþÃû           */

+    UINT32          line;                               /* ÉêÇëλÖÃÐкŠ            */

+    ZOSS_THREAD_ID  threadId;                           /* ÉêÇëÏß³ÌID               */

+    ZOSS_TASK_ID    taskId;                             /* ÉêÇëÈÎÎñºÅ               */

+    UINT32          applyTimeTick;                      /* ÉêÇëʱ¼ä(TICK)           */

+}T_Mem_UBBlockInfo;                                 /* й¶ÄÚ´æ¿éÄÚ´æÍ·ÐÅÏ¢     */

+

+typedef struct 

+{

+    UINT8               pool_num;   /* ÄÚ´æ³Ø×ÜÊý   */

+    T_Mem_UBPoolInfo    pool_info[ZOSS_UB_MAX_POOLNUM];

+}T_Mem_UBPoolGrpInfo;           /* ÄÚ´æ³Ø×ÜÐÅÏ¢ */

+ 

+typedef struct 

+{

+    UINT16              ub_leak_num;    /* ÄÚ´æÐ¹Â¶ÊýÄ¿,×î´óΪMEM_MAX_LEAK_UB   */

+    T_Mem_UBBlockInfo   ubHeadInfo[MEM_MAX_LEAK_UB];

+}T_Mem_UBLeakInfo;                  /* ÄÚ´æÐ¹Â¶ÐÅÏ¢                         */

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/    

+#ifdef _OS_LINUX

+

+#if defined(_UB_USE_HEAP_DEBUG)

+extern void *ub_debug_alloc(unsigned long size, const char *file, unsigned long line);

+extern void ub_debug_free(void *ptr);

+static inline VOID *mem_getub(UINT32 size, const CHAR *file, UINT32 line)

+{

+	return ub_debug_alloc(size, file, line);

+}

+static inline UINT32 mem_retub(VOID *msg_ptr, const CHAR *file, UINT32 line)

+{

+	ub_debug_free(msg_ptr);

+

+    return ZOSS_SUCCESS;

+}

+#elif defined(_UB_USE_HEAP)

+static inline VOID *mem_getub(UINT32 size, const CHAR *file, UINT32 line)

+{

+	//zOss_ASSERT(PAGE_SIZE == 4096);

+	if(size <= PAGE_SIZE)

+		return kmalloc(size, GFP_KERNEL);

+	else

+		return vmalloc(size);

+}

+static inline UINT32 mem_retub(VOID *msg_ptr, const CHAR *file, UINT32 line)

+{

+	if(!is_vmalloc_addr(msg_ptr))

+		kfree(msg_ptr);

+	else

+		vfree(msg_ptr);

+

+    return ZOSS_SUCCESS;

+}

+#elif defined(_UB_USE_POOL)

+static inline VOID *mem_getub(UINT32 size, const CHAR *file, UINT32 line)

+{

+    return pool_alloc(size, file, line);

+}

+static inline UINT32 mem_retub(VOID *msg_ptr, const CHAR *file, UINT32 line)

+{

+    pool_free(msg_ptr, file, line);

+    return ZOSS_SUCCESS;

+}

+#endif

+

+#else

+

+#if defined(_UB_USE_HEAP)

+static inline VOID *mem_getub(UINT32 size, const CHAR *file, UINT32 line)

+{

+    return tos_heap_alloc(size, file, line);

+}

+static inline UINT32 mem_retub(VOID *msg_ptr, const CHAR *file, UINT32 line)

+{

+    tos_heap_free(msg_ptr, file, line);

+    return ZOSS_SUCCESS;

+}

+#elif defined(_UB_USE_POOL)

+static inline VOID *mem_getub(UINT32 size, const CHAR *file, UINT32 line)

+{

+    return pool_alloc(size, file, line);

+}

+static inline UINT32 mem_retub(VOID *msg_ptr, const CHAR *file, UINT32 line)

+{

+    pool_free(msg_ptr, file, line);

+    return ZOSS_SUCCESS;

+}

+#else

+VOID *mem_getub(UINT32 size, const CHAR *file, UINT32 line);

+UINT32 mem_retub(VOID *msg_ptr, const CHAR *file, UINT32 line);

+#endif

+

+#endif  // #ifdef _OS_LINUX

+

+FLOAT zOss_GetUBFreeRate(UINT32 ubSize);

+VOID zOss_MemLeakStart(UINT32 leak_threadhold);

+VOID zOss_MemLeakEnd(VOID);

+VOID zOss_CheckMem(VOID);

+VOID zOss_SetUbDbgSwitch(UINT32 dbgFlag);

+BOOL zOss_GetMemInitState(VOID);

+UINT32 zOss_GetSysMemInfo(T_Mem_MemInfo *mem_info);

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _OSS_MEM_H */

+

diff --git a/cp/ps/plat/inc/oss/oss_monitor.h b/cp/ps/plat/inc/oss/oss_monitor.h
new file mode 100644
index 0000000..861ddf1
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_monitor.h
@@ -0,0 +1,336 @@
+/*******************************************************************************

+* °æÈ¨ËùÓÐ (C)2012, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£

+* 

+* ÎļþÃû³Æ:     oss_monitor.h

+* Îļþ±êʶ:     oss_monitor.h

+* ÄÚÈÝÕªÒª:     Ö§³Å²ã¼à¿ØÄ£¿éÍ·Îļþ£¬ele±íʾelement

+* ʹÓ÷½·¨:     #include "oss_monitor.h"

+* 

+* ÐÞ¸ÄÈÕÆÚ        °æ±¾ºÅ      Ð޸ıê¼Ç        ÐÞ¸ÄÈË          ÐÞ¸ÄÄÚÈÝ

+* ------------------------------------------------------------------------------

+* 2012/09/20      V1.0        Create          ÁõÑÇÄÏ          ´´½¨

+* 

+*******************************************************************************/

+

+#ifndef _OSS_MONITOR_H

+#define _OSS_MONITOR_H

+

+/*******************************************************************************

+*                                   Í·Îļþ                                     *

+*******************************************************************************/

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+

+/*******************************************************************************

+*                                   ºê¶¨Òå                                     *

+*******************************************************************************/

+#define OSS_MON_PERCENT_RADIO           100    

+

+/*¼à¿ØÐÅÏ¢×î´óÖµ*/

+#define OSS_MON_INFO_MAX_NUMBER         (0x64)

+

+/*Ïß³Ì״̬ */

+#define OSS_MON_THREAD_RUNNING          (0x01)

+#define OSS_MON_THREAD_READY            (0x02)

+#define OSS_MON_THREAD_WAITING          (0x04)

+

+/*ÈÎÎñ״̬ */

+#define OSS_MON_TASK_STOPPED            (0x01)

+#define OSS_MON_TASK_IDLE               (0x02)

+#define OSS_MON_TASK_READY              (0x03)

+#define OSS_MON_TASK_RUN                (0x04)

+

+/*¼à¿ØÏ̺߳ÍDSRµÄ¹ì¼£ */

+#define OSS_MON_EVENT_THREAD_SWAPIN     (0x00) 

+#define OSS_MON_EVENT_THREAD_SWAPOUT    (0x01)

+#define OSS_MON_EVENT_DSR_SWAPIN        (0x02)

+#define OSS_MON_EVENT_DSR_SWAPOUT       (0x03)

+

+/*MMUµÄÊôÐÔ*/

+#define OSS_MON_MMU_PERMISSION_RW       (0x01)

+#define OSS_MON_MMU_PERMISSION_RO       (0x02)

+#define OSS_MON_MMU_ACCESS_WRITEBACK    (0x04)

+#define OSS_MON_MMU_ACCESS_WRITETHROUGH (0x08)

+

+/*¼à¿Ø¿ª¹Ø±êÖ¾*/

+#define OSS_MON_FLAG_OFF                (0x0)

+#define OSS_MON_FLAG_ON                 (0x1)

+

+/*ÏûÏ¢¶¨ÒåÀàÐÍ*/

+#define OSS_MON_INVALID                 (-1)

+#define OSS_MON_BASE                    (0x00)

+#define OSS_MON_VERSION                 (OSS_MON_BASE + 0)

+#define OSS_MON_CPU_FREQUENCY           (OSS_MON_BASE + 1)

+#define OSS_MON_CPU_LOAD                (OSS_MON_BASE + 2)

+#define OSS_MON_POOL                    (OSS_MON_BASE + 3)

+#define OSS_MON_POOL_ALLOC              (OSS_MON_BASE + 4)

+#define OSS_MON_POOL_LEAK               (OSS_MON_BASE + 5)

+#define OSS_MON_HEAP                    (OSS_MON_BASE + 6)

+#define OSS_MON_THREAD                  (OSS_MON_BASE + 7)

+#define OSS_MON_TASK                    (OSS_MON_BASE + 8)

+#define OSS_MON_EVENT                   (OSS_MON_BASE + 9)

+#define OSS_MON_MSG                     (OSS_MON_BASE + 10)

+#define OSS_MON_RAMLOG                  (OSS_MON_BASE + 11)

+#define OSS_MON_GET_VAR_REQ             (OSS_MON_BASE + 12)

+#define OSS_MON_GET_VAR_ACK             (OSS_MON_BASE + 13)

+#define OSS_MON_SET_VAR                 (OSS_MON_BASE + 14)

+#define OSS_MON_TIMER                   (OSS_MON_BASE + 15)

+#define OSS_MON_MMU                     (OSS_MON_BASE + 16)

+#define OSS_MON_SET_FLAG                (OSS_MON_BASE + 17)

+

+/*******************************************************************************

+*                                Êý¾ÝÀàÐͶ¨Òå                                  *

+*******************************************************************************/

+/*¼à¿Ø°æ±¾*/

+typedef struct

+{

+    const CHAR *version;

+} T_ZOss_Mon_Version;

+

+/*cpu µÄÖ÷Ƶ*/

+typedef struct

+{

+    UINT16  frequency;

+} T_ZOss_Mon_Cpu_Frequency;

+

+/*cpu ¸ºÔØ (load/100)*/

+typedef struct

+{

+    UINT16  load;

+} T_ZOss_Mon_Cpu_Load;

+

+/*pool ÅäÖÃÐÅÏ¢*/

+typedef struct

+{

+    UINT32  size;

+    UINT32  total;

+    UINT32  used;

+    UINT32  max_used;

+} T_ZOss_Mon_Pool_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Pool_Ele *ele;

+} T_ZOss_Mon_Pool;

+

+/*pool alloc ÐÅÏ¢*/

+typedef struct

+{

+    UINT32      addr;

+    UINT32      owner;

+    UINT32      timestamp;

+    const CHAR *file;

+    UINT32      line;

+} T_ZOss_Mon_Pool_Alloc_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Pool_Alloc_Ele *ele;

+} T_ZOss_Mon_Pool_Alloc;

+

+/*pool leak ÐÅÏ¢*/

+typedef struct

+{

+    UINT32      addr;

+    UINT32      owner;

+    UINT32      timestamp;

+    const CHAR  *file;

+    UINT32      line;

+} T_ZOss_Mon_Pool_Leak_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Pool_Leak_Ele *ele;

+} T_ZOss_Mon_Pool_Leak;

+

+/*heap ÐÅÏ¢*/

+typedef struct

+{

+    UINT32  base;

+    UINT32  size;

+    UINT32  used;

+} T_ZOss_Mon_Heap;

+

+/*Ïß³ÌÐÅÏ¢*/

+typedef struct

+{

+    CHAR    *name;

+    UINT32  handle;

+    UINT32  msg_num;

+    UINT8   status;

+    UINT8   priority;

+    UINT16  stack_used;

+    UINT16  stack_max_used;

+    UINT16  cpu_load;

+} T_ZOss_Mon_Thread_Ele;

+

+typedef struct

+{

+    unsigned int num;

+    T_ZOss_Mon_Thread_Ele *ele;

+} T_ZOss_Mon_Thread;

+

+/*ÈÎÎñÐÅÏ¢*/

+typedef struct

+{

+    CHAR    *name;

+    UINT32  handle;

+    UINT32  thread_handle;

+    UINT8   status;

+} T_ZOss_Mon_Task_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Task_Ele *ele;

+} T_ZOss_Mon_Task;

+

+/*Ï̺߳ÍÖжϹ켣ÐÅÏ¢*/

+typedef struct

+{

+    UINT8   event;

+    CHAR    *name;

+    UINT32  handle;

+    UINT64  tickstamp;

+} T_ZOss_Mon_Event_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Event_Ele *ele;

+} T_ZOss_Mon_Event;

+

+/*ÏûÏ¢ÊÕ·¢ÐÅÏ¢*/

+typedef struct

+{   

+    UINT32  msgId;

+    UINT32  ptr;

+    UINT32  size;

+    CHAR    *sender;

+    CHAR    *receiver;

+    UINT32  timestamp;

+} T_ZOss_Mon_Msg_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Msg_Ele  *ele;

+} T_ZOss_Mon_Msg;

+

+/*ramlog ÐÅÏ¢*/

+typedef struct

+{   

+    UINT32  size;

+    const CHAR *ramlog;

+} T_ZOss_Mon_Ramlog;

+

+/*»ñÈ¡±äÁ¿ÇëÇó*/

+typedef struct

+{

+    UINT32  base;

+    UINT32  size;

+} T_ZOss_Mon_Get_Var_Req;

+

+/*»ñÈ¡±äÁ¿È·ÈÏÐÅÏ¢*/

+typedef struct

+{

+    UINT32  size;

+    UINT8   *value;

+} T_ZOss_Mon_Get_Var_Ack;

+

+/*ÉèÖñäÁ¿*/

+typedef struct

+{

+    UINT32  base;

+    UINT32  size;

+    UINT8   *value;

+} T_ZOss_Mon_Set_Var;

+

+/*¶¨Ê±Æ÷ÐÅÏ¢*/

+typedef struct

+{

+    UINT32  start_time;

+    UINT32  expire_time;

+    UINT32  callback_func;

+    UINT8   is_period;

+    UINT32  handle;

+} T_ZOss_Mon_Timer_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Timer_Ele *ele;

+} T_ZOss_Mon_Timer;

+

+/*MMU ÐÅÏ¢*/

+typedef struct

+{

+    CHAR    *name;

+    UINT32  vir_addr;

+    UINT32  phy_addr;

+    UINT32  size;

+    UINT8   attr; /* permission and access */

+} T_ZOss_Mon_Mmu_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Mmu_Ele *ele;

+} T_ZOss_Mon_Mmu;

+

+/*MPU ÐÅÏ¢*/

+typedef struct

+{

+    CHAR   *name;

+    UINT32 num;

+    UINT32 base;

+    UINT32 size;

+    UINT32 attr;

+    UINT32 subRegion;

+} T_ZOss_Mon_Mpu_Ele;

+

+typedef struct

+{

+    UINT32  num;

+    T_ZOss_Mon_Mpu_Ele *ele;

+} T_ZOss_Mon_Mpu;

+

+typedef struct

+{

+    UINT32  flag;

+} T_ZOss_Mon_Set_Flag;

+

+/*******************************************************************************

+*                                È«¾Ö±äÁ¿ÉùÃ÷                                  *

+*******************************************************************************/

+#ifdef _USE_MONITOR

+extern UINT32   gOsa_MonitorFlag;

+#endif

+

+/*******************************************************************************

+*                                È«¾Öº¯ÊýÉùÃ÷                                  *

+*******************************************************************************/

+/* TOS¸ú×ÙÄ£¿é */

+VOID zTos_GetMmuConfigTable(T_ZOss_Mon_Mmu *pMonMmuInfo);

+VOID pool_used_info(T_ZOss_Mon_Pool *pMonPoolInfo);

+VOID pool_alloc_info(T_ZOss_Mon_Pool_Alloc *pMonPoolAllocInfo);

+VOID pool_leak_info(T_ZOss_Mon_Pool_Leak *pMonPoolLeakInfo);

+VOID z0ss_GetMsgInfo(T_ZOss_Mon_Msg *pMonMsgInfo);

+VOID z0ss_GetEventInfo(T_ZOss_Mon_Event *pMonEventInfo);

+VOID zOss_GetAllTaskInfo(T_ZOss_Mon_Task *pMonTaskInfo);

+VOID z0ss_GetAllThreadInfo(T_ZOss_Mon_Thread *pMonThreadInfo);

+VOID zOss_GetTimerInfo(T_ZOss_Mon_Timer *pMonTimerInfo);

+VOID z0ss_GetRamlogInfo(T_ZOss_Mon_Ramlog *pMonRamlogInfo);

+VOID z0ss_GetHeapInfo(T_ZOss_Mon_Heap *pMonHeapInfo);

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif // #ifndef _OSS_MONITOR_H

+

diff --git a/cp/ps/plat/inc/oss/oss_pool.h b/cp/ps/plat/inc/oss/oss_pool.h
new file mode 100644
index 0000000..80f6972
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_pool.h
@@ -0,0 +1,122 @@
+/*******************************************************************************

+* °æÈ¨ËùÓÐ (C)2014, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£

+* 

+* ÎļþÃû³Æ:     oss_pool.h

+* Îļþ±êʶ:     oss_pool.h

+* ÄÚÈÝÕªÒª:     ossÖ§³Å²ãÄÚ´æ³Ø¹ÜÀíÄ£¿éÍ·Îļþ

+* ʹÓ÷½·¨:     #include "oss_api.h"

+* 

+* ÐÞ¸ÄÈÕÆÚ        °æ±¾ºÅ      Ð޸ıê¼Ç        ÐÞ¸ÄÈË          ÐÞ¸ÄÄÚÈÝ

+* ------------------------------------------------------------------------------

+* 2014/08/25      V1.0        Create          ÁõÑÇÄÏ          ´´½¨

+* 

+*******************************************************************************/

+

+#ifndef _OSS_POOL_H

+#define _OSS_POOL_H

+

+/*******************************************************************************

+*                                   Í·Îļþ                                     *

+*******************************************************************************/

+

+/*******************************************************************************

+*                                   ºê¶¨Òå                                     *

+*******************************************************************************/

+#if defined(_DEBUG) && !defined(_USE_OSS_MIN)

+# define POOL_DEBUG

+# define POOL_LEAK_CHECK

+# define POOL_INIT_CHECK

+#endif

+

+#ifdef POOL_DEBUG

+# define palloc(size)           pool_alloc(size, __FILE__, __LINE__)

+# define pfree(ptr)             pool_free(ptr, __FILE__, __LINE__)

+# define prealloc(ptr, size)    pool_realloc(ptr, size, __FILE__, __LINE__)

+# define psize(ptr)             pool_node_size(ptr, __FILE__, __LINE__)

+#else

+# define palloc(size)           pool_alloc(size, NULL, 0x00)

+# define pfree(ptr)             pool_free(ptr, NULL, 0x00)

+# define prealloc(ptr, size)    pool_realloc(ptr, size, NULL, 0x00)

+# define psize(ptr)             pool_node_size(ptr, NULL, 0x00)

+#endif

+

+#define POOL_INDEX_0_NUM    (4096)    /* the number of index 0 pool node  */

+#define POOL_INDEX_0_SIZE   (4)       /* the size of index 0 pool node    */

+

+#define POOL_INDEX_1_NUM    (4096)    /* the number of index 1 pool node  */

+#define POOL_INDEX_1_SIZE   (8)       /* the size of index 1 pool node    */

+

+#define POOL_INDEX_2_NUM    (256)     /* the number of index 2 pool node  */

+#define POOL_INDEX_2_SIZE   (16)      /* the size of index 2 pool node    */

+

+#define POOL_INDEX_3_NUM    (2048)    /* the number of index 3 pool node  */

+#define POOL_INDEX_3_SIZE   (32)      /* the size of index 3 pool node    */

+

+#define POOL_INDEX_4_NUM    (3072)    /* the number of index 4 pool node  */

+#define POOL_INDEX_4_SIZE   (64)      /* the size of index 4 pool node    */

+

+#define POOL_INDEX_5_NUM    (512)     /* the number of index 5 pool node  */

+#define POOL_INDEX_5_SIZE   (128)     /* the size of index 5 pool node    */

+

+#define POOL_INDEX_6_NUM    (512)     /* the number of index 6 pool node  */

+#define POOL_INDEX_6_SIZE   (256)     /* the size of index 6 pool node    */

+

+#define POOL_INDEX_7_NUM    (300)     /* the number of index 7 pool node  */

+#define POOL_INDEX_7_SIZE   (512)     /* the size of index 7 pool node    */

+

+#define POOL_INDEX_8_NUM    (300)     /* the number of index 8 pool node  */

+#define POOL_INDEX_8_SIZE   (1024)    /* the size of index 8 pool node    */

+

+#define POOL_INDEX_9_NUM    (100)     /* the number of index 9 pool node  */

+#define POOL_INDEX_9_SIZE   (2048)    /* the size of index 9 pool node    */

+

+#define POOL_INDEX_10_NUM   (21)      /* the number of index 10 pool node */

+#define POOL_INDEX_10_SIZE  (4096)    /* the size of index 10 pool node   */

+

+#define POOL_INDEX_11_NUM   (60)      /* the number of index 11 pool node */

+#define POOL_INDEX_11_SIZE  (8192)    /* the size of index 11 pool node   */

+

+#define POOL_INDEX_12_NUM   (15)      /* the number of index 12 pool node */

+#define POOL_INDEX_12_SIZE  (16384)   /* the size of index 12 pool node   */

+

+#define POOL_INDEX_13_NUM   (5)       /* the number of index 13 pool node */

+#define POOL_INDEX_13_SIZE  (32768)   /* the size of index 13 pool node   */

+

+#define POOL_INDEX_14_NUM   (5)       /* the number of index 14 pool node */

+#define POOL_INDEX_14_SIZE  (65536)   /* the size of index 14 pool node   */

+

+#define POOL_INDEX_15_NUM   (1)       /* the number of index 15 pool node */

+#define POOL_INDEX_15_SIZE  (131072)  /* the size of index 15 pool node   */

+

+#define POOL_LEAK_CHECK_TIMEOUT     (100)

+

+#define POOL_ALLOC_STATISTIC_NUM    (8)

+

+#define POOL_MBOX_ITEM_COUNT        (3000)  /* the total available items(msgs) for system */

+

+

+/*******************************************************************************

+*                                Êý¾ÝÀàÐͶ¨Òå                                  *

+*******************************************************************************/

+

+/*******************************************************************************

+*                                È«¾Ö±äÁ¿ÉùÃ÷                                  *

+*******************************************************************************/

+

+/*******************************************************************************

+*                                È«¾Öº¯ÊýÉùÃ÷                                  *

+*******************************************************************************/

+void pool_init(void);

+__tcm_call_func void *pool_alloc(unsigned long size, const char *file, unsigned long line);

+__tcm_call_func void pool_free(void *ptr, const char *file, unsigned long line);

+void *pool_realloc(void *old_ptr, unsigned long new_size, const char *file, unsigned long line);

+unsigned long pool_node_size(void *ptr, const char *file, unsigned long line);

+void pool_print_leak(unsigned long timeout);

+void pool_print_alloc_fail(void);

+void pool_print_alloc_statistic(void);

+void pool_print_free(void);

+void pool_trace_leak_start(void);

+void pool_trace_leak_end(unsigned long timeout);

+

+#endif  // #ifndef _OSS_POOL_H

+

diff --git a/cp/ps/plat/inc/oss/oss_posix.h b/cp/ps/plat/inc/oss/oss_posix.h
new file mode 100644
index 0000000..9effacb
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_posix.h
@@ -0,0 +1,106 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_posix.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : posix¿âÍ·Îļþ

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10 

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_POSIX_H

+#define _OSS_POSIX_H

+

+#define _USE_POSIX

+#ifdef _USE_POSIX

+

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef _OS_TOS

+#include <sys/time.h>

+#include <sys/types.h>

+#elif defined (_OS_LINUX)

+

+#else

+#include "sys/types.h"

+#endif

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+/* ʱ¼ä¶¨Òå */

+#ifndef _OS_WIN

+typedef struct timeval  ZOSS_S_TIMEVAL;

+typedef struct timezone ZOSS_S_TIMEZONE;

+typedef struct timespec ZOSS_S_TIMESPEC;

+#else

+# ifndef _USE_OS_SOCK

+typedef struct timeval

+# else

+typedef struct

+# endif

+{

+    SINT32  tv_sec;        

+    SINT32  tv_usec;     

+}ZOSS_S_TIMEVAL;

+

+typedef struct timezone

+{

+    SINT32  tz_minuteswest; /*  minutes west of Greenwich,ºÍGreenwich ʱ¼ä²îÁ˶àÉÙ·ÖÖÓ  */

+    SINT32  tz_dsttime;     /*  type of dst correction to apply ,ÈÕ¹â½ÚԼʱ¼äµÄ״̬Ëù´ú±íµÄ״̬ÈçÏÂ

+                                DST_NONE    ²»Ê¹ÓÃ

+                                DST_USA     ÃÀ¹ú

+                                DST_AUST    °ÄÖÞ

+                                DST_WET     Î÷Å·

+                                DST_MET     ÖÐÅ·

+                                DST_EET     ¶«Å·

+                                DST_CAN     ¼ÓÄôó

+                                DST_GB      ´ó²»Áеß

+                                DST_RUM     ÂÞÂíÄáÑÇ

+                                DST_TUR     ÍÁ¶úÆä

+                                DST_AUSTALT °ÄÖÞ(1986ÄêÒÔºó)    */

+}ZOSS_S_TIMEZONE;

+

+typedef struct timespec 

+{

+    SINT32  tv_sec;

+    SINT32  tv_nsec;

+}ZOSS_S_TIMESPEC;

+#endif

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+UINT32 zOss_Gettimeofday(ZOSS_S_TIMEVAL *tv, ZOSS_S_TIMEZONE *tz);

+UINT32 zOss_Settimeofday(ZOSS_S_TIMEVAL *tv, ZOSS_S_TIMEZONE *tz);

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _USE_POSIX   */

+

+#endif  /* _OSS_POSIX_H */

+

diff --git a/cp/ps/plat/inc/oss/oss_psm.h b/cp/ps/plat/inc/oss/oss_psm.h
new file mode 100644
index 0000000..0427f46
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_psm.h
@@ -0,0 +1,46 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_psm.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : Ê¡µç¹ÜÀíÄ£¿é

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+       

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef _USE_PSM_NEW_FRAMEWORK

+#include "oss_psm_new_framework.h"       /*7510ºóÐøÍ·Îļþ      */

+#else

+#include "oss_psm_old_framework.h"       /*ÒÔǰ°æ±¾µÄÍ·Îļþ    */

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+

+

diff --git a/cp/ps/plat/inc/oss/oss_psm_new_framework.h b/cp/ps/plat/inc/oss/oss_psm_new_framework.h
new file mode 100644
index 0000000..29b98fc
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_psm_new_framework.h
@@ -0,0 +1,127 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_psm.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : Ê¡µç¹ÜÀíÄ£¿é

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_PSM_H

+#define _OSS_PSM_H

+       

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+typedef VOID *ZOSS_COMPENSATE_ID;                       /* ˯Ãß²¹³¥ID           */

+typedef VOID (*psm_SleepInitHook)(VOID);                /* ˯Ãß³õʼ»¯hook       */

+typedef VOID (*psm_SleepFinishHook)(VOID);              /* ˯Ãß½áÊøhook         */

+typedef VOID (*psm_SleepBeforeHook)(VOID);              /* ˯Ãßǰhook           */

+typedef VOID (*psm_SleepAfterHook)(VOID);               /* ˯Ãߺóhook           */

+typedef VOID (*psm_CompensateHook)(UINT32 sleepTime);   /* ˯Ãßʱ¼ä²¹³¥¹³×Óº¯Êý */

+

+typedef enum

+{

+    PSM_BOOT_DEFAULT,   /* Æô¶¯³õʼֵ                           */

+    PSM_SYSINIT_FINISH, /* ϵͳ³õʼ»¯Íê³É,ÈçÐͺŻúÍê³ÉSysEntry  */

+    PSM_BOOT_FINISH     /* ¿ª»úÍê³É£¬ÈçÐͺŻú³öÏÖ´ý»ú½çÃæ       */

+}T_zPsm_BootStage;  /* Æô¶¯½×¶Î                             */

+

+#ifdef _USE_CPU_DFM

+typedef struct  

+{

+    UINT32  cpuClk;

+    BOOL    isUsed;

+}T_zPsm_CpuFreq;                    /* Á¢¼´µ÷Ƶ½á¹¹     */

+

+typedef struct  

+{

+    UINT32  pullCpuPercent;

+    UINT32  upCpuPercent;

+    UINT32  downCpuPercent;

+}T_zPsm_CpuPercentThreshold;    /* CPUµ÷Ƶ·§Öµ½á¹¹  */

+

+typedef struct 

+{

+    UINT32  curCpuFreq;

+    UINT32  downCpuFreq; 

+    UINT32  upCpuFreq;

+    UINT32  pullCpuFreq;

+}T_zPsm_CpuFm;                      /* CPUµ÷Ƶ½á¹¹      */

+#endif

+

+typedef struct 

+{ 

+    UINT32          deepSleepTimeThreshold; /* ϵͳÉî˯Ãߵķ§Öµ             */

+    UINT32          shadowSleepTimeThreshold;        

+#ifdef _USE_CPU_DFM

+    UINT32          dfmPeriod;              /* µ÷ƵµÄÖÜÆÚ£¬½¨ÒéÖÜÆÚÔÚ5msÒÔÉÏ*/

+    UINT32          dfmThrdPri;             /* µ÷ƵµÄÓÅÏȼ¶                 */

+    UINT32          dfmCnt;                 /* µ÷ƵµÄ´ÎÊý                   */

+    T_zPsm_CpuFm    *desClk;                /* δ²åusbÉèÖÃcpuµ÷Ƶ           */

+    UINT32          desClkNum;              /* δ²åusbÉèÖÃcpuµ÷ƵµÄ¸öÊý     */

+    T_zPsm_CpuFm    *usbDesClk;             /* ²åÉÏusbÉèÖÃcpuµ÷Ƶ           */

+    UINT32          usbDesClkNum;           /* ²åÉÏusbÉèÖÃcpuµ÷ƵµÄ¸öÊý     */

+    T_zPsm_CpuFreq  *minClk;                /* Á¢¼´µ÷Ƶ                     */

+    T_zPsm_CpuPercentThreshold scaleCpuPcnt;/* cpuµ÷ƵµÄ·§Öµ                */

+    CHAR            **pIgnoreThreadNameArry;/* ºöÂÔÏ̵߳ÄÃû×ÖÊý×é           */

+    UINT32          ignoreThreadCnt;        /* ºöÂÔÏ̵߳ĸöÊý               */

+    UINT32          *usbSysClk;             /* ²åÉÏusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ    */

+    UINT32          usbSysClkNum;           /* ²åÉÏusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ¸öÊý*/

+    UINT32          *sysClk;                /* δ²åusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ    */

+    UINT32          sysClkNum;              /* δ²åusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ¸öÊý*/

+#endif

+    UINT32          chargeringSleepTime;    /* ³äµçÖÐ˯Ãßʱ¼ä£¬µ¥Î»ms       */

+    UINT32          airPlaneSleepTime;      /* ·ÉÐÐģʽϵÄ˯Ãßʱ¼ä£¬µ¥Î»ms */

+    UINT32          bootOverClk;            /* boot sleep ½áÊøºóµÄ¿ª»úÖ÷Ƶ  */

+}T_zPsm_Param;  /* Ê¡µçÅäÖòÎÊý½á¹¹Ìå            */

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+UINT32 zOss_PsmInit(VOID);

+VOID   zOss_SetBootStage(T_zPsm_BootStage stage);

+UINT32 zOss_SetPSMAppIdle(UINT32 appId);

+UINT32 zOss_SetPSMAppActive(UINT32 appId);

+UINT32 zOss_ApplyCpuFreq(UINT32 appId, BOOL isUsed);

+VOID   zOss_SetSleepHookOpt(psm_SleepInitHook  initHook, psm_SleepFinishHook  finishHook, psm_SleepBeforeHook  beforeHook, psm_SleepAfterHook afterHook);

+ZOSS_COMPENSATE_ID zOss_RegSleepCompensateFunc(psm_CompensateHook funcOpt);

+VOID   zOss_DeregSleepCompensateFunc(ZOSS_COMPENSATE_ID psmCmpnstId);

+VOID   zOss_SetIgnoreThreadTimeRate(FLOAT timeRate);

+VOID   zOss_DfmSettingInit(VOID);

+VOID   zOss_SetIgnoreThread(ZOSS_THREAD_ID threadId);

+VOID   zOss_PsmTraceInfo(VOID);

+VOID   zOss_DfmTraceInfo(VOID);

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _OSS_PSM_H */

+

+

diff --git a/cp/ps/plat/inc/oss/oss_psm_old_framework.h b/cp/ps/plat/inc/oss/oss_psm_old_framework.h
new file mode 100644
index 0000000..4b88027
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_psm_old_framework.h
@@ -0,0 +1,171 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_psm.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : Ê¡µç¹ÜÀíÄ£¿é

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_PSM_H

+#define _OSS_PSM_H

+       

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+typedef VOID (*PSM_SleepFunc)(SINT32 arg);  /* Ê¡µç¹ÜÀí˯Ãߺ¯ÊýÀàÐÍ     */

+typedef VOID (*PSM_SleepHookFunc)(VOID);    /* Ê¡µç¹ÜÀí˯ÃßHOOKº¯ÊýÀàÐÍ */ 

+

+typedef enum 

+{

+    PSM_MODULE_APP = 1,     /* ÉϲãÓ¦Óà             */

+    PSM_MODULE_PS,          /* ЭÒéÕ»               */

+    PSM_MODULE_DRV          /* ϲãÇý¶¯             */

+}T_PSM_IdleModule;          /* Ê¡µç¹ÜÀíËù»®·ÖµÄÄ£¿é */       

+

+typedef enum

+{

+    PSM_NO_SLEEP,

+    PSM_KENEL_SLEEP,

+    PSM_SHALLOW_SLEEP,

+    PSM_DEEP_SLEEP,

+    PSM_BOOTING_SLEEP,      /* ¿ª»úÊäÈëPINÂë¡¢ÊÖ»úÃÜÂëÊ¡µç˯Ãß  */

+    PSM_LOSSCOVERAGE_SLEEP, /* ¶ªÊ§¸²¸ÇÊ¡µç˯Ãß                 */

+    PSM_AIRPLANE_SLEEP,     /* ·ÉÐÐģʽʡµç˯Ãß                 */

+    PSM_CHARGERING_SLEEP,   /* ³äµç¿ª»úÊ¡µç˯Ãß                 */

+    PSM_MAX_SLEEP

+}T_Psm_SleepMode;           /* ˯Ãßģʽ                         */

+

+typedef enum

+{

+    PSM_BOOT_DEFAULT,       /* Æô¶¯³õʼֵ                           */

+    PSM_SYSINIT_FINISH,     /* ϵͳ³õʼ»¯Íê³É,ÈçÐͺŻúÍê³ÉSysEntry  */

+    PSM_BOOT_FINISH         /* ¿ª»úÍê³É£¬ÈçÐͺŻú³öÏÖ´ý»ú½çÃæ       */

+}T_Psm_BootStage;           /* Æô¶¯½×¶Î                             */

+

+#ifdef _USE_APPFLAG_DFM

+typedef struct  

+{

+    UINT32  PSM_AppPowFlag;

+    UINT32  PSM_AppPow;

+}T_ZOss_PSM_AppPow;         /* Ó¦Óñê־λµ÷Ƶ½á¹¹ */

+#endif

+

+#ifdef _USE_CPU_DFM

+typedef struct  

+{

+    UINT32  CPUCLK;

+    BOOL    isUsed;

+}T_ZOSS_CPU_Clock;          /* Á¢¼´µ÷Ƶ½á¹¹ */

+

+typedef struct  

+{

+    UINT32  pullCpuPercent;

+    UINT32  upCpuPercent;

+    UINT32  downCpuPercent;

+}ARMScaleCpu;               /* CPUµ÷Ƶ·§Öµ½á¹¹ */

+

+typedef struct 

+{

+    CHAR *threadname;

+}PSM_IgnoreThread;          /* ºöÂÔÏ߳̽ṹ */

+

+typedef struct 

+{

+    UINT32  currentARMClock;

+    UINT32  downARMCLock;

+    UINT32  upARMClock;

+    UINT32  pushARMClock;

+}T_ZPSM_ARMClockSet;        /* CPUµ÷Ƶ½á¹¹ */

+#endif

+

+#ifdef _USE_PSM  

+typedef struct 

+{ 

+    UINT32              deepSleepTimeLen;       /* ϵͳÉî˯Ãߵķ§Öµ                 */

+    UINT32              secondSleepTimeLen;     /* ϵͳµÚ¶þ´Î˯Ãߵķ§Öµ             */

+    UINT32              shadowSleepTimeLen;        

+    UINT32              tddT1PichSleepTimeLen;

+#ifdef _USE_APPFLAG_DFM

+    T_ZOss_PSM_AppPow   *appDfm;                /* δ²åusbÓ¦Óõ÷Ƶ                  */

+    UINT32              appDfmNum;              /* δ²åusbÓ¦Óõ÷ƵµÄ¸öÊý            */

+    T_ZOss_PSM_AppPow   *appUsbDfm;             /* ²åÉÏusbÓ¦Óõ÷Ƶ                  */

+    UINT32              appUsbDfmNum;           /* ²åÉÏusbÓ¦Óõ÷ƵµÄ¸öÊý            */

+#endif 

+#ifdef _USE_CPU_DFM

+    UINT32              minTimeLen;             /* µ÷ƵµÄÖÜÆÚ                       */

+    UINT32              cpuThreadPrior;         /* µ÷ƵµÄÓÅÏȼ¶                     */

+    UINT32              cpuAdjustNum;           /* µ÷ƵµÄ´ÎÊý                       */

+    T_ZPSM_ARMClockSet  *desClock;              /* δ²åusbÉèÖÃcpuµ÷Ƶ               */

+    UINT32              desClockNum;            /* δ²åusbÉèÖÃcpuµ÷ƵµÄ¸öÊý         */

+    T_ZPSM_ARMClockSet  *usbDesClock;           /* ²åÉÏusbÉèÖÃcpuµ÷Ƶ               */

+    UINT32              usbDesClockNum;         /* ²åÉÏusbÉèÖÃcpuµ÷ƵµÄ¸öÊý         */

+    T_ZOSS_CPU_Clock    *minClock;              /* Á¢¼´µ÷Ƶ                         */

+    UINT32              minClockNum;

+    ARMScaleCpu         scaleCpuPcnt;           /* cpuµ÷ƵµÄ·§Öµ                    */

+    PSM_IgnoreThread    *psmThreadName;         /* ºöÂÔÏ̵߳ÄÃû×Ö                   */

+    UINT32              psmThrdNameNum;         /* ºöÂÔÏ̵߳ĸöÊý                   */

+    UINT32              *usbSysClk;             /* ²åÉÏusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ        */

+    UINT32              usbSysClkNum;           /* ²åÉÏusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ¸öÊý    */

+    UINT32              *sysClk;                /* δ²åusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ        */

+    UINT32              sysClkNum;              /* δ²åusbʱ£¬ÏµÍ³Ö§³ÖµÄÖ÷Ƶ¸öÊý    */

+#endif

+    UINT32              chargeringSleepTime;    /* ³äµçÖÐ˯Ãßʱ¼ä£¬µ¥Î»ms           */

+}T_PSM_PARAM;

+#endif

+

+typedef struct 

+{

+    PSM_SleepHookFunc   SleepHook;  /* ϵͳ˯ÃßǰµÄ»Øµ÷º¯Êý */

+    PSM_SleepHookFunc   WakeupHook; /* ϵͳ¼¤»îºóµÄ»Øµ÷º¯Êý */

+}T_ZOSS_PSM_HOOK;

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+VOID zOss_InstallSleep(PSM_SleepFunc shallowSleep, PSM_SleepFunc deepSleep, PSM_SleepFunc kernelSleep);

+VOID zOss_InstallPsmHook(T_ZOSS_PSM_HOOK *hook);

+VOID zOss_SetBootStage(T_Psm_BootStage stage);

+VOID zOss_SetLcdPsmFlag(BOOL flag);

+UINT32 zOss_SetAppIdle(UINT32 appId);

+UINT32 zOss_SetAppActive(UINT32 appId);

+UINT32 zOss_SetPSMAppIdle(UINT32 appId);

+UINT32 zOss_SetPSMAppActive(UINT32 appId);

+UINT32 zOss_SetDevIdle(UINT32 devId);

+UINT32 zOss_SetDevActive(UINT32 devId);

+UINT32 zOss_ApplyCpuFreq(UINT32 appId, BOOL isUsed);

+UINT32 zOss_PsmClearArm1SleepTime(VOID);

+UINT32 zOss_GetSleepTimeForGui(VOID);

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _OSS_PSM_H */

+

+

diff --git a/cp/ps/plat/inc/oss/oss_pub.h b/cp/ps/plat/inc/oss/oss_pub.h
new file mode 100644
index 0000000..d052478
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_pub.h
@@ -0,0 +1,300 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_pub.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : »ù±¾ÀàÐÍ¡¢Ä£¿éºÅ¡¢´íÎóºÅ¡¢ÏûÏ¢ºÅ¶¨Òå

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-08-10 

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_PUB_H

+#define _OSS_PUB_H

+

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#if defined _OS_TOS

+#include <pkgconf/kernel.h>

+#include <cyg/hal/hal_intr.h>

+#include <cyg/kernel/kapi.h>

+#elif defined _OS_OSE

+#include "ose.h"

+#include "osetypes.h"

+#include "ose_spi/arm/cpu_intlock.h"

+#elif defined (_OS_LINUX)

+#include <linux/types.h>

+#include <linux/kernel.h>

+#include <linux/jiffies.h>

+#include <asm/param.h>

+#ifdef _USE_TCM

+#include <asm/tcm.h>

+#endif

+#elif defined _OS_WIN

+# ifndef _USE_OS_SOCK

+#define _WINSOCK2_H  

+#define _WINSOCK_H 

+#define _WINSOCK2API_ 

+#define _WINSOCKAPI_

+# endif

+#include <windows.h>

+#endif

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+/* ²Ù×÷ϵͳ´íÎóºÅ, 0x00001000 --- 0x00001fff */

+#define ZOSS_ERR                (0x00001000)

+

+

+/* ƽ̨ÏûÏ¢ */

+#define EV_ZPLAT_BASE           (0x00001000)

+

+/* ²Ù×÷ϵͳÏûÏ¢, ¸öÊý0x1000 */

+#define EV_ZOSS_BASE            (EV_ZPLAT_BASE)

+

+/* ƽ̨ÏûÏ¢Çø¼ä */

+#define EV_ZOSS_SCHE_BASE       (EV_ZOSS_BASE)

+#define EV_ZOSS_SYSM_BASE       (EV_ZOSS_BASE + 50)

+#define EV_ZOSS_EXCEP_BASE      (EV_ZOSS_BASE + 100)

+#define EV_ZOSS_TRACE_BASE      (EV_ZOSS_BASE + 150)

+#define EV_ZOSS_MEM_BASE        (EV_ZOSS_BASE + 300)

+#define EV_ZOSS_COMM_BASE       (EV_ZOSS_BASE + 350)

+

+/* ϵͳ¹ÜÀíÄ£¿éÏûÏ¢ */

+#define EV_INIT                 (EV_ZOSS_SYSM_BASE + 0) /* ÈÎÎñ³õʼ»¯ÏûÏ¢   */

+#define EV_POWERON              (EV_ZOSS_SYSM_BASE + 1) /* ÈÎÎñÉϵçÏûÏ¢     */

+#define EV_POWEROFF             (EV_ZOSS_SYSM_BASE + 2) /* ÈÎÎñϵçÏûÏ¢     */

+#define EV_POWERON_OK           (EV_ZOSS_SYSM_BASE + 3) /* ÈÎÎñÉϵçÍê³ÉÏûÏ¢ */

+#define EV_PS_START             (EV_ZOSS_SYSM_BASE + 4) /* ЭÒéÕ»Æô¶¯ÏûÏ¢   */

+#define EV_TASKSTOP             (EV_ZOSS_SYSM_BASE + 5) /* ЭÒéÕ»ÔÝÍ£ÏûÏ¢   */

+#define EV_TASKRESUM            (EV_ZOSS_SYSM_BASE + 6) /* ЭÒéÕ»»Ö¸´ÏûÏ¢   */

+#define EV_SYSM_DOWN            (EV_ZOSS_SYSM_BASE + 7) /* ¹Ø»úÏûÏ¢         */

+

+/* GUIÏûÏ¢ */

+#define EV_ZGUI_BASE            (0x00002000)

+

+/* ЭÒéÕ»²âÊÔ¹¤¾ßÏûÏ¢ */

+#define EV_ZPTE_BASE            (EV_ZPLAT_BASE + 0x00008000) 

+

+/* ϵͳ¹«¹²´òÓ¡Ä£¿éºÅ */

+#define SUBMDL_SYSBASE          (1)

+#define SUBMDL_PUB              (SUBMDL_SYSBASE + 0)    /* ϵͳ¹«¹²     */

+#define SUBMDL_RAM              (SUBMDL_SYSBASE + 1)    /* ÍùRAM´òÓ¡    */

+#define SUBMDL_FILE             (SUBMDL_SYSBASE + 2)    /* ÍùÎļþ´òÓ¡   */

+#define SUBMDL_LCD              (SUBMDL_SYSBASE + 3)    /* ÍùLCD´òÓ¡    */

+

+/* OSS´òÓ¡Ä£¿éºÅ */

+#define SUBMDL_OSSBASE          (10)

+#define SUBMDL_COMMON           (SUBMDL_OSSBASE + 0)    /* ¹«¹²Ä£¿é         */

+#define SUBMDL_OSA              (SUBMDL_OSSBASE + 1)    /* OSAÄ£¿é          */

+#define SUBMDL_SCHE             (SUBMDL_OSSBASE + 2)    /* µ÷¶ÈͨѶ         */

+#define SUBMDL_MEM              (SUBMDL_OSSBASE + 3)    /* ÄÚ´æ¹ÜÀí         */

+#define SUBMDL_SYSM             (SUBMDL_OSSBASE + 4)    /* SYSMÄ£¿é         */

+#define SUBMDL_TIMER            (SUBMDL_OSSBASE + 5)    /* ¶¨Ê±Æ÷Ä£¿é       */

+#define SUBMDL_EXCEP            (SUBMDL_OSSBASE + 6)    /* Òì³£´¦Àí         */

+#define SUBMDL_NET              (SUBMDL_OSSBASE + 7)    /* NETÄ£¿é          */

+#define SUBMDL_FS               (SUBMDL_OSSBASE + 8)    /* Îļþ´úÀíÄ£¿é     */

+#define SUBMDL_TRACE            (SUBMDL_OSSBASE + 9)    /* traceÄ£¿é        */

+#define SUBMDL_TEST             (SUBMDL_OSSBASE + 10)   /* testÄ£¿é         */

+#define SUBMDL_EVENT            (SUBMDL_OSSBASE + 11)   /* EventÄ£¿é        */

+#define SUBMDL_NV               (SUBMDL_OSSBASE + 12)   /* NV´úÀíÄ£¿é       */

+#define SUBMDL_SHELL            (SUBMDL_OSSBASE + 13)   /* SHELL´úÀíÄ£¿é    */

+#define SUBMDL_AMT              (SUBMDL_OSSBASE + 14)   /* AMT´úÀíÄ£¿é      */

+

+/* ЭÒéÕ»²âÊÔ¹¤¾ßÄ£¿éºÅ */

+#define SUBMDL_PTE              (SUBMDL_OSSBASE + 15) 

+

+/* DRV´òÓ¡Ä£¿éºÅ */

+#define SUBMDL_DRVBASE          (25)

+#define SUBMDL_DAL              (SUBMDL_DRVBASE + 0)    /* DALÄ£¿é  */

+#define SUBMDL_DD               (SUBMDL_DRVBASE + 1)    /* DDÄ£¿é   */

+#define SUBMDL_HAL              (SUBMDL_DRVBASE + 2)    /* HALÄ£¿é  */

+#define SUBMDL_MUX              (SUBMDL_DRVBASE + 3)    /* MUXÄ£¿é  */

+

+#define SUBMDL_IMS              (31)                    /* IMSÐÅÁîÄ£¿é */

+

+/* MULTIMEDIA´òÓ¡Ä£¿éºÅ */

+#define SUBMDL_MMBASE           (60)

+/* MONITOR¸ú×ÙÄ£¿éºÅ */

+#define SUBMDL_MONAGENT         (128)

+

+#define SUBMDL_Z_EXTMOD         (BYTE)0xff

+#define SUBMDL_ZPS_EXTMOD       SUBMDL_Z_EXTMOD

+

+/* FALSE/TRUE¶¨Òå */

+#ifndef _OS_WIN

+#ifdef  TRUE

+#undef  TRUE

+#endif

+#define TRUE    (BOOL)1

+            

+#ifdef  FALSE

+#undef  FALSE

+#endif

+#define FALSE   (BOOL)0

+

+/* ×î´óÖµ/×îСֵ¶¨Òå */

+#ifdef _OS_LINUX

+# define oss_max(a,b)   (((a) > (b)) ? (a) : (b))

+# define oss_min(a,b)   (((a) < (b)) ? (a) : (b))

+#else

+# define max(a,b)       (((a) > (b)) ? (a) : (b))

+# define min(a,b)       (((a) < (b)) ? (a) : (b))

+#endif

+

+#endif

+

+#ifdef _DEBUG

+# define ZOSS_FILE __FILE__

+# define ZOSS_LINE __LINE__

+#else

+# define ZOSS_FILE NULL

+# define ZOSS_LINE 0

+#endif

+

+#define ___str(x)   #x

+#define __str(x)    ___str(x)

+

+#define ZOSS_UNUSED_PARAM(_name_)   _name_ = _name_;

+#define ZOSS_UNUSED_PTR(_name_)     if (_name_) _name_ = _name_;

+#define ZOSS_MACRO_START            do {

+#define ZOSS_MACRO_END              } while (0)

+

+#define ALIGN_TO(base, align)       ((base + (align - 1)) & ~(align - 1))

+#ifndef _OS_LINUX

+#define ARRAY_SIZE(array)           (sizeof(array)/sizeof(array[0]))

+#endif

+#define ARRAY_START(array)          (&array[0])

+#define ARRAY_END(array)            (&array[sizeof(array)/sizeof(array[0])])

+

+/* 1¸öϵͳµÎ´ðËùÐèµÄºÁÃëÊý */

+#if defined _OS_TOS

+# define ZOSS_MS_PER_TICK   (CYGNUM_HAL_RTC_PERIOD / 1000)   

+#elif defined _OS_OSE

+# define ZOSS_MS_PER_TICK   (system_tick() / 1000) 

+#elif defined _OS_WIN

+# define ZOSS_MS_PER_TICK   1

+#elif defined _OS_LINUX

+# define ZOSS_MS_PER_TICK   1

+#endif

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+/* »ù±¾ÀàÐÍ */

+typedef signed char         SINT8;

+typedef unsigned char       UINT8;

+typedef short               SINT16;

+typedef unsigned short      UINT16;

+typedef long                SINT32;

+typedef UINT8               BITS;

+

+#ifndef _OS_WIN

+typedef unsigned long       UINT32;

+typedef unsigned long long  UINT64;

+typedef long long           SINT64;

+typedef float               FLOAT;

+typedef double              DOUBLE;

+typedef int                 BOOL;

+

+#ifndef VOID

+#define VOID                void

+#endif

+

+#ifndef CHAR

+#define CHAR                char

+#endif

+ 

+typedef UINT32              SSIZE_T;

+typedef UINT8               BYTE;

+typedef SINT16              SHORT;

+typedef SINT32              LONG;

+typedef UINT16              WORD;

+typedef UINT32              DWORD;

+typedef UINT32              HANDLE;

+typedef SINT8               *PSTR;

+typedef UINT8               *PBYTE;

+typedef UINT16              *PWORD;

+typedef UINT32              *PDWORD;

+typedef VOID                *PVOID;

+typedef UINT32              *PHANDLE;

+#else 

+typedef __int64             SINT64;  

+typedef unsigned __int64    UINT64;

+typedef int                 mode_t; 

+#endif

+

+#if defined (_OS_TOS) || defined(_OS_LINUX)

+typedef SINT8   S8;

+typedef UINT8   U8;

+typedef SINT16  S16;

+typedef UINT16  U16;

+typedef SINT32  S32; 

+typedef UINT32  U32;

+

+typedef UINT32  PROCESS;

+typedef UINT32  OSADDRESS;

+typedef UINT8   OSPRIORITY;

+typedef UINT32  OSTIME;

+typedef UINT32  SIGSELECT;

+typedef UINT16  OSVECTOR;

+typedef UINT32  OSUSER;

+

+typedef VOID (OSENTRYPOINT)(VOID);

+

+enum PROCESS_TYPE 

+{

+    OS_PRI_PROC = 0,

+    OS_BG_PROC  = 64,

+    OS_INT_PROC = 128,

+    OS_TI_PROC  = 256,

+    OS_PHANTOM  = 512,

+    OS_BLOCK    = 1024,

+    OS_ZOOMBIE  = 2048,

+    OS_ILLEGAL  = 4096

+};

+

+struct OS_redir_entry

+{

+    SIGSELECT   sig;

+    PROCESS     pid;

+};

+#endif

+

+#ifdef _OS_LINUX

+typedef struct {

+    int quot;   /* quotient  */

+    int rem;    /* remainder */

+} div_t;

+#endif

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/ 

+SINT32 zOss_GetLastError(VOID);

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _OSS_PUB_H */

+

+

diff --git a/cp/ps/plat/inc/oss/oss_sup.h b/cp/ps/plat/inc/oss/oss_sup.h
new file mode 100755
index 0000000..686c318
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_sup.h
@@ -0,0 +1,971 @@
+/**

+ * @file oss_sup.h

+ * @brief ossÄ£¿é¸½¼Ó¹¦ÄÜ

+ *

+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.

+ * 

+ * 

+ */

+

+#ifndef _OSS_SUP_H

+#define _OSS_SUP_H

+

+/*******************************************************************************

+ *                           Include header files                              *

+ ******************************************************************************/

+#include "ramdump.h"

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+

+/*******************************************************************************

+ *                             Macro definitions                               *

+ ******************************************************************************/

+#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/* ÉèÖûò»ñȡʼþÊôÐÔ */

+#define ZOSS_EVENTS_OR              0x00

+#define ZOSS_EVENTS_AND             0x01

+#define ZOSS_EVENTS_OR_CLEAR        0x02

+#define ZOSS_EVENTS_AND_CLEAR       0x03

+

+/* ÉèÖûص÷º¯ÊýÀàÐÍ */

+#define ZOSS_SETHOOKFLAG_MONI       0x01         /* ÏûÏ¢¼à¿Ø                 */

+#define ZOSS_SETHOOKFLAG_TRACK      0x02         /* ÏßÐÔ¸ú×Ù                 */

+#define ZOSS_SETHOOKFLAG_INTER      0x03         /* ÏûÏ¢½Ø»ñ                 */

+#define ZOSS_SETHOOK_SEND           0x01         /* zOss_SendMsgÏûÏ¢À©Õ¹     */

+#define ZOSS_SETHOOK_SEND_DATA      0x02         /* zOss_SendMsgÏûÏ¢À©Õ¹     */

+#define ZOSS_SETHOOK_GET_ALL_ID     0x03         /* zOss_GetAllTaskIDÀ©Õ¹    */

+#define ZOSS_SETHOOK_GET_ID         0x04         /* zOss_GetTaskIDÀ©Õ¹       */

+#define ZOSS_SETHOOK_GET_NAME       0x05         /* zOss_GetTaskNameÀ©Õ¹     */

+

+/* ÈÎÎñÏûϢ״̬ */

+#define ZOSS_MSGSENDTYPE_MSG        0x01         /* ·¢ËÍÏûÏ¢                 */

+#define ZOSS_MSGSENDTYPE_DATA       0x02         /* ·¢ËÍÊý¾Ý                 */

+#define ZOSS_MSGSENDTYPE_INTER      0x03         /* ÔÚÖжÏÖз¢ËÍ             */

+#define ZOSS_MSGSENDTYPE_TIMER      0x04         /* ¶¨Ê±Æ÷ÏûÏ¢               */

+

+/* ÈÎÎñ״̬»ú */

+#define ZOSS_STATUS_INIT            0x01         /* ³õʼ̬                   */

+#define ZOSS_STATUS_WORK            0x02         /* ¹¤×÷̬                   */

+#define ZOSS_STATUS_IDLE            0x03         /* ¿ÕÏÐ̬                   */

+#define ZOSS_STATUS_USERBASE        0x04         /* Óû§×´Ì¬×Ô¶¨Òå           */

+

+/* ÈÎÎñÔËÐÐ״̬ */

+#define ZOSS_STATE_STOPPED          0x01         /* ÈÎÎñÔÝÍ£                 */

+#define ZOSS_STATE_IDLE             0x02         /* ÈÎÎñ¿ÕÏÐ                 */

+#define ZOSS_STATE_READY            0x03         /* ÈÎÎñ¾ÍÐ÷                 */

+#define ZOSS_STATE_RUN              0x04         /* ÈÎÎñÔËÐÐ                 */

+

+/* ÏûÏ¢²¶»ñ·½Ïò */

+#define ZOSS_MSGDIRE_IN             0x01         /* ÊäÈëÏûÏ¢²¶»ñ             */

+#define ZOSS_MSGDIRE_OUT            0x02         /* Êä³öÏûÏ¢²¶»ñ             */

+#define ZOSS_MSGDIRE_INOUT          0x03         /* Ë«Ïò²¶»ñ                 */

+

+/* ÏûÏ¢·¢ËÍÓÅÏȼ¶ */

+#define ZOSS_QUEUE_MSG_PRI_NORMAL   0x00         /* normal priority message£¬¼´·Åµ½ÏûÏ¢¶ÓÁÐβ */

+#define ZOSS_QUEUE_MSG_PRI_URGENT   0x01         /* urgent priority message£¬¼´·Åµ½ÏûÏ¢¶ÓÁÐÊ× */

+

+/* ÅäÖòÎÊý×î´ó³¤¶È */

+#define MAX_EVENTNAME_LEN           63          /* ʼþ×éÃû³Æ×î´ó³¤¶È       */

+#define MAX_QUEUENAME_LEN           63          /* ×î´óÏûÏ¢¶ÓÁÐÃû³¤¶È       */ 

+#define ZOSS_MAX_TASKNAME_LEN       63          /* ÈÎÎñÃû³¤¶È               */

+#define SHELL_CMD_LENGTH            31          /* shellÃüÁîµÄ×î´ó³¤¶È      */

+#define SHELL_CMD_PARAM_NUM         12          /* shellÃüÁî²ÎÊýµÄ×î´ó¸öÊý  */

+#define SHELL_CMD_PARAM_LENGTH      23          /* shellÃüÁî²ÎÊýµÄ×î´ó³¤¶È  */

+

+/* ´òÓ¡ */

+#define zOss_Printf                 zTools_Printf

+#define PRINT_LEVEL_ALLWAYS         0x00        /* ±¾¼¶±ð×ÜÊÇ´òÓ¡                   */

+#define PRINT_LEVEL_DEBUG           0x01        /* µ÷ÊÔ¼¶±ð                         */

+#define PRINT_LEVEL_NORMAL          0x02        /* ÆÕͨ¼¶±ð                         */

+#define PRINT_LEVEL_SEVERE          0x03        /* ÑÏÖØ¼¶±ð                         */

+#define PRINT_LEVEL_ABNORMAL        0x04        /* Òì³£¼¶±ð                         */

+#define PRINT_LEVEL_RAM             0x05        /* ´òÓ¡µ½ÄÚ´æ,½öÔÚ´òÓ¡´úÀíÖÐʹÓà    */

+#define PRINT_LEVEL_FORBID          0xff        /* ²»´òÓ¡                           */

+

+/* NV ECC*/

+#define ZOSS_NV_ECC_LOG_NR          (6)

+#define ZOSS_NV_ECC_WORK            (1)

+#define ZOSS_NV_ECC_BACKUP          (2)

+#define ZOSS_NV_ECC_BOTH            (3)

+#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS

+

+/*******************************************************************************

+ *                             Type definitions                                *

+ ******************************************************************************/

+#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/* Ë«ÏòÁ´±íÄ£¿é */

+typedef struct tag_NODE        

+{

+    struct tag_NODE *next;      

+    struct tag_NODE *previous;  

+}T_ZOss_Node;

+

+typedef struct              

+{

+    SINT32      count;             

+    T_ZOss_Node *HEAD;

+    T_ZOss_Node *TAIL;

+}T_ZOss_List;

+

+/* »·Ðλº³åÄ£¿é */

+typedef struct     

+{

+    SINT32  pToBuf;     /* offset from start of buffer where to write next  */

+    SINT32  pFromBuf;   /* offset from start of buffer where to read next   */

+    SINT32  bufSize;    /* size of ring in bytes                            */

+    CHAR    *buf;       /* pointer to start of buffer                       */

+}T_ZOss_Ring, *T_ZOss_RingId;

+

+/* ¶¨Ê±Æ÷¹ÜÀíÄ£¿é 20130415ÒÆÖÁosa.h*/

+

+/* ITCÄ£¿é 20130523 ɾ³ý*/

+

+/* ramdump ¹Ò½Óº¯ÊýÀàÐÍ */

+typedef VOID (*T_zOss_RamdumpHookFunc)(VOID); 

+

+/* ÏûÏ¢¹ÜÀíÄ£¿é */

+typedef struct

+{

+    T_ZOss_Node     node;

+    ZOSS_TASK_ID    t_task_id;      /* Ä¿±êÈÎÎñID   */

+    ZOSS_TASK_ID    s_task_id;      /* Ô´ÈÎÎñID     */

+    UINT32          msgID;          /* ÏûÏ¢ID       */

+    UINT16          msgLen;         /* ÏûÏ¢Ì峤¶È   */

+    UINT8           send_state;     /* ÏûÏ¢·¢ËÍ״̬ */

+}T_ZOss_TaskMsgHead;                /* ÏûϢͷ       */

+

+typedef struct

+{

+    VOID    *msgbuf;

+    UINT16  msgLenEX;

+}T_ZOss_TaskMsg;        /* ÏûÏ¢Ìå */

+

+typedef UINT32 (*TASK_SEND_HOOK)(T_ZOss_TaskMsgHead *buf, UINT8 dire);

+

+/* ÈÎÎñ¹ÜÀíÄ£¿é */                    

+typedef VOID (*FUNC_TASKENTRY)(UINT8 state, UINT32 msg_id, UINT8 *buf, UINT16 msg_len, UINT8 *private_data);

+

+typedef struct struTCB

+{

+    T_ZOss_Node     node;                                   /* Ë«ÏòÁ´±í½áµã                             */

+    UINT32          type;                                   /* Çø·ÖÊÇ·ñSDLÈÎÎñ                          */

+    UINT32          count;                                  /* ÈÎÎñÖ´ÐеĴÎÊý                           */

+    CHAR            task_name[ZOSS_MAX_TASKNAME_LEN + 1];   /* ÈÎÎñÃû,³¤¶È×î´ó63                        */

+    FUNC_TASKENTRY  taskEntry;                              /* ÈÎÎñÈë¿Ú                                 */

+    TASK_SEND_HOOK  HookEntry[3];                           /* »Øµ÷º¯Êý                                 */

+    ZOSS_TASK_ID    task_id;                                /* ÈÎÎñID                                   */

+    ZOSS_TASK_ID    sender_task_id;                         /* ÏûÏ¢Ô´ÈÎÎñID                             */

+    ZOSS_THREAD_ID  thread_id;                              /* ËùÔÚÏß³ÌID                               */

+    T_ZOss_List     msg_queue;                              /* ÈÎÎñÏûÏ¢¶ÓÁÐÁ´±í                         */

+    UINT32          stack_size;                             /* ¶ÑÕ»´óС                                 */

+    UINT32          priority;                               /* ÈÎÎñÓÅÏȼ¶(0-31)                         */

+    UINT32          private_data_len;                       /* ˽ÓÐÊý¾Ý³¤¶È                             */

+    UINT32          time;                                   /* ÈÎÎñ´´½¨Ê±¼ä                             */

+    UINT32          stack_used;                             /* ÒÑÓöÑÕ»´óС                             */

+    UINT32          task_time;                              /* ÈÎÎñ¿ªÊ¼Ê±¼ä                             */

+    UINT32          msg_id;                                 /* µ±Ç°ÈÎÎñÏûÏ¢ID                           */

+    UINT8           dire[4];                                /* ÏûÏ¢²¶»ñ·½Ïò                             */

+    UINT8           thread_no;                              /* Ï̺߳Š                                  */

+    UINT8           run_status;                             /* ÔËÐÐ×´¿ö                                 */

+    UINT8           state;                                  /* ÈÎÎñ״̬                                 */

+    UINT8           *taskData;                              /* ÈÎÎñÊý¾ÝÇøÖ¸Õë                           */

+    struct struTCB  *next;

+    UINT32          cputime;                                /* ÈÎÎñÔËÐÐcpuʱ¼ä                          */

+    FLOAT           cpupercent;                             /* ÈÎÎñcpuÕ¼ÓÃÂÊ                            */

+    UINT32          runtime;                                /* ÈÎÎñÔËÐÐʱ¼ä                             */

+    UINT32          malloc_size;                            /* ÈÎÎñËùÓÃmalloc´óС                       */

+    UINT32          ub_size;                                /* ÈÎÎñËùÓÃÄÚ´æ³Ø´óС                       */

+    UINT8           reserved[4];                            /* ±£Áô룬µÚÒ»¸ö×Ö½ÚΪϵͳ¾²Ì¬ÈÎÎñ±ê־λ   */

+}T_ZOss_TCB;                      /* ÈÎÎñ¿ØÖÆ¿é */

+

+typedef struct 

+{

+    UINT8           is_use;

+    CHAR            task_name[ZOSS_MAX_TASKNAME_LEN + 1];

+    FUNC_TASKENTRY  task_entry;

+    UINT32          priority;

+    UINT32          stack_size;

+    UINT32          private_data_len;

+    UINT8           process_no;

+    UINT8           ack_flag;

+#ifdef _USE_HAL_HRDTST

+    BOOL            hardTestFlag;

+#endif

+}T_ZOss_TaskTabItem;    /* ÈÎÎñµÇ¼Ç±í */

+

+/* SDLÈÎÎñ */

+typedef struct 

+{

+    T_ZOss_Node     node;           /* ±£Áô             */

+    UINT32          type;           /* Çø·ÖÊÇ·ñSDLÈÎÎñ  */

+    SINT32          index;          /* Ë÷Òý             */

+    UINT32          self_id;

+    ZOSS_THREAD_ID  thread_id;      /* ËùÔÚÏß³ÌID       */

+    VOID            *self;

+    TASK_SEND_HOOK  HookEntry[3];   /* »Øµ÷º¯Êý         */

+    UINT8           dire[4];        /* ÏûÏ¢²¶»ñ·½Ïò     */

+}T_ZOss_SDLTCB;                     /* SDLÈÎÎñ¿ØÖÆ¿é    */    

+

+typedef struct signalcode_desc 

+{

+    UINT32  selfid;

+    CHAR    task_name[ZOSS_MAX_TASKNAME_LEN + 1];

+} T_ZOss_SignalCode_Desc;

+

+typedef struct 

+{

+    UINT32          selfid;

+    ZOSS_TASK_ID    task_id;

+}tasksdl_desc;

+/* shellÃüÁî */

+typedef struct 

+{

+    CHAR    cmd[SHELL_CMD_LENGTH + 1];                              /* ÃüÁî×Ö·û´®³¤¶È       */

+    CHAR    para[SHELL_CMD_PARAM_NUM][SHELL_CMD_PARAM_LENGTH + 1];  /* ²ÎÊý                 */

+    UINT32  paraCount;                                              /* ²ÎÊý¸öÊý             */

+}T_Shell_CommandMessage;                                            /* sehllÃüÁîÏûÏ¢½á¹¹Ìå  */

+

+typedef VOID (*Shell_Func)(T_Shell_CommandMessage *CmdMsg);         /* shellÃüÁîʵÏÖº¯ÊýÖ¸Õë */

+

+/* ¶¯Ì¬ÅäÖÃÀàÐͶ¨Òå */

+typedef struct 

+{

+    UINT8 (*pPrioMap)[32];

+}T_OSA_PARAM;

+

+typedef struct 

+{

+    UINT32          ub_pool_num;    /* ÄÚ´æ³Ø¸öÊý, ×î´ó²»Äܳ¬¹ý255  */

+    T_ZOss_UBPOOL   *UBPool;        /* ÄÚ´æ³ØÅäÖñíÖ¸Õë             */

+}T_MEM_PARAM;                       /* ÄÚ´æÄ£¿é                     */

+

+typedef struct 

+{

+    UINT32  max_task_num;           /* ×î´óÈÎÎñÊý                   */

+    UINT32  max_schthread_num;      /* µ÷¶ÈÏß³ÌÊý£¬×î¶à10           */

+    UINT32  max_msg_queue_len;      /* ÈÎÎñÏûÏ¢¶ÓÁг¤¶È             */

+    UINT32  deadloop_time;          /* ËÀÑ­»·ÅжÏʱ¼ä, µ¥Î»s        */

+}T_TASK_PARAM;                      /* ÈÎÎñÄ£¿é                     */

+

+typedef struct 

+{

+    UINT32  SchPrio;                /* ¶¨Ê±Æ÷µ÷¶ÈÏß³ÌÓÅÏȼ¶0-9                                              */

+    UINT32  CallBackStack;          /* ¶¨Ê±Æ÷»Øµ÷º¯ÊýÏ̶߳ÑÕ»                                               */

+    UINT32  CallBackPrio;           /* ¶¨Ê±Æ÷»Øµ÷º¯ÊýÏß³ÌÓÅÏȼ¶£¬±ØÐëµÍÓÚµ÷¶ÈÏß³ÌÓÅÏȼ¶£¬Ò»°ãΪSchPrio+1    */

+    UINT32  MinTimeLen;             /* ¶¨Ê±Æ÷×îСµÄ³¬Ê±Ê±¼ä,µ¥Î»ºÁÃë                                        */

+    UINT32  MaxTimeNum;             /* ×î´ó¶¨Ê±Æ÷¸öÊý                                                       */

+}T_TIMER_PARAM;                     /* ¶¨Ê±Æ÷Ä£¿é                                                           */

+

+typedef struct 

+{

+    UINT32  DeadLoopCheckTime;      /* ËÀÑ­»·¼ì²éʱ¼ä                   */

+    UINT32  UpdateCPUTime;          /* Ë¢ÐÂCPUʹÓÃÂÊʱ¼ä                */

+    UINT32  DeamonStartTime;        /* ϵͳ³õʼ»¯ºóExcepÈÎÎñÆô¶¯µÄʱ¼ä  */

+}T_EXCEP_PARAM;                     /* Ò쳣ģ¿é                         */

+

+typedef struct 

+{

+    T_ZOss_TaskTabItem  *pSysm_TaskItemTab;

+    UINT32              task_num;

+}T_SYSM_PARAM;  /* sysmÄ£¿é */

+

+typedef struct 

+{

+    UINT32  *pNvAddrCfg;

+    UINT32  addrCfgNum;

+    VOID    *pRevNvCfg;

+    UINT32  revNvCfgNum;

+    UINT32  NV_Work_Area_Base_Addr;       /* NV¹¤×÷Çø»ùµØÖ·       */

+    UINT32  NV_Start_Backup_Base_Addr;    /* ±¸·Ý¿éµÄÆðʼµØÖ·     */

+    UINT32  NV_Backup_Area_Base_Addr;     /* NV±¸·ÝÇø»ùµØÖ·       */    

+    UINT32  NV_Backup_Area_Size;          /* NV±¸·ÝÇø´óС         */

+    UINT32  NV_Factory_Area_Base_Addr;    /* NV³ö³§Çø»ùµØÖ·       */

+    UINT32  NV_Factory_Area_Size;         /* NV³ö³§Çø´óС         */

+    UINT32  NV_Work_Area_Symbol_Addr;     /* ¹¤×÷ÇøÐ´±ê־λµØÖ·   */

+    UINT32  NV_Backup_Area_Symbol_Addr;   /* ±¸·ÝÇøÐ´±ê־λµØÖ·   */

+    UINT32  NV_Factory_Area_Symbol_Addr;  /* ³ö³§Çø±ê־λµØÖ·     */

+    UINT32  NV_Reset_Factory_Symbol_Addr; /* »Ö¸´³ö³§ÉèÖñêÖ¾µØÖ· */

+    UINT32  NV_Ecc_log_Addr;              /* Ecc Log¹¤×÷ÇøµØÖ·    */

+    UINT32  NV_Block_Size;                /* ¿é´óС               */

+}T_NVRAM_PARAM;                           /* NVRAMÇøÓòµØÖ·ÐÅÏ¢    */

+

+typedef struct

+{

+    UINT8  count;

+    UINT8  index;

+    UINT8  type[ZOSS_NV_ECC_LOG_NR];

+    UINT32 tick[ZOSS_NV_ECC_LOG_NR];

+    UINT32 addr[ZOSS_NV_ECC_LOG_NR];

+}T_ZOss_NvEccLog;

+

+typedef struct

+{

+    UINT32  Work_Area_Base_Addr;       /* vSIM¹¤×÷Çø»ùµØÖ·   */

+    UINT32  Backup_Area_Base_Addr;     /* vSIM±¸·ÝÇø»ùµØÖ·   */    

+    UINT32  Factory_Area_Base_Addr;    /* vSIM³ö³§Çø»ùµØÖ·   */

+    UINT32  Area_Size;                 /* vSIMµ¥¸öÇø´óС     */

+    UINT32  Work_Area_Symbol_Addr;     /* ¹¤×÷ÇøÐ´±ê־λµØÖ· */

+    UINT32  Backup_Area_Symbol_Addr;   /* ±¸·ÝÇøÐ´±ê־λµØÖ· */

+    UINT32  Factory_Area_Symbol_Addr;  /* ³ö³§Çø±ê־λµØÖ·   */

+}T_vSIM_PARAM;

+

+typedef struct 

+{

+    CHAR    WinDisk[4];    /* windowsÅÌ·û      */

+    CHAR    LinuxPath[20]; /* ÀàlinuxÉ豸Ãû    */

+    CHAR    Format[20];    /* ÎļþϵͳÀàÐÍ     */

+    CHAR    Device[20];    /* É豸Ãû           */

+    CHAR    Params[100];   /* Ïà¹Ø²ÎÊý         */

+    CHAR    Manager[40];   /* ¹ÜÀíÏß³ÌÃû       */

+}T_OSA_DISKMAP;

+

+typedef struct 

+{

+    T_OSA_DISKMAP   *diskMap;

+    UINT32          diskNum;

+}T_DISK_PARAM;

+

+typedef VOID (*ramdump_Hook)(VOID);

+

+typedef struct

+{

+    ramdump_Hook ramdump_Process_PreHook;

+    ramdump_Hook ramdump_Process_AftHook;

+}T_zOss_RamdumpOpt;

+

+

+typedef VOID (*ramdump_IoInit)(VOID);

+typedef VOID (*ramdump_IoReadData)(UINT8 *buffer, UINT32 size);

+typedef VOID (*ramdump_IoWriteData)(UINT8 *buffer, UINT32 size);

+typedef VOID (*ramdump_IoFinish)(VOID);

+

+typedef struct

+{

+    ramdump_IoInit      init;

+    ramdump_IoReadData  read;

+    ramdump_IoWriteData write;

+    ramdump_IoFinish    finish;

+} T_zOss_RamdumpIoOpt;

+

+typedef struct

+{

+    UINT32  baseForServer;

+    UINT32  baseForSelf;

+    UINT32  baseForCopy;

+    UINT32  size;

+} T_zOss_RamdumpRegion;

+

+typedef struct 

+{

+    T_OSA_PARAM     OsaCfg;     /* osaÅäÖÃ              */

+    T_DISK_PARAM    DiskMap;    /* ´ÅÅÌÓ³ÉäÅäÖà         */

+    T_MEM_PARAM     MemCfg;     /* ÄÚ´æÅäÖà             */

+    T_TASK_PARAM    TaskCfg;    /* ÈÎÎñÅäÖà             */

+    T_TIMER_PARAM   TimerCfg;   /* ¶¨Ê±Æ÷ÅäÖà           */

+    T_EXCEP_PARAM   ExcepCfg;   /* Òì³£ÅäÖà             */

+    T_SYSM_PARAM    SysmCfg;    /* sysmtÅäÖÃ            */

+    T_NVRAM_PARAM   NvramCfg;   /* NvÅäÖÃ               */

+    T_vSIM_PARAM    vSIMCfg;    /* vSimÅäÖÃ             */

+#ifdef _USE_PSM

+#ifdef _USE_PSM_NEW_FRAMEWORK

+    T_zPsm_Param    PsmCfg;     /* PsmÅäÖÃ              */

+#else

+    T_PSM_PARAM     PsmCfg;     /* PsmÅäÖÃ              */

+#endif

+#endif

+}T_OSS_PARAM;                   /* Õû¸öOSS¶¯Ì¬ÅäÖÃÀàÐÍ  */

+

+typedef enum 

+{

+    SYS_RESET_TO_NORMAL,

+    SYS_RESET_TO_CHARGER,

+    SYS_RESET_TO_ALRAM,

+    SYS_RESET_TO_EXCEPTRESET,

+    SYS_MAX_RESET_TYPE,

+} T_ZOssSys_RESET_TYPE;

+#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS

+

+/*******************************************************************************

+ *                       Global variable declarations                          *

+ ******************************************************************************/

+

+

+/*******************************************************************************

+ *                       Global function declarations                          *

+ ******************************************************************************/

+#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/* OSAÄ£¿é³õʼ»¯ */

+UINT32 OSA_Init(VOID);

+

+/* ϵͳ¹ÜÀíÄ£¿é */

+UINT32 zOss_Init(VOID);

+UINT32 zOss_TaskInit(VOID);

+UINT32 zOss_Start(VOID);

+VOID zOss_TaskStartOK(VOID);

+UINT32 zOss_SysPowerdown(VOID);

+VOID zOss_SysSoftReset(T_ZOssSys_RESET_TYPE type);

+T_OSS_PARAM *zOss_GetOssCfg(VOID);

+

+/* ÈÎÎñ¹ÜÀíÄ£¿é */

+UINT32 zOss_Task_HookSet(UINT8 type, VOID *HookFunc);

+ZOSS_TASK_ID zOss_CreateTask(const CHAR *task_name, FUNC_TASKENTRY task_entry, UINT32 stack_size, UINT32 priority, UINT32 private_data_len, UINT8 pno);

+UINT32 zOss_DeleteTask(ZOSS_TASK_ID task_id);

+UINT32 zOss_GetTaskInfo(ZOSS_TASK_ID task_id, T_ZOss_TCB *task_info);

+CHAR *zOss_GetTaskName(ZOSS_TASK_ID task_id);

+UINT32 zOss_GetAllTaskID(ZOSS_TASK_ID *task_id_arr);

+ZOSS_TASK_ID zOss_GetTaskID(const CHAR *task_name);

+ZOSS_TASK_ID zOss_GetSelfTaskID(VOID);

+UINT32 zOss_SetState(UINT8 next_state);

+UINT32 zOss_RegTaskSendHook(ZOSS_TASK_ID task_id, UINT8 hooktype, UINT8 dire, TASK_SEND_HOOK intercept_Entry);

+UINT32 zOss_TaskSend(UINT32 msg_id, const VOID *msg_buf, UINT16 msg_len, ZOSS_TASK_ID task_id);

+UINT32 zOss_TaskSendData(UINT32 msg_id, VOID *buf, UINT16 msg_len, ZOSS_TASK_ID task_id);

+ZOSS_TASK_ID zOss_Sender(VOID);

+

+/* ramdump */

+#ifdef _USE_MULTI_CORE_RAMDUMP

+VOID zOss_RamdumpSetOperation(T_zOss_RamdumpOpt *funcObjPtr);

+VOID zOss_RamdumpConfigureMem(T_zOss_RamdumpRegion *regionInfo);

+#else

+VOID zOss_RamdumpConfigureMem(UINT32 base, UINT32 size, UINT32 map_base, UINT32 copy_base);

+VOID zOss_RamdumpHookInstall(T_zOss_RamdumpHookFunc hook);

+#endif

+VOID zOss_RamdumpSetIoOpt(T_zOss_RamdumpIoOpt hook);

+

+/* NV²Ù×÷½Ó¿Ú */

+UINT32 zOss_NvItemWrite(UINT32 NvItemID, UINT8 *NvItemData, UINT32 NvItemLen);

+UINT32 zOss_NvItemRead(UINT32 NvItemID, UINT8 *NvItemData, UINT32 NvItemLen);

+UINT32 zOss_ResetNVFactory(VOID);

+UINT32 zOss_NvramFlush(VOID);

+VOID zOss_NvSetErrorAddr(UINT32 addr);

+BOOL zOss_NvInResume(VOID);

+VOID zOss_NvCheck(VOID);

+VOID zOss_NvWriteFactory(VOID);

+VOID zOss_NvScanBackUpArea(VOID);

+UINT32 zOss_NvGetEccLogInfo(T_ZOss_NvEccLog *logInfo);

+UINT32 zOss_ChangeNvroAttr(int writable);

+UINT32 Nvram_Flush(VOID);

+UINT32 Nvram_Finish(VOID);

+

+/* VSIM²Ù×÷½Ó¿Ú */

+UINT32 zOss_vSIMInit(VOID);

+UINT32 zOss_vSIMDataRead(UINT32 addr, VOID *data, UINT32 len);

+UINT32 zOss_vSIMDataWrite(UINT32 addr, VOID *data, UINT32 len);

+UINT32 zOss_vSIMFacWrite(VOID *data, UINT32 len);

+UINT32 zOss_vSIMRecovery(VOID);

+

+/* ´òÓ¡ */

+UINT32 zTools_Printf(UINT32 nModNo, UINT8 nPrintLevel, const VOID *pFormat, ...);

+VOID zOss_RamLog(CHAR *rambuf, UINT32 restrict);

+VOID zOss_RamPrintf(VOID);

+

+/* ά²â */

+UINT32 zOss_DebugInfoRecord(UINT32 id, const VOID *pFormat, ...);

+

+/* shellÄ£¿é */

+UINT32 zOss_AddShellCmd(const CHAR *cmd_name, const Shell_Func func, const CHAR *description);

+

+/* ¿´ÃŹ· */

+VOID zOss_WatchDogEnable(BOOL enable);

+

+/* CRCУÑé */

+UINT8 Comm_CrcCalc(const UINT8 *buf, UINT8 len);

+SINT32 Comm_CrcCheck(UINT8 *buf, UINT8 len, UINT8 crc);

+

+/* µãµÆÄ£¿é */

+VOID zOss_SetTransDataFlag(VOID);

+BOOL zOss_GetTransDataFlag(VOID);

+

+/* ʼþ×é */

+ZOSS_EVENT_ID zOss_CreateEvent(const CHAR *name);

+UINT32 zOss_GetEvent(ZOSS_EVENT_ID eventId, UINT32 events, UINT32 getOptions, UINT32 *pEventsReceived, UINT32 timeout);

+UINT32 zOss_SetEvent(ZOSS_EVENT_ID eventId, UINT32 events, UINT32 setOptions);

+UINT32 zOss_DeleteEvent(ZOSS_EVENT_ID eventId);

+UINT32 zOss_QueryEvent(ZOSS_EVENT_ID eventId);

+BOOL   zOss_WaitingEvent(ZOSS_EVENT_ID eventId);

+

+/* »·Ðλº³å */ 

+BOOL zOss_RingIsEmpty(T_ZOss_RingId ring_id); 

+BOOL zOss_RingIsFull(T_ZOss_RingId ring_id);

+T_ZOss_RingId zOss_RingCreate(SINT32 nbytes); 

+SINT32 zOss_RingBufGet(T_ZOss_RingId ring_id, CHAR *buffer, SINT32 maxbytes); 

+SINT32 zOss_RingBufPut(T_ZOss_RingId ring_id, CHAR *buffer, SINT32 nbytes);

+SINT32 zOss_RingFreeBytes(T_ZOss_RingId ring_id);

+SINT32 zOss_RingNBytes(T_ZOss_RingId ring_id);

+VOID zOss_RingDelete(T_ZOss_RingId ring_id);

+VOID zOss_RingFlush(T_ZOss_RingId ring_id);

+VOID zOss_RingMoveAhead(T_ZOss_RingId ring_id, SINT32 n);

+VOID zOss_RingPutAhead(T_ZOss_RingId ring_id, CHAR byte, SINT32 offset);

+

+/* ÏûÏ¢¶ÓÁÐ */

+ZOSS_QUEUE_ID zOss_QueueCreate(const CHAR *queue_name, UINT32 maxMsgs, UINT32 maxMsgLen);

+UINT32 zOss_QueueSend(ZOSS_QUEUE_ID queue_id, VOID *msg_ptr, UINT32 size, UINT32 timeout, UINT32 priority);

+UINT32 zOss_QueueRecv(ZOSS_QUEUE_ID queue_id, VOID *buffer, UINT32 maxsize, UINT32 timeout);

+UINT32 zOss_QueueFreeCount(ZOSS_QUEUE_ID queue_id);

+UINT32 zOss_QueueDelete(ZOSS_QUEUE_ID queue_id);

+

+/* ¹ÜµÀ */

+UINT32 zOss_PipeDevCreate(const CHAR *name, SINT32 nBytes);

+UINT32 zOss_PipeDevDelete(const CHAR *name, BOOL force);

+

+/* Cahce½Ó¿Ú */

+VOID zOss_CacheCleanRange(UINT32 base, UINT32 size);

+VOID zOss_CacheInvalidateRange(UINT32 base, UINT32 size);

+VOID zOss_CacheCleanRangeFast(UINT32 base, UINT32 size);

+VOID zOss_CacheInvalidateRangeFast(UINT32 base, UINT32 size);

+VOID zOss_IoRemapPages(VOID *base, UINT32 size);

+

+/* svÉèÖûñÈ¡½Ó¿Ú */

+UINT8 zOss_GetSvConfig(VOID);

+VOID zOss_SetSvConfig(UINT8 sv);

+

+/* ¶¨Ê±Æ÷¹ÜÀíÄ£¿é */

+#ifdef _USE_PSM

+VOID zOss_SetTimer_PsmFlag(ZOSS_TIMER_ID time_id, BOOL Flag);

+UINT32 zOss_GetPs_SleepTimer(VOID);

+#endif

+

+#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS

+

+/**

+ * @brief ÉèÖ÷ÇÖÜÆÚÐÔÈÎÎñ¶¨Ê±Æ÷

+ * @param time_len  Èë²Î£¬Ê±³¤£¬µ¥Î»£ºms

+ * @param msg_id    Èë²Î£¬¶¨Ê±µ½ºó,·¢Ë͸øÉèÖö¨Ê±Æ÷ÈÎÎñµÄÏûÏ¢id

+ * @param arg       Èë²Î£¬¸½¼Ó²ÎÊý,¶¨´«µÝ¸øÈÎÎñÈë¿Úº¯ÊýµÄbufÐβδËʱmsg_lenֵΪ4(sizeof(UINT32/arg))

+ * @return ³É¹¦:ÏàÓ¦µÄ¶¨Ê±Æ÷±êʶ; ʧ°Ü:ZOSS_INVALID_TIMER_ID

+ * @retval ZOSS_TIMER_IDÀàÐ͵ıêʶ    ³É¹¦

+ * @retval ZOSS_INVALID_TIMER_ID      ʧ°Ü

+ * @note  ÉèÖÃʱ¿ÌΪ²Î¿¼µã,¾­¹ýÖ¸¶¨Ê±¼äºó, ÏòÉèÖö¨Ê±Æ÷µÄÈÎÎñ·¢ËÍÖ¸¶¨ÏûÏ¢²¢×Ô¶¯ÊͷŶ¨Ê±Æ÷ËùÕ¼×ÊÔ´

+ * @warning  ±ØÐèÔÚÈÎÎñÄÚµ÷ÓÃ

+ */

+ZOSS_TIMER_ID zOss_SetRelativeTimer(UINT32 time_len, UINT32 msg_id, UINT32 arg);

+

+/**

+ * @brief ÉèÖ÷ÇÖÜÆÚÐÔÈÎÎñ¶¨Ê±Æ÷ÏòÄ¿±êÈÎÎñ·¢ËÍÏûÏ¢

+ * @param time_len       Èë²Î£¬Ê±³¤£¬µ¥Î»£ºms

+ * @param msg_id         Èë²Î£¬¶¨Ê±µ½ºó,·¢Ë͸øÉèÖö¨Ê±Æ÷ÈÎÎñµÄÏûÏ¢id

+ * @param arg            Èë²Î£¬¸½¼Ó²ÎÊý,¶¨´«µÝ¸øÈÎÎñÈë¿Úº¯ÊýµÄbufÐβδËʱmsg_lenֵΪ4(sizeof(UINT32/arg))

+ * @param desk_task_id   Èë²Î£¬Ö¸¶¨Ä¿±êÈÎÎñ£¬Èç¹ûÄ¿±êÈÎÎñΪ¿Õʱ£¬½«·¢ËÍÉèÖö¨Ê±Æ÷µÄÈÎÎñ

+ * @return ³É¹¦:ÏàÓ¦µÄ¶¨Ê±Æ÷±êʶ; ʧ°Ü:ZOSS_INVALID_TIMER_ID

+ * @retval ZOSS_TIMER_IDÀàÐ͵ıêʶ    ³É¹¦

+ * @retval ZOSS_INVALID_TIMER_ID      ʧ°Ü

+ * @note 

+ * @warning 

+ */

+ZOSS_TIMER_ID zOss_SetRelativeTimerByTaskId(UINT32 time_len, UINT32 msg_id, UINT32 arg, ZOSS_TASK_ID desk_task_id);

+

+/**

+ * @brief ÉèÖÃÖÜÆÚÐÔÈÎÎñ¶¨Ê±Æ÷

+ * @param time_len  Èë²Î£¬Ê±³¤£¬µ¥Î»£ºms

+ * @param msg_id    Èë²Î£¬¶¨Ê±µ½ºó,·¢Ë͸øÉèÖö¨Ê±Æ÷ÈÎÎñµÄÏûÏ¢id

+ * @param arg       Èë²Î£¬¸½¼Ó²ÎÊý,¶¨´«µÝ¸øÈÎÎñÈë¿Úº¯ÊýµÄbufÐβδËʱmsg_lenֵΪ4(sizeof(UINT32/arg))

+ * @return ³É¹¦:ÏàÓ¦µÄ¶¨Ê±Æ÷±êʶ; ʧ°Ü:ZOSS_INVALID_TIMER_ID

+ * @retval ZOSS_TIMER_IDÀàÐ͵ıêʶ    ³É¹¦

+ * @retval ZOSS_INVALID_TIMER_ID      ʧ°Ü

+ * @note  ÉèÖÃʱ¿ÌΪ²Î¿¼µã,¾­¹ýÖ¸¶¨Ê±¼äºó, ÏòÉèÖö¨Ê±Æ÷µÄÈÎÎñ·¢ËÍÖ¸¶¨ÏûÏ¢²¢×Ô¶¯ÊͷŶ¨Ê±Æ÷ËùÕ¼×ÊÔ´

+ * @warning ±ØÐèÔÚÈÎÎñÄÚµ÷ÓÃ

+ */

+ZOSS_TIMER_ID zOss_SetLoopTimer(UINT32 time_len, UINT32 msg_id, UINT32 arg);

+

+/**

+ * @brief ÉèÖÃÖÜÆÚÐÔÈÎÎñ¶¨Ê±Æ÷ÏòÄ¿±êÈÎÎñ·¢ËÍÏûÏ¢

+ * @param time_len       Èë²Î£¬Ê±³¤£¬µ¥Î»£ºms

+ * @param msg_id         Èë²Î£¬¶¨Ê±µ½ºó,·¢Ë͸øÉèÖö¨Ê±Æ÷ÈÎÎñµÄÏûÏ¢id

+ * @param arg            Èë²Î£¬¸½¼Ó²ÎÊý,¶¨´«µÝ¸øÈÎÎñÈë¿Úº¯ÊýµÄbufÐβδËʱmsg_lenֵΪ4(sizeof(UINT32/arg))

+ * @param desk_task_id   Èë²Î£¬Ö¸¶¨Ä¿±êÈÎÎñ£¬Èç¹ûÄ¿±êÈÎÎñΪ¿Õʱ£¬½«·¢ËÍÉèÖö¨Ê±Æ÷µÄÈÎÎñ

+ * @return ³É¹¦:ÏàÓ¦µÄ¶¨Ê±Æ÷±êʶ; ʧ°Ü:ZOSS_INVALID_TIMER_ID

+ * @retval ZOSS_TIMER_IDÀàÐ͵ıêʶ    ³É¹¦

+ * @retval ZOSS_INVALID_TIMER_ID      ʧ°Ü

+ * @note  

+ * @warning 

+ */

+ZOSS_TIMER_ID zOss_SetLoopTimerByTaskId(UINT32 time_len, UINT32 msg_id, UINT32 arg, ZOSS_TASK_ID desk_task_id);

+

+/**

+ * @brief ´´½¨¶¨Ê±Æ÷º¯Êý

+ * @param tm_name        Èë²Î£¬¶¨Ê±Æ÷Ãû³Æ

+ * @param tm_callback    Èë²Î£¬¶¨Ê±µ½ºóÐèÒªµ÷ÓõĻص÷º¯Êý

+ * @param tm_param       Èë²Î£¬»Øµ÷º¯ÊýµÄÈë²Î

+ * @param bPeriod        Èë²Î£¬TRUE£ºÖÜÆÚÐÔ¶¨Ê±Æ÷£»FALSE£º·ÇÖÜÆÚÐÔ¶¨Ê±Æ÷

+ * @return ³É¹¦:ÏàÓ¦µÄ¶¨Ê±Æ÷±êʶ; ʧ°Ü:ZOSS_INVALID_TIMER_ID

+ * @retval ZOSS_TIMER_IDÀàÐ͵ıêʶ    ³É¹¦

+ * @retval ZOSS_INVALID_TIMER_ID      ʧ°Ü

+ * @note  ´´½¨ºÃÖ®ºó¿ÉÒÔµ÷ÓÃzOss_StartTimer()Æô¶¯¶¨Ê±Æ÷

+ * @warning 

+ */

+ZOSS_TIMER_ID zOss_CreateTimer(const CHAR *tm_name, ZOSS_TIMER_FUN tm_callback, SINT32 tm_param, BOOL bPeriod);

+

+/**

+ * @brief Æô¶¯¶¨Ê±Æ÷º¯Êý,Æô¶¯Ê±¿ÌΪ²Î¿¼µã,¾­¹ýÖ¸¶¨Ê±¼äºó,µ÷Óûص÷º¯Êý

+ * @param timer_id        Èë²Î£¬¶¨Ê±Æ÷id

+ * @param time_len        Èë²Î£¬¶¨Ê±Æ÷ʱ³¤£¬µ¥Î»£ºms

+ * @param tm_callback     Èë²Î£¬¶¨Ê±µ½ºóÒªµ÷ÓõĻص÷º¯Êý

+ * @param tm_param        Èë²Î£¬»Øµ÷º¯ÊýµÄÈë²Î

+ * @return ³É¹¦:ZOSS_SUCCESS;ʧ°ÜZOSS_ERROR

+ * @retval ZOSS_SUCCESS    ³É¹¦

+ * @retval ZOSS_ERROR      ʧ°Ü

+ * @note

+ * @warning  Èç¹û»Øµ÷º¯ÊýÖ´ÐÐʱ¼ä´óÓÚ¶¨Ê±Æ÷ʱ³¤,¿ÉÄÜ»áÔì³É´íÎó»ò¶¨Ê±Æ÷²»±»ÕýÈ·µ÷¶È

+ */

+UINT32 zOss_StartTimer(ZOSS_TIMER_ID timer_id, UINT32 time_len, ZOSS_TIMER_FUN tm_callback, SINT32 tm_param);

+

+/**

+ * @brief Í£Ö¹¶¨Ê±Æ÷¼ÆÊ±º¯Êý

+ * @param timer_id        Èë²Î£¬¶¨Ê±Æ÷id

+ * @return ³É¹¦:ZOSS_SUCCESS;ʧ°ÜZOSS_ERROR

+ * @retval ZOSS_SUCCESS    ³É¹¦

+ * @retval ZOSS_ERROR      ʧ°Ü

+ * @note 

+ * @warning 

+ */

+UINT32 zOss_StopTimer(ZOSS_TIMER_ID timer_id);

+

+/**

+ * @brief ÔÝÍ£Ö¸¶¨¶¨Ê±Æ÷µÄ¼ÆÊ±

+ * @param timer_id        Èë²Î£¬¶¨Ê±Æ÷id

+ * @return ³É¹¦:ZOSS_SUCCESS;ʧ°ÜZOSS_ERROR

+ * @retval ZOSS_SUCCESS    ³É¹¦

+ * @retval ZOSS_ERROR      ʧ°Ü

+ * @note  ÔÝÍ£µÄͬʱ¼Ç¼ÏÂÊ£ÓàµÄÏà¶Ôʱ¼ä£¬µ÷ÓÃzOss_ResumeTime()º¯Êýºó¼ÌÐø¼ÆÊ±£»

+                Èç¹û¶¨Ê±Æ÷ÕýÔÚ±»µ÷¶È,ÔòÖ´ÐÐÍ굱ǰµ÷¶ÈºóÔÝÍ£¼ÆÊ±¡£

+ * @warning 

+ */

+UINT32 zOss_PauseTimer(ZOSS_TIMER_ID timer_id);

+

+/**

+ * @brief ʹÔÝÍ£µÄ¶¨Ê±Æ÷¼ÌÐø¼ÆÊ±

+ * @param timer_id        Èë²Î£¬¶¨Ê±Æ÷id

+ * @return ³É¹¦:ZOSS_SUCCESS;ʧ°ÜZOSS_ERROR

+ * @retval ZOSS_SUCCESS    ³É¹¦

+ * @retval ZOSS_ERROR      ʧ°Ü

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_ResumeTimer(ZOSS_TIMER_ID timer_id);

+

+/**

+ * @brief ɾ³ýÖ¸¶¨µÄ¶¨Ê±Æ÷

+ * @param timer_id        Èë²Î£¬¶¨Ê±Æ÷id

+ * @return ³É¹¦:ZOSS_SUCCESS;ʧ°ÜZOSS_ERROR

+ * @retval ZOSS_SUCCESS    ³É¹¦

+ * @retval ZOSS_ERROR      ʧ°Ü

+ * @note  

+ * @warning 

+ */

+UINT32 zOss_KillTimer(ZOSS_TIMER_ID timer_id);

+

+/*******************************************************************************

+ *                      Inline function implementations                        *

+ ******************************************************************************/

+#ifndef DOXYGEN_SHOULD_SKIP_THIS

+/* Ë«ÏòÁ´±í */

+#if defined (_OS_TOS) || defined (_OS_LINUX)

+/**************************************************************************

+* º¯ÊýÃû³Æ:  zOss_ListInit

+* ¹¦ÄÜÃèÊö:  ³õʼ»¯Ë«ÏòÁ´±í

+* ²ÎÊý˵Ã÷£º

+             (IN)

+                pList:Á´±íÖ¸Õë

+             (OUT)

+* ·µ »Ø Öµ:

+**************************************************************************/

+static inline VOID zOss_ListInit(T_ZOss_List *pList)

+{

+    zOss_AssertExN(pList != NULL);

+

+    pList->HEAD  = NULL;

+    pList->TAIL  = NULL;

+    pList->count = 0;

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ:  zOss_ListCount

+* ¹¦ÄÜÃèÊö:  »ñÈ¡Á´±íÏÂ×ܹ²µÄ½ÚµãÊý

+* ²ÎÊý˵Ã÷£º

+             (IN)

+                pList:Á´±íÖ¸Õë

+             (OUT)

+* ·µ »Ø Öµ:  ½Úµã¸öÊý

+**************************************************************************/

+static inline SINT32 zOss_ListCount(T_ZOss_List *pList)

+{

+    return (pList->count);

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListDelete

+* ¹¦ÄÜÃèÊö: ÒÆ³ýÁ´±íÖÐÖ¸¶¨µÄ½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pList:Á´±íÖ¸Õë

+                pNode:´ýɾ³ý½ÚµãÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ:

+**************************************************************************/

+static inline VOID zOss_ListDelete(T_ZOss_List *pList, T_ZOss_Node *pNode)

+{

+    if (pNode->previous != NULL)

+    {

+        pNode->previous->next = pNode->next;

+    }

+    else

+    {

+        pList->HEAD = pNode->next;

+    }

+

+    if (pNode->next != NULL)

+    {

+        pNode->next->previous = pNode->previous;

+    }

+    else

+    {

+        pList->TAIL = pNode->previous;

+    }

+

+    /* update node count */

+    pList->count--;

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListFirst

+* ¹¦ÄÜÃèÊö: »ñÈ¡Á´±íµÄÊ×½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pList:Á´±íÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ: ½ÚµãÖ¸Õë(µ±Á´±íÖÐûÓнڵãʱ£¬·µ»Ø¿Õ)

+**************************************************************************/

+static inline T_ZOss_Node* zOss_ListFirst(T_ZOss_List *pList)

+{

+    return (pList->HEAD);

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListInsert

+* ¹¦ÄÜÃèÊö: ÏòÁ´±íÖ¸¶¨µÄ½Úµãºó²åÈë½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pList:Á´±íÖ¸Õë

+                pPrev:²åÈëµã½ÚµãÖ¸Õ룬µ±pPrevΪ¿Õʱ£¬±íʾ²åÈëµ½Á´±íÊ×λÖÃ

+                pNode:´ý²åÈëµÄ½ÚµãÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ:

+**************************************************************************/

+static inline VOID zOss_ListInsert (T_ZOss_List *pList, T_ZOss_Node *pPrev, T_ZOss_Node *pNode)

+{

+    T_ZOss_Node *pNext = NULL;

+

+    if (pPrev != NULL)

+    {

+        pNext = pPrev->next;    /* make prev node point fwd to new */

+        pPrev->next = pNode;

+    }

+    else

+    {

+     	pNext = pList->HEAD;    /* new node is to be first in list */

+    	pList->HEAD = pNode;

+    }

+

+    if (pNext != NULL)

+    {    	

+       pNext->previous = pNode; /* make next node point back to new */

+    }

+    else

+    {

+        pList->TAIL = pNode;    /* new node is to be last in list */

+    }

+

+    /* set pointers in new node, and update node count */

+    pNode->next     = pNext;

+    pNode->previous = pPrev;

+

+    pList->count++;

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListAdd

+* ¹¦ÄÜÃèÊö: ÏòÁ´±íβÌí¼Ó½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pList:Á´±íÖ¸Õë

+                pNode:´ýÌí¼Ó½ÚµãÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ:

+**************************************************************************/

+static inline VOID zOss_ListAdd (T_ZOss_List *pList, T_ZOss_Node *pNode)

+{

+    zOss_ListInsert(pList, pList->TAIL, pNode);

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListLast

+* ¹¦ÄÜÃèÊö: »ñȡָ¶¨½ÚµãµÄºóÒ»½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pNode:Ö¸¶¨½ÚµãÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ: ½ÚµãÖ¸Õë(µ±Á´±íÖÐûÓнڵãʱ£¬·µ»Ø¿Õ)

+**************************************************************************/

+static inline T_ZOss_Node* zOss_ListLast(T_ZOss_List *pList)

+{

+    return (pList->TAIL);

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListNext

+* ¹¦ÄÜÃèÊö: »ñȡָ¶¨½ÚµãµÄǰһ½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pNode:½ÚµãÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ: ½ÚµãÖ¸Õë(µ±´«Èë½ÚµãÊÇÁ´±í×îºóÒ»¸ö½Úµãʱ£¬·µ»Ø¿Õ)

+**************************************************************************/

+static inline T_ZOss_Node* zOss_ListNext(T_ZOss_Node *pNode)

+{

+    return (pNode->next);

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListPrevious

+* ¹¦ÄÜÃèÊö: »ñȡָ¶¨½ÚµãµÄǰһ½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pNode:Ö¸¶¨½ÚµãÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ: ½ÚµãÖ¸Õë(µ±´«Èë½ÚµãÊÇÁ´±íµÚÒ»¸ö½Úµãʱ£¬·µ»Ø¿Õ)

+**************************************************************************/

+static inline T_ZOss_Node *zOss_ListPrevious(T_ZOss_Node *pNode)

+{

+    return (pNode->previous);

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListNStep

+* ¹¦ÄÜÃèÊö: »ñÈ¡ÓëÖ¸¶¨½Úµã¼ä¸ônStepµÄ½Úµã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pNode:½ÚµãÖ¸Õë

+                nStep:¼ä¸ôÊý. ÕýÊý:²éÕÒnext½Úµã£¬¸ºÊý²éÕÒprevious½Úµã

+            (OUT)

+* ·µ »Ø Öµ: ½ÚµãÖ¸Õë(µ±ÔÚ¼ä¸ônStepÄÚµ½´ïÁ´±íβʱ£¬·µ»Ø¿Õ)

+**************************************************************************/

+static inline T_ZOss_Node *zOss_ListNStep(T_ZOss_Node *pNode, SINT32 nStep)

+{

+    int i       = 0;

+    

+    if (nStep > 0)

+    {

+        for (i = nStep; i > 0; i--)

+        {

+            pNode = pNode->next;

+            

+            if (pNode == NULL)

+            {

+                break;

+            }

+        }

+    }

+    else

+    {

+        for (i = nStep; i < 0; i++)

+        {

+            pNode = pNode->previous;

+            

+            if (pNode == NULL)

+            {

+                break;

+            }

+        }

+    }

+    return (pNode);

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListFind

+* ¹¦ÄÜÃèÊö: ²éÕÒÁ´±íÖеĽڵã

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pList:Á´±íÖ¸Õë

+                pNode:´ý²éÕÒ½ÚµãÖ¸Õë

+            (OUT)

+* ·µ »Ø Öµ: Á´±íÖÐÓÐÖ¸¶¨½Úµã:½ÚµãÔÚÁ´±íÖеÄË÷Òý(´Ó1¿ªÊ¼)£¬

+                        Á´±íÖÐÎÞÖ¸¶¨½Úµã:-1

+**************************************************************************/

+static inline SINT32 zOss_ListFind (T_ZOss_List *pList, T_ZOss_Node *pNode)

+{

+    T_ZOss_Node *pNextNode      = NULL;

+    int         iNodePosition   = 1;

+

+    pNextNode = zOss_ListFirst (pList);

+

+    while ((pNextNode != NULL) && (pNextNode != pNode))

+    {

+        iNodePosition++;

+        

+        pNextNode = zOss_ListNext (pNextNode);

+    }

+

+    if (pNextNode != NULL)

+    {

+        return (iNodePosition);

+    }

+    else

+    {

+        return (-1);

+    }

+}

+

+/**************************************************************************

+* º¯ÊýÃû³Æ: zOss_ListConnect

+* ¹¦ÄÜÃèÊö: ½«Á½¸öÁ´±íÁ´½ÓÔÚÒ»Æð

+* ²ÎÊý˵Ã÷£º

+            (IN)

+                pList1: Á´±í1

+                pList2: Á´±í2

+            (OUT)

+* ·µ»ØÖµ:

+* ˵Ã÷£º    ½«pList2Á´½Óµ½pList1β²¿£»pList2µÄÁ´±íÍ·ÄÚÈݲ»»á¸Ä±ä

+**************************************************************************/

+static inline VOID zOss_ListConnect(T_ZOss_List *pList1, T_ZOss_List *pList2)

+{

+    if (pList1->count == 0)

+    {

+        pList1->HEAD    = pList2->HEAD;

+        pList1->TAIL    = pList2->TAIL;

+    }

+    else

+    {

+        if (pList2->count != 0)

+        {

+            pList1->TAIL ->next     = pList2->HEAD;

+            pList2->HEAD->previous  = pList1->TAIL;

+            pList1->TAIL            = pList2->TAIL;

+        }

+    }

+    pList1->count += pList2->count;

+}

+#else

+VOID zOss_ListInit(T_ZOss_List *pList);

+T_ZOss_Node *zOss_ListFirst(T_ZOss_List *pList);

+T_ZOss_Node *zOss_ListLast(T_ZOss_List *pList);

+T_ZOss_Node *zOss_ListNext(T_ZOss_Node *pNode);

+T_ZOss_Node *zOss_ListPrevious(T_ZOss_Node *pNode);

+T_ZOss_Node *zOss_ListNStep(T_ZOss_Node *pNode, SINT32 nStep); 

+SINT32 zOss_ListCount(T_ZOss_List *pList); 

+SINT32 zOss_ListFind(T_ZOss_List *pList, T_ZOss_Node *pNode);

+VOID zOss_ListAdd(T_ZOss_List *pList, T_ZOss_Node *pNode);

+VOID zOss_ListDelete(T_ZOss_List *pList, T_ZOss_Node *pNode);

+VOID zOss_ListInsert(T_ZOss_List *pList, T_ZOss_Node *pPrev, T_ZOss_Node *pNode);

+VOID zOss_ListConnect(T_ZOss_List *pList1, T_ZOss_List *pList2);

+#endif

+

+#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS

+

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  // #ifndef _OSS_SUP_H

diff --git a/cp/ps/plat/inc/oss/oss_trace.h b/cp/ps/plat/inc/oss/oss_trace.h
new file mode 100644
index 0000000..1ae7b7b
--- /dev/null
+++ b/cp/ps/plat/inc/oss/oss_trace.h
@@ -0,0 +1,90 @@
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : P98C_OSS

+* ÎÄ ¼þ Ãû : oss_trace.h

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : ¸ú×Ù¹¦ÄܵÄÍ·Îļþ

+* ×÷    Õß : chenxingfang

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2012-07-30

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ

+**************************************************************************/

+#ifndef _OSS_TRACE_H

+#define _OSS_TRACE_H

+

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+    

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+#if defined (_OS_OSE) || defined (_OS_TOS)

+# define OSS_TRACE_FUNC

+# define OSS_TRACE_THREAD

+#endif

+

+#ifndef _OS_WIN

+#if defined OSS_TRACE_FUNC

+# define ZOSS_TRACE_FUNC_START()                                \

+    {                                                           \

+        static VOID *td = NULL; /* Trace Descriptor */          \

+        oss_trace_func_start(&td, __FUNCTION__);

+

+# define ZOSS_TRACE_FUNC_END()                                  \

+        oss_trace_func_end(td);                                 \

+    }

+

+# define ZOSS_TRACE_FUNC_START_ALWAYS()                         \

+    {                                                           \

+        VOID *td = NULL;        /* Trace Descriptor */          \

+        oss_trace_func_start(&td, __FUNCTION__);

+

+# define ZOSS_TRACE_FUNC_END_ALWAYS()                           \

+        oss_trace_func_end(td);                                 \

+    }

+#else

+# define ZOSS_TRACE_FUNC_START()

+# define ZOSS_TRACE_FUNC_END()

+

+# define ZOSS_TRACE_FUNC_START_ALWAYS()

+# define ZOSS_TRACE_FUNC_END_ALWAYS()

+#endif

+#endif

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+

+/**************************************************************************

+* º¯ÊýÉùÃ÷Çø

+**************************************************************************/

+#ifdef OSS_TRACE_FUNC

+VOID oss_trace_thread_open(VOID);

+VOID oss_trace_thread_close(VOID);

+#endif

+

+VOID zOss_TraceFuncInit(VOID);

+VOID zOss_TraceFuncInfo(CHAR *func_name);

+

+/**************************************************************************

+* È«¾Ö±äÁ¿ÉùÃ÷Çø

+**************************************************************************/

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif  /* _OSS_TRACE_H */

+

diff --git a/cp/ps/plat/inc/oss/ramdump.h b/cp/ps/plat/inc/oss/ramdump.h
new file mode 100644
index 0000000..a83ffda
--- /dev/null
+++ b/cp/ps/plat/inc/oss/ramdump.h
@@ -0,0 +1,77 @@
+/*******************************************************************************
+* °æÈ¨ËùÓÐ (C)2016, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+* 
+* ÎļþÃû³Æ:     ramdump.h
+* Îļþ±êʶ:     ramdump.h
+* ÄÚÈÝÕªÒª:     ramdump¶ÔÍâÌṩͷÎļþ
+* ʹÓ÷½·¨:     #include "ramdump.h"
+* 
+* ÐÞ¸ÄÈÕÆÚ        °æ±¾ºÅ      Ð޸ıê¼Ç        ÐÞ¸ÄÈË          ÐÞ¸ÄÄÚÈÝ
+* ------------------------------------------------------------------------------
+* 2016/3/10      V1.0        Create           ÕÔ¾ü¿ü          ´´½¨
+* 
+*******************************************************************************/
+
+#ifndef _RAMDUMP_H
+#define _RAMDUMP_H
+
+/*******************************************************************************
+*                                   Í·Îļþ                                     *
+*******************************************************************************/
+
+/*******************************************************************************
+*                                Íⲿº¯ÊýÉùÃ÷                                  *
+*******************************************************************************/
+
+/*******************************************************************************
+*                                   ºê¶¨Òå                                     *
+*******************************************************************************/
+
+/*******************************************************************************
+*                                Êý¾ÝÀàÐͶ¨Òå                                  *
+*******************************************************************************/
+typedef int (*ramdump_callback_t)(void);
+
+/* RAMDUMP_FLAG_XXX         */
+enum
+{
+    RAMDUMP_FLAG_NONE           = 0x00, /* default                  */
+    RAMDUMP_FLAG_NEED_COPY      = 0x01, /* Copy destination address */
+    RAMDUMP_FLAG_HAS_EXTERNAL   = 0x02, /* External address         */
+    RAMDUMP_FLAG_HAS_CALLBACK   = 0x04, /* Callback funtion         */
+};
+
+/*******************************************************************************
+*                                È«¾Ö±äÁ¿ÉùÃ÷                                  *
+*******************************************************************************/
+
+/*******************************************************************************
+*                                È«¾Öº¯ÊýÉùÃ÷                                  *
+*******************************************************************************/
+#if defined (CONFIG_RAMDUMP) || defined (_USE_CLIENT_RAMDUMP)
+extern void ramdump_ram_conf_table_add(
+        char *ram_name, 
+        unsigned long ram_phy, 
+        unsigned long ram_size, 
+        unsigned long ram_virt,
+        unsigned long ram_flag,
+        unsigned long ram_extra);
+#else
+static void ramdump_ram_conf_table_add(
+        char *ram_name, 
+        unsigned long ram_phy, 
+        unsigned long ram_size, 
+        unsigned long ram_virt,
+        unsigned long ram_flag,
+        unsigned long ram_extra)
+{
+    ;
+}
+#endif
+
+/*******************************************************************************
+*                                ÄÚÁªº¯ÊýʵÏÖ                                  *
+*******************************************************************************/
+
+#endif  //#ifndef _RAMDUMP_H
+