OpenCores
URL https://opencores.org/ocsvn/zet86/zet86/trunk

Subversion Repositories zet86

[/] [zet86/] [trunk/] [tests/] [22_sysace.s] - Blame information for rev 52

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 52 zeus
.code16
2
start:
3
 
4
# CSR_ACE_BUSMODE = ACE_BUSMODE_16BIT;
5
movw $0xe200, %dx
6
movw $0x0001, %ax
7
outw %ax, %dx
8
 
9
# if(!(CSR_ACE_STATUSL & ACE_STATUSL_CFDETECT)) return 0;
10
movw $0xe204, %dx
11
inw  %dx, %ax
12
andw $0x0010, %ax
13
jne  cf_detect
14
movw $0x2, (0)
15
hlt
16
cf_detect:
17
 
18
# if((CSR_ACE_ERRORL != 0) || (CSR_ACE_ERRORH != 0)) return 0;
19
movw $0xe208, %dx
20
inw  %dx, %ax
21
cmpw $0x0, %ax
22
jne  error_l
23
 
24
movw $0xe20a, %dx
25
inw  %dx, %ax
26
cmpw $0x0, %ax
27
je   lock_req
28
error_l:
29
movw $0x3, (0)
30
hlt
31
lock_req:
32
 
33
# CSR_ACE_CTLL |= ACE_CTLL_LOCKREQ;
34
movw $0xe218, %dx
35
inw  %dx, %ax
36
orw  $0x2, %ax
37
outw %ax, %dx
38
 
39
# timeout = TIMEOUT;
40
movw $0xffff, %cx
41
 
42
# while((timeout > 0) && (!(CSR_ACE_STATUSL & ACE_STATUSL_MPULOCK))) timeout--;
43
movw $0xe204, %dx
44
ace_statusl:
45
inw  %dx, %ax
46
andw $0x2, %ax
47
loopz ace_statusl
48
 
49
# if(timeout == 0) return 0;
50
cmpw $0x0, %cx
51
jnz  success
52
movw $0x4, (0)
53
hlt
54
 
55
success:
56
# We are going to read the first block
57
xor %bx, %bx
58
 
59
# timeout = TIMEOUT;
60
movw $0xffff, %cx
61
 
62
# while((timeout > 0) && (!(CSR_ACE_STATUSL & ACE_STATUSL_CFCMDRDY))) timeout--;
63
movw $0xe204, %dx
64
ace_statusl2:
65
inw  %dx, %ax
66
andw $0x100, %ax
67
loopz ace_statusl2
68
 
69
# if(timeout == 0) return 0;
70
cmpw $0x0, %cx
71
jnz  success2
72
movw $0x5, (0)
73
hlt
74
 
75
success2:
76
movw $0x4, (2)
77
# CSR_ACE_MLBAL = blocknr & 0x0000ffff;
78
# CSR_ACE_MLBAH = (blocknr & 0x0fff0000) >> 16;
79
xorw %ax, %ax
80
movw $0xe210, %dx
81
outw %ax, %dx
82
movw $0xe212, %dx
83
outw %ax, %dx
84
 
85
movw $0x5, (2)
86
# CSR_ACE_SECCMD = ACE_SECCMD_READ|0x01;
87
movw $0x0301, %ax
88
movw $0xe214, %dx
89
outw %ax, %dx
90
 
91
movw $0x6, (2)
92
# CSR_ACE_CTLL |= ACE_CTLL_CFGRESET;
93
movw $0xe218, %dx
94
inw  %dx, %ax
95
orw  $0x0080, %ax
96
outw %ax, %dx
97
 
98
movw $0x7, (2)
99
# buffer_count = 16;
100
movw $16, %si
101
 
102
movw $0x8, (2)
103
# while(buffer_count > 0) {
104
cond_loop:
105
cmpw $0, %si
106
jbe  exit_loop
107
 
108
# timeout = TIMEOUT;
109
movw $0xffff, %cx
110
 
111
# while((timeout > 0) && (!(CSR_ACE_STATUSL & ACE_STATUSL_DATARDY))) timeout--;
112
movw $0xe204, %dx
113
ace_statusl3:
114
inw  %dx, %ax
115
andw $0x20, %ax
116
loopz ace_statusl3
117
 
118
# if(timeout == 0) return 0;
119
cmpw $0x0, %cx
120
jnz  success3
121
movw $0x6, (0)
122
hlt
123
 
124
success3:
125
# for(i=0;i<16;i++) {
126
movw $16, %cx
127
# *bufw = CSR_ACE_DATA;
128
movw $0xe240, %dx
129
ace_data:
130
inw  %dx, %ax
131
movw %ax, (%bx)
132
# bufw++;
133
addw $2, %bx
134
# }
135
loop ace_data
136
 
137
# buffer_count--;
138
decw %si
139
jmp cond_loop
140
 
141
# }
142
exit_loop:
143
 
144
# CSR_ACE_CTLL &= ~ACE_CTLL_CFGRESET;
145
movw $0xe218, %dx
146
inw  %dx, %ax
147
andw $0xff7f, %ax
148
outw %ax, %dx
149
 
150
hlt
151
 
152
.org 65520
153
jmp start
154
.org 65535
155
.byte 0xff
156
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.