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 | 58015c2 | 2022-04-14 13:50:55 +0200 | [diff] [blame] | 18 | #include "platform.h" |
Thomas Heijligen | d2174c5 | 2022-04-21 13:29:33 +0200 | [diff] [blame] | 19 | #include "platform/swap.h" |
Thomas Heijligen | 5618d5b | 2022-02-19 21:17:44 +0100 | [diff] [blame] | 20 | |
| 21 | /* convert cpu native endian to little endian */ |
| 22 | ___return_swapped(cpu_to_le, 8) |
| 23 | ___return_swapped(cpu_to_le, 16) |
| 24 | ___return_swapped(cpu_to_le, 32) |
| 25 | ___return_swapped(cpu_to_le, 64) |
| 26 | |
| 27 | /* convert cpu native endian to big endian */ |
| 28 | ___return_same(cpu_to_be, 8) |
| 29 | ___return_same(cpu_to_be, 16) |
| 30 | ___return_same(cpu_to_be, 32) |
| 31 | ___return_same(cpu_to_be, 64) |
| 32 | |
| 33 | /* convert little endian to cpu native endian */ |
| 34 | ___return_swapped(le_to_cpu, 8) |
| 35 | ___return_swapped(le_to_cpu, 16) |
| 36 | ___return_swapped(le_to_cpu, 32) |
| 37 | ___return_swapped(le_to_cpu, 64) |
| 38 | |
| 39 | /* convert big endian to cpu native endian */ |
| 40 | ___return_same(be_to_cpu, 8) |
| 41 | ___return_same(be_to_cpu, 16) |
| 42 | ___return_same(be_to_cpu, 32) |
| 43 | ___return_same(be_to_cpu, 64) |