CP_SaveContext

Syntax

#include <nitro/cp.h>
void CP_SaveContext( CPContext* context );

Arguments

Pointer to the region where the divider, square root calculator context will be stored.

Return Values

None.

Description

This function stores the status (context) for the current divider and square root calculator in a specified structure.

The CP_RestoreContext function can be used to restore the saved context.
When you use a divider or square root calculator inside an interrupt, save the divider and square root calculator contexts prior to their use by these functions.

During thread switch, the context are also automatically switched. Therefore, there is no need for this function to explicitly run a save process.

Example Using a divider/square root calculator inside an interrupt

void intr_func( void )
{
CPContext context;

CP_SaveContext( &context );
CP_SetDiv32_32( 1000, 5 );
CP_WaitDiv();
result = CP_GetDivResult();
CP_RestoreContext( &context );
}

See Also

CP_RestoreContext, CP_SetDiv*, CP_SetSqrt*

Revision History

2006/08/09 Added sample code segment.
2004/05/06 Initial version.


CONFIDENTIAL