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