source: rtems-libbsd/rtems/freebsd/machine/endian.h @ a9153ec

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since a9153ec was a9153ec, checked in by Joel Sherrill <joel.sherrill@…>, on 03/07/12 at 15:52:04

Initial import

Code is based on FreeBSD 8.2 with USB support from Sebastian Huber
and Thomas Doerfler. Initial TCP/IP stack work is from Kevel Kirspel.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd_machine
5 *
6 * @brief TODO.
7 */
8
9/*
10 * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.com/license/LICENSE.
21 */
22
23#ifndef _RTEMS_BSD_MACHINE_ENDIAN_H
24#define _RTEMS_BSD_MACHINE_ENDIAN_H
25
26#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_
27#error "the header file <rtems/freebsd/machine/rtems-bsd-config.h> must be included first"
28#endif
29
30#include <rtems/endian.h>
31
32#if CPU_BIG_ENDIAN
33# define _BYTE_ORDER _BIG_ENDIAN
34#elif CPU_LITTLE_ENDIAN
35# define _BYTE_ORDER _LITTLE_ENDIAN
36#else
37# error "undefined endian"
38#endif
39
40#define __bswap16(x) CPU_swap_u16(x)
41#define __bswap32(x) CPU_swap_u32(x)
42
43#define __htonl(x)  __bswap32(x)
44#define __htons(x)  __bswap16(x)
45#define __ntohl(x)  __bswap32(x)
46#define __ntohs(x)  __bswap16(x)
47
48#endif /* _RTEMS_BSD_MACHINE_ENDIAN_H */
Note: See TracBrowser for help on using the repository browser.