Last change
on this file since ba619b7f was
ba619b7f,
checked in by Joel Sherrill <joel@…>, on 03/01/22 at 21:38:20
|
bsps/arm/: Scripted embedded brains header file clean up
Updates #4625.
|
-
Property mode set to
100644
|
File size:
809 bytes
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2018 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | */ |
---|
8 | |
---|
9 | #include <bsp/iocopy.h> |
---|
10 | |
---|
11 | static void atsam_do_copy( |
---|
12 | uint8_t *dst, |
---|
13 | const uint8_t *src, |
---|
14 | size_t n, |
---|
15 | bool aligned |
---|
16 | ) |
---|
17 | { |
---|
18 | if (aligned) { |
---|
19 | while (n > 3) { |
---|
20 | *(uint32_t *)dst = *(uint32_t *)src; |
---|
21 | dst += 4; |
---|
22 | src += 4; |
---|
23 | n -= 4; |
---|
24 | } |
---|
25 | } |
---|
26 | |
---|
27 | while (n > 0) { |
---|
28 | *dst = *src; |
---|
29 | ++dst; |
---|
30 | ++src; |
---|
31 | --n; |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | void atsam_copy_to_io(void *dst, const void *src, size_t n) |
---|
36 | { |
---|
37 | atsam_do_copy(dst, src, n, ((uintptr_t)dst) % 4 == 0); |
---|
38 | } |
---|
39 | |
---|
40 | void atsam_copy_from_io(void *dst, const void *src, size_t n) |
---|
41 | { |
---|
42 | atsam_do_copy(dst, src, n, ((uintptr_t)src) % 4 == 0); |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.