Add single precision operations to FPU test

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4429 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-02-26 15:27:36 +00:00
parent 0e52cdc2c4
commit 8f5d4f5810

View File

@ -70,6 +70,12 @@
# error "CONFIG_EXAMPLES_OSTEST_FPUSIZE has the wrong size" # error "CONFIG_EXAMPLES_OSTEST_FPUSIZE has the wrong size"
#endif #endif
/************************************************************************************
* Private Data
************************************************************************************/
static uint32_t g_saveregs[XCPTCONTEXT_REGS];
/************************************************************************************ /************************************************************************************
* Private Functions * Private Functions
************************************************************************************/ ************************************************************************************/
@ -84,17 +90,20 @@
void arch_getfpu(FAR uint32_t *fpusave) void arch_getfpu(FAR uint32_t *fpusave)
{ {
irqstate_t flags; irqstate_t flags;
uint32_t regs[XCPTCONTEXT_REGS];
/* Take a snapshot of the thread context right now */
flags = irqsave(); flags = irqsave();
up_savefpu(regs); /* Saves the context of the FPU registers to memory */ up_saveusercontext(g_saveregs);
irqrestore(flags);
memcpy(fpusave, &regs[REG_S0], (4*SW_FPU_REGS)); /* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
irqrestore(flags);
} }
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function /* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
* will compare then an return true if they are identical. * will compare them and return true if they are identical.
*/ */
bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2) bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)