[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/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