blob: 84d24c9384194162a010b8ea29399b29ba455d93 [file] [log] [blame]
Guennadi Liakhovetski9b077732008-08-31 00:39:46 +02001/*
2 * Originates from Samsung's u-boot 1.1.6 port to S3C6400 / SMDK6400
3 *
4 * (C) Copyright 2008
5 * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (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 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23#ifndef _ARCH_HARDWARE_H_
24#define _ARCH_HARDWARE_H_
25
26#include <asm/sizes.h>
27
28#ifndef __ASSEMBLY__
29#define UData(Data) ((unsigned long) (Data))
30
31#define __REG(x) (*(vu_long *)(x))
32#define __REGl(x) (*(vu_long *)(x))
33#define __REGw(x) (*(vu_short *)(x))
34#define __REGb(x) (*(vu_char *)(x))
35#define __REG2(x, y) (*(vu_long *)((x) + (y)))
36#else
37#define UData(Data) (Data)
38
39#define __REG(x) (x)
40#define __REGl(x) (x)
41#define __REGw(x) (x)
42#define __REGb(x) (x)
43#define __REG2(x, y) ((x) + (y))
44#endif
45
46#define Fld(Size, Shft) (((Size) << 16) + (Shft))
47
48#define FSize(Field) ((Field) >> 16)
49#define FShft(Field) ((Field) & 0x0000FFFF)
50#define FMsk(Field) (((UData (1) << FSize (Field)) - 1) << FShft (Field))
51#define FAlnMsk(Field) ((UData (1) << FSize (Field)) - 1)
52#define F1stBit(Field) (UData (1) << FShft (Field))
53
54#define FClrBit(Data, Bit) (Data = (Data & ~(Bit)))
55#define FClrFld(Data, Field) (Data = (Data & ~FMsk(Field)))
56
57#define FInsrt(Value, Field) \
58 (UData (Value) << FShft (Field))
59
60#define FExtr(Data, Field) \
61 ((UData (Data) >> FShft (Field)) & FAlnMsk (Field))
62
63#endif /* _ARCH_HARDWARE_H_ */