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

📄 main.lst

📁 rtc code for lpc2148
💻 LST
📖 第 1 页 / 共 2 页
字号:
   1              		.file	"main.c"
   9              	.Ltext0:
  10              		.global	time_toggle
  11              		.bss
  12              		.align	2
  15              	time_toggle:
  16 0000 00000000 		.space	4
  17              		.section	.rodata.str1.4,"aMS",%progbits,1
  18              		.align	2
  19              	.LC0:
  20 0000 0A0D5469 		.ascii	"\012\015Tic\015\012\000"
  20      630D0A00 
  21              		.align	2
  22              	.LC1:
  23 0008 0A0D5461 		.ascii	"\012\015Tac\015\012\000"
  23      630D0A00 
  24              		.text
  25              		.align	2
  27              	rtc0:
  28              	.LFB4:
  29              		.file 1 "main.c"
   1:main.c        **** /******************************************************************************
   2:main.c        ****  *
   3:main.c        ****  * WinARM RTC application
   4:main.c        ****  *
   5:main.c        ****  * - UART0 send in Interrupt-Mode
   6:main.c        ****  * - Sends message every seccond.
   7:main.c        ****  * - RTC interupt every second
   8:main.c        **** ******************************************************************************/
   9:main.c        ****  
  10:main.c        **** #include "types.h"
  11:main.c        **** #include "LPC214x.h"
  12:main.c        **** #include "config.h"
  13:main.c        **** #include "armVIC.h"
  14:main.c        **** #include "uart.h"
  15:main.c        **** 
  16:main.c        **** uint32_t time_toggle=0;
  17:main.c        **** /******************************************************************************
  18:main.c        ****  *
  19:main.c        ****  * Function Name: lowInit()
  20:main.c        ****  *
  21:main.c        ****  * Description:
  22:main.c        ****  *    This function starts up the PLL then sets up the GPIO pins before
  23:main.c        ****  *    waiting for the PLL to lock.  It finally engages the PLL and
  24:main.c        ****  *    returns
  25:main.c        ****  *
  26:main.c        ****  * Calling Sequence: 
  27:main.c        ****  *    void
  28:main.c        ****  *
  29:main.c        ****  * Returns:
  30:main.c        ****  *    void
  31:main.c        ****  *
  32:main.c        ****  *****************************************************************************/
  33:main.c        **** static void rtc0(void) __attribute__ ((interrupt ("IRQ")));
  34:main.c        **** static void lowInit(void)
  35:main.c        **** {
  36:main.c        **** 	// set PLL multiplier & divisor.
  37:main.c        **** 	// values computed from config.h
  38:main.c        **** 	PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL;
  39:main.c        **** 	
  40:main.c        **** 	// enable PLL
  41:main.c        **** 	PLLCON = PLLCON_PLLE;
  42:main.c        **** 	PLLFEED = 0xAA;                       // Make it happen.  These two updates
  43:main.c        **** 	PLLFEED = 0x55;                       // MUST occur in sequence.
  44:main.c        **** 	
  45:main.c        **** 	// setup the parallel port pin
  46:main.c        **** 	IO0CLR = PIO0_ZERO_BITS;                // clear the ZEROs output
  47:main.c        **** 	IO0SET = PIO0_ONE_BITS;                 // set the ONEs output
  48:main.c        **** 	IO0DIR = PIO0_OUTPUT_BITS;              // set the output bit direction
  49:main.c        **** 	
  50:main.c        **** 	IO1CLR = PIO1_ZERO_BITS;                // clear the ZEROs output
  51:main.c        **** 	IO1SET = PIO1_ONE_BITS;                 // set the ONEs output
  52:main.c        **** 	IO1DIR = PIO1_OUTPUT_BITS;              // set the output bit direction
  53:main.c        **** 	
  54:main.c        **** 	// wait for PLL lock
  55:main.c        **** 	while (!(PLLSTAT & PLLSTAT_LOCK))
  56:main.c        **** 		continue;
  57:main.c        **** 	
  58:main.c        **** 	// enable & connect PLL
  59:main.c        **** 	PLLCON = PLLCON_PLLE | PLLCON_PLLC;
  60:main.c        **** 	PLLFEED = 0xAA;                       // Make it happen.  These two updates
  61:main.c        **** 	PLLFEED = 0x55;                       // MUST occur in sequence.
  62:main.c        **** 	
  63:main.c        **** 	// setup & enable the MAM
  64:main.c        **** 	MAMTIM = MAMTIM_CYCLES;
  65:main.c        **** 	MAMCR = MAMCR_FULL;
  66:main.c        **** 	
  67:main.c        **** 	// set the peripheral bus speed
  68:main.c        **** 	// value computed from config.h
  69:main.c        **** 	VPBDIV = VPBDIV_VALUE;                // set the peripheral bus clock speed
  70:main.c        **** }
  71:main.c        **** 
  72:main.c        **** /******************************************************************************
  73:main.c        ****  *
  74:main.c        ****  * Function Name: sysInit()
  75:main.c        ****  *
  76:main.c        ****  * Description:
  77:main.c        ****  *    This function is responsible for initializing the program
  78:main.c        ****  *    specific hardware
  79:main.c        ****  *
  80:main.c        ****  * Calling Sequence: 
  81:main.c        ****  *    void
  82:main.c        ****  *
  83:main.c        ****  * Returns:
  84:main.c        ****  *    void
  85:main.c        ****  *
  86:main.c        ****  *****************************************************************************/
  87:main.c        **** static void sysInit(void)
  88:main.c        **** {
  89:main.c        **** 	lowInit();                            // setup clocks and processor port pins
  90:main.c        **** 	
  91:main.c        **** 	// set the interrupt controller defaults
  92:main.c        **** #if defined(RAM_RUN)
  93:main.c        **** 	MEMMAP = MEMMAP_SRAM;                 // map interrupt vectors space into SRAM
  94:main.c        **** #elif defined(ROM_RUN)
  95:main.c        **** 	MEMMAP = MEMMAP_FLASH;                // map interrupt vectors space into FLASH
  96:main.c        **** #else
  97:main.c        **** #error RUN_MODE not defined!
  98:main.c        **** #endif
  99:main.c        **** 
 100:main.c        **** 	VICIntEnClear = 0xFFFFFFFF;           // clear all interrupts
 101:main.c        **** 	VICIntSelect = 0x00000000;            // clear all FIQ selections
 102:main.c        **** 	
 103:main.c        **** 	
 104:main.c        **** 	
 105:main.c        **** 	VICDefVectAddr = (uint32_t)reset;     // point unvectored IRQs to reset()
 106:main.c        **** 	
 107:main.c        **** 	//  wdtInit();                            // initialize the watchdog timer
 108:main.c        **** 	initSysTime();                        // initialize the system timer
 109:main.c        **** 	
 110:main.c        **** 	uart0Init(UART_BAUD(HOST_BAUD), UART_8N1, UART_FIFO_8); // setup the UART
 111:main.c        **** 
 112:main.c        **** }
 113:main.c        **** /*************************************************************/
 114:main.c        **** void rtc0(void)
 115:main.c        **** {
  30              	rvice Routine.
  31              		@ args = 0, pretend = 0, frame = 0
  32              		@ frame_needed = 0, uses_anonymous_args = 0
  33              	.LVL0:
  34              		sub	lr, lr, #4
  35 0000 04E04EE2 		stmfd	sp!, {r0, r1, r2, r3, r4, ip, lr}
  36 0004 1F502DE9 	.LCFI0:
  37              		.loc 1 116 0
 116:main.c        ****    if (time_toggle==0)
  38              	 .L7
  39 0008 54409FE5 		ldr	r3, [r4, #0]
  40 000c 003094E5 		cmp	r3, #0
  41 0010 000053E3 		.loc 1 118 0
 117:main.c        ****    {
 118:main.c        **** 	uart0Puts("\n\rTic\r\n");//Tic Tac output to UART0
  42              		r0, .L7+4
  43 0014 4C009FE5 		.loc 1 116 0
  44              		bne	.L2
  45 0018 0200001A 		.loc 1 118 0
  46              		bl	uart0Puts
  47 001c FEFFFFEB 		.loc 1 119 0
 119:main.c        **** 	time_toggle=1;
  48              	3, #1
  49 0020 0130A0E3 		b	.L6
  50 0024 020000EA 	.L2:
  51              		.loc 1 123 0
 120:main.c        ****    }
 121:main.c        ****    else
 122:main.c        ****    {
 123:main.c        **** 	uart0Puts("\n\rTac\r\n");
  52              		r0, .L7+8
  53 0028 3C009FE5 		bl	uart0Puts
  54 002c FEFFFFEB 		.loc 1 124 0
 124:main.c        **** 	time_toggle=0;
  55              	v	r3, #0
  56 0030 0030A0E3 	.L6:
  57              		str	r3, [r4, #0]
  58 0034 003084E5 		.loc 1 126 0
 125:main.c        **** 	}
 126:main.c        ****    ILR |= 1;     // Clear interrupt flag
  59              		r2, .L7+12
  60 0038 30209FE5 		ldr	r3, [r2, #0]
  61 003c 003092E5 		orr	r3, r3, #1
  62 0040 013083E3 		str	r3, [r2, #0]
  63 0044 003082E5 		.loc 1 127 0
 127:main.c        ****    VICVectAddr = 0;     // Acknowledge Interrupt
  64              	r3, .L7+16
  65 0048 24309FE5 		mov	r2, #0
  66 004c 0020A0E3 		str	r2, [r3, #48]
  67 0050 302083E5 		.loc 1 128 0
 128:main.c        ****    PCON = 1;     // IDLE mode
  68              		r3, .L7+20
  69 0054 1C309FE5 		add	r2, r2, #1
  70 0058 012082E2 		strb	r2, [r3, #192]
  71 005c C020C3E5 		.loc 1 129 0
 129:main.c        **** } 
  72              	fd	sp!, {r0, r1, r2, r3, r4, ip, pc}^
  73 0060 1F90FDE8 	.L8:
  74              		.align	2
  75              	.L7:
  76              		.word	time_toggle
  77 0064 00000000 		.word	.LC0
  78 0068 00000000 		.word	.LC1
  79 006c 08000000 		.word	-536723456
  80 0070 004002E0 		.word	-4096
  81 0074 00F0FFFF 		.word	-534790144
  82 0078 00C01FE0 	.LFE4:
  84              		.align	2
  85              		.global	init_rtc
  87              	init_rtc:
  88              	.LFB5:
  89              		.loc 1 131 0
 130:main.c        **** void init_rtc(void)
 131:main.c        **** {
  90              	nd = 0, frame = 0
  91              		@ frame_needed = 0, uses_anonymous_args = 0
  92              		@ link register save eliminated.
  93              	.LVL1:
  94              		.loc 1 132 0
 132:main.c        ****    ILR = 3;     // Disable 32'768 interrupt
  95              	r3, .L11
  96 007c 38309FE5 		mov	r2, #3
  97 0080 0320A0E3 		str	r2, [r3, #0]
  98 0084 002083E5 		.loc 1 133 0
 133:main.c        ****    CCR = 0x11;     // Clock enable + 32'767Hz quartz enable
  99              		r2, r2, #14
 100 0088 0E2082E2 		add	r3, r3, #8
 101 008c 083083E2 		str	r2, [r3], #4
 102 0090 042083E4 		.loc 1 134 0
 134:main.c        ****    CIIR = 0x01;     // Interupt every second
 103              		r2, #1
 104 0094 0120A0E3 		str	r2, [r3, #0]
 105 0098 002083E5 		.loc 1 135 0
 135:main.c        ****    VICVectAddr1 = (unsigned long)rtc0;     // set interrupt vector in 1
 106              	r	r1, .L11+4
 107 009c 1C109FE5 		ldr	r3, .L11+8
 108 00a0 1C309FE5 		str	r3, [r1, #260]
 109 00a4 043181E5 		.loc 1 136 0
 136:main.c        ****    VICVectCntl1 = 0x0000002D;     // use it for RTC Interrupt
 110              		r3, #45
 111 00a8 2D30A0E3 		str	r3, [r1, #516]
 112 00ac 043281E5 		.loc 1 137 0
 137:main.c        ****    VICIntEnable = 0x00002000;     // Enable RTC Interrupt
 113              	v	r3, #8192
 114 00b0 023AA0E3 		.loc 1 131 0
 115              		@ lr needed for prologue
 116              		.loc 1 137 0
 117              		str	r3, [r1, #16]
 118 00b4 103081E5 		.loc 1 138 0
 138:main.c        **** }       
 119              	
 120 00b8 1EFF2FE1 	.L12:
 121              		.align	2
 122              	.L11:
 123              		.word	-536723456
 124 00bc 004002E0 		.word	-4096
 125 00c0 00F0FFFF 		.word	rtc0
 126 00c4 00000000 	.LFE5:
 128              		.align	2
 129              		.global	set_time
 131              	set_time:
 132              	.LFB6:
 133              		.loc 1 140 0

⌨️ 快捷键说明

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