6 #define __BV32(num) ((0x80000000 >> (num)))
7 #define __BV16(num) ((0x8000 >> (num)))
8 #define __BV08(num) ((0x80 >> (num)))
22 typedef struct fpuregs
{
27 typedef struct context
{
32 #define SIZEOF_ALL_REGISTERS (sizeof(context_t))
34 static inline uint32_t rdmsr() {
35 uint32_t msr
; asm volatile("mfmsr %0":"=r"(msr
)); return msr
;
38 static inline void wrmsr(uint32_t msr
) {
39 asm volatile("mtmsr %0"::"r"(msr
));
42 /* Machine State Register */
43 #define MSR_POW 0x00040000
44 #define MSR_TGPR 0x00020000
45 #define MSR_ILE 0x00010000
46 #define MSR_EE 0x00008000
47 #define MSR_PR 0x00004000
48 #define MSR_FP 0x00002000
49 #define MSR_ME 0x00001000
50 #define MSR_FE0 0x00000800
51 #define MSR_SE 0x00000400
52 #define MSR_BE 0x00000200
53 #define MSR_FE1 0x00000100
54 #define MSR_IP 0x00000040
55 #define MSR_IS 0x00000020
56 #define MSR_DS 0x00000010
57 #define MSR_RI 0x00000002
58 #define MSR_LE 0x00000001
61 ({ unsigned long val; asm volatile("mfspr %0,%1":"=r"(val):"i"(reg)); val; })
63 #define wrspr(reg, val) \
64 do { asm volatile("mtspr %0,%1"::"i"(reg),"r"(val)); } while(0)
67 #define XER 0x001 /* Integer Exception Register */
68 #define LR 0x008 /* Link Register */
69 #define CTR 0x009 /* Count Register */
70 #define DEC 0x016 /* Decrementer */
71 #define SDR1 0x019 /* MMU base address */
72 #define SRR0 0x01A /* Save/Restore Register 0 */
73 #define SRR1 0x01B /* Save/Restore Register 1 */
74 #define TBLU 0x10C /* Time Base Lower */
75 #define TBUU 0x10D /* Time Base Upper */
76 #define SPRG0 0x110 /* Special Purpose Register General 0 */
77 #define SPRG1 0x111 /* Special Purpose Register General 1 */
78 #define SPRG2 0x112 /* Special Purpose Register General 2 */
79 #define SPRG3 0x113 /* Special Purpose Register General 3 */
80 #define SPRG4 0x114 /* Special Purpose Register General 4 */
81 #define SPRG5 0x115 /* Special Purpose Register General 5 */
82 #define SPRG6 0x116 /* Special Purpose Register General 6 */
83 #define SPRG7 0x117 /* Special Purpose Register General 7 */
93 static inline struct KernelBase
*getKernelBase()
95 return (struct KernelBase
*)rdspr(SPRG4
);
98 static inline struct ExecBase
*getSysBase()
100 return (struct ExecBase
*)rdspr(SPRG5
);
103 /* Interrupt controller */
106 uint32_t ictl_pim
; /* Peripheral interrupt mask register */
107 uint32_t ictl_ppri
[3]; /* Peripheral priority and HI/LO select register */
108 uint32_t ictl_ee
; /* External enable and external types register */
109 uint32_t ictl_cpmim
; /* Critical Priority and Main Interrupt Mask Register */
110 uint32_t ictl_mip
[2]; /* Main Interrupt Priority and INT/SMI Select Register */
112 uint32_t ictl_pmce
; /* PerStat, MainStat, CritStat Encoded Register */
113 uint32_t ictl_cis
; /* Critical Interrupt Status All Register */
114 uint32_t ictl_mis
; /* Main Interrupt Status All Register */
115 uint32_t ictl_pis
; /* Peripheral Interrupt Status All Register */
117 uint32_t ictl_bes
; /* Bus Error Status Register */
119 uint32_t ictl_mie
; /* Main Interrupt Emulation All Register */
120 uint32_t ictl_pie
; /* Peripheral Interrupt Emulation All Register */
121 uint32_t ictl_iie
; /* IRQ Interrupt Emulation All Register */
124 #define MPC5200B_IRQ0 0 /* IRQ 0 */
125 #define MPC5200B_ST0 1 /* Slice Timer 0 */
126 #define MPC5200B_HI_INT 2 /* HI_int */
127 #define MPC5200B_WAKEUP 3 /* WakeUp from deep-sleep */
129 #define MPC5200B_ST1 4 /* Slice Timer 1 */
130 #define MPC5200B_IRQ1 5 /* IRQ 1 */
131 #define MPC5200B_IRQ2 6 /* IRQ 2 */
132 #define MPC5200B_IRQ3 7 /* IRQ 3 */
133 #define MPC5200B_LO_INT 8 /* LO_int */
134 #define MPC5200B_RTC_PINT 9 /* RTC Periodic Int */
135 #define MPC5200B_RTC_SINT 10 /* RTC Stopwatch and Alarm Int */
136 #define MPC5200B_GPIO_STD 11 /* GPIO interrupts */
137 #define MPC5200B_GPIO_WKUP 12 /* GPIO wakeup */
138 #define MPC5200B_TMR0 13 /* Timer 0 */
139 #define MPC5200B_TMR1 14 /* Timer 1 */
140 #define MPC5200B_TMR2 15 /* Timer 2 */
141 #define MPC5200B_TMR3 16 /* Timer 3 */
142 #define MPC5200B_TMR4 17 /* Timer 4 */
143 #define MPC5200B_TMR5 18 /* Timer 5 */
144 #define MPC5200B_TMR6 19 /* Timer 6 */
145 #define MPC5200B_TMR7 20 /* Timer 7 */
147 #define MPC5200B_BESTCOMM 21
148 #define MPC5200B_PSC1 22
149 #define MPC5200B_PSC2 23
150 #define MPC5200B_PSC3 24
151 #define MPC5200B_PSC6 25
152 #define MPC5200B_ETHER 26
153 #define MPC5200B_USB 27
154 #define MPC5200B_ATA 28
155 #define MPC5200B_PCICM 29
156 #define MPC5200B_PCISC_RX 30
157 #define MPC5200B_PCISC_TX 31
158 #define MPC5200B_PSC4 32
159 #define MPC5200B_PSC5 33
160 #define MPC5200B_SPI_MODF 34
161 #define MPC5200B_SPI_SPIF 35
162 #define MPC5200B_I2C1 36
163 #define MPC5200B_I2C2 37
164 #define MPC5200B_CAN1 38
165 #define MPC5200B_CAN2 39
166 #define MPC5200B_XLB 42
167 #define MPC5200B_BDLC 43
168 #define MPC5200B_BESTCOMMLP 44
170 #define PER_BESTCOMM 0
179 #define PER_PCISC_RX 9
180 #define PER_PCISC_TX 10
183 #define PER_SPI_MODF 13
184 #define PER_SPI_SPIF 14
191 #define PER_BESTCOMMLP 23
193 #define ICTL_PIM_BESTCOMM __BV32(PER_BESTCOMM)
194 #define ICTL_PIM_PSC1 __BV32(PER_PSC1)
195 #define ICTL_PIM_PSC2 __BV32(PER_PSC2)
196 #define ICTL_PIM_PSC3 __BV32(PER_PSC3)
197 #define ICTL_PIM_PSC6 __BV32(PER_PSC6)
198 #define ICTL_PIM_ETHER __BV32(PER_ETHER)
199 #define ICTL_PIM_USB __BV32(PER_USB)
200 #define ICTL_PIM_ATA __BV32(PER_ATA)
201 #define ICTL_PIM_PCICM __BV32(PER_PCICM)
202 #define ICTL_PIM_PCISC_RX __BV32(PER_PCISC_RX)
203 #define ICTL_PIM_PCISC_TX __BV32(PER_PCISC_TX)
204 #define ICTL_PIM_PSC4 __BV32(PER_PSC4)
205 #define ICTL_PIM_PSC5 __BV32(PER_PSC5)
206 #define ICTL_PIM_SPI_MODF __BV32(PER_SPI_MODF)
207 #define ICTL_PIM_SPI_SPIF __BV32(PER_SPI_SPIF)
208 #define ICTL_PIM_I2C1 __BV32(PER_I2C1)
209 #define ICTL_PIM_I2C2 __BV32(PER_I2C2)
210 #define ICTL_PIM_CAN1 __BV32(PER_CAN1)
211 #define ICTL_PIM_CAN2 __BV32(PER_CAN2)
212 #define ICTL_PIM_XLB __BV32(PER_XLB)
213 #define ICTL_PIM_BDLC __BV32(PER_BDLC)
214 #define ICTL_PIM_BESTCOMMLP __BV32(PER_BESTCOMMLP)
216 #define ICTL_EE_MEE __BV32(19)
217 #define ICTL_EE_CEB __BV32(31)
221 volatile uint32_t slt_tc
; /* Terminal count register */
222 volatile uint32_t slt_cf
; /* Control field register */
223 volatile uint32_t slt_cv
; /* Count value register. Read only! */
224 volatile uint32_t slt_ts
; /* Timer Status register */
227 #define SLT_CF_RUNWAIT 0x04000000 /* Run/Wait */
228 #define SLT_CF_INTRENA 0x02000000 /* Interrupt enable */
229 #define SLT_CF_ENABLE 0x01000000 /* Enable/Disable timer */
231 #define SLT_TS_ST 0x01000000 /* Terminal count reached. Write 1 to clear */
236 volatile uint32_t ata_config
;
237 volatile uint32_t ata_status
;
239 volatile uint32_t ata_pio1
;
240 volatile uint32_t ata_pio2
;
241 volatile uint32_t ata_dma1
;
242 volatile uint32_t ata_dma2
;
243 volatile uint32_t ata_udma1
;
244 volatile uint32_t ata_udma2
;
245 volatile uint32_t ata_udma3
;
246 volatile uint32_t ata_udma4
;
247 volatile uint32_t ata_udma5
;
248 volatile uint32_t ata_invalid
;
256 uint32_t bc_currentPointer
;
257 uint32_t bc_endPointer
;
258 uint32_t bc_variablePointer
;
259 uint32_t bc_interruptVector
;
260 uint32_t bc_interruptPending
;
261 uint32_t bc_interruptMask
;
264 uint32_t bc_requestMuxControl
;
265 uint32_t bc_taskSize
[2];
268 /* Bestcomm's task description table */
274 uint32_t exec_status
;
280 #endif /* ASM_MPC5200B_H */