Project

General

Profile

С выравниванием по байту » History » Version 1

krufter_multiclet, 07/19/2013 04:15 PM

1 1 krufter_multiclet
h1. С выравниванием по байту
2 1 krufter_multiclet
3 1 krufter_multiclet
+Для платы HW1-MCp04:+
4 1 krufter_multiclet
5 1 krufter_multiclet
<pre>
6 1 krufter_multiclet
.include "HDL50001_pcf.inc" 
7 1 krufter_multiclet
8 1 krufter_multiclet
.alias DM_START        0x00000000 ;start address DM for output by uart0
9 1 krufter_multiclet
.alias BLOCK_SIZE    0x00000100 ;end address DM for output by uart0
10 1 krufter_multiclet
.alias iterator1 2
11 1 krufter_multiclet
.alias byte_DM 5
12 1 krufter_multiclet
13 1 krufter_multiclet
.alias UART_DATA    UART0_DATA
14 1 krufter_multiclet
.alias UART_BDR     UART0_BDR
15 1 krufter_multiclet
.alias UART_ST      UART0_ST
16 1 krufter_multiclet
.alias UART_CR      UART0_CR
17 1 krufter_multiclet
18 1 krufter_multiclet
.alias UART_PORT_PIN  0x300
19 1 krufter_multiclet
.alias UART_PORT_BPS  GPIOB_BPS
20 1 krufter_multiclet
21 1 krufter_multiclet
.text
22 1 krufter_multiclet
23 1 krufter_multiclet
;config uart
24 1 krufter_multiclet
initUART:
25 1 krufter_multiclet
    jmp read_DM
26 1 krufter_multiclet
    getl 0x00000300
27 1 krufter_multiclet
    wrl @1, UART_PORT_BPS
28 1 krufter_multiclet
    getl 0x00000104
29 1 krufter_multiclet
    wrl @1, UART_BDR
30 1 krufter_multiclet
    getl 0x00000003
31 1 krufter_multiclet
    wrl @1, UART_CR
32 1 krufter_multiclet
    setl #iterator1, 0x00000000
33 1 krufter_multiclet
complete
34 1 krufter_multiclet
35 1 krufter_multiclet
; read DM for define address as double word (64 bits)
36 1 krufter_multiclet
read_DM:
37 1 krufter_multiclet
    getl BLOCK_SIZE
38 1 krufter_multiclet
    subl @1, #iterator1
39 1 krufter_multiclet
    je @1, stop2
40 1 krufter_multiclet
    jne @2, out_DM
41 1 krufter_multiclet
    getl #iterator1
42 1 krufter_multiclet
    addl @1, DM_START
43 1 krufter_multiclet
    rdb @1
44 1 krufter_multiclet
    setb #byte_DM, @1
45 1 krufter_multiclet
    addl @4, 0x00000001
46 1 krufter_multiclet
    setl #iterator1, @1
47 1 krufter_multiclet
complete
48 1 krufter_multiclet
49 1 krufter_multiclet
out_DM:
50 1 krufter_multiclet
    getb #byte_DM 
51 1 krufter_multiclet
    wrb @1, UART_DATA ; write to tx fifo only one byte
52 1 krufter_multiclet
    jmp buf_TXD
53 1 krufter_multiclet
complete
54 1 krufter_multiclet
55 1 krufter_multiclet
; wait for fifo transmitter not full
56 1 krufter_multiclet
buf_TXD:
57 1 krufter_multiclet
    rdl UART_ST
58 1 krufter_multiclet
    getl 0x00000200
59 1 krufter_multiclet
    and @1, @2
60 1 krufter_multiclet
    jne @1, buf_TXD
61 1 krufter_multiclet
    je @2, read_DM
62 1 krufter_multiclet
complete
63 1 krufter_multiclet
64 1 krufter_multiclet
; enable led 2,3
65 1 krufter_multiclet
stop2:
66 1 krufter_multiclet
    getl 0x1000
