⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2442lib.txt

📁 S3C2442的起动代码程序等。有较大的实用价值
💻 TXT
📖 第 1 页 / 共 3 页
字号:
; generated by ARM C Compiler, ADS1.2 [Build 805]

; commandline [-errors .\err\2442lib.err -O2 -asm -cpu ARM920T -fs -DCOREVOLT_M100=130 -DOS_START_ADDR_OFFSET=0x02040000 "-IC:\Program Files\ARM\ADSv1_2\INCLUDE"]
                          CODE32

                          AREA ||.text||, CODE, READONLY

                  Delay PROC
;;;30     void Delay(int time)
;;;31     {
                  |L1.0|
000000  e3a00000          MOV      r0,#0
;;;32           // time=0: adjust the Delay function by WatchDog timer.
;;;33           // time>0: the number of loop time
;;;34           // resolution of time is 100us.
;;;35         int i,adjust=0;
;;;36          for(i=0; i<1000; i++);
                  |L1.4|
000004  e2800001          ADD      r0,r0,#1
000008  e3500ffa          CMP      r0,#0x3e8
00000c  bafffffc          BLT      |L1.4|
000010  e1a0f00e          MOV      pc,lr
;;;37     /*
;;;38         if(time==0)
;;;39         {
;;;40             time   = 200;
;;;41             adjust = 1;
;;;42             delayLoopCount = 400;
;;;43                 //PCLK/1M,Watch-dog disable,1/64,interrupt disable,reset disable
;;;44             rWTCON = ((PCLK/1000000-1)<<8)|(2<<3); 
;;;45             rWTDAT = 0xffff;                              //for first update
;;;46             rWTCNT = 0xffff;                              //resolution=64us @any PCLK 
;;;47             rWTCON = ((PCLK/1000000-1)<<8)|(2<<3)|(1<<5); //Watch-dog timer start
;;;48         }
;;;49         for(;time>0;time--)
;;;50             for(i=0;i<delayLoopCount;i++);
;;;51         if(adjust==1)
;;;52         {
;;;53             rWTCON = ((PCLK/1000000-1)<<8)|(2<<3); //Watch-dog timer stop
;;;54             i = 0xffff - rWTCNT;                     //1count->64us, 200*400 cycle runtime = 64*i us
;;;55             delayLoopCount = 8000000/(i*64);         //200*400:64*i=1*x:100 -> x=80000*100/(64*i)   
;;;56         }
;;;57         */
;;;58     }
                          ENDP

                  Port_Init PROC
