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

📄 vxalib.s

📁 VxWorks BSP框架源代码包含头文件和驱动
💻 S
📖 第 1 页 / 共 5 页
字号:
/* vxALib.s - miscellaneous assembly language routines *//* Copyright 1984-2002 Wind River Systems, Inc. */	.data	.globl	copyright_wind_river	.long	copyright_wind_river/*modification history --------------------03e,18jun03,mil  Fixed build error with Diab.03d,21feb03,dtr  Adding vxHid1Set function fixed timebase function 	         compilation error.03c,02dec02,mil  Updated for PPC85XX.03b,03sep02,dtr  Wrap #ifndef around some insructions not available for 85XX.03a,03aug02,pcs  Add support for PPC85XX and make it the same as PPC603 for                 the present.02z,09may02,dtr  Adding vxPlprcrSet function for SPR34619.02y,24apr02,pch  add sync instructions in vxMemProbeSup() to ensure exception                 is detected before function returns02x,19apr02,pch  SPR 7319502w,17apr02,jtp  Fix SPR 73662. remove PPC440 vxDecReload declaration.	         Apply FUNC_BEGIN/FUNC_END throughout02v,12dec01,kab  Added vxImmr*Get routines to return ISB and DEV.02u,03dec01,sn   Moved save/restore functions to target/src/tool/common02t,24oct01,jtp  Added 440 Decrementer Interrupt support02s,22oct01,dtr  Fix for SPR65678. Code for PPC860 should lock/unlock keyed                 registers due to board lock up/register corruption. S/W fix                 for h/w problem.02r,08oct01,mil  modified workaround for 750CX/CXe erratum #16 for stwcx. wrong                 store (SPR 65319).02q,25sep01,yvp  Fix SPR62760: Use _WRS_TEXT_SEG_START macro instead of .align02p,15aug01,pch  Add PPC440 support02o,29may01,pch  Fix for IBM 750CX errata #16 (SPR 65319)02n,08may01,pch  Add assembler abstractions (FUNC_EXPORT, FUNC_BEGIN, etc.)02m,17apr01,dat  65984, portable C Code, added vxDecReload, vxHid1Get02l,04dec00,s_m  updated due to changes in ppc405.h02k,25oct00,s_m  renamed PPC405 cpu types02j,18oct00,s_m  fixed reading of timebase for PPC40502i,06oct00,sm   PPC405 support02h,14mar00,tam  added vxMdCtrSet/Get, vxMiCtrSet/Get and vxMTwbGet02g,22feb00,jgn  update global syms to use GTEXT & GDATA02f,24mar99,tpr  added PowerPC 555 and 509 support.02e,18aug98,tpr  added PowerPC EC 603 support.02d,01aug97,mas  added eieio ordering to vxTas() (SPR 9061).02c,22jul97,tpr  added sync instruction arround HID0 modification (SPR #8976)02b,14jul97,mas  added support for DAR, DSISR, SRR0 and SRR1 regs (SPR 8918).02a,28mar97,tam  added some DMA register access routines (PPC403 specific).01z,10feb97,tam  added vxFpscrGet/Set() functions.01y,23oct96,tam  added vxPowerDown() to enable power management. 01x,08nov96,mas  changed sync to isync in vxMemProbeSup (SPR 7444).01w,29jul96,jds  added vxEieio() to enforce in-order execution for drivers01v,18jun96,tam  added PPC403 specific routines to access debug register.01u,17jun96,tpr  added vxDerGet() and vxDerSet() for PPC860		 added vxImmrGet() and vxImmrSet().01t,29may96,tam  changed code and fixed typo error for vxTimeBaseGet() 		 (spr #6614). Added PPC403 support for vxTimeBaseGet/Set.01s,13may96,ms   vxPvrGet no longer masks off lower bits01r,08mar96,tam  added forward declarations for PPC403. Added function 		 vxBesrSet ().01q,29feb96,kkk  added vxHid0[GS]et() for PPC601.01p,27feb96,ms   removed vxMemProbeTrap. Made "vmpxx" global.01o,23feb96,tpr  added vxHid0Set() and vxPvrGet().01n,14feb96,tpr  split PPC603 and PPC604.01m,07dec95,kvk  added vxTas().01l,09oct95,tpr  added vxGhsFlagSet().01k,24sep95,tpr  added vxHid0Get ().01j,03aug95,caf  no longer modify machine state register in vxFitIntEnable().01i,22jun95,caf  cleanup of register save/restore routines.01h,27apr95,caf  removed vxDecIntEnable().01g,29mar95,caf  added register save/restore routine names in order		 to satisfy both Diab Data and Green Hills tools.		 removed #ifndef _GREEN_TOOL.01f,22mar95,caf  added register save/restore routines, courtesy Diab Data.01e,09feb95,yao  fixed vxMemProbeTrap for PPC403.01d,03feb95,caf  cleanup.01c,19jan95,yao  added vxFirstBit(), vxExisrGet(), vxExisrClear(),		 vxExier{G,S}et(), vxDccr{G,S}et(), vxIccr{G,S}et(), 		 vxIocr{G,S}et(), vxEvpr{G,S}et() for 403. added vxMsrGet ()		 for debugging popourse.  changed to use m{t,f}tb[u] mnemonics.		 forced tbl to zero before setting the timer base.01b,10oct94,yao  added vxMemProbeSup, vxMemProbeTrap.01a,02jun94,yao  written.*//*DESCRIPTIONThis module contains miscellaneous VxWorks support routines.SEE ALSO: vxLib*/#define PPC750CX_ERRATUM_16_STWCX    /* IBM PPC750CX/CXe DD2.0-2.3 erratum #16                                      * stwcx. after snoop hit may store wrong                                      * data. As cost to eval PVR might be                                      * higher using static workaround for now                                      */#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "arch/ppc/excPpcLib.h"	#if	(CPU == PPC860)	/* necessary to prevent name clashes */#define PLPRCR_OFFSET 0x284 /* see MPC860 Users Manual */#endif	/* CPU == PPC860 */	FUNC_EXPORT(vxTimeBaseSet)	FUNC_EXPORT(vxTimeBaseGet)	FUNC_EXPORT(vxMemProbeSup)	FUNC_EXPORT(vxMsrGet)	FUNC_EXPORT(vxMsrSet)#if (CPU == PPC85XX)	FUNC_EXPORT(vxDearGet)	FUNC_EXPORT(vxDearSet)	FUNC_EXPORT(vxCsrr0Get)	FUNC_EXPORT(vxCsrr0Set)	FUNC_EXPORT(vxCsrr1Get)	FUNC_EXPORT(vxCsrr1Set)	FUNC_EXPORT(vxMcsrr0Get)	FUNC_EXPORT(vxMcsrr0Set)	FUNC_EXPORT(vxMcsrr1Get)	FUNC_EXPORT(vxMcsrr1Set)	FUNC_EXPORT(vxSpefscrGet)	FUNC_EXPORT(vxSpefscrSet)	FUNC_EXPORT(vxDecarSet)	FUNC_EXPORT(vxL1CSR0Get)	FUNC_EXPORT(vxL1CSR0Set)	FUNC_EXPORT(vxL1CSR1Get)	FUNC_EXPORT(vxL1CSR1Set)	FUNC_EXPORT(vxL1CFG0Get)	FUNC_EXPORT(vxL1CFG1Get)#else  /* CPU == PPC85XX */	FUNC_EXPORT(vxDarGet)	FUNC_EXPORT(vxDarSet)	FUNC_EXPORT(vxDsisrGet)	FUNC_EXPORT(vxDsisrSet)#endif  /* CPU == PPC85XX */	FUNC_EXPORT(vxSrr0Get)	FUNC_EXPORT(vxSrr0Set)	FUNC_EXPORT(vxSrr1Get)	FUNC_EXPORT(vxSrr1Set)	FUNC_EXPORT(vxPvrGet)	FUNC_EXPORT(vxFirstBit)	FUNC_EXPORT(vxEieio)	FUNC_EXPORT(vxPowerDown)#if	((CPU == PPC509) || (CPU == PPC555)   || (CPU == PPC601) || \         (CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604) || \	 (CPU == PPC405F))	FUNC_EXPORT(vxFpscrGet)	FUNC_EXPORT(vxFpscrSet)#endif	/* ((CPU == PPC509) || (CPU == PPC555)   || (CPU == PPC601) || \            (CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604)) */#if     ((CPU == PPC601) || (CPU == PPC603) || (CPU == PPCEC603) || \	 (CPU == PPC604) || (CPU == PPC85XX))	FUNC_EXPORT(vxHid0Get)	FUNC_EXPORT(vxHid0Set)	FUNC_EXPORT(vxHid1Get)	FUNC_EXPORT(vxHid1Set)#endif /* CPU == PPC6xx, PPC85XX */	FUNC_EXPORT(vxGhsFlagSet)	FUNC_EXPORT(vxTas)	FUNC_EXPORT(vmpxx)#if	((CPU == PPC509) || (CPU == PPC555)   || (CPU == PPC601) || \         (CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604) || \	 (CPU == PPC860) || (CPU == PPC440) || (CPU == PPC85XX))	FUNC_EXPORT(vxDecSet)	FUNC_EXPORT(vxDecGet)#endif	/* ((CPU == PPC509) || (CPU == PPC555)   || (CPU == PPC601) || \            (CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604) || \	    (CPU == PPC860) || (CPU == PPC440) || (CPU == PPC85XX)) */#if	((CPU == PPC509) || (CPU == PPC555)   || (CPU == PPC601) || \         (CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604) || \	 (CPU == PPC860))	FUNC_EXPORT(vxDecReload)#endif	/* ((CPU == PPC509) || (CPU == PPC555)   || (CPU == PPC601) || \            (CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604) || \	    (CPU == PPC860)) */	#if     (CPU == PPC860 )	FUNC_EXPORT(vxKeyedDecReload)	FUNC_EXPORT(vxPlprcrSet)	/* Set the PLPRCR memory based register */#endif  /* CPU==PPC860 */	#if	((CPU == PPC403) || (CPU == PPC405) || (CPU == PPC405F) || \	 (CPU == PPC440) || (CPU == PPC85XX))# if	 ((CPU == PPC440) || (CPU == PPC85XX))	FUNC_EXPORT(vxDbcr2Get)	FUNC_EXPORT(vxDbcr2Set)	FUNC_EXPORT(vxDecIntEnable)	FUNC_EXPORT(vxDecIntAck)# else	/* CPU == PPC440 */	FUNC_EXPORT(vxPitSet)	FUNC_EXPORT(vxPitGet)	FUNC_EXPORT(vxPitIntEnable)	FUNC_EXPORT(vxPitIntAck)# endif	/* CPU == PPC440 */	FUNC_EXPORT(vxFitIntEnable)	FUNC_EXPORT(vxFitIntDisable)	FUNC_EXPORT(vxFitIntAck)# if     (CPU == PPC403)	FUNC_EXPORT(vxExisrGet)	FUNC_EXPORT(vxExisrClear)	FUNC_EXPORT(vxExierGet)	FUNC_EXPORT(vxExierSet)# endif /* (CPU == PPC403) */# ifndef PPC_NO_REAL_MODE	FUNC_EXPORT(vxDccrGet)	FUNC_EXPORT(vxDccrSet)	FUNC_EXPORT(vxIccrGet)	FUNC_EXPORT(vxIccrSet)# endif	/* PPC_NO_REAL_MODE */# ifdef IVPR	FUNC_EXPORT(vxIvprGet)	FUNC_EXPORT(vxIvprSet)# else	/* IVPR */	FUNC_EXPORT(vxEvprGet)	FUNC_EXPORT(vxEvprSet)# endif	/* IVPR */# if     (CPU == PPC403)	FUNC_EXPORT(vxIocrSet)	FUNC_EXPORT(vxIocrGet)# endif /* (CPU == PPC403) */	FUNC_EXPORT(vxTcrGet)	FUNC_EXPORT(vxTcrSet)	FUNC_EXPORT(vxTsrGet)	FUNC_EXPORT(vxTsrSet)# if     (CPU == PPC403)	FUNC_EXPORT(vxBesrSet)	FUNC_EXPORT(vxDbcrGet)	FUNC_EXPORT(vxDbcrSet)# elif	((CPU == PPC405) || (CPU == PPC405F) || (CPU == PPC440) || \	 (CPU == PPC85XX))	FUNC_EXPORT(vxDbcr0Get)	FUNC_EXPORT(vxDbcr0Set)	FUNC_EXPORT(vxDbcr1Get)	FUNC_EXPORT(vxDbcr1Set)# if	 ((CPU == PPC440) || (CPU == PPC85XX))	FUNC_EXPORT(vxDbcr2Get)	FUNC_EXPORT(vxDbcr2Set)# endif	/* CPU == PPC440, PPC85XX */# endif /* (CPU == PPC403 : PPC405 || PPC405F || PPC440 || PPC85XX */	FUNC_EXPORT(vxDbsrGet)	FUNC_EXPORT(vxDbsrClear)	FUNC_EXPORT(vxDac1Get)	FUNC_EXPORT(vxDac1Set)	FUNC_EXPORT(vxDac2Get)	FUNC_EXPORT(vxDac2Set)	FUNC_EXPORT(vxIac1Get)	FUNC_EXPORT(vxIac1Set)	FUNC_EXPORT(vxIac2Get)	FUNC_EXPORT(vxIac2Set)# if     ((CPU == PPC405) || (CPU == PPC405F) || (CPU == PPC440))        FUNC_EXPORT(vxIac3Get)        FUNC_EXPORT(vxIac3Set)        FUNC_EXPORT(vxIac4Get)        FUNC_EXPORT(vxIac4Set)# endif /* ((CPU == PPC405) || (CPU == PPC405F) || (CPU == PPC440)) */# if 	(CPU == PPC403)	FUNC_EXPORT(vxDmacrSet)	FUNC_EXPORT(vxDmacrGet)	FUNC_EXPORT(vxDmasrSet)	FUNC_EXPORT(vxDmasrGet)	FUNC_EXPORT(vxDmaccSet)	FUNC_EXPORT(vxDmaccGet)	FUNC_EXPORT(vxDmactSet)	FUNC_EXPORT(vxDmactGet)	FUNC_EXPORT(vxDmadaSet)	FUNC_EXPORT(vxDmadaGet)	FUNC_EXPORT(vxDmasaSet)	FUNC_EXPORT(vxDmasaGet)# endif	/* (CPU == PPC403) */#endif	/* CPU == PPC4xx, PPC85XX */#if	((CPU == PPC555) || (CPU == PPC860))	FUNC_EXPORT(vxImmrSet)		/* Set the IMMR register */	FUNC_EXPORT(vxImmrGet) 		/* Get the IMMR register */#endif	/* ((CPU == PPC555) || (CPU == PPC860)) */#if	((CPU == PPC555) || (CPU == PPC860) || \	 (CPU == PPC603) || (CPU == PPC604) || (CPU == PPC85XX))	FUNC_EXPORT(vxImmrIsbGet)	/* Get ISB bits of IMMR */	FUNC_EXPORT(vxImmrDevGet)	/* Get PART/MASK bits of IMMR */#endif	/* ((CPU == PPC555 || PPC860) || PPC603) || PC604)) */#if	((CPU == PPC509) || (CPU == PPC860))	FUNC_EXPORT(vxIcCstSet)		/* Set the IC_CST register */	FUNC_EXPORT(vxIcCstGet)		/* Get the IC_CST register */	FUNC_EXPORT(vxIcAdrSet)		/* Set the IC_ADR register */	FUNC_EXPORT(vxIcDatGet)		/* Get the IC_DAT register */#endif	/* ((CPU == PPC509) || (CPU == PPC860)) */#if	(CPU == PPC555)	FUNC_EXPORT(vxImemBaseSet)	/* Set the internal memory base addr */	FUNC_EXPORT(vxImemBaseGet) 	/* Get the internal memory base addr */#endif	/* (CPU == PPC555) */#if	(CPU == PPC860)	FUNC_EXPORT(vxDerSet)		/* Set the DER register */	FUNC_EXPORT(vxDerGet)		/* Get the DER register */	FUNC_EXPORT(vxMTwbSet)		/* Set the M_TWB register */	FUNC_EXPORT(vxMTwbGet)		/* Get the M_TWB register */	FUNC_EXPORT(vxMdCtrSet)		/* Set the MD_CTR register */	FUNC_EXPORT(vxMdCtrGet)		/* Get the MD_CTR register */	FUNC_EXPORT(vxMiCtrSet)		/* Set the MI_CTR register */	FUNC_EXPORT(vxMiCtrGet)		/* Get the MI_CTR register */	FUNC_EXPORT(vxDcCstSet)		/* Set the DC_CST register */	FUNC_EXPORT(vxDcCstGet)		/* Get the DC_CST register */	FUNC_EXPORT(vxDcAdrSet)		/* Set the DC_ADR register */	FUNC_EXPORT(vxDcDatGet)		/* Get the DC_DAT register */#endif	/* (CPU == PPC860) */	.extern	VAR_DECL(vxPowMgtEnable) /* power management status */#if (CPU == PPC860)	.extern VAR_DECL(vx860KeyedRegUsed) /* ppc keyed reg used for bsps with */#endif	_WRS_TEXT_SEG_START	/********************************************************************************* vxTas - this routine performs the atomic test and set for the PowerPC arch.** RETURN: None.*/FUNC_BEGIN(vxTas)	lis	r4, 0x8000	/* set the upper bit of r4 */#ifdef PPC750CX_ERRATUM_16_STWCX        sync                    /* SPR 65319:  empty L1 store queues                                 * to ensure they are not full when stwcx.                                 * executes.  The next lwarx might cause                                 * one L1 store queue to fill (dirty blk                                 * replacement) but another should be                                 * empty.                                 * ****************************************                                 * **** Future code change might need  ****                                 * **** to replace sync with eieio and ****                                 * **** add sync closer to stwcx.      ****                                 * ****************************************                                 */#else        eieio                   /* simple ordered store using eieio */#endif  /* PPC750CX_ERRATUM_16_STWCX */	lwarx	r5, 0, r3	/* load and reserve */	cmpwi	r5, 0		/* done if word */	bne	vxTasEnd	/* not equal to 0 */	stwcx.	r4, 0, r3	/* try to store non-zero */	eieio			/* preserve load/store order */	bne-	vxTas	li	r3, 0x01	blrvxTasEnd:	li	r3, 0	blrFUNC_END(vxTas)/********************************************************************************* vxMsrGet - this routine returns the content of msr** RETURN: content of msr.*/FUNC_BEGIN(vxMsrGet)	mfmsr	p0			/* read msr */	blrFUNC_END(vxMsrGet)/********************************************************************************* vxMsrSet - this routine returns the content of msr** RETURN: N/A.*/FUNC_BEGIN(vxMsrSet)	mtmsr	p0			/* set msr */	isync	blrFUNC_END(vxMsrSet)#if (CPU == PPC85XX)/***************************************************************************** vxDearGet - this routine returns the content of DEAR** RETURNS: content of DEAR**/FUNC_BEGIN(vxDearGet)        mfspr   p0, DEAR        blrFUNC_END(vxDearGet)/***************************************************************************** vxDearSet - this routine sets the content of DEAR** RETURNS: none**/FUNC_BEGIN(vxDearSet)        mtspr   DEAR, p0        blrFUNC_END(vxDearSet)/***************************************************************************** vxCsrr0Get - this routine returns the content of CSRR0** RETURNS: content of CSRR0**/FUNC_BEGIN(vxCsrr0Get)        mfspr   p0, CSRR0        blrFUNC_END(vxCsrr0Get)/***************************************************************************** vxCsrr0Set - this routine sets the content of CSRR0** RETURNS: none**/FUNC_BEGIN(vxCsrr0Set)        mtspr   CSRR0, p0        blrFUNC_END(vxCsrr0Set)/***************************************************************************** vxCsrr1Get - this routine returns the content of CSRR1** RETURNS: content of CSRR1**/FUNC_BEGIN(vxCsrr1Get)        mfspr   p0, CSRR1        blrFUNC_END(vxCsrr1Get)/***************************************************************************** vxCsrr1Set - this routine sets the content of CSRR1** RETURNS: none**/FUNC_BEGIN(vxCsrr1Set)        mtspr   CSRR1, p0        blrFUNC_END(vxCsrr1Set)/***************************************************************************** vxMcsrr0Get - this routine returns the content of MCSRR0** RETURNS: content of MCSRR0**/FUNC_BEGIN(vxMcsrr0Get)        mfspr   p0, MCSRR0        blrFUNC_END(vxMcsrr0Get)/***************************************************************************** vxMcsrr0Set - this routine sets the content of MCSRR0** RETURNS: none**/FUNC_BEGIN(vxMcsrr0Set)        mtspr   MCSRR0, p0        blrFUNC_END(vxMcsrr0Set)/***************************************************************************** vxMcsrr1Get - this routine returns the content of MCSRR1

⌨️ 快捷键说明

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