GNU ARM匯編--(十)s3c2440的RTC 作者: 時間:2016-11-26 來源:網(wǎng)絡(luò) 加入技術(shù)交流群 掃碼加入和技術(shù)大咖面對面交流海量資料庫查詢 收藏 ldrr3,=WTCONmovr4,#0x0strr4,[r3]@disablewatchdogldrr0,=GPBCONldrr1,=0x15400@這個時候暫不配置GPB0為TOUT0strr1,[r0]ldrr2,=GPBDATldrr1,=0x160strr1,[r2]blclock_setupbluart_initbldelaymsrcpsr_c,#0xd2@進(jìn)入中斷模式ldrsp,=3072@中斷模式的棧指針定義msrcpsr_c,#0xd3@進(jìn)入系統(tǒng)模式ldrsp,=4096@設(shè)置系統(tǒng)模式的棧指針@--------------------------------------------ldrr0,=GPBUPldrr1,=0x03f0strr1,[r0]ldrr0,=GPFCONldrr1,=0x2ea@0x2strr1,[r0]ldrr0,=EXTINT0@ldrr1,=0x8f888@0x0@0x8f888@~(7|(7<<4)|(7<<8)|(7<<16))//低電平觸發(fā)中斷ldrr1,=0xafaaa@0x0@0x8f888//下降沿觸發(fā)中斷strr1,[r0]ldrr0,=EINTPENDldrr1,=0xf0@0b10000strr1,[r0]ldrr0,=EINTMASKldrr1,=0x00@0b00000strr1,[r0]ldrr0,=SRCPNDldrr1,=0x3ff|(1<<30)@0x1@0b11111strr1,[r0]ldrr0,=SUBSRCPNDldrr1,=0x1<<13strr1,[r0]ldrr0,=INTPNDldrr1,=0x3ff|(1<<30)@0x1@0b11111strr1,[r0]ldrr0,=INTSUBMSKldrr1,=0x0<<13strr1,[r0]ldrr0,=INTMSKldrr1,=0x1ffff000@0b00000strr1,[r0]MRSr1,cpsrBICr1,r1,#0x80MSRcpsr_c,r1blmainirq:sublr,lr,#4stmfdsp!,{r0-r12,lr}blirq_isrldmfdsp!,{r0-r12,pc}^irq_isr:ldrr2,=GPBDATldrr1,=0x0e0strr1,[r2]ldrr3,=0xffffffdelay2:subr3,r3,#1cmpr3,#0x0bnedelay2//這上面的延時必須要,否則蜂鳴器的聲音有問題ldrr0,=EINTPENDldrr1,=0xf0strr1,[r0]ldrr0,=SRCPNDldrr1,=0x3ff|(1<<30)@0b11111strr1,[r0]ldrr0,=SUBSRCPNDldrr1,=0x1<<13strr1,[r0]ldrr0,=INTPNDldrr1,=0x3ff|(1<<30)@0b11111strr1,[r0]ldrr2,=GPBCONldrr1,[r2]ldrr1,[r1]//ldrr1,=0x15400bicr1,r1,#0x3orrr1,r1,#0x2strr1,[r2]ldrr2,=GPBDATldrr1,=0x1a0strr1,[r2]ldrr1,=TCFG0ldrr2,=(Prescaler0<<0)strr2,[r1]ldrr1,=TCFG1ldrr2,=(DMA_MODE<<20)|(MUX0<<0)strr2,[r1]//ldrr3,[r0]//strr3,[r2]//movr2,r0ldrr1,=TCNTB0ldrr2,=10strr2,[r1]//r0就是c調(diào)用匯編的傳遞參數(shù)//movr0,r0,LSR#2ldrr1,=TCMPB0ldrr2,=2strr2,[r1]ldrr1,=TCONldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(start<<0)strr2,[r1]ldrr1,=TCONldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(clear_man_update<<1)|(start<<0)strr2,[r1]ldrr2,=GPBDATldrr1,=0x1a0strr1,[r2]movpc,lrdelay:ldrr3,=0xffffffdelay1:subr3,r3,#1cmpr3,#0x0bnedelay1movpc,lrclock_setup:ldrr0,=LOCKTIMEldrr1,=0xffffffffstrr1,[r0]ldrr0,=CLKDIVNldrr1,=(DIVN_UPLL<<3)|(HDIVN<<1)|(PDIVN<<0)strr1,[r0]ldrr0,=UPLLCONldrr1,=(U_MDIV<<12)|(U_PDIV<<4)|(U_SDIV<<0)@Fin=12MUPLL=48Mstrr1,[r0]nopnopnopnopnopnopnopldrr0,=MPLLCONldrr1,=(M_MDIV<<12)|(M_PDIV<<4)|(M_SDIV<<0)@Fin=12MFCLK=400Mstrr1,[r0]movpc,lruart_init:ldrr0,=GPHCONldrr1,=0x2aaaa@配置GPIO復(fù)用規(guī)則為串口strr1,[r0]ldrr0,=ULCON0ldrr1,=(IR_MODE<<6)|(Parity_Mode<<3)|(Num_of_stop_bit<<2)|(Word_length<<0)@strr1,[r0]ldrr0,=UCON0ldrr1,=(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,=UFCON0ldrr1,=(Tx_FIFO_Trig_Level<<6)|(Rx_FIFO_Trig_Level<<4)|(Tx_FIFO_Reset<<2)|(Rx_FIFO_Reset<<1)|(FIFO_Enable<<0)@strr1,[r0]ldrr0,=UBRDIV0ldrr1,=(UBRDIV<<0)strr1,[r0]movpc,lr/*Buzzer_Freq_Set://ldrr0,=GPBCON//ldrr1,=0x15400@這個時候暫不配置GPB0為TOUT0,這時候只是配置GPB0為TOUT0//strr1,[r0]ldrr2,=GPBCONldrr1,[r2]ldrr1,[r1]//ldrr1,=0x15400bicr1,r1,#0x3orrr1,r1,#0x2strr1,[r2]ldrr2,=GPBDATldrr1,=0x1a0strr1,[r2]ldrr1,=TCFG0ldrr2,=(Prescaler0<<0)strr2,[r1]ldrr1,=TCFG1ldrr2,=(DMA_MODE<<20)|(MUX0<<0)strr2,[r1]//ldrr3,[r0]//strr3,[r2]//movr2,r0ldrr1,=TCNTB0ldrr2,=10strr2,[r1]//r0就是c調(diào)用匯編的傳遞參數(shù)//movr0,r0,LSR#2ldrr1,=TCMPB0ldrr2,=2strr2,[r1]ldrr1,=TCONldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(start<<0)strr2,[r1]ldrr1,=TCONldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(clear_man_update<<1)|(start<<0)strr2,[r1]ldrr2,=GPBDATldrr1,=0x1a0strr1,[r2]movpc,lr*/main:ldrr2,=GPBDATldrr1,=0x1a0strr1,[r2]bldelay//ldrr1,=TCON//ldrr2,=(DZ_eable<<4)|(auto_reload<<3)|(inverter<<2)|(man_update<<1)|(stop<<0)//strr2,[r1]/*ldrr2,=GPBCONldrr1,[r2]ldrr1,[r1]//ldrr1,=0x15400bicr1,r1,#0x3orrr1,r1,#0x2strr1,[r2] 上一頁 1 2 3 下一頁
評論