Added SWAB (swap bytes) macros

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@162 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-04-21 21:53:45 +00:00
parent e7d40dce78
commit 78e6bb8ee2
1 changed files with 17 additions and 1 deletions

View File

@ -19,7 +19,8 @@
#ifndef __SYSTEM_H__
#define __SYSTEM_H__
#include <sh7034.h>
#include "sh7034.h"
/*
* 11.059,200 MHz => 90.4224537037037037037037037037037... ns
@ -32,6 +33,21 @@
//#define PHI ((int)(11.059200 MHz))
//#define BAUDRATE 115200 /* 115200 - 9600 */
#ifdef LITTLE_ENDIAN
#define SWAB16(x) (x)
#define SWAB32(x) (x)
#else
#define SWAB16(x) \
(((x & 0x00ff) << 8) | \
((x & 0xff00) >> 8))
#define SWAB32(x) \
(((x & 0x000000ff) << 24) | \
((x & 0x0000ff00) << 8) | \
((x & 0x00ff0000) >> 8) | \
((x & 0xff000000) >> 24))
#endif
#define nop \
asm volatile ("nop")