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

📄 zl5011xdma.h

📁 Zalink50114----TDMoIP芯片驱动源码
💻 H
字号:
/*******************************************************************************
*
*  File name:              zl5011xDma.h
*
*  Version:                16
*
*  Author:                 ARW
*
*  Date created:           17/09/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*    This module provides the DMA functionality for the device
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     17/09/2002  ARW      New file
*  2     08/10/2002  ARW      Removed padding parameter from structure
*                             All prototypes to have 2 parameters
*                             Made AllocateStructure and FreeStructure
*                             static functions
*  3     17/10/2002  ARW      Added missing prototypes (StructInit fns)
*  4     25/10/2002  ARW      Removed reference to zl5011xDmaMap.h
*  5     30/10/2002  ARW      Removed reference to zl5011xDmaMpc8260.h
*  6     31/10/2002  MRC      Added variants + minor fixes
*  7     21/11/2002  ARW      Added more external variables for debug
*  8     04/12/2002  ARW      Added more external variables for debug
*  9     11/12/2002  ARW      Added byte count fields to zl5011xHostTxGetStats &
*                                zl5011xHostRxGetStats
*  10    18/12/2002  ARW      Added more fields to zl5011xHostRxGetStats
*  11    19/12/2002  ARW      Removed _DEV_BOARD macro
*  12    29/01/2003  ARW      Added new include files
*  13    19/08/2004  MRC      Removed unneeded header file zl5011xPacket.h
*  14    06/09/2004  APL      Added port/queue parameters for HostTxSendPacket
*  15    31/03/2005  MRC      Added support for DMA packet Rx interrupt
*  16    04/05/2005  APL      Added ethernetSrcAddressFromMac flag to
*                                zl5011xHostTxInitialiseS
*
*******************************************************************************/

#ifndef _ZL5011X_DMA_H_
#define _ZL5011X_DMA_H_

#ifdef __cplusplus
extern "C" {
#endif

/*****************   INCLUDE FILES   ******************************************/

#include "zl5011x.h"
#include "zl5011xCpu.h"
#include "zl5011xCpq.h"
#include "zl5011xDmaMpc.h"
#include "zl5011xMisc.h"
#include "zl5011xApi.h"
#include "zl5011xLan.h"

/*****************   # DEFINES   **********************************************/

/*****************   DATA TYPES   *********************************************/

/*****************   ENUMERATIONS    ******************************************/

typedef enum zl5011xPacketClassE
{
    ZL5011X_UNICAST,
    ZL5011X_MULTICAST,
    ZL5011X_BROADCAST
} zl5011xPacketClassE;

/*****************  DATA STRUCTURES and FUNCTION DECLARATIONS   ***************/

typedef struct zl5011xHostTxInitialiseS
{
    Uint32T dmaChannel;
    Uint32T numberOfBuffers;
    Uint32T bufferSize;
    zl5011xBooleanE ethernetSrcAddressFromMac;
} zl5011xHostTxInitialiseS;

zlStatusE zl5011xHostTxInitialiseStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostTxInitialiseS *par);
zlStatusE zl5011xHostTxInitialise(zl5011xParamsS *zl5011xParams, zl5011xHostTxInitialiseS *par);

/********************************/

typedef struct zl5011xHostTxSendPacketS
{
    Uint8T *buffer;
    zl5011xFlowTypeE pathType;
    Uint32T packetLength;
    Uint32T context;
    Uint32T lanPort;
    Uint32T lanPortQueue;
    Uint32T sequenceNumber;
    Uint32T tstampChksum;
} zl5011xHostTxSendPacketS;

zlStatusE zl5011xHostTxSendPacketStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostTxSendPacketS *par);
zlStatusE zl5011xHostTxSendPacket(zl5011xParamsS *zl5011xParams, zl5011xHostTxSendPacketS *par);

/********************************/

typedef struct zl5011xHostRxInitialiseS
{
   Uint32T dmaChannel;
   Uint32T numberOfBuffers;
   Uint32T bufferSize;
   Uint32T queueNumberOfBuffers[ZL5011X_CPQ_QUEUES];
   Uint32T queueBufferSize[ZL5011X_CPQ_QUEUES];
   Uint32T queueGranuleThreshold[ZL5011X_CPQ_QUEUES];
   Uint32T totalGranuleThreshold;
   zl5011xBooleanE packetRxInterruptEnable;
} zl5011xHostRxInitialiseS;

zlStatusE zl5011xHostRxInitialiseStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostRxInitialiseS *par);
zlStatusE zl5011xHostRxInitialise(zl5011xParamsS *zl5011xParams, zl5011xHostRxInitialiseS *par);

/********************************/


typedef struct zl5011xHostRxFreePacketS
{
    Uint8T *buffer;
    zl5011xQueueE queueNumber;
} zl5011xHostRxFreePacketS;

zlStatusE zl5011xHostRxFreePacketStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostRxFreePacketS *par);
zlStatusE zl5011xHostRxFreePacket(zl5011xParamsS *zl5011xParams, zl5011xHostRxFreePacketS *par);

/********************************/

typedef struct zl5011xHostRxReceivePacketS
{
    zl5011xQueueE queueNumber;
    Uint32T timeout;
    Uint8T *buffer;
    Uint32T packetLength;
    Uint32T sequenceNumber;
    zl5011xPacketClassE packetClass;
    zl5011xBooleanE truncationFlag;
} zl5011xHostRxReceivePacketS;

zlStatusE zl5011xHostRxReceivePacketStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostRxReceivePacketS *par);
zlStatusE zl5011xHostRxReceivePacket(zl5011xParamsS *zl5011xParams, zl5011xHostRxReceivePacketS *par);

/********************************/

typedef struct zl5011xHostTxGetStatsS
{
    Uint32T packetsSent;
    Uint32T bytesSenth;
    Uint32T bytesSentl;
    Uint32T packetsSentFail;
    Uint32T packetsInQueue;
} zl5011xHostTxGetStatsS;

zlStatusE zl5011xHostTxGetStatsStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostTxGetStatsS *par);
zlStatusE zl5011xHostTxGetStats(zl5011xParamsS *zl5011xParams, zl5011xHostTxGetStatsS *par);

/********************************/

typedef struct zl5011xHostRxGetStatsS
{
    Uint32T packetsReceived[ZL5011X_CPQ_QUEUES];
    Uint32T bytesReceivedh[ZL5011X_CPQ_QUEUES];
    Uint32T bytesReceivedl[ZL5011X_CPQ_QUEUES];
    Uint32T packetsDropped[ZL5011X_CPQ_QUEUES];
    Uint32T bytesDroppedh[ZL5011X_CPQ_QUEUES];
    Uint32T bytesDroppedl[ZL5011X_CPQ_QUEUES];
    Uint32T packetsTruncated[ZL5011X_CPQ_QUEUES];
    Uint32T bytesTruncatedh[ZL5011X_CPQ_QUEUES];
    Uint32T bytesTruncatedl[ZL5011X_CPQ_QUEUES];
    Uint32T packetsInMemory[ZL5011X_CPQ_QUEUES];
    Uint32T packetsInQueue[ZL5011X_CPQ_QUEUES];
    Uint32T packetsInDevice[ZL5011X_CPQ_QUEUES];
    Uint32T buffersProcessed;
} zl5011xHostRxGetStatsS;

zlStatusE zl5011xHostRxGetStatsStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostRxGetStatsS *par);
zlStatusE zl5011xHostRxGetStats(zl5011xParamsS *zl5011xParams, zl5011xHostRxGetStatsS *par);

/********************************/

typedef struct zl5011xHostRxDisableS
{
    Uint32T unused;
} zl5011xHostRxDisableS;

zlStatusE zl5011xHostRxDisableStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostRxDisableS *par);
zlStatusE zl5011xHostRxDisable(zl5011xParamsS *zl5011xParams, zl5011xHostRxDisableS *par);

/********************************/

typedef struct zl5011xHostTxDisableS
{
    Uint32T unused;
} zl5011xHostTxDisableS;

zlStatusE zl5011xHostTxDisableStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostTxDisableS *par);
zlStatusE zl5011xHostTxDisable(zl5011xParamsS *zl5011xParams, zl5011xHostTxDisableS *par);

/********************************/

typedef struct zl5011xHostRxSetQueuePrioritiesS
{
    zl5011xDmaQueueModeE queueMode[ZL5011X_CPQ_QUEUES];
    Uint32T weighting[ZL5011X_CPQ_QUEUES];
} zl5011xHostRxSetQueuePrioritiesS;

zlStatusE zl5011xHostRxSetQueuePrioritiesStructInit(zl5011xParamsS *zl5011xParams, zl5011xHostRxSetQueuePrioritiesS * par);
zlStatusE zl5011xHostRxSetQueuePriorities(zl5011xParamsS *zl5011xParams, zl5011xHostRxSetQueuePrioritiesS * par);

/*****************   EXPORTED GLOBAL VARIABLE DECLARATIONS   ******************/

/* Global variables required to test the function when there is no development
board present                                                                 */
#ifdef _NO_DEVICE
extern zl5011xReceiveQueueParamsS *rxQParams;
extern zl5011xTransmitQueueParamsS *txQParams;

/* Extra parameters for the test bench                                        */
Uint8T **bigBuffers;
Uint32T *seqNumOfLastCompletedPacket;
Uint32T bigBufferRepeatCount;
#endif

/*****************   EXTERNAL FUNCTION DECLARATIONS   *************************/

#ifdef __cplusplus
}
#endif

#endif /* _ZL5011X_DMA_H_ */

⌨️ 快捷键说明

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