?? vxlib.c
字號(hào):
vxHid0Set ((vxHid0Get() & ~(_PPC_HID0_DOZE | _PPC_HID0_NAP | _PPC_HID0_SLEEP)) | hid0Mode);#endif /* CPU != PPC85XX */ return (OK);#elif (CPU == PPC604) /* set vxPowMgtEnable and vxPowMgtMode according to <mode> */ if (mode == VX_POWER_MODE_DISABLE) { vxPowMgtEnable = FALSE; vxPowMgtMode = VX_POWER_MODE_DISABLE; } else { if (mode == VX_POWER_MODE_NAP) { vxPowMgtMode = VX_POWER_MODE_NAP; vxPowMgtEnable = TRUE; } else return (ERROR); } return (OK);#elif ((CPU == PPC860) || (CPU == PPC555)) UINT32 plprcrVal = 0; # if (CPU == PPC555) int immrVal = vxImemBaseGet();# else /* CPU == PPC555 */ int immrVal = vxImmrGet();# endif /* CPU == PPC555 */ /* set plprcrVal, vxPowMgtEnable and vxPowMgtMode according to <mode> */ switch (mode) { case VX_POWER_MODE_DISABLE: plprcrVal = PLPRCR_LPM_NORMAL; vxPowMgtMode = VX_POWER_MODE_DISABLE; vxPowMgtEnable = FALSE; break; case VX_POWER_MODE_FULL: plprcrVal = PLPRCR_LPM_NORMAL; vxPowMgtMode = VX_POWER_MODE_FULL; vxPowMgtEnable = TRUE; break; case VX_POWER_MODE_DOZE: plprcrVal = PLPRCR_LPM_DOZE; vxPowMgtMode = VX_POWER_MODE_DOZE; vxPowMgtEnable = TRUE; break; case VX_POWER_MODE_SLEEP: plprcrVal = PLPRCR_LPM_SLEEP; vxPowMgtMode = VX_POWER_MODE_SLEEP; vxPowMgtEnable = TRUE; break; case VX_POWER_MODE_DEEP_SLEEP: plprcrVal = PLPRCR_LPM_DEEP_SLEEP; vxPowMgtMode = VX_POWER_MODE_DEEP_SLEEP; vxPowMgtEnable = TRUE; break; case VX_POWER_MODE_DOWN: plprcrVal = PLPRCR_LPM_DOWN | PLPRCR_TEXPS; vxPowMgtMode = VX_POWER_MODE_DOWN; vxPowMgtEnable = TRUE; break; default: return (ERROR); /* mode not supported */ } /* set new value for PLPRCR */# if (CPU == PPC860) if (vx860KeyedRegUsed==TRUE) { *PLPRCRK(immrVal) = 0x55ccaa33; /* KEYED_REG_UNLOCK_VALUE */ WRS_ASM(" isync"); plprcrVal |= (*PLPRCR(immrVal) & ~PLPRCR_LPM_MSK); /* the delay value of 3 is worst case scenario */ vxPlprcrSet ((UINT32*)immrVal,plprcrVal,3); *PLPRCRK(immrVal) = ~0x55ccaa33; /* ~KEYED_REG_UNLOCK_VALUE */ } else { plprcrVal |= (*PLPRCR(immrVal) & ~PLPRCR_LPM_MSK); /* the delay value of 3 is worst case scenario */ vxPlprcrSet ((UINT32*)immrVal,plprcrVal,3); }# else /* CPU == PPC860 */ *PLPRCR(immrVal) = (*PLPRCR(immrVal) & ~PLPRCR_LPM_MSK) | plprcrVal;# endif /* CPU == PPC860 */ return (OK);#else /* remaining cases are 403, 405, 405F, 440, 505, 509, 601, 602 */ return (ERROR); /* power management not supported */#endif /* ((CPU == PPC603) || (CPU == PPCEC603)) */ }/********************************************************************************* vxPowerModeGet - get the power management mode ** This routine returns the power management mode set via vxPowerDown().** RETURNS:* the power management mode (VX_POWER_MODE_DOZE, VX_POWER_MODE_NAP,* VX_POWER_MODE_SLEEP, VX_POWER_MODE_DEEP_SLEEP, VX_POWER_MODE_DPM,* VX_POWER_MODE_FULL, VX_POWER_MODE_DOWN or VX_POWER_MODE_DISABLE),* or ERROR if no power mode has been selected or power management is* not supported.** SEE ALSO:* vxPowerModeSet(), vxPowerDown()*/UINT32 vxPowerModeGet (void) {#if ((CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604) || \ (CPU == PPC860) || (CPU == PPC555) || (CPU == PPC85XX)) return (vxPowMgtMode); /* return mode set via vxPowerDown() */#else /* remaining cases are 403, 405, 405F, 440, 505, 509, 601, 602 */ return (ERROR); /* power management not supported */#endif /* PPC603, PPCEC603, PPC604, PPC860, PPC555 */ }#if (CPU==PPC403)/********************************************************************************* vxExierEnable - turn on external interrupt** This routine enables specified external interrupt by setting the exier.** RETURNS: old value of exier.**/UINT32 vxExierEnable ( UINT32 exier /* external interrupts to enable */ ) { int oldExier = vxExierGet (); vxExierSet ((oldExier | exier)); return (oldExier); }/********************************************************************************* vxExierDisable - turn off external interrupt** This routine disables specified external interrupt. ** RETURNS: old value of exier.**/UINT32 vxExierDisable ( UINT32 exier /* external interrupts to disable */ ) { int oldExier = vxExierGet (); vxExierSet ((oldExier & ~exier)); return (oldExier); }#endif /* CPU==PPC403 */#if 0 /*PCS Verify with DIAB folks. */#ifdef _DIAB_TOOL/* * Copyright 1995 Diab Data, Inc. * * Description : * Implemention of PowerPC ABI function * void *__va_arg(va_list argp, int type) * * History : * When Who What * 950523 teve initial */#undef __EABI__#define __EABI__ 1void *__va_arg(va_list argp, int type) { int index; char *rp; if (type == 1) { /* arg_WORD */ index = argp->__gpr; if (index < 8) { argp->__gpr = index + 1; return argp->__reg + index*4; } else { rp = argp->__mem; argp->__mem = rp + 4; return rp; } } else if (type == 3) { /* arg_ARGREAL */ index = argp->__fpr; if (index < 8) { argp->__fpr = index + 1; return argp->__reg + index*8 + 32; } else { rp = argp->__mem; rp = (char *)(((long)rp + 7) & ~7); argp->__mem = rp + 8; return rp; } } else if (type == 4) { /* arg_ARGSINGLE */ index = argp->__fpr; if (index < 8) { argp->__fpr = index + 1; return argp->__reg + index*4 + 32; } else { rp = argp->__mem; argp->__mem = rp + 4; return rp; } } else if (type == 2) { /* arg_DOUBLEWORD */ index = argp->__gpr; index = (index + 1) & ~1; if (index < 7) { argp->__gpr = index + 2; return argp->__reg + index*4; } else { rp = argp->__mem; argp->__gpr = index; rp = (char *)(((long)rp + 7) & ~7); argp->__mem = rp + 4; return rp; } } else if (type == 0) { /* arg_ARGPOINTER */ index = argp->__gpr; if (index < 8) { argp->__gpr = index + 1; return *(void **)(argp->__reg + index*4); } else { rp = argp->__mem; argp->__mem = rp + 4; return *(void **)rp; } } } #endif /* _DIAB_TOOL */#endif#ifdef _GREEN_TOOL# if ( (CPU==PPC403) || (CPU==PPC405) || (CPU==PPC440) )#define __ppcsfp /* soft floating point */# endif /* CPU==PPC403 || CPU==PPC405 || CPU==PPC440 *//* the following code is from indvaarg.c of Green Hills *//* Low Level Interface Library Copyright 1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994 Green Hills Software,Inc. * This program is the property of Green Hills Software, Inc, * its contents are proprietary information and no part of it * is to be disclosed to anyone except employees of Green Hills * Software, Inc., or as agreed in writing signed by the President * of Green Hills Software, Inc. **/#define NINTREGS 8#define NFLTREGS 13# if !defined(__ppcsfp)/* Power PC Varargs helper function *//* This assumes that all pointers are the same size >= size of ints. * Actually for PPC pointers are the size of ints now, but this is * designed to be slightly more general. */char * __gh_va_arg(va_list *pap, int isreg, int isfloat, int size) {/* [Hal] Wed May 24 12:03:17 PDT 1995 - Rewrite to be reentrant. */ char *z; if (isreg && !isfloat) { /* ints */ if (pap->int_cnt < NINTREGS) { return (char *)&pap->reg_ptr[pap->int_cnt++]; } else { return (char *)&pap->oflo_ptr[pap->mem_cnt++]; } } else if (isreg && isfloat) { /* doubles */# define DSIZE (sizeof(double)/sizeof(int)) if (pap->FP_cnt < NFLTREGS) { return (char *)(pap->reg_ptr+NINTREGS+(DSIZE*pap->FP_cnt++)); } else { /* Align doubles */ pap->mem_cnt = ((pap->mem_cnt+DSIZE-1)/DSIZE)*DSIZE; z = (char *)(pap->oflo_ptr+pap->mem_cnt); pap->mem_cnt += DSIZE; return z; } } else { /* structs */# define PSIZE (sizeof(char *)/sizeof(int)) if (pap->int_cnt < NINTREGS) { z = *(char **)(pap->reg_ptr+(PSIZE*pap->int_cnt)); pap->int_cnt += PSIZE; } else { z = *(char **)(pap->oflo_ptr+pap->mem_cnt); pap->mem_cnt += PSIZE; } return z; /* structs passed as addresses */ } }# else /* __ppcsfp *//* [Hal] Tue Mar 21 14:56:56 PST 1995 - Support for PPC403 software FP. */char * __gh_va_arg(va_list *pap, int isreg, int isfloat, int size) {/* [Hal] Wed May 24 12:03:17 PDT 1995 - Rewrite to be reentrant. */ char *z; if (isreg && !isfloat) { /* ints */ if (pap->int_cnt < NINTREGS) { return (char *)&pap->reg_ptr[pap->int_cnt++]; /* fixed: & */ } else { return (char *)&pap->oflo_ptr[pap->mem_cnt++]; /* fixed: & */ } } else if (isreg && isfloat) { /* doubles */# define DSIZE (sizeof(double)/sizeof(int)) if (pap->int_cnt & 1) /* Get to even offset */ pap->int_cnt += 1; if (pap->int_cnt < NINTREGS) { z = (char *)(pap->reg_ptr+pap->int_cnt); pap->int_cnt += 2; } else { /* Align doubles */ pap->mem_cnt = ((pap->mem_cnt+DSIZE-1)/DSIZE)*DSIZE; z = (char *)(pap->oflo_ptr+pap->mem_cnt); pap->mem_cnt += DSIZE; } return z; } else { /* structs */# define PSIZE (sizeof(char *)/sizeof(int)) if (pap->int_cnt < NINTREGS) { z = *(char **)(pap->reg_ptr+(PSIZE*pap->int_cnt)); pap->int_cnt += PSIZE; } else { z = *(char **)(pap->oflo_ptr+pap->mem_cnt); pap->mem_cnt += PSIZE; } return z; /* structs passed as addresses */ } }# endif /* __ppcsfp */#endif /* _GREEN_TOOL */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -