| 1 |
/* |
| 2 |
* This file is part of the flashrom project. |
| 3 |
* |
| 4 |
* Copyright (C) 2022 secunet Security Networks AG |
| 5 |
* (written by Thomas Heijligen <[email protected]) |
| 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 |
|
| 18 |
#include "platform.h" |
| 19 |
#include "platform/swap.h" |
| 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) |