# CP_RestoreContext

## Syntax

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

## Arguments

Pointer to the context structure for the divider or square root calculator that you want to restore.

## Return Values

None.

## Description

This function restores divider and square root calculator status (context) that was saved by the `CP_SaveContext` function.

When you use a divider or square root calculator inside an interrupt, use these functions to save the context of the divider or square root calculator before use.
The absolute minimum amount of weighted processing necessary is performed to restore original status inside this function.

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_SaveContext, CP_SetDiv*, CP_SetSqrt*`

## Revision History

2006/08/09 Added a sample code fragment and revised the description in line with the change that it is no longer necessary to wait for status to finish being restored.
2004/05/06 Initial version.

CONFIDENTIAL