色婷婷AⅤ一区二区三区|亚洲精品第一国产综合亚AV|久久精品官方网视频|日本28视频香蕉

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > GNU ARM匯編--(十)s3c2440的RTC

          GNU ARM匯編--(十)s3c2440的RTC

          作者: 時間:2016-11-26 來源:網(wǎng)絡(luò) 收藏
        1. ldrr3,=WTCON
        2. movr4,#0x0
        3. strr4,[r3]@disablewatchdog
        4. ldrr0,=GPBCON
        5. ldrr1,=0x15400@這個時候暫不配置GPB0為TOUT0
        6. strr1,[r0]
        7. ldrr2,=GPBDAT
        8. ldrr1,=0x160
        9. strr1,[r2]
        10. blclock_setup
        11. bluart_init
        12. bldelay
        13. msrcpsr_c,#0xd2@進入中斷模式
        14. ldrsp,=3072@中斷模式的棧指針定義
        15. msrcpsr_c,#0xd3@進入系統(tǒng)模式
        16. ldrsp,=4096@設(shè)置系統(tǒng)模式的棧指針
        17. @--------------------------------------------
        18. ldrr0,=GPBUP
        19. ldrr1,=0x03f0
        20. strr1,[r0]
        21. ldrr0,=GPFCON
        22. ldrr1,=0x2ea@0x2
        23. strr1,[r0]
        24. ldrr0,=EXTINT0
        25. @ldrr1,=0x8f888@0x0@0x8f888@~(7|(7<<4)|(7<<8)|(7<<16))//低電平觸發(fā)中斷
        26. ldrr1,=0xafaaa@0x0@0x8f888//下降沿觸發(fā)中斷
        27. strr1,[r0]
        28. ldrr0,=EINTPEND
        29. ldrr1,=0xf0@0b10000
        30. strr1,[r0]
        31. ldrr0,=EINTMASK
        32. ldrr1,=0x00@0b00000
        33. strr1,[r0]
        34. ldrr0,=SRCPND
        35. ldrr1,=0x3ff|(1<<30)@0x1@0b11111
        36. strr1,[r0]
        37. ldrr0,=SUBSRCPND
        38. ldrr1,=0x1<<13
        39. strr1,[r0]
        40. ldrr0,=INTPND
        41. ldrr1,=0x3ff|(1<<30)@0x1@0b11111
        42. strr1,[r0]
        43. ldrr0,=INTSUBMSK
        44. ldrr1,=0x0<<13
        45. strr1,[r0]
        46. ldrr0,=INTMSK
        47. ldrr1,=0x1ffff000@0b00000
        48. strr1,[r0]
        49. MRSr1,cpsr
        50. BICr1,r1,#0x80
        51. MSRcpsr_c,r1
        52. blmain
        53. irq:
        54. sublr,lr,#4
        55. stmfdsp!,{r0-r12,lr}
        56. blirq_isr
        57. ldmfdsp!,{r0-r12,pc}^
        58. irq_isr:
        59. ldrr2,=GPBDAT
        60. ldrr1,=0x0e0
        61. strr1,[r2]
        62. ldrr3,=0xffffff
        63. delay2:
        64. subr3,r3,#1
        65. cmpr3,#0x0
        66. bnedelay2
        67. //這上面的延時必須要,否則蜂鳴器的聲音有問題
        68. ldrr0,=EINTPEND
        69. ldrr1,=0xf0
        70. strr1,[r0]
        71. ldrr0,=SRCPND
        72. ldrr1,=0x3ff|(1<<30)@0b11111
        73. strr1,[r0]
        74. ldrr0,=SUBSRCPND
        75. ldrr1,=0x1<<13
        76. strr1,[r0]
        77. ldrr0,=INTPND
        78. ldrr1,=0x3ff|(1<<30)@0b11111
        79. strr1,[r0]
        80. ldrr2,=GPBCON
        81. ldrr1,[r2]
        82. ldrr1,[r1]
        83. //ldrr1,=0x15400
        84. bicr1,r1,#0x3
        85. orrr1,r1,#0x2
        86. strr1,[r2]
        87. ldrr2,=GPBDAT
        88. ldrr1,=0x1a0
        89. strr1,[r2]
        90. ldrr1,=TCFG0
        91. ldrr2,=(Prescaler0<<0)
        92. strr2,[r1]
        93. ldrr1,=TCFG1
        94. ldrr2,=(DMA_MODE<<20)|(MUX0<<0)
        95. strr2,[r1]
        96. //ldrr3,[r0]
        97. //strr3,[r2]
        98. //movr2,r0
        99. ldrr1,=TCNTB0
        100. ldrr2,=10
        101. strr2,[r1]//r0就是c調(diào)用匯編的傳遞參數(shù)
        102. //movr0,r0,LSR#2
        103. ldrr1,=TCMPB0
        104. ldrr2,=2
        105. strr2,[r1]
        106. ldrr1,=TCON
        107. ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(start<<0)
        108. strr2,[r1]
        109. ldrr1,=TCON
        110. ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(clear_man_update<<1)|(start<<0)
        111. strr2,[r1]
        112. ldrr2,=GPBDAT
        113. ldrr1,=0x1a0
        114. strr1,[r2]
        115. movpc,lr
        116. delay:
        117. ldrr3,=0xffffff
        118. delay1:
        119. subr3,r3,#1
        120. cmpr3,#0x0
        121. bnedelay1
        122. movpc,lr
        123. clock_setup:
        124. ldrr0,=LOCKTIME
        125. ldrr1,=0xffffffff
        126. strr1,[r0]
        127. ldrr0,=CLKDIVN
        128. ldrr1,=(DIVN_UPLL<<3)|(HDIVN<<1)|(PDIVN<<0)
        129. strr1,[r0]
        130. ldrr0,=UPLLCON
        131. ldrr1,=(U_MDIV<<12)|(U_PDIV<<4)|(U_SDIV<<0)@Fin=12MUPLL=48M
        132. strr1,[r0]
        133. nop
        134. nop
        135. nop
        136. nop
        137. nop
        138. nop
        139. nop
        140. ldrr0,=MPLLCON
        141. ldrr1,=(M_MDIV<<12)|(M_PDIV<<4)|(M_SDIV<<0)@Fin=12MFCLK=400M
        142. strr1,[r0]
        143. movpc,lr
        144. uart_init:
        145. ldrr0,=GPHCON
        146. ldrr1,=0x2aaaa@配置GPIO復(fù)用規(guī)則為串口
        147. strr1,[r0]
        148. ldrr0,=ULCON0
        149. ldrr1,=(IR_MODE<<6)|(Parity_Mode<<3)|(Num_of_stop_bit<<2)|(Word_length<<0)@
        150. strr1,[r0]
        151. ldrr0,=UCON0
        152. ldrr1,=(FCLK_Div<<12)|(Clk_select<<10)|(Tx_Int_Type<<9)|(Rx_Int_Type<<8)|(Rx_Timeout<<7)|(Rx_Error_Stat_Int<<6)|(Loopback_Mode<<5)|(Break_Sig<<4)|(Tx_Mode<<2)|(Rx_Mode<<0)
        153. strr1,[r0]
        154. ldrr0,=UFCON0
        155. ldrr1,=(Tx_FIFO_Trig_Level<<6)|(Rx_FIFO_Trig_Level<<4)|(Tx_FIFO_Reset<<2)|(Rx_FIFO_Reset<<1)|(FIFO_Enable<<0)@
        156. strr1,[r0]
        157. ldrr0,=UBRDIV0
        158. ldrr1,=(UBRDIV<<0)
        159. strr1,[r0]
        160. movpc,lr
        161. /*
        162. Buzzer_Freq_Set:
        163. //ldrr0,=GPBCON
        164. //ldrr1,=0x15400@這個時候暫不配置GPB0為TOUT0,這時候只是配置GPB0為TOUT0
        165. //strr1,[r0]
        166. ldrr2,=GPBCON
        167. ldrr1,[r2]
        168. ldrr1,[r1]
        169. //ldrr1,=0x15400
        170. bicr1,r1,#0x3
        171. orrr1,r1,#0x2
        172. strr1,[r2]
        173. ldrr2,=GPBDAT
        174. ldrr1,=0x1a0
        175. strr1,[r2]
        176. ldrr1,=TCFG0
        177. ldrr2,=(Prescaler0<<0)
        178. strr2,[r1]
        179. ldrr1,=TCFG1
        180. ldrr2,=(DMA_MODE<<20)|(MUX0<<0)
        181. strr2,[r1]
        182. //ldrr3,[r0]
        183. //strr3,[r2]
        184. //movr2,r0
        185. ldrr1,=TCNTB0
        186. ldrr2,=10
        187. strr2,[r1]//r0就是c調(diào)用匯編的傳遞參數(shù)
        188. //movr0,r0,LSR#2
        189. ldrr1,=TCMPB0
        190. ldrr2,=2
        191. strr2,[r1]
        192. ldrr1,=TCON
        193. ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(start<<0)
        194. strr2,[r1]
        195. ldrr1,=TCON
        196. ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(clear_man_update<<1)|(start<<0)
        197. strr2,[r1]
        198. ldrr2,=GPBDAT
        199. ldrr1,=0x1a0
        200. strr1,[r2]
        201. movpc,lr
        202. */
        203. main:
        204. ldrr2,=GPBDAT
        205. ldrr1,=0x1a0
        206. strr1,[r2]
        207. bldelay
        208. //ldrr1,=TCON
        209. //ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(stop<<0)
        210. //strr2,[r1]
        211. /*
        212. ldrr2,=GPBCON
        213. ldrr1,[r2]
        214. ldrr1,[r1]
        215. //ldrr1,=0x15400
        216. bicr1,r1,#0x3
        217. orrr1,r1,#0x2
        218. strr1,[r2]


          關(guān)鍵詞: ARM匯編s3c2440RT

          評論


          技術(shù)專區(qū)

          關(guān)閉