157 lines
4.0 KiB
C
157 lines
4.0 KiB
C
/* aimFppShow.c - floating-point show routines */
|
|
|
|
/*
|
|
* Copyright (c) 2010-2011 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify, or otherwise make use
|
|
* of this software may be licensed only pursuant to the terms
|
|
* of an applicable Wind River license agreement.
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
--------------------
|
|
01q,02nov11,swu remove _func_fppTaskRegsShow from funcBind. (WIND00245382)
|
|
01p,05jul10,liu created based on fppShow.c.
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
This library provides the routines necessary to show a task's optional
|
|
floating-point context. To use this facility, it must first be
|
|
installed using aimFppShowInit(), which is called automatically
|
|
when the floating-point show facility is configured into VxWorks
|
|
using either of the following methods:
|
|
.iP
|
|
If you use the configuration header files, define
|
|
INCLUDE_SHOW_ROUTINES in config.h.
|
|
.iP
|
|
If you use the Tornado project facility, select INCLUDE_HW_FP_SHOW.
|
|
.LP
|
|
|
|
This library enhances task information routines, such as ti(), to display
|
|
the floating-point context.
|
|
|
|
INCLUDE FILES: fppLib.h
|
|
|
|
*/
|
|
|
|
#include "vxWorks.h"
|
|
#include "stdio.h"
|
|
#include "regs.h"
|
|
#include "fppLib.h"
|
|
#include "private/coprocLibP.h"
|
|
|
|
/* global variables */
|
|
|
|
#if defined (_WRS_PAL_COPROC_LIB)
|
|
extern char *fppTaskRegsCFmt;
|
|
extern char *fppTaskRegsDFmt;
|
|
#else /* _WRS_PAL_COPROC_LIB */
|
|
char *fppTaskRegsCFmt = "%-6.6s = %8x";
|
|
char *fppTaskRegsDFmt = "%-6.6s = %8g";
|
|
#endif /* _WRS_PAL_COPROC_LIB */
|
|
|
|
#if !defined _WRS_FLOAT_TYPE
|
|
#define _WRS_FLOAT_TYPE double
|
|
#endif /* _WRS_FLOAT_TYPE */
|
|
|
|
#if !defined _WRS_FP_REG_TEMP
|
|
#define _WRS_FP_REG_TEMP(ix) fpTmp = (_WRS_FLOAT_TYPE *) ((int)&fpRegSet + fpRegName[(ix)].regOff)
|
|
#endif /* _WRS_FP_REG_TEMP */
|
|
|
|
/* forward declarations */
|
|
|
|
void fppTaskRegsShow(TASK_ID task);
|
|
|
|
/******************************************************************************
|
|
*
|
|
* aimFppShowInit - initialize the floating-point show facility
|
|
*
|
|
* This routine links the floating-point show facility into the VxWorks system.
|
|
* It is called automatically when the floating-point show facility is
|
|
* configured into VxWorks using either of the following methods:
|
|
* .iP
|
|
* If you use the configuration header files, define
|
|
* INCLUDE_SHOW_ROUTINES in config.h.
|
|
* .iP
|
|
* If you use the Tornado project facility, select INCLUDE_HW_FP_SHOW.
|
|
*
|
|
* RETURNS: N/A
|
|
*/
|
|
|
|
void aimFppShowInit (void)
|
|
{
|
|
/* avoid direct coupling with fppShow with this global variable */
|
|
|
|
#if !defined (_WRS_PAL_COPROC_LIB)
|
|
_func_fppTaskRegsShow = fppTaskRegsShow;
|
|
#endif /* _WRS_PAL_COPROC_LIB */
|
|
}
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* fppTaskRegsShow - print the contents of a task's floating-point registers
|
|
*
|
|
* This routine prints to standard output the contents of a task's
|
|
* floating-point registers.
|
|
*
|
|
* RETURNS: N/A
|
|
*/
|
|
|
|
void fppTaskRegsShow
|
|
(
|
|
TASK_ID task /* task to display floating point registers for */
|
|
)
|
|
{
|
|
int ix;
|
|
_WRS_FLOAT_TYPE *fpTmp;
|
|
int * fpCtlTmp;
|
|
FPREG_SET fpRegSet;
|
|
|
|
#if defined (_WRS_NEED_DOUBLE_TMP)
|
|
double doubleTmp;
|
|
double *fpDoubleTmp = &doubleTmp;
|
|
#endif /* _WRS_NEED_DOUBLE_TMP */
|
|
|
|
if ((fppProbe() != OK) || (fppTaskRegsGet (task, &fpRegSet) == ERROR))
|
|
return;
|
|
|
|
/* Some architectures organize floats sequentially, but to
|
|
* display them as doubles the floats need to be word swapped.
|
|
*/
|
|
|
|
if (fppDisplayHookRtn != NULL)
|
|
(* fppDisplayHookRtn) (&fpRegSet);
|
|
|
|
/* print floating point control registers */
|
|
|
|
for (ix = 0; fpCtlRegName[ix].regName != (char *) NULL; ix++)
|
|
{
|
|
if ((ix % 4) == 0)
|
|
printf ("\n");
|
|
else
|
|
printf ("%3s","");
|
|
|
|
fpCtlTmp = (int *) ((int)&fpRegSet + fpCtlRegName[ix].regOff);
|
|
printf (fppTaskRegsCFmt, fpCtlRegName[ix].regName, *fpCtlTmp);
|
|
}
|
|
|
|
/* print floating point data registers */
|
|
|
|
for (ix = 0; fpRegName[ix].regName != (char *) NULL; ix++)
|
|
{
|
|
if ((ix % 4) == 0)
|
|
printf ("\n");
|
|
else
|
|
printf ("%3s","");
|
|
|
|
/* copy reg value into fpTmp, print it from there */
|
|
|
|
_WRS_FP_REG_TEMP(ix);
|
|
printf (fppTaskRegsDFmt, fpRegName[ix].regName, *fpTmp);
|
|
}
|
|
|
|
printf ("\n");
|
|
}
|