/*******************************************************************************
** � Copyright 2011 - 2012 Xilinx, Inc. All rights reserved.
** This file contains confidential and proprietary information of Xilinx, Inc. and
** is protected under U.S. and international copyright and other intellectual property laws.
*******************************************************************************
** ____ ____
** / /\/ /
** /___/ \ / Vendor: Xilinx
** \ \ \/
** \ \
** / /
** /___/ /\
** \ \ / \ Kintex-7 PCIe-DMA-DDR3 Base Targeted Reference Design
** \___\/\___\
**
** Device: xc7k325t
** Reference: UG882
*******************************************************************************
**
** Disclaimer:
**
** This disclaimer is not a license and does not grant any rights to the materials
** distributed herewith. Except as otherwise provided in a valid license issued to you
** by Xilinx, and to the maximum extent permitted by applicable law:
** (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL FAULTS,
** AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY,
** INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR
** FITNESS FOR ANY PARTICULAR PURPOSE; and (2) Xilinx shall not be liable (whether in contract
** or tort, including negligence, or under any other theory of liability) for any loss or damage
** of any kind or nature related to, arising under or in connection with these materials,
** including for any direct, or any indirect, special, incidental, or consequential loss
** or damage (including loss of data, profits, goodwill, or any type of loss or damage suffered
** as a result of any action brought by a third party) even if such damage or loss was
** reasonably foreseeable or Xilinx had been advised of the possibility of the same.
** Critical Applications:
**
** Xilinx products are not designed or intended to be fail-safe, or for use in any application
** requiring fail-safe performance, such as life-support or safety devices or systems,
** Class III medical devices, nuclear facilities, applications related to the deployment of airbags,
** or any other applications that could lead to death, personal injury, or severe property or
** environmental damage (individually and collectively, "Critical Applications"). Customer assumes
** the sole risk and liability of any use of Xilinx products in Critical Applications, subject only
** to applicable laws and regulations governing limitations on product liability.
** THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE AT ALL TIMES.
*******************************************************************************/
/***************************** System Include Files **************************/
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <signal.h>
#include <ctype.h>
#include <gtk/gtk.h>
#include <glib.h>
/***************************** Local Include Files ***************************/
#include <xpmon_be.h>
#include "ConfigGui.h"
#include "xp_types.h"
/***************************** Preprocessor Constants ************************/
#if !defined(K7_TRD)
Warning! Cannot without K7 macros.
#endif
#define UP 1
#define DOWN 2
#define MAINLABEL "Xilinx Performance & Status Monitor - Kintex-7 Base TRD"
#ifdef K7_TRD
#define LABEL1 "Raw Data Path0:"
#define LABEL2 "Raw Data Path1:"
#endif
#define GLABEL1 "Transmit"
#define GLABEL2 "Receive"
#define FILENAME "/dev/xdma_stat"
#define XLNX_LOGO "xlnx_logo.gif"
#define START_TEST "Start Test"
#define STOP_TEST "Stop Test"
#ifdef K7_TRD
#define DEV_LOGO "k7_logo.png"
#endif
#define MAX_Y_CNT 4 /* Max gradations on Y-axis of graph */
#define MAX_Y 16 /* Max Y-value displayed on graph */
#define DIVISOR (1024*1024*1024) /* Graph is in Gbits/s */
#define SDIVISOR (1024*1024*1024) /* Main status page must show Gbps */
#define MULTIPLIER 8 /* Because graph is in bits/s */
#define RATE "Throughput (Gbps)" /* For showing on main status page */
#define MIN_PKTSIZE 64
#define MAX_PKTSIZE (32*1024)
char * Yaxis[MAX_Y_CNT] =
{ " 16", " 12", " 8", " 4" };
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/***************************** Function Prototypes ***************************/
///* Function to clear Text in the Text view */
//gboolean ClearTextView(GtkWidget *Widget, gpointer Data);
gboolean quit_window( GtkWidget *Widget, gpointer Data );
gboolean LBCallback1(GtkWidget *Widget, gpointer String);
gboolean LBCallback2(GtkWidget *Widget, gpointer String);
gboolean NonLBCallback1(GtkWidget *Widget, gpointer String);
gboolean NonLBCallback2(GtkWidget *Widget, gpointer String);
gboolean StartTestCallback(GtkWidget *Widget, gpointer String);
gboolean StatusCallback(GtkWidget *Widget, gpointer String);
gboolean StartTest(int engine);
gboolean StopTest(int engine);
gboolean DisplayMainPage(GtkWidget *Widget, gpointer String);
void DrawWidget(struct screen *MyGuiScreen,void *PWidgets[],int i);
gboolean DrawPayloadGraph1(GtkWidget *Widget, gpointer Data);
gboolean DrawPayloadGraph2(GtkWidget *Widget, gpointer Data);
gboolean DrawPayloadGraph3(GtkWidget *Widget, gpointer Data);
gboolean DrawPayloadGraph4(GtkWidget *Widget, gpointer Data);
gboolean DrawTRNGraph1(GtkWidget *Widget, gpointer Data);
gboolean DrawTRNGraph2(GtkWidget *Widget, gpointer Data);
gboolean DrawGraph (GtkWidget *, int, int, int, int, char *, int *, int, int, int *, int, int);
/************************** Variable Definitions *****************************/
char xlnx_logo[PATH_MAX];
char dev_logo[PATH_MAX];
char mainlabel[128];
#define MAX_STATS 350
struct
{
int Engine; /* Engine number - for communicating with driver */
char *name; /* Name to be used in Setup screen */
int mode; /* TX/RX - incase of specific screens */
} DMAConfig[MAX_ENGS] =
{
{0, LABEL1, TX_MODE },
{32, LABEL1, RX_MODE },
{1, LABEL2, TX_MODE },
{33, LABEL2, RX_MODE }
};
struct
{
float LBR;
unsigned int LAT;
unsigned int LWT;
unsigned int BDe;
unsigned int BDSe;
unsigned int BDs;
unsigned int Bufs;
unsigned int MinPkt;
unsigned int MaxPkt;
unsigned int TestMode;
int TXEnab;
int LBEnab;
int IntEnab;
int PktGenEnab;
int PktChkEnab;
} EngStats[MAX_ENGS] = { 0 };
struct
{
float LTX;
float LRX;
} TRNStats = { 0 };
/* array of Pointers to Signals emitted from Widgets */
char *Signal[]={"delete_event", //0
"activate", //1
"clicked", //2
"toggled", //3
"pressed", //4
"changed", //5
"expose_event",//6
"insert_text" //7
};
enum SIndex
{
DELETE=0,
ACTIVATE,
CLICKED,
TOGGLED,
PRESSED,
CHANGED,
EXPOSE_EVENT,
INSERT_TEXT
} Sig;
/* IMPORTANT: Indices are used to point to particular widget during callback
* hence order of index should be exactly same as the order of widgets
* definition.
*/
enum WidgetIndex /* Corresponds to GuiWidgets */
{
MAIN_WINDOW_INDEX=0,
VPANED_INDEX,
MAIN_TAB_INDEX,
ALIGN_IMAGE1_INDEX=3, // Xilinx Logo
ALIGN_IMAGE2_INDEX=5, // Device Logo
LABEL1_INDEX=8,
评论2