xref: /openbmc/u-boot/arch/sh/include/asm/macro.h (revision 4e3349b6)
1 /*
2  * Copyright (C) 2008 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17  * MA 02111-1307 USA
18  */
19 
20 #ifndef __MACRO_H__
21 #define __MACRO_H__
22 #ifdef __ASSEMBLY__
23 
24 .macro	write32, addr, data
25 	mov.l \addr ,r1
26 	mov.l \data ,r0
27 	mov.l r0, @r1
28 .endm
29 
30 .macro	write16, addr, data
31 	mov.l \addr ,r1
32 	mov.w \data ,r0
33 	mov.w r0, @r1
34 .endm
35 
36 .macro	write8, addr, data
37 	mov.l \addr ,r1
38 	mov.l \data ,r0
39 	mov.b r0, @r1
40 .endm
41 
42 .macro	wait_timer, time
43 	mov.l	\time ,r3
44 1:
45 	nop
46 	tst	r3, r3
47 	bf/s	1b
48 	dt	r3
49 .endm
50 
51 #endif /* __ASSEMBLY__ */
52 #endif /* __MACRO_H__ */
53