Вывод блока памяти данных » History » Version 9
krufter_multiclet, 07/19/2013 04:08 PM
1 | 1 | krufter_multiclet | h1. Вывод блока памяти данных |
---|---|---|---|
2 | 1 | krufter_multiclet | |
3 | 7 | krufter_multiclet | +Для платы HW1-MCp04:+ |
4 | 2 | krufter_multiclet | |
5 | 2 | krufter_multiclet | <pre> |
6 | 8 | krufter_multiclet | .include "HDL50001_pcf.inc" |
7 | 8 | krufter_multiclet | |
8 | 2 | krufter_multiclet | .alias DM_START 0x00000000 ;start address DM for output by uart0 |
9 | 2 | krufter_multiclet | .alias BLOCK_SIZE 0x00000100 ;end address DM for output by uart0 |
10 | 2 | krufter_multiclet | .alias iterator1 2 |
11 | 2 | krufter_multiclet | .alias iterator2 3 |
12 | 2 | krufter_multiclet | .alias iterator3 4 |
13 | 2 | krufter_multiclet | .alias byte_DM 5 |
14 | 2 | krufter_multiclet | |
15 | 2 | krufter_multiclet | .alias UART_DATA UART0_DATA |
16 | 2 | krufter_multiclet | .alias UART_BDR UART0_BDR |
17 | 2 | krufter_multiclet | .alias UART_ST UART0_ST |
18 | 2 | krufter_multiclet | .alias UART_CR UART0_CR |
19 | 2 | krufter_multiclet | |
20 | 2 | krufter_multiclet | .alias UART_PORT_PIN 0x300 |
21 | 2 | krufter_multiclet | .alias UART_PORT_BPS GPIOB_BPS |
22 | 2 | krufter_multiclet | |
23 | 2 | krufter_multiclet | .text |
24 | 2 | krufter_multiclet | |
25 | 3 | krufter_multiclet | ;config uart |
26 | 2 | krufter_multiclet | initUART: |
27 | 2 | krufter_multiclet | jmp read_DM |
28 | 2 | krufter_multiclet | getl 0x00000300 |
29 | 9 | krufter_multiclet | wrl @1, UART_PORT_BPS |
30 | 2 | krufter_multiclet | getl 0x00000104 |
31 | 2 | krufter_multiclet | wrl @1, UART_BDR |
32 | 2 | krufter_multiclet | getl 0x00000003 |
33 | 2 | krufter_multiclet | wrl @1, UART_CR |
34 | 2 | krufter_multiclet | setl #iterator1, 0x00000000 |
35 | 4 | krufter_multiclet | setl #iterator3, 4 ; send to uart fifo 32 bytes |
36 | 2 | krufter_multiclet | complete |
37 | 2 | krufter_multiclet | |
38 | 2 | krufter_multiclet | ; read DM for define address as double word (64 bits) |
39 | 2 | krufter_multiclet | read_DM: |
40 | 2 | krufter_multiclet | getl BLOCK_SIZE |
41 | 2 | krufter_multiclet | subl @1, #iterator1 |
42 | 2 | krufter_multiclet | je @1, stop2 |
43 | 2 | krufter_multiclet | jne @2, out_DM |
44 | 2 | krufter_multiclet | getl #iterator1 |
45 | 2 | krufter_multiclet | addl @1, DM_START |
46 | 2 | krufter_multiclet | rdq @1 |
47 | 2 | krufter_multiclet | setq #byte_DM, @1 |
48 | 2 | krufter_multiclet | addl @4, 0x00000008 |
49 | 2 | krufter_multiclet | setl #iterator1, @1 |
50 | 2 | krufter_multiclet | setl #iterator2, 0 |
51 | 2 | krufter_multiclet | getl #iterator3 |
52 | 2 | krufter_multiclet | subl @1, 1 |
53 | 2 | krufter_multiclet | setl #iterator3, @1 |
54 | 2 | krufter_multiclet | complete |
55 | 2 | krufter_multiclet | |
56 | 2 | krufter_multiclet | out_DM: |
57 | 2 | krufter_multiclet | getl #iterator2 |
58 | 2 | krufter_multiclet | getl 56 ; write to tx fifo 8 bytes |
59 | 2 | krufter_multiclet | subl @1, @2 |
60 | 2 | krufter_multiclet | je @1, full_FIFO |
61 | 2 | krufter_multiclet | jne @2, out_DM |
62 | 2 | krufter_multiclet | getq #byte_DM |
63 | 2 | krufter_multiclet | slrq @1, #iterator2 |
64 | 2 | krufter_multiclet | wrq @1, UART_DATA ; write to tx fifo only one byte |
65 | 2 | krufter_multiclet | getl 8 |
66 | 2 | krufter_multiclet | addl @1, #iterator2 |
67 | 2 | krufter_multiclet | setl #iterator2, @1 |
68 | 2 | krufter_multiclet | complete |
69 | 2 | krufter_multiclet | |
70 | 2 | krufter_multiclet | ; analyze iterator3 for sending all 4*8 bytes |
71 | 2 | krufter_multiclet | full_FIFO: |
72 | 2 | krufter_multiclet | getl #iterator3 |
73 | 2 | krufter_multiclet | getl 0xFFFFFFFF |
74 | 2 | krufter_multiclet | and @1, @2 |
75 | 2 | krufter_multiclet | je @1, buf_TXD |
76 | 2 | krufter_multiclet | jne @2, read_DM |
77 | 2 | krufter_multiclet | complete |
78 | 2 | krufter_multiclet | |
79 | 2 | krufter_multiclet | ; wait for fifo transmitter is empty |
80 | 2 | krufter_multiclet | buf_TXD: |
81 | 2 | krufter_multiclet | rdl UART_ST |
82 | 2 | krufter_multiclet | getl 0x00000004 |
83 | 2 | krufter_multiclet | and @1, @2 |
84 | 2 | krufter_multiclet | je @1, buf_TXD |
85 | 2 | krufter_multiclet | jne @2, read_DM |
86 | 2 | krufter_multiclet | setl #iterator3, 4 |
87 | 2 | krufter_multiclet | complete |
88 | 2 | krufter_multiclet | |
89 | 2 | krufter_multiclet | ; enable led 2,3 |
90 | 2 | krufter_multiclet | stop2: |
91 | 2 | krufter_multiclet | getl 0x1000 |
92 | 2 | krufter_multiclet | complete |
93 | 2 | krufter_multiclet | </pre> |
94 | 5 | krufter_multiclet | |
95 | 1 | krufter_multiclet | +Замечание:+ размер блока BLOCK_SIZE должен быть выравнен на 8. Скоро появится пример вывода по UART с точностью до байта. |
96 | 7 | krufter_multiclet | |
97 | 7 | krufter_multiclet | |
98 | 7 | krufter_multiclet | +Для платы LDM-MCp04:+ |
99 | 7 | krufter_multiclet | |
100 | 7 | krufter_multiclet | <pre> |
101 | 8 | krufter_multiclet | .include "HDL50001_pcf.inc" |
102 | 8 | krufter_multiclet | |
103 | 7 | krufter_multiclet | .alias DM_START 0x00000000 ;start address DM for output by uart0 |
104 | 7 | krufter_multiclet | .alias BLOCK_SIZE 0x00000100 ;end address DM for output by uart0 |
105 | 7 | krufter_multiclet | .alias iterator1 2 |
106 | 7 | krufter_multiclet | .alias iterator2 3 |
107 | 7 | krufter_multiclet | .alias iterator3 4 |
108 | 7 | krufter_multiclet | .alias byte_DM 5 |
109 | 7 | krufter_multiclet | |
110 | 7 | krufter_multiclet | .alias UART_DATA UART3_DATA |
111 | 7 | krufter_multiclet | .alias UART_BDR UART3_BDR |
112 | 7 | krufter_multiclet | .alias UART_ST UART3_ST |
113 | 7 | krufter_multiclet | .alias UART_CR UART3_CR |
114 | 7 | krufter_multiclet | |
115 | 7 | krufter_multiclet | .alias UART_PORT_PIN 0x300 |
116 | 7 | krufter_multiclet | .alias UART_PORT_BPS GPIOD_BPS |
117 | 7 | krufter_multiclet | |
118 | 7 | krufter_multiclet | .text |
119 | 7 | krufter_multiclet | |
120 | 7 | krufter_multiclet | ;config uart |
121 | 7 | krufter_multiclet | initUART: |
122 | 7 | krufter_multiclet | jmp read_DM |
123 | 7 | krufter_multiclet | getl 0x00000300 |
124 | 9 | krufter_multiclet | wrl @1, UART_PORT_BPS |
125 | 7 | krufter_multiclet | getl 0x00000104 |
126 | 7 | krufter_multiclet | wrl @1, UART_BDR |
127 | 7 | krufter_multiclet | getl 0x00000003 |
128 | 7 | krufter_multiclet | wrl @1, UART_CR |
129 | 7 | krufter_multiclet | setl #iterator1, 0x00000000 |
130 | 7 | krufter_multiclet | setl #iterator3, 4 ; send to uart fifo 32 bytes |
131 | 7 | krufter_multiclet | complete |
132 | 7 | krufter_multiclet | |
133 | 7 | krufter_multiclet | ; read DM for define address as double word (64 bits) |
134 | 7 | krufter_multiclet | read_DM: |
135 | 7 | krufter_multiclet | getl BLOCK_SIZE |
136 | 7 | krufter_multiclet | subl @1, #iterator1 |
137 | 7 | krufter_multiclet | je @1, stop2 |
138 | 7 | krufter_multiclet | jne @2, out_DM |
139 | 7 | krufter_multiclet | getl #iterator1 |
140 | 7 | krufter_multiclet | addl @1, DM_START |
141 | 7 | krufter_multiclet | rdq @1 |
142 | 7 | krufter_multiclet | setq #byte_DM, @1 |
143 | 7 | krufter_multiclet | addl @4, 0x00000008 |
144 | 7 | krufter_multiclet | setl #iterator1, @1 |
145 | 7 | krufter_multiclet | setl #iterator2, 0 |
146 | 7 | krufter_multiclet | getl #iterator3 |
147 | 7 | krufter_multiclet | subl @1, 1 |
148 | 7 | krufter_multiclet | setl #iterator3, @1 |
149 | 7 | krufter_multiclet | complete |
150 | 7 | krufter_multiclet | |
151 | 7 | krufter_multiclet | out_DM: |
152 | 7 | krufter_multiclet | getl #iterator2 |
153 | 7 | krufter_multiclet | getl 56 ; write to tx fifo 8 bytes |
154 | 7 | krufter_multiclet | subl @1, @2 |
155 | 7 | krufter_multiclet | je @1, full_FIFO |
156 | 7 | krufter_multiclet | jne @2, out_DM |
157 | 7 | krufter_multiclet | getq #byte_DM |
158 | 7 | krufter_multiclet | slrq @1, #iterator2 |
159 | 7 | krufter_multiclet | wrq @1, UART_DATA ; write to tx fifo only one byte |
160 | 7 | krufter_multiclet | getl 8 |
161 | 7 | krufter_multiclet | addl @1, #iterator2 |
162 | 7 | krufter_multiclet | setl #iterator2, @1 |
163 | 7 | krufter_multiclet | complete |
164 | 7 | krufter_multiclet | |
165 | 7 | krufter_multiclet | ; analyze iterator3 for sending all 4*8 bytes |
166 | 7 | krufter_multiclet | full_FIFO: |
167 | 7 | krufter_multiclet | getl #iterator3 |
168 | 7 | krufter_multiclet | getl 0xFFFFFFFF |
169 | 7 | krufter_multiclet | and @1, @2 |
170 | 7 | krufter_multiclet | je @1, buf_TXD |
171 | 7 | krufter_multiclet | jne @2, read_DM |
172 | 7 | krufter_multiclet | complete |
173 | 7 | krufter_multiclet | |
174 | 7 | krufter_multiclet | ; wait for fifo transmitter is empty |
175 | 7 | krufter_multiclet | buf_TXD: |
176 | 7 | krufter_multiclet | rdl UART_ST |
177 | 7 | krufter_multiclet | getl 0x00000004 |
178 | 7 | krufter_multiclet | and @1, @2 |
179 | 7 | krufter_multiclet | je @1, buf_TXD |
180 | 7 | krufter_multiclet | jne @2, read_DM |
181 | 7 | krufter_multiclet | setl #iterator3, 4 |
182 | 7 | krufter_multiclet | complete |
183 | 7 | krufter_multiclet | |
184 | 7 | krufter_multiclet | ; enable led 2,3 |
185 | 7 | krufter_multiclet | stop2: |
186 | 7 | krufter_multiclet | getl 0x1000 |
187 | 7 | krufter_multiclet | complete |
188 | 7 | krufter_multiclet | </pre> |