Project

General

Profile

Вывод блока памяти данных » History » Version 4

krufter_multiclet, 07/19/2013 11:53 AM

1 1 krufter_multiclet
h1. Вывод блока памяти данных
2 1 krufter_multiclet
3 2 krufter_multiclet
+Для платы HW-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>