|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\drivers\ecomm\arm\uart16550.cia |
|
15 // PDD for 16550 UART - ARM assembler bits |
|
16 // |
|
17 // |
|
18 |
|
19 #include <comm.h> |
|
20 #include <assp.h> |
|
21 #include <var_defs.h> |
|
22 #include <uart16550.h> |
|
23 #include <e32hal.h> |
|
24 |
|
25 __NAKED__ void T16550Uart::ModifyFCR(TUint /*aClearMask*/, TUint /*aSetMask*/) |
|
26 { |
|
27 asm("mrs ip, cpsr "); |
|
28 asm("orr r3, ip, #0xc0 "); |
|
29 asm("msr cpsr, r3 "); |
|
30 asm("ldrb r3, [r0, #4] "); |
|
31 asm("bic r3, r3, r1 "); |
|
32 asm("ldr r1, [r0, #0] "); |
|
33 asm("orr r3, r3, r2 "); |
|
34 asm("strb r3, [r0, #4] "); |
|
35 asm("strb r3, [r1, #%a0]" : : "i" ((TInt)K16550FCROffset)); |
|
36 asm("msr cpsr, ip "); |
|
37 __JUMP(,lr); |
|
38 } |
|
39 |
|
40 __NAKED__ void T16550Uart::ModifyLCR(TUint /*aClearMask*/, TUint /*aSetMask*/) |
|
41 { |
|
42 asm("mrs ip, cpsr "); |
|
43 asm("orr r3, ip, #0xc0 "); |
|
44 asm("msr cpsr, r3 "); |
|
45 asm("ldrb r3, [r0, #5] "); |
|
46 asm("bic r3, r3, r1 "); |
|
47 asm("ldr r1, [r0, #0] "); |
|
48 asm("orr r3, r3, r2 "); |
|
49 asm("strb r3, [r0, #5] "); |
|
50 asm("strb r3, [r1, #%a0]" : : "i" ((TInt)K16550LCROffset)); |
|
51 asm("msr cpsr, ip "); |
|
52 __JUMP(,lr); |
|
53 } |
|
54 |
|
55 __NAKED__ void T16550Uart::ModifyMCR(TUint /*aClearMask*/, TUint /*aSetMask*/) |
|
56 { |
|
57 asm("mrs ip, cpsr "); |
|
58 asm("orr r3, ip, #0xc0 "); |
|
59 asm("msr cpsr, r3 "); |
|
60 asm("ldrb r3, [r0, #6] "); |
|
61 asm("bic r3, r3, r1 "); |
|
62 asm("ldr r1, [r0, #0] "); |
|
63 asm("orr r3, r3, r2 "); |
|
64 asm("strb r3, [r0, #6] "); |
|
65 asm("strb r3, [r1, #%a0]" : : "i" ((TInt)K16550MCROffset)); |
|
66 asm("msr cpsr, ip "); |
|
67 __JUMP(,lr); |
|
68 } |
|
69 |
|
70 __NAKED__ void T16550Uart::ModifyIER(TUint /*aClearMask*/, TUint /*aSetMask*/) |
|
71 { |
|
72 asm("mrs ip, cpsr "); |
|
73 asm("orr r3, ip, #0xc0 "); |
|
74 asm("msr cpsr, r3 "); |
|
75 asm("ldrb r3, [r0, #7] "); |
|
76 asm("bic r3, r3, r1 "); |
|
77 asm("ldr r1, [r0, #0] "); |
|
78 asm("orr r3, r3, r2 "); |
|
79 asm("strb r3, [r0, #7] "); |
|
80 asm("strb r3, [r1, #%a0]" : : "i" ((TInt)K16550IEROffset)); |
|
81 asm("msr cpsr, ip "); |
|
82 __JUMP(,lr); |
|
83 } |
|
84 |
|
85 __NAKED__ void T16550Uart::SetFCR(TUint /*aValue*/) |
|
86 { |
|
87 asm("mrs ip, cpsr "); |
|
88 asm("ldr r3, [r0, #0] "); |
|
89 asm("orr r2, ip, #0xc0 "); |
|
90 asm("msr cpsr, r2 "); |
|
91 asm("strb r1, [r0, #4] "); |
|
92 asm("strb r1, [r3, #%a0]" : : "i" ((TInt)K16550FCROffset)); |
|
93 asm("msr cpsr, ip "); |
|
94 __JUMP(,lr); |
|
95 } |
|
96 |
|
97 __NAKED__ void T16550Uart::SetLCR(TUint /*aValue*/) |
|
98 { |
|
99 asm("mrs ip, cpsr "); |
|
100 asm("ldr r3, [r0, #0] "); |
|
101 asm("orr r2, ip, #0xc0 "); |
|
102 asm("msr cpsr, r2 "); |
|
103 asm("strb r1, [r0, #5] "); |
|
104 asm("strb r1, [r3, #%a0]" : : "i" ((TInt)K16550LCROffset)); |
|
105 asm("msr cpsr, ip "); |
|
106 __JUMP(,lr); |
|
107 } |
|
108 |
|
109 __NAKED__ void T16550Uart::SetMCR(TUint /*aValue*/) |
|
110 { |
|
111 asm("mrs ip, cpsr "); |
|
112 asm("ldr r3, [r0, #0] "); |
|
113 asm("orr r2, ip, #0xc0 "); |
|
114 asm("msr cpsr, r2 "); |
|
115 asm("strb r1, [r0, #6] "); |
|
116 asm("strb r1, [r3, #%a0]" : : "i" ((TInt)K16550MCROffset)); |
|
117 asm("msr cpsr, ip "); |
|
118 __JUMP(,lr); |
|
119 } |
|
120 |
|
121 __NAKED__ void T16550Uart::SetIER(TUint /*aValue*/) |
|
122 { |
|
123 asm("mrs ip, cpsr "); |
|
124 asm("ldr r3, [r0, #0] "); |
|
125 asm("orr r2, ip, #0xc0 "); |
|
126 asm("msr cpsr, r2 "); |
|
127 asm("strb r1, [r0, #7] "); |
|
128 asm("strb r1, [r3, #%a0]" : : "i" ((TInt)K16550IEROffset)); |
|
129 asm("msr cpsr, ip "); |
|
130 __JUMP(,lr); |
|
131 } |