Thomas Heijligen | 5618d5b | 2022-02-19 21:17:44 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2022 secunet Security Networks AG |
| 5 | * (written by Thomas Heijligen <thomas.heijligen@secunet.com) |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | */ |
| 17 | |
Thomas Heijligen | c92f94b | 2022-03-17 13:41:17 +0100 | [diff] [blame] | 18 | #include "../platform.h" |
Thomas Heijligen | 5618d5b | 2022-02-19 21:17:44 +0100 | [diff] [blame] | 19 | |
| 20 | /* convert cpu native endian to little endian */ |
| 21 | ___return_swapped(cpu_to_le, 8) |
| 22 | ___return_swapped(cpu_to_le, 16) |
| 23 | ___return_swapped(cpu_to_le, 32) |
| 24 | ___return_swapped(cpu_to_le, 64) |
| 25 | |
| 26 | /* convert cpu native endian to big endian */ |
| 27 | ___return_same(cpu_to_be, 8) |
| 28 | ___return_same(cpu_to_be, 16) |
| 29 | ___return_same(cpu_to_be, 32) |
| 30 | ___return_same(cpu_to_be, 64) |
| 31 | |
| 32 | /* convert little endian to cpu native endian */ |
| 33 | ___return_swapped(le_to_cpu, 8) |
| 34 | ___return_swapped(le_to_cpu, 16) |
| 35 | ___return_swapped(le_to_cpu, 32) |
| 36 | ___return_swapped(le_to_cpu, 64) |
| 37 | |
| 38 | /* convert big endian to cpu native endian */ |
| 39 | ___return_same(be_to_cpu, 8) |
| 40 | ___return_same(be_to_cpu, 16) |
| 41 | ___return_same(be_to_cpu, 32) |
| 42 | ___return_same(be_to_cpu, 64) |