# SVC_CpuClear*

## Syntax

      #include <nitro/os/common/systemCall.h>

      #define SVC_CpuClear( data, destp, size, bit );
      #define SVC_CpuClearArray( data, destp, bit );
      #define SVC_CpuClearFast( data, destp, size );
      #define SVC_CpuClearArrayFast( data, destp );

      (These are macros.)

## Arguments

data | Clear data.
destp | Destination address.
size | Number of bytes to transfer.
bit | Transfer bit width (16 or 32).

## Return Values

None.

## Description

Uses system calls to clear memory via the CPU. The `MI_CpuClear*` functions zero-clear memory; in contrast, the `SVC_CpuClear*` functions fill memory with a specified value.

Because the `SVC_CpuClear*` functions are macros, if destp is a pointer, the type is not restricted. The size is a `u32` value. The bit argument can take only a value of 16 or 32. Specify the data to clear (the memory to fill) in data. When bit is 16, specify a `u16` value; when bit is 32, specify a `u32` value.

The difference between these functions and the `MI_CpuClear*` or `MI_CpuFill*` functions is that because the `SVC_CpuClear*` functions operate on system ROM, their operating frequency is half what it would be if operating on cache or TCM. However, if cache is enabled, the loop portion of these sets of functions is identical and the only difference becomes the overhead of calling the SVC functions. Also, the method of specifying arguments is different, and the method of specifying the value to fill memory with is different. If your code can be written with either function, it is better to use the `MI_CpuClear*` or `MI_CpuFill*` functions instead of the `SVC_CpuClear*` functions unless there is a specific reason to do otherwise.

The `SVC_CpuClear` function writes size bytes of the data indicated by data, starting from the address indicated by destp. When the transfer bits are set to 16, you must align destp to a 2-byte boundary; when the transfer bits are 32, you must align destp to a 4-byte boundary.

The `SVC_CpuClearArray` function is `SVC_CpuClear` with its transfer size set to `sizeof(destp)`. In other words, it is the same as the line below:
`SVC_CpuClear( data, destp, sizeof(destp), bit )`

The `SVC_CpuClearFast` function quickly writes size bytes of the data indicated by data, starting from the address shown by destp. The write size must be a multiple of 4. It processes units of 32 bytes at high speed, and processes the remainder in units of 4 bytes. You must align destp to a 4-byte boundary.

The `SVC_CpuClearArrayFast` function is `SVC_CpuClearFast` with its transfer size set to `sizeof(destp)`. In other words, it is the same as the line below:
`SVC_CpuClearFast( data ,destp, sizeof(destp) )`

## Internal Operation

Calls system calls.

## See Also

`MI_CpuClear*
MI_CpuFill*
MI_DmaClear*
SVC_CpuCopy*`

## Revision History

2004/07/20 Changed the condition for the transfer size of `SVC_CpuClearFast()` from a multiple of 32 bytes to a multiple of 4 bytes.
2004/03/29 Indicated that system call is used.
2004/01/18 Initial version.

CONFIDENTIAL