s390-ccw.img: replace while loop with a disabled wait on s390 bios
[qemu/agraf.git] / tests / tcg / mips / mips32-dsp / wrdsp.c
blobdc54943a99e81b686f06b17100777a9ffea9ad4b
1 #include<stdio.h>
2 #include<assert.h>
4 int main()
6 int dsp_i, dsp_o;
7 int ccond_i, outflag_i, efi_i, c_i, scount_i, pos_i;
8 int ccond_o, outflag_o, efi_o, c_o, scount_o, pos_o;
10 ccond_i = 0x000000BC; /* 4 */
11 outflag_i = 0x0000001B; /* 3 */
12 efi_i = 0x00000001; /* 5 */
13 c_i = 0x00000001; /* 2 */
14 scount_i = 0x0000000F; /* 1 */
15 pos_i = 0x0000000C; /* 0 */
17 dsp_i = (ccond_i << 24) | \
18 (outflag_i << 16) | \
19 (efi_i << 14) | \
20 (c_i << 13) | \
21 (scount_i << 7) | \
22 pos_i;
24 __asm
25 ("wrdsp %1, 0x3F\n\t"
26 "rddsp %0, 0x3F\n\t"
27 : "=r"(dsp_o)
28 : "r"(dsp_i)
31 ccond_o = (dsp_o >> 24) & 0xFF;
32 outflag_o = (dsp_o >> 16) & 0xFF;
33 efi_o = (dsp_o >> 14) & 0x01;
34 c_o = (dsp_o >> 14) & 0x01;
35 scount_o = (dsp_o >> 7) & 0x3F;
36 pos_o = dsp_o & 0x1F;
38 assert(ccond_o == (ccond_i & 0x0F));
39 assert(outflag_o == outflag_i);
40 assert(efi_o == efi_i);
41 assert(c_o == c_i);
42 assert(scount_o == scount_i);
43 assert(pos_o == pos_i);
45 return 0;