2 * share/reginit.h: generic hardware initialisation engine
4 * Copyright (c) 2001, Algorithmics Ltd. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the "Free MIPS" License Agreement, a copy of
8 * which is available at:
10 * http://www.algor.co.uk/ftp/pub/doc/freemips-license.txt
12 * You may not, however, modify or remove any part of this copyright
13 * message if this program is redistributed or reused in whole or in
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * "Free MIPS" License for more details.
22 #define MOD_MASK 0x00000003
23 #define MOD_B 0x00000000 /* byte "modifier" */
24 #define MOD_H 0x00000001 /* halfword "modifier" */
25 #define MOD_W 0x00000002 /* word "modifier" */
27 #define MOD_D 0x00000003 /* doubleword "modifier" */
30 #define OP_MASK 0x000000fc
31 #define OP_EXIT 0x00000000 /* exit (status) */
32 #define OP_DELAY 0x00000008 /* delay (cycles) */
33 #define OP_RD 0x00000010 /* read (addr) */
34 #define OP_WR 0x00000014 /* write (addr, val) */
35 #define OP_RMW 0x00000018 /* read-modify-write (addr, and, or) */
36 #define OP_WAIT 0x00000020 /* wait (addr, mask, value) */
37 #define OP_JUMP 0x00000024 /* jump (addr) */
57 #define WR_INIT(mod,addr,val) \
58 .word OP_WR|MOD_##mod,PHYS_TO_K1(addr);\
61 #define RD_INIT(mod,addr) \
62 .word OP_RD|MOD_##mod,PHYS_TO_K1(addr);\
65 #define RMW_INIT(mod,addr,and,or) \
66 .word OP_RMW|MOD_##mod,PHYS_TO_K1(addr);\
69 #define WAIT_INIT(mod,addr,and,or) \
70 .word OP_WAIT|MOD_##mod,PHYS_TO_K1(addr);\
73 #define JUMP_INIT(addr) \
74 88: .word OP_JUMP,addr;\
77 #define DELAY_INIT(cycles) \
78 .word OP_DELAY,(cycles);\
81 #define EXIT_INIT(status) \
82 .word OP_EXIT,(status);\
91 unsigned long long a1
;
92 unsigned long long a2
;
99 #define WR_INIT(mod,addr,val) \
100 {OP_WR | MOD_ ## mod, PHYS_TO_K1(addr), (val)}
102 #define RD_INIT(mod,addr) \
103 {OP_RD | MOD_ ## mod, PHYS_TO_K1(addr)}
105 #define RMW_INIT(mod,addr,and,or) \
106 {OP_RMW | MOD_ ## mod, PHYS_TO_K1(addr), (and), (or)}
108 #define WAIT_INIT(mod,addr,and,or) \
109 {OP_WAIT | MOD_ ## mod, PHYS_TO_K1(addr), (mask), (val)}
111 #define JUMP_INIT(addr) \
112 {OP_JUMP, (unsigned long)(addr)}
114 #define DELAY_INIT(cycles) \
117 #define EXIT_INIT(status) \