# SVC_CpuClear*

## C Specification

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

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

      (These are macros.)

## Description

This function uses the CPU to perform memory clear.

The `MI_CpuClear*()` function filled the memory with 0s. However the `SVC_CpuClear*()` function fills the memory with a specified value.

Because `SVC_CpuClear*()` is a macro, if `destp` is a pointer, the type will not be limited. The `size` is in `u32` format. Only 16 or 32 bits can be specified. Specify `data` as clear data (data to fill the memory). When `bit` is 16, specify a `u16` value; when `bit` is 32, specify a `u32` value.

The difference from `MI_CpuClear*()` and `MI_CpuFill*()` is that because `SVC_CpuClear*()` operates with system ROM, it operates with half the frequency of operating with cache or TCM. However, if the cache is valid, there is no difference with the loop, and the difference will be the generation of overhead for calling SVC function. As is mentioned above, the method of specifying argument is different, and the method of specifying values to fill memory is different. If it is possible to describe with either function, it would be better to use `MI_CpuCopy*()` and `MI_CpuFill*()` instead of `SVC_CpuClear*()` if there is no particular reason to use this.

`SVC_CpuClear()` writes `size` bytes of the data shown by `data`, starting from the address shown by `destp`. When the transmit bit is set to 16, you must align `destp` to a 2-byte boundary; when the transmit bit is 32 you must align `destp` to a 4-byte boundary.

`SVC_CpuClearArray()` is `SVC_CpuClear()` with the transmit size set to `sizeof(` `destp` `)`. In other words, it is the same as `SVC_CpuClear(` `data``,` `destp``, sizeof(``destp``),` `bit``)`.

`SVC_CpuClearFast()` quickly writes `size` bytes of the data shown by `data`, starting from the address shown by `destp`. The writing size must be a multiple of 4. It quickly writes in units of 32 bytes and the remainder is in units of 4 bytes. You must align `destp` to a 4-byte boundary.

`SVC_CpuClearArrayFast()` is `SVC_CpuClearFast()` with the transmit size set to `sizeof(` `destp` `)`. In other words, it is the same as `SVC_CpuClearFast(` `data``,``destp``, sizeof(``destp``)`.

## Internal Operation

Calls system call.

## Arguments

`data` | Clear data
`destp` | Destination address
`size` | Transmit byte number
`bit` | Transmit bit width (16 or 32)

## Return Values

None

## See Also

`MI_CpuClear*, MI_CpuFill*, MI_DmaClear*, SVC_CpuCopy*`

## Revision History

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