1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup mpc55xx_asm |
---|
5 | * |
---|
6 | * @brief Memory copy functions. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2008 |
---|
11 | * Embedded Brains GmbH |
---|
12 | * Obere Lagerstr. 30 |
---|
13 | * D-82178 Puchheim |
---|
14 | * Germany |
---|
15 | * rtems@embedded-brains.de |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be found in the file |
---|
18 | * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. |
---|
19 | */ |
---|
20 | |
---|
21 | #include <libcpu/powerpc-utility.h> |
---|
22 | #include <bspopts.h> |
---|
23 | |
---|
24 | .section ".bsp_start_text", "ax" |
---|
25 | |
---|
26 | /** |
---|
27 | * @fn int mpc55xx_copy_8( const void *src, void *dest, size_t n) |
---|
28 | * |
---|
29 | * @brief Copy @a n bytes from @a src to @a dest with 8 byte reads and writes. |
---|
30 | * |
---|
31 | * The memory areas should not overlap. The addresses @a src and @a dest have |
---|
32 | * to be aligned on 8 byte boundaries. The size @a n must be evenly divisible by 8. |
---|
33 | * The SPE operations @b evxor, @b evlddx and @b evstddx will be used. |
---|
34 | */ |
---|
35 | #if ((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517)) |
---|
36 | GLOBAL_FUNCTION mpc55xx_copy_8 |
---|
37 | #endif /* ((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517)) */ |
---|
38 | GLOBAL_FUNCTION mpc55xx_copy_4 |
---|
39 | /* Loop counter = data size / 4 */ |
---|
40 | srwi. r5, r5, 2 |
---|
41 | beqlr |
---|
42 | mtctr r5 |
---|
43 | xor r5,r5,r5 |
---|
44 | copy_data4: |
---|
45 | lwzx r6, r5, r3 |
---|
46 | stwx r6, r5, r4 |
---|
47 | addi r5, r5, 4 |
---|
48 | bdnz copy_data4 |
---|
49 | |
---|
50 | /* Return */ |
---|
51 | blr |
---|
52 | |
---|
53 | #if !((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517)) |
---|
54 | /** |
---|
55 | * @fn int mpc55xx_copy_8( const void *src, void *dest, size_t n) |
---|
56 | * |
---|
57 | * @brief Copy @a n bytes from @a src to @a dest with 8 byte reads and writes. |
---|
58 | * |
---|
59 | * The memory areas should not overlap. The addresses @a src and @a dest have |
---|
60 | * to be aligned on 8 byte boundaries. The size @a n must be evenly divisible by 8. |
---|
61 | * The SPE operations @b evxor, @b evlddx and @b evstddx will be used. |
---|
62 | */ |
---|
63 | GLOBAL_FUNCTION mpc55xx_copy_8 |
---|
64 | /* Loop counter = data size / 8 */ |
---|
65 | srwi. r5, r5, 3 |
---|
66 | beqlr |
---|
67 | mtctr r5 |
---|
68 | |
---|
69 | /* Set offset */ |
---|
70 | evxor r5, r5, r5 |
---|
71 | |
---|
72 | copy_data: |
---|
73 | evlddx r6, r3, r5 |
---|
74 | evstddx r6, r4, r5 |
---|
75 | addi r5, r5, 8 |
---|
76 | bdnz copy_data |
---|
77 | |
---|
78 | /* Return */ |
---|
79 | blr |
---|
80 | #endif /*!((MPC55XX_CHIP_TYPE>=5510) && (MPC55XX_CHIP_TYPE<=5517))*/ |
---|