# SVC_CpuCopy*

## Syntax

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

      #define SVC_CpuCopy( srcp, destp, size, bit );
      #define SVC_CpuCopyArray( srcp, destp, bit );
      #define SVC_CpuCopyFast( srcp, destp, size );
      #define SVC_CpuCopyArrayFast( srcp, destp );

      (These are macros.)

## Arguments

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

## Return Values

None.

## Description

Uses system calls to copy memory through the CPU. Because the `SVC_CpuCopy*` functions are macros, if srcp and destp are pointers, the type is not restricted. The size is a `u32` value. The bit argument can take only a value of 16 or 32.

The difference between these functions and the `MI_CpuCopy*` functions is that because the `SVC_CpuCopy*` 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 two sets of functions is identical and the only difference becomes the overhead of calling the SVC functions. The method of specifying arguments is also different. If it is possible to use either instruction in your code, it would probably be better to use the `MI_CpuCopy*` functions instead of the `SVC_CpuCopy*` functions, unless you have a specific reason to do otherwise.

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

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

The `SVC_CpuCopyFast` function quickly copies size bytes of data from the address indicated by srcp to the address indicated by destp. The copy size must be a multiple of 4. It copies quickly in units of 32 bytes and copies the remainder in units of 4 bytes. You must align srcp and destp to a 4-byte boundary.

The `SVC_CpuCopyArrayFast` function is equivalent to `SVC_CpuCopyFast` with its transfer size set to `sizeof(srcp)`. In other words, it is the same as the line below:
`SVC_CpuCopyFast( srcp, destp, sizeof(srcp) )`

## Internal Operation

Calls system call.

## See Also

`MI_CpuCopy*`
`MI_DmaCopy*`
`SVC_CpuClear*`

## 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 calls are used.
2004/01/18 Initial version.

CONFIDENTIAL