;;;61     void Port_Init(void)
;;;62     {
000014  e59f13cc          LDR      r1,|L1.1000|
;;;63         //CAUTION:Follow the configuration order for setting the ports. 
;;;64         // 1) setting value(GPnDAT) 
;;;65         // 2) setting control register  (GPnCON)
;;;66         // 3) configure pull-up resistor(GPnUP)  
;;;67     
;;;68         //32bit data bus configuration  
;;;69         //*** PORT A GROUP
;;;70         //Ports  : GPA22 GPA21  GPA20 GPA19 GPA18 GPA17 GPA16 GPA15 GPA14 GPA13 GPA12  
;;;71         //Signal : nFCE nRSTOUT nFRE   nFWE  ALE   CLE  nGCS5 nGCS4 nGCS3 nGCS2 nGCS1 
;;;72         //Binary :  1     1      1  , 1   1   1    1   ,  1     1     1     1
;;;73         //Ports  : GPA11   GPA10  GPA9   GPA8   GPA7   GPA6   GPA5   GPA4   GPA3   GPA2   GPA1  GPA0
;;;74         //Signal : ADDR26 ADDR25 ADDR24 ADDR23 ADDR22 ADDR21 ADDR20 ADDR19 ADDR18 ADDR17 ADDR16 ADDR0 
;;;75         //Binary :  1       1      1      1   , 1       1      1      1   ,  1       1     1      1         
;;;76         rGPACON = 0x7fffff; 
000018  e3a00456          MOV      r0,#0x56000000
00001c  e5801000          STR      r1,[r0,#0]
;;;77     
;;;78         //**** PORT B GROUP
;;;79         //Ports  : GPB10    GPB9    GPB8    GPB7    GPB6     GPB5    GPB4   GPB3   GPB2     GPB1      GPB0
;;;80         //Signal : nXDREQ0 nXDACK0 nXDREQ1 nXDACK1 nSS_KBD nDIS_OFF L3CLOCK L3DATA L3MODE nIrDATXDEN Keyboard
;;;81         //Setting: INPUT  OUTPUT   INPUT  OUTPUT   INPUT   OUTPUT   OUTPUT OUTPUT OUTPUT   OUTPUT    OUTPUT 
;;;82         //Binary :   00  ,  01       00  ,   01      00   ,  01       01  ,   01     01   ,  01        01  
;;;83      //   rGPBCON = 0x044555;
;;;84      //   rGPBUP  = 0x7ff;     // The pull up function is disabled GPB[10:0]
;;;85     
;;;86         //*** PORT C GROUP
;;;87         //Ports  : GPC15 GPC14 GPC13 GPC12 GPC11 GPC10 GPC9 GPC8  GPC7   GPC6   GPC5 GPC4 GPC3  GPC2  GPC1 GPC0
;;;88         //Signal : VD7   VD6   VD5   VD4   VD3   VD2   VD1  VD0 LCDVF2 LCDVF1 LCDVF0 VM VFRAME VLINE VCLK LEND  
;;;89         //Binary :  10   10  , 10    10  , 10    10  , 10   10  , 10     10  ,  10   10 , 10     10 , 10   10
;;;90         rGPCCON = 0xaaaaaaaa;       
000020  e59f23c4          LDR      r2,|L1.1004|
000024  e5802020          STR      r2,[r0,#0x20]
;;;91         rGPCUP  = 0xffff;     // The pull up function is disabled GPC[15:0] 
000028  e1a013c1          MOV      r1,r1,ASR #7
00002c  e5801028          STR      r1,[r0,#0x28]
;;;92     
;;;93         //*** PORT D GROUP
;;;94         //Ports  : GPD15 GPD14 GPD13 GPD12 GPD11 GPD10 GPD9 GPD8 GPD7 GPD6 GPD5 GPD4 GPD3 GPD2 GPD1 GPD0
;;;95         //Signal : VD23  VD22  VD21  VD20  VD19  VD18  VD17 VD16 VD15 VD14 VD13 VD12 VD11 VD10 VD9  VD8
;;;96         //Binary : 10    10  , 10    10  , 10    10  , 10   10 , 10   10 , 10   10 , 10   10 ,10   10
;;;97         rGPDCON = 0xaaaaaaaa;       
000030  e5802030          STR      r2,[r0,#0x30]
;;;98         rGPDUP  = 0xffff;     // The pull up function is disabled GPD[15:0]
000034  e5801038          STR      r1,[r0,#0x38]
;;;99     
;;;100        //*** PORT E GROUP
;;;101        //Ports  : GPE15  GPE14 GPE13   GPE12   GPE11   GPE10   GPE9    GPE8     GPE7  GPE6  GPE5   GPE4  
;;;102        //Signal : IICSDA IICSCL SPICLK SPIMOSI SPIMISO SDDATA3 SDDATA2 SDDATA1 SDDATA0 SDCMD SDCLK I2SSDO 
;;;103        //Binary :  10     10  ,  10      10  ,  10      10   ,  10      10   ,   10    10  , 10     10  ,     
;;;104        //-------------------------------------------------------------------------------------------------------
;;;105        //Ports  :  GPE3   GPE2  GPE1    GPE0    
;;;106        //Signal : I2SSDI CDCLK I2SSCLK I2SLRCK     
;;;107        //Binary :  10     10  ,  10      10 
;;;108        rGPECON = 0xaaaaaaaa;       
000038  e5802040          STR      r2,[r0,#0x40]
;;;109        rGPEUP  = 0xffff;     // The pull up function is disabled GPE[15:0]
00003c  e5801048          STR      r1,[r0,#0x48]
;;;110    
;;;111    	
;;;112        //*** PORT F GROUP
;;;113        //Ports  : GPF7   GPF6   GPF5   GPF4      GPF3     GPF2  GPF1   GPF0
;;;114        //Signal : nLED_8 nLED_4 nLED_2 nLED_1 nIRQ_PCMCIA EINT2 KBDINT EINT0
;;;115        //Setting: Output Output Output Output    EINT3    EINT2 EINT1  EINT0
;;;116        //Binary :  01      01 ,  01     01  ,     10       10  , 10     10
;;;117        rGPFCON = 0x55aa;
000040  e59f23a8          LDR      r2,|L1.1008|
000044  e5802050          STR      r2,[r0,#0x50]
;;;118        rGPFUP  = 0xff;     // The pull up function is disabled GPF[7:0]
000048  e3a020ff          MOV      r2,#0xff
00004c  e5802058          STR      r2,[r0,#0x58]
;;;119    
;;;120        //*** PORT G GROUP
;;;121        //Ports  : GPG15 GPG14 GPG13 GPG12 GPG11    GPG10    GPG9     GPG8     GPG7      GPG6    
;;;122        //Signal : nYPON  YMON nXPON XMON  EINT19 DMAMODE1 DMAMODE0 DMASTART KBDSPICLK KBDSPIMOSI
;;;123        //Setting: nYPON  YMON nXPON XMON  EINT19  Output   Output   Output   SPICLK1    SPIMOSI1
;;;124        //Binary :   11    11 , 11    11  , 10      01    ,   01       01   ,    11         11
;;;125        //-----------------------------------------------------------------------------------------
;;;126        //Ports  :    GPG5       GPG4    GPG3    GPG2    GPG1    GPG0    
;;;127        //Signal : KBDSPIMISO LCD_PWREN EINT11 nSS_SPI IRQ_LAN IRQ_PCMCIA
;;;128        //Setting:  SPIMISO1  LCD_PWRDN EINT11   nSS0   EINT9    EINT8
;;;129        //Binary :     11         11   ,  10      11  ,  10        10
;;;130        rGPGCON = 0xff95ffba;
000050  e59f239c          LDR      r2,|L1.1012|
000054  e5802060          STR      r2,[r0,#0x60]
;;;131        rGPGUP  = 0xffff;    // The pull up function is disabled GPG[15:0]
000058  e5801068          STR      r1,[r0,#0x68]
;;;132    
;;;133        //*** PORT H GROUP
;;;134        //Ports  :  GPH10    GPH9  GPH8 GPH7  GPH6  GPH5 GPH4 GPH3 GPH2 GPH1  GPH0 
;;;135        //Signal : 	INPUT 	INPUT  UCLK nCTS1 nRTS1 RXD1 TXD1 RXD0 TXD0 nRTS0 nCTS0
;;;136        //Binary :   00   ,  00     10 , 11    11  , 10   10 , 10   10 , 10    10
;;;137        rGPHCON = 0x02faaa;
00005c  e59f1394          LDR      r1,|L1.1016|
000060  e5801070          STR      r1,[r0,#0x70]
;;;138        rGPHUP  = 0x7ff;    // The pull up function is disabled GPH[10:0]
000064  e59f1390          LDR      r1,|L1.1020|
000068  e5801078          STR      r1,[r0,#0x78]
;;;139    
;;;140    	// Added for S3C2442X, DonGo
;;;141    	//PORT J GROUP
;;;142    	//Ports	:  GPJ12    GPJ11     GPJ10	  GPJ9  GPJ8      GPJ7	GPJ6  GPJ5	GPJ4  GPJ3  GPJ2  GPJ1  GPJ0
;;;143    	//Signal : CAMRESET CAMCLKOUT CAMHREF CAMVS CAMPCLKIN CAMD7 CAMD6 CAMD5 CAMD4 CAMD3 CAMD2 CAMD1 CAMD0
;;;144    	//Setting: Out      Out      CAMHREF CAMVS CAMPCLKIN CAMD7 CAMD6 CAMD5 CAMD4 CAMD3 CAMD2 CAMD1 CAMD0
;;;145    	//Binary : 01	    01        10      10    10        10    10    10    10    10    10    10    10
;;;146    	//PU_OFF : 1	    0 		 1	      1     1         1     1     1		1	  1     1     1     1
;;;147    	//---------------------------------------------------------------------------------------
;;;148    	rGPJDAT = (1<<12)|(0<<11);
00006c  e3a01d40          MOV      r1,#0x1000
000070  e58010d4          STR      r1,[r0,#0xd4]
;;;149    	rGPJCON = 0x016aaaa;
000074  e59f1384          LDR      r1,|L1.1024|
000078  e58010d0          STR      r1,[r0,#0xd0]
;;;150    	rGPJUP	= ~((0<<12)|(1<<11));
00007c  e3e02e80          MVN      r2,#0x800
000080  e58020d8          STR      r2,[r0,#0xd8]
;;;151    
;;;152    	rGPJDAT = (0<<12)|(0<<11);
000084  e3a02000          MOV      r2,#0
000088  e58020d4          STR      r2,[r0,#0xd4]
;;;153    	rGPJCON = 0x016aaaa;
00008c  e58010d0          STR      r1,[r0,#0xd0]
;;;154    	rGPJUP	= 0x1fff;//~((1<<12)|(1<<11));
000090  e59f136c          LDR      r1,|L1.1028|
000094  e58010d8          STR      r1,[r0,#0xd8]
;;;155    
;;;156    	
;;;157    	//rGPJCON = 0x02aaaaaa;
;;;158    	//rGPJUP  = 0x1fff;    // The pull up function is disabled GPH[10:0]
;;;159    
;;;160        //External interrupt will be falling edge triggered. 
;;;161        rEXTINT0 = 0x22222222;    // EINT[7:0]
000098  e59f1368          LDR      r1,|L1.1032|
00009c  e5801088          STR      r1,[r0,#0x88]
;;;162        rEXTINT1 = 0x22222222;    // EINT[15:8]
0000a0  e580108c          STR      r1,[r0,#0x8c]
;;;163        rEXTINT2 = 0x22222222;    // EINT[23:16]
0000a4  e5801090          STR      r1,[r0,#0x90]
;;;164    }
0000a8  e1a0f00e          MOV      pc,lr
                          ENDP

                  Uart_Init PROC
;;;169    void Uart_Init(int pclk,int baud)
;;;170    {
0000ac  e52de004          STR      lr,[sp,#-4]!
;;;171        #define Baudrate (PCLK/16./115200+0.5) 
;;;172    
;;;173        int i;
;;;174        if(pclk == 0)
;;;175        pclk    = PCLK;
;;;176        rUFCON0 = 0x0;   //UART channel 0 FIFO control register, FIFO disable
0000b0  e3a03000          MOV      r3,#0
0000b4  e3a00450          MOV      r0,#0x50000000
0000b8  e5803008          STR      r3,[r0,#8]
;;;177        rUFCON1 = 0x0;   //UART channel 1 FIFO control register, FIFO disable
0000bc  e2801c40          ADD      r1,r0,#0x4000
0000c0  e5813008          STR      r3,[r1,#8]
;;;178        rUFCON2 = 0x0;   //UART channel 2 FIFO control register, FIFO disable
0000c4  e2802c80          ADD      r2,r0,#0x8000
0000c8  e5823008          STR      r3,[r2,#8]
;;;179        rUMCON0 = 0x0;   //UART chaneel 0 MODEM control register, AFC disable
0000cc  e580300c          STR      r3,[r0,#0xc]
;;;180        rUMCON1 = 0x0;   //UART chaneel 1 MODEM control register, AFC disable
0000d0  e581300c          STR      r3,[r1,#0xc]
;;;181    //UART0
;;;182        rULCON0 = 0x3;   //Line control register : Normal,No parity,1 stop,8 bits
0000d4  e3a03003          MOV      r3,#3
0000d8  e5803000          STR      r3,[r0,#0]
;;;183         //    [10]       [9]     [8]        [7]        [6]      [5]         [4]           [3:2]        [1:0]
;;;184         // Clock Sel,  Tx Int,  Rx Int, Rx Time Out, Rx err, Loop-back, Send break,  Transmit Mode, Receive Mode
;;;185         //     0          1       0    ,     0          1        0           0     ,       01          01
;;;186         //   PCLK       Level    Pulse    Disable    Generate  Normal      Normal        Interrupt or Polling
;;;187        rUCON0  = 0x245;   // Control register
0000dc  e59fc328          LDR      r12,|L1.1036|
0000e0  e580c004          STR      r12,[r0,#4]
;;;188        rUBRDIV0=( (int)(Baudrate) -1 );   //Baud rate divisior register 0
0000e4  e3a0e01a          MOV      lr,#0x1a
0000e8  e580e028          STR      lr,[r0,#0x28]
;;;189    //UART1
;;;190    
;;;191        rULCON1 = 0x3;
0000ec  e5813000          STR      r3,[r1,#0]
;;;192        rUCON1  = 0x245;
0000f0  e581c004          STR      r12,[r1,#4]
;;;193        rUBRDIV1=( (int)(Baudrate) -1 );
0000f4  e581e028          STR      lr,[r1,#0x28]
;;;194    	//rUBRDIV1=( (int)(pclk/16./baud+0.5) -1 );
;;;195    //UART2
;;;196        rULCON2 = 0x3;
0000f8  e5823000          STR      r3,[r2,#0]
;;;197        rUCON2  = 0x245;
0000fc  e582c004          STR      r12,[r2,#4]
;;;198        rUBRDIV2=( (int)(Baudrate) -1 );
000100  e582e028          STR      lr,[r2,#0x28]
;;;199    	//rUBRDIV2=( (int)(pclk/16./baud+0.5) -1 );    
;;;200    
;;;201        for(i=0;i<100;i++);
000104  e3a00000          MOV      r0,#0
                  |L1.264|
000108  e2800001          ADD      r0,r0,#1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -