⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dpx_rtos.h

📁 交换机中常用芯片链路复用7350的驱动源代码(vxworks中实现)
💻 H
字号:
/******************************************************************************/
/**  COPYRIGHT (C) 1999 PMC-SIERRA, INC. ALL RIGHTS RESERVED.                **/
/**--------------------------------------------------------------------------**/
/** This software embodies materials and concepts which are proprietary and  **/
/** confidential to PMC-Sierra, Inc.                                         **/
/** PMC-Sierra distributes this software to its customers pursuant to the    **/ 
/** terms and conditions of the Device Driver Software License Agreement     **/ 
/** contained in the text file software.lic that is distributed along with   **/ 
/** the device driver software. This software can only be utilized if all    **/ 
/** terms and conditions of the Device Driver Software License Agreement are **/ 
/** accepted. If there are any questions, concerns, or if the Device Driver  **/
/** Software License Agreement text file, software.lic, is missing please    **/
/** contact PMC-Sierra for assistance.                                       **/
/**--------------------------------------------------------------------------**/
/**                                                                          **/
/******************************************************************************/
/*******************************************************************************
**    MODULE     : Duplex device drivers header file related to RTOS
**
**    FILE       : dpx_rtos.h
**      
**    DESCRIPTION: This file contains RTOS related definition and prototype 
**                 required by the dpx_rtos.c.
**
**
**    NOTES      :
**
*******************************************************************************/
/* 
**    MODIFICATION HISTORY:
**
** $Log: dpx_rtos.h.rca $
** 
**  Revision: 1.1 Wed Aug 16 16:22:13 2000 bhalwani
**    Beta-1.0
**
** 
**  5   06/15/00    Bhalwani        Vortex chipset driver beta-1.0
**  4   06/15/00    Bhalwani        Vortex chipset driver Alpha-1.30
**  3   03/03/00    Regisfre        Move the TSK_CTL_BLK structure in the IF Type_defined 
**                                  statement.
**  2   12/10/99    chenkemi        
**  1   08/11/99    chenkemi        Initial Version
**
**  13  08/11/99    chenkemi        moved sTSK_CTL_BLK
**  12  07/20/99    chenkemi        Beta-1.0
**  11  07/20/99    chenkemi        removed path reference for syspci.h header file
**  10  06/28/99    chenkemi        changed DPX_POLLING_DELAY to 50.
**  9   06/04/99    chenkemi        changed DPX_DPR_TASK_PRIORITY to 85
**                                  and  DPX_DPR_TASK_STACK_SZ  to 4096
**  8   06/02/99    chenkemi        change the DPX_MAX_IND_BUFSZ value to 128.
**  7   05/27/99    chenkemi        Re-organized header files
**  6   05/26/99    chenkemi        code cleanup after code review
**  5   04/08/99    chenkemi        added a new data structure "sDPX_IRQ_TABLE"
**  4   04/01/99    chenkemi        added DPX_SEM_ID definition
**  3   03/29/99    chenkemi        re-organized the header file.
**  2   03/12/99    chenkemi        Version Alpha1.1
**  1   03/02/99    chenkemi        Initial Version
**
*/



#ifndef _DPX_RTOS_H
#define _DPX_RTOS_H

#include <string.h>
#include <stdio.h>
#include <semLib.h>
#include <taskLib.h>


/*********************************************************/ 
#ifndef _TYPE_DEF
#define _TYPE_DEF

 
/* type define */
#ifndef _TYPE_DEFINED
#define _TYPE_DEFINED

typedef unsigned char   UINT1;
typedef unsigned short  UINT2;
typedef unsigned int    UINT4;
typedef char            INT1;
typedef short           INT2;
typedef int             INT4;

/* Task control Block structure */
typedef struct
{
  INT4      i4Id;
  INT1      *pi1Name;
  INT4      i4Pri;
  INT4      i4Opt;
  INT4      i4StckSz;
  FUNCPTR   FEntryPtr;      
    
}sTSK_CTL_BLK;
#endif

/* typedef void            VOID;  */ 


/* defines for Duplex related constant anf types */
typedef	void*  DPX_USR_CTXT;
typedef	void*  DUPLEX;

#define DPX_NULL (VOID*)0
#define DPX_SEM_ID      SEM_ID

#endif
/********************************************************/

/* define for message queues */
#define DPX_MAX_MSGS        10

/* define for DPR task priority */
#define DPX_DPR_TASK_PRIORITY 85
#define DPX_DPR_TASK_STACK_SZ  4096  /* in bytes */

/* In polling mode, DPR task  delay time in millisecond for the next polling */
#define DPX_POLLING_DELAY   50  

/* the delay time for a gracely shutdown the DPR task before forcing to kill
   the DPR task  */
#define DPX_TASK_SHUTDOWN_DELAY 10 /* in millisecond */

/*-----------------------------------------*/
/* MACROs defined for DUPLEX RTOS services */
/*-----------------------------------------*/
#define sysDuplexMemAlloc(nbytes)         malloc(nbytes)
#define sysDuplexMemFree(pulFirst)        free(pulFirst)
#define sysDuplexMemCopy(dst,src,nbytes)	memcpy(dst,src,nbytes)
/* create a mutual-exclusion semaphore */
#define sysDuplexSemCreate()              semMCreate(SEM_Q_PRIORITY|SEM_INVERSION_SAFE)
#define sysDuplexSemDelete(semId)         semDelete(semId)
#define sysDuplexSemGive(semId)           semGive(semId)
#define sysDuplexSemTake(semId)           semTake(semId, WAIT_FOREVER)


/* Maximum indication buffer size */
#define DPX_MAX_IND_BUFSZ	128 /* in bytes */

#define DPX_MAX_NUM_DEVS	7  /* maximum nember of Duplex devices */
	
/* indication buffer structure */
typedef struct _dpx_Ind_Buf
{
    UINT4               u4Len;
    UINT1               u1Data[DPX_MAX_IND_BUFSZ];
}sDPX_IND_BUF;

/* Interrupt Context Structure */
typedef struct _dpx_int_Ctxt
{
    UINT1		u1NumDevs;
    UINT4		*pu4DevHandles[DPX_MAX_NUM_DEVS];
} sDPX_INT_CTXT;



typedef struct _dpx_Irq_Table
{
  int irq;
  int count;
} sDPX_IRQ_TABLE;


/** in dpx_rtos.c **/
VOID sysDuplexMemset(VOID *ptr, INT1 u1Byte, UINT4 u4ByteCnt);
sDPX_INT_CTXT *duplexGetIntCtxt(VOID);
VOID duplexReturnIntCtxt(sDPX_INT_CTXT *pBuf);
sDPX_IND_BUF *duplexGetIndBuf(VOID);
VOID duplexReturnIndBuf(sDPX_IND_BUF *pBuf);
VOID sysDuplexDelayFn(UINT4 u4Msecs);
INT4 sysDuplexIntInstallHandler(DUPLEX duplex);
VOID sysDuplexIntRemoveHandler(DUPLEX duplex);
VOID sysDuplexIntHandler(INT4 irq);
VOID sysDuplexDPRtask(VOID);


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -