1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /* PCI Access Library |
---|
4 | * Registers-over-Memory Space - Generic Big endian PCI bus definitions |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 2010 Cobham Gaisler AB. |
---|
7 | * |
---|
8 | * Redistribution and use in source and binary forms, with or without |
---|
9 | * modification, are permitted provided that the following conditions |
---|
10 | * are met: |
---|
11 | * 1. Redistributions of source code must retain the above copyright |
---|
12 | * notice, this list of conditions and the following disclaimer. |
---|
13 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
14 | * notice, this list of conditions and the following disclaimer in the |
---|
15 | * documentation and/or other materials provided with the distribution. |
---|
16 | * |
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
27 | * POSSIBILITY OF SUCH DAMAGE. |
---|
28 | */ |
---|
29 | |
---|
30 | #include <pci.h> |
---|
31 | |
---|
32 | uint16_t pci_mem_be_ld_le16(uint16_t *adr) |
---|
33 | { |
---|
34 | return ld_be16(adr); |
---|
35 | } |
---|
36 | |
---|
37 | uint16_t pci_mem_be_ld_be16(uint16_t *adr) |
---|
38 | { |
---|
39 | return ld_le16(adr); |
---|
40 | } |
---|
41 | |
---|
42 | uint32_t pci_mem_be_ld_le32(uint32_t *adr) |
---|
43 | { |
---|
44 | return ld_be32(adr); |
---|
45 | } |
---|
46 | |
---|
47 | uint32_t pci_mem_be_ld_be32(uint32_t *adr) |
---|
48 | { |
---|
49 | return ld_le32(adr); |
---|
50 | } |
---|
51 | |
---|
52 | void pci_mem_be_st_le16(uint16_t *adr, uint16_t data) |
---|
53 | { |
---|
54 | st_be16(adr, data); |
---|
55 | } |
---|
56 | |
---|
57 | void pci_mem_be_st_be16(uint16_t *adr, uint16_t data) |
---|
58 | { |
---|
59 | st_le16(adr, data); |
---|
60 | } |
---|
61 | |
---|
62 | void pci_mem_be_st_le32(uint32_t *adr, uint32_t data) |
---|
63 | { |
---|
64 | st_be32(adr, data); |
---|
65 | } |
---|
66 | |
---|
67 | void pci_mem_be_st_be32(uint32_t *adr, uint32_t data) |
---|
68 | { |
---|
69 | st_le32(adr, data); |
---|
70 | } |
---|
71 | |
---|
72 | struct pci_memreg_ops pci_mem_be_ops = { |
---|
73 | .ld8 = pci_mem_ld8, |
---|
74 | .st8 = pci_mem_st8, |
---|
75 | |
---|
76 | .ld_le16 = pci_mem_be_ld_le16, |
---|
77 | .st_le16 = pci_mem_be_st_le16, |
---|
78 | .ld_be16 = pci_mem_be_ld_be16, |
---|
79 | .st_be16 = pci_mem_be_st_be16, |
---|
80 | |
---|
81 | .ld_le32 = pci_mem_be_ld_le32, |
---|
82 | .st_le32 = pci_mem_be_st_le32, |
---|
83 | .ld_be32 = pci_mem_be_ld_be32, |
---|
84 | .st_be32 = pci_mem_be_st_be32, |
---|
85 | }; |
---|