|
Message
From: cvs at opencores.org<cvs@o...>
Date: Fri Jun 23 21:03:45 CEST 2006
Subject: [cvs-checkins] MODIFIED: mb-jpeg ...
Date: 00/06/06 23:21:03 Added: mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile Makefile _profile_clean.c _profile_init.c _profile_timer_hw.c _profile_timer_hw.h dummy.S mblaze_nt_types.h profile.h profile_cg.c profile_config.h profile_hist.c profile_mcount_mb.S profile_mcount_ppc.S Log: Updated to EDK8.1 Revision Changes Path 1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/Makefile http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/Makefile?rev=1.1&content-type=text/x-cvsweb-markup Index: Makefile =================================================================== ####################################################################### # # Copyright (c) 2002 Xilinx, Inc. All rights reserved. # Xilinx, Inc. # # XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A # COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS # ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR # STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION # IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE # FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. # XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO # THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO # ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE # FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS FOR A PARTICULAR PURPOSE. # # $Id: Makefile,v 1.1 2006/06/23 19:03:44 quickwayne Exp $ # # Makefile for profiler # ####################################################################### # PROFILE_ARCH_OBJS - Processor Architecture Dependent files defined here include ../config.make AS=mb-as COMPILER = mb-gcc ARCHIVER = mb-ar CP = cp COMPILER_FLAGS=-O2 EXTRA_COMPILER_FLAGS= LIB = libxil.a DUMMYLIB = libxilprofile.a CC_FLAGS = $(subst -pg, , $(COMPILER_FLAGS)) ECC_FLAGS = $(subst -pg, , $(EXTRA_COMPILER_FLAGS)) RELEASEDIR = ../../../../lib INCLUDEDIR = ../../../../include INCLUDES = -I./. -I${INCLUDEDIR} OBJS = _profile_init.o _profile_clean.o _profile_timer_hw.o profile_hist.o profile_cg.o DUMMYOBJ = dummy.o INCLUDEFILES = profile.h mblaze_nt_types.h _profile_timer_hw.h libs : reallibs dummylibs reallibs : $(OBJS) $(PROFILE_ARCH_OBJS) $(ARCHIVER) -r $(RELEASEDIR)/$(LIB) $(OBJS) $(PROFILE_ARCH_OBJS) dummylibs : $(DUMMYOBJ) $(ARCHIVER) -r $(RELEASEDIR)/$(DUMMYLIB) $(DUMMYOBJ) %.o:%.c $(COMPILER) $(CC_FLAGS) $(ECC_FLAGS) -c $< -o $@ $(INCLUDES) %.o:%.S $(COMPILER) $(CC_FLAGS) $(ECC_FLAGS) -c $< -o $@ $(INCLUDES) include: $(CP) -rf $(INCLUDEFILES) $(INCLUDEDIR) clean: rm -f $(OBJS) $(PROFILE_ARCH_OBJS) $(LIB) 1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_clean.c http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_clean.c?rev=1.1&content-type=text/x-cvsweb-markup Index: _profile_clean.c =================================================================== // // Copyright (c) 2002 Xilinx, Inc. All rights reserved. // Xilinx, Inc. // // XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A // COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS // ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR // STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION // IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE // FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: _profile_clean.c,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
#include "profile.h"
#include "_profile_timer_hw.h"
/*
* This function is the exit routine and is called by the crtinit, when the
* program terminates. The name needs to be changed later..
*/
void _profile_clean( void )
{
disable_timer();
}
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_init.c
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_init.c?rev=1.1&content-type=text/x-cvsweb-markup
Index: _profile_init.c
===================================================================
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: _profile_init.c,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
// _program_init.c:
// Initialize the Profiling Structures.
//
//////////////////////////////////////////////////////////////////////
#include "profile.h"
// XMD Initializes the following Global Variables Value during Program
// Download with appropriate values.
int profile_version = 1; // Version of S/W Intrusive Profiling library
int binsize = BINSIZE; // Histogram Bin Size
unsigned int cpu_clk_freq = CPU_FREQ_HZ ; // CPU Clock Frequency
unsigned int sample_freq_hz = SAMPLE_FREQ_HZ ; // Histogram Sampling Frequency
unsigned int timer_clk_ticks = TIMER_CLK_TICKS ;// Timer Clock Ticks for the Timer
// Structure for Storing the Profiling Data
struct gmonparam *_gmonparam = (struct gmonparam *)0xffffffff;
int n_gmon_sections = 1;
// This is the initialization code, which is called from the crtinit.
//
void _profile_init( void )
{
int i;
/* print("Gmon Init called....\r\n") ; */
/* putnum(n_gmon_sections) ; print("\r\n") ; */
/* if( _gmonparam == 0xffffffff ) */
/* printf("Gmonparam is NULL !!\r\n"); */
/* for( i = 0; i < n_gmon_sections; i++ ){ */
/* putnum(_gmonparam[i].lowpc) ; print("\t") ; */
/* putnum(_gmonparam[i].highpc) ; print("\r\n") ; */
/* putnum( _gmonparam[i].textsize ); print("\r\n") ; */
/* putnum( _gmonparam[i].kcountsize * sizeof(unsigned short));print("\r\n"); */
/* } */
#ifdef PROC_MICROBLAZE
microblaze_init();
#else
powerpc405_init();
#endif
}
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_timer_hw.c
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_timer_hw.c?rev=1.1&content-type=text/x-cvsweb-markup
Index: _profile_timer_hw.c
===================================================================
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Header: /cvsroot/quickwayne/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_timer_hw.c,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
// $Id: _profile_timer_hw.c,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
// _program_timer_hw.c:
// Timer related functions
//
//////////////////////////////////////////////////////////////////////
#include "profile.h"
#ifdef PROC_PPC
#include "xexception_l.h"
#include "xtime_l.h"
#include "xpseudo_asm.h"
#endif
#ifdef TIMER_CONNECT_INTC
#include "xintc_l.h"
#include "xintc.h"
#endif // TIMER_CONNECT_INTC
#ifndef PPC_PIT_INTERRUPT
#include "xtmrctr_l.h"
#endif
extern unsigned int timer_clk_ticks ;
//--------------------------------------------------------------------
// PowerPC Target - Timer related functions
//--------------------------------------------------------------------
#ifdef PROC_PPC
//--------------------------------------------------------------------
// PowerPC PIT Timer Init.
// Defined only if PIT Timer is used for Profiling
//
//--------------------------------------------------------------------
#ifdef PPC_PIT_INTERRUPT
int ppc_pit_init( void )
{
// 1. Register Profile_intr_handler as Interrupt handler
// 2. Set PIT Timer Interrupt and Enable it.
XExc_RegisterHandler( XEXC_ID_PIT_INT,
(XExceptionHandler)profile_intr_handler,(void *)0);
XTime_PITSetInterval( timer_clk_ticks ) ;
XTime_PITEnableAutoReload() ;
return 0;
}
#endif
//--------------------------------------------------------------------
// PowerPC Timer Initialization functions.
// For PowerPC, PIT and opb_timer can be used for Profiling. This
// is selected by the user in standalone BSP
//
//--------------------------------------------------------------------
int powerpc405_init()
{
XExc_Init() ;
XExc_mDisableExceptions( XEXC_NON_CRITICAL ) ;
// Initialize the Timer.
// 1. If PowerPC PIT Timer has to be used, initialize PIT timer.
// 2. Else use opb_timer. It can be directly connected or thru intc to PowerPC
#ifdef PPC_PIT_INTERRUPT
ppc_pit_init();
#else
#ifdef TIMER_CONNECT_INTC
XExc_RegisterHandler( XEXC_ID_NON_CRITICAL_INT,
(XExceptionHandler)XIntc_DeviceInterruptHandler,(void *)0);
XIntc_RegisterHandler( INTC_BASEADDR, PROFILE_TIMER_INTR_ID,
(XInterruptHandler)profile_intr_handler,(void*)0);
#else
XExc_RegisterHandler( XEXC_ID_NON_CRITICAL_INT,
(XExceptionHandler)profile_intr_handler,(void *)0);
#endif
// Initialize the timer with Timer Ticks
opb_timer_init() ;
#endif
// Enable Interrupts in the System, if Profile Timer is the only Interrupt
// in the System.
#ifdef ENABLE_SYS_INTR
#ifdef PPC_PIT_INTERRUPT
XTime_PITEnableInterrupt() ;
#elif TIMER_CONNECT_INTC
XIntc_mMasterEnable( INTC_BASEADDR );
XIntc_SetIntrSvcOption( INTC_BASEADDR, XIN_SVC_ALL_ISRS_OPTION);
XIntc_mEnableIntr( INTC_BASEADDR, PROFILE_TIMER_INTR_MASK );
#endif
XExc_mEnableExceptions( XEXC_NON_CRITICAL ) ;
#endif
}
#endif // PROC_PPC
//--------------------------------------------------------------------
// opb_timer Initialization for PowerPC and MicroBlaze. This function
// is not needed if PIT timer is used in PowerPC
//
//--------------------------------------------------------------------
#ifndef PPC_PIT_INTERRUPT
int opb_timer_init( void )
{
// set the number of cycles the timer counts before interrupting
XTmrCtr_mSetLoadReg(PROFILE_TIMER_BASEADDR, 0, timer_clk_ticks);
// reset the timers, and clear interrupts
XTmrCtr_mSetControlStatusReg(PROFILE_TIMER_BASEADDR, 0,
XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK );
// start the timers
XTmrCtr_mSetControlStatusReg(PROFILE_TIMER_BASEADDR, 0, XTC_CSR_ENABLE_TMR_MASK
| XTC_CSR_ENABLE_INT_MASK | XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK);
return 0;
}
#endif
//--------------------------------------------------------------------
// MicroBlaze Target - Timer related functions
//--------------------------------------------------------------------
#ifdef PROC_MICROBLAZE
//--------------------------------------------------------------------
// Initialize the Profile Timer for MicroBlaze Target.
// For MicroBlaze, opb_timer is used. The opb_timer can be directly
// connected to MicroBlaze or connected through Interrupt Controller.
//
//--------------------------------------------------------------------
int microblaze_init()
{
// Register profile_intr_handler
// 1. If timer is connected to Interrupt Controller, register the handler
// to Interrupt Controllers vector table.
// 2. If timer is directly connected to MicroBlaze, register the handler
// as Interrupt handler
#ifdef TIMER_CONNECT_INTC
XIntc_RegisterHandler( INTC_BASEADDR, PROFILE_TIMER_INTR_ID,
(XInterruptHandler)profile_intr_handler,(void*)0);
#else
microblaze_register_handler( (XInterruptHandler)profile_intr_handler,
(void *)0) ;
#endif
// Initialize the timer with Timer Ticks
opb_timer_init() ;
// Enable Interrupts in the System, if Profile Timer is the only Interrupt
// in the System.
#ifdef ENABLE_SYS_INTR
#ifdef TIMER_CONNECT_INTC
XIntc_mMasterEnable( INTC_BASEADDR );
XIntc_SetIntrSvcOption( INTC_BASEADDR, XIN_SVC_ALL_ISRS_OPTION);
XIntc_mEnableIntr( INTC_BASEADDR, PROFILE_TIMER_INTR_MASK );
#endif
microblaze_enable_interrupts();
#endif
}
#endif // PROC_MICROBLAZE
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_timer_hw.h
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_timer_hw.h?rev=1.1&content-type=text/x-cvsweb-markup
Index: _profile_timer_hw.h
===================================================================
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Header: /cvsroot/quickwayne/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/_profile_timer_hw.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
// $Id: _profile_timer_hw.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
// _program_timer_hw.h:
// Timer related functions
//
//////////////////////////////////////////////////////////////////////
#ifndef _PROFILE_TIMER_HW_H
#define _PROFILE_TIMER_HW_H
#include "profile.h"
#ifdef PROC_PPC
#include "xexception_l.h"
#include "xtime_l.h"
#include "xpseudo_asm.h"
#endif
#ifdef TIMER_CONNECT_INTC
#include "xintc_l.h"
#include "xintc.h"
#endif // TIMER_CONNECT_INTC
#ifndef PPC_PIT_INTERRUPT
#include "xtmrctr_l.h"
#endif
extern unsigned int timer_clk_ticks ;
//--------------------------------------------------------------------
// PowerPC Target - Timer related functions
//--------------------------------------------------------------------
#ifdef PROC_PPC
#ifdef PPC_PIT_INTERRUPT
unsigned long timer_lo_clk_ticks ; // Clk ticks when Timer is disabled in CG
#endif
//--------------------------------------------------------------------
// Disable the Timer - During Profiling
//
// For PIT Timer -
// 1. XTime_PITDisableInterrupt() ;
// 2. Store the remaining timer clk tick
// 3. Stop the PIT Timer
//--------------------------------------------------------------------
#ifdef PPC_PIT_INTERRUPT
#define disable_timer() \
{ \
unsigned long val; \
val=mfspr(XREG_SPR_TCR); \
mtspr(XREG_SPR_TCR, val & ~XREG_TCR_PIT_INTERRUPT_ENABLE); \
timer_lo_clk_ticks = mfspr(XREG_SPR_PIT); \
mtspr(XREG_SPR_PIT, 0); \
}
#else
#define disable_timer() \
{ \
XTmrCtr_mDisable(PROFILE_TIMER_BASEADDR, 0 ); \
}
#endif
//--------------------------------------------------------------------
// Enable the Timer
//
// For PIT Timer -
// 1. Load the remaining timer clk ticks
// 2. XTime_PITEnableInterrupt() ;
//--------------------------------------------------------------------
#ifdef PPC_PIT_INTERRUPT
#define enable_timer() \
{ \
unsigned long val; \
val=mfspr(XREG_SPR_TCR); \
mtspr(XREG_SPR_PIT, timer_lo_clk_ticks); \
mtspr(XREG_SPR_TCR, val | XREG_TCR_PIT_INTERRUPT_ENABLE); \
}
#else
#define enable_timer() \
{ \
XTmrCtr_mEnable(PROFILE_TIMER_BASEADDR, 0 ); \
}
#endif
//--------------------------------------------------------------------
// Send Ack to Timer Interrupt
//
// For PIT Timer -
// 1. Load the timer clk ticks
// 2. Enable AutoReload and Interrupt
// 3. Clear PIT Timer Status bits
//--------------------------------------------------------------------
#ifdef PPC_PIT_INTERRUPT
#define timer_ack() \
{ \
unsigned long val; \
mtspr(XREG_SPR_PIT, timer_clk_ticks); \
mtspr(XREG_SPR_TSR, XREG_TSR_PIT_INTERRUPT_STATUS); \
val=mfspr(XREG_SPR_TCR); \
mtspr(XREG_SPR_TCR, val| XREG_TCR_PIT_INTERRUPT_ENABLE| XREG_TCR_AUTORELOAD_ENABLE); \
}
#else
#define timer_ack() \
{ \
unsigned int csr; \
csr = XTmrCtr_mGetControlStatusReg(PROFILE_TIMER_BASEADDR, 0); \
XTmrCtr_mSetControlStatusReg(PROFILE_TIMER_BASEADDR, 0, csr); \
}
#endif
//--------------------------------------------------------------------
#endif // PROC_PPC
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// MicroBlaze Target - Timer related functions
//--------------------------------------------------------------------
#ifdef PROC_MICROBLAZE
//--------------------------------------------------------------------
// Disable the Timer during Call-Graph Data collection
//
//--------------------------------------------------------------------
#define disable_timer() \
{ \
XTmrCtr_mDisable(PROFILE_TIMER_BASEADDR, 0 ); \
}
//--------------------------------------------------------------------
// Enable the Timer after Call-Graph Data collection
//
//--------------------------------------------------------------------
#define enable_timer() \
{ \
XTmrCtr_mEnable(PROFILE_TIMER_BASEADDR, 0 ); \
}
//--------------------------------------------------------------------
// Send Ack to Timer Interrupt
//
//--------------------------------------------------------------------
#define timer_ack() \
{ \
unsigned int csr; \
csr = XTmrCtr_mGetControlStatusReg(PROFILE_TIMER_BASEADDR, 0); \
XTmrCtr_mSetControlStatusReg(PROFILE_TIMER_BASEADDR, 0, csr); \
}
//--------------------------------------------------------------------
#endif // PROC_MICROBLAZE
//--------------------------------------------------------------------
#endif
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/dummy.S
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/dummy.S?rev=1.1&content-type=text/x-cvsweb-markup
Index: dummy.S
===================================================================
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: dummy.S,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
.globl dummy_f
#ifdef PROC_MICROBLAZE
.text
.align 2
.ent dummy_f
dummy_f:
nop
.end dummy_f
#endif
#ifdef PROC_PPC
.section .text
.align 2
.type dummy_f at function
dummy_f:
b dummy_f
#endif
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/mblaze_nt_types.h
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/mblaze_nt_types.h?rev=1.1&content-type=text/x-cvsweb-markup
Index: mblaze_nt_types.h
===================================================================
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Header: /cvsroot/quickwayne/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/mblaze_nt_types.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
// $Id: mblaze_nt_types.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
//////////////////////////////////////////////////////////////////////
#ifndef _MBLAZE_NT_TYPES_H
#define _MBLAZE_NT_TYPES_H
typedef char byte;
typedef short half;
typedef int word;
typedef unsigned char ubyte;
typedef unsigned short uhalf;
typedef unsigned int uword;
typedef ubyte boolean;
//typedef unsigned char u_char;
//typedef unsigned short u_short;
//typedef unsigned int u_int;
//typedef unsigned long u_long;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
#endif
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile.h
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile.h?rev=1.1&content-type=text/x-cvsweb-markup
Index: profile.h
===================================================================
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Header: /cvsroot/quickwayne/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
// $Id: profile.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
//////////////////////////////////////////////////////////////////////
#ifndef _PROFILE_H
#define _PROFILE_H 1
#include <stdio.h>
#include "mblaze_nt_types.h"
#include "profile_config.h"
void _system_init( void ) ;
void _system_clean( void ) ;
void mcount(unsigned long frompc, unsigned long selfpc);
void profile_intr_handler( void ) ;
/****************************************************************************
* Profiling on hardware - Hash table maintained on hardware and data sent
* to xmd for gmon.out generation.
****************************************************************************/
/*
* histogram counters are unsigned shorts (according to the kernel).
*/
#define HISTCOUNTER unsigned short
struct tostruct {
unsigned long selfpc;
long count;
short link;
unsigned short pad;
};
struct fromstruct {
unsigned long frompc ;
short link ;
unsigned short pad ;
} ;
/*
* general rounding functions.
*/
#define ROUNDDOWN(x,y) (((x)/(y))*(y))
#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
/*
* The profiling data structures are housed in this structure.
*/
struct gmonparam {
long int state;
// Histogram Information
unsigned short *kcount; /* No. of bins in histogram */
unsigned long kcountsize; /* Histogram samples */
// Call-graph Information
struct fromstruct *froms;
unsigned long fromssize;
struct tostruct *tos;
unsigned long tossize;
// Initialization I/Ps
unsigned long lowpc;
unsigned long highpc;
unsigned long textsize;
//unsigned long cg_froms;
//unsigned long cg_tos;
};
extern struct gmonparam *_gmonparam;
extern int n_gmon_sections;
/*
* Possible states of profiling.
*/
#define GMON_PROF_ON 0
#define GMON_PROF_BUSY 1
#define GMON_PROF_ERROR 2
#define GMON_PROF_OFF 3
/*
* Sysctl definitions for extracting profiling information from the kernel.
*/
#define GPROF_STATE 0 /* int: profiling enabling variable */
#define GPROF_COUNT 1 /* struct: profile tick count buffer */
#define GPROF_FROMS 2 /* struct: from location hash bucket */
#define GPROF_TOS 3 /* struct: destination/count structure */
#define GPROF_GMONPARAM 4 /* struct: profiling parameters (see above) */
#endif /* _PROFILE_H */
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_cg.c
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_cg.c?rev=1.1&content-type=text/x-cvsweb-markup
Index: profile_cg.c
===================================================================
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: profile_cg.c,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
#include "mblaze_nt_types.h"
#include "profile.h"
#include "_profile_timer_hw.h"
/*
* The mcount fucntion is excluded from the library, if the user defines
* PROFILE_NO_GRAPH.
*/
#ifndef PROFILE_NO_GRAPH
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern struct gmonparam *_gmonparam;
void mcount( unsigned long frompc, unsigned long selfpc )
{
register struct gmonparam *p;
register long toindex, fromindex;
int i, j;
disable_timer();
//print("CG: "); putnum(frompc); print("->"); putnum(selfpc); print("\r\n");
// check that frompcindex is a reasonable pc value.
// for example: signal catchers get called from the stack,
// not from text space. too bad.
//
for(j = 0; j < n_gmon_sections; j++ ){
if((frompc >= _gmonparam[j].lowpc) && (frompc < _gmonparam[j].highpc)) {
p = &_gmonparam[j];
break;
}
}
if( j == n_gmon_sections )
goto done;
#ifdef PROFILE_NO_FUNCPTR
fromindex = searchpc( p->cgtable, p->cgtable_size, frompc ) ;
if( fromindex == -1 ) {
fromindex = p->cgtable_size ;
p->cgtable_size++ ;
p->cgtable[fromindex].frompc = frompc ;
p->cgtable[fromindex].selfpc = selfpc ;
p->cgtable[fromindex].count = 1 ;
goto done ;
}
p->cgtable[fromindex].count++ ;
#else
fromindex = searchpc( p->froms, p->fromssize, frompc ) ;
if( fromindex == -1 ) {
fromindex = p->fromssize ;
p->fromssize++ ;
//if( fromindex >= N_FROMS ) {
//print("Error : From PC table overflow\r\n") ;
//goto overflow ;
//}
p->froms[fromindex].frompc = frompc ;
p->froms[fromindex].link = -1 ;
}else {
toindex = p->froms[fromindex].link ;
while(toindex != -1) {
toindex = (p->tossize - toindex)-1 ;
if( p->tos[toindex].selfpc == selfpc ) {
p->tos[toindex].count++ ;
goto done ;
}
toindex = p->tos[toindex].link ;
}
}
//if( toindex == -1 ) {
p->tos-- ;
p->tossize++ ;
//if( toindex >= N_TOS ) {
//print("Error : To PC table overflow\r\n") ;
//goto overflow ;
//}
p->tos[0].selfpc = selfpc ;
p->tos[0].count = 1 ;
p->tos[0].link = p->froms[fromindex].link ;
p->froms[fromindex].link = p->tossize-1 ;
#endif
done:
p->state = GMON_PROF_ON;
goto enable_timer ;
overflow:
p->state = GMON_PROF_ERROR;
enable_timer:
enable_timer();
return ;
}
#ifdef PROFILE_NO_FUNCPTR
int searchpc( struct fromto_struct *cgtable, int cgtable_size, unsigned long frompc )
{
int index = 0 ;
while( (index < cgtable_size) && (cgtable[index].frompc != frompc) ){
index++ ;
}
if( index == cgtable_size )
return -1 ;
else
return index ;
}
#else
int searchpc( struct fromstruct *froms, int fromssize, unsigned long frompc )
{
int index = 0 ;
while( (index < fromssize) && (froms[index].frompc != frompc) ){
index++ ;
}
if( index == fromssize )
return -1 ;
else
return index ;
}
#endif /* PROFILE_NO_FUNCPTR */
#endif /* PROFILE_NO_GRAPH */
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_config.h
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_config.h?rev=1.1&content-type=text/x-cvsweb-markup
Index: profile_config.h
===================================================================
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Header: /cvsroot/quickwayne/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_config.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
// $Id: profile_config.h,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
//////////////////////////////////////////////////////////////////////
#ifndef _PROFILE_CONFIG_H
#define _PROFILE_CONFIG_H
#define BINSIZE 4
#define SAMPLE_FREQ_HZ 100000
#define TIMER_CLK_TICKS 1000
#define PROFILE_NO_FUNCPTR_FLAG 0
//#define PROFILE_TIMER_BASEADDR 0x0c000500
#define PROFILE_TIMER_BASEADDR 0x00608000
#define PROFILE_TIMER_INTR_ID 0
#define TIMER_CONNECT_INTC
#endif
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_hist.c
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_hist.c?rev=1.1&content-type=text/x-cvsweb-markup
Index: profile_hist.c
===================================================================
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: profile_hist.c,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
#include "profile.h"
#include "mblaze_nt_types.h"
#include "_profile_timer_hw.h"
#ifdef PROC_PPC
#include "xpseudo_asm.h"
#define SPR_SRR0 0x01A
#endif
extern int binsize ;
uint32_t pc ;
void profile_intr_handler( void )
{
unsigned int csr, j ;
#ifdef PROC_MICROBLAZE
asm( "swi r14, r0, pc" ) ;
#else
pc = mfspr(SPR_SRR0);
#endif
//print("PC: "); putnum(pc); print("\r\n");
for(j = 0; j < n_gmon_sections; j++ ){
if((pc >= _gmonparam[j].lowpc) && (pc < _gmonparam[j].highpc)) {
_gmonparam[j].kcount[(pc-_gmonparam[j].lowpc)/(4 * binsize)]++;
break;
}
}
// Ack the Timer Interrupt
timer_ack();
}
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_mcount_mb.S
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_mcount_mb.S?rev=1.1&content-type=text/x-cvsweb-markup
Index: profile_mcount_mb.S
===================================================================
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: profile_mcount_mb.S,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
.globl _mcount
.text
.align 2
.ent _mcount
#ifndef PROFILE_NO_GRAPH
_mcount:
addi r1, r1, -40
swi r5, r1, 36
swi r6, r1, 32
swi r7, r1, 28
swi r8, r1, 24
swi r9, r1, 20
swi r10, r1, 16
swi r16, r1, 12
add r5, r0, r15
brlid r15, mcount
add r6, r0, r16
lwi r5, r1, 36
lwi r6, r1, 32
lwi r7, r1, 28
lwi r8, r1, 24
lwi r9, r1, 20
lwi r10, r1, 16
lwi r16, r1, 12
rtbd r16, 4
addi r1, r1, 40
#endif /* PROFILE_NO_GRAPH */
.end _mcount
1.1 mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_mcount_ppc.S
http://www.opencores.org/cvsweb.shtml/mb-jpeg/microblaze_0/libsrc/standalone_v1_00_a/src/profile/profile_mcount_ppc.S?rev=1.1&content-type=text/x-cvsweb-markup
Index: profile_mcount_ppc.S
===================================================================
//
// Copyright (c) 2002 Xilinx, Inc. All rights reserved.
// Xilinx, Inc.
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: profile_mcount_ppc.S,v 1.1 2006/06/23 19:03:44 quickwayne Exp $
//
.globl _mcount
#define _MCOUNT_STACK_FRAME 40
.section .text
.align 2
.type _mcount at function
_mcount:
stwu 1, -_MCOUNT_STACK_FRAME(1)
stw 3, 8(1)
stw 4, 12(1)
stw 5, 16(1)
stw 6, 20(1)
stw 7, 24(1)
stw 8, 28(1)
stw 9, 32(1)
stw 10, 36(1)
mflr 4
stw 4, (_MCOUNT_STACK_FRAME+4)(1)
lwz 3, (_MCOUNT_STACK_FRAME)(1)
lwz 3, 4(3)
bl mcount
lwz 4, (_MCOUNT_STACK_FRAME+4)(1)
mtlr 4
lwz 10, 36(1)
lwz 9, 32(1)
lwz 8, 28(1)
lwz 7, 24(1)
lwz 6, 20(1)
lwz 5, 16(1)
lwz 4, 12(1)
lwz 3, 8(1)
addi 1,1, _MCOUNT_STACK_FRAME
blr
|
 |