67 1 krufter_multiclet
complete
68 1 krufter_multiclet
</pre>
69 1 krufter_multiclet
70 1 krufter_multiclet
+Для платы LDM-MCp04:+
71 1 krufter_multiclet
<pre>
72 1 krufter_multiclet
.include "HDL50001_pcf.inc" 
73 1 krufter_multiclet
74 1 krufter_multiclet
.alias DM_START        0x00000000 ;start address DM for output by uart0
75 1 krufter_multiclet
.alias BLOCK_SIZE    0x00000100 ;end address DM for output by uart0
76 1 krufter_multiclet
.alias iterator1 2
77 1 krufter_multiclet
.alias byte_DM 5
78 1 krufter_multiclet
79 1 krufter_multiclet
.alias UART_DATA    UART3_DATA
80 1 krufter_multiclet
.alias UART_BDR     UART3_BDR
81 1 krufter_multiclet
.alias UART_ST      UART3_ST
82 1 krufter_multiclet
.alias UART_CR      UART3_CR
83 1 krufter_multiclet
84 1 krufter_multiclet
.alias UART_PORT_PIN  0x300
85 1 krufter_multiclet
.alias UART_PORT_BPS  GPIOD_BPS
86 1 krufter_multiclet
87 1 krufter_multiclet
.text
88 1 krufter_multiclet
89 1 krufter_multiclet
;config uart
90 1 krufter_multiclet
initUART:
91 1 krufter_multiclet
    jmp read_DM
92 1 krufter_multiclet
    getl 0x00000300
93 1 krufter_multiclet
    wrl @1, UART_PORT_BPS
94 1 krufter_multiclet
    getl 0x00000104
95 1 krufter_multiclet
    wrl @1, UART_BDR
96 1 krufter_multiclet
    getl 0x00000003
97 1 krufter_multiclet
    wrl @1, UART_CR
98 1 krufter_multiclet
    setl #iterator1, 0x00000000
99 1 krufter_multiclet
complete
100 1 krufter_multiclet
101 1 krufter_multiclet
; read DM for define address as double word (64 bits)
102 1 krufter_multiclet
read_DM:
103 1 krufter_multiclet
    getl BLOCK_SIZE
104 1 krufter_multiclet
    subl @1, #iterator1
105 1 krufter_multiclet
    je @1, stop2
106 1 krufter_multiclet
    jne @2, out_DM
107 1 krufter_multiclet
    getl #iterator1
108 1 krufter_multiclet
    addl @1, DM_START
109 1 krufter_multiclet
    rdb @1
110 1 krufter_multiclet
    setb #byte_DM, @1
111 1 krufter_multiclet
    addl @4, 0x00000001
112 1 krufter_multiclet
    setl #iterator1, @1
113 1 krufter_multiclet
complete
114 1 krufter_multiclet
115 1 krufter_multiclet
out_DM:
116 1 krufter_multiclet
    getb #byte_DM 
117 1 krufter_multiclet
    wrb @1, UART_DATA ; write to tx fifo only one byte
118 1 krufter_multiclet
    jmp buf_TXD
119 1 krufter_multiclet
complete
120 1 krufter_multiclet
121 1 krufter_multiclet
; wait for fifo transmitter not full
122 1 krufter_multiclet
buf_TXD:
123 1 krufter_multiclet
    rdl UART_ST
124 1 krufter_multiclet
    getl 0x00000200
125 1 krufter_multiclet
    and @1, @2
126 1 krufter_multiclet
    jne @1, buf_TXD
127 1 krufter_multiclet
    je @2, read_DM
128 1 krufter_multiclet
complete
129 1 krufter_multiclet
130 1 krufter_multiclet
; enable led 2,3
131 1 krufter_multiclet
stop2:
132 1 krufter_multiclet
    getl 0x1000
133 1 krufter_multiclet
complete
134 1 krufter_multiclet
</pre>