initial
[fpgammix.git] / workloads / common / mmix-iospace.h
blob03051551dadeffbb81406c3fe4722515e2941d74
1 #ifndef _MMIX_IOSPACE_H_
2 #define _MMIX_IOSPACE_H_ 1
4 // XXX Don't belong here I know.
5 typedef long int64_t;
6 typedef long unsigned uint64_t;
7 typedef int int32_t;
8 typedef int unsigned uint32_t;
9 typedef short int16_t;
10 typedef short unsigned uint16_t;
11 typedef char int8_t;
12 typedef char unsigned uint8_t;
14 #define MMIX_IOSPACE ((volatile int *) 0x1000000000000ULL)
16 #define MMIX_IO_PS2_RAW 23
17 #define MMIX_IO_KEYBOARD 25
18 #define MMIX_IO_MOUSE 27
20 #define MMIX_IO_RS232_OUT 1
21 #define MMIX_IO_RS232_BUSY_IN 1
23 #define MMIX_IO_RS232_RDDATA_IN 3
25 #define MMIX_IO_S7_0_OUT 9
26 #define MMIX_IO_S7_1_OUT 11
28 #define set_mmix_fbaddr0(x) MMIX_IOSPACE[21] = (int) (unsigned long) (x)
31 void wait(unsigned long ms);
32 void wait_us(long unsigned us);
34 static inline long unsigned now(void) {
35 long unsigned rC;
37 asm volatile("GET %0,rC" : "=r" (rC));
39 return rC;
43 static inline long unsigned getEvents(void) {
44 long unsigned rC;
46 asm volatile("GET %0,rQ" : "=r" (rC));
48 return rC;
51 static inline long unsigned getIntrMask(void) {
52 long unsigned rC;
54 asm volatile("GET %0,rK" : "=r" (rC));
56 return rC;
60 static inline void setIntrMask(long unsigned mask) {
61 asm volatile("PUT rK,%0" :: "r" (mask));}
63 static inline void setInterruptVector(long unsigned addr) {
64 asm volatile("PUT rTT,%0" :: "r" (addr)); }
66 static inline void setInterval(long unsigned v) {
67 asm volatile("PUT rI,%0" :: "r" (v)); }
70 #define get_switches() MMIX_IOSPACE[5]
71 #define SW0 1
72 #define SW1 2
73 #define SW2 4
74 #define SW3 8
77 #define DAC_both MMIX_IOSPACE[17]
79 #define FREQUENCY 25000000
81 #endif