新聞中心

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

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

作者: 時間:2016-11-26 來源:網(wǎng)絡(luò) 收藏
  • ldrr3,=WTCON
  • movr4,#0x0
  • strr4,[r3]@disablewatchdog
  • ldrr0,=GPBCON
  • ldrr1,=0x15400@這個時候暫不配置GPB0為TOUT0
  • strr1,[r0]
  • ldrr2,=GPBDAT
  • ldrr1,=0x160
  • strr1,[r2]
  • blclock_setup
  • bluart_init
  • bldelay
  • msrcpsr_c,#0xd2@進(jìn)入中斷模式
  • ldrsp,=3072@中斷模式的棧指針定義
  • msrcpsr_c,#0xd3@進(jìn)入系統(tǒng)模式
  • ldrsp,=4096@設(shè)置系統(tǒng)模式的棧指針
  • @--------------------------------------------
  • ldrr0,=GPBUP
  • ldrr1,=0x03f0
  • strr1,[r0]
  • ldrr0,=GPFCON
  • ldrr1,=0x2ea@0x2
  • strr1,[r0]
  • ldrr0,=EXTINT0
  • @ldrr1,=0x8f888@0x0@0x8f888@~(7|(7<<4)|(7<<8)|(7<<16))//低電平觸發(fā)中斷
  • ldrr1,=0xafaaa@0x0@0x8f888//下降沿觸發(fā)中斷
  • strr1,[r0]
  • ldrr0,=EINTPEND
  • ldrr1,=0xf0@0b10000
  • strr1,[r0]
  • ldrr0,=EINTMASK
  • ldrr1,=0x00@0b00000
  • strr1,[r0]
  • ldrr0,=SRCPND
  • ldrr1,=0x3ff|(1<<30)@0x1@0b11111
  • strr1,[r0]
  • ldrr0,=SUBSRCPND
  • ldrr1,=0x1<<13
  • strr1,[r0]
  • ldrr0,=INTPND
  • ldrr1,=0x3ff|(1<<30)@0x1@0b11111
  • strr1,[r0]
  • ldrr0,=INTSUBMSK
  • ldrr1,=0x0<<13
  • strr1,[r0]
  • ldrr0,=INTMSK
  • ldrr1,=0x1ffff000@0b00000
  • strr1,[r0]
  • MRSr1,cpsr
  • BICr1,r1,#0x80
  • MSRcpsr_c,r1
  • blmain
  • irq:
  • sublr,lr,#4
  • stmfdsp!,{r0-r12,lr}
  • blirq_isr
  • ldmfdsp!,{r0-r12,pc}^
  • irq_isr:
  • ldrr2,=GPBDAT
  • ldrr1,=0x0e0
  • strr1,[r2]
  • ldrr3,=0xffffff
  • delay2:
  • subr3,r3,#1
  • cmpr3,#0x0
  • bnedelay2
  • //這上面的延時必須要,否則蜂鳴器的聲音有問題
  • ldrr0,=EINTPEND
  • ldrr1,=0xf0
  • strr1,[r0]
  • ldrr0,=SRCPND
  • ldrr1,=0x3ff|(1<<30)@0b11111
  • strr1,[r0]
  • ldrr0,=SUBSRCPND
  • ldrr1,=0x1<<13
  • strr1,[r0]
  • ldrr0,=INTPND
  • ldrr1,=0x3ff|(1<<30)@0b11111
  • strr1,[r0]
  • ldrr2,=GPBCON
  • ldrr1,[r2]
  • ldrr1,[r1]
  • //ldrr1,=0x15400
  • bicr1,r1,#0x3
  • orrr1,r1,#0x2
  • strr1,[r2]
  • ldrr2,=GPBDAT
  • ldrr1,=0x1a0
  • strr1,[r2]
  • ldrr1,=TCFG0
  • ldrr2,=(Prescaler0<<0)
  • strr2,[r1]
  • ldrr1,=TCFG1
  • ldrr2,=(DMA_MODE<<20)|(MUX0<<0)
  • strr2,[r1]
  • //ldrr3,[r0]
  • //strr3,[r2]
  • //movr2,r0
  • ldrr1,=TCNTB0
  • ldrr2,=10
  • strr2,[r1]//r0就是c調(diào)用匯編的傳遞參數(shù)
  • //movr0,r0,LSR#2
  • ldrr1,=TCMPB0
  • ldrr2,=2
  • strr2,[r1]
  • ldrr1,=TCON
  • ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(start<<0)
  • strr2,[r1]
  • ldrr1,=TCON
  • ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(clear_man_update<<1)|(start<<0)
  • strr2,[r1]
  • ldrr2,=GPBDAT
  • ldrr1,=0x1a0
  • strr1,[r2]
  • movpc,lr
  • delay:
  • ldrr3,=0xffffff
  • delay1:
  • subr3,r3,#1
  • cmpr3,#0x0
  • bnedelay1
  • movpc,lr
  • clock_setup:
  • ldrr0,=LOCKTIME
  • ldrr1,=0xffffffff
  • strr1,[r0]
  • ldrr0,=CLKDIVN
  • ldrr1,=(DIVN_UPLL<<3)|(HDIVN<<1)|(PDIVN<<0)
  • strr1,[r0]
  • ldrr0,=UPLLCON
  • ldrr1,=(U_MDIV<<12)|(U_PDIV<<4)|(U_SDIV<<0)@Fin=12MUPLL=48M
  • strr1,[r0]
  • nop
  • nop
  • nop
  • nop
  • nop
  • nop
  • nop
  • ldrr0,=MPLLCON
  • ldrr1,=(M_MDIV<<12)|(M_PDIV<<4)|(M_SDIV<<0)@Fin=12MFCLK=400M
  • strr1,[r0]
  • movpc,lr
  • uart_init:
  • ldrr0,=GPHCON
  • ldrr1,=0x2aaaa@配置GPIO復(fù)用規(guī)則為串口
  • strr1,[r0]
  • ldrr0,=ULCON0
  • ldrr1,=(IR_MODE<<6)|(Parity_Mode<<3)|(Num_of_stop_bit<<2)|(Word_length<<0)@
  • strr1,[r0]
  • ldrr0,=UCON0
  • 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)
  • strr1,[r0]
  • ldrr0,=UFCON0
  • ldrr1,=(Tx_FIFO_Trig_Level<<6)|(Rx_FIFO_Trig_Level<<4)|(Tx_FIFO_Reset<<2)|(Rx_FIFO_Reset<<1)|(FIFO_Enable<<0)@
  • strr1,[r0]
  • ldrr0,=UBRDIV0
  • ldrr1,=(UBRDIV<<0)
  • strr1,[r0]
  • movpc,lr
  • /*
  • Buzzer_Freq_Set:
  • //ldrr0,=GPBCON
  • //ldrr1,=0x15400@這個時候暫不配置GPB0為TOUT0,這時候只是配置GPB0為TOUT0
  • //strr1,[r0]
  • ldrr2,=GPBCON
  • ldrr1,[r2]
  • ldrr1,[r1]
  • //ldrr1,=0x15400
  • bicr1,r1,#0x3
  • orrr1,r1,#0x2
  • strr1,[r2]
  • ldrr2,=GPBDAT
  • ldrr1,=0x1a0
  • strr1,[r2]
  • ldrr1,=TCFG0
  • ldrr2,=(Prescaler0<<0)
  • strr2,[r1]
  • ldrr1,=TCFG1
  • ldrr2,=(DMA_MODE<<20)|(MUX0<<0)
  • strr2,[r1]
  • //ldrr3,[r0]
  • //strr3,[r2]
  • //movr2,r0
  • ldrr1,=TCNTB0
  • ldrr2,=10
  • strr2,[r1]//r0就是c調(diào)用匯編的傳遞參數(shù)
  • //movr0,r0,LSR#2
  • ldrr1,=TCMPB0
  • ldrr2,=2
  • strr2,[r1]
  • ldrr1,=TCON
  • ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(start<<0)
  • strr2,[r1]
  • ldrr1,=TCON
  • ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(clear_man_update<<1)|(start<<0)
  • strr2,[r1]
  • ldrr2,=GPBDAT
  • ldrr1,=0x1a0
  • strr1,[r2]
  • movpc,lr
  • */
  • main:
  • ldrr2,=GPBDAT
  • ldrr1,=0x1a0
  • strr1,[r2]
  • bldelay
  • //ldrr1,=TCON
  • //ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(stop<<0)
  • //strr2,[r1]
  • /*
  • ldrr2,=GPBCON
  • ldrr1,[r2]
  • ldrr1,[r1]
  • //ldrr1,=0x15400
  • bicr1,r1,#0x3
  • orrr1,r1,#0x2
  • strr1,[r2]


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

    評論


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

    關(guān)閉