GNU ARM汇编--(十)s3c2440的RTC 作者: 时间:2016-11-26 来源:网络 收藏 ldrr3,=WTCONmovr4,#0x0strr4,[r3]@disablewatchdogldrr0,=GPBCONldrr1,=0x15400@这个时候暂不配置GPB0为TOUT0strr1,[r0]ldrr2,=GPBDATldrr1,=0x160strr1,[r2]blclock_setupbluart_initbldelaymsrcpsr_c,#0xd2@进入中断模式ldrsp,=3072@中断模式的栈指针定义msrcpsr_c,#0xd3@进入系统模式ldrsp,=4096@设置系统模式的栈指针@--------------------------------------------ldrr0,=GPBUPldrr1,=0x03f0strr1,[r0]ldrr0,=GPFCONldrr1,=0x2ea@0x2strr1,[r0]ldrr0,=EXTINT0@ldrr1,=0x8f888@0x0@0x8f888@~(7|(7<<4)|(7<<8)|(7<<16))//低电平触发中断ldrr1,=0xafaaa@0x0@0x8f888//下降沿触发中断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调用汇编的传递参数//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复用规则为串口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调用汇编的传递参数//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 下一页
